diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2008-10-09 03:31:08 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2008-10-09 03:31:08 +0000 |
commit | 488e645d6500a7b46a3b7c82d80afc317444b9c6 (patch) | |
tree | 283c7f65a38e86a8da210a2a9135dc982fe62736 /sys/net | |
parent | 0bed251bdd34ae18ff7ac26ae010f83109d7b033 (diff) |
Add fallback ioctl handlers for MTU and multicast to ether_ioctl().
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_ethersubr.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index 6315867c53b..45456994caa 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ethersubr.c,v 1.125 2008/10/02 20:21:14 brad Exp $ */ +/* $OpenBSD: if_ethersubr.c,v 1.126 2008/10/09 03:31:07 brad Exp $ */ /* $NetBSD: if_ethersubr.c,v 1.19 1996/05/07 02:40:30 thorpej Exp $ */ /* @@ -162,14 +162,11 @@ u_char etherbroadcastaddr[ETHER_ADDR_LEN] = int -ether_ioctl(ifp, arp, cmd, data) - struct ifnet *ifp; - struct arpcom *arp; - u_long cmd; - caddr_t data; +ether_ioctl(struct ifnet *ifp, struct arpcom *arp, u_long cmd, caddr_t data) { struct ifaddr *ifa = (struct ifaddr *)data; - int error = 0; + struct ifreq *ifr = (struct ifreq *)data; + int error = 0; switch (cmd) { case SIOCSIFADDR: @@ -181,11 +178,29 @@ ether_ioctl(ifp, arp, cmd, data) #endif /* NETATALK */ } break; + + case SIOCSIFMTU: + if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ifp->if_hardmtu) + error = EINVAL; + else + ifp->if_mtu = ifr->ifr_mtu; + break; + + case SIOCADDMULTI: + case SIOCDELMULTI: + if (ifp->if_flags & IFF_MULTICAST) { + error = (cmd == SIOCADDMULTI) ? + ether_addmulti(ifr, arp) : + ether_delmulti(ifr, arp); + } else + error = ENOTTY; + break; + default: error = ENOTTY; } - return error; + return (error); } /* |