Re: [PATCH] arp, kernel 2.2.15 and 2.3.99-pre6

From: Ville Nummela (vnummela@lut.fi)
Date: Thu May 04 2000 - 03:24:47 EST


Mathijs Mohlmann wrote:

> On 04-May-2000 Ville Nummela wrote:
> > It adds a
> > send_replies -entry to /proc/sys/net/ipv4/neigh/<device>, and if it's 1
> > then sending any arp replies is disabled.
>
> Shouldn't it be called "disable_arp_reply" then?

Probably should.
"fixed" versions attached (just run s/send_replies/disable_arp_reply/g).

--
 |   vnummela@lut.fi work: +358-5-4125389 home: +358-40-5075560       |
 |   So Linus, what are we doing tonight?                             |
 |   The same thing we every night Tux. Try to take over the world!   |

diff -Naur linux-orig/CREDITS linux/CREDITS --- linux-orig/CREDITS Thu May 4 09:09:43 2000 +++ linux/CREDITS Thu May 4 09:24:27 2000 @@ -1529,6 +1529,11 @@ S: Reston, Virginia 20191 S: USA +N: Ville Nummela +E: vnummela@lut.fi +W: http://www.lut.fi/~vnummela +D: Wrote dynamic arp replies disabling + N: Michael O'Reilly E: michael@iinet.com.au E: oreillym@tartarus.uwa.edu.au diff -Naur linux-orig/Documentation/proc.txt linux/Documentation/proc.txt --- linux-orig/Documentation/proc.txt Thu May 4 09:10:02 2000 +++ linux/Documentation/proc.txt Thu May 4 09:24:17 2000 @@ -1312,6 +1312,10 @@ tries to send an ARP packet directly to the known host, when that fails and mcast_solicit is > 0, an ARP request is broadcasted. +disable_arp_replies + Determines whether to send replies to ARP solicitations on a device. + 0 means "send replies", while 1 means "don't send replies" + 3.10 Appletalk The /proc/sys/net/appletalk directory holds the Appletalk diff -Naur linux-orig/include/linux/sysctl.h linux/include/linux/sysctl.h --- linux-orig/include/linux/sysctl.h Thu May 4 09:09:43 2000 +++ linux/include/linux/sysctl.h Thu May 4 09:26:14 2000 @@ -318,10 +318,11 @@ NET_NEIGH_ANYCAST_DELAY=10, NET_NEIGH_PROXY_DELAY=11, NET_NEIGH_LOCKTIME=12, - NET_NEIGH_GC_INTERVAL=13, - NET_NEIGH_GC_THRESH1=14, - NET_NEIGH_GC_THRESH2=15, - NET_NEIGH_GC_THRESH3=16 + NET_NEIGH_SEND_REPLIES=13, + NET_NEIGH_GC_INTERVAL=14, + NET_NEIGH_GC_THRESH1=15, + NET_NEIGH_GC_THRESH2=16, + NET_NEIGH_GC_THRESH3=17, }; /* /proc/sys/net/ipx */ diff -Naur linux-orig/include/net/neighbour.h linux/include/net/neighbour.h --- linux-orig/include/net/neighbour.h Thu May 4 09:09:44 2000 +++ linux/include/net/neighbour.h Thu May 4 09:24:17 2000 @@ -74,6 +74,7 @@ int proxy_delay; int proxy_qlen; int locktime; + int disable_arp_replies; }; struct neigh_statistics diff -Naur linux-orig/net/core/neighbour.c linux/net/core/neighbour.c --- linux-orig/net/core/neighbour.c Thu May 4 09:09:44 2000 +++ linux/net/core/neighbour.c Thu May 4 09:24:17 2000 @@ -1268,7 +1268,7 @@ struct neigh_sysctl_table { struct ctl_table_header *sysctl_header; - ctl_table neigh_vars[17]; + ctl_table neigh_vars[18]; ctl_table neigh_dev[2]; ctl_table neigh_neigh_dir[2]; ctl_table neigh_proto_dir[2]; @@ -1311,6 +1311,9 @@ {NET_NEIGH_LOCKTIME, "locktime", NULL, sizeof(int), 0644, NULL, &proc_dointvec}, + {NET_NEIGH_SEND_REPLIES, "disable_arp_replies", + NULL, sizeof(int), 0644, NULL, + &proc_dointvec}, {NET_NEIGH_GC_INTERVAL, "gc_interval", NULL, sizeof(int), 0644, NULL, &proc_dointvec_jiffies}, @@ -1352,15 +1355,16 @@ t->neigh_vars[9].data = &p->anycast_delay; t->neigh_vars[10].data = &p->proxy_delay; t->neigh_vars[11].data = &p->locktime; + t->neigh_vars[12].data = &p->disable_arp_replies; if (dev) { t->neigh_dev[0].procname = dev->name; t->neigh_dev[0].ctl_name = dev->ifindex; - memset(&t->neigh_vars[12], 0, sizeof(ctl_table)); + memset(&t->neigh_vars[13], 0, sizeof(ctl_table)); } else { - t->neigh_vars[12].data = (int*)(p+1); - t->neigh_vars[13].data = (int*)(p+1) + 1; - t->neigh_vars[14].data = (int*)(p+1) + 2; - t->neigh_vars[15].data = (int*)(p+1) + 3; + t->neigh_vars[13].data = (int*)(p+1); + t->neigh_vars[14].data = (int*)(p+1) + 1; + t->neigh_vars[15].data = (int*)(p+1) + 2; + t->neigh_vars[16].data = (int*)(p+1) + 3; } t->neigh_neigh_dir[0].ctl_name = pdev_id; diff -Naur linux-orig/net/ipv4/arp.c linux/net/ipv4/arp.c --- linux-orig/net/ipv4/arp.c Thu May 4 09:09:44 2000 +++ linux/net/ipv4/arp.c Thu May 4 09:24:17 2000 @@ -67,6 +67,7 @@ * now it is in net/core/neighbour.c. * Julian Anastasov: "hidden" flag: hide the * interface and don't reply for it + * Ville Nummela: disable_arp_replies flag in proc */ /* RFC1122 Status: @@ -694,7 +695,7 @@ goto out; } } - + if (n->parms->disable_arp_replies==0) arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); neigh_release(n); }

