ipv6: Fix MLD Query message check
Subsystems (3)
PATCH 1/1 ipv6: Fix MLD Query message check
Based on RFC3810 6.2, we also need to check the hop limit and router alert option besides source address.
--- net/ipv6/mcast.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/ipv6/mcast.c +12 -2
@@ -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 ; idev =__in6_dev_get (skb->dev);
Signature · 1 line
1.8.1.4
Hello.
Quoted 20 lines · Hangbin Liu
Based on RFC3810 6.2, we also need to check the hop limit and router alert option besides source address.
Signed-off-by Hangbin Liu <[email protected]>--- net/ipv6/mcast.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)net/ipv6/mcast.c +2
-2@@ -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
net/ipv6/mcast.c int igmp6_event_query(struct sk_buff *skb) · line 1315
Quoted 10 lines
net/ipv6/mcast.c +10
-0+* 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 ))
The continuation lines should start exactly under '!' on the broken up line.
WBR, Sergei
2014-06-24 22:27 GMT+08:00 Sergei Shtylyov <[email protected]>:
Quoted 37 lines
Hello.
Quoted 32 lines · Hangbin Liu
Based on RFC3810 6.2, we also need to check the hop limit and router alert option besides source address.
Signed-off-by Hangbin Liu <[email protected]>--- net/ipv6/mcast.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)net/ipv6/mcast.c +2
-2@@ -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-localnet/ipv6/mcast.c +5
-0+* 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)||
Quoted 8 lines
net/ipv6/mcast.c int igmp6_event_query(struct sk_buff *skb) · line 1315
Quoted 4 lines
net/ipv6/mcast.c +4
-0+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))The continuation lines should start exactly under '!' on the broken up
line.
Ah, thanks for the reminder. I will send a patch v2 later.
Best Regards
Hangbin Liu
Quoted 3 lines
WBR, Sergei