public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxim Levitsky <maximlevitsky@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: linux1394-devel <linux1394-devel@lists.sourceforge.net>,
	Stefan Richter <stefanr@s5r6.in-berlin.de>,
	netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	James Morris <jmorris@namei.org>,
	Patrick McHardy <kaber@trash.net>
Subject: Re: [PATCH 3/5] NET: IPV4: ARP: allow to invalidate specific ARP entries
Date: Sun, 09 Jan 2011 01:57:12 +0200	[thread overview]
Message-ID: <1294531032.25396.11.camel@maxim-laptop> (raw)
In-Reply-To: <1294405062.3306.11.camel@edumazet-laptop>

On Fri, 2011-01-07 at 13:57 +0100, Eric Dumazet wrote:
> Le vendredi 07 janvier 2011 à 14:47 +0200, Maxim Levitsky a écrit :
> > On Mon, 2010-11-29 at 04:09 +0200, Maxim Levitsky wrote:
> > > IPv4 over firewire needs to be able to remove ARP entries
> > > from the ARP cache that belong to nodes that are removed, because
> > > IPv4 over firewire uses ARP packets for private information
> > > about nodes.
> > > 
> > > This information becomes invalid as soon as node drops
> > > off the bus and when it reconnects, its only possible
> > > to start takling to is after it responded to an ARP packet.
> > > But ARP cache prevents such packets from being sent.
> > > 
> > > CC: netdev@vger.kernel.org
> > > CC: "David S. Miller" <davem@davemloft.net>
> > > CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
> > > CC: James Morris <jmorris@namei.org>
> > > CC: Patrick McHardy <kaber@trash.net>
> > 
> > Anybody?
> > 
> > Best regards,
> > 	Maxim Levitsky
> > 
> > > 
> > > 
> > > Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
> > > ---
> > >  include/net/arp.h |    1 +
> > >  net/ipv4/arp.c    |   29 ++++++++++++++++++-----------
> > >  2 files changed, 19 insertions(+), 11 deletions(-)
> > > 
> > > diff --git a/include/net/arp.h b/include/net/arp.h
> > > index f4cf6ce..91f0568 100644
> > > --- a/include/net/arp.h
> > > +++ b/include/net/arp.h
> > > @@ -25,5 +25,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
> > >  				  const unsigned char *src_hw,
> > >  				  const unsigned char *target_hw);
> > >  extern void arp_xmit(struct sk_buff *skb);
> > > +int arp_invalidate(struct net_device *dev, __be32 ip);
> > >  
> > >  #endif	/* _ARP_H */
> > > diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
> > > index d8e540c..35b1272 100644
> > > --- a/net/ipv4/arp.c
> > > +++ b/net/ipv4/arp.c
> > > @@ -1142,6 +1142,23 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev)
> > >  	return err;
> > >  }
> > >  
> > > +int arp_invalidate(struct net_device *dev, __be32 ip)
> > > +{
> > > +	int err = -ENXIO;
> > > +	struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev);
> > > +
> > > +	if (neigh) {
> > > +		if (neigh->nud_state & ~NUD_NOARP)
> > > +			err = neigh_update(neigh, NULL, NUD_FAILED,
> > > +					   NEIGH_UPDATE_F_OVERRIDE|
> > > +					   NEIGH_UPDATE_F_ADMIN);
> > > +		neigh_release(neigh);
> > > +	}
> > > +
> > > +	return err;
> > > +}
> > > +EXPORT_SYMBOL(arp_invalidate);
> > > +
> > >  static int arp_req_delete_public(struct net *net, struct arpreq *r,
> > >  		struct net_device *dev)
> > >  {
> > > @@ -1162,7 +1179,6 @@ static int arp_req_delete(struct net *net, struct arpreq *r,
> > >  {
> > >  	int err;
> > >  	__be32 ip;
> > > -	struct neighbour *neigh;
> > >  
> > >  	if (r->arp_flags & ATF_PUBL)
> > >  		return arp_req_delete_public(net, r, dev);
> > > @@ -1180,16 +1196,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r,
> > >  		if (!dev)
> > >  			return -EINVAL;
> > >  	}
> > > -	err = -ENXIO;
> > > -	neigh = neigh_lookup(&arp_tbl, &ip, dev);
> > > -	if (neigh) {
> > > -		if (neigh->nud_state & ~NUD_NOARP)
> > > -			err = neigh_update(neigh, NULL, NUD_FAILED,
> > > -					   NEIGH_UPDATE_F_OVERRIDE|
> > > -					   NEIGH_UPDATE_F_ADMIN);
> > > -		neigh_release(neigh);
> > > -	}
> > > -	return err;
> > > +	return arp_invalidate(dev, ip);
> > >  }
> > >  
> > >  /*
> > 
> 
> Hi Maxim
> 
> You were supposed to respin your patch after my commit :
> 
> (941666c2e3e0f9f6a1 net: RCU conversion of dev_getbyhwaddr() and
> arp_ioctl())
> 
> Thanks

Hi,

After looking at the code (and honestly its hard to work with it as it
has no documentation at all), I think I don't need any changes in my
patch.

Here is the latest version for I use with the above commit applied (it
is in mainline now).

---

commit 7da91d68d78b6a44ba6337be3b29b22ba2909b9e
Author: Maxim Levitsky <maximlevitsky@gmail.com>
Date:   Sat Nov 27 00:50:45 2010 +0200

    NET: IPV4: ARP: allow to invalidate specific ARP entries
    
    IPv4 over firewire needs to be able to remove ARP entries
    from the ARP cache that belong to nodes that are removed, because
    IPv4 over firewire uses ARP packets for private information
    about nodes.
    
    This information becomes invalid as soon as node drops
    off the bus and when it reconnects, its only possible
    to start takling to is after it responded to an ARP packet.
    But ARP cache prevents such packets from being sent.
    
    CC: netdev@vger.kernel.org
    CC: "David S. Miller" <davem@davemloft.net>
    CC: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
    CC: James Morris <jmorris@namei.org>
    CC: Patrick McHardy <kaber@trash.net>
    
    
    Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>

diff --git a/include/net/arp.h b/include/net/arp.h
index f4cf6ce..91f0568 100644
--- a/include/net/arp.h
+++ b/include/net/arp.h
@@ -25,5 +25,6 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip,
 				  const unsigned char *src_hw,
 				  const unsigned char *target_hw);
 extern void arp_xmit(struct sk_buff *skb);
+int arp_invalidate(struct net_device *dev, __be32 ip);
 
 #endif	/* _ARP_H */
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index a2fc7b9..e941c75 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -1143,6 +1143,23 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev)
 	return err;
 }
 