diff -Naur linux-orig/CREDITS linux/CREDITS --- linux-orig/CREDITS Mon Apr 24 23:39:33 2000 +++ linux/CREDITS Thu May 4 09:33:01 2000 @@ -1831,6 +1831,11 @@ W: http://www.lysator.liu.se/~noring/ D: dsp56k device driver +N: Ville Nummela +E: vnummela@lut.fi +W: http://www.lut.fi/~vnummela +D: Wrote dynamic arp replies disabling + N: Michael O'Reilly E: michael@iinet.com.au E: oreillym@tartarus.uwa.edu.au diff -Naur linux-orig/Documentation/filesystems/proc.txt linux/Documentation/filesystems/proc.txt --- linux-orig/Documentation/filesystems/proc.txt Tue Nov 2 18:19:44 1999 +++ linux/Documentation/filesystems/proc.txt Thu May 4 09:31:47 2000 @@ -1588,6 +1588,12 @@ Maximum number of retries for multicast solicitation. +disable_arp_replies +------------ + +Determines whether to send replies to ARP solicitations on a device. +0 means "send replies", while 1 means "don't send replies". + delay_first_probe_time ---------------------- diff -Naur linux-orig/include/linux/sysctl.h linux/include/linux/sysctl.h --- linux-orig/include/linux/sysctl.h Thu Apr 27 01:06:25 2000 +++ linux/include/linux/sysctl.h Thu May 4 09:31:47 2000 @@ -351,10 +351,11 @@ NET_NEIGH_ANYCAST_DELAY=10, NET_NEIGH_PROXY_DELAY=11, NET_NEIGH_LOCKTIME=12, - NET_NEIGH_GC_INTERVAL=13, - NET_NEIGH_GC_THRESH1=14, - NET_NEIGH_GC_THRESH2=15, - NET_NEIGH_GC_THRESH3=16 + NET_NEIGH_SEND_REPLIES=13, + NET_NEIGH_GC_INTERVAL=14, + NET_NEIGH_GC_THRESH1=15, + NET_NEIGH_GC_THRESH2=16, + NET_NEIGH_GC_THRESH3=17 }; /* /proc/sys/net/ipx */ diff -Naur linux-orig/include/net/neighbour.h linux/include/net/neighbour.h --- linux-orig/include/net/neighbour.h Thu Apr 27 01:30:06 2000 +++ linux/include/net/neighbour.h Thu May 4 09:31:47 2000 @@ -74,6 +74,7 @@ int proxy_delay; int proxy_qlen; int locktime; + int disable_arp_replies; }; struct neigh_statistics diff -Naur linux-orig/net/core/neighbour.c linux/net/core/neighbour.c --- linux-orig/net/core/neighbour.c Sat Apr 22 02:08:45 2000 +++ linux/net/core/neighbour.c Thu May 4 09:31:47 2000 @@ -1430,7 +1430,7 @@ struct neigh_sysctl_table { struct ctl_table_header *sysctl_header; - ctl_table neigh_vars[17]; + ctl_table neigh_vars[18]; ctl_table neigh_dev[2]; ctl_table neigh_neigh_dir[2]; ctl_table neigh_proto_dir[2]; @@ -1473,6 +1473,9 @@ {NET_NEIGH_LOCKTIME, "locktime", NULL, sizeof(int), 0644, NULL, &proc_dointvec}, + {NET_NEIGH_SEND_REPLIES, "disable_arp_replies", + NULL, sizeof(int), 0644, NULL, + &proc_dointvec}, {NET_NEIGH_GC_INTERVAL, "gc_interval", NULL, sizeof(int), 0644, NULL, &proc_dointvec_jiffies}, @@ -1514,15 +1517,16 @@ t->neigh_vars[9].data = &p->anycast_delay; t->neigh_vars[10].data = &p->proxy_delay; t->neigh_vars[11].data = &p->locktime; + t->neigh_vars[12].data = &p->disable_arp_replies; if (dev) { t->neigh_dev[0].procname = dev->name; t->neigh_dev[0].ctl_name = dev->ifindex; - memset(&t->neigh_vars[12], 0, sizeof(ctl_table)); + memset(&t->neigh_vars[13], 0, sizeof(ctl_table)); } else { - t->neigh_vars[12].data = (int*)(p+1); - t->neigh_vars[13].data = (int*)(p+1) + 1; - t->neigh_vars[14].data = (int*)(p+1) + 2; - t->neigh_vars[15].data = (int*)(p+1) + 3; + t->neigh_vars[13].data = (int*)(p+1); + t->neigh_vars[14].data = (int*)(p+1) + 1; + t->neigh_vars[15].data = (int*)(p+1) + 2; + t->neigh_vars[16].data = (int*)(p+1) + 3; } t->neigh_neigh_dir[0].ctl_name = pdev_id; diff -Naur linux-orig/net/ipv4/arp.c linux/net/ipv4/arp.c --- linux-orig/net/ipv4/arp.c Wed Apr 26 22:13:17 2000 +++ linux/net/ipv4/arp.c Thu May 4 09:31:47 2000 @@ -65,6 +65,7 @@ * clean up the APFDDI & gen. FDDI bits. * Alexey Kuznetsov: new arp state machine; * now it is in net/core/neighbour.c. + * Ville Nummela : disable_arp_replies flag in proc */ /* RFC1122 Status: @@ -721,7 +722,8 @@ if (addr_type == RTN_LOCAL) { n = neigh_event_ns(&arp_tbl, sha, &sip, dev); if (n) { - arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); + if (n->parms->disable_arp_replies==0) + arp_send(ARPOP_REPLY,ETH_P_ARP,sip,dev,tip,sha,dev->dev_addr,sha); neigh_release(n); } goto out;

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sun May 07 2000 - 21:00:14 EST