diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2018-05-25 06:05:09 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2018-05-25 06:05:09 +0000 |
commit | 60f4140c0d53729f3e09f4ce03d2e7d62aacf697 (patch) | |
tree | 51c37ccf2e031fafcd0d8c8a33534c3f8b91572f /sys/netinet | |
parent | 33e511d9c5b6415da06508a687bb82dc652cb78d (diff) |
Prepare in_ioctl() for further refactoring with the goal of merging the
two big switches in this function. Error out early in the default case
without grabbing the NET_LOCK() and move SIOCSIFNETMASK a bit up. This
will reduce the noise in an upcoming diff.
ok visa
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/in.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/sys/netinet/in.c b/sys/netinet/in.c index dc8cfa3efb2..9c6b5cbc42c 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.151 2018/05/02 12:40:52 tb Exp $ */ +/* $OpenBSD: in.c,v 1.152 2018/05/25 06:05:08 tb Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -227,6 +227,15 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged) case SIOCGIFDSTADDR: case SIOCGIFBRDADDR: return in_ioctl_get(cmd, data, ifp); + case SIOCAIFADDR: + case SIOCDIFADDR: + case SIOCSIFADDR: + case SIOCSIFNETMASK: + case SIOCSIFDSTADDR: + case SIOCSIFBRDADDR: + break; + default: + return (EOPNOTSUPP); } NET_LOCK(); @@ -329,6 +338,11 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged) ifa_update_broadaddr(ifp, &ia->ia_ifa, &ifr->ifr_broadaddr); break; + case SIOCSIFNETMASK: + ia->ia_netmask = ia->ia_sockmask.sin_addr.s_addr = + ifra->ifra_addr.sin_addr.s_addr; + break; + case SIOCSIFADDR: in_ifscrub(ifp, ia); error = in_ifinit(ifp, ia, satosin(&ifr->ifr_addr), newifaddr); @@ -337,11 +351,6 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged) dohooks(ifp->if_addrhooks, 0); break; - case SIOCSIFNETMASK: - ia->ia_netmask = ia->ia_sockmask.sin_addr.s_addr = - ifra->ifra_addr.sin_addr.s_addr; - break; - case SIOCAIFADDR: { int needinit = 0; @@ -390,10 +399,6 @@ in_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp, int privileged) in_purgeaddr(&ia->ia_ifa); dohooks(ifp->if_addrhooks, 0); break; - - default: - error = EOPNOTSUPP; - break; } err: |