summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/arp/arp.814
-rw-r--r--usr.sbin/arp/arp.c21
2 files changed, 26 insertions, 9 deletions
diff --git a/usr.sbin/arp/arp.8 b/usr.sbin/arp/arp.8
index b56505e422c..0cc99ad80b4 100644
--- a/usr.sbin/arp/arp.8
+++ b/usr.sbin/arp/arp.8
@@ -50,7 +50,7 @@
.Fl d Ar hostname
.Nm arp
.Fl s Ar hostname ether_addr
-.Op Ar temp
+.Op Ar temp | permanent
.Op Ar pub
.Nm arp
.Fl f Ar filename
@@ -90,11 +90,13 @@ entry for the host called
.Ar hostname
with the Ethernet address
.Ar ether_addr .
-The Ethernet address is given as six hex bytes separated by colons.
-The entry will be permanent unless the word
+The Ethernet address is given as six hex bytes separated by
+colons. The entry will be static, i.e. not time out, unless the word
.Ar temp
-is given in the command.
-If the word
+is given in the command. A static ARP entry can be overwritten
+by network traffic, unless the word
+.Ar permanent
+is given. If the word
.Ar pub
is given, the entry will be
.Dq published ;
@@ -115,7 +117,7 @@ in the file should be of the form
.Pp
.Bd -filled -offset indent -compact
.Ar hostname ether_addr
-.Op Ar temp
+.Op Ar temp | permanent
.Op Ar pub
.Ed
.Pp
diff --git a/usr.sbin/arp/arp.c b/usr.sbin/arp/arp.c
index 1f8afd70745..7369e0de9c3 100644
--- a/usr.sbin/arp/arp.c
+++ b/usr.sbin/arp/arp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arp.c,v 1.13 1998/09/29 02:22:14 millert Exp $ */
+/* $OpenBSD: arp.c,v 1.14 1999/05/16 00:43:44 ho Exp $ */
/* $NetBSD: arp.c,v 1.12 1995/04/24 13:25:18 cgd Exp $ */
/*
@@ -227,10 +227,23 @@ set(argc, argv)
struct timeval time;
(void)gettimeofday(&time, 0);
expire_time = time.tv_sec + 20 * 60;
+ if (flags & RTF_PERMANENT_ARP) {
+ /* temp or permanent, not both */
+ usage();
+ return (0);
+ }
}
else if (strncmp(argv[0], "pub", 3) == 0) {
flags |= RTF_ANNOUNCE;
doing_proxy = SIN_PROXY;
+ }
+ else if (strncmp(argv[0], "permanent", 9) == 0) {
+ flags |= RTF_PERMANENT_ARP;
+ if (expire_time != 0) {
+ /* temp or permanent, not both */
+ usage();
+ return (0);
+ }
} else if (strncmp(argv[0], "trail", 5) == 0) {
(void)printf(
"%s: Sending trailers is no longer supported\n",
@@ -410,8 +423,10 @@ dump(addr)
ether_print(LLADDR(sdl));
else
(void)printf("(incomplete)");
+ if (rtm->rtm_flags & RTF_PERMANENT_ARP)
+ (void)printf(" permanent");
if (rtm->rtm_rmx.rmx_expire == 0)
- (void)printf(" permanent");
+ (void)printf(" static");
if (sin->sin_other & SIN_PROXY)
(void)printf(" published (proxy only)");
if (rtm->rtm_addrs & RTA_NETMASK) {
@@ -441,7 +456,7 @@ usage()
(void)fprintf(stderr, "usage: arp [-n] -a\n");
(void)fprintf(stderr, "usage: arp -d hostname\n");
(void)fprintf(stderr,
- "usage: arp -s hostname ether_addr [temp] [pub]\n");
+ "usage: arp -s hostname ether_addr [temp | permanent] [pub]\n");
(void)fprintf(stderr, "usage: arp -f filename\n");
exit(1);
}