alfred: netlink: random fixes
cover alfred: netlink: random fixes
Similar to the batctl fixes, I have now compiled a list of potential fixes for alfred. Instead of posting everything at once, I will be posted in smaller chunks. They are just various (mostly minor) problems which should be tackled at some point.
---
Sven Eckelmann (2):
alfred: import batadv_netlink_policy from batctl
alfred: don't stop translation table dump after first entry
batadv_querynl.c | 2 +- netlink.c | 277 +++++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 198 insertions(+), 81 deletions(-)
---
base-commit: 462a0cf40615f62e0912c36d72a75accbb26f5ee
change-id: 20260728-bugfixes-netlink-90da29811a06
Best regards,
Signature · 1 line
Sven Eckelmann <[email protected]>
PATCH 1/2 alfred: import batadv_netlink_policy from batctl
The batcl policy is more complete and is cleaner formatted than the alfred version. Just import then new one to keep them in sync.
--- netlink.c | 277 ++++++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 197 insertions(+), 80 deletions(-)
netlink.c +197 -80
@@ -27,86 +27,203 @@#endif struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR ] = { - [BATADV_ATTR_VERSION ] = { .type =NLA_STRING }, - [BATADV_ATTR_ALGO_NAME ] = { .type =NLA_STRING }, - [BATADV_ATTR_MESH_IFINDEX ] = { .type =NLA_U32 }, - [BATADV_ATTR_MESH_IFNAME ] = { .type =NLA_STRING , - .maxlen =IFNAMSIZ }, - [BATADV_ATTR_MESH_ADDRESS ] = { .type =NLA_UNSPEC , - .minlen =ETH_ALEN , - .maxlen =ETH_ALEN }, - [BATADV_ATTR_HARD_IFINDEX ] = { .type =NLA_U32 }, - [BATADV_ATTR_HARD_IFNAME ] = { .type =NLA_STRING , - .maxlen =IFNAMSIZ }, - [BATADV_ATTR_HARD_ADDRESS ] = { .type =NLA_UNSPEC , - .minlen =ETH_ALEN , - .maxlen =ETH_ALEN }, - [BATADV_ATTR_ORIG_ADDRESS ] = { .type =NLA_UNSPEC , - .minlen =ETH_ALEN , - .maxlen =ETH_ALEN }, - [BATADV_ATTR_TPMETER_RESULT ] = { .type =NLA_U8 }, - [BATADV_ATTR_TPMETER_TEST_TIME ] = { .type =NLA_U32 }, - [BATADV_ATTR_TPMETER_BYTES ] = { .type =NLA_U64 }, - [BATADV_ATTR_TPMETER_COOKIE ] = { .type =NLA_U32 }, - [BATADV_ATTR_PAD ] = { .type =NLA_UNSPEC }, - [BATADV_ATTR_ACTIVE ] = { .type =NLA_FLAG }, - [BATADV_ATTR_TT_ADDRESS ] = { .type =NLA_UNSPEC , - .minlen =ETH_ALEN , - .maxlen =ETH_ALEN }, - [BATADV_ATTR_TT_TTVN ] = { .type =NLA_U8 }, - [BATADV_ATTR_TT_LAST_TTVN ] = { .type =NLA_U8 }, - [BATADV_ATTR_TT_CRC32 ] = { .type =NLA_U32 }, - [BATADV_ATTR_TT_VID ] = { .type =NLA_U16 }, - [BATADV_ATTR_TT_FLAGS ] = { .type =NLA_U32 }, - [BATADV_ATTR_FLAG_BEST ] = { .type =NLA_FLAG }, - [BATADV_ATTR_LAST_SEEN_MSECS ] = { .type =NLA_U32 }, - [BATADV_ATTR_NEIGH_ADDRESS ] = { .type =NLA_UNSPEC , - .minlen =ETH_ALEN , - .maxlen =ETH_ALEN }, - [BATADV_ATTR_TQ ] = { .type =NLA_U8 }, - [BATADV_ATTR_THROUGHPUT ] = { .type =NLA_U32 }, - [BATADV_ATTR_BANDWIDTH_UP ] = { .type =NLA_U32 }, - [BATADV_ATTR_BANDWIDTH_DOWN ] = { .type =NLA_U32 }, - [BATADV_ATTR_ROUTER ] = { .type =NLA_UNSPEC , - .minlen =ETH_ALEN , - .maxlen =ETH_ALEN }, - [BATADV_ATTR_BLA_OWN ] = { .type =NLA_FLAG }, - [BATADV_ATTR_BLA_ADDRESS ] = { .type =NLA_UNSPEC , - .minlen =ETH_ALEN , - .maxlen =ETH_ALEN }, - [BATADV_ATTR_BLA_VID ] = { .type =NLA_U16 }, - [BATADV_ATTR_BLA_BACKBONE ] = { .type =NLA_UNSPEC , - .minlen =ETH_ALEN , - .maxlen =ETH_ALEN }, - [BATADV_ATTR_BLA_CRC ] = { .type =NLA_U16 }, - [BATADV_ATTR_DAT_CACHE_IP4ADDRESS ] = { .type =NLA_U32 }, - [BATADV_ATTR_DAT_CACHE_HWADDRESS ] = { .type =NLA_UNSPEC , - .minlen =ETH_ALEN , - .maxlen =ETH_ALEN }, - [BATADV_ATTR_DAT_CACHE_VID ] = { .type =NLA_U16 }, - [BATADV_ATTR_MCAST_FLAGS ] = { .type =NLA_U32 }, - [BATADV_ATTR_MCAST_FLAGS_PRIV ] = { .type =NLA_U32 }, - [BATADV_ATTR_VLANID ] = { .type =NLA_U16 }, - [BATADV_ATTR_AGGREGATED_OGMS_ENABLED ] = { .type =NLA_U8 }, - [BATADV_ATTR_AP_ISOLATION_ENABLED ] = { .type =NLA_U8 }, - [BATADV_ATTR_ISOLATION_MARK ] = { .type =NLA_U32 }, - [BATADV_ATTR_ISOLATION_MASK ] = { .type =NLA_U32 }, - [BATADV_ATTR_BONDING_ENABLED ] = { .type =NLA_U8 }, - [BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED ] = { .type =NLA_U8 }, - [BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED ] = { .type =NLA_U8 }, - [BATADV_ATTR_FRAGMENTATION_ENABLED ] = { .type =NLA_U8 }, - [BATADV_ATTR_GW_BANDWIDTH_DOWN ] = { .type =NLA_U32 }, - [BATADV_ATTR_GW_BANDWIDTH_UP ] = { .type =NLA_U32 }, - [BATADV_ATTR_GW_MODE ] = { .type =NLA_U8 }, - [BATADV_ATTR_GW_SEL_CLASS ] = { .type =NLA_U32 }, - [BATADV_ATTR_HOP_PENALTY ] = { .type =NLA_U8 }, - [BATADV_ATTR_LOG_LEVEL ] = { .type =NLA_U32 }, - [BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED ] = { .type =NLA_U8 }, - [BATADV_ATTR_MULTICAST_FANOUT ] = { .type =NLA_U32 }, - [BATADV_ATTR_NETWORK_CODING_ENABLED ] = { .type =NLA_U8 }, - [BATADV_ATTR_ORIG_INTERVAL ] = { .type =NLA_U32 }, - [BATADV_ATTR_ELP_INTERVAL ] = { .type =NLA_U32 }, - [BATADV_ATTR_THROUGHPUT_OVERRIDE ] = { .type =NLA_U32 }, + [BATADV_ATTR_VERSION ] = { + .type =NLA_STRING , + }, + [BATADV_ATTR_ALGO_NAME ] = { + .type =NLA_STRING , + }, + [BATADV_ATTR_MESH_IFINDEX ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_MESH_IFNAME ] = { + .type =NLA_STRING , + .maxlen =IFNAMSIZ , + }, + [BATADV_ATTR_MESH_ADDRESS ] = { + .type =NLA_UNSPEC , + .minlen =ETH_ALEN , + .maxlen =ETH_ALEN , + }, + [BATADV_ATTR_HARD_IFINDEX ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_HARD_IFNAME ] = { + .type =NLA_STRING , + .maxlen =IFNAMSIZ , + }, + [BATADV_ATTR_HARD_ADDRESS ] = { + .type =NLA_UNSPEC , + .minlen =ETH_ALEN , + .maxlen =ETH_ALEN , + }, + [BATADV_ATTR_ORIG_ADDRESS ] = { + .type =NLA_UNSPEC , + .minlen =ETH_ALEN , + .maxlen =ETH_ALEN , + }, + [BATADV_ATTR_TPMETER_RESULT ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_TPMETER_TEST_TIME ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_TPMETER_BYTES ] = { + .type =NLA_U64 , + }, + [BATADV_ATTR_TPMETER_COOKIE ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_PAD ] = { + .type =NLA_UNSPEC , + }, + [BATADV_ATTR_ACTIVE ] = { + .type =NLA_FLAG , + }, + [BATADV_ATTR_TT_ADDRESS ] = { + .type =NLA_UNSPEC , + .minlen =ETH_ALEN , + .maxlen =ETH_ALEN , + }, + [BATADV_ATTR_TT_TTVN ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_TT_LAST_TTVN ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_TT_CRC32 ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_TT_VID ] = { + .type =NLA_U16 , + }, + [BATADV_ATTR_TT_FLAGS ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_FLAG_BEST ] = { + .type =NLA_FLAG , + }, + [BATADV_ATTR_LAST_SEEN_MSECS ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_NEIGH_ADDRESS ] = { + .type =NLA_UNSPEC , + .minlen =ETH_ALEN , + .maxlen =ETH_ALEN , + }, + [BATADV_ATTR_TQ ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_THROUGHPUT ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_BANDWIDTH_UP ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_BANDWIDTH_DOWN ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_ROUTER ] = { + .type =NLA_UNSPEC , + .minlen =ETH_ALEN , + .maxlen =ETH_ALEN , + }, + [BATADV_ATTR_BLA_OWN ] = { + .type =NLA_FLAG , + }, + [BATADV_ATTR_BLA_ADDRESS ] = { + .type =NLA_UNSPEC , + .minlen =ETH_ALEN , + .maxlen =ETH_ALEN , + }, + [BATADV_ATTR_BLA_VID ] = { + .type =NLA_U16 , + }, + [BATADV_ATTR_BLA_BACKBONE ] = { + .type =NLA_UNSPEC , + .minlen =ETH_ALEN , + .maxlen =ETH_ALEN , + }, + [BATADV_ATTR_BLA_CRC ] = { + .type =NLA_U16 , + }, + [BATADV_ATTR_DAT_CACHE_IP4ADDRESS ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_DAT_CACHE_HWADDRESS ] = { + .type =NLA_UNSPEC , + .minlen =ETH_ALEN , + .maxlen =ETH_ALEN , + }, + [BATADV_ATTR_DAT_CACHE_VID ] = { + .type =NLA_U16 , + }, + [BATADV_ATTR_MCAST_FLAGS ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_MCAST_FLAGS_PRIV ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_VLANID ] = { + .type =NLA_U16 , + }, + [BATADV_ATTR_AGGREGATED_OGMS_ENABLED ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_AP_ISOLATION_ENABLED ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_ISOLATION_MARK ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_ISOLATION_MASK ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_BONDING_ENABLED ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_BRIDGE_LOOP_AVOIDANCE_ENABLED ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_DISTRIBUTED_ARP_TABLE_ENABLED ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_FRAGMENTATION_ENABLED ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_GW_BANDWIDTH_DOWN ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_GW_BANDWIDTH_UP ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_GW_MODE ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_GW_SEL_CLASS ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_HOP_PENALTY ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_LOG_LEVEL ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_MULTICAST_FORCEFLOOD_ENABLED ] = { + .type =NLA_U8 , + }, + [BATADV_ATTR_ORIG_INTERVAL ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_ELP_INTERVAL ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_THROUGHPUT_OVERRIDE ] = { + .type =NLA_U32 , + }, + [BATADV_ATTR_MULTICAST_FANOUT ] = { + .type =NLA_U32 , + }, }; int missing_mandatory_attrs(struct nlattr *attrs[], const int mandatory[],
Signature · 1 line
2.47.3
PATCH 2/2 alfred: don't stop translation table dump after first entry
In reply to Sven Eckelmanntranslate_mac_netlink_cb() is handling the response for BATADV_CMD_GET_TRANSTABLE_GLOBAL dump. It returns NL_STOP and cause the dump to be aborted.
As result, the MAC addresses of all other alfred servers could no longer be translated to their originator address and their TQ was considered to be 0. The selection algorithm might then not select the actual best originator for the data sync.
Continue the dump with NL_OK to fill the translation hash with all (best) originator entries.
--- batadv_querynl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
batadv_querynl.c +1 -1
@@ -79,7 +79,7 @@ static int translate_mac_netlink_cb(struct nl_msg *msg, void *arg)tg_hash_add (opts->tg_hash, &mac_addr, &mac_orig); opts->query_opts.err =0 ; -return NL_STOP ; +return NL_OK ; }int translate_mac_netlink (const char *mesh_iface,struct hashtable_t *tg_hash)
Signature · 1 line
2.47.3