batctl: netlink support for DAT and MCAST
v2 cover batctl: netlink support for DAT and MCAST
This patchset adds netlink support for dumping DAT cache and multicast flags tables.
Changes in v2:
==============
- Removed htonl() conversion for BATADV_ATTR_DC_ADDRESS as batman-adv now provides it in network byte order (via nla_put_in_addr() )
- Increased BATADV_ATTR_MCAST_FLAGS and BATADV_ATTR_MCAST_FLAGS_PRIV size from 8 to 32 bits to enhance extensibility
- Changed mcast_flags error value from -EINVAL to -ENOTSUPP to allow a fallback to and retry via debugfs, for compatibility with older batman-adv versions
PATCH v2 1/4 batctl: add DAT cache netlink support
Dump the list of DAT cache entries via the netlink socket.
--- batman_adv.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
batman_adv.h +20 -0
@@ -272,6 +272,21 @@ enum batadv_nl_attrs {*/ BATADV_ATTR_BLA_CRC , +/** +* @BATADV_ATTR_DC_ADDRESS: Client IPv4 address +*/ +BATADV_ATTR_DC_ADDRESS , + +/** +* @BATADV_ATTR_DC_HWADDRESS: Client MAC address +*/ +BATADV_ATTR_DC_HWADDRESS , + +/** +* @BATADV_ATTR_DC_VID: VLAN ID +*/ +BATADV_ATTR_DC_VID , +/* add attributes above here, update the policy in netlink.c */ /**
@@ -361,6 +376,11 @@ enum batadv_nl_commands {*/ BATADV_CMD_GET_BLA_BACKBONE , +/** +* @BATADV_CMD_GET_DAT_CACHE: Query list of DAT cache entries +*/ + BATADV_CMD_GET_DAT_CACHE, +/* add new commands above here */ /**
Signature · 1 line
2.11.0
PATCH v2 2/4 batctl: add netlink dump function for DAT cache table
In reply to Linus Lüssing--- debug.c | 1 + netlink.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ netlink.h | 2 ++ 3 files changed, 104 insertions(+)
debug.c +1 -0
@@ -87,6 +87,7 @@ const struct debug_table_data batctl_debug_tables[BATCTL_TABLE_NUM] = { .opt_short = "dc", .debugfs_name = "dat_cache", .header_lines = 2, + .netlink_fn = netlink_print_dat_cache, }, { .opt_long = "nc_nodes",
netlink.c +101 -0
119 lines not on this page · raw message
netlink.h +2 -0
@@ -45,6 +45,8 @@ int netlink_print_bla_claim(char *mesh_iface, char *orig_iface, int read_opt, float orig_timeout, float watch_interval);int netlink_print_bla_backbone (char *mesh_iface,char *orig_iface,int read_opt,float orig_timeout,float watch_interval); +int netlink_print_dat_cache (char *mesh_iface,char *orig_iface,int read_opt, +float orig_timeout,float watch_interval);int translate_mac_netlink (const char *mesh_iface,const struct ether_addr *mac,struct ether_addr *mac_out);
Signature · 1 line
2.11.0
PATCH v2 3/4 batctl: add multicast flags netlink support
In reply to Linus LüssingDump the list of multicast flags entries via the netlink socket.
--- batman_adv.h | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
batman_adv.h +62 -0
@@ -92,6 +92,53 @@ enum batadv_tt_client_flags { };/** +* enum batadv_mcast_flags_priv - Private, own multicast flags +* +* These are internal, multicast related flags. Currently they describe certain +* multicast related attributes of the segment this originator bridges into the +* mesh. +* +* Those attributes are used to determine the public multicast flags this +* originator is going to announce via TT. +* +* For netlink, if BATADV_MCAST_FLAGS_BRIDGED is unset then all querier +* related flags are undefined. +*/ +enum batadv_mcast_flags_priv { +/** +* @BATADV_MCAST_FLAGS_BRIDGED: There is a bridge on top of the mesh +* interface. +*/ +BATADV_MCAST_FLAGS_BRIDGED = (1 <<0 ), + +/** +* @BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS: Whether an IGMP querier +* exists in the mesh +*/ +BATADV_MCAST_FLAGS_QUERIER_IPV4_EXISTS = (1 <<1 ), + +/** +* @BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS: Whether an MLD querier +* exists in the mesh +*/ +BATADV_MCAST_FLAGS_QUERIER_IPV6_EXISTS = (1 <<2 ), + +/** +* @BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING: If an IGMP querier +* exists, whether it is potentially shadowing multicast listeners +* (i.e. querier is behind our own bridge segment) +*/ +BATADV_MCAST_FLAGS_QUERIER_IPV4_SHADOWING = (1 <<3 ), + +/** +* @BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING: If an MLD querier +* exists, whether it is potentially shadowing multicast listeners +* (i.e. querier is behind our own bridge segment) +*/ +BATADV_MCAST_FLAGS_QUERIER_IPV6_SHADOWING = (1 <<4 ), +}; + +/** * enum batadv_nl_attrs - batman-adv netlink attributes */ enum batadv_nl_attrs {
@@ -287,6 +334,16 @@ enum batadv_nl_attrs {*/ BATADV_ATTR_DC_VID , +/** +* @BATADV_ATTR_MCAST_FLAGS: Per originator multicast flags +*/ +BATADV_ATTR_MCAST_FLAGS , + +/** +* @BATADV_ATTR_MCAST_FLAGS_PRIV: Private, own multicast flags +*/ + BATADV_ATTR_MCAST_FLAGS_PRIV, +/* add attributes above here, update the policy in netlink.c */ /**
@@ -381,6 +438,11 @@ enum batadv_nl_commands {*/ BATADV_CMD_GET_DAT_CACHE , +/** +* @BATADV_CMD_GET_MCAST_FLAGS: Query list of multicast flags +*/ + BATADV_CMD_GET_MCAST_FLAGS, +/* add new commands above here */ /**
Signature · 1 line
2.11.0
PATCH v2 4/4 batctl: add netlink dump function for multicast flags table
In reply to Linus Lüssing--- debug.c | 1 + netlink.c | 143 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ netlink.h | 2 + 3 files changed, 146 insertions(+)
debug.c +1 -0
@@ -100,6 +100,7 @@ const struct debug_table_data batctl_debug_tables[BATCTL_TABLE_NUM] = { .opt_short = "mf", .debugfs_name = "mcast_flags", .header_lines = 6, + .netlink_fn = netlink_print_mcast_flags, }, };
netlink.c +143 -0
171 lines not on this page · raw message
netlink.h +2 -0
@@ -47,6 +47,8 @@ int netlink_print_bla_backbone(char *mesh_iface, char *orig_iface, int read_opt, float orig_timeout, float watch_interval);int netlink_print_dat_cache (char *mesh_iface,char *orig_iface,int read_opt,float orig_timeout,float watch_interval); +int netlink_print_mcast_flags (char *mesh_iface,char *orig_iface,int read_opt, +float orig_timeout,float watch_interval);int translate_mac_netlink (const char *mesh_iface,const struct ether_addr *mac,struct ether_addr *mac_out);
Signature · 1 line
2.11.0