diff options
author | andre <andre@FreeBSD.org> | 2006-03-15 19:43:25 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2006-03-15 19:43:25 +0000 |
commit | 2937e9f7ab5c5e12245327e3c169af3b04bbd0fb (patch) | |
tree | 32d3ec2cbb53c95ffe0829e4ee995d98a058453e /sys/net | |
parent | 71d2be426c8d4c957d7a6ff97b44f40f70658dfb (diff) | |
download | FreeBSD-src-2937e9f7ab5c5e12245327e3c169af3b04bbd0fb.zip FreeBSD-src-2937e9f7ab5c5e12245327e3c169af3b04bbd0fb.tar.gz |
Add link status descriptions and related structures for userland
applications.
Open[BGP|OSPF]D make use of this to determine the link status of
interfaces to make the right routing descisions.
Obtained from: OpenBSD
MFC after: 3 days
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if_media.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/sys/net/if_media.h b/sys/net/if_media.h index 7263208..f387c9c 100644 --- a/sys/net/if_media.h +++ b/sys/net/if_media.h @@ -269,6 +269,15 @@ uint64_t ifmedia_baudrate(int); #define IFM_AVALID 0x00000001 /* Active bit valid */ #define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ +/* Mask of "status valid" bits, for ifconfig(8). */ +#define IFM_STATUS_VALID IFM_AVALID + +/* List of "status valid" bits, for ifconfig(8). */ +#define IFM_STATUS_VALID_LIST { \ + IFM_AVALID, \ + 0 \ +} + /* * Macros to extract various bits of information from the media word. */ @@ -601,4 +610,33 @@ struct ifmedia_baudrate { { 0, 0 }, \ } +/* + * Status descriptions for the various media types. + */ +struct ifmedia_status_description { + int ifms_type; + int ifms_valid; + int ifms_bit; + const char *ifms_string[2]; +}; + +#define IFM_STATUS_DESC(ifms, bit) \ + (ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0] + +#define IFM_STATUS_DESCRIPTIONS { \ + { IFM_ETHER, IFM_AVALID, IFM_ACTIVE, \ + { "no carrier", "active" } }, \ + { IFM_FDDI, IFM_AVALID, IFM_ACTIVE, \ + { "no ring", "inserted" } }, \ + { IFM_TOKEN, IFM_AVALID, IFM_ACTIVE, \ + { "no ring", "inserted" } }, \ + { IFM_IEEE80211, IFM_AVALID, IFM_ACTIVE, \ + { "no network", "active" } }, \ + { IFM_ATM, IFM_AVALID, IFM_ACTIVE, \ + { "no network", "active" } }, \ + { IFM_CARP, IFM_AVALID, IFM_ACTIVE, \ + { "backup", "master" } }, \ + { 0, 0, 0, \ + { NULL, NULL } } \ +} #endif /* _NET_IF_MEDIA_H_ */ |