From: Willy Tarreau <willy@w.ods.org>
To: "David S. Miller" <davem@redhat.com>
Cc: linux-kernel@vger.kernel.org, netdev@oss.sgi.com
Subject: Re: [RFC][2.4 PATCH] source address selection for ARP requests
Date: Thu, 21 Aug 2003 00:27:10 +0200 [thread overview]
Message-ID: <20030820222710.GC734@alpha.home.local> (raw)
In-Reply-To: <20030820144711.13ea5f38.davem@redhat.com>
On Wed, Aug 20, 2003 at 02:47:11PM -0700, David S. Miller wrote:
> On Wed, 20 Aug 2003 23:34:43 +0200
> Willy Tarreau <willy@w.ods.org> wrote:
>
> > + if (in_dev == NULL)
> > + return;
>
> A NULL in_dev is what you'll see if no addresses are
> assigned to the interface, therefore you must treat
> this case similarly.
OK, that's fine. It is what I wanted to test with in_dev->ifa_list==NULL. I
don't know if I must keep the test or not (anyway, it doesn't hurt, this isn't
a fast path).
Better this way ?
Cheers,
Willy
--------
patch 1 :
diff -urN linux-2.4.22-rc2/net/ipv4/arp.c linux-2.4.22-rc2-arp/net/ipv4/arp.c
--- linux-2.4.22-rc2/net/ipv4/arp.c Fri Aug 1 23:06:29 2003
+++ linux-2.4.22-rc2-arp/net/ipv4/arp.c Thu Aug 21 00:20:19 2003
@@ -320,13 +320,20 @@
u32 saddr;
u8 *dst_ha = NULL;
struct net_device *dev = neigh->dev;
+ struct in_device *in_dev = in_dev_get(dev);
u32 target = *(u32*)neigh->primary_key;
int probes = atomic_read(&neigh->probes);
- if (skb && inet_addr_type(skb->nh.iph->saddr) == RTN_LOCAL)
+ if (in_dev == NULL || in_dev->ifa_list == NULL ||
+ (skb && inet_addr_type(skb->nh.iph->saddr) == RTN_LOCAL &&
+ (IN_DEV_SHARED_MEDIA(in_dev) ||
+ inet_addr_onlink(in_dev, skb->nh.iph->saddr, 0))))
saddr = skb->nh.iph->saddr;
else
saddr = inet_select_addr(dev, target, RT_SCOPE_LINK);
+
+ if (in_dev == NULL)
+ in_dev_put(in_dev);
if ((probes -= neigh->parms->ucast_probes) < 0) {
if (!(neigh->nud_state&NUD_VALID))
---------
patch 2 :
diff -urN linux-2.4.22-rc2/net/ipv4/arp.c linux-2.4.22-rc2-arp2/net/ipv4/arp.c
--- linux-2.4.22-rc2/net/ipv4/arp.c Fri Aug 1 23:06:29 2003
+++ linux-2.4.22-rc2-arp2/net/ipv4/arp.c Thu Aug 21 00:24:25 2003
@@ -320,13 +320,19 @@
u32 saddr;
u8 *dst_ha = NULL;
struct net_device *dev = neigh->dev;
+ struct in_device *in_dev = in_dev_get(dev);
u32 target = *(u32*)neigh->primary_key;
int probes = atomic_read(&neigh->probes);
- if (skb && inet_addr_type(skb->nh.iph->saddr) == RTN_LOCAL)
- saddr = skb->nh.iph->saddr;
+ if (skb && inet_addr_type(skb->nh.iph->saddr) == RTN_LOCAL &&
+ (in_dev == NULL || IN_DEV_SHARED_MEDIA(in_dev) ||
+ (saddr = inet_select_addr(dev, target, RT_SCOPE_LINK)) == 0))
+ saddr = skb->nh.iph->saddr;
else
saddr = inet_select_addr(dev, target, RT_SCOPE_LINK);
+
+ if (in_dev == NULL)
+ in_dev_put(in_dev);
if ((probes -= neigh->parms->ucast_probes) < 0) {
if (!(neigh->nud_state&NUD_VALID))
next prev parent reply other threads:[~2003-08-20 22:29 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-19 12:02 [2.4 PATCH] bugfix: ARP respond on all devices Richard Underwood
2003-08-19 12:35 ` Alan Cox
2003-08-19 18:30 ` Daniel Gryniewicz
2003-08-19 18:29 ` David S. Miller
2003-08-19 19:12 ` Daniel Gryniewicz
2003-08-19 19:10 ` David S. Miller
2003-08-20 16:49 ` Bill Davidsen
2003-08-20 17:00 ` David S. Miller
2003-08-20 17:44 ` Ben Greear
2003-08-20 17:48 ` David S. Miller
2003-08-20 21:34 ` [RFC][2.4 PATCH] source address selection for ARP requests Willy Tarreau
2003-08-20 21:47 ` David S. Miller
2003-08-20 22:27 ` Willy Tarreau [this message]
2003-08-20 22:35 ` David S. Miller
2003-08-20 22:59 ` Willy Tarreau
2003-08-20 23:18 ` [2.4 PATCH] bugfix: ARP respond on all devices Julian Anastasov
2003-08-23 20:50 ` Bill Davidsen
2003-08-20 19:08 ` Bill Davidsen
2003-08-20 20:07 ` Bas Bloemsaat
2003-08-19 19:17 ` Discussion fucking closed WAS(Re: " jamal
2003-08-19 19:42 ` bill davidsen
2003-08-20 5:31 ` ARP and knowledge of IP addresses [Re: [2.4 PATCH] bugfix: ARP respond on all devices] Pekka Savola
2003-08-19 13:11 ` [2.4 PATCH] bugfix: ARP respond on all devices Bas Bloemsaat
2003-08-19 15:34 ` David S. Miller
2003-08-19 17:39 ` Lars Marowsky-Bree
2003-08-19 17:36 ` David S. Miller
2003-08-19 21:01 ` Harley Stenzel
2003-08-19 16:19 ` Stephan von Krawczynski
2003-08-19 16:54 ` David S. Miller
2003-08-19 17:15 ` Stephan von Krawczynski
2003-08-19 16:56 ` David S. Miller
2003-08-20 5:18 ` host vs interface address ownership [Re: [2.4 PATCH] bugfix: ARP respond on all devices] Pekka Savola
2003-08-20 5:38 ` Valdis.Kletnieks
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=20030820222710.GC734@alpha.home.local \
--to=willy@w.ods.org \
--cc=davem@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@oss.sgi.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).