On Thursday 28 April 2016 22:54:57 Andrew Lunn wrote:
The kernel has gained support for exporting information via netlink. Use this when available, rather than debugfs. Netlink has the advantage of being network name space aware, where as debugfs is not.
If netlink is not available, batctl will fall back to debugfs, so should be backwards compatible with older kernel versions.
Signed-off-by: Andrew Lunn andrew@lunn.ch
[...]
- addr = nla_data(attrs[BATADV_ATTR_TT_ADDRESS]);
- orig = nla_data(attrs[BATADV_ATTR_ORIG_ADDRESS]);
- vid = nla_get_u16(attrs[BATADV_ATTR_TT_VID]);
- ttvn = nla_get_u8(attrs[BATADV_ATTR_TT_TTVN]);
- last_ttvn = nla_get_u8(attrs[BATADV_ATTR_TT_LAST_TTVN]);
- crc32 = nla_get_u32(attrs[BATADV_ATTR_TT_CRC32]);
- flags = nla_get_u32(attrs[BATADV_ATTR_TT_FLAGS]);
You are accessing a lot of data without checking if it exists and is from the correct type. This was discussed in an earlier mail [1].
Kind regards, Sven
[1] https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2016-March/014722.html