netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: John Dykstra <john.dykstra1@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Chia-chi Yeh <chiachi@android.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] net: Keep interface binding when sending packets with ipi_ifindex = 0
Date: Wed, 29 Jul 2009 19:10:21 -0500	[thread overview]
Message-ID: <1248912621.13447.12.camel@merlyn> (raw)
In-Reply-To: <20090727144402.513369f1.akpm@linux-foundation.org>

On Mon, 2009-07-27 at 14:44 -0700, Andrew Morton wrote:
> (cc netdev)
> 
> On Thu, 23 Jul 2009 14:39:28 -0700
> Chia-chi Yeh (_________) <chiachi@android.com> wrote:
> 
> > In IPv4, sending a packet with ipi_ifindex = 0 via an interface-bound
> > socket will unbind the packet to that interface. This behavior is
> > different from IPv6 which treats ipi6_ifindex = 0 as unspecified.
> > Furthermore, IPv6 does not allow sending packets to other interface
> > than the bound one, but I am not sure if it is necessary in IPv4. The
> > following patch keeps the interface binding when ipi_ifindex = 0.
> > 
> > Thanks,
> > Chia-chi
> > 
> > --- a/net/ipv4/ip_sockglue.c	2009-07-24 04:50:45.000000000 +0800
> > +++ b/net/ipv4/ip_sockglue.c	2009-07-24 04:51:09.000000000 +0800
> > @@ -213,7 +213,8 @@
> >  			if (cmsg->cmsg_len != CMSG_LEN(sizeof(struct in_pktinfo)))
> >  				return -EINVAL;
> >  			info = (struct in_pktinfo *)CMSG_DATA(cmsg);
> > -			ipc->oif = info->ipi_ifindex;
> > +			if (info->ipi_ifindex)
> > +				ipc->oif = info->ipi_ifindex;
> >  			ipc->addr = info->ipi_spec_dst.s_addr;
> >  			break;
> >  		}

A convenient copy of the man page says "When ipi_ifindex is not zero the
primary local address of the interface specified by the index overwrites
ipi_spec_dst for the routing table lookup."

But this is changing API behavior that's been this way since at least
the beginning of git history.

I guess Dave's letting this stand.  I'm posting this just to make sure
this is an explicit decision.

--
John

  reply	other threads:[~2009-07-30  0:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <6c039e090907231439t1def08a4n10978733bee55bec@mail.gmail.com>
2009-07-27 21:44 ` [PATCH] net: Keep interface binding when sending packets with ipi_ifindex = 0 Andrew Morton
2009-07-30  0:10   ` John Dykstra [this message]
2009-08-04  4:23     ` David Miller
2009-08-04  7:36       ` Chia-chi Yeh (葉家齊)
2009-08-04  7:57         ` Badalian Vyacheslav
2009-08-04  8:28           ` Chia-chi Yeh (葉家齊)
2009-08-04 18:57         ` David Miller
2009-08-05  0:06           ` Chia-chi Yeh (葉家齊)
2009-08-05  2:33             ` David Miller

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=1248912621.13447.12.camel@merlyn \
    --to=john.dykstra1@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chiachi@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --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).