Skip to contentSkip to conversation

net/ipv4/arp.c, kernel 2.4.6

PATCH New Roberto Arcomano 1 participant 1 message Jul 26, 2001

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ipv4/arp.c, kernel 2.4.6

This patch should update proxy arp feature for shaper device. Details are in README file attached.
Thank you for your support.
Best Regards
Roberto Arcomano

net/ipv4/arp.c +9 -1
@@ -111,6 +111,7 @@
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
+#include <linux/if_shaper.h>
 
 
 
@@ -767,8 +768,15 @@
 			}
 			goto out;
 		} else if (IN_DEV_FORWARD(in_dev)) {
+                        char shflag=0;
+                        if ( (rt->u.dst.dev) &&
+			     (rt->u.dst.dev->priv) &&
+			     (((struct shaper *) rt->u.dst.dev->priv)->dev) &&
+			     (strncmp(rt->u.dst.dev->name,"shaper",6)==0) )
+			  shflag=1;
 			if ((rt->rt_flags&RTCF_DNAT) ||
-			    (addr_type == RTN_UNICAST  && rt->u.dst.dev != dev &&
+			    (addr_type == RTN_UNICAST  && 
+			    ( ((shflag) && ( ((struct shaper *) rt->u.dst.dev->priv)->dev != dev)) || ((!shflag) && (rt->u.dst.dev != dev)) ) &&
 			     (IN_DEV_PROXY_ARP(in_dev) || pneigh_lookup(&arp_tbl, &tip, dev, 0)))) {
 				n = neigh_event_ns(&arp_tbl, sha, &sip, dev);
 				if (n)

Subject: PATCH to update proxy arp feature on shaper device

Author: Roberto Arcomano, [email protected],
http://www.fatamorgana.com/bertolinux

Date: 07/22/2001

Description: Shaper device is seen by the kernel like a
different device than the physical one to which is attached to. So kernel always issues an "ARP REPLY" (if proxy arp is active): this prevent us to enable proxy arp (on a shaper device) and turn on machine cause we would receive an "IP conflit".

Solution: The patch investigates about the shaper device
(it compares string with "shaper"): if yes, we search the real interface attached to shaper (we read value of priv->dev) and we use that to
make the classic proxy arp devices compare.

Problems: The patch uses routine "strncmp" which is not the
best thing (I guess).

Tests: I tested new feature using 3 PC like that:

CLIENT1 ----------- LINUX ----- CLIENT2
shaper0 ppp0
[eth0]

LINUX host has proxy arp and shaper enabled, with a routing (using shaper0 interface) to CLIENT1 If I use old feature, when I turn on CLIENT1 I receive an "IP conflit" by its OS, while using patched version I have no problem and proxy arp feature for CLIENT2 works well (as right, I cannot assign CLIENT2 IP to CLIENT1 host).

Kernel version tested is 2.4.6

Final notes: It should be very simple to port patch to older

             kernel version (2.0.xx, 2.1.xx, 2.2.xx, 2.3.xx)