netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-2.6.25 3/3][ARP] Consolidate some code in arp_req_set/delete_publc
@ 2007-12-05 17:18 Pavel Emelyanov
  2007-12-06  5:21 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Emelyanov @ 2007-12-05 17:18 UTC (permalink / raw)
  To: David Miller; +Cc: Linux Netdev List, devel

The PROXY_ARP is set on devconfigs in a similar way in
both calls.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

---

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 0a3f00c..ccd36fa 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -953,6 +953,19 @@ out_of_mem:
  *	Set (create) an ARP cache entry.
  */
 
+static int arp_req_set_proxy(struct net_device *dev, int on)
+{
+	if (dev == NULL) {
+		IPV4_DEVCONF_ALL(PROXY_ARP) = on;
+		return 0;
+	}
+	if (__in_dev_get_rtnl(dev)) {
+		IN_DEV_CONF_SET(__in_dev_get_rtnl(dev), PROXY_ARP, on);
+		return 0;
+	}
+	return -ENXIO;
+}
+
 static int arp_req_set_public(struct arpreq *r, struct net_device *dev)
 {
 	__be32 ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
@@ -971,15 +984,8 @@ static int arp_req_set_public(struct arpreq *r, struct net_device *dev)
 			return -ENOBUFS;
 		return 0;
 	}
-	if (dev == NULL) {
-		IPV4_DEVCONF_ALL(PROXY_ARP) = 1;
-		return 0;
-	}
-	if (__in_dev_get_rtnl(dev)) {
-		IN_DEV_CONF_SET(__in_dev_get_rtnl(dev), PROXY_ARP, 1);
-		return 0;
-	}
-	return -ENXIO;
+
+	return arp_req_set_proxy(dev, 1);
 }
 
 static int arp_req_set(struct arpreq *r, struct net_device * dev)
@@ -1083,19 +1089,10 @@ static int arp_req_delete_public(struct arpreq *r, struct net_device *dev)
 	if (mask == htonl(0xFFFFFFFF))
 		return pneigh_delete(&arp_tbl, &ip, dev);
 
-	if (mask == 0) {
-		if (dev == NULL) {
-			IPV4_DEVCONF_ALL(PROXY_ARP) = 0;
-			return 0;
-		}
-		if (__in_dev_get_rtnl(dev)) {
-			IN_DEV_CONF_SET(__in_dev_get_rtnl(dev),
-					PROXY_ARP, 0);
-			return 0;
-		}
-		return -ENXIO;
-	}
-	return -EINVAL;
+	if (mask)
+		return -EINVAL;
+
+	return arp_req_set_proxy(dev, 0);
 }
 
 static int arp_req_delete(struct arpreq *r, struct net_device * dev)
-- 
1.5.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-2.6.25 3/3][ARP] Consolidate some code in arp_req_set/delete_publc
  2007-12-05 17:18 [PATCH net-2.6.25 3/3][ARP] Consolidate some code in arp_req_set/delete_publc Pavel Emelyanov
@ 2007-12-06  5:21 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2007-12-06  5:21 UTC (permalink / raw)
  To: xemul; +Cc: netdev, devel

From: Pavel Emelyanov <xemul@openvz.org>
Date: Wed, 05 Dec 2007 20:18:44 +0300

> The PROXY_ARP is set on devconfigs in a similar way in
> both calls.
> 
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>

Also applied, thanks a lot.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-12-06  5:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-05 17:18 [PATCH net-2.6.25 3/3][ARP] Consolidate some code in arp_req_set/delete_publc Pavel Emelyanov
2007-12-06  5:21 ` David Miller

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).