From 1c59bf7de3824a44200ed51eba18819912f51b80 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Tue, 12 Jun 2001 13:31:53 +0000 Subject: [PATCH] Allow route(8) to create "proxy only" published ARP entries. PR: bin/12357 Submitted by: Craig Leres --- sbin/route/keywords | 1 + sbin/route/route.8 | 17 +++++++++++++---- sbin/route/route.c | 11 ++++++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/sbin/route/keywords b/sbin/route/keywords index 00080a797483..18f995d2b85e 100644 --- a/sbin/route/keywords +++ b/sbin/route/keywords @@ -36,6 +36,7 @@ osi prefixlen proto1 proto2 +proxy recvpipe reject rtt diff --git a/sbin/route/route.8 b/sbin/route/route.8 index 13ab5ced7948..c88656c536c4 100644 --- a/sbin/route/route.8 +++ b/sbin/route/route.8 @@ -313,6 +313,16 @@ or .Fl ifa modifiers may be used to determine the interface or interface address. .Pp +The optional +.Fl proxy +modifier specifies that the +.Dv RTF_LLINFO +routing table entry is the +.Dq published Pq proxy-only +.Tn ARP +entry, as reported by +.Xr arp 8 . +.Pp All symbolic names specified for a .Ar destination or @@ -325,11 +335,9 @@ is then used to interpret the name as that of a network. .Pp .Nm Route uses a routing socket and the new message types -RTM_ADD, -RTM_DELETE, -RTM_GET, +.Dv RTM_ADD , RTM_DELETE , RTM_GET , and -RTM_CHANGE. +.Dv RTM_CHANGE . As such, only the super-user may modify the routing tables. .Sh DIAGNOSTICS @@ -377,6 +385,7 @@ utility exits 0 on success or >0 if an error occurred. .Xr netintro 4 , .Xr route 4 , .Xr IPXrouted 8 , +.Xr arp 8 , .Xr routed 8 .\" .Xr XNSrouted 8 .\" Xr esis 4 , diff --git a/sbin/route/route.c b/sbin/route/route.c index 02a8dce56f4a..38c35f7478f6 100644 --- a/sbin/route/route.c +++ b/sbin/route/route.c @@ -56,6 +56,7 @@ static const char rcsid[] = #include #include #include +#include #include #ifdef NS #include @@ -94,6 +95,7 @@ union sockunion { struct sockaddr_ns sns; #endif struct sockaddr_dl sdl; + struct sockaddr_inarp sinarp; struct sockaddr_storage ss; /* added to avoid memory overrun */ } so_dst, so_gate, so_mask, so_genmask, so_ifa, so_ifp; @@ -581,7 +583,7 @@ newroute(argc, argv) register char **argv; { char *cmd, *dest = "", *gateway = "", *err; - int ishost = 0, ret, attempts, oerrno, flags = RTF_STATIC; + int ishost = 0, proxy = 0, ret, attempts, oerrno, flags = RTF_STATIC; int key; struct hostent *hp = 0; @@ -653,6 +655,9 @@ newroute(argc, argv) case K_PROTO2: flags |= RTF_PROTO2; break; + case K_PROXY: + proxy = 1; + break; case K_CLONING: flags |= RTF_CLONING; break; @@ -750,6 +755,10 @@ newroute(argc, argv) flags |= RTF_HOST; if (iflag == 0) flags |= RTF_GATEWAY; + if (proxy) { + so_dst.sinarp.sin_other = SIN_PROXY; + flags |= RTF_ANNOUNCE; + } for (attempts = 1; ; attempts++) { errno = 0; if ((ret = rtmsg(*cmd, flags)) == 0)