[2456] in linux-net channel archive

home help back first fref pref prev next nref lref last post

Patch for ARP code to listen more...

daemon@ATHENA.MIT.EDU (Tim Morley)
Thu Apr 11 19:07:08 1996

Date: 	Thu, 11 Apr 1996 17:42:21 +0100
From: Tim Morley <tim@cityscape.co.uk>
To: iialan@iifeak.swan.ac.uk, linux-net@vger.rutgers.edu


A situation i have come across uses arp transmittions to enable to
swapping between duplicate routers, to allow dynamic changeover in
event of a failure. (E.G.routing through address a, with duplicate
routers with addresses b and c (a!=b!=c), but b and c broadcast arp
packets for a at regular intervals, so routing transparently hops from
one to the other).

I've modified things as follows, when an arp reply is recieved (for
any IP address, not just my own), it checks if its in the arp table
already, and if so updates it. If it isn't it checks to see if the
reply is to my address and if so adds it to the table.

Its only a little patch, but I would appreciate it if it could go into
the next kernel.

Tim Morley

diff -u -r linux-1.3.80/net/ipv4/arp.c linux-1.3.80-arphack/net/ipv4/arp.c
--- linux-1.3.80/net/ipv4/arp.c Thu Apr 11 16:47:16 1996
+++ linux-1.3.80-arphack/net/ipv4/arp.c Thu Apr 11 17:30:29 1996
@@ -54,6 +54,8 @@
  *             Manuel Rodriguez:       Gratutious ARP.
  *              Jonathan Layes  :       Added arpd support through kerneld 
  *                                      message queue (960314)
+ *              Tim Morley      :       Update arp table entries from arp
+ *                                      replies to other hosts.
  */
 
 /* RFC1122 Status:
@@ -1168,19 +1170,11 @@
        }
 /*
  *     It is now an arp reply.
- */
-       if(ip_chk_addr(tip)!=IS_MYADDR)
-       {
-/*
- *     Replies to other machines get tossed.
- */
-               kfree_skb(skb, FREE_READ);
-               return 0;
-       }
-/*
+ *
  * Now all replies are handled.  Next, anything that falls through to here
- * needs to be added to the arp cache, or have its entry updated if it is 
- * there.
+ * needs to have its entry updated if it is there, and if the reply is to
+ * my adress add it to the tables. This allows up to keep ARP entries
+ * updated for any host we have already in the tables.
  */
 
        arp_fast_lock();
@@ -1220,7 +1214,7 @@
                        arp_send_q(entry);
                }
        }
-       else
+       else if (ip_chk_addr(tip)==IS_MYADDR)
        {
 /*
  *     No entry found.  Need to add a new entry to the arp table.


home help back first fref pref prev next nref lref last post