mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Prevent mixing of static and dynamic unit allocation strategies
This commit is contained in:
parent
9d9092ed48
commit
d99bab06b5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=15768
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if_sl.c 8.6 (Berkeley) 2/1/94
|
||||
* $Id: if_sl.c,v 1.38 1996/04/24 15:44:34 phk Exp $
|
||||
* $Id: if_sl.c,v 1.39 1996/04/25 02:34:37 davidg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -275,7 +275,7 @@ slopen(dev, tp)
|
||||
return (0);
|
||||
|
||||
for (nsl = NSL, sc = sl_softc; --nsl >= 0; sc++)
|
||||
if (sc->sc_ttyp == NULL) {
|
||||
if (sc->sc_ttyp == NULL && !(sc->sc_flags & SC_STATIC)) {
|
||||
if (slinit(sc) == 0)
|
||||
return (ENOBUFS);
|
||||
tp->t_sc = (caddr_t)sc;
|
||||
@ -340,7 +340,7 @@ slclose(tp,flag)
|
||||
untimeout(sl_keepalive, sc);
|
||||
}
|
||||
if_down(&sc->sc_if);
|
||||
sc->sc_flags = 0;
|
||||
sc->sc_flags &= SC_STATIC;
|
||||
sc->sc_ttyp = NULL;
|
||||
tp->t_sc = NULL;
|
||||
MCLFREE((caddr_t)(sc->sc_ep - SLBUFSIZE));
|
||||
@ -365,8 +365,8 @@ sltioctl(tp, cmd, data, flag, p)
|
||||
int flag;
|
||||
struct proc *p;
|
||||
{
|
||||
struct sl_softc *sc = (struct sl_softc *)tp->t_sc;
|
||||
int s;
|
||||
struct sl_softc *sc = (struct sl_softc *)tp->t_sc, *nc;
|
||||
int s, nsl;
|
||||
|
||||
s = splimp();
|
||||
switch (cmd) {
|
||||
@ -375,7 +375,22 @@ sltioctl(tp, cmd, data, flag, p)
|
||||
break;
|
||||
|
||||
case SLIOCSUNIT:
|
||||
sc->sc_if.if_unit = *(u_int *)data;
|
||||
if (sc->sc_if.if_unit != *(u_int *)data) {
|
||||
for (nsl = NSL, nc = sl_softc; --nsl >= 0; nc++) {
|
||||
if ( nc->sc_if.if_unit == *(u_int *)data
|
||||
&& nc->sc_ttyp == NULL
|
||||
) {
|
||||
nc->sc_if.if_unit = sc->sc_if.if_unit;
|
||||
nc->sc_flags &= ~SC_STATIC;
|
||||
sc->sc_if.if_unit = *(u_int *)data;
|
||||
goto slfound;
|
||||
}
|
||||
}
|
||||
splx(s);
|
||||
return (ENXIO);
|
||||
}
|
||||
slfound:
|
||||
sc->sc_flags |= SC_STATIC;
|
||||
break;
|
||||
|
||||
case SLIOCSKEEPAL:
|
||||
|
@ -32,7 +32,7 @@
|
||||
*
|
||||
* @(#)if_slvar.h 8.3 (Berkeley) 2/1/94
|
||||
*
|
||||
* $Id: if_slvar.h,v 1.9 1996/01/30 22:57:52 mpp Exp $
|
||||
* $Id: if_slvar.h,v 1.10 1996/02/06 18:51:15 wollman Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_SLVAR_H_
|
||||
@ -67,6 +67,7 @@ struct sl_softc {
|
||||
#define SC_ERROR 0x0001 /* had an input error */
|
||||
#define SC_OUTWAIT 0x0002 /* waiting for output fill */
|
||||
#define SC_KEEPALIVE 0x0004 /* input keepalive */
|
||||
#define SC_STATIC 0x0008 /* it is static unit */
|
||||
|
||||
/* visible flags */
|
||||
#define SC_COMPRESS IFF_LINK0 /* compress TCP traffic */
|
||||
|
Loading…
Reference in New Issue
Block a user