Clarification on rtnetlink requests

2015-08-19 Thread David Chappelle
I am a bit confused with respect to the structure of rtnetlink requests.
It seems that in some circumstances a request can look like:

struct request
{
struct nlmsghdr header;
struct rtgenmsg body;
};

and in other cases it can look like:

struct request
{
struct nlmsghdr header;
struct ifinfomsg body;
};

How do I know which one to use when sending RTM_GETLINK and
RTM_GETADDR requests? Furthermore, it also seems that 'struct rtattr'
can be specified at the end of the request as well. Is there any
documentation that describes this.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: Clarification on rtnetlink requests

2015-08-19 Thread Anish Bhatt

> -Original Message-
> From: netdev-ow...@vger.kernel.org [mailto:netdev-
> ow...@vger.kernel.org] On Behalf Of David Chappelle
> Sent: Wednesday, August 19, 2015 8:05 AM
> To: netdev@vger.kernel.org
> Subject: Clarification on rtnetlink requests
> 
> I am a bit confused with respect to the structure of rtnetlink requests.
> It seems that in some circumstances a request can look like:
> 
> struct request
> {
> struct nlmsghdr header;
> struct rtgenmsg body;
> };
> 
> and in other cases it can look like:
> 
> struct request
> {
> struct nlmsghdr header;
> struct ifinfomsg body;
> };
> 
> How do I know which one to use when sending RTM_GETLINK and
> RTM_GETADDR requests? Furthermore, it also seems that 'struct rtattr'
> can be specified at the end of the request as well. Is there any
> documentation that describes this.

RTM_GETLINK uses ifinfomsg and RTM_GETADDR uses ifaddrmsg, see man 7 rtnetlink. 
struct  rtgenmsg is just a generic type, look at include/linux/rtnetlink.h
-Anish

N�r��yb�X��ǧv�^�)޺{.n�+���z�^�)w*jg����ݢj/���z�ޖ��2�ޙ&�)ߡ�a�����G���h��j:+v���w��٥