public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Badalian Vyacheslav <slavon@bigtelecom.ru>
To: "\"Chia-chi Yeh (葉家齊)\"" <chiachi@android.com>
Cc: David Miller <davem@davemloft.net>,
	john.dykstra1@gmail.com, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH] net: Keep interface binding when sending packets with ipi_ifindex = 0
Date: Tue, 04 Aug 2009 11:57:46 +0400	[thread overview]
Message-ID: <4A77E9FA.7030503@bigtelecom.ru> (raw)
In-Reply-To: <6c039e090908040036j38666152y2db1d4c55529eaff@mail.gmail.com>

Chia-chi Yeh (葉家齊) пишет:
> After thinking more deeply, I believe that IPv6 does the right thing
> and IPv4 does not. SO_BINDTODEVICE requires CAP_NET_RAW, so it is a
> privileged operation. Therefore, it looks weird to me if one can
> specify other interface than the bound one without the same
> capability. The following patch makes the behavior in IPv4 and IPv6
> identical. Thanks for your help.
> 
> Chia-chi
> 
> --- a/net/ipv4/ip_sockglue.c    2009-08-04 15:11:39.000000000 +0800
> +++ b/net/ipv4/ip_sockglue.c    2009-08-04 15:17:05.000000000 +0800
> @@ -213,7 +213,11 @@
>                         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) {
> +                               if (ipc->oif && info->ipi_ifindex != ipc->oif)
> +                                       return -EINVAL;
> +                               ipc->oif = info->ipi_ifindex;

Hello
Sorry if its my mistake or i someone not understand :)

if (ipc->oif && info->ipi_ifindex != ipc->oif)
	// if match: info->ipi_ifindex != ipc->oif
	return ...
else
	// else match: info->ipi_ifindex == ipc->oif
	// but you do 
	ipc->oif = info->ipi_ifindex; 
	// why if you else match allready check for it?

Thanks



> +                       }
>                         ipc->addr = info->ipi_spec_dst.s_addr;
>                         break;
>                 }
> 
> On Tue, Aug 4, 2009 at 12:23 PM, David Miller<davem@davemloft.net> wrote:
>> From: John Dykstra <john.dykstra1@gmail.com>
>> Date: Wed, 29 Jul 2009 19:10:21 -0500
>>
>>> I guess Dave's letting this stand.  I'm posting this just to make sure
>>> this is an explicit decision.
>> I'm still thinking about this.
>>
> --
> 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
> 
> 


  reply	other threads:[~2009-08-04  8:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-23 21:39 [PATCH] net: Keep interface binding when sending packets with ipi_ifindex = 0 Chia-chi Yeh (葉家齊)
2009-07-27 21:44 ` Andrew Morton
2009-07-30  0:10   ` John Dykstra
2009-08-04  4:23     ` David Miller
2009-08-04  7:36       ` Chia-chi Yeh (葉家齊)
2009-08-04  7:57         ` Badalian Vyacheslav [this message]
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=4A77E9FA.7030503@bigtelecom.ru \
    --to=slavon@bigtelecom.ru \
    --cc=akpm@linux-foundation.org \
    --cc=chiachi@android.com \
    --cc=davem@davemloft.net \
    --cc=john.dykstra1@gmail.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