diff options
| author | Robert Watson <rwatson@FreeBSD.org> | 2004-03-31 22:59:56 +0000 |
|---|---|---|
| committer | Robert Watson <rwatson@FreeBSD.org> | 2004-03-31 22:59:56 +0000 |
| commit | 2168debca99585dba9de9797a974b5bf1df6c237 (patch) | |
| tree | 5efb77bb93951efdfbb534e3b3d0aede4ce82a7d /sys | |
| parent | 5d4ca75e5688a565acf34ac318eecd9105207536 (diff) | |
Notes
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/net/if_sl.c | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index 39fce74f1e7e..4632bfb35758 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -224,6 +224,18 @@ static int *st_unit_list; static size_t st_unit_max = 0; static int +slisunitfree(int unit) +{ + struct sl_softc *nc; + + LIST_FOREACH(nc, &sl_list, sl_next) { + if (nc->sc_if.if_dunit == unit) + return (0); + } + return (1); +} + +static int slisstatic(unit) int unit; { @@ -260,7 +272,7 @@ slmarkstatic(unit) static struct sl_softc * slcreate() { - struct sl_softc *sc, *nc; + struct sl_softc *sc; int unit; struct mbuf *m; @@ -310,10 +322,8 @@ slcreate() for (unit=0; ; unit++) { if (slisstatic(unit)) continue; - LIST_FOREACH(nc, &sl_list, sl_next) { - if (nc->sc_if.if_dunit == unit) - continue; - } + if (!slisunitfree(unit)) + continue; break; } if_initname(&sc->sc_if, "sl", unit); @@ -443,7 +453,7 @@ sltioctl(tp, cmd, data, flag, td) int flag; struct thread *td; { - struct sl_softc *sc = (struct sl_softc *)tp->t_sc, *nc; + struct sl_softc *sc = (struct sl_softc *)tp->t_sc; int s, unit, wasup; s = splimp(); @@ -459,12 +469,8 @@ sltioctl(tp, cmd, data, flag, td) return (ENXIO); } if (sc->sc_if.if_dunit != unit) { - LIST_FOREACH(nc, &sl_list, sl_next) { - if (nc->sc_if.if_dunit == *(u_int *)data) { - splx(s); - return (ENXIO); - } - } + if (!slisunitfree(unit)) + return (ENXIO); wasup = sc->sc_if.if_flags & IFF_UP; bpfdetach(&sc->sc_if); |
