From: David Miller <davem@davemloft.net>
To: liuhangbin@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH v2 net] ipv6: Fix MLD Query message check
Date: Thu, 26 Jun 2014 17:33:41 -0700 (PDT) [thread overview]
Message-ID: <20140626.173341.1309075773440112452.davem@davemloft.net> (raw)
In-Reply-To: <1403659867-8323-1-git-send-email-liuhangbin@gmail.com>
From: Hangbin Liu <liuhangbin@gmail.com>
Date: Wed, 25 Jun 2014 09:31:07 +0800
> @@ -1301,8 +1301,18 @@ int igmp6_event_query(struct sk_buff *skb)
> len = ntohs(ipv6_hdr(skb)->payload_len) + sizeof(struct ipv6hdr);
> len -= skb_network_header_len(skb);
>
> - /* Drop queries with not link local source */
> - if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL))
> + /* RFC3810 6.2
> + * Upon reception of an MLD message that contains a Query, the node
> + * checks if the source address of the message is a valid link-local
> + * address, if the Hop Limit is set to 1, and if the Router Alert
> + * option is present in the Hop-By-Hop Options header of the IPv6
> + * packet. If any of these checks fails, the packet is dropped.
> + */
> + if (!(ipv6_addr_type(&ipv6_hdr(skb)->saddr) & IPV6_ADDR_LINKLOCAL) ||
> + ipv6_hdr(skb)->hop_limit != 1 ||
> + ipv6_hdr(skb)->nexthdr != NEXTHDR_HOP ||
> + !(IP6CB(skb)->flags & IP6SKB_ROUTERALERT) ||
> + IP6CB(skb)->ra != htons(IPV6_OPT_ROUTERALERT_MLD))
> return -EINVAL;
>
Does the NEXTHDR_HOP have the be exactly the next extension header
present? I think you need to allow for more flexibility here.
In any event, the only way the IP6SKB_ROUTERALERT bit can be set
is if there were hop-by-hop options present, so testing only the
bit itself is sufficient.
The forwarding path simplifies the check in this way too.
So please adjust this to only check the bit and remove the NEXTHDR_HOP
test.
Thanks.
next prev parent reply other threads:[~2014-06-27 0:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-25 1:31 [PATCH v2 net] ipv6: Fix MLD Query message check Hangbin Liu
2014-06-27 0:33 ` David Miller [this message]
2014-06-27 1:56 ` Hangbin Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140626.173341.1309075773440112452.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=liuhangbin@gmail.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).