ipv4: switch and case should be at the same indent
[cascardo/linux.git] / net / ipv4 / arp.c
index f041858..1a9b99e 100644 (file)
@@ -381,6 +381,7 @@ static void arp_solicit(struct neighbour *neigh, struct sk_buff *skb)
 
 static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
 {
+       struct net *net = dev_net(in_dev->dev);
        int scope;
 
        switch (IN_DEV_ARP_IGNORE(in_dev)) {
@@ -399,6 +400,7 @@ static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
        case 3: /* Do not reply for scope host addresses */
                sip = 0;
                scope = RT_SCOPE_LINK;
+               in_dev = NULL;
                break;
        case 4: /* Reserved */
        case 5:
@@ -410,7 +412,7 @@ static int arp_ignore(struct in_device *in_dev, __be32 sip, __be32 tip)
        default:
                return 0;
        }
-       return !inet_confirm_addr(in_dev, sip, tip, scope);
+       return !inet_confirm_addr(net, in_dev, sip, tip, scope);
 }
 
 static int arp_filter(__be32 sip, __be32 tip, struct net_device *dev)
@@ -730,6 +732,7 @@ static int arp_process(struct sk_buff *skb)
        int addr_type;
        struct neighbour *n;
        struct net *net = dev_net(dev);
+       bool is_garp = false;
 
        /* arp_rcv below verifies the ARP header and verifies the device
         * is ARP'able.
@@ -896,10 +899,12 @@ static int arp_process(struct sk_buff *skb)
                   It is possible, that this option should be enabled for some
                   devices (strip is candidate)
                 */
+               is_garp = arp->ar_op == htons(ARPOP_REQUEST) && tip == sip &&
+                         inet_addr_type(net, sip) == RTN_UNICAST;
+
                if (n == NULL &&
-                   (arp->ar_op == htons(ARPOP_REPLY) ||
-                    (arp->ar_op == htons(ARPOP_REQUEST) && tip == sip)) &&
-                   inet_addr_type(net, sip) == RTN_UNICAST)
+                   ((arp->ar_op == htons(ARPOP_REPLY)  &&
+                     inet_addr_type(net, sip) == RTN_UNICAST) || is_garp))
                        n = __neigh_lookup(&arp_tbl, &sip, dev, 1);
        }
 
@@ -912,8 +917,10 @@ static int arp_process(struct sk_buff *skb)
                   agents are active. Taking the first reply prevents
                   arp trashing and chooses the fastest router.
                 */
-               override = time_after(jiffies, n->updated +
-                                              NEIGH_VAR(n->parms, LOCKTIME));
+               override = time_after(jiffies,
+                                     n->updated +
+                                     NEIGH_VAR(n->parms, LOCKTIME)) ||
+                          is_garp;
 
                /* Broadcast replies and request packets
                   do not assert neighbour reachability.
@@ -1110,7 +1117,7 @@ static int arp_req_get(struct arpreq *r, struct net_device *dev)
        return err;
 }
 
-int arp_invalidate(struct net_device *dev, __be32 ip)
+static int arp_invalidate(struct net_device *dev, __be32 ip)
 {
        struct neighbour *neigh = neigh_lookup(&arp_tbl, &ip, dev);
        int err = -ENXIO;
@@ -1125,7 +1132,6 @@ int arp_invalidate(struct net_device *dev, __be32 ip)
 
        return err;
 }
-EXPORT_SYMBOL(arp_invalidate);
 
 static int arp_req_delete_public(struct net *net, struct arpreq *r,
                struct net_device *dev)