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.
Don't forget to also adjust the batctl code (remove the htonl).
Kind regards, Sven