mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 13:13:08 +08:00
net/netlink/netlink_route.c: Add support for the NETLINK_ROUTE RTM_GETLINK command that is used to obtain a list of all devices in the UP state.
This commit is contained in:
@@ -235,11 +235,17 @@
|
||||
#define NLMSG_ALIGN(n) (((n) + NLMSG_MASK) & ~NLMSG_MASK)
|
||||
#define NLMSG_HDRLEN sizeof(struct nlmsghdr)
|
||||
#define NLMSG_LENGTH(n) (NLMSG_HDRLEN + (n))
|
||||
#define NLMSG_DATA(hdr) ((FAR void*)(((FAR char*)hdr) + NLMSG_HDRLEN)
|
||||
#define NLMSG_DATA(hdr) ((FAR void*)(((FAR char*)hdr) + NLMSG_HDRLEN))
|
||||
#define NLMSG_NEXT(hdr,n) \
|
||||
((n) -= NLMSG_ALIGN((hdr)->nlmsg_len), \
|
||||
(FAR struct nlmsghdr*)(((FAR cha r*)(hdr)) + NLMSG_ALIGN((hdr)->nlmsg_len)))
|
||||
|
||||
#define NLMSG_NOOP 1 /* Nothing */
|
||||
#define NLMSG_ERROR 2 /* Error */
|
||||
#define NLMSG_DONE 3 /* End of a dump */
|
||||
#define NLMSG_OVERRUN 4 /* Data lost */
|
||||
#define NLMSG_MIN_TYPE 16 /* < 16: Reserved control messages */
|
||||
|
||||
/* Definitions for struct rtattr ********************************************/
|
||||
|
||||
/* Macros to handle rtattributes */
|
||||
@@ -265,8 +271,19 @@
|
||||
* address set by the user and other undocumented flags.
|
||||
*/
|
||||
|
||||
#define IFA_F_SECONDARY 0x01
|
||||
#define IFA_F_PERMANENT 0x02
|
||||
#define IFA_F_SECONDARY 0x01
|
||||
#define IFA_F_PERMANENT 0x02
|
||||
|
||||
/* Definitions for struct ifinfomsg *****************************************/
|
||||
|
||||
#define IFLA_RTA(r) ((FAR struct rtattr *) \
|
||||
(((FAR char *)(r)) + \
|
||||
NLMSG_ALIGN(sizeof(struct ifinfomsg))))
|
||||
#define IFLA_PAYLOAD(n) NLMSG_PAYLOAD(n, sizeof(struct ifinfomsg))
|
||||
|
||||
/* Values for rta_type */
|
||||
|
||||
#define IFLA_IFNAME 1
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
@@ -318,13 +335,21 @@ struct rtattr
|
||||
|
||||
struct ifinfomsg
|
||||
{
|
||||
uint8_t ifi_family; /* AF_UNSPEC */
|
||||
uint16_t ifi_type; /* Device type */
|
||||
int16_t ifi_index; /* Unique interface index */
|
||||
uint32_t ifi_flags; /* Device flags */
|
||||
uint8_t ifi_family; /* AF_UNSPEC */
|
||||
uint8_t ifi_pid;
|
||||
uint16_t ifi_type; /* Device type (ARPHRD) */
|
||||
int16_t ifi_index; /* Unique interface index */
|
||||
uint32_t ifi_flags; /* Device IFF_* flags */
|
||||
uint32_t ifi_change; /* Change mask, must always be 0xffffffff */
|
||||
};
|
||||
|
||||
/* General form of address family dependent message. */
|
||||
|
||||
struct rtgenmsg
|
||||
{
|
||||
unsigned char rtgen_family;
|
||||
};
|
||||
|
||||
/* RTM_NEWADDR, RTM_DELADDR, RTM_GETADDR
|
||||
*
|
||||
* Add, remove or receive information about an IP address associated with
|
||||
|
||||
+12
-10
@@ -54,16 +54,17 @@
|
||||
|
||||
/* Supported Protocol Families */
|
||||
|
||||
#define PF_UNSPEC 0 /* Protocol family unspecified */
|
||||
#define PF_UNIX 1 /* Local communication */
|
||||
#define PF_LOCAL 1 /* Local communication */
|
||||
#define PF_INET 2 /* IPv4 Internet protocols */
|
||||
#define PF_INET6 10 /* IPv6 Internet protocols */
|
||||
#define PF_NETLINK 16 /* Netlink IPC socket */
|
||||
#define PF_PACKET 17 /* Low level packet interface */
|
||||
#define PF_BLUETOOTH 31 /* Bluetooth sockets */
|
||||
#define PF_IEEE802154 36 /* Low level IEEE 802.15.4 radio frame interface */
|
||||
#define PF_PKTRADIO 64 /* Low level packet radio interface */
|
||||
#define PF_UNSPEC 0 /* Protocol family unspecified */
|
||||
#define PF_UNIX 1 /* Local communication */
|
||||
#define PF_LOCAL 1 /* Local communication */
|
||||
#define PF_INET 2 /* IPv4 Internet protocols */
|
||||
#define PF_INET6 10 /* IPv6 Internet protocols */
|
||||
#define PF_NETLINK 16 /* Netlink IPC socket */
|
||||
#define PF_ROUTE PF_NETLINK /* 4.4BSD Compatibility*/
|
||||
#define PF_PACKET 17 /* Low level packet interface */
|
||||
#define PF_BLUETOOTH 31 /* Bluetooth sockets */
|
||||
#define PF_IEEE802154 36 /* Low level IEEE 802.15.4 radio frame interface */
|
||||
#define PF_PKTRADIO 64 /* Low level packet radio interface */
|
||||
|
||||
/* Supported Address Families. Opengroup.org requires only AF_UNSPEC,
|
||||
* AF_UNIX, AF_INET and AF_INET6.
|
||||
@@ -75,6 +76,7 @@
|
||||
#define AF_INET PF_INET
|
||||
#define AF_INET6 PF_INET6
|
||||
#define AF_NETLINK PF_NETLINK
|
||||
#define AF_ROUTE PF_ROUTE
|
||||
#define AF_PACKET PF_PACKET
|
||||
#define AF_BLUETOOTH PF_BLUETOOTH
|
||||
#define AF_IEEE802154 PF_IEEE802154
|
||||
|
||||
+561
-179
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user