Skip to content

Commit

Permalink
ipv6: drop packets when source address is multicast
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Brian Haley authored and David S. Miller committed Nov 8, 2011
1 parent 10953db commit c457338
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions net/ipv6/ip6_input.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit c457338

Please sign in to comment.