discover/network: Allow for arbitrary-sized netlink messages
authorJeremy Kerr <jk@ozlabs.org>
Fri, 25 Oct 2013 06:34:30 +0000 (14:34 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Fri, 1 Nov 2013 07:31:59 +0000 (15:31 +0800)
commit896da834e7126759ef69c33347055c593abedde3
treeb1bff122f3f61c46017cf671f0a01be7207e6cd0
parent3df3cc38458bc2f6122d07a6ba348dbaf1c7267e
discover/network: Allow for arbitrary-sized netlink messages

Currently, we drop any netlink data beyond our 4096-byte buffer. This
means that we can only parse a limited number of network interfaces.

This change uses recvmsg with MSG_PEEK to determine the size of an
incoming netlink message before doing the actual recvmsg. This way, we
can realloc our buffer to suit.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
discover/network.c