+int arp_invalidate(struct net_device *dev, __be32 ip)
+{
+	int err = -ENXIO;
+	struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev);
+
+	if (neigh) {
+		if (neigh->nud_state & ~NUD_NOARP)
+			err = neigh_update(neigh, NULL, NUD_FAILED,
+					   NEIGH_UPDATE_F_OVERRIDE|
+					   NEIGH_UPDATE_F_ADMIN);
+		neigh_release(neigh);
+	}
+
+	return err;
+}
+EXPORT_SYMBOL(arp_invalidate);
+
 static int arp_req_delete_public(struct net *net, struct arpreq *r,
 		struct net_device *dev)
 {
@@ -1163,7 +1180,6 @@ static int arp_req_delete(struct net *net, struct arpreq *r,
 {
 	int err;
 	__be32 ip;
-	struct neighbour *neigh;
 
 	if (r->arp_flags & ATF_PUBL)
 		return arp_req_delete_public(net, r, dev);
@@ -1181,16 +1197,7 @@ static int arp_req_delete(struct net *net, struct arpreq *r,
 		if (!dev)
 			return -EINVAL;
 	}
-	err = -ENXIO;
-	neigh = neigh_lookup(&arp_tbl, &ip, dev);
-	if (neigh) {
-		if (neigh->nud_state & ~NUD_NOARP)
-			err = neigh_update(neigh, NULL, NUD_FAILED,
-					   NEIGH_UPDATE_F_OVERRIDE|
-					   NEIGH_UPDATE_F_ADMIN);
-		neigh_release(neigh);
-	}
-	return err;
+	return arp_invalidate(dev, ip);
 }
 
 /*





  parent reply	other threads:[~2011-01-08 23:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-29  2:09 [PATCH 0/5 V2] Firewire networking assorted fixes Maxim Levitsky
2010-11-29  2:09 ` [PATCH 1/5] firewire: ohci: restore GUID on resume Maxim Levitsky
2010-11-29  2:09 ` [PATCH 2/5] firewire: ohci: restart ISO DMA contexts on resume from low power mode Maxim Levitsky
2010-11-29  2:09 ` [PATCH 3/5] NET: IPV4: ARP: allow to invalidate specific ARP entries Maxim Levitsky
2010-12-04 23:15   ` Maxim Levitsky
2010-12-05  8:19     ` Eric Dumazet
2010-12-05 11:23       ` [PATCH] net: RCU conversion of dev_getbyhwaddr() and arp_ioctl() Eric Dumazet
2010-12-05 12:03         ` [PATCH net-2.6] llc: fix a device refcount imbalance Eric Dumazet
2010-12-08 17:59           ` David Miller
2010-12-09  3:46             ` Maxim Levitsky
2010-12-16 21:49               ` Maxim Levitsky
2010-12-08 18:05         ` [PATCH] net: RCU conversion of dev_getbyhwaddr() and arp_ioctl() David Miller
2010-12-08 18:07           ` Eric Dumazet
2010-12-08 18:10             ` David Miller
2010-12-08 18:11               ` Eric Dumazet
2011-01-07 12:47   ` [PATCH 3/5] NET: IPV4: ARP: allow to invalidate specific ARP entries Maxim Levitsky
2011-01-07 12:57     ` Eric Dumazet
2011-01-07 13:15       ` Maxim Levitsky
2011-01-08 23:57       ` Maxim Levitsky [this message]
2011-01-11  0:11         ` David Miller
2010-11-29  2:09 ` [PATCH 4/5] firewire: net: invalidate ARP entries of removed nodes Maxim Levitsky
2010-11-29  2:09 ` [PATCH 5/5] firewire: net: ratelimit error messages Maxim Levitsky
2010-11-29 15:02 ` [PATCH 0/5 V2] Firewire networking assorted fixes Stefan Richter
2010-12-04 23:14 ` Maxim Levitsky
2010-12-08  3:32 ` Maxim Levitsky
2010-12-09  1:42   ` Maxim Levitsky
     [not found]   ` <20101208040559.20639.qmail@stuge.se>
     [not found]     ` <1291809485.5421.0.camel@maxim-laptop>
2010-12-12 17:09       ` [PATCH update] firewire: net: add carrier detection Stefan Richter
2010-12-12 23:05         ` Ben Hutchings
2010-12-13  0:46           ` [PATCH update 2] " Stefan Richter
2010-12-13 23:01             ` [PATCH update 3] " Stefan Richter
2010-12-14 23:46               ` Maxim Levitsky
2010-12-16  1:17               ` Dan Williams

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=1294531032.25396.11.camel@maxim-laptop \
    --to=maximlevitsky@gmail.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jmorris@namei.org \
    --cc=kaber@trash.net \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=netdev@vger.kernel.org \
    --cc=stefanr@s5r6.in-berlin.de \
    /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