summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/net/route.h3
-rw-r--r--sys/netinet/if_ether.c20
-rw-r--r--sys/netinet/if_ether.h7
3 files changed, 22 insertions, 8 deletions
diff --git a/sys/net/route.h b/sys/net/route.h
index 8eed978d927..cd880ad239b 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.5 1999/02/04 00:04:35 deraadt Exp $ */
+/* $OpenBSD: route.h,v 1.6 1999/05/16 00:34:40 ho Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -135,6 +135,7 @@ struct ortentry {
#define RTF_LLINFO 0x400 /* generated by ARP or ESIS */
#define RTF_STATIC 0x800 /* manually added */
#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */
+#define RTF_PROTO3 0x2000 /* protocol specific routing flag */
#define RTF_PROTO2 0x4000 /* protocol specific routing flag */
#define RTF_PROTO1 0x8000 /* protocol specific routing flag */
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index fc2bb1948eb..936647df848 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.13 1999/03/13 21:15:16 deraadt Exp $ */
+/* $OpenBSD: if_ether.c,v 1.14 1999/05/16 00:34:40 ho Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -493,9 +493,21 @@ in_arpinput(m)
la = arplookup(isaddr.s_addr, itaddr.s_addr == myaddr.s_addr, 0);
if (la && (rt = la->la_rt) && (sdl = SDL(rt->rt_gateway))) {
if (sdl->sdl_alen &&
- bcmp((caddr_t)ea->arp_sha, LLADDR(sdl), sdl->sdl_alen))
- log(LOG_INFO, "arp info overwritten for %s by %s\n",
- inet_ntoa(isaddr), ether_sprintf(ea->arp_sha));
+ bcmp((caddr_t)ea->arp_sha, LLADDR(sdl), sdl->sdl_alen)) {
+ if (rt->rt_flags & RTF_PERMANENT_ARP) {
+ log(LOG_WARNING,
+ "arp: attempt to overwrite permanent "
+ "entry for %s by %s\n", inet_ntoa(isaddr),
+ ether_sprintf(ea->arp_sha));
+ goto out;
+ } else {
+ log(LOG_INFO,
+ "arp info overwritten for %s by %s\n",
+ inet_ntoa(isaddr),
+ ether_sprintf(ea->arp_sha));
+ rt->rt_expire = 1; /* no longer static */
+ }
+ }
bcopy((caddr_t)ea->arp_sha, LLADDR(sdl),
sdl->sdl_alen = sizeof(ea->arp_sha));
if (rt->rt_expire)
diff --git a/sys/netinet/if_ether.h b/sys/netinet/if_ether.h
index 39b73b5a3f2..c780d8aa081 100644
--- a/sys/netinet/if_ether.h
+++ b/sys/netinet/if_ether.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.h,v 1.6 1999/01/07 09:11:52 deraadt Exp $ */
+/* $OpenBSD: if_ether.h,v 1.7 1999/05/16 00:34:40 ho Exp $ */
/* $NetBSD: if_ether.h,v 1.22 1996/05/11 13:00:00 mycroft Exp $ */
/*
@@ -148,8 +148,9 @@ struct sockaddr_inarp {
/*
* IP and ethernet specific routing flags
*/
-#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */
-#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */
+#define RTF_USETRAILERS RTF_PROTO1 /* use trailers */
+#define RTF_ANNOUNCE RTF_PROTO2 /* announce new arp entry */
+#define RTF_PERMANENT_ARP RTF_PROTO3 /* only manual overwrite of entry */
#ifdef _KERNEL
u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN];