SIOCSIFADDR, SIOCGIFADDR, and SIOCSIFMTU are implemented in

sys/net/if_ethersubr.c:ether_ioctl().  Drivers need not implement generic
behavior.

PR: kern/12126
Submitted by: in part by Boris Popov <bp@butya.kz>
This commit is contained in:
Matthew N. Dodd 1999-08-18 06:12:00 +00:00
parent f437b38cf7
commit b2864868b3
16 changed files with 76 additions and 1017 deletions

View File

@ -38,7 +38,7 @@
*/
/*
* $Id: if_ep.c,v 1.80 1999/07/06 19:22:46 des Exp $
* $Id: if_ep.c,v 1.81 1999/07/25 01:20:36 hosokawa Exp $
*
* Promiscuous mode added and interrupt logic slightly changed
* to reduce the number of adapter failures. Transceiver select
@ -78,21 +78,6 @@
#include <net/if.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
@ -1225,7 +1210,6 @@ epioctl(ifp, cmd, data)
u_long cmd;
caddr_t data;
{
register struct ifaddr *ifa = (struct ifaddr *) data;
struct ep_softc *sc = ifp->if_softc;
struct ifreq *ifr = (struct ifreq *) data;
int s, error = 0;
@ -1234,67 +1218,11 @@ epioctl(ifp, cmd, data)
switch (cmd) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
/* netifs are BUSY when UP */
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
epinit(sc); /* before arpwhohas */
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
#ifdef IPX
case AF_IPX:
{
register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
if (ipx_nullhost(*ina))
ina->x_host =
*(union ipx_host *) (sc->arpcom.ac_enaddr);
else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) sc->arpcom.ac_enaddr,
sizeof(sc->arpcom.ac_enaddr));
}
epinit(sc);
break;
}
#endif
#ifdef NS
case AF_NS:
{
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
ina->x_host =
*(union ns_host *) (sc->arpcom.ac_enaddr);
else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) sc->arpcom.ac_enaddr,
sizeof(sc->arpcom.ac_enaddr));
}
epinit(sc);
break;
}
#endif
default:
epinit(sc);
break;
}
break;
case SIOCGIFADDR:
{
struct sockaddr *sa;
sa = (struct sockaddr *) & ifr->ifr_data;
bcopy((caddr_t) sc->arpcom.ac_enaddr,
(caddr_t) sa->sa_data, ETHER_ADDR_LEN);
}
break;
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFFLAGS:
if ((ifp->if_flags & IFF_UP) == 0 && ifp->if_flags & IFF_RUNNING) {
@ -1315,17 +1243,6 @@ epioctl(ifp, cmd, data)
sizeof(sc->sc_addr));
break;
#endif
case SIOCSIFMTU:
/*
* Set the interface MTU.
*/
if (ifr->ifr_mtu > ETHERMTU) {
error = EINVAL;
} else {
ifp->if_mtu = ifr->ifr_mtu;
}
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
/*

View File

@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_ex.c,v 1.15 1999/05/02 22:01:24 peter Exp $
* $Id: if_ex.c,v 1.16 1999/07/06 19:22:47 des Exp $
*/
/*
@ -50,21 +50,6 @@
#include <net/if.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
@ -766,7 +751,6 @@ void ex_rx_intr(int unit)
int ex_ioctl(register struct ifnet *ifp, u_long cmd, caddr_t data)
{
register struct ifaddr *ifa = (struct ifaddr *) data;
struct ex_softc *sc = &ex_sc[ifp->if_unit];
struct ifreq *ifr = (struct ifreq *) data;
int s, error = 0;
@ -777,60 +761,11 @@ int ex_ioctl(register struct ifnet *ifp, u_long cmd, caddr_t data)
switch(cmd) {
case SIOCSIFADDR:
DODEBUG(Start_End, printf("SIOCSIFADDR"););
ifp->if_flags |= IFF_UP;
switch(ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
ex_init(sc);
arp_ifinit((struct arpcom *) ifp, ifa);
break;
#endif
#ifdef IPX_NOTYET
case AF_IPX:
{
register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
if (ipx_nullhost(*ina))
ina->x_host = *(union ipx_host *) (sc->arpcom.ac_enaddr);
else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host, (caddr_t) sc->arpcom.ac_enaddr, sizeof(sc->arpcom.ac_enaddr));
}
ex_init(sc);
break;
}
#endif
#ifdef NS
case AF_NS:
{
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
ina->x_host = *(union ns_host *) (sc->arpcom.ac_enaddr);
else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host, (caddr_t) sc->arpcom.ac_enaddr, sizeof(sc->arpcom.ac_enaddr));
}
ex_init(sc);
break;
}
#endif
default:
ex_init(sc);
break;
}
break;
case SIOCGIFADDR:
{
struct sockaddr *sa;
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
DODEBUG(Start_End, printf("SIOCGIFADDR"););
sa = (struct sockaddr *) &ifr->ifr_data;
bcopy((caddr_t) sc->arpcom.ac_enaddr, (caddr_t) sa->sa_data, ETHER_ADDR_LEN);
}
break;
case SIOCSIFFLAGS:
DODEBUG(Start_End, printf("SIOCSIFFLAGS"););
if ((ifp->if_flags & IFF_UP) == 0 && ifp->if_flags & IFF_RUNNING) {
@ -846,13 +781,6 @@ int ex_ioctl(register struct ifnet *ifp, u_long cmd, caddr_t data)
bcopy((caddr_t) sc->sc_addr, (caddr_t) &ifr->ifr_data, sizeof(sc->sc_addr));
break;
#endif
case SIOCSIFMTU:
DODEBUG(Start_End, printf("SIOCSIFMTU"););
if (ifr->ifr_mtu > ETHERMTU)
error = EINVAL;
else
ifp->if_mtu = ifr->ifr_mtu;
break;
case SIOCADDMULTI:
DODEBUG(Start_End, printf("SIOCADDMULTI"););
case SIOCDELMULTI:

View File

@ -21,7 +21,7 @@
*/
/*
* $Id: if_fe.c,v 1.50 1999/05/04 12:59:59 kato Exp $
* $Id: if_fe.c,v 1.51 1999/07/06 19:22:48 des Exp $
*
* Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
* To be used with FreeBSD 3.x
@ -87,29 +87,6 @@
#include <net/if_media.h>
#include <net/if_types.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
/* IPX code is not tested. FIXME. */
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
/* To be used with IPv6 package of INRIA. */
#ifdef INET6
/* IPv6 added by shin 96.2.6 */
#include <netinet/if_ether6.h>
#endif
/* XNS code is not tested. FIXME. */
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif

