Changeset View
Changeset View
Standalone View
Standalone View
sys/netlink/route/interface.h
- This file was added.
/* | |||||
* Interface-related (RTM_<NEW|DEL|GET|SET>LINK) message header and attributes. | |||||
*/ | |||||
#ifndef _NETLINK_ROUTE_INTERFACE_H_ | |||||
#define _NETLINK_ROUTE_INTERFACE_H_ | |||||
/* Base header for all of the relevant messages */ | |||||
struct ifinfomsg { | |||||
unsigned char ifi_family; /* Related XX */ | |||||
unsigned char __ifi_pad; | |||||
unsigned short ifi_type; /* ARPHRD_* */ | |||||
int ifi_index; /* Link index */ | |||||
unsigned ifi_flags; /* IFF_* flags */ | |||||
unsigned ifi_change; /* IFF_* change mask */ | |||||
}; | |||||
#ifndef _KERNEL | |||||
/* Compatilbility helpers */ | |||||
#define _IFINFO_HDRLEN ((int)sizeof(struct ifinfomsg)) | |||||
#define IFLA_RTA(_ifi) ((struct rtattr *)NL_ITEM_DATA(_ifi, _IFINFO_HDRLEN)) | |||||
#define IFLA_PAYLOAD(_ifi) NLMSG_PAYLOAD(_ifi, _IFINFO_HDRLEN) | |||||
#endif | |||||
enum { | |||||
IFLA_UNSPEC, | |||||
IFLA_ADDRESS, | |||||
IFLA_BROADCAST, | |||||
IFLA_IFNAME, | |||||
IFLA_MTU, | |||||
IFLA_LINK, | |||||
IFLA_QDISC, | |||||
IFLA_STATS, | |||||
IFLA_COST, | |||||
#define IFLA_COST IFLA_COST | |||||
IFLA_PRIORITY, | |||||
#define IFLA_PRIORITY IFLA_PRIORITY | |||||
IFLA_MASTER, | |||||
#define IFLA_MASTER IFLA_MASTER | |||||
IFLA_WIRELESS, /* Wireless Extension event - see wireless.h */ | |||||
#define IFLA_WIRELESS IFLA_WIRELESS | |||||
IFLA_PROTINFO, /* Protocol specific information for a link */ | |||||
#define IFLA_PROTINFO IFLA_PROTINFO | |||||
IFLA_TXQLEN, | |||||
#define IFLA_TXQLEN IFLA_TXQLEN | |||||
IFLA_MAP, | |||||
#define IFLA_MAP IFLA_MAP | |||||
IFLA_WEIGHT, | |||||
#define IFLA_WEIGHT IFLA_WEIGHT | |||||
IFLA_OPERSTATE, | |||||
IFLA_LINKMODE, | |||||
IFLA_LINKINFO, | |||||
#define IFLA_LINKINFO IFLA_LINKINFO | |||||
IFLA_NET_NS_PID, | |||||
IFLA_IFALIAS, | |||||
IFLA_NUM_VF, /* Number of VFs if device is SR-IOV PF */ | |||||
imp: why the #defines here?
It is an odd construct. | |||||
Not Done Inline ActionsI assume it is so that these can be an enum as they ought to be, but also allowing #ifdef IFLA_ADDRESS emaste: I assume it is so that these can be an enum as they ought to be, but also allowing `#ifdef… | |||||
Done Inline ActionsIn Linux world there are many variations of kernel/userland version and "old kernel, new userland" is not uncommon. Some software like iproute2 explicitly check for the definitions of certain message/attributest to ensure that the behaviour/functionality is supported. melifaro: In Linux world there are many variations of kernel/userland version and "old kernel, new… | |||||
IFLA_VFINFO_LIST, | |||||
IFLA_STATS64, | |||||
IFLA_VF_PORTS, | |||||
IFLA_PORT_SELF, | |||||
IFLA_AF_SPEC, | |||||
IFLA_GROUP, /* Group the device belongs to */ | |||||
IFLA_NET_NS_FD, | |||||
IFLA_EXT_MASK, /* Extended info mask, VFs, etc */ | |||||
IFLA_PROMISCUITY, /* Promiscuity count: > 0 means acts PROMISC */ | |||||
#define IFLA_PROMISCUITY IFLA_PROMISCUITY | |||||
IFLA_NUM_TX_QUEUES, | |||||
IFLA_NUM_RX_QUEUES, | |||||
IFLA_CARRIER, | |||||
IFLA_PHYS_PORT_ID, | |||||
IFLA_CARRIER_CHANGES, | |||||
IFLA_PHYS_SWITCH_ID, | |||||
IFLA_LINK_NETNSID, | |||||
IFLA_PHYS_PORT_NAME, | |||||
IFLA_PROTO_DOWN, | |||||
IFLA_GSO_MAX_SEGS, | |||||
IFLA_GSO_MAX_SIZE, | |||||
IFLA_PAD, | |||||
IFLA_XDP, | |||||
IFLA_EVENT, | |||||
IFLA_NEW_NETNSID, | |||||
IFLA_IF_NETNSID, | |||||
IFLA_TARGET_NETNSID = IFLA_IF_NETNSID, /* new alias */ | |||||
IFLA_CARRIER_UP_COUNT, | |||||
IFLA_CARRIER_DOWN_COUNT, | |||||
IFLA_NEW_IFINDEX, | |||||
IFLA_MIN_MTU, | |||||
IFLA_MAX_MTU, | |||||
IFLA_PROP_LIST, | |||||
IFLA_ALT_IFNAME, /* Alternative ifname */ | |||||
IFLA_PERM_ADDRESS, | |||||
IFLA_PROTO_DOWN_REASON, | |||||
__IFLA_MAX }; | |||||
#define IFLA_MAX (__IFLA_MAX - 1) | |||||
/* | |||||
* Attributes that can be used as filters: | |||||
* IFLA_IFNAME, IFLA_GROUP, IFLA_ALT_IFNAME | |||||
* Headers that can be used as filters: | |||||
* ifi_index, ifi_type | |||||
*/ | |||||
#endif |
why the #defines here?
It is an odd construct.