From eb05aab5fd1ea97dcac4c9c0af221beebfc5bc05 Mon Sep 17 00:00:00 2001 From: David Stevens Date: Fri, 21 Nov 2003 00:49:32 -0800 Subject: [PATCH] [IPV6]: Fix header length calculation in multicast input. It did not account for extension headers properly. If we get this length wrong, we do not determine if a multicast packet is MLDv1 vs. MLDv2 correctly. --- net/ipv6/mcast.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 883bf65c3ae54..af95ae08ff0d6 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c @@ -1017,7 +1017,9 @@ int igmp6_event_query(struct sk_buff *skb) if (!pskb_may_pull(skb, sizeof(struct in6_addr))) return -EINVAL; - len = ntohs(skb->nh.ipv6h->payload_len); + /* compute payload length excluding extension headers */ + len = ntohs(skb->nh.ipv6h->payload_len) + sizeof(struct ipv6hdr); + len -= (char *)skb->h.raw - (char *)skb->nh.ipv6h; /* Drop queries with not link local source */ if (!(ipv6_addr_type(&skb->nh.ipv6h->saddr)&IPV6_ADDR_LINKLOCAL)) -- 2.53.0