Introduce IFF_SMART bit.
This means that the driver will add/delete routes when it knows it is up/down, rather than have the generic code belive it is up if configured. This is probably most useful for serial lines, although many PHY chips could probably tell us if we're connected to the cable/hub as well.
This commit is contained in:
parent
b9569cad67
commit
cf4b937128
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=47777
@ -42,7 +42,7 @@ static const char copyright[] =
|
||||
static char sccsid[] = "@(#)ifconfig.c 8.2 (Berkeley) 2/16/94";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: ifconfig.c,v 1.38 1998/08/07 06:36:53 phk Exp $";
|
||||
"$Id: ifconfig.c,v 1.39 1999/03/15 01:22:01 wpaul Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -701,7 +701,7 @@ setifmtu(val, dummy, s, afp)
|
||||
|
||||
|
||||
#define IFFBITS \
|
||||
"\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6b6\7RUNNING" \
|
||||
"\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6SMART\7RUNNING" \
|
||||
"\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2" \
|
||||
"\20MULTICAST"
|
||||
|
||||
|
11
sys/net/if.c
11
sys/net/if.c
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if.c 8.3 (Berkeley) 1/4/94
|
||||
* $Id: if.c,v 1.69 1999/04/27 11:16:56 phk Exp $
|
||||
* $Id: if.c,v 1.70 1999/04/28 11:37:32 phk Exp $
|
||||
*/
|
||||
|
||||
#include "opt_compat.h"
|
||||
@ -639,12 +639,15 @@ ifioctl(so, cmd, data, p)
|
||||
if (error)
|
||||
return (error);
|
||||
ifr->ifr_prevflags = ifp->if_flags;
|
||||
if (ifp->if_flags & IFF_UP && (ifr->ifr_flags & IFF_UP) == 0) {
|
||||
if (ifp->if_flags & IFF_SMART) {
|
||||
/* Smart drivers twiddle their own routes */
|
||||
} else if ((ifp->if_flags & IFF_UP &&
|
||||
(ifr->ifr_flags & IFF_UP) == 0) {
|
||||
int s = splimp();
|
||||
if_down(ifp);
|
||||
splx(s);
|
||||
}
|
||||
if (ifr->ifr_flags & IFF_UP && (ifp->if_flags & IFF_UP) == 0) {
|
||||
} else if (ifr->ifr_flags & IFF_UP &&
|
||||
(ifp->if_flags & IFF_UP) == 0) {
|
||||
int s = splimp();
|
||||
if_up(ifp);
|
||||
splx(s);
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)if.h 8.1 (Berkeley) 6/10/93
|
||||
* $Id: if.h,v 1.51 1999/04/28 11:37:33 phk Exp $
|
||||
* $Id: if.h,v 1.52 1999/05/08 07:00:04 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _NET_IF_H_
|
||||
@ -82,6 +82,7 @@ struct if_data {
|
||||
#define IFF_DEBUG 0x4 /* turn on debugging */
|
||||
#define IFF_LOOPBACK 0x8 /* is a loopback net */
|
||||
#define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */
|
||||
#define IFF_SMART 0x20 /* interface manages own routes */
|
||||
#define IFF_RUNNING 0x40 /* resources allocated */
|
||||
#define IFF_NOARP 0x80 /* no address resolution protocol */
|
||||
#define IFF_PROMISC 0x100 /* receive all packets */
|
||||
@ -97,7 +98,7 @@ struct if_data {
|
||||
/* flags set internally only: */
|
||||
#define IFF_CANTCHANGE \
|
||||
(IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\
|
||||
IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI)
|
||||
IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI|IFF_SMART)
|
||||
|
||||
#define IFQ_MAXLEN 50
|
||||
#define IFNET_SLOWHZ 1 /* granularity is 1 second */
|
||||
|
Loading…
Reference in New Issue
Block a user