Anton Boritskiy
Anton Boritskiy

Reputation: 1569

Where to get device type constants description?

I'm getting the information about system network devices through netlink socket. I'm parsing three message types RTM_NEWLINK, RTM_DELLINK, RTM_GETLINK defined in the ifinfomsg structure.

struct ifinfomsg {
    unsigned char  ifi_family; /* AF_UNSPEC */
    unsigned short ifi_type;   /* Device type */
    int            ifi_index;  /* Interface index */
    unsigned int   ifi_flags;  /* Device flags  */
    unsigned int   ifi_change; /* change mask */
};

the definition is from here http://www.kernel.org/doc/man-pages/online/pages/man7/rtnetlink.7.html

But there are no description for the device type field ifi_type, where can I found the constants that describes the possible values?

there are no description even here http://www.foxprofr.com/rfc/RFC3549-LINUX-NETLINK-AS-AN-IP-SERVICES-PROTOCOL/3549.aspx

Now I know that 1 is ethernet and 772 is loopback, but I'd like to know all possible values. May be the answer is very obvious but google doesn't want to tell me anything usefull.

Upvotes: 4

Views: 2707

Answers (1)

ldx
ldx

Reputation: 4074

Take a look at /usr/include/net/if_arp.h, you will find the constants there as ARPHRD_*. If you want to make your life somewhat easier, check out libnl if you don't use it already.

Upvotes: 6

Related Questions