mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net/ipv4/arp.c, kernel 2.4.6 - PROXY_ARP bug on shaper device
@ 2001-07-28 10:01 Roberto Arcomano
  2001-07-28 11:43 ` David S. Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Roberto Arcomano @ 2001-07-28 10:01 UTC (permalink / raw)
  To: linux-kernel; +Cc: torvalds

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

This patch should update proxy arp feature for shaper device:  it should 
correct proxy arp bug when talking with shaper device.
Details are in README file attached:
Thank you for your support.
Best Regards
Roberto Arcomano

[-- Attachment #2: Proxy arp PATCH diff file --]
[-- Type: text/x-c, Size: 967 bytes --]

--- linux-2.4.6.orig/net/ipv4/arp.c	Wed May 16 19:21:45 2001
+++ linux-2.4.6/net/ipv4/arp.c	Thu Jul 26 02:00:35 2001
@@ -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)

[-- Attachment #3: README file for proxy arp PATCH --]
[-- Type: text/x-c, Size: 1655 bytes --]

Subject: PATCH to update proxy arp feature on shaper device

Author: Roberto Arcomano, berto@fatamorgana.com,
        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)
	    
	             
	     
	     

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net/ipv4/arp.c, kernel 2.4.6 - PROXY_ARP bug on shaper device
  2001-07-28 10:01 [PATCH] net/ipv4/arp.c, kernel 2.4.6 - PROXY_ARP bug on shaper device Roberto Arcomano
@ 2001-07-28 11:43 ` David S. Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David S. Miller @ 2001-07-28 11:43 UTC (permalink / raw)
  To: Roberto Arcomano; +Cc: linux-kernel, torvalds


Roberto Arcomano writes:
 > 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).

This is gross, make a device flag and have shaper set that
flag during shaper device init, then have ARP test it.

Make the name of the flag reflect what the attribute is that shaper
has (and potentially other devices could have) which makes this ARP
special case necessary.  Ie. don't name the flag NETIF_F_SHAPER :-)

Later,
David S. Miller
davem@redhat.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-07-28 11:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-28 10:01 [PATCH] net/ipv4/arp.c, kernel 2.4.6 - PROXY_ARP bug on shaper device Roberto Arcomano
2001-07-28 11:43 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®