- Modify ether_ioctl() for readability. No functional change.

- KNF
This commit is contained in:
msaitoh 2017-11-22 04:27:57 +00:00
parent 922a211b53
commit df22004151

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ethersubr.c,v 1.246 2017/11/16 03:07:18 ozaki-r Exp $ */
/* $NetBSD: if_ethersubr.c,v 1.247 2017/11/22 04:27:57 msaitoh Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.246 2017/11/16 03:07:18 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.247 2017/11/22 04:27:57 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -226,13 +226,13 @@ ether_output(struct ifnet * const ifp0, struct mbuf * const m0,
ifp = ifp->if_carpdev;
/* ac = (struct arpcom *)ifp; */
if ((ifp0->if_flags & (IFF_UP|IFF_RUNNING)) !=
(IFF_UP|IFF_RUNNING))
if ((ifp0->if_flags & (IFF_UP | IFF_RUNNING)) !=
(IFF_UP | IFF_RUNNING))
senderr(ENETDOWN);
}
#endif /* NCARP > 0 */
if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING))
senderr(ENETDOWN);
switch (dst->sa_family) {
@ -640,7 +640,7 @@ ether_input(struct ifnet *ifp, struct mbuf *m)
return;
}
#endif /* NCARP > 0 */
if ((m->m_flags & (M_BCAST|M_MCAST|M_PROMISC)) == 0 &&
if ((m->m_flags & (M_BCAST | M_MCAST | M_PROMISC)) == 0 &&
(ifp->if_flags & IFF_PROMISC) != 0 &&
memcmp(CLLADDR(ifp->if_sadl), eh->ether_dhost,
ETHER_ADDR_LEN) != 0) {
@ -1348,8 +1348,8 @@ ether_ioctl(struct ifnet *ifp, u_long cmd, void *data)
{
struct ifaddr *ifa = (struct ifaddr *)data;
if (ifa->ifa_addr->sa_family != AF_LINK
&& (ifp->if_flags & (IFF_UP|IFF_RUNNING)) !=
(IFF_UP|IFF_RUNNING)) {
&& (ifp->if_flags & (IFF_UP | IFF_RUNNING)) !=
(IFF_UP | IFF_RUNNING)) {
ifp->if_flags |= IFF_UP;
if ((error = (*ifp->if_init)(ifp)) != 0)
return error;
@ -1384,7 +1384,7 @@ ether_ioctl(struct ifnet *ifp, u_long cmd, void *data)
case SIOCSIFFLAGS:
if ((error = ifioctl_common(ifp, cmd, data)) != 0)
return error;
switch (ifp->if_flags & (IFF_UP|IFF_RUNNING)) {
switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) {
case IFF_RUNNING:
/*
* If interface is marked down and it is running,
@ -1398,18 +1398,21 @@ ether_ioctl(struct ifnet *ifp, u_long cmd, void *data)
* start it.
*/
return (*ifp->if_init)(ifp);
case IFF_UP|IFF_RUNNING:
case IFF_UP | IFF_RUNNING:
error = 0;
if (ec->ec_ifflags_cb == NULL ||
(error = (*ec->ec_ifflags_cb)(ec)) == ENETRESET) {
/*
* Reset the interface to pick up
* changes in any other flags that
* affect the hardware state.
*/
return (*ifp->if_init)(ifp);
} else
return error;
if (ec->ec_ifflags_cb != NULL) {
error = (*ec->ec_ifflags_cb)(ec);
if (error == ENETRESET) {
/*
* Reset the interface to pick up
* changes in any other flags that
* affect the hardware state.
*/
return (*ifp->if_init)(ifp);
}
} else
error = (*ifp->if_init)(ifp);
return error;
case 0:
break;
}