Date: Tue, 22 Jun 1999 23:05:50 PDT From: Craig Leres <leres@ee.lbl.gov> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/12357: [PATCH] allow route(8) to create "proxy only" arp entries Message-ID: <199906230605.XAA32639@fun.ee.lbl.gov>
next in thread | raw e-mail | index | archive | help
>Number: 12357 >Category: bin >Synopsis: [PATCH] allow route to create "proxy only" arp entries >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue Jun 22 23:10:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Craig Leres >Release: FreeBSD 3.2-RELEASE i386 >Organization: Lawrence Berkeley National Laboratory >Environment: >Description: It would be really nice if route(8) could add the necessary magic to create "proxy only" arp entries. One might argue that arp(8) should do this by default however route(8) is much more powerful; for example, it already allows the user to specify the network interface. (One might argue futher that arp(8) could be replaced with a shell script that uses route to create entries and netstat to display them!) >How-To-Repeat: Try to create a proxy arp entry using arp(8): fun 212 # arp -s 131.243.1.120 0:a0:c9:b7:e3:3c pub fun 213 # netstat -rn | egrep 131.243.1.120 131.243.1.120/32 0:a0:c9:b7:e3:3c ULS2c 0 0 fxp0 fun 214 # arp 131.243.1.120 kitten.ee.lbl.gov (131.243.1.120) at 0:a0:c9:b7:e3:3c \ permanent published Notice that the routing table flags are wrong ('H' should be set but 'c' should not since this should be a host route but not a cloning route). Also notice that arp does not indicate "proxy only" in its listing of this entry. The example where this is buring me is a system that uses a pair of wavelans to do a point to point link. A subset of the real subnet is used at the far end of the link so we have a route like this: 131.243.1.112/28 131.243.1.102 UGSc 0 0 wl1 Where 131.243.1/24 is the "real" subnet and 131.243.1.112/28 is the subset subnet at the far end of the uwave link. But since arp(8) doesn't set the right flags, the arp entry is used to route packets back out the ethernet interface which results in lots of icmp redirects and a routing loop. >Fix: Add a -proxy flag to route(8) and then we have: fun 216 # route -n add -host 131.243.1.120 \ -link fxp0:0.a0.c9.b7.e3.3c -llinfo -proxy -iface add host 131.243.1.120: gateway fxp0:0.a0.c9.b7.e3.3c fun 217 # netstat -rn | egrep 131.243.1.120 131.243.1.120 0:a0:c9:b7:e3:3c UHLS2 0 0 fxp0 fun 218 # arp 131.243.1.120 kitten.ee.lbl.gov (131.243.1.120) at 0:a0:c9:b7:e3:3c \ permanent published (proxy only) Notice that this arp/routing entry has the correct flags and also is designated as "proxy only" . Also note that the proxy arp code in the FreeBSD-current version of ppp(8) creates proxy arp entries that have the same flags and arp output as shown above. Context diffs are appended. However, any similar change to that allows RTF_ANNOUNCE (aka RTF_PROTO2) and SIN_PROXY to be set would be acceptable. RCS file: RCS/route.c,v retrieving revision 1.1 diff -c -r1.1 route.c *** /tmp/,RCSt1X32288 Tue Jun 22 22:50:34 1999 --- route.c Tue Jun 22 22:12:12 1999 *************** *** 55,60 **** --- 55,61 ---- #include <net/route.h> #include <net/if_dl.h> #include <netinet/in.h> + #include <netinet/if_ether.h> #include <netatalk/at.h> #ifdef NS #include <netns/ns.h> *************** *** 88,93 **** --- 89,95 ---- struct sockaddr_ns sns; #endif struct sockaddr_dl sdl; + struct sockaddr_inarp sia; } so_dst, so_gate, so_mask, so_genmask, so_ifa, so_ifp; typedef union sockunion *sup; *************** *** 505,511 **** register char **argv; { char *cmd, *dest = "", *gateway = "", *err; ! int ishost = 0, ret, attempts, oerrno, flags = RTF_STATIC; int key; struct hostent *hp = 0; --- 507,513 ---- register char **argv; { char *cmd, *dest = "", *gateway = "", *err; ! int ishost = 0, proxy = 0, ret, attempts, oerrno, flags = RTF_STATIC; int key; struct hostent *hp = 0; *************** *** 571,576 **** --- 573,581 ---- case K_PROTO2: flags |= RTF_PROTO2; break; + case K_PROXY: + ++proxy; + break; case K_CLONING: flags |= RTF_CLONING; break; *************** *** 643,648 **** --- 648,658 ---- flags |= RTF_HOST; if (iflag == 0) flags |= RTF_GATEWAY; + if (proxy) { + /* XXX probably only makes sense for RTF_HOST */ + flags |= RTF_ANNOUNCE; /* aka RTF_PROTO2 */ + so_dst.sia.sin_other = SIN_PROXY; + } for (attempts = 1; ; attempts++) { errno = 0; if ((ret = rtmsg(*cmd, flags)) == 0) RCS file: RCS/keywords,v retrieving revision 1.1 diff -c -r1.1 keywords *** /tmp/,RCSt1h32293 Tue Jun 22 22:50:42 1999 --- keywords Tue Jun 22 22:11:27 1999 *************** *** 33,38 **** --- 33,39 ---- osi proto1 proto2 + proxy recvpipe reject rtt RCS file: RCS/route.8,v retrieving revision 1.1 diff -c -r1.1 route.8 *** /tmp/,RCSt1p32298 Tue Jun 22 22:50:46 1999 --- route.8 Tue Jun 22 22:16:35 1999 *************** *** 32,38 **** .\" @(#)route.8 8.3 (Berkeley) 3/19/94 .\" $Id: route.8,v 1.12.2.1 1999/05/04 18:41:32 ghelmer Exp $ .\" ! .Dd March 19, 1994 .Dt ROUTE 8 .Os BSD 4.4 .Sh NAME --- 32,38 ---- .\" @(#)route.8 8.3 (Berkeley) 3/19/94 .\" $Id: route.8,v 1.12.2.1 1999/05/04 18:41:32 ghelmer Exp $ .\" ! .Dd June 22, 1999 .Dt ROUTE 8 .Os BSD 4.4 .Sh NAME *************** *** 239,244 **** --- 239,245 ---- -blackhole RTF_BLACKHOLE - silently discard pkts (during updates) -proto1 RTF_PROTO1 - set protocol specific routing flag #1 -proto2 RTF_PROTO2 - set protocol specific routing flag #2 + -proxy RTF_ANNOUNCE - respond to "proxy only" arp requests -llinfo RTF_LLINFO - validly translates proto addr to link addr .Ed .Pp >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906230605.XAA32639>