mirror of
https://github.com/apache/nuttx.git
synced 2025-12-09 03:13:19 +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
|
||||
|
||||
Reference in New Issue
Block a user