Questions on Netlink sockets

Bhaskar Upadhyayula bu.kernel at gmail.com
Tue Aug 25 04:47:23 EDT 2015


Hi Rami,

Sorry for the delay in response.

In the buggy code, the missing lines were the following:

115     data->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)data;
116     linkinfo->rta_len = (void *)NLMSG_TAIL(&req.n) - (void *)linkinfo;

Above code is to adjust the length for nested attributes. I missed it
and the constructed packet was messed up.

'dmesg' was not throwing any errors and I was stuck, trying to debug.

Thx.


On Wed, Aug 19, 2015 at 3:28 AM, Rami Rosen <roszenrami at gmail.com> wrote:
> Hi, Bhaskar,
>
> Thanks for posting the code.
>
>>PS: I am humbled to see a reply from you. I read Chapter 2 from your
>>book to understand netlink sockets.
>
> I hope you enjoyed it and find it useful!
>
>>+ My code is not creating VLAN interface as executed by the 'ip link
>>...' command.
>
> Can you elaborate a bit about this: which difference do you see between creating
> a VLAN with
> ip link add name eth2.200  link eth2 type vlan id 200
>
> And running your program (let's call your executable "vlan_nl")
> in this way:
> ./vlan_nl eth1.100 eth1 100
>
>
>
> Regards,
> Rami Rosen
> http://ramirose.wix.com/ramirosen



More information about the Kernelnewbies mailing list