netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: ja@ssi.bg
Cc: shemminger@vyatta.com, netdev@vger.kernel.org
Subject: Re: [BUG] VPN broken in net-next
Date: Wed, 09 Mar 2011 13:28:09 -0800 (PST)	[thread overview]
Message-ID: <20110309.132809.48496992.davem@davemloft.net> (raw)
In-Reply-To: <alpine.LFD.2.00.1103031454060.2113@ja.ssi.bg>

From: Julian Anastasov <ja@ssi.bg>
Date: Thu, 3 Mar 2011 15:09:22 +0200 (EET)

> 	While checking for ifa_address usage I see other
> two places that look suspicious:
> 
> - inet_gifconf() exposes address from ifa_local but then
> devinet_ioctl() matches by ifa_address in the
> 'if (tryaddrmatch)' block. I think, we should use ifa_local.
> 
> - IN_DEV_ARP_NOTIFY: announces ifa_address instead of ifa_local.

Thanks Julian, I'll push the following into net-2.6:

--------------------
ipv4: Fix erroneous uses of ifa_address.

In usual cases ifa_address == ifa_local, but in the case where
SIOCSIFDSTADDR sets the destination address on a point-to-point
link, ifa_address gets set to that destination address.

Therefore we should use ifa_local when we want the local interface
address.

There were two cases where the selection was done incorrectly:

1) When devinet_ioctl() does matching, it checks ifa_address even
   though gifconf correct reported ifa_local to the user

2) IN_DEV_ARP_NOTIFY handling sends a gratuitous ARP using
   ifa_address instead of ifa_local.

Reported-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/ipv4/devinet.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index df4616f..036652c 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -670,7 +670,7 @@ int devinet_ioctl(struct net *net, unsigned int cmd, void __user *arg)
 			     ifap = &ifa->ifa_next) {
 				if (!strcmp(ifr.ifr_name, ifa->ifa_label) &&
 				    sin_orig.sin_addr.s_addr ==
-							ifa->ifa_address) {
+							ifa->ifa_local) {
 					break; /* found */
 				}
 			}
@@ -1040,8 +1040,8 @@ static void inetdev_send_gratuitous_arp(struct net_device *dev,
 		return;
 
 	arp_send(ARPOP_REQUEST, ETH_P_ARP,
-		 ifa->ifa_address, dev,
-		 ifa->ifa_address, NULL,
+		 ifa->ifa_local, dev,
+		 ifa->ifa_local, NULL,
 		 dev->dev_addr, NULL);
 }
 
-- 
1.7.4.1


  parent reply	other threads:[~2011-03-09 21:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03  0:28 [BUG] VPN broken in net-next Stephen Hemminger
2011-03-03  0:41 ` Stephen Hemminger
2011-03-03  0:43   ` David Miller
2011-03-03  0:46     ` Stephen Hemminger
2011-03-03  0:50       ` David Miller
2011-03-03  0:54         ` David Miller
2011-03-03 12:41           ` Julian Anastasov
2011-03-03 13:09             ` Julian Anastasov
2011-03-03 17:32               ` Stephen Hemminger
2011-03-03 19:23               ` David Miller
2011-03-03 21:54                 ` Stephen Hemminger
2011-03-04  8:39                 ` Julian Anastasov
2011-03-23  4:56                   ` David Miller
2011-03-23  9:05                     ` Julian Anastasov
2011-03-23 15:24                     ` Stephen Hemminger
2011-03-09 21:28               ` David Miller [this message]
2011-03-03  0:56         ` Stephen Hemminger
2011-03-03  1:03           ` David Miller
2011-03-03  1:16             ` Stephen Hemminger

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=20110309.132809.48496992.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ja@ssi.bg \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.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).