View File

@ -47,7 +47,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_ie.c,v 1.60 1999/05/13 12:21:41 bde Exp $
* $Id: if_ie.c,v 1.61 1999/07/06 19:22:49 des Exp $
*/
/*
@ -127,21 +127,6 @@ iomem and and with 0xffff.
#include "bpf.h"
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#include <machine/clock.h>
#include <machine/md_var.h>
@ -2258,80 +2243,16 @@ ie_stop(int unit)
static int
ieioctl(struct ifnet *ifp, u_long command, caddr_t data)
{
struct ifaddr *ifa = (struct ifaddr *) data;
#if defined(IPX) || defined(NS)
struct ie_softc *ie = ifp->if_softc;
#endif
struct ifreq *ifr = (struct ifreq *) data;
int s, error = 0;
s = splimp();
switch (command) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
ieinit(ifp->if_unit);
arp_ifinit((struct arpcom *) ifp, ifa);
break;
#endif /* INET */
#ifdef IPX
/*
* This magic copied from if_is.c; I don't use XNS,
* so I have no way of telling if this actually
* works or not.
*/
case AF_IPX:
{
struct ipx_addr *ina =
&(IA_SIPX(ifa)->sipx_addr);
if (ipx_nullhost(*ina)) {
ina->x_host = *(union ipx_host *) (ie->arpcom.ac_enaddr);
} else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) ie->arpcom.ac_enaddr,
sizeof ie->arpcom.ac_enaddr);
}
ieinit(ifp->if_unit);
}
break;
#endif /* IPX */
#ifdef NS
/*
* This magic copied from if_is.c; I don't use XNS,
* so I have no way of telling if this actually
* works or not.
*/
case AF_NS:
{
struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina)) {
ina->x_host = *(union ns_host *)(ie->arpcom.ac_enaddr);
} else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) ie->arpcom.ac_enaddr,
sizeof ie->arpcom.ac_enaddr);
}
ieinit(ifp->if_unit);
}
break;
#endif /* NS */
default:
ieinit(ifp->if_unit);
break;
}
case SIOCSIFADDR:
case SIOCGIFADDR:
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFFLAGS:
@ -2367,17 +2288,6 @@ ieioctl(struct ifnet *ifp, u_long command, caddr_t data)
error = 0;
break;
case SIOCSIFMTU:
/*
* Set the interface MTU.
*/
if (ifr->ifr_mtu > ETHERMTU) {
error = EINVAL;
} else {
ifp->if_mtu = ifr->ifr_mtu;
}
break;
default:
error = EINVAL;
}

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_lnc.c,v 1.61 1999/07/06 19:22:50 des Exp $
* $Id: if_lnc.c,v 1.62 1999/08/10 01:03:49 mdodd Exp $
*/
/*
@ -83,10 +83,6 @@
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
@ -1845,28 +1841,17 @@ lnc_ioctl(struct ifnet * ifp, u_long command, caddr_t data)
{
struct lnc_softc *sc = ifp->if_softc;
struct ifaddr *ifa = (struct ifaddr *) data;
struct ifreq *ifr = (struct ifreq *) data;
int s, error = 0;
s = splimp();
switch (command) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
lnc_init(sc);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
default:
lnc_init(sc);
break;
}
break;
case SIOCSIFADDR:
case SIOCGIFADDR:
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFFLAGS:
#ifdef DEBUG
@ -1917,16 +1902,6 @@ lnc_ioctl(struct ifnet * ifp, u_long command, caddr_t data)
lnc_init(sc);
error = 0;
break;
case SIOCSIFMTU:
/*
* Set the interface MTU.
*/
if (ifr->ifr_mtu > ETHERMTU) {
error = EINVAL;
} else
ifp->if_mtu = ifr->ifr_mtu;
break;
default:
error = EINVAL;
}

