📄 rtnetlink.h
字号:
* Interface address. ****/struct ifaddrmsg{ unsigned char ifa_family; unsigned char ifa_prefixlen; /* The prefix length */ unsigned char ifa_flags; /* Flags */ unsigned char ifa_scope; /* See above */ int ifa_index; /* Link index */};enum{ IFA_UNSPEC, IFA_ADDRESS, IFA_LOCAL, IFA_LABEL, IFA_BROADCAST, IFA_ANYCAST, IFA_CACHEINFO, IFA_MULTICAST, __IFA_MAX};#define IFA_MAX (__IFA_MAX - 1)/* ifa_flags */#define IFA_F_SECONDARY 0x01#define IFA_F_TEMPORARY IFA_F_SECONDARY#define IFA_F_DEPRECATED 0x20#define IFA_F_TENTATIVE 0x40#define IFA_F_PERMANENT 0x80struct ifa_cacheinfo{ __u32 ifa_prefered; __u32 ifa_valid; __u32 cstamp; /* created timestamp, hundredths of seconds */ __u32 tstamp; /* updated timestamp, hundredths of seconds */};#define IFA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifaddrmsg))))#define IFA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifaddrmsg))/* Important comment: IFA_ADDRESS is prefix address, rather than local interface address. It makes no difference for normally configured broadcast interfaces, but for point-to-point IFA_ADDRESS is DESTINATION address, local address is supplied in IFA_LOCAL attribute. *//************************************************************** * Neighbour discovery. ****/struct ndmsg{ unsigned char ndm_family; unsigned char ndm_pad1; unsigned short ndm_pad2; int ndm_ifindex; /* Link index */ __u16 ndm_state; __u8 ndm_flags; __u8 ndm_type;};enum{ NDA_UNSPEC, NDA_DST, NDA_LLADDR, NDA_CACHEINFO, NDA_PROBES, __NDA_MAX};#define NDA_MAX (__NDA_MAX - 1)#define NDA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ndmsg))))#define NDA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ndmsg))/* * Neighbor Cache Entry Flags */#define NTF_PROXY 0x08 /* == ATF_PUBL */#define NTF_ROUTER 0x80/* * Neighbor Cache Entry States. */#define NUD_INCOMPLETE 0x01#define NUD_REACHABLE 0x02#define NUD_STALE 0x04#define NUD_DELAY 0x08#define NUD_PROBE 0x10#define NUD_FAILED 0x20/* Dummy states */#define NUD_NOARP 0x40#define NUD_PERMANENT 0x80#define NUD_NONE 0x00struct nda_cacheinfo{ __u32 ndm_confirmed; __u32 ndm_used; __u32 ndm_updated; __u32 ndm_refcnt;};/**** * General form of address family dependent message. ****/struct rtgenmsg{ unsigned char rtgen_family;};/***************************************************************** * Link layer specific messages. ****//* struct ifinfomsg * passes link level specific information, not dependent * on network protocol. */struct ifinfomsg{ unsigned char ifi_family; 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 */};/******************************************************************** * prefix information ****/struct prefixmsg{ unsigned char prefix_family; int prefix_ifindex; unsigned char prefix_type; unsigned char prefix_len; unsigned char prefix_flags;};enum { PREFIX_UNSPEC, PREFIX_ADDRESS, PREFIX_CACHEINFO, __PREFIX_MAX};#define PREFIX_MAX (__PREFIX_MAX - 1)struct prefix_cacheinfo{ __u32 preferred_time; __u32 valid_time;};/* The struct should be in sync with struct net_device_stats */struct rtnl_link_stats{ __u32 rx_packets; /* total packets received */ __u32 tx_packets; /* total packets transmitted */ __u32 rx_bytes; /* total bytes received */ __u32 tx_bytes; /* total bytes transmitted */ __u32 rx_errors; /* bad packets received */ __u32 tx_errors; /* packet transmit problems */ __u32 rx_dropped; /* no space in linux buffers */ __u32 tx_dropped; /* no space available in linux */ __u32 multicast; /* multicast packets received */ __u32 collisions; /* detailed rx_errors: */ __u32 rx_length_errors; __u32 rx_over_errors; /* receiver ring buff overflow */ __u32 rx_crc_errors; /* recved pkt with crc error */ __u32 rx_frame_errors; /* recv'd frame alignment error */ __u32 rx_fifo_errors; /* recv'r fifo overrun */ __u32 rx_missed_errors; /* receiver missed packet */ /* detailed tx_errors */ __u32 tx_aborted_errors; __u32 tx_carrier_errors; __u32 tx_fifo_errors; __u32 tx_heartbeat_errors; __u32 tx_window_errors; /* for cslip etc */ __u32 rx_compressed; __u32 tx_compressed;};/* The struct should be in sync with struct ifmap */struct rtnl_link_ifmap{ __u64 mem_start; __u64 mem_end; __u64 base_addr; __u16 irq; __u8 dma; __u8 port;};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_MAX};#define IFLA_MAX (__IFLA_MAX - 1)#define IFLA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct ifinfomsg))))#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct ifinfomsg))/* ifi_flags. IFF_* flags. The only change is: IFF_LOOPBACK, IFF_BROADCAST and IFF_POINTOPOINT are more not changeable by user. They describe link media characteristics and set by device driver. Comments: - Combination IFF_BROADCAST|IFF_POINTOPOINT is invalid - If neither of these three flags are set; the interface is NBMA. - IFF_MULTICAST does not mean anything special: multicasts can be used on all not-NBMA links. IFF_MULTICAST means that this media uses special encapsulation for multicast frames. Apparently, all IFF_POINTOPOINT and IFF_BROADCAST devices are able to use multicasts too. *//* IFLA_LINK. For usual devices it is equal ifi_index. If it is a "virtual interface" (f.e. tunnel), ifi_link can point to real physical interface (f.e. for bandwidth calculations), or maybe 0, what means, that real media is unknown (usual for IPIP tunnels, when route to endpoint is allowed to change) *//* Subtype attributes for IFLA_PROTINFO */enum{ IFLA_INET6_UNSPEC, IFLA_INET6_FLAGS, /* link flags */ IFLA_INET6_CONF, /* sysctl parameters */ IFLA_INET6_STATS, /* statistics */ IFLA_INET6_MCAST, /* MC things. What of them? */ IFLA_INET6_CACHEINFO, /* time values and max reasm size */ __IFLA_INET6_MAX};#define IFLA_INET6_MAX (__IFLA_INET6_MAX - 1)struct ifla_cacheinfo{ __u32 max_reasm_len; __u32 tstamp; /* ipv6InterfaceTable updated timestamp */ __u32 reachable_time; __u32 retrans_time;};/***************************************************************** * Traffic control messages. ****/struct tcmsg{ unsigned char tcm_family; unsigned char tcm__pad1; unsigned short tcm__pad2; int tcm_ifindex; __u32 tcm_handle; __u32 tcm_parent; __u32 tcm_info;};enum{ TCA_UNSPEC, TCA_KIND, TCA_OPTIONS, TCA_STATS, TCA_XSTATS, TCA_RATE, TCA_FCNT, TCA_STATS2, __TCA_MAX};#define TCA_MAX (__TCA_MAX - 1)#define TCA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcmsg))))#define TCA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcmsg))/* RTnetlink multicast groups */#define RTMGRP_LINK 1#define RTMGRP_NOTIFY 2#define RTMGRP_NEIGH 4#define RTMGRP_TC 8#define RTMGRP_IPV4_IFADDR 0x10#define RTMGRP_IPV4_MROUTE 0x20#define RTMGRP_IPV4_ROUTE 0x40#define RTMGRP_IPV6_IFADDR 0x100#define RTMGRP_IPV6_MROUTE 0x200#define RTMGRP_IPV6_ROUTE 0x400#define RTMGRP_IPV6_IFINFO 0x800#define RTMGRP_DECnet_IFADDR 0x1000#define RTMGRP_DECnet_ROUTE 0x4000#define RTMGRP_IPV6_PREFIX 0x20000/* TC action piece */struct tcamsg{ unsigned char tca_family; unsigned char tca__pad1; unsigned short tca__pad2;};#define TA_RTA(r) ((struct rtattr*)(((char*)(r)) + NLMSG_ALIGN(sizeof(struct tcamsg))))#define TA_PAYLOAD(n) NLMSG_PAYLOAD(n,sizeof(struct tcamsg))#define TCA_ACT_TAB 1 /* attr type must be >=1 */ #define TCAA_MAX 1#endif /* __LINUX_RTNETLINK_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -