Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=43dc1701172b7f73c495dea6c165c73ab8934f76
Commit:     43dc1701172b7f73c495dea6c165c73ab8934f76
Parent:     1ff1cc202e9a7dbd9f54d1bce5adb44283497185
Author:     Pavel Emelyanov <[EMAIL PROTECTED]>
AuthorDate: Wed Dec 5 21:19:44 2007 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Mon Jan 28 14:56:37 2008 -0800

    [ARP]: Minus one level of indentation in arp_req_set
    
    The ATF_PUBL requests are handled completely separate from
    the others. Emphasize it with a separate function. This also
    reduces the indentation level.
    
    The same issue exists with the arp_delete_request, but
    when I tried to make it in one patch diff produced completely
    unreadable patch. So I split it into two, but they may be
    done with one commit.
    
    Signed-off-by: Pavel Emelyanov <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/arp.c |   58 +++++++++++++++++++++++++++++++------------------------
 1 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index 54a76b8..04e0ecd 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -952,37 +952,45 @@ out_of_mem:
  *     Set (create) an ARP cache entry.
  */
 
+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;
+       __be32 mask = ((struct sockaddr_in *)&r->arp_netmask)->sin_addr.s_addr;
+
+       if (mask && mask != htonl(0xFFFFFFFF))
+               return -EINVAL;
+       if (!dev && (r->arp_flags & ATF_COM)) {
+               dev = dev_getbyhwaddr(&init_net, r->arp_ha.sa_family,
+                               r->arp_ha.sa_data);
+               if (!dev)
+                       return -ENODEV;
+       }
+       if (mask) {
+               if (pneigh_lookup(&arp_tbl, &ip, dev, 1) == NULL)
+                       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;
+}
+
 static int arp_req_set(struct arpreq *r, struct net_device * dev)
 {
-       __be32 ip = ((struct sockaddr_in *) &r->arp_pa)->sin_addr.s_addr;
+       __be32 ip;
        struct neighbour *neigh;
        int err;
 
-       if (r->arp_flags&ATF_PUBL) {
-               __be32 mask = ((struct sockaddr_in *) 
&r->arp_netmask)->sin_addr.s_addr;
-               if (mask && mask != htonl(0xFFFFFFFF))
-                       return -EINVAL;
-               if (!dev && (r->arp_flags & ATF_COM)) {
-                       dev = dev_getbyhwaddr(&init_net, r->arp_ha.sa_family, 
r->arp_ha.sa_data);
-                       if (!dev)
-                               return -ENODEV;
-               }
-               if (mask) {
-                       if (pneigh_lookup(&arp_tbl, &ip, dev, 1) == NULL)
-                               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;
-       }
+       if (r->arp_flags & ATF_PUBL)
+               return arp_req_set_public(r, dev);
 
+       ip = ((struct sockaddr_in *)&r->arp_pa)->sin_addr.s_addr;
        if (r->arp_flags & ATF_PERM)
                r->arp_flags |= ATF_COM;
        if (dev == NULL) {
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to