View File

@ -1,4 +1,4 @@
/* $Id: if_wl.c,v 1.21 1999/04/27 11:15:02 phk Exp $ */
/* $Id: if_wl.c,v 1.22 1999/07/06 19:22:54 des Exp $ */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -1160,7 +1160,6 @@ wlread(int unit, u_short fd_p)
static int
wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
register struct ifaddr *ifa = (struct ifaddr *)data;
register struct ifreq *ifr = (struct ifreq *)data;
int unit = ifp->if_unit;
register struct wl_softc *sc = WLSOFTC(unit);
@ -1180,33 +1179,11 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
opri = splimp();
switch (cmd) {
case SIOCSIFADDR:
/* Set own IP address and enable interface */
ifp->if_flags |= IFF_UP;
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
wlinit(sc);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
#ifdef NS
case AF_NS:
{
register struct ns_addr *ina =
&(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
ina->x_host = *(union ns_host *)(ds->wl_addr);
else
wlsetaddr(ina->x_host.c_host, unit);
wlinit(sc);
break;
}
#endif
default:
wlinit(sc);
break;
}
break;
case SIOCGIFADDR:
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFFLAGS:
if (ifp->if_flags & IFF_ALLMULTI) {
mode |= MOD_ENAL;

View File

@ -6,7 +6,7 @@
*
* Questions, comments, bug reports and fixes to kimmel@cs.umass.edu.
*
* $Id: if_el.c,v 1.40 1999/01/12 01:29:42 eivind Exp $
* $Id: if_el.c,v 1.41 1999/07/06 19:22:45 des Exp $
*/
/* Except of course for the portions of code lifted from other FreeBSD
* drivers (mainly elread, elget and el_ioctl)
@ -33,21 +33,6 @@
#include <net/if.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
@ -651,7 +636,6 @@ el_ioctl(ifp, command, data)
u_long command;
caddr_t data;
{
register struct ifaddr *ifa = (struct ifaddr *)data;
struct el_softc *sc = ifp->if_softc;
struct ifreq *ifr = (struct ifreq *)data;
int s, error = 0;
@ -659,82 +643,10 @@ el_ioctl(ifp, command, data)
s = splimp();
switch (command) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
el_init(ifp->if_unit); /* before arpwhohas */
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
#ifdef IPX
/*
* XXX - This code is probably wrong
*/
case AF_IPX:
{
register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
if (ipx_nullhost(*ina))
ina->x_host =
*(union ipx_host *)(sc->arpcom.ac_enaddr);
else {
/*
*
*/
bcopy((caddr_t)ina->x_host.c_host,
(caddr_t)sc->arpcom.ac_enaddr,
sizeof(sc->arpcom.ac_enaddr));
}
/*
* Set new address
*/
el_init(ifp->if_unit);
break;
}
#endif
#ifdef NS
/*
* XXX - This code is probably wrong
*/
case AF_NS:
{
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
ina->x_host =
*(union ns_host *)(sc->arpcom.ac_enaddr);
else {
/*
*
*/
bcopy((caddr_t)ina->x_host.c_host,
(caddr_t)sc->arpcom.ac_enaddr,
sizeof(sc->arpcom.ac_enaddr));
}
/*
* Set new address
*/
el_init(ifp->if_unit);
break;
}
#endif
default:
el_init(ifp->if_unit);
break;
}
break;
case SIOCSIFADDR:
case SIOCGIFADDR:
{
struct sockaddr *sa;
sa = (struct sockaddr *)&ifr->ifr_data;
bcopy((caddr_t)sc->arpcom.ac_enaddr,
(caddr_t) sa->sa_data, ETHER_ADDR_LEN);
}
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFFLAGS:
@ -754,19 +666,6 @@ el_ioctl(ifp, command, data)
el_init(ifp->if_unit);
}
break;
case SIOCSIFMTU:
/*
* Set the interface MTU.
*/
if (ifr->ifr_mtu > ETHERMTU) {
error = EINVAL;
} else {
ifp->if_mtu = ifr->ifr_mtu;
}
break;
default:
error = EINVAL;
}

