On Sonntag, 4. März 2018 17:41:26 CET Sven Eckelmann wrote:
On Dienstag, 27. Februar 2018 09:10:15 CET Linus Lüssing wrote:
if (nla_put_u32(msg, BATADV_ATTR_DC_ADDRESS, ip) ||
nla_put(msg, BATADV_ATTR_DC_HWADDRESS, ETH_ALEN,
dat_entry->mac_addr) ||
nla_put_u16(msg, BATADV_ATTR_DC_VID, dat_entry->vid) ||
nla_put_u32(msg, BATADV_ATTR_LAST_SEEN_MSECS, msecs)) {
genlmsg_cancel(msg, hdr);
return -EMSGSIZE;
Just found that there is a function to send IPv4 addresses (BATADV_ATTR_DC_ADDRESS) to userspace: nla_put_in_addr. It requires that you provide the IPv4 address in __be32 format and not in host format. It is maybe a good idea to use it and keep it more consistent with the rest of the kernel.
Btw. this function was introduced with linux-4.1 [1] and older kernels will need compat code for it.
Kind regards, Sven
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...