summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHakan Olsson <ho@cvs.openbsd.org>1999-07-18 21:36:41 +0000
committerHakan Olsson <ho@cvs.openbsd.org>1999-07-18 21:36:41 +0000
commit88d3bdfec7b2ba6cf6de0e1aae7b6a6a9ea771a3 (patch)
tree1de2c4d6532d504b3c6ba875e5608d8e5c643164
parent04dc83c968dde4a684bab6459442579548ec13e4 (diff)
Prevent host on one interface from overwriting ARP route entry for a
host on a different interface. Also add interface name to other overwrite diagnostic messages.
-rw-r--r--sys/netinet/if_ether.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 936647df848..294437da182 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.14 1999/05/16 00:34:40 ho Exp $ */
+/* $OpenBSD: if_ether.c,v 1.15 1999/07/18 21:36:40 ho Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -497,14 +497,25 @@ in_arpinput(m)
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));
+ "entry for %s by %s on %s\n",
+ inet_ntoa(isaddr),
+ ether_sprintf(ea->arp_sha),
+ (&ac->ac_if)->if_xname);
+ goto out;
+ } else if (rt->rt_ifp != &ac->ac_if) {
+ log(LOG_WARNING,
+ "arp: attemt to overwrite entry for %s "
+ "on %s by %s on %s\n",
+ inet_ntoa(isaddr), rt->rt_ifp->if_xname,
+ ether_sprintf(ea->arp_sha),
+ (&ac->ac_if)->if_xname);
goto out;
} else {
log(LOG_INFO,
- "arp info overwritten for %s by %s\n",
+ "arp info overwritten for %s by %s on %s\n",
inet_ntoa(isaddr),
- ether_sprintf(ea->arp_sha));
+ ether_sprintf(ea->arp_sha),
+ (&ac->ac_if)->if_xname);
rt->rt_expire = 1; /* no longer static */
}
}