diff mbox

ipv6: drop packets when source address is multicast

Message ID 4EB93FA6.3090709@hp.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Brian Haley Nov. 8, 2011, 2:41 p.m. UTC
RFC 4291 Section 2.7 says Multicast addresses must not be used as source
addresses in IPv6 packets - drop them on input so we don't process the
packet further.

Signed-off-by: Brian Haley <brian.haley@hp.com>
Reported-and-Tested-by: Kumar Sanghvi <divinekumar@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Nov. 8, 2011, 5:37 p.m. UTC | #1
From: Brian Haley <brian.haley@hp.com>
Date: Tue, 08 Nov 2011 09:41:42 -0500

> RFC 4291 Section 2.7 says Multicast addresses must not be used as source
> addresses in IPv6 packets - drop them on input so we don't process the
> packet further.
> 
> Signed-off-by: Brian Haley <brian.haley@hp.com>
> Reported-and-Tested-by: Kumar Sanghvi <divinekumar@gmail.com>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c
index 027c7ff..a46c64e 100644
--- a/net/ipv6/ip6_input.c
+++ b/net/ipv6/ip6_input.c
@@ -111,6 +111,14 @@  int ipv6_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt
 	    ipv6_addr_loopback(&hdr->daddr))
 		goto err;
 
+	/*
+	 * RFC4291 2.7
+	 * Multicast addresses must not be used as source addresses in IPv6
+	 * packets or appear in any Routing header.
+	 */
+	if (ipv6_addr_is_multicast(&hdr->saddr))
+		goto err;
+
 	skb->transport_header = skb->network_header + sizeof(*hdr);
 	IP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);