View File

@ -38,7 +38,7 @@
*/
/*
* $Id: if_ep.c,v 1.80 1999/07/06 19:22:46 des Exp $
* $Id: if_ep.c,v 1.81 1999/07/25 01:20:36 hosokawa Exp $
*
* Promiscuous mode added and interrupt logic slightly changed
* to reduce the number of adapter failures. Transceiver select
@ -78,21 +78,6 @@
#include <net/if.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
@ -1225,7 +1210,6 @@ epioctl(ifp, cmd, data)
u_long cmd;
caddr_t data;
{
register struct ifaddr *ifa = (struct ifaddr *) data;
struct ep_softc *sc = ifp->if_softc;
struct ifreq *ifr = (struct ifreq *) data;
int s, error = 0;
@ -1234,67 +1218,11 @@ epioctl(ifp, cmd, data)
switch (cmd) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
/* netifs are BUSY when UP */
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
epinit(sc); /* before arpwhohas */
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
#ifdef IPX
case AF_IPX:
{
register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
if (ipx_nullhost(*ina))
ina->x_host =
*(union ipx_host *) (sc->arpcom.ac_enaddr);
else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) sc->arpcom.ac_enaddr,
sizeof(sc->arpcom.ac_enaddr));
}
epinit(sc);
break;
}
#endif
#ifdef NS
case AF_NS:
{
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
ina->x_host =
*(union ns_host *) (sc->arpcom.ac_enaddr);
else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) sc->arpcom.ac_enaddr,
sizeof(sc->arpcom.ac_enaddr));
}
epinit(sc);
break;
}
#endif
default:
epinit(sc);
break;
}
break;
case SIOCGIFADDR:
{
struct sockaddr *sa;
sa = (struct sockaddr *) & ifr->ifr_data;
bcopy((caddr_t) sc->arpcom.ac_enaddr,
(caddr_t) sa->sa_data, ETHER_ADDR_LEN);
}
break;
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFFLAGS:
if ((ifp->if_flags & IFF_UP) == 0 && ifp->if_flags & IFF_RUNNING) {
@ -1315,17 +1243,6 @@ epioctl(ifp, cmd, data)
sizeof(sc->sc_addr));
break;
#endif
case SIOCSIFMTU:
/*
* Set the interface MTU.
*/
if (ifr->ifr_mtu > ETHERMTU) {
error = EINVAL;
} else {
ifp->if_mtu = ifr->ifr_mtu;
}
break;
case SIOCADDMULTI:
case SIOCDELMULTI:
/*

View File

@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_ex.c,v 1.15 1999/05/02 22:01:24 peter Exp $
* $Id: if_ex.c,v 1.16 1999/07/06 19:22:47 des Exp $
*/
/*
@ -50,21 +50,6 @@
#include <net/if.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
@ -766,7 +751,6 @@ void ex_rx_intr(int unit)
int ex_ioctl(register struct ifnet *ifp, u_long cmd, caddr_t data)
{
register struct ifaddr *ifa = (struct ifaddr *) data;
struct ex_softc *sc = &ex_sc[ifp->if_unit];
struct ifreq *ifr = (struct ifreq *) data;
int s, error = 0;
@ -777,60 +761,11 @@ int ex_ioctl(register struct ifnet *ifp, u_long cmd, caddr_t data)
switch(cmd) {
case SIOCSIFADDR:
DODEBUG(Start_End, printf("SIOCSIFADDR"););
ifp->if_flags |= IFF_UP;
switch(ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
ex_init(sc);
arp_ifinit((struct arpcom *) ifp, ifa);
break;
#endif
#ifdef IPX_NOTYET
case AF_IPX:
{
register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
if (ipx_nullhost(*ina))
ina->x_host = *(union ipx_host *) (sc->arpcom.ac_enaddr);
else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host, (caddr_t) sc->arpcom.ac_enaddr, sizeof(sc->arpcom.ac_enaddr));
}
ex_init(sc);
break;
}
#endif
#ifdef NS
case AF_NS:
{
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
ina->x_host = *(union ns_host *) (sc->arpcom.ac_enaddr);
else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host, (caddr_t) sc->arpcom.ac_enaddr, sizeof(sc->arpcom.ac_enaddr));
}
ex_init(sc);
break;
}
#endif
default:
ex_init(sc);
break;
}
break;
case SIOCGIFADDR:
{
struct sockaddr *sa;
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
DODEBUG(Start_End, printf("SIOCGIFADDR"););
sa = (struct sockaddr *) &ifr->ifr_data;
bcopy((caddr_t) sc->arpcom.ac_enaddr, (caddr_t) sa->sa_data, ETHER_ADDR_LEN);
}
break;
case SIOCSIFFLAGS:
DODEBUG(Start_End, printf("SIOCSIFFLAGS"););
if ((ifp->if_flags & IFF_UP) == 0 && ifp->if_flags & IFF_RUNNING) {
@ -846,13 +781,6 @@ int ex_ioctl(register struct ifnet *ifp, u_long cmd, caddr_t data)
bcopy((caddr_t) sc->sc_addr, (caddr_t) &ifr->ifr_data, sizeof(sc->sc_addr));
break;
#endif
case SIOCSIFMTU:
DODEBUG(Start_End, printf("SIOCSIFMTU"););
if (ifr->ifr_mtu > ETHERMTU)
error = EINVAL;
else
ifp->if_mtu = ifr->ifr_mtu;
break;
case SIOCADDMULTI:
DODEBUG(Start_End, printf("SIOCADDMULTI"););
case SIOCDELMULTI:

View File

@ -21,7 +21,7 @@
*/
/*
* $Id: if_fe.c,v 1.50 1999/05/04 12:59:59 kato Exp $
* $Id: if_fe.c,v 1.51 1999/07/06 19:22:48 des Exp $
*
* Device driver for Fujitsu MB86960A/MB86965A based Ethernet cards.
* To be used with FreeBSD 3.x
@ -87,29 +87,6 @@
#include <net/if_media.h>
#include <net/if_types.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
/* IPX code is not tested. FIXME. */
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
/* To be used with IPv6 package of INRIA. */
#ifdef INET6
/* IPv6 added by shin 96.2.6 */
#include <netinet/if_ether6.h>
#endif
/* XNS code is not tested. FIXME. */
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif

