aboutgitcodebugslistschat
path: root/util.c
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-09-27 01:25:19 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-09-27 01:28:09 +0200
commite69e13671dcbf3b6964e7bd9d485f267c5fa03cb (patch)
tree5055cd2f2eecaef412bc37cd335a5c2a80bfad89 /util.c
parent904b86ade7dba15f74cebde7d351920a76a82d2a (diff)
downloadpasst-e69e13671dcbf3b6964e7bd9d485f267c5fa03cb.tar
passt-e69e13671dcbf3b6964e7bd9d485f267c5fa03cb.tar.gz
passt-e69e13671dcbf3b6964e7bd9d485f267c5fa03cb.tar.bz2
passt-e69e13671dcbf3b6964e7bd9d485f267c5fa03cb.tar.lz
passt-e69e13671dcbf3b6964e7bd9d485f267c5fa03cb.tar.xz
passt-e69e13671dcbf3b6964e7bd9d485f267c5fa03cb.tar.zst
passt-e69e13671dcbf3b6964e7bd9d485f267c5fa03cb.zip
util: Fix parsing of next option in ipv6_l4hdr()
We need to update next header and header length as soon as we meet a new option header. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'util.c')
-rw-r--r--util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/util.c b/util.c
index 6ce7c9a..285c0b6 100644
--- a/util.c
+++ b/util.c
@@ -92,6 +92,7 @@ char *ipv6_l4hdr(struct ipv6hdr *ip6h, uint8_t *proto)
nh = ip6h->nexthdr;
hdrlen = sizeof(struct ipv6hdr);
} else {
+ o = (struct ipv6_opt_hdr *)(((char *)ip6h) + offset);
nh = o->nexthdr;
hdrlen = (o->hdrlen + 1) * 8;
}
@@ -103,8 +104,6 @@ char *ipv6_l4hdr(struct ipv6hdr *ip6h, uint8_t *proto)
nh == 51 || nh == 60 || nh == 135 || nh == 139 ||
nh == 140 || nh == 253 || nh == 254) {
offset += hdrlen;
- o = (struct ipv6_opt_hdr *)(unsigned char *)ip6h +
- offset;
} else {
*proto = nh;
return (char *)(ip6h + 1) + offset;