From: Kumar Sanghvi <divinekumar@gmail.com>
To: Brian Haley <brian.haley@hp.com>
Cc: netdev@vger.kernel.org
Subject: Re: Query on usage of multicast as source IPv6 address
Date: Tue, 8 Nov 2011 10:05:47 +0530 [thread overview]
Message-ID: <20111108043546.GA2581@kumar> (raw)
In-Reply-To: <4EB88FCC.9000509@hp.com>
Hi Brian,
On Mon, Nov 07, 2011 at 21:11:24 -0500, Brian Haley wrote:
> On 11/07/2011 03:45 PM, Kumar Sanghvi wrote:
> > Hi,
> >
> > I am trying to understand IPv6 behavior in Linux.
> > And I have a doubt related to use of multicast address
> > as source address.
> >
> > RFC 4291 in Section 2.7 states that:
> > "Multicast addresses must not be used as source addresses
> > in IPv6 packets or appear in any Routing header."
> >
> > However, what should be the behavior if a host receives a
> > packet (probably from a malicious host with pktgen abilities)
> > having a multicast address in source address field:
> > 1) Should the receiving host discard the packet?
>
> I believe other *nixes silently drop it, can you try this patch?
>
> -Brian
>
> 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);
>
Tested this patch on 3.1 kernel.
The patch works fine and now, Linux no longer sends a response
to multicast address.
Thanks Brian for the patch!
Reported-and-Tested-by: Kumar Sanghvi <divinekumar@gmail.com>
Thanks,
Kumar.
prev parent reply other threads:[~2011-11-08 4:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-07 20:45 Query on usage of multicast as source IPv6 address Kumar Sanghvi
2011-11-07 21:11 ` Stephen Hemminger
2011-11-07 21:20 ` Kumar Sanghvi
2011-11-08 2:11 ` Brian Haley
2011-11-08 4:35 ` Kumar Sanghvi [this message]
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=20111108043546.GA2581@kumar \
--to=divinekumar@gmail.com \
--cc=brian.haley@hp.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).