View File

@ -47,7 +47,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_ie.c,v 1.60 1999/05/13 12:21:41 bde Exp $
* $Id: if_ie.c,v 1.61 1999/07/06 19:22:49 des Exp $
*/
/*
@ -127,21 +127,6 @@ iomem and and with 0xffff.
#include "bpf.h"
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#include <machine/clock.h>
#include <machine/md_var.h>
@ -2258,80 +2243,16 @@ ie_stop(int unit)
static int
ieioctl(struct ifnet *ifp, u_long command, caddr_t data)
{
struct ifaddr *ifa = (struct ifaddr *) data;
#if defined(IPX) || defined(NS)
struct ie_softc *ie = ifp->if_softc;
#endif
struct ifreq *ifr = (struct ifreq *) data;
int s, error = 0;
s = splimp();
switch (command) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
ieinit(ifp->if_unit);
arp_ifinit((struct arpcom *) ifp, ifa);
break;
#endif /* INET */
#ifdef IPX
/*
* This magic copied from if_is.c; I don't use XNS,
* so I have no way of telling if this actually
* works or not.
*/
case AF_IPX:
{
struct ipx_addr *ina =
&(IA_SIPX(ifa)->sipx_addr);
if (ipx_nullhost(*ina)) {
ina->x_host = *(union ipx_host *) (ie->arpcom.ac_enaddr);
} else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) ie->arpcom.ac_enaddr,
sizeof ie->arpcom.ac_enaddr);
}
ieinit(ifp->if_unit);
}
break;
#endif /* IPX */
#ifdef NS
/*
* This magic copied from if_is.c; I don't use XNS,
* so I have no way of telling if this actually
* works or not.
*/
case AF_NS:
{
struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina)) {
ina->x_host = *(union ns_host *)(ie->arpcom.ac_enaddr);
} else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) ie->arpcom.ac_enaddr,
sizeof ie->arpcom.ac_enaddr);
}
ieinit(ifp->if_unit);
}
break;
#endif /* NS */
default:
ieinit(ifp->if_unit);
break;
}
case SIOCSIFADDR:
case SIOCGIFADDR:
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFFLAGS:
@ -2367,17 +2288,6 @@ ieioctl(struct ifnet *ifp, u_long command, caddr_t data)
error = 0;
break;
case SIOCSIFMTU:
/*
* Set the interface MTU.
*/
if (ifr->ifr_mtu > ETHERMTU) {
error = EINVAL;
} else {
ifp->if_mtu = ifr->ifr_mtu;
}
break;
default:
error = EINVAL;
}

