summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2006-08-10 20:52:55 +0000
committerBrad Smith <brad@cvs.openbsd.org>2006-08-10 20:52:55 +0000
commitc3858497156b5a8e7e0e0f15bcd81a5d19257960 (patch)
tree3bfe07a7a2015bf5da16a102e1e39ae4b75786d6 /sys/dev/ic
parent522ccb307c4359350d45da228cf986c78f4858d3 (diff)
- eliminate re-initialization's when adding IP addresses.
- simplify ioctl handler.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/dc.c30
1 files changed, 12 insertions, 18 deletions
diff --git a/sys/dev/ic/dc.c b/sys/dev/ic/dc.c
index 7c53a041857..e99e40d8b53 100644
--- a/sys/dev/ic/dc.c
+++ b/sys/dev/ic/dc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dc.c,v 1.95 2006/05/22 20:35:12 krw Exp $ */
+/* $OpenBSD: dc.c,v 1.96 2006/08/10 20:52:54 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999
@@ -3075,36 +3075,30 @@ dc_ioctl(ifp, command, data)
switch(command) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
- switch (ifa->ifa_addr->sa_family) {
- case AF_INET:
+ if (!(ifp->if_flags & IFF_RUNNING))
dc_init(sc);
+#ifdef INET
+ if (ifa->ifa_addr->sa_family == AF_INET)
arp_ifinit(&sc->sc_arpcom, ifa);
- break;
- default:
- dc_init(sc);
- break;
- }
+#endif
break;
case SIOCSIFFLAGS:
if (ifp->if_flags & IFF_UP) {
if (ifp->if_flags & IFF_RUNNING &&
- ifp->if_flags & IFF_PROMISC &&
- !(sc->dc_if_flags & IFF_PROMISC)) {
- dc_setfilt(sc);
- } else if (ifp->if_flags & IFF_RUNNING &&
- !(ifp->if_flags & IFF_PROMISC) &&
- sc->dc_if_flags & IFF_PROMISC) {
+ (ifp->if_flags ^ sc->dc_if_flags) &
+ IFF_PROMISC) {
dc_setfilt(sc);
- } else if (!(ifp->if_flags & IFF_RUNNING)) {
- sc->dc_txthresh = 0;
- dc_init(sc);
+ } else {
+ if (!(ifp->if_flags & IFF_RUNNING)) {
+ sc->dc_txthresh = 0;
+ dc_init(sc);
+ }
}
} else {
if (ifp->if_flags & IFF_RUNNING)
dc_stop(sc);
}
sc->dc_if_flags = ifp->if_flags;
- error = 0;
break;
case SIOCSIFMTU:
if (ifr->ifr_mtu > ETHERMTU || ifr->ifr_mtu < ETHERMIN) {