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>
This commit is contained in:
parent
904b86ade7
commit
e69e13671d
1 changed files with 1 additions and 2 deletions
3
util.c
3
util.c
|
@ -92,6 +92,7 @@ char *ipv6_l4hdr(struct ipv6hdr *ip6h, uint8_t *proto)
|
||||||
nh = ip6h->nexthdr;
|
nh = ip6h->nexthdr;
|
||||||
hdrlen = sizeof(struct ipv6hdr);
|
hdrlen = sizeof(struct ipv6hdr);
|
||||||
} else {
|
} else {
|
||||||
|
o = (struct ipv6_opt_hdr *)(((char *)ip6h) + offset);
|
||||||
nh = o->nexthdr;
|
nh = o->nexthdr;
|
||||||
hdrlen = (o->hdrlen + 1) * 8;
|
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 == 51 || nh == 60 || nh == 135 || nh == 139 ||
|
||||||
nh == 140 || nh == 253 || nh == 254) {
|
nh == 140 || nh == 253 || nh == 254) {
|
||||||
offset += hdrlen;
|
offset += hdrlen;
|
||||||
o = (struct ipv6_opt_hdr *)(unsigned char *)ip6h +
|
|
||||||
offset;
|
|
||||||
} else {
|
} else {
|
||||||
*proto = nh;
|
*proto = nh;
|
||||||
return (char *)(ip6h + 1) + offset;
|
return (char *)(ip6h + 1) + offset;
|
||||||
|
|
Loading…
Reference in a new issue