View File

@ -21,7 +21,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: if_le.c,v 1.50 1999/05/11 19:54:12 phk Exp $
* $Id: if_le.c,v 1.51 1999/07/06 19:22:49 des Exp $
*/
/*
@ -54,21 +54,6 @@
#include "bpf.h"
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#include <machine/clock.h>
#include <i386/isa/isa_device.h>
@ -513,65 +498,11 @@ le_ioctl(
s = splimp();
switch (cmd) {
case SIOCSIFADDR: {
struct ifaddr *ifa = (struct ifaddr *)data;
ifp->if_flags |= IFF_UP;
switch(ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET: {
(*sc->if_init)(ifp->if_unit);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
}
#endif /* INET */
#ifdef IPX
/* This magic copied from if_is.c; I don't use XNS,
* so I have no way of telling if this actually
* works or not.
*/
case AF_IPX: {
struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
if (ipx_nullhost(*ina)) {
ina->x_host = *(union ipx_host *)(sc->le_ac.ac_enaddr);
} else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t)ina->x_host.c_host,
(caddr_t)sc->le_ac.ac_enaddr,
sizeof sc->le_ac.ac_enaddr);
}
(*sc->if_init)(ifp->if_unit);
break;
}
#endif /* IPX */
#ifdef NS
/* This magic copied from if_is.c; I don't use XNS,
* so I have no way of telling if this actually
* works or not.
*/
case AF_NS: {
struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina)) {
ina->x_host = *(union ns_host *)(sc->le_ac.ac_enaddr);
} else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t)ina->x_host.c_host,
(caddr_t)sc->le_ac.ac_enaddr,
sizeof sc->le_ac.ac_enaddr);
}
(*sc->if_init)(ifp->if_unit);
break;
}
#endif /* NS */
default: {
(*sc->if_init)(ifp->if_unit);
break;
}
}
break;
}
case SIOCSIFADDR:
case SIOCGIFADDR:
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFFLAGS: {
(*sc->if_init)(ifp->if_unit);

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: if_lnc.c,v 1.61 1999/07/06 19:22:50 des Exp $
* $Id: if_lnc.c,v 1.62 1999/08/10 01:03:49 mdodd Exp $
*/
/*
@ -83,10 +83,6 @@
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
@ -1845,28 +1841,17 @@ lnc_ioctl(struct ifnet * ifp, u_long command, caddr_t data)
{
struct lnc_softc *sc = ifp->if_softc;
struct ifaddr *ifa = (struct ifaddr *) data;
struct ifreq *ifr = (struct ifreq *) data;
int s, error = 0;
s = splimp();
switch (command) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
lnc_init(sc);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
default:
lnc_init(sc);
break;
}
break;
case SIOCSIFADDR:
case SIOCGIFADDR:
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFFLAGS:
#ifdef DEBUG
@ -1917,16 +1902,6 @@ lnc_ioctl(struct ifnet * ifp, u_long command, caddr_t data)
lnc_init(sc);
error = 0;
break;
case SIOCSIFMTU:
/*
* Set the interface MTU.
*/
if (ifr->ifr_mtu > ETHERMTU) {
error = EINVAL;
} else
ifp->if_mtu = ifr->ifr_mtu;
break;
default:
error = EINVAL;
}

