X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/3d364b3406af34655938597c483f0507b9361c7b..a3934270ef99a321a151092720b987c8b4de9d9d:/usr/src/usr.sbin/arp/arp.c diff --git a/usr/src/usr.sbin/arp/arp.c b/usr/src/usr.sbin/arp/arp.c index ab860b9705..946195892d 100644 --- a/usr/src/usr.sbin/arp/arp.c +++ b/usr/src/usr.sbin/arp/arp.c @@ -15,18 +15,17 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)arp.c 5.12 (Berkeley) %G%"; +static char sccsid[] = "@(#)arp.c 5.17 (Berkeley) %G%"; #endif /* not lint */ /* * arp - display, set, and delete arp table entries */ - #include #include #include -#include +#include #include #include @@ -36,15 +35,17 @@ static char sccsid[] = "@(#)arp.c 5.12 (Berkeley) %G%"; #include #include +#include + #include #include #include +#include #include #include extern int errno; static int pid; -static int kflag; static int nflag; static int s = -1; @@ -175,10 +176,13 @@ set(argc, argv) gettimeofday(&time, 0); expire_time = time.tv_sec + 20 * 60; } - else if (strncmp(argv[0], "pub", 3) == 0) + else if (strncmp(argv[0], "pub", 3) == 0) { + flags |= RTF_ANNOUNCE; doing_proxy = SIN_PROXY; - else if (strncmp(argv[0], "trail", 5) == 0) - flags = RTF_PROTO1; + } else if (strncmp(argv[0], "trail", 5) == 0) { + printf("%s: Sending trailers is no longer supported\n", + host); + } argv++; } tryagain: @@ -227,7 +231,6 @@ get(host) struct hostent *hp; struct sockaddr_inarp *sin = &sin_m; u_char *ea; - char *inet_ntoa(); sin_m = blank_sin; sin->sin_addr.s_addr = inet_addr(host); @@ -314,8 +317,8 @@ delete: dump(addr) u_long addr; { - int sz, needed, rlen; - long op = KINFO_RT_FLAGS | (((long)AF_INET) << 16); + int mib[6]; + size_t needed; char *host, *malloc(), *lim, *buf, *next; struct rt_msghdr *rtm; struct sockaddr_inarp *sin; @@ -323,22 +326,6 @@ u_long addr; extern int h_errno; struct hostent *hp; - if ((needed = getkerninfo(op, 0, 0, RTF_LLINFO)) < 0) - quit("route-getkerninfo-estimate"); - if ((buf = malloc(needed)) == NULL) - quit("malloc"); - if ((rlen = getkerninfo(op, buf, &needed, RTF_LLINFO)) < 0) - quit("actual retrieval of routing table"); - lim = buf + rlen; - for (next = buf; next < lim; next += rtm->rtm_msglen) { - rtm = (struct rt_msghdr *)next; - sin = (struct sockaddr_inarp *)(rtm + 1); - sdl = (struct sockaddr_dl *)(sin + 1); - if (addr) { - if (addr != sin->sin_addr.s_addr) - continue; - found_entry = 1; - } if (nflag == 0) hp = gethostbyaddr((caddr_t)&(sin->sin_addr), sizeof sin->sin_addr, AF_INET); @@ -360,8 +347,6 @@ u_long addr; printf(" permanent"); if (sin->sin_other & SIN_PROXY) printf(" published (proxy only)"); - if (rtm->rtm_flags & RTF_PROTO1) - printf(" trailers"); if (rtm->rtm_addrs & RTA_NETMASK) { sin = (struct sockaddr_inarp *) (sdl->sdl_len + (char *)sdl); @@ -372,8 +357,6 @@ u_long addr; } printf("\n"); } -} - ether_print(cp) u_char *cp; { @@ -402,7 +385,7 @@ usage() printf("usage: arp hostname\n"); printf(" arp -a [kernel] [kernel_memory]\n"); printf(" arp -d hostname\n"); - printf(" arp -s hostname ether_addr [temp] [pub] [trail]\n"); + printf(" arp -s hostname ether_addr [temp] [pub]\n"); printf(" arp -f filename\n"); exit(1); } @@ -430,7 +413,7 @@ rtmsg(cmd) rtm->rtm_addrs |= RTA_GATEWAY; rtm->rtm_rmx.rmx_expire = expire_time; rtm->rtm_inits = RTV_EXPIRE; - rtm->rtm_flags |= RTF_HOST; + rtm->rtm_flags |= (RTF_HOST | RTF_STATIC); sin_m.sin_other = 0; if (doing_proxy) { if (export_only)