netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Timo Teräs" <timo.teras@iki.fi>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: netdev@vger.kernel.org, Doug Kehn <rdkehn@yahoo.com>
Subject: Re: [PATCH] net: gre: provide multicast mappings for ipv4 and ipv6
Date: Tue, 29 Mar 2011 13:00:32 +0300	[thread overview]
Message-ID: <4D91ADC0.9090400@iki.fi> (raw)
In-Reply-To: <1301389905.3161.3.camel@edumazet-laptop>

On 03/29/2011 12:11 PM, Eric Dumazet wrote:
> Le mardi 29 mars 2011 à 11:40 +0300, Timo Teräs a écrit :
>> My commit 6d55cb91a0020ac0 (gre: fix hard header destination
>> address checking) broke multicast.
>>
>> The reason is that ip_gre used to get ipgre_header() calls with
>> zero destination if we have NOARP or multicast destination. Instead
>> the actual target was decided at ipgre_tunnel_xmit() time based on
>> per-protocol dissection.
>>
>> Instead of allowing the "abuse" of ->header() calls with invalid
>> destination, this creates multicast mappings for ip_gre. This also
>> fixes "ip neigh show nud noarp" to display the proper multicast
>> mappings used by the gre device.
>>
>> Reported-by: Doug Kehn <rdkehn@yahoo.com>
>> Signed-off-by: Timo Teräs <timo.teras@iki.fi>
>> ---
>> Compile tested only. Doug tested IPv4 side with the earlier patch.
> 
> 
>> +static inline int ipv6_ipgre_mc_map(const struct in6_addr *addr,
>> +				    const unsigned char *broadcast, char *buf)
>> +{
>> +	if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0) {
>> +		memcpy(buf, broadcast, 4);
>> +	} else {
>> +		/* v4mapped? */
>> +		if ((addr->s6_addr32[0] | addr->s6_addr32[1] |
>> +		     (addr->s6_addr32[2] ^ htonl(0x0000ffff))) != 0)
>> +			return -EINVAL;
> 
> 		if (ipv6_addr_v4mapped(addr))
> 
> 
>> +		memcpy(buf, &addr->s6_addr32[3], 4);
>> +	}
>> +	return 0;
>> +}

I wanted to put the function same header as all other similar ones:
net/if_inet6.h. However, ipv6_addr_v4mapped() is defined in net/ipv6.h
which includes net/if_inet6.h. So I can't really use that function there.


  reply	other threads:[~2011-03-29 10:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-14 23:34 Multicast Fails Over Multipoint GRE Tunnel Doug Kehn
2011-03-15 15:34 ` Eric Dumazet
2011-03-15 16:36   ` Timo Teräs
2011-03-15 18:28     ` Timo Teräs
2011-03-15 21:33     ` Doug Kehn
2011-03-15 21:35     ` Doug Kehn
2011-03-16  6:01       ` Timo Teräs
2011-03-16 20:02         ` Doug Kehn
2011-03-27 16:17           ` Timo Teräs
2011-03-29  8:40             ` [PATCH] net: gre: provide multicast mappings for ipv4 and ipv6 Timo Teräs
2011-03-29  9:11               ` Eric Dumazet
2011-03-29 10:00                 ` Timo Teräs [this message]
2011-03-29 20:26               ` Doug Kehn
2011-03-30  7:11                 ` David Miller
2011-03-15 21:24   ` Multicast Fails Over Multipoint GRE Tunnel Doug Kehn

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=4D91ADC0.9090400@iki.fi \
    --to=timo.teras@iki.fi \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=rdkehn@yahoo.com \
    /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).