Allow route(8) to create "proxy only" published ARP entries.

PR:		bin/12357
Submitted by:	Craig Leres <leres@ee.lbl.gov>
This commit is contained in:
Ruslan Ermilov 2001-06-12 13:31:53 +00:00
parent 86cd74127c
commit 1c59bf7de3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=78140
3 changed files with 24 additions and 5 deletions

View File

@ -36,6 +36,7 @@ osi
prefixlen prefixlen
proto1 proto1
proto2 proto2
proxy
recvpipe recvpipe
reject reject
rtt rtt

View File

@ -313,6 +313,16 @@ or
.Fl ifa .Fl ifa
modifiers may be used to determine the interface or interface address. modifiers may be used to determine the interface or interface address.
.Pp .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 All symbolic names specified for a
.Ar destination .Ar destination
or or
@ -325,11 +335,9 @@ is then used to interpret the name as that of a network.
.Pp .Pp
.Nm Route .Nm Route
uses a routing socket and the new message types uses a routing socket and the new message types
RTM_ADD, .Dv RTM_ADD , RTM_DELETE , RTM_GET ,
RTM_DELETE,
RTM_GET,
and and
RTM_CHANGE. .Dv RTM_CHANGE .
As such, only the super-user may modify As such, only the super-user may modify
the routing tables. the routing tables.
.Sh DIAGNOSTICS .Sh DIAGNOSTICS
@ -377,6 +385,7 @@ utility exits 0 on success or >0 if an error occurred.
.Xr netintro 4 , .Xr netintro 4 ,
.Xr route 4 , .Xr route 4 ,
.Xr IPXrouted 8 , .Xr IPXrouted 8 ,
.Xr arp 8 ,
.Xr routed 8 .Xr routed 8
.\" .Xr XNSrouted 8 .\" .Xr XNSrouted 8
.\" Xr esis 4 , .\" Xr esis 4 ,

View File

@ -56,6 +56,7 @@ static const char rcsid[] =
#include <net/route.h> #include <net/route.h>
#include <net/if_dl.h> #include <net/if_dl.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <netinet/if_ether.h>
#include <netatalk/at.h> #include <netatalk/at.h>
#ifdef NS #ifdef NS
#include <netns/ns.h> #include <netns/ns.h>
@ -94,6 +95,7 @@ union sockunion {
struct sockaddr_ns sns; struct sockaddr_ns sns;
#endif #endif
struct sockaddr_dl sdl; struct sockaddr_dl sdl;
struct sockaddr_inarp sinarp;
struct sockaddr_storage ss; /* added to avoid memory overrun */ struct sockaddr_storage ss; /* added to avoid memory overrun */
} so_dst, so_gate, so_mask, so_genmask, so_ifa, so_ifp; } so_dst, so_gate, so_mask, so_genmask, so_ifa, so_ifp;
@ -581,7 +583,7 @@ newroute(argc, argv)
register char **argv; register char **argv;
{ {
char *cmd, *dest = "", *gateway = "", *err; 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; int key;
struct hostent *hp = 0; struct hostent *hp = 0;
@ -653,6 +655,9 @@ newroute(argc, argv)
case K_PROTO2: case K_PROTO2:
flags |= RTF_PROTO2; flags |= RTF_PROTO2;
break; break;
case K_PROXY:
proxy = 1;
break;
case K_CLONING: case K_CLONING:
flags |= RTF_CLONING; flags |= RTF_CLONING;
break; break;
@ -750,6 +755,10 @@ newroute(argc, argv)
flags |= RTF_HOST; flags |= RTF_HOST;
if (iflag == 0) if (iflag == 0)
flags |= RTF_GATEWAY; flags |= RTF_GATEWAY;
if (proxy) {
so_dst.sinarp.sin_other = SIN_PROXY;
flags |= RTF_ANNOUNCE;
}
for (attempts = 1; ; attempts++) { for (attempts = 1; ; attempts++) {
errno = 0; errno = 0;
if ((ret = rtmsg(*cmd, flags)) == 0) if ((ret = rtmsg(*cmd, flags)) == 0)