summaryrefslogtreecommitdiff
path: root/sys/dev/usb/if_cdce.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2013-12-07 20:17:43 +0000
committerBrad Smith <brad@cvs.openbsd.org>2013-12-07 20:17:43 +0000
commit3da1225f7dc413907f60dc6f9a59f9699d16d544 (patch)
tree9a816a3530c882b3284f7aacb0e5f4fb87119640 /sys/dev/usb/if_cdce.c
parent4230b885fd5b413f90a51aba1f2ec3e4f1f2447b (diff)
Some cleaning up of the ioctl handling bits to bring things in line
with the other drivers. No functional change.
Diffstat (limited to 'sys/dev/usb/if_cdce.c')
-rw-r--r--sys/dev/usb/if_cdce.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sys/dev/usb/if_cdce.c b/sys/dev/usb/if_cdce.c
index 591e91931cd..12ec05ec4c4 100644
--- a/sys/dev/usb/if_cdce.c
+++ b/sys/dev/usb/if_cdce.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_cdce.c,v 1.58 2013/12/04 00:52:52 deraadt Exp $ */
+/* $OpenBSD: if_cdce.c,v 1.59 2013/12/07 20:17:42 brad Exp $ */
/*
* Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wpaul@windriver.com>
@@ -528,23 +528,24 @@ cdce_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
switch(command) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
- cdce_init(sc);
- switch (ifa->ifa_addr->sa_family) {
- case AF_INET:
+ if (!(ifp->if_flags & IFF_RUNNING))
+ cdce_init(sc);
+#ifdef INET
+ if (ifa->ifa_addr->sa_family == AF_INET)
arp_ifinit(&sc->cdce_arpcom, ifa);
- break;
- }
+#endif
break;
case SIOCSIFFLAGS:
if (ifp->if_flags & IFF_UP) {
- if (!(ifp->if_flags & IFF_RUNNING))
+ if (ifp->if_flags & IFF_RUNNING)
+ error = ENETRESET;
+ else
cdce_init(sc);
} else {
if (ifp->if_flags & IFF_RUNNING)
cdce_stop(sc);
}
- error = 0;
break;
default:
@@ -580,9 +581,6 @@ cdce_init(void *xsc)
usbd_status err;
int s, i;
- if (ifp->if_flags & IFF_RUNNING)
- return;
-
s = splnet();
if (sc->cdce_intr_no != -1 && sc->cdce_intr_pipe == NULL) {