batman-adv: netns and netlink support
Sven Eckelmann
maintainerv10 cover batman-adv: netns and netlink support
Hi,
This patchset completes netns support, by disabling debugfs entries when not in the default name space, and correctly handling interface stack loops when the parent is in a different name space.
It additionally adds netlink support for most of the information found in debugfs, and is netns aware.
This patchset is based on Andrews v7 series and contains an update/rebase of the v9 sent by Simon on June 6th, with the following changes:
* add batadv_algo ops support to dump gateways dump via netlink
* integrate B.A.T.M.A.N. IV gateways dump code in batadv_algo
* add support for B.A.T.M.A.N. V gateways
* rebased on top of current master + gateway patches v6
It should apply clean on todays master + the gateway patches v6.
The batctl patches will be sent separately.
Kind regards,
Sven
Andrew Lunn (5):
batman-adv: Handle parent interfaces in a different netns
batman-adv: Suppress debugfs entries for netns's
batman-adv: add B.A.T.M.A.N. IV bat_gw_dump implementations
batman-adv: add B.A.T.M.A.N. Dump BLA claims via netlink
batman-adv: Indicate netlink socket can be used with netns.
Matthias Schiffer (6):
batman-adv: netlink: add routing_algo query
batman-adv: netlink: hardif query
batman-adv: netlink: add translation table query
batman-adv: netlink: add originator and neighbor table queries
batman-adv: add B.A.T.M.A.N. IV bat_{orig, neigh}_dump implementations
batman-adv: add B.A.T.M.A.N. V bat_{orig, neigh}_dump implementations
Simon Wunderlich (1):
batman-adv: add backbone table netlink support
Sven Eckelmann (4):
batman-adv: Provide TTVN in the mesh_info netlink msg
batman-adv: netlink: add gateway table queries
batman-adv: add B.A.T.M.A.N. V bat_gw_dump implementations
batman-adv: Provide bla group in the mesh_info netlink msg
compat-include/linux/netlink.h | 18 ++ compat.h | 7 + include/uapi/linux/batman_adv.h | 94 +++++++ net/batman-adv/bat_algo.c | 68 +++++ net/batman-adv/bat_algo.h | 3 + net/batman-adv/bat_iv_ogm.c | 471 +++++++++++++++++++++++++++++++++ net/batman-adv/bat_v.c | 465 ++++++++++++++++++++++++++++++++ net/batman-adv/bridge_loop_avoidance.c | 333 +++++++++++++++++++++++ net/batman-adv/bridge_loop_avoidance.h | 17 +- net/batman-adv/debugfs.c | 18 ++ net/batman-adv/gateway_client.c | 59 +++++ net/batman-adv/gateway_client.h | 2 + net/batman-adv/hard-interface.c | 50 +++- net/batman-adv/netlink.c | 217 ++++++++++++++- net/batman-adv/netlink.h | 6 + net/batman-adv/originator.c | 160 +++++++++++ net/batman-adv/originator.h | 4 + net/batman-adv/packet.h | 36 --- net/batman-adv/translation-table.c | 377 ++++++++++++++++++++++++++ net/batman-adv/translation-table.h | 4 + net/batman-adv/types.h | 12 + 21 files changed, 2373 insertions(+), 48 deletions(-)
Signature · 1 line
2.8.1
Sven Eckelmann
maintainerPATCH v10 1/16 batman-adv: Handle parent interfaces in a different netns
From: Andrew Lunn <[email protected]>
batman-adv tries to prevent the user from placing a batX soft interface into another batman mesh as a hard interface. It does this by walking up the devices list of parents and ensures they are all none batX interfaces. iflink can point to an interface in a different namespace, so also retrieve the parents name space when finding the parent and use it when doing the comparison.
--- compat.h | 7 ++++++ net/batman-adv/hard-interface.c | 50 +++++++++++++++++++++++++++++++++++------ 2 files changed, 50 insertions(+), 7 deletions(-)
compat.h +7 -0
@@ -146,6 +146,13 @@ static int __batadv_interface_kill_vid(struct net_device *dev, __be16 proto,\#endif /* < KERNEL_VERSION(3, 15, 0) */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (4 ,0 ,0 ) + +/* WARNING for batadv_getlink_net */ +#define get_link_net get_xstats_size || 1 || netdev->rtnl_link_ops->get_xstats_size + +#endif /* < KERNEL_VERSION(4, 0, 0) */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (4 ,3 ,0 )#define IFF_NO_QUEUE 0; dev->tx_queue_len = 0
net/batman-adv/hard-interface.c +43 -7
95 lines not on this page · raw message
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 01/16] batman-adv: Handle parent interfaces in a different netns
Quoted 13 lines · On Sunday, July 03, 2016 13:31:33 Sven Eckelmann wrote:
From: Andrew Lunn <[email protected]>
batman-adv tries to prevent the user from placing a batX soft interface into another batman mesh as a hard interface. It does this by walking up the devices list of parents and ensures they are all none batX interfaces. iflink can point to an interface in a different namespace, so also retrieve the parents name space when finding the parent and use it when doing the comparison.
Signed-off-by Andrew Lunn <[email protected]>[[email protected]: Fix alignments, simplify parent netns retrieval]Signed-off-by Sven Eckelmann <[email protected]>Signed-off-by Simon Wunderlich <[email protected]>
Quoted 5 lines
--- compat.h | 7 ++++++ net/batman-adv/hard-interface.c | 50+++++++++++++++++++++++++++++++++++------ 2 files changed, 50 insertions(+), 7 deletions(-)
Applied in revision bea804d.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 2/16 batman-adv: Suppress debugfs entries for netns's
In reply to Sven EckelmannFrom: Andrew Lunn <[email protected]>
Debugfs is not netns aware. It thus has problems when the same interface name exists in multiple network name spaces.
Work around this by not creating entries for interfaces in name spaces other than the default name space. This means meshes in network namespaces cannot be managed via debugfs, but there will soon be a netlink interface which is netns aware.
--- net/batman-adv/debugfs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
net/batman-adv/debugfs.c +18 -0
@@ -31,6 +31,7 @@#include <linux/stddef.h> #include <linux/stringify.h> #include <linux/sysfs.h> +#include <net/net_namespace.h> #include "bat_algo.h" #include "bridge_loop_avoidance.h"
@@ -305,12 +306,16 @@ void batadv_debugfs_destroy(void)*/ int batadv_debugfs_add_hardif (struct batadv_hard_iface *hard_iface) { +struct net *net =dev_net (hard_iface->net_dev);struct batadv_debuginfo **bat_debug;struct dentry *file;if (!batadv_debugfs) goto out; +if (net != &init_net) +return 0 ; + hard_iface->debug_dir =debugfs_create_dir (hard_iface->net_dev->name, batadv_debugfs);if (!hard_iface->debug_dir)
@@ -341,6 +346,11 @@ out:*/ void batadv_debugfs_del_hardif (struct batadv_hard_iface *hard_iface) { +struct net *net =dev_net (hard_iface->net_dev); + +if (net != &init_net) +return ; +if (batadv_debugfs) {debugfs_remove_recursive (hard_iface->debug_dir); hard_iface->debug_dir =NULL ;
@@ -351,11 +361,15 @@ int batadv_debugfs_add_meshif(struct net_device *dev) {struct batadv_priv *bat_priv =netdev_priv (dev);struct batadv_debuginfo **bat_debug; +struct net *net =dev_net (dev);struct dentry *file;if (!batadv_debugfs) goto out; +if (net != &init_net) +return 0 ; + bat_priv->debug_dir =debugfs_create_dir (dev->name, batadv_debugfs);if (!bat_priv->debug_dir) goto out;
@@ -392,6 +406,10 @@ out:void batadv_debugfs_del_meshif (struct net_device *dev) {struct batadv_priv *bat_priv =netdev_priv (dev); +struct net *net =dev_net (dev); + +if (net != &init_net) +return ;batadv_debug_log_cleanup (bat_priv);
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 02/16] batman-adv: Suppress debugfs entries for netns's
Quoted 10 lines · On Sunday, July 03, 2016 13:31:34 Sven Eckelmann wrote:
From: Andrew Lunn <[email protected]>
Debugfs is not netns aware. It thus has problems when the same interface name exists in multiple network name spaces.
Work around this by not creating entries for interfaces in name spaces other than the default name space. This means meshes in network namespaces cannot be managed via debugfs, but there will soon be a netlink interface which is netns aware.
Quoted 6 lines
Signed-off-by Andrew Lunn <[email protected]>Signed-off-by Simon Wunderlich <[email protected]>Signed-off-by Sven Eckelmann <[email protected]>--- net/batman-adv/debugfs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
Applied in revision 242d600.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 3/16 batman-adv: netlink: add routing_algo query
In reply to Sven EckelmannFrom: Matthias Schiffer <[email protected]>
BATADV_CMD_GET_ROUTING_ALGOS is used to get the list of supported routing algorithms.
[[email protected]: Reduce the number of changes to BATADV_CMD_GET_ROUTING_ALGOS, fix includes]
--- compat-include/linux/netlink.h | 18 +++++++++++ include/uapi/linux/batman_adv.h | 2 ++ net/batman-adv/bat_algo.c | 68 +++++++++++++++++++++++++++++++++++++++++ net/batman-adv/bat_algo.h | 3 ++ net/batman-adv/netlink.c | 9 +++++- net/batman-adv/netlink.h | 3 ++ 6 files changed, 102 insertions(+), 1 deletion(-)
compat-include/linux/netlink.h +18 -0
@@ -24,6 +24,24 @@#include <linux/version.h> #include_next <linux/netlink.h> +#if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,7 ,0 ) + +#include <net/scm.h> + +struct batadv_netlink_skb_parms { +struct ucred creds;/* Skb credentials */ +union { +__u32 portid; +__u32 pid; + }; +__u32 dst_group; +}; + +#undef NETLINK_CB +#define NETLINK_CB (skb) (*(struct batadv_netlink_skb_parms *)&((skb)->cb)) + +#endif /* < KERNEL_VERSION(3, 7, 0) */ +#if LINUX_VERSION_CODE <KERNEL_VERSION (4 ,7 ,0 )#include_next <net/netlink.h>
include/uapi/linux/batman_adv.h +2 -0
@@ -73,6 +73,7 @@ enum batadv_nl_attrs {* @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv device * @BATADV_CMD_TP_METER: Start a tp meter session * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session +* @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms. * @__BATADV_CMD_AFTER_LAST: internal use * @BATADV_CMD_MAX: highest used command number */
@@ -81,6 +82,7 @@ enum batadv_nl_commands {BATADV_CMD_GET_MESH_INFO ,BATADV_CMD_TP_METER ,BATADV_CMD_TP_METER_CANCEL , +BATADV_CMD_GET_ROUTING_ALGOS ,/* add new commands above here */ __BATADV_CMD_AFTER_LAST,BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST -1
net/batman-adv/bat_algo.c +68 -0
83 lines not on this page · raw message
net/batman-adv/bat_algo.h +3 -0
@@ -22,7 +22,9 @@#include <linux/types.h> +struct netlink_callback ;struct seq_file ; +struct sk_buff ;extern char batadv_routing_algo[];extern struct list_head batadv_hardif_list;
@@ -31,5 +33,6 @@ void batadv_algo_init(void);int batadv_algo_register (struct batadv_algo_ops *bat_algo_ops);int batadv_algo_select (struct batadv_priv *bat_priv,char *name);int batadv_algo_seq_print_text (struct seq_file *seq,void *offset); +int batadv_algo_dump (struct sk_buff *msg,struct netlink_callback *cb);#endif /* _NET_BATMAN_ADV_BAT_ALGO_H_ */
net/batman-adv/netlink.c +8 -1
@@ -32,13 +32,14 @@#include <net/netlink.h> #include <uapi/linux/batman_adv.h> +#include "bat_algo.h" #include "hard-interface.h" #include "soft-interface.h" #include "tp_meter.h" struct sk_buff ; -static struct genl_family batadv_netlink_family = { +struct genl_family batadv_netlink_family = { .id =GENL_ID_GENERATE , .hdrsize =0 , .name =BATADV_NL_NAME ,
@@ -399,6 +400,12 @@ static struct genl_ops batadv_netlink_ops[] = { .policy = batadv_netlink_policy, .doit = batadv_netlink_tp_meter_cancel, }, + { + .cmd = BATADV_CMD_GET_ROUTING_ALGOS, + .flags = GENL_ADMIN_PERM, + .policy = batadv_netlink_policy, + .dumpit = batadv_algo_dump, + }, };/**
net/batman-adv/netlink.h +3 -0
@@ -21,6 +21,7 @@#include "main.h" #include <linux/types.h> +#include <net/genetlink.h> void batadv_netlink_register (void );void batadv_netlink_unregister (void );
@@ -29,4 +30,6 @@ int batadv_netlink_tpmeter_notify(struct batadv_priv *bat_priv, const u8 *dst, u8 result, u32 test_time, u64 total_bytes, u32 cookie); +extern struct genl_family batadv_netlink_family; +#endif /* _NET_BATMAN_ADV_NETLINK_H_ */
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 03/16] batman-adv: netlink: add routing_algo query
Quoted 11 lines · On Sunday, July 03, 2016 13:31:35 Sven Eckelmann wrote:
From: Matthias Schiffer <[email protected]>
BATADV_CMD_GET_ROUTING_ALGOSis used to get the list of supported routing algorithms.Signed-off-by Matthias Schiffer <[email protected]>Signed-off-by Andrew Lunn <[email protected]>[[email protected]: Reduce the number of changes to
BATADV_CMD_GET_ROUTING_ALGOS, fix includes]Signed-off-by Sven Eckelmann <[email protected]>Signed-off-by Simon Wunderlich <[email protected]>
Quoted 9 lines
--- compat-include/linux/netlink.h | 18 +++++++++++ include/uapi/linux/batman_adv.h | 2 ++ net/batman-adv/bat_algo.c | 68 +++++++++++++++++++++++++++++++++++++++++ net/batman-adv/bat_algo.h | 3 ++ net/batman-adv/netlink.c | 9 +++++- net/batman-adv/netlink.h | 3 ++ 6 files changed, 102 insertions(+), 1 deletion(-)
Applied in revision d632653.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 4/16 batman-adv: netlink: hardif query
In reply to Sven EckelmannFrom: Matthias Schiffer <[email protected]>
BATADV_CMD_GET_HARDIFS will return the list of hardifs (including index, name and MAC address) of all hardifs for a given softif.
[[email protected]: Reduce the number of changes to BATADV_CMD_GET_HARDIFS, add policy for attributes]
--- include/uapi/linux/batman_adv.h | 4 ++ net/batman-adv/netlink.c | 128 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 130 insertions(+), 2 deletions(-)
include/uapi/linux/batman_adv.h +4 -0
@@ -40,6 +40,7 @@* @BATADV_ATTR_TPMETER_BYTES: amount of acked bytes during run * @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment +* @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active * @__BATADV_ATTR_AFTER_LAST: internal use * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available * @BATADV_ATTR_MAX: highest attribute number currently defined
@@ -60,6 +61,7 @@ enum batadv_nl_attrs {BATADV_ATTR_TPMETER_BYTES ,BATADV_ATTR_TPMETER_COOKIE ,BATADV_ATTR_PAD , +BATADV_ATTR_ACTIVE ,/* add attributes above here, update the policy in netlink.c */ __BATADV_ATTR_AFTER_LAST, NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
@@ -74,6 +76,7 @@ enum batadv_nl_attrs {* @BATADV_CMD_TP_METER: Start a tp meter session * @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms. +* @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces * @__BATADV_CMD_AFTER_LAST: internal use * @BATADV_CMD_MAX: highest used command number */
@@ -83,6 +86,7 @@ enum batadv_nl_commands {BATADV_CMD_TP_METER ,BATADV_CMD_TP_METER_CANCEL ,BATADV_CMD_GET_ROUTING_ALGOS , +BATADV_CMD_GET_HARDIFS ,/* add new commands above here */ __BATADV_CMD_AFTER_LAST,BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST -1
net/batman-adv/netlink.c +126 -2
165 lines not on this page · raw message
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 04/16] batman-adv: netlink: hardif query
Quoted 9 lines · On Sunday, July 03, 2016 13:31:36 Sven Eckelmann wrote:
From: Matthias Schiffer <[email protected]>
BATADV_CMD_GET_HARDIFSwill return the list of hardifs (including index, name and MAC address) of all hardifs for a given softif.Signed-off-by Matthias Schiffer <[email protected]>Signed-off-by Andrew Lunn <[email protected]>[[email protected]: Reduce the number of changes to
BATADV_CMD_GET_HARDIFS, add policy for attributes]
Quoted 7 lines
Signed-off-by Sven Eckelmann <[email protected]>Signed-off-by Simon Wunderlich <[email protected]>--- include/uapi/linux/batman_adv.h | 4 ++ net/batman-adv/netlink.c | 128+++++++++++++++++++++++++++++++++++++++- 2 files changed, 130 insertions(+), 2 deletions(-)
Applied in revision 55d368c.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 5/16 batman-adv: netlink: add translation table query
In reply to Sven EckelmannFrom: Matthias Schiffer <[email protected]>
This adds the commands BATADV_CMD_GET_TRANSTABLE_LOCAL and BATADV_CMD_GET_TRANSTABLE_GLOBAL, which correspond to the transtable_local and transtable_global debugfs files.
The batadv_tt_client_flags enum is moved to the UAPI to expose it as part of the netlink API.
--- include/uapi/linux/batman_adv.h | 56 ++++++ net/batman-adv/netlink.c | 23 ++- net/batman-adv/netlink.h | 3 + net/batman-adv/packet.h | 36 ---- net/batman-adv/translation-table.c | 377 +++++++++++++++++++++++++++++++++++++ net/batman-adv/translation-table.h | 4 + 6 files changed, 462 insertions(+), 37 deletions(-)
include/uapi/linux/batman_adv.h +56 -0
@@ -23,6 +23,42 @@#define BATADV_NL_MCAST_GROUP_TPMETER "tpmeter"/** +* enum batadv_tt_client_flags - TT client specific flags +* @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table +* @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and the new +* update telling its new real location has not been received/sent yet +* @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi interface. +* This information is used by the "AP Isolation" feature +* @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This +* information is used by the Extended Isolation feature +* @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from the table +* @BATADV_TT_CLIENT_NEW: this client has been added to the local table but has +* not been announced yet +* @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it is kept +* in the table for one more originator interval for consistency purposes +* @BATADV_TT_CLIENT_TEMP: this global client has been detected to be part of +* the network but no nnode has already announced it +* +* Bits from 0 to 7 are called _remote flags_ because they are sent on the wire. +* Bits from 8 to 15 are called _local flags_ because they are used for local +* computations only. +* +* Bits from 4 to 7 - a subset of remote flags - are ensured to be in sync with +* the other nodes in the network. To achieve this goal these flags are included +* in the TT CRC computation. +*/ +enum batadv_tt_client_flags { +BATADV_TT_CLIENT_DEL = (1 <<0 ), +BATADV_TT_CLIENT_ROAM = (1 <<1 ), +BATADV_TT_CLIENT_WIFI = (1 <<4 ), +BATADV_TT_CLIENT_ISOLA = (1 <<5 ), +BATADV_TT_CLIENT_NOPURGE = (1 <<8 ), +BATADV_TT_CLIENT_NEW = (1 <<9 ), +BATADV_TT_CLIENT_PENDING = (1 <<10 ), +BATADV_TT_CLIENT_TEMP = (1 <<11 ), +}; + +/** * enum batadv_nl_attrs - batman-adv netlink attributes * * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors
@@ -41,6 +77,14 @@* @BATADV_ATTR_TPMETER_COOKIE: session cookie to match tp_meter session * @BATADV_ATTR_PAD: attribute used for padding for 64-bit alignment * @BATADV_ATTR_ACTIVE: Flag indicating if the hard interface is active +* @BATADV_ATTR_TT_ADDRESS: Client MAC address +* @BATADV_ATTR_TT_TTVN: Translation table version +* @BATADV_ATTR_TT_LAST_TTVN: Previous translation table version +* @BATADV_ATTR_TT_CRC32: CRC32 over translation table +* @BATADV_ATTR_TT_VID: VLAN ID +* @BATADV_ATTR_TT_FLAGS: Translation table client flags +* @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best +* @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen * @__BATADV_ATTR_AFTER_LAST: internal use * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available * @BATADV_ATTR_MAX: highest attribute number currently defined
@@ -62,6 +106,14 @@ enum batadv_nl_attrs {BATADV_ATTR_TPMETER_COOKIE ,BATADV_ATTR_PAD ,BATADV_ATTR_ACTIVE , +BATADV_ATTR_TT_ADDRESS , +BATADV_ATTR_TT_TTVN , +BATADV_ATTR_TT_LAST_TTVN , +BATADV_ATTR_TT_CRC32 , +BATADV_ATTR_TT_VID , +BATADV_ATTR_TT_FLAGS , +BATADV_ATTR_FLAG_BEST , +BATADV_ATTR_LAST_SEEN_MSECS ,/* add attributes above here, update the policy in netlink.c */ __BATADV_ATTR_AFTER_LAST, NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
@@ -77,6 +129,8 @@ enum batadv_nl_attrs {* @BATADV_CMD_TP_METER_CANCEL: Cancel a tp meter session * @BATADV_CMD_GET_ROUTING_ALGOS: Query the list of routing algorithms. * @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces +* @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations +* @BATADV_CMD_GET_TRANSTABLE_GLOBAL Query list of global translations * @__BATADV_CMD_AFTER_LAST: internal use * @BATADV_CMD_MAX: highest used command number */
@@ -87,6 +141,8 @@ enum batadv_nl_commands {BATADV_CMD_TP_METER_CANCEL ,BATADV_CMD_GET_ROUTING_ALGOS ,BATADV_CMD_GET_HARDIFS , +BATADV_CMD_GET_TRANSTABLE_LOCAL , +BATADV_CMD_GET_TRANSTABLE_GLOBAL ,/* add new commands above here */ __BATADV_CMD_AFTER_LAST,BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST -1
net/batman-adv/netlink.c +22 -1
@@ -40,6 +40,7 @@#include "hard-interface.h" #include "soft-interface.h" #include "tp_meter.h" +#include "translation-table.h" struct genl_family batadv_netlink_family = { .id =GENL_ID_GENERATE ,
@@ -73,6 +74,14 @@ static struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = { [BATADV_ATTR_TPMETER_BYTES] = { .type = NLA_U64 }, [BATADV_ATTR_TPMETER_COOKIE] = { .type = NLA_U32 }, [BATADV_ATTR_ACTIVE] = { .type = NLA_FLAG }, + [BATADV_ATTR_TT_ADDRESS] = { .len = 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 }, };/**
@@ -82,7 +91,7 @@ static struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = {* * Return: interface index, or 0. */ -static int +int batadv_netlink_get_ifindex (const struct nlmsghdr *nlh,int attrtype) {struct nlattr *attr =nlmsg_find_attr (nlh,GENL_HDRLEN , attrtype);
@@ -530,6 +539,18 @@ static struct genl_ops batadv_netlink_ops[] = { .policy = batadv_netlink_policy, .dumpit = batadv_netlink_dump_hardifs, }, + { + .cmd = BATADV_CMD_GET_TRANSTABLE_LOCAL, + .flags = GENL_ADMIN_PERM, + .policy = batadv_netlink_policy, + .dumpit = batadv_tt_local_dump, + }, + { + .cmd = BATADV_CMD_GET_TRANSTABLE_GLOBAL, + .flags = GENL_ADMIN_PERM, + .policy = batadv_netlink_policy, + .dumpit = batadv_tt_global_dump, + }, };/**
net/batman-adv/netlink.h +3 -0
@@ -23,8 +23,11 @@#include <linux/types.h> #include <net/genetlink.h> +struct nlmsghdr ; +void batadv_netlink_register (void );void batadv_netlink_unregister (void ); +int batadv_netlink_get_ifindex (const struct nlmsghdr *nlh,int attrtype); int batadv_netlink_tpmeter_notify(struct batadv_priv *bat_priv, const u8 *dst, u8 result, u32 test_time, u64 total_bytes,
net/batman-adv/packet.h +0 -36
@@ -129,42 +129,6 @@ enum batadv_tt_data_flags { };/** -* enum batadv_tt_client_flags - TT client specific flags -* @BATADV_TT_CLIENT_DEL: the client has to be deleted from the table -* @BATADV_TT_CLIENT_ROAM: the client roamed to/from another node and the new -* update telling its new real location has not been received/sent yet -* @BATADV_TT_CLIENT_WIFI: this client is connected through a wifi interface. -* This information is used by the "AP Isolation" feature -* @BATADV_TT_CLIENT_ISOLA: this client is considered "isolated". This -* information is used by the Extended Isolation feature -* @BATADV_TT_CLIENT_NOPURGE: this client should never be removed from the table -* @BATADV_TT_CLIENT_NEW: this client has been added to the local table but has -* not been announced yet -* @BATADV_TT_CLIENT_PENDING: this client is marked for removal but it is kept -* in the table for one more originator interval for consistency purposes -* @BATADV_TT_CLIENT_TEMP: this global client has been detected to be part of -* the network but no nnode has already announced it -* -* Bits from 0 to 7 are called _remote flags_ because they are sent on the wire. -* Bits from 8 to 15 are called _local flags_ because they are used for local -* computations only. -* -* Bits from 4 to 7 - a subset of remote flags - are ensured to be in sync with -* the other nodes in the network. To achieve this goal these flags are included -* in the TT CRC computation. -*/ -enum batadv_tt_client_flags { -BATADV_TT_CLIENT_DEL =BIT (0 ), -BATADV_TT_CLIENT_ROAM =BIT (1 ), -BATADV_TT_CLIENT_WIFI =BIT (4 ), -BATADV_TT_CLIENT_ISOLA =BIT (5 ), -BATADV_TT_CLIENT_NOPURGE =BIT (8 ), -BATADV_TT_CLIENT_NEW =BIT (9 ), -BATADV_TT_CLIENT_PENDING =BIT (10 ), -BATADV_TT_CLIENT_TEMP =BIT (11 ), -}; - -/** * enum batadv_vlan_flags - flags for the four MSB of any vlan ID field * @BATADV_VLAN_HAS_TAG: whether the field contains a valid vlan tag or not */
net/batman-adv/translation-table.c +377 -0
409 lines not on this page · raw message
net/batman-adv/translation-table.h +4 -0
@@ -22,8 +22,10 @@#include <linux/types.h> +struct netlink_callback ;struct net_device ;struct seq_file ; +struct sk_buff ;int batadv_tt_init (struct batadv_priv *bat_priv); bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
@@ -33,6 +35,8 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const char *message, bool roaming);int batadv_tt_local_seq_print_text (struct seq_file *seq,void *offset);int batadv_tt_global_seq_print_text (struct seq_file *seq,void *offset); +int batadv_tt_local_dump (struct sk_buff *msg,struct netlink_callback *cb); +int batadv_tt_global_dump (struct sk_buff *msg,struct netlink_callback *cb);void batadv_tt_global_del_orig (struct batadv_priv *bat_priv,struct batadv_orig_node *orig_node,s32 match_vid,const char *message);
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 05/16] batman-adv: netlink: add translation table query
Quoted 15 lines · On Sunday, July 03, 2016 13:31:37 Sven Eckelmann wrote:
From: Matthias Schiffer <[email protected]>
This adds the commands
BATADV_CMD_GET_TRANSTABLE_LOCALandBATADV_CMD_GET_TRANSTABLE_GLOBAL, which correspond to thetranstable_localandtranstable_globaldebugfs files.The
batadv_tt_client_flagsenum is moved to the UAPI to expose it as part of the netlink API.Signed-off-by Matthias Schiffer <[email protected]>Signed-off-by Andrew Lunn <[email protected]>[[email protected]: add policy for attributes, fix includes]Signed-off-by Sven Eckelmann <[email protected]>[[email protected]: fix VID attributes content]Signed-off-by Simon Wunderlich <[email protected]>
Quoted 9 lines
--- include/uapi/linux/batman_adv.h | 56 ++++++ net/batman-adv/netlink.c | 23 ++- net/batman-adv/netlink.h | 3 + net/batman-adv/packet.h | 36 ---- net/batman-adv/translation-table.c | 377 +++++++++++++++++++++++++++++++++++++ net/batman-adv/translation-table.h | 4 + 6 files changed, 462 insertions(+), 37 deletions(-)
Applied in revision fcfcf61.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 6/16 batman-adv: Provide TTVN in the mesh_info netlink msg
In reply to Sven EckelmannThe TTVN is the main information for the debugging of translation table problems. It is therefore necessary when comparing the global translation tables.
--- net/batman-adv/netlink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/batman-adv/netlink.c +4 -1
@@ -18,6 +18,7 @@#include "netlink.h" #include "main.h" +#include <linux/atomic.h> #include <linux/errno.h> #include <linux/fs.h> #include <linux/genetlink.h>
@@ -121,7 +122,9 @@ batadv_netlink_mesh_info_put(struct sk_buff *msg, struct net_device *soft_iface)nla_put_u32 (msg,BATADV_ATTR_MESH_IFINDEX , soft_iface->ifindex) ||nla_put_string (msg,BATADV_ATTR_MESH_IFNAME , soft_iface->name) ||nla_put (msg,BATADV_ATTR_MESH_ADDRESS ,ETH_ALEN , - soft_iface->dev_addr)) + soft_iface->dev_addr) || +nla_put_u8 (msg,BATADV_ATTR_TT_TTVN , + (u8)atomic_read(&bat_priv->tt.vn))) goto out; primary_if =batadv_primary_if_get_selected (bat_priv);
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 06/16] batman-adv: Provide TTVN in the mesh_info netlink msg
Quoted 9 lines · On Sunday, July 03, 2016 13:31:38 Sven Eckelmann wrote:
The TTVN is the main information for the debugging of translation table problems. It is therefore necessary when comparing the global translation tables.
Signed-off-by Sven Eckelmann <[email protected]>Signed-off-by Simon Wunderlich <[email protected]>--- net/batman-adv/netlink.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Applied in revision a754c02.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 7/16 batman-adv: netlink: add originator and neighbor table queries
In reply to Sven EckelmannFrom: Matthias Schiffer <[email protected]>
Add BATADV_CMD_GET_ORIGINATORS and BATADV_CMD_GET_NEIGHBORS commands, using handlers bat_orig_dump and bat_neigh_dump in batadv_algo_ops. Will always return -EOPNOTSUPP for now, as no implementations exist yet.
--- include/uapi/linux/batman_adv.h | 4 + net/batman-adv/netlink.c | 13 ++++ net/batman-adv/originator.c | 160 ++++++++++++++++++++++++++++++++++++++++ net/batman-adv/originator.h | 4 + net/batman-adv/types.h | 9 +++ 5 files changed, 190 insertions(+)
include/uapi/linux/batman_adv.h +4 -0
@@ -131,6 +131,8 @@ enum batadv_nl_attrs {* @BATADV_CMD_GET_HARDIFS: Query list of hard interfaces * @BATADV_CMD_GET_TRANSTABLE_LOCAL: Query list of local translations * @BATADV_CMD_GET_TRANSTABLE_GLOBAL Query list of global translations +* @BATADV_CMD_GET_ORIGINATORS: Query list of originators +* @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours * @__BATADV_CMD_AFTER_LAST: internal use * @BATADV_CMD_MAX: highest used command number */
@@ -143,6 +145,8 @@ enum batadv_nl_commands {BATADV_CMD_GET_HARDIFS ,BATADV_CMD_GET_TRANSTABLE_LOCAL ,BATADV_CMD_GET_TRANSTABLE_GLOBAL , +BATADV_CMD_GET_ORIGINATORS , +BATADV_CMD_GET_NEIGHBORS ,/* add new commands above here */ __BATADV_CMD_AFTER_LAST,BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST -1
net/batman-adv/netlink.c +13 -0
@@ -39,6 +39,7 @@#include "bat_algo.h" #include "hard-interface.h" +#include "originator.h" #include "soft-interface.h" #include "tp_meter.h" #include "translation-table.h"
@@ -554,6 +555,18 @@ static struct genl_ops batadv_netlink_ops[] = { .policy = batadv_netlink_policy, .dumpit = batadv_tt_global_dump, }, + { + .cmd = BATADV_CMD_GET_ORIGINATORS, + .flags = GENL_ADMIN_PERM, + .policy = batadv_netlink_policy, + .dumpit = batadv_orig_dump, + }, + { + .cmd = BATADV_CMD_GET_NEIGHBORS, + .flags = GENL_ADMIN_PERM, + .policy = batadv_netlink_policy, + .dumpit = batadv_hardif_neigh_dump, + }, };/**
net/batman-adv/originator.c +160 -0
191 lines not on this page · raw message
net/batman-adv/originator.h +4 -0
@@ -31,7 +31,9 @@#include "hash.h" +struct netlink_callback ;struct seq_file ; +struct sk_buff ;bool batadv_compare_orig (const struct hlist_node *node,const void *data2);int batadv_originator_init (struct batadv_priv *bat_priv);
@@ -61,6 +63,7 @@ batadv_neigh_ifinfo_get(struct batadv_neigh_node *neigh, struct batadv_hard_iface *if_outgoing);void batadv_neigh_ifinfo_put (struct batadv_neigh_ifinfo *neigh_ifinfo); +int batadv_hardif_neigh_dump (struct sk_buff *msg,struct netlink_callback *cb);int batadv_hardif_neigh_seq_print_text (struct seq_file *seq,void *offset); struct batadv_orig_ifinfo *
@@ -72,6 +75,7 @@ batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node,void batadv_orig_ifinfo_put (struct batadv_orig_ifinfo *orig_ifinfo);int batadv_orig_seq_print_text (struct seq_file *seq,void *offset); +int batadv_orig_dump (struct sk_buff *msg,struct netlink_callback *cb);int batadv_orig_hardif_seq_print_text (struct seq_file *seq,void *offset);int batadv_orig_hash_add_if (struct batadv_hard_iface *hard_iface,int max_if_num);
net/batman-adv/types.h +9 -0
@@ -28,6 +28,7 @@#include <linux/if_ether.h> #include <linux/kref.h> #include <linux/netdevice.h> +#include <linux/netlink.h> #include <linux/sched.h> /* for linux/wait.h */ #include <linux/spinlock.h> #include <linux/types.h>
@@ -1412,6 +1413,7 @@ struct batadv_algo_iface_ops {* @is_similar_or_better: check if neigh1 is equally similar or better than * neigh2 for their respective outgoing interface from the metric prospective * @print: print the single hop neighbor list (optional) +* @dump: dump neighbors to a netlink socket (optional) */ struct batadv_algo_neigh_ops {void (*hardif_init)(struct batadv_hardif_neigh_node *neigh);
@@ -1424,6 +1426,9 @@ struct batadv_algo_neigh_ops {struct batadv_neigh_node *neigh2, struct batadv_hard_iface *if_outgoing2);void (*print)(struct batadv_priv *priv,struct seq_file *seq); +void (*dump)(struct sk_buff *msg,struct netlink_callback *cb, +struct batadv_priv *priv, +struct batadv_hard_iface *hard_iface); };/**
@@ -1435,6 +1440,7 @@ struct batadv_algo_neigh_ops {* @del_if: ask the routing algorithm to apply the needed changes to the * orig_node due to an hard-interface being removed from the mesh (optional) * @print: print the originator table (optional) +* @dump: dump originators to a netlink socket (optional) */ struct batadv_algo_orig_ops {void (*free)(struct batadv_orig_node *orig_node);
@@ -1443,6 +1449,9 @@ struct batadv_algo_orig_ops { int del_if_num);void (*print)(struct batadv_priv *priv,struct seq_file *seq,struct batadv_hard_iface *hard_iface); +void (*dump)(struct sk_buff *msg,struct netlink_callback *cb, +struct batadv_priv *priv, +struct batadv_hard_iface *hard_iface); };/**
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 07/16] batman-adv: netlink: add originator and neighbor table queries
Quoted 11 lines · On Sunday, July 03, 2016 13:31:39 Sven Eckelmann wrote:
From: Matthias Schiffer <[email protected]>
Add
BATADV_CMD_GET_ORIGINATORSandBATADV_CMD_GET_NEIGHBORScommands, using handlersbat_orig_dumpandbat_neigh_dumpinbatadv_algo_ops. Will always return-EOPNOTSUPPfor now, as no implementations exist yet.Signed-off-by Matthias Schiffer <[email protected]>Signed-off-by Andrew Lunn <[email protected]>[[email protected]: Rewrite based on new algo_ops structures]Signed-off-by Sven Eckelmann <[email protected]>Signed-off-by Simon Wunderlich <[email protected]>
Quoted 8 lines
--- include/uapi/linux/batman_adv.h | 4 + net/batman-adv/netlink.c | 13 ++++ net/batman-adv/originator.c | 160 ++++++++++++++++++++++++++++++++++++++++ net/batman-adv/originator.h | 4 + net/batman-adv/types.h | 9 +++ 5 files changed, 190 insertions(+)
Applied in revision c441a84.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 8/16 batman-adv: add B.A.T.M.A.N. IV bat_{orig, neigh}_dump implementations
In reply to Sven EckelmannFrom: Matthias Schiffer <[email protected]>
[[email protected]: Fix function parameter alignments, add policy for attributes, fix includes, fix algo_ops integration]
--- include/uapi/linux/batman_adv.h | 4 + net/batman-adv/bat_iv_ogm.c | 366 ++++++++++++++++++++++++++++++++++++++++ net/batman-adv/netlink.c | 2 + 3 files changed, 372 insertions(+)
include/uapi/linux/batman_adv.h +4 -0
@@ -85,6 +85,8 @@ enum batadv_tt_client_flags {* @BATADV_ATTR_TT_FLAGS: Translation table client flags * @BATADV_ATTR_FLAG_BEST: Flags indicating entry is the best * @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen +* @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address +* @BATADV_ATTR_TQ: TQ to neighbour * @__BATADV_ATTR_AFTER_LAST: internal use * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available * @BATADV_ATTR_MAX: highest attribute number currently defined
@@ -114,6 +116,8 @@ enum batadv_nl_attrs {BATADV_ATTR_TT_FLAGS ,BATADV_ATTR_FLAG_BEST ,BATADV_ATTR_LAST_SEEN_MSECS , +BATADV_ATTR_NEIGH_ADDRESS , +BATADV_ATTR_TQ ,/* add attributes above here, update the policy in netlink.c */ __BATADV_ATTR_AFTER_LAST, NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
net/batman-adv/bat_iv_ogm.c +366 -0
405 lines not on this page · raw message
net/batman-adv/netlink.c +2 -0
@@ -84,6 +84,8 @@ static struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = { [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] = { .len = ETH_ALEN }, + [BATADV_ATTR_TQ] = { .type = NLA_U8 }, };/**
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 08/16] batman-adv: add B.A.T.M.A.N. IV bat_{orig, neigh}_dump implementations
Quoted 6 lines · On Sunday, July 03, 2016 13:31:40 Sven Eckelmann wrote:
From: Matthias Schiffer <[email protected]>
Signed-off-by Matthias Schiffer <[email protected]>Signed-off-by Andrew Lunn <[email protected]>[[email protected]: Fix function parameter alignments, add policy for attributes, fix includes, fix
algo_opsintegration]
Quoted 8 lines
Signed-off-by Sven Eckelmann <[email protected]>Signed-off-by Simon Wunderlich <[email protected]>--- include/uapi/linux/batman_adv.h | 4 + net/batman-adv/bat_iv_ogm.c | 366 ++++++++++++++++++++++++++++++++++++++++ net/batman-adv/netlink.c | 2 + 3 files changed, 372 insertions(+)
Applied in revision df08990.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 9/16 batman-adv: add B.A.T.M.A.N. V bat_{orig, neigh}_dump implementations
In reply to Sven EckelmannFrom: Matthias Schiffer <[email protected]>
Dump the algo V originators and neighbours.
--- include/uapi/linux/batman_adv.h | 2 + net/batman-adv/bat_v.c | 340 ++++++++++++++++++++++++++++++++++++++++ net/batman-adv/netlink.c | 1 + 3 files changed, 343 insertions(+)
include/uapi/linux/batman_adv.h +2 -0
@@ -87,6 +87,7 @@ enum batadv_tt_client_flags {* @BATADV_ATTR_LAST_SEEN_MSECS: Time in milliseconds since last seen * @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address * @BATADV_ATTR_TQ: TQ to neighbour +* @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour * @__BATADV_ATTR_AFTER_LAST: internal use * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available * @BATADV_ATTR_MAX: highest attribute number currently defined
@@ -118,6 +119,7 @@ enum batadv_nl_attrs {BATADV_ATTR_LAST_SEEN_MSECS ,BATADV_ATTR_NEIGH_ADDRESS ,BATADV_ATTR_TQ , +BATADV_ATTR_THROUGHPUT ,/* add attributes above here, update the policy in netlink.c */ __BATADV_ATTR_AFTER_LAST, NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
net/batman-adv/bat_v.c +340 -0
387 lines not on this page · raw message
net/batman-adv/netlink.c +1 -0
@@ -86,6 +86,7 @@ static struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = { [BATADV_ATTR_LAST_SEEN_MSECS] = { .type = NLA_U32 }, [BATADV_ATTR_NEIGH_ADDRESS] = { .len = ETH_ALEN }, [BATADV_ATTR_TQ] = { .type = NLA_U8 }, + [BATADV_ATTR_THROUGHPUT] = { .type = NLA_U32 }, };/**
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 09/16] batman-adv: add B.A.T.M.A.N. V bat_{orig, neigh}_dump implementations
Quoted 9 lines · On Sunday, July 03, 2016 13:31:41 Sven Eckelmann wrote:
From: Matthias Schiffer <[email protected]>
Dump the algo V originators and neighbours.
Signed-off-by Matthias Schiffer <[email protected]>Signed-off-by Andrew Lunn <[email protected]>[[email protected]: Fix includes, fix algo_ops integration]Signed-off-by Sven Eckelmann <[email protected]>Signed-off-by Simon Wunderlich <[email protected]>
Quoted 6 lines
--- include/uapi/linux/batman_adv.h | 2 + net/batman-adv/bat_v.c | 340 ++++++++++++++++++++++++++++++++++++++++ net/batman-adv/netlink.c | 1 + 3 files changed, 343 insertions(+)
Applied in revision 2ec4acd.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 10/16 batman-adv: netlink: add gateway table queries
In reply to Sven EckelmannAdd BATADV_CMD_GET_GATEWAYS commands, using handlers bat_gw_dump in batadv_algo_ops. Will always return -EOPNOTSUPP for now, as no implementations exist yet.
--- include/uapi/linux/batman_adv.h | 8 ++++++ net/batman-adv/gateway_client.c | 59 +++++++++++++++++++++++++++++++++++++++++ net/batman-adv/gateway_client.h | 2 ++ net/batman-adv/netlink.c | 10 +++++++ net/batman-adv/types.h | 3 +++ 5 files changed, 82 insertions(+)
include/uapi/linux/batman_adv.h +8 -0
@@ -88,6 +88,9 @@ enum batadv_tt_client_flags {* @BATADV_ATTR_NEIGH_ADDRESS: Neighbour MAC address * @BATADV_ATTR_TQ: TQ to neighbour * @BATADV_ATTR_THROUGHPUT: Estimated throughput to Neighbour +* @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth +* @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth +* @BATADV_ATTR_ROUTER: Gateway router MAC address * @__BATADV_ATTR_AFTER_LAST: internal use * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available * @BATADV_ATTR_MAX: highest attribute number currently defined
@@ -120,6 +123,9 @@ enum batadv_nl_attrs {BATADV_ATTR_NEIGH_ADDRESS ,BATADV_ATTR_TQ ,BATADV_ATTR_THROUGHPUT , +BATADV_ATTR_BANDWIDTH_UP , +BATADV_ATTR_BANDWIDTH_DOWN , +BATADV_ATTR_ROUTER ,/* add attributes above here, update the policy in netlink.c */ __BATADV_ATTR_AFTER_LAST, NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
@@ -139,6 +145,7 @@ enum batadv_nl_attrs {* @BATADV_CMD_GET_TRANSTABLE_GLOBAL Query list of global translations * @BATADV_CMD_GET_ORIGINATORS: Query list of originators * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours +* @BATADV_CMD_GET_GATEWAYS: Query list of gateways * @__BATADV_CMD_AFTER_LAST: internal use * @BATADV_CMD_MAX: highest used command number */
@@ -153,6 +160,7 @@ enum batadv_nl_commands {BATADV_CMD_GET_TRANSTABLE_GLOBAL ,BATADV_CMD_GET_ORIGINATORS ,BATADV_CMD_GET_NEIGHBORS , +BATADV_CMD_GET_GATEWAYS ,/* add new commands above here */ __BATADV_CMD_AFTER_LAST,BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST -1
net/batman-adv/gateway_client.c +59 -0
90 lines not on this page · raw message
net/batman-adv/gateway_client.h +2 -0
@@ -23,6 +23,7 @@#include <linux/types.h> struct batadv_tvlv_gateway_data ; +struct netlink_callback ;struct seq_file ;struct sk_buff ;
@@ -43,6 +44,7 @@ void batadv_gw_node_put(struct batadv_gw_node *gw_node);struct batadv_gw_node *batadv_gw_get_selected_gw_node (struct batadv_priv *bat_priv);int batadv_gw_client_seq_print_text (struct seq_file *seq,void *offset); +int batadv_gw_dump (struct sk_buff *msg,struct netlink_callback *cb);bool batadv_gw_out_of_range (struct batadv_priv *bat_priv,struct sk_buff *skb); enum batadv_dhcp_recipient batadv_gw_dhcp_recipient_get(struct sk_buff *skb, unsigned int *header_len,
net/batman-adv/netlink.c +10 -0
@@ -38,6 +38,7 @@#include <uapi/linux/batman_adv.h> #include "bat_algo.h" +#include "gateway_client.h" #include "hard-interface.h" #include "originator.h" #include "soft-interface.h"
@@ -87,6 +88,9 @@ static struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = { [BATADV_ATTR_NEIGH_ADDRESS] = { .len = 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] = { .len = ETH_ALEN }, };/**
@@ -570,6 +574,12 @@ static struct genl_ops batadv_netlink_ops[] = { .policy = batadv_netlink_policy, .dumpit = batadv_hardif_neigh_dump, }, + { + .cmd = BATADV_CMD_GET_GATEWAYS, + .flags = GENL_ADMIN_PERM, + .policy = batadv_netlink_policy, + .dumpit = batadv_gw_dump, + }, };/**
net/batman-adv/types.h +3 -0
@@ -1463,6 +1463,7 @@ struct batadv_algo_orig_ops {* @is_eligible: check if a newly discovered GW is a potential candidate for * the election as best GW (optional) * @print: print the gateway table (optional) +* @dump: dump gateways to a netlink socket (optional) */ struct batadv_algo_gw_ops { ssize_t (*store_sel_class)(struct batadv_priv *bat_priv, char *buff,
@@ -1474,6 +1475,8 @@ struct batadv_algo_gw_ops {struct batadv_orig_node *curr_gw_orig, struct batadv_orig_node *orig_node);void (*print)(struct batadv_priv *bat_priv,struct seq_file *seq); +void (*dump)(struct sk_buff *msg,struct netlink_callback *cb, +struct batadv_priv *priv); };/**
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 10/16] batman-adv: netlink: add gateway table queries
Quoted 5 lines · On Sunday, July 03, 2016 13:31:42 Sven Eckelmann wrote:
Add
BATADV_CMD_GET_GATEWAYScommands, using handlersbat_gw_dumpinbatadv_algo_ops. Will always return-EOPNOTSUPPfor now, as no implementations exist yet.Signed-off-by Sven Eckelmann <[email protected]>
Quoted 8 lines
--- include/uapi/linux/batman_adv.h | 8 ++++++ net/batman-adv/gateway_client.c | 59 +++++++++++++++++++++++++++++++++++++++++ net/batman-adv/gateway_client.h | 2 ++ net/batman-adv/netlink.c | 10 +++++++ net/batman-adv/types.h | 3 +++ 5 files changed, 82 insertions(+)
Applied in revision 117a3bf.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 11/16 batman-adv: add B.A.T.M.A.N. IV bat_gw_dump implementations
In reply to Sven EckelmannFrom: Andrew Lunn <[email protected]>
Dump the list of gateways via the netlink socket.
--- net/batman-adv/bat_iv_ogm.c | 105 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+)
net/batman-adv/bat_iv_ogm.c +105 -0
@@ -2684,6 +2684,110 @@ static void batadv_iv_gw_print(struct batadv_priv *bat_priv,seq_puts (seq,"No gateways in range ...\n" ); } +/** +* batadv_iv_gw_dump_entry - Dump a gateway into a message +* @msg: Netlink message to dump into +* @portid: Port making netlink request +* @seq: Sequence number of netlink message +* @bat_priv: The bat priv with all the soft interface information +* @gw_node: Gateway to be dumped +* +* Return: Error code, or 0 on success +*/ +static int batadv_iv_gw_dump_entry (struct sk_buff *msg,u32 portid,u32 seq, +struct batadv_priv *bat_priv, +struct batadv_gw_node *gw_node) +{ +struct batadv_neigh_ifinfo *router_ifinfo =NULL ; +struct batadv_neigh_node *router; +struct batadv_gw_node *curr_gw; +int ret = -EINVAL ; +void *hdr; + + router =batadv_orig_router_get (gw_node->orig_node,BATADV_IF_DEFAULT ); +if (!router) + goto out; + + router_ifinfo =batadv_neigh_ifinfo_get (router,BATADV_IF_DEFAULT ); +if (!router_ifinfo) + goto out; + + curr_gw =batadv_gw_get_selected_gw_node (bat_priv); + + hdr =genlmsg_put (msg, portid, seq, &batadv_netlink_family, +NLM_F_MULTI ,BATADV_CMD_GET_GATEWAYS ); +if (!hdr) { + ret = -ENOBUFS ; + goto out; + } + + ret = -EMSGSIZE ; + +if (curr_gw == gw_node) +if (nla_put_flag (msg,BATADV_ATTR_FLAG_BEST )) { +genlmsg_cancel (msg, hdr); + goto out; + } + +if (nla_put (msg,BATADV_ATTR_ORIG_ADDRESS ,ETH_ALEN , + gw_node->orig_node->orig) || +nla_put_u8 (msg,BATADV_ATTR_TQ , router_ifinfo->bat_iv.tq_avg) || +nla_put (msg,BATADV_ATTR_ROUTER ,ETH_ALEN , + router->addr) || +nla_put_string (msg,BATADV_ATTR_HARD_IFNAME , + router->if_incoming->net_dev->name) || +nla_put_u32 (msg,BATADV_ATTR_BANDWIDTH_DOWN , + gw_node->bandwidth_down) || +nla_put_u32 (msg,BATADV_ATTR_BANDWIDTH_UP , + gw_node->bandwidth_up)) { +genlmsg_cancel (msg, hdr); + goto out; + } + +genlmsg_end (msg, hdr); + ret =0 ; + +out: +if (router_ifinfo) +batadv_neigh_ifinfo_put (router_ifinfo); +if (router) +batadv_neigh_node_put (router); +return ret; +} + +/** +* batadv_iv_gw_dump - Dump gateways into a message +* @msg: Netlink message to dump into +* @cb: Control block containing additional options +* @bat_priv: The bat priv with all the soft interface information +*/ +static void batadv_iv_gw_dump (struct sk_buff *msg,struct netlink_callback *cb, +struct batadv_priv *bat_priv) +{ +int portid =NETLINK_CB (cb->skb).portid; +struct batadv_gw_node *gw_node; +int idx_skip = cb->args[0 ]; +int idx =0 ; + +rcu_read_lock (); +hlist_for_each_entry_rcu (gw_node, &bat_priv->gw.list, list) { +if (idx++ < idx_skip) +continue ; + +if (batadv_iv_gw_dump_entry (msg, portid, cb->nlh->nlmsg_seq, + bat_priv, gw_node)) { + idx_skip = idx -1 ; + goto unlock; + } + } + + idx_skip = idx; +unlock: +rcu_read_unlock (); + + cb->args[0 ] = idx_skip; +} +static struct batadv_algo_ops batadv_batman_iv__read_mostly = { .name ="BATMAN_IV" , .iface = {
@@ -2710,6 +2814,7 @@ static struct batadv_algo_ops batadv_batman_iv __read_mostly = { .get_best_gw_node = batadv_iv_gw_get_best_gw_node, .is_eligible = batadv_iv_gw_is_eligible, .print = batadv_iv_gw_print, + .dump = batadv_iv_gw_dump, }, };
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 11/16] batman-adv: add B.A.T.M.A.N. IV bat_gw_dump implementations
Quoted 4 lines · On Sunday, July 03, 2016 13:31:43 Sven Eckelmann wrote:
From: Andrew Lunn <[email protected]>
Dump the list of gateways via the netlink socket.
Quoted 8 lines
Signed-off-by Andrew Lunn <[email protected]>[[email protected]: integrate in batadv_algo_ops]Signed-off-by Sven Eckelmann <[email protected]>Signed-off-by Simon Wunderlich <[email protected]>--- net/batman-adv/bat_iv_ogm.c | 105++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+)
Applied in revision fa32289.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 12/16 batman-adv: add B.A.T.M.A.N. V bat_gw_dump implementations
In reply to Sven Eckelmann--- net/batman-adv/bat_v.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+)
net/batman-adv/bat_v.c +125 -0
@@ -897,6 +897,130 @@ static void batadv_v_gw_print(struct batadv_priv *bat_priv,seq_puts (seq,"No gateways in range ...\n" ); } +/** +* batadv_v_gw_dump_entry - Dump a gateway into a message +* @msg: Netlink message to dump into +* @portid: Port making netlink request +* @seq: Sequence number of netlink message +* @bat_priv: The bat priv with all the soft interface information +* @gw_node: Gateway to be dumped +* +* Return: Error code, or 0 on success +*/ +static int batadv_v_gw_dump_entry (struct sk_buff *msg,u32 portid,u32 seq, +struct batadv_priv *bat_priv, +struct batadv_gw_node *gw_node) +{ +struct batadv_neigh_ifinfo *router_ifinfo =NULL ; +struct batadv_neigh_node *router; +struct batadv_gw_node *curr_gw; +int ret = -EINVAL ; +void *hdr; + + router =batadv_orig_router_get (gw_node->orig_node,BATADV_IF_DEFAULT ); +if (!router) + goto out; + + router_ifinfo =batadv_neigh_ifinfo_get (router,BATADV_IF_DEFAULT ); +if (!router_ifinfo) + goto out; + + curr_gw =batadv_gw_get_selected_gw_node (bat_priv); + + hdr =genlmsg_put (msg, portid, seq, &batadv_netlink_family, +NLM_F_MULTI ,BATADV_CMD_GET_GATEWAYS ); +if (!hdr) { + ret = -ENOBUFS ; + goto out; + } + + ret = -EMSGSIZE ; + +if (curr_gw == gw_node) { +if (nla_put_flag (msg,BATADV_ATTR_FLAG_BEST )) { +genlmsg_cancel (msg, hdr); + goto out; + } + } + +if (nla_put (msg,BATADV_ATTR_ORIG_ADDRESS ,ETH_ALEN , + gw_node->orig_node->orig)) { +genlmsg_cancel (msg, hdr); + goto out; + } + +if (nla_put_u32 (msg,BATADV_ATTR_THROUGHPUT , + router_ifinfo->bat_v.throughput)) { +genlmsg_cancel (msg, hdr); + goto out; + } + +if (nla_put (msg,BATADV_ATTR_ROUTER ,ETH_ALEN , router->addr)) { +genlmsg_cancel (msg, hdr); + goto out; + } + +if (nla_put_string (msg,BATADV_ATTR_HARD_IFNAME , + router->if_incoming->net_dev->name)) { +genlmsg_cancel (msg, hdr); + goto out; + } + +if (nla_put_u32 (msg,BATADV_ATTR_BANDWIDTH_DOWN , + gw_node->bandwidth_down)) { +genlmsg_cancel (msg, hdr); + goto out; + } + +if (nla_put_u32 (msg,BATADV_ATTR_BANDWIDTH_UP , gw_node->bandwidth_up)) { +genlmsg_cancel (msg, hdr); + goto out; + } + +genlmsg_end (msg, hdr); + ret =0 ; + +out: +if (router_ifinfo) +batadv_neigh_ifinfo_put (router_ifinfo); +if (router) +batadv_neigh_node_put (router); +return ret; +} + +/** +* batadv_v_gw_dump - Dump gateways into a message +* @msg: Netlink message to dump into +* @cb: Control block containing additional options +* @bat_priv: The bat priv with all the soft interface information +*/ +static void batadv_v_gw_dump (struct sk_buff *msg,struct netlink_callback *cb, +struct batadv_priv *bat_priv) +{ +int portid =NETLINK_CB (cb->skb).portid; +struct batadv_gw_node *gw_node; +int idx_skip = cb->args[0 ]; +int idx =0 ; + +rcu_read_lock (); +hlist_for_each_entry_rcu (gw_node, &bat_priv->gw.list, list) { +if (idx++ < idx_skip) +continue ; + +if (batadv_v_gw_dump_entry (msg, portid, cb->nlh->nlmsg_seq, + bat_priv, gw_node)) { + idx_skip = idx -1 ; + goto unlock; + } + } + + idx_skip = idx; +unlock: +rcu_read_unlock (); + + cb->args[0 ] = idx_skip; +} +static struct batadv_algo_ops batadv_batman_v__read_mostly = { .name ="BATMAN_V" , .iface = {
@@ -923,6 +1047,7 @@ static struct batadv_algo_ops batadv_batman_v __read_mostly = { .get_best_gw_node = batadv_v_gw_get_best_gw_node, .is_eligible = batadv_v_gw_is_eligible, .print = batadv_v_gw_print, + .dump = batadv_v_gw_dump, }, };
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 12/16] batman-adv: add B.A.T.M.A.N. V bat_gw_dump implementations
Quoted 5 lines · On Sunday, July 03, 2016 13:31:44 Sven Eckelmann wrote:
Signed-off-by Sven Eckelmann <[email protected]>--- net/batman-adv/bat_v.c | 125+++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+)
Applied in revision 15315a9.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 13/16 batman-adv: add B.A.T.M.A.N. Dump BLA claims via netlink
In reply to Sven EckelmannFrom: Andrew Lunn <[email protected]>
Dump the list of bridge loop avoidance claims via the netlink socket.
[[email protected]: add policy for attributes, fix includes, fix soft_iface reference leak]
--- include/uapi/linux/batman_adv.h | 12 +++ net/batman-adv/bridge_loop_avoidance.c | 169 +++++++++++++++++++++++++++++++++ net/batman-adv/bridge_loop_avoidance.h | 10 +- net/batman-adv/netlink.c | 12 +++ 4 files changed, 202 insertions(+), 1 deletion(-)
include/uapi/linux/batman_adv.h +12 -0
@@ -91,6 +91,11 @@ enum batadv_tt_client_flags {* @BATADV_ATTR_BANDWIDTH_UP: Reported uplink bandwidth * @BATADV_ATTR_BANDWIDTH_DOWN: Reported downlink bandwidth * @BATADV_ATTR_ROUTER: Gateway router MAC address +* @BATADV_ATTR_BLA_OWN: Flag indicating own originator +* @BATADV_ATTR_BLA_ADDRESS: Bridge loop avoidance claim MAC address +* @BATADV_ATTR_BLA_VID: BLA VLAN ID +* @BATADV_ATTR_BLA_BACKBONE: BLA gateway originator MAC address +* @BATADV_ATTR_BLA_CRC: BLA CRC * @__BATADV_ATTR_AFTER_LAST: internal use * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available * @BATADV_ATTR_MAX: highest attribute number currently defined
@@ -126,6 +131,11 @@ enum batadv_nl_attrs {BATADV_ATTR_BANDWIDTH_UP ,BATADV_ATTR_BANDWIDTH_DOWN ,BATADV_ATTR_ROUTER , +BATADV_ATTR_BLA_OWN , +BATADV_ATTR_BLA_ADDRESS , +BATADV_ATTR_BLA_VID , +BATADV_ATTR_BLA_BACKBONE , +BATADV_ATTR_BLA_CRC ,/* add attributes above here, update the policy in netlink.c */ __BATADV_ATTR_AFTER_LAST, NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
@@ -146,6 +156,7 @@ enum batadv_nl_attrs {* @BATADV_CMD_GET_ORIGINATORS: Query list of originators * @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours * @BATADV_CMD_GET_GATEWAYS: Query list of gateways +* @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims * @__BATADV_CMD_AFTER_LAST: internal use * @BATADV_CMD_MAX: highest used command number */
@@ -161,6 +172,7 @@ enum batadv_nl_commands {BATADV_CMD_GET_ORIGINATORS ,BATADV_CMD_GET_NEIGHBORS ,BATADV_CMD_GET_GATEWAYS , +BATADV_CMD_GET_BLA_CLAIM ,/* add new commands above here */ __BATADV_CMD_AFTER_LAST,BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST -1
net/batman-adv/bridge_loop_avoidance.c +169 -0
193 lines not on this page · raw message
net/batman-adv/bridge_loop_avoidance.h +9 -1
@@ -23,6 +23,7 @@#include <linux/types.h> struct net_device ; +struct netlink_callback ;struct seq_file ;struct sk_buff ;
@@ -35,6 +36,7 @@ bool batadv_bla_is_backbone_gw(struct sk_buff *skb,struct batadv_orig_node *orig_node, int hdr_size);int batadv_bla_claim_table_seq_print_text (struct seq_file *seq,void *offset); +int batadv_bla_claim_dump (struct sk_buff *msg,struct netlink_callback *cb);int batadv_bla_backbone_table_seq_print_text (struct seq_file *seq,void *offset); bool batadv_bla_is_backbone_gw_orig(struct batadv_priv *bat_priv, u8 *orig,
@@ -47,7 +49,7 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv,void batadv_bla_status_update (struct net_device *net_dev);int batadv_bla_init (struct batadv_priv *bat_priv);void batadv_bla_free (struct batadv_priv *bat_priv); - +int batadv_bla_claim_dump (struct sk_buff *msg,struct netlink_callback *cb);#define BATADV_BLA_CRC_INIT 0#else /* ifdef CONFIG_BATMAN_ADV_BLA */
@@ -112,6 +114,12 @@ static inline void batadv_bla_free(struct batadv_priv *bat_priv) { } +static inline int batadv_bla_claim_dump (struct sk_buff *msg, +struct netlink_callback *cb) +{ +return -EOPNOTSUPP ; +} +#endif /* ifdef CONFIG_BATMAN_ADV_BLA */ #endif /* ifndef _NET_BATMAN_ADV_BLA_H_ */
net/batman-adv/netlink.c +12 -0
@@ -38,6 +38,7 @@#include <uapi/linux/batman_adv.h> #include "bat_algo.h" +#include "bridge_loop_avoidance.h" #include "gateway_client.h" #include "hard-interface.h" #include "originator.h"
@@ -91,6 +92,11 @@ static struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = { [BATADV_ATTR_BANDWIDTH_UP] = { .type = NLA_U32 }, [BATADV_ATTR_BANDWIDTH_DOWN] = { .type = NLA_U32 }, [BATADV_ATTR_ROUTER] = { .len = ETH_ALEN }, + [BATADV_ATTR_BLA_OWN] = { .type = NLA_FLAG }, + [BATADV_ATTR_BLA_ADDRESS] = { .len = ETH_ALEN }, + [BATADV_ATTR_BLA_VID] = { .type = NLA_U16 }, + [BATADV_ATTR_BLA_BACKBONE] = { .len = ETH_ALEN }, + [BATADV_ATTR_BLA_CRC] = { .type = NLA_U16 }, };/**
@@ -580,6 +586,12 @@ static struct genl_ops batadv_netlink_ops[] = { .policy = batadv_netlink_policy, .dumpit = batadv_gw_dump, }, + { + .cmd = BATADV_CMD_GET_BLA_CLAIM, + .flags = GENL_ADMIN_PERM, + .policy = batadv_netlink_policy, + .dumpit = batadv_bla_claim_dump, + }, };/**
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 13/16] batman-adv: add B.A.T.M.A.N. Dump BLA claims via netlink
Quoted 10 lines · On Sunday, July 03, 2016 13:31:45 Sven Eckelmann wrote:
From: Andrew Lunn <[email protected]>
Dump the list of bridge loop avoidance claims via the netlink socket.
Signed-off-by Andrew Lunn <[email protected]>[[email protected]: add policy for attributes, fix includes, fix
soft_ifacereference leak]Signed-off-by Sven Eckelmann <[email protected]>[[email protected]: fix kerneldoc, fix error reporting]Signed-off-by Simon Wunderlich <[email protected]>
Quoted 7 lines
--- include/uapi/linux/batman_adv.h | 12 +++ net/batman-adv/bridge_loop_avoidance.c | 169 +++++++++++++++++++++++++++++++++ net/batman-adv/bridge_loop_avoidance.h | 10 +- net/batman-adv/netlink.c | 12 +++ 4 files changed, 202 insertions(+), 1 deletion(-)
Applied in revision 3b7a636.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 14/16 batman-adv: Provide bla group in the mesh_info netlink msg
In reply to Sven EckelmannThe bridge loop avoidange is the main information for the debugging of of bridge loop detection problems. It is therefore necessary when comparing the bla claim tables.
--- net/batman-adv/netlink.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/batman-adv/netlink.c +8 -0
@@ -19,6 +19,7 @@#include "main.h" #include <linux/atomic.h> +#include <linux/byteorder/generic.h> #include <linux/errno.h> #include <linux/fs.h> #include <linux/genetlink.h>
@@ -42,6 +43,7 @@#include "gateway_client.h" #include "hard-interface.h" #include "originator.h" +#include "packet.h" #include "soft-interface.h" #include "tp_meter.h" #include "translation-table.h"
@@ -141,6 +143,12 @@ batadv_netlink_mesh_info_put(struct sk_buff *msg, struct net_device *soft_iface) (u8)atomic_read(&bat_priv->tt.vn))) goto out; +#ifdef CONFIG_BATMAN_ADV_BLA +if (nla_put_u16 (msg,BATADV_ATTR_BLA_CRC , +ntohs (bat_priv->bla.claim_dest.group))) + goto out; +#endif + primary_if =batadv_primary_if_get_selected (bat_priv);if (primary_if && primary_if->if_status ==BATADV_IF_ACTIVE ) { hard_iface = primary_if->net_dev;
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 14/16] batman-adv: Provide bla group in the mesh_info netlink msg
Quoted 9 lines · On Sunday, July 03, 2016 13:31:46 Sven Eckelmann wrote:
The bridge loop avoidange is the main information for the debugging of of bridge loop detection problems. It is therefore necessary when comparing the bla claim tables.
Signed-off-by Sven Eckelmann <[email protected]>Signed-off-by Simon Wunderlich <[email protected]>--- net/batman-adv/netlink.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Applied in revision 28489de.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 15/16 batman-adv: add backbone table netlink support
In reply to Sven EckelmannFrom: Simon Wunderlich <[email protected]>
Dump the list of bridge loop avoidance backbones via the netlink socket.
--- include/uapi/linux/batman_adv.h | 2 + net/batman-adv/bridge_loop_avoidance.c | 164 +++++++++++++++++++++++++++++++++ net/batman-adv/bridge_loop_avoidance.h | 7 ++ net/batman-adv/netlink.c | 7 ++ 4 files changed, 180 insertions(+)
include/uapi/linux/batman_adv.h +2 -0
@@ -157,6 +157,7 @@ enum batadv_nl_attrs {* @BATADV_CMD_GET_NEIGHBORS: Query list of neighbours * @BATADV_CMD_GET_GATEWAYS: Query list of gateways * @BATADV_CMD_GET_BLA_CLAIM: Query list of bridge loop avoidance claims +* @BATADV_CMD_GET_BLA_BACKBONE: Query list of bridge loop avoidance backbones * @__BATADV_CMD_AFTER_LAST: internal use * @BATADV_CMD_MAX: highest used command number */
@@ -173,6 +174,7 @@ enum batadv_nl_commands {BATADV_CMD_GET_NEIGHBORS ,BATADV_CMD_GET_GATEWAYS ,BATADV_CMD_GET_BLA_CLAIM , +BATADV_CMD_GET_BLA_BACKBONE ,/* add new commands above here */ __BATADV_CMD_AFTER_LAST,BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST -1
net/batman-adv/bridge_loop_avoidance.c +164 -0
167 lines not on this page · raw message
net/batman-adv/bridge_loop_avoidance.h +7 -0
@@ -39,6 +39,7 @@ int batadv_bla_claim_table_seq_print_text(struct seq_file *seq, void *offset);int batadv_bla_claim_dump (struct sk_buff *msg,struct netlink_callback *cb);int batadv_bla_backbone_table_seq_print_text (struct seq_file *seq,void *offset); +int batadv_bla_backbone_dump (struct sk_buff *msg,struct netlink_callback *cb);bool batadv_bla_is_backbone_gw_orig (struct batadv_priv *bat_priv,u8 *orig,unsigned short vid); bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
@@ -120,6 +121,12 @@ static inline int batadv_bla_claim_dump(struct sk_buff *msg,return -EOPNOTSUPP ; } +static inline int batadv_bla_backbone_dump (struct sk_buff *msg, +struct netlink_callback *cb) +{ +return -EOPNOTSUPP ; +} +#endif /* ifdef CONFIG_BATMAN_ADV_BLA */ #endif /* ifndef _NET_BATMAN_ADV_BLA_H_ */
net/batman-adv/netlink.c +7 -0
@@ -600,6 +600,13 @@ static struct genl_ops batadv_netlink_ops[] = { .policy = batadv_netlink_policy, .dumpit = batadv_bla_claim_dump, }, + { + .cmd = BATADV_CMD_GET_BLA_BACKBONE, + .flags = GENL_ADMIN_PERM, + .policy = batadv_netlink_policy, + .dumpit = batadv_bla_backbone_dump, + }, + };/**
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 15/16] batman-adv: add backbone table netlink support
Quoted 6 lines · On Sunday, July 03, 2016 13:31:47 Sven Eckelmann wrote:
From: Simon Wunderlich <[email protected]>
Dump the list of bridge loop avoidance backbones via the netlink socket.
Signed-off-by Simon Wunderlich <[email protected]>Signed-off-by Sven Eckelmann <[email protected]>
Quoted 7 lines
--- include/uapi/linux/batman_adv.h | 2 + net/batman-adv/bridge_loop_avoidance.c | 164 +++++++++++++++++++++++++++++++++ net/batman-adv/bridge_loop_avoidance.h | 7 ++ net/batman-adv/netlink.c | 7 ++ 4 files changed, 180 insertions(+)
Applied in revision 7f609ca.
Thanks,
Marek
Sven Eckelmann
maintainerPATCH v10 16/16 batman-adv: Indicate netlink socket can be used with netns.
In reply to Sven EckelmannFrom: Andrew Lunn <[email protected]>
Set the netnsof flag on the family structure, indicating it can be used with different network name spaces.
--- net/batman-adv/netlink.c | 1 + 1 file changed, 1 insertion(+)
net/batman-adv/netlink.c +1 -0
@@ -54,6 +54,7 @@ struct genl_family batadv_netlink_family = { .name = BATADV_NL_NAME, .version = 1, .maxattr = BATADV_ATTR_MAX, + .netnsok = true, };/* multicast groups */
Signature · 1 line
2.8.1
Marek Lindner
AppliedRe: [B.A.T.M.A.N.] [PATCH v10 16/16] batman-adv: Indicate netlink socket can be used with netns.
Quoted 11 lines · On Sunday, July 03, 2016 13:31:48 Sven Eckelmann wrote:
From: Andrew Lunn <[email protected]>
Set the netnsof flag on the family structure, indicating it can be used with different network name spaces.
Signed-off-by Andrew Lunn <[email protected]>Signed-off-by Simon Wunderlich <[email protected]>Signed-off-by Sven Eckelmann <[email protected]>--- net/batman-adv/netlink.c | 1 + 1 file changed, 1 insertion(+)
Applied in revision 5f4c6eb.
Thanks,
Marek