summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2000-09-07 04:48:59 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2000-09-07 04:48:59 +0000
commit07e3237c8a882efb017ff0c24234ce058f452c60 (patch)
treed9faa8b75b11ab0b1019e9bdcb5fd30a4c3532e3 /sys
parent3e59a4e56291301564716d995df45617dccdb6d6 (diff)
if an interface comes up with a bad ethernet address, change it --
setting it to fe:e1:ba:d0:xx where xx is a random number. this avoids various network catastrophies, and also client machines will complain everytime that server is rebooted...
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_ethersubr.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index 7534a603006..5d013140805 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ethersubr.c,v 1.37 2000/06/02 15:44:56 jason Exp $ */
+/* $OpenBSD: if_ethersubr.c,v 1.38 2000/09/07 04:48:58 deraadt Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */
/*
@@ -850,6 +850,19 @@ ether_ifattach(ifp)
register struct ifaddr *ifa;
register struct sockaddr_dl *sdl;
+ /*
+ * Any interface which provides a MAC address which is obviously
+ * invalid gets whacked, so that users will notice.
+ */
+ if (ETHER_IS_MULTICAST(((struct arpcom *)ifp)->ac_enaddr)) {
+ ((struct arpcom *)ifp)->ac_enaddr[0] = 0x00;
+ ((struct arpcom *)ifp)->ac_enaddr[1] = 0xfe;
+ ((struct arpcom *)ifp)->ac_enaddr[2] = 0xe1;
+ ((struct arpcom *)ifp)->ac_enaddr[3] = 0xba;
+ ((struct arpcom *)ifp)->ac_enaddr[4] = 0xd0;
+ ((struct arpcom *)ifp)->ac_enaddr[5] = (u_char)arc4random();
+ }
+
ifp->if_type = IFT_ETHER;
ifp->if_addrlen = 6;
ifp->if_hdrlen = 14;