View File

@ -1,4 +1,4 @@
/* $Id: if_wl.c,v 1.21 1999/04/27 11:15:02 phk Exp $ */
/* $Id: if_wl.c,v 1.22 1999/07/06 19:22:54 des Exp $ */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -1160,7 +1160,6 @@ wlread(int unit, u_short fd_p)
static int
wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
{
register struct ifaddr *ifa = (struct ifaddr *)data;
register struct ifreq *ifr = (struct ifreq *)data;
int unit = ifp->if_unit;
register struct wl_softc *sc = WLSOFTC(unit);
@ -1180,33 +1179,11 @@ wlioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
opri = splimp();
switch (cmd) {
case SIOCSIFADDR:
/* Set own IP address and enable interface */
ifp->if_flags |= IFF_UP;
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
wlinit(sc);
arp_ifinit((struct arpcom *)ifp, ifa);
break;
#endif
#ifdef NS
case AF_NS:
{
register struct ns_addr *ina =
&(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
ina->x_host = *(union ns_host *)(ds->wl_addr);
else
wlsetaddr(ina->x_host.c_host, unit);
wlinit(sc);
break;
}
#endif
default:
wlinit(sc);
break;
}
break;
case SIOCGIFADDR:
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFFLAGS:
if (ifp->if_flags & IFF_ALLMULTI) {
mode |= MOD_ENAL;

View File

@ -47,7 +47,7 @@
*/
/*
* $Id: if_ze.c,v 1.58 1999/05/06 18:43:58 peter Exp $
* $Id: if_ze.c,v 1.59 1999/07/06 19:22:55 des Exp $
*/
/* XXX don't mix different PCCARD support code. */
@ -77,21 +77,6 @@ static char const zedummy[] = "code to use the includes of card.h and pcic.h";
#include <net/if.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
@ -1331,81 +1316,17 @@ ze_ioctl(ifp, command, data)
u_long command;
caddr_t data;
{
register struct ifaddr *ifa = (struct ifaddr *)data;
struct ze_softc *sc = ifp->if_softc;
int s, error = 0;
s = splnet();
switch (command) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
ze_init(ifp->if_unit); /* before arpwhohas */
arp_ifinit((struct arpcom*) ifp, ifa);
break;
#endif
#ifdef IPX
/*
* XXX - This code is probably wrong
*/
case AF_IPX:
{
register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
if (ipx_nullhost(*ina))
ina->x_host =
*(union ipx_host *)(sc->arpcom.ac_enaddr);
else {
/*
*
*/
bcopy((caddr_t)ina->x_host.c_host,
(caddr_t)sc->arpcom.ac_enaddr,
sizeof(sc->arpcom.ac_enaddr));
}
/*
* Set new address
*/
ze_init(ifp->if_unit);
break;
}
#endif
#ifdef NS
/*
* XXX - This code is probably wrong
*/
case AF_NS:
{
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
ina->x_host =
*(union ns_host *)(sc->arpcom.ac_enaddr);
else {
/*
*
*/
bcopy((caddr_t)ina->x_host.c_host,
(caddr_t)sc->arpcom.ac_enaddr,
sizeof(sc->arpcom.ac_enaddr));
}
/*
* Set new address
*/
ze_init(ifp->if_unit);
break;
}
#endif
default:
ze_init(ifp->if_unit);
break;
}
break;
case SIOCSIFADDR:
case SIOCGIFADDR:
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
case SIOCSIFFLAGS:
/*

View File

@ -34,7 +34,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* From: if_ep.c,v 1.9 1994/01/25 10:46:29 deraadt Exp $
* $Id: if_zp.c,v 1.51 1999/04/19 06:56:24 imp Exp $
* $Id: if_zp.c,v 1.52 1999/07/06 19:22:55 des Exp $
*/
/*-
* TODO:
@ -130,21 +130,6 @@ static char const zpdummy[] = "code to use the includes of card.h and pcic.h";
#include <net/if.h>
#ifdef INET
#include <netinet/in.h>
#include <netinet/if_ether.h>
#endif
#ifdef IPX
#include <netipx/ipx.h>
#include <netipx/ipx_if.h>
#endif
#ifdef NS
#include <netns/ns.h>
#include <netns/ns_if.h>
#endif
#if NBPF > 0
#include <net/bpf.h>
#endif
@ -1014,62 +999,17 @@ zpioctl(ifp, cmd, data)
u_long cmd;
caddr_t data;
{
register struct ifaddr *ifa = (struct ifaddr *) data;
struct zp_softc *sc = ifp->if_softc;
int error = 0;
switch (cmd) {
case SIOCSIFADDR:
ifp->if_flags |= IFF_UP;
switch (ifa->ifa_addr->sa_family) {
#ifdef INET
case AF_INET:
zpinit(ifp->if_unit); /* before arpwhohas */
arp_ifinit((struct arpcom *) ifp, ifa);
break;
#endif
#ifdef IPX
case AF_IPX:
{
register struct ipx_addr *ina = &(IA_SIPX(ifa)->sipx_addr);
case SIOCSIFADDR:
case SIOCGIFADDR:
case SIOCSIFMTU:
error = ether_ioctl(ifp, command, data);
break;
if (ipx_nullhost(*ina))
ina->x_host =
*(union ipx_host *) (sc->arpcom.ac_enaddr);
else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) sc->arpcom.ac_enaddr,
sizeof(sc->arpcom.ac_enaddr));
}
zpinit(ifp->if_unit);
break;
}
#endif
#ifdef NS
case AF_NS:
{
register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
if (ns_nullhost(*ina))
ina->x_host =
*(union ns_host *) (sc->arpcom.ac_enaddr);
else {
ifp->if_flags &= ~IFF_RUNNING;
bcopy((caddr_t) ina->x_host.c_host,
(caddr_t) sc->arpcom.ac_enaddr,
sizeof(sc->arpcom.ac_enaddr));
}
zpinit(ifp->if_unit);
break;
}
#endif
default:
zpinit(ifp->if_unit);
break;
}
break;
case SIOCSIFFLAGS:
if ((ifp->if_flags & IFF_UP) == 0 && ifp->if_flags & IFF_RUNNING) {
ifp->if_flags &= ~IFF_RUNNING;