diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-05-06 13:06:41 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2010-05-06 13:06:41 +0000 |
commit | 6bf5d720f926e867f1201b2f6e13af768c5bbb4b (patch) | |
tree | 1b9425f7a0dc418b02ec154b3645aabd23513f4e /sys/net/if_tun.c | |
parent | 9ff5febd490f753232eb4892189f581276f0c237 (diff) |
Remove the incorrect if_media code. It is no longer needed to show and track
link states. Additionally do not up the interface when opening the device.
Resulting in the same behaviour as on real ethernet interfaces.
OK sthen
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r-- | sys/net/if_tun.c | 40 |
1 files changed, 3 insertions, 37 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 9f9f658a09a..844f9542826 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tun.c,v 1.105 2010/01/13 07:23:38 yasuoka Exp $ */ +/* $OpenBSD: if_tun.c,v 1.106 2010/05/06 13:06:40 claudio Exp $ */ /* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */ /* @@ -59,7 +59,6 @@ #include <machine/cpu.h> #include <net/if.h> -#include <net/if_media.h> #include <net/if_types.h> #include <net/netisr.h> #include <net/route.h> @@ -93,7 +92,6 @@ struct tun_softc { struct selinfo tun_rsel; /* read select */ struct selinfo tun_wsel; /* write select (not used) */ LIST_ENTRY(tun_softc) tun_list; /* all tunnel interfaces */ - struct ifmedia tun_media; int tun_unit; uid_t tun_siguid; /* uid for process that set tun_pgid */ uid_t tun_sigeuid; /* euid for process that set tun_pgid */ @@ -140,8 +138,6 @@ void filt_tunrdetach(struct knote *); void filt_tunwdetach(struct knote *); void tunstart(struct ifnet *); void tun_link_state(struct tun_softc *); -int tun_media_change(struct ifnet *); -void tun_media_status(struct ifnet *, struct ifmediareq *); struct filterops tunread_filtops = { 1, NULL, filt_tunrdetach, filt_tunread}; @@ -194,13 +190,10 @@ tun_create(struct if_clone *ifc, int unit, int flags) ifp->if_output = tun_output; ifp->if_start = tunstart; ifp->if_hardmtu = TUNMRU; + ifp->if_link_state = LINK_STATE_DOWN; IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); IFQ_SET_READY(&ifp->if_snd); - ifmedia_init(&tp->tun_media, 0, tun_media_change, tun_media_status); - ifmedia_add(&tp->tun_media, IFM_ETHER | IFM_AUTO, 0, NULL); - ifmedia_set(&tp->tun_media, IFM_ETHER | IFM_AUTO); - if ((flags & TUN_LAYER2) == 0) { tp->tun_flags &= ~TUN_LAYER2; ifp->if_mtu = ETHERMTU; @@ -371,11 +364,10 @@ tunopen(dev_t dev, int flag, int mode, struct proc *p) ifp = &tp->tun_if; tp->tun_flags |= TUN_OPEN; - /* automatically UP the interface on open */ + /* automatically mark the interface running on open */ s = splnet(); ifp->if_flags |= IFF_RUNNING; tun_link_state(tp); - if_up(ifp); splx(s); TUNDEBUG(("%s: open\n", ifp->if_xname)); @@ -561,10 +553,6 @@ tun_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = tun_switch(tp, ifp->if_flags & IFF_LINK0 ? TUN_LAYER2 : 0); break; - case SIOCGIFMEDIA: - case SIOCSIFMEDIA: - error = ifmedia_ioctl(ifp, ifr, &tp->tun_media, cmd); - break; default: if (tp->tun_flags & TUN_LAYER2) error = ether_ioctl(ifp, &tp->arpcom, cmd, data); @@ -1207,25 +1195,3 @@ tun_link_state(struct tun_softc *tp) if_link_state_change(ifp); } } - -int -tun_media_change(struct ifnet *ifp) -{ - /* Ignore */ - return (0); -} - -void -tun_media_status(struct ifnet *ifp, struct ifmediareq *imr) -{ - struct tun_softc *tp = ifp->if_softc; - - imr->ifm_active = IFM_ETHER | IFM_AUTO; - imr->ifm_status = IFM_AVALID; - - tun_link_state(tp); - - if (LINK_STATE_IS_UP(ifp->if_link_state) && - ifp->if_flags & IFF_UP) - imr->ifm_status |= IFM_ACTIVE; -} |