From patchwork Mon May 9 18:29:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16137 Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 91C02827CD; Mon, 9 May 2016 20:29:24 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=narfation.org Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=narfation.org header.i=@narfation.org header.b=xZrGayHU; dkim-adsp=fail (unprotected policy); dkim-atps=neutral Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2001:4d88:2000:7::2; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=pass header.from=narfation.org Received: from v3-1039.vlinux.de (narfation.org [IPv6:2001:4d88:2000:7::2]) by open-mesh.org (Postfix) with ESMTPS id 28A99827CC for ; Mon, 9 May 2016 20:29:23 +0200 (CEST) Received: from bentobox.localnet (p4FFE56B5.dip0.t-ipconnect.de [79.254.86.181]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 83E801100E7; Mon, 9 May 2016 20:29:22 +0200 (CEST) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1462818562; bh=SJj1xFKpoCRHcv7rgSucOigD2asKst1p4R/HrvmwIqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xZrGayHUfQtvXZ9E1sQs0kEJ9t9Ey8dezlkH5ZII9xTCohcvwvjPytQgOZhoaEePI Qnx4r0ptsqOtEVMlTyuYlD15++Xy50S/kddHgNYz7fVcIfFWHOuZAqVGQdYqqfKtbQ eHjtD4z311uTY4hQ2tARyD3GMAd050vghbwhPtqo= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Mon, 09 May 2016 20:29:21 +0200 Message-ID: <1680132.z76VCK1c2R@bentobox> User-Agent: KMail/4.14.10 (Linux/4.5.0-2-amd64; KDE/4.14.14; x86_64; ; ) In-Reply-To: <1462817239-18104-1-git-send-email-andrew@lunn.ch> References: <1462817239-18104-1-git-send-email-andrew@lunn.ch> MIME-Version: 1.0 Subject: Re: [B.A.T.M.A.N.] [PATCHv4 00/12] netns and netlink support X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" On Monday 09 May 2016 20:07:07 Andrew Lunn wrote: > 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 awaire. Attached is a tarball with the v4 version rebased on the two initial patches from the tp_meter patchset. The patches include many TODOs in the kernel-doc which should be replaced with actual docs. The batctl patch was not yet rebased. I've removed following change in your v4 patchset: I've also added the diff between your patchset and the one attached tarball. I hope you can see that nothing evil was done :) Kind regards, Sven diff --git a/MAINTAINERS b/MAINTAINERS index 7e47274..ff0322d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9,4 +9,5 @@ S: Maintained F: Documentation/ABI/testing/sysfs-class-net-batman-adv F: Documentation/ABI/testing/sysfs-class-net-mesh F: Documentation/networking/batman-adv.txt +F: include/uapi/linux/batman_adv.h F: net/batman-adv/ diff --git a/include/uapi/linux/batman_adv.h b/include/uapi/linux/batman_adv.h index 6a97a2c..4c8e526 100644 --- a/include/uapi/linux/batman_adv.h +++ b/include/uapi/linux/batman_adv.h @@ -56,7 +56,44 @@ enum batadv_tt_client_flags { BATADV_TT_CLIENT_TEMP = (1 << 11), }; -enum { +/** + * enum batadv_nl_attrs - batman-adv netlink attributes + * + * @BATADV_ATTR_UNSPEC: unspecified attribute to catch errors + * @BATADV_ATTR_VERSION: batman-adv version string + * @BATADV_ATTR_ALGO_NAME: name of routing algorithm + * @BATADV_ATTR_MESH_IFINDEX: index of the batman-adv interface + * @BATADV_ATTR_MESH_IFNAME: name of the batman-adv interface + * @BATADV_ATTR_MESH_ADDRESS: mac address of the batman-adv interface + * @BATADV_ATTR_HARD_IFINDEX: index of the non-batman-adv interface + * @BATADV_ATTR_HARD_IFNAME: name of the non-batman-adv interface + * @BATADV_ATTR_HARD_ADDRESS: mac address of the non-batman-adv interface + * @BATADV_ATTR_ACTIVE: TODO + * @BATADV_ATTR_ORIG_ADDRESS: TODO + * @BATADV_ATTR_TT_ADDRESS: TODO + * @BATADV_ATTR_TT_TTVN: TODO + * @BATADV_ATTR_TT_LAST_TTVN: TODO + * @BATADV_ATTR_TT_CRC32: TODO + * @BATADV_ATTR_TT_VID: TODO + * @BATADV_ATTR_TT_FLAGS: TODO + * @BATADV_ATTR_FLAG_BEST: TODO + * @BATADV_ATTR_LAST_SEEN_MSECS: TODO + * @BATADV_ATTR_NEIGH_ADDRESS: TODO + * @BATADV_ATTR_TQ: TODO + * @BATADV_ATTR_THROUGHPUT: TODO + * @BATADV_ATTR_BANDWIDTH_UP: TODO + * @BATADV_ATTR_BANDWIDTH_DOWN: TODO + * @BATADV_ATTR_ROUTER: TODO + * @BATADV_ATTR_BLA_OWN: TODO + * @BATADV_ATTR_BLA_ADDRESS: TODO + * @BATADV_ATTR_BLA_VID: TODO + * @BATADV_ATTR_BLA_BACKBONE: TODO + * @BATADV_ATTR_BLA_CRC: TODO + * @__BATADV_ATTR_AFTER_LAST: internal use + * @NUM_BATADV_ATTR: total number of batadv_nl_attrs available + * @BATADV_ATTR_MAX: highest attribute number currently defined + */ +enum batadv_nl_attrs { BATADV_ATTR_UNSPEC, BATADV_ATTR_VERSION, BATADV_ATTR_ALGO_NAME, @@ -87,15 +124,32 @@ enum { BATADV_ATTR_BLA_VID, BATADV_ATTR_BLA_BACKBONE, BATADV_ATTR_BLA_CRC, - __BATADV_ATTR_MAX, + /* add attributes above here, update the policy in netlink.c */ + __BATADV_ATTR_AFTER_LAST, + NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST, + BATADV_ATTR_MAX = __BATADV_ATTR_AFTER_LAST - 1 }; -#define BATADV_ATTR_MAX (__BATADV_ATTR_MAX - 1) - -enum { +/** + * enum batadv_nl_commands - supported batman-adv netlink commands + * + * @BATADV_CMD_UNSPEC: unspecified command to catch errors + * @BATADV_CMD_GET_MESH_INFO: Query basic information about batman-adv device + * @BATADV_CMD_GET_ROUTING_ALGOS: TODO + * @BATADV_CMD_GET_HARDIFS: TODO + * @BATADV_CMD_GET_TRANSTABLE_LOCAL: TODO + * @BATADV_CMD_GET_TRANSTABLE_GLOBAL: TODO + * @BATADV_CMD_GET_ORIGINATORS: TODO + * @BATADV_CMD_GET_NEIGHBORS: TODO + * @BATADV_CMD_GET_GATEWAYS: TODO + * @BATADV_CMD_GET_BLA_CLAIM: TODO + * @__BATADV_CMD_AFTER_LAST: internal use + * @BATADV_CMD_MAX: highest used command number + */ +enum batadv_nl_commands { BATADV_CMD_UNSPEC, - BATADV_CMD_GET_ROUTING_ALGOS, BATADV_CMD_GET_MESH_INFO, + BATADV_CMD_GET_ROUTING_ALGOS, BATADV_CMD_GET_HARDIFS, BATADV_CMD_GET_TRANSTABLE_LOCAL, BATADV_CMD_GET_TRANSTABLE_GLOBAL, @@ -103,9 +157,9 @@ enum { BATADV_CMD_GET_NEIGHBORS, BATADV_CMD_GET_GATEWAYS, BATADV_CMD_GET_BLA_CLAIM, - __BATADV_CMD_MAX, + /* add new commands above here */ + __BATADV_CMD_AFTER_LAST, + BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1 }; -#define BATADV_CMD_MAX (__BATADV_CMD_MAX - 1) - #endif /* _UAPI_LINUX_BATMAN_ADV_H_ */ diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 9abfdbb..0558ed2 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c @@ -1980,6 +1980,14 @@ next: seq_puts(seq, "No batman nodes in range ...\n"); } +/** + * batadv_iv_ogm_neigh_get_tq_avg - TODO + * @neigh_node: TODO + * @if_outgoing: TODO + * @tq_avg: TODO + * + * Return: TODO + */ static bool batadv_iv_ogm_neigh_get_tq_avg(struct batadv_neigh_node *neigh_node, struct batadv_hard_iface *if_outgoing, @@ -1997,6 +2005,19 @@ batadv_iv_ogm_neigh_get_tq_avg(struct batadv_neigh_node *neigh_node, return true; } +/** + * batadv_iv_ogm_orig_dump_subentry - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @if_outgoing: TODO + * @orig_node: TODO + * @neigh_node: TODO + * @best: TODO + * + * Return: TODO + */ static int batadv_iv_ogm_orig_dump_subentry(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -2045,6 +2066,18 @@ batadv_iv_ogm_orig_dump_subentry(struct sk_buff *msg, u32 portid, u32 seq, return -EMSGSIZE; } +/** + * batadv_iv_ogm_orig_dump_entry - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @if_outgoing: TODO + * @orig_node: TODO + * @sub_s: TODO + * + * Return: TODO + */ static int batadv_iv_ogm_orig_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -2093,6 +2126,19 @@ batadv_iv_ogm_orig_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, return 0; } +/** + * batadv_iv_ogm_orig_dump_bucket - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @if_outgoing: TODO + * @head: TODO + * @idx_s: TODO + * @sub: TODO + * + * Return: TODO + */ static int batadv_iv_ogm_orig_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -2122,6 +2168,13 @@ batadv_iv_ogm_orig_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq, return 0; } +/** + * batadv_iv_ogm_orig_dump - TODO + * @msg: TODO + * @cb: TODO + * @bat_priv: TODO + * @if_outgoing: TODO + */ static void batadv_iv_ogm_orig_dump(struct sk_buff *msg, struct netlink_callback *cb, struct batadv_priv *bat_priv, @@ -2202,6 +2255,15 @@ static void batadv_iv_neigh_print(struct batadv_priv *bat_priv, seq_puts(seq, "No batman nodes in range ...\n"); } +/** + * batadv_iv_ogm_neigh_dump_neigh - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @hardif_neigh: TODO + * + * Return: TODO + */ static int batadv_iv_ogm_neigh_dump_neigh(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_hardif_neigh_node *hardif_neigh) @@ -2232,6 +2294,17 @@ batadv_iv_ogm_neigh_dump_neigh(struct sk_buff *msg, u32 portid, u32 seq, return -EMSGSIZE; } +/** + * batadv_iv_ogm_neigh_dump_hardif - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @hard_iface: TODO + * @idx_s: TODO + * + * Return: TODO + */ static int batadv_iv_ogm_neigh_dump_hardif(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -2257,6 +2330,13 @@ batadv_iv_ogm_neigh_dump_hardif(struct sk_buff *msg, u32 portid, u32 seq, return 0; } +/** + * batadv_iv_ogm_neigh_dump - TODO + * @msg: TODO + * @cb: TODO + * @bat_priv: TODO + * @single_hardif: TODO + */ static void batadv_iv_ogm_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb, struct batadv_priv *bat_priv, diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c index 5daa300..e244b5f 100644 --- a/net/batman-adv/bat_v.c +++ b/net/batman-adv/bat_v.c @@ -212,6 +212,15 @@ static void batadv_v_neigh_print(struct batadv_priv *bat_priv, seq_puts(seq, "No batman nodes in range ...\n"); } +/** + * batadv_v_neigh_dump_neigh - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @hardif_neigh: TODO + * + * Return: TODO + */ static int batadv_v_neigh_dump_neigh(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_hardif_neigh_node *hardif_neigh) @@ -246,6 +255,17 @@ batadv_v_neigh_dump_neigh(struct sk_buff *msg, u32 portid, u32 seq, return -EMSGSIZE; } +/** + * batadv_v_neigh_dump_hardif - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @hard_iface: TODO + * @idx_s: TODO + * + * Return: TODO + */ static int batadv_v_neigh_dump_hardif(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -270,6 +290,13 @@ batadv_v_neigh_dump_hardif(struct sk_buff *msg, u32 portid, u32 seq, return 0; } +/** + * batadv_v_neigh_dump - TODO + * @msg: TODO + * @cb: TODO + * @bat_priv: TODO + * @single_hardif: TODO + */ static void batadv_v_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb, struct batadv_priv *bat_priv, @@ -380,6 +407,19 @@ next: seq_puts(seq, "No batman nodes in range ...\n"); } +/** + * batadv_v_orig_dump_subentry - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @if_outgoing: TODO + * @orig_node: TODO + * @neigh_node: TODO + * @best: TODO + * + * Return: TODO + */ static int batadv_v_orig_dump_subentry(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -434,6 +474,18 @@ batadv_v_orig_dump_subentry(struct sk_buff *msg, u32 portid, u32 seq, return -EMSGSIZE; } +/** + * batadv_v_orig_dump_entry - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @if_outgoing: TODO + * @orig_node: TODO + * @sub_s: TODO + * + * Return: TODO + */ static int batadv_v_orig_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -473,6 +525,19 @@ batadv_v_orig_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, return 0; } +/** + * batadv_v_orig_dump_bucket - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @if_outgoing: TODO + * @head: TODO + * @idx_s: TODO + * @sub: TODO + * + * Return: TODO + */ static int batadv_v_orig_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -501,6 +566,13 @@ batadv_v_orig_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq, return 0; } +/** + * batadv_v_orig_dump - TODO + * @msg: TODO + * @cb: TODO + * @bat_priv: TODO + * @if_outgoing: TODO + */ static void batadv_v_orig_dump(struct sk_buff *msg, struct netlink_callback *cb, struct batadv_priv *bat_priv, diff --git a/net/batman-adv/gateway_client.c b/net/batman-adv/gateway_client.c index 7f38aea..dedf89e 100644 --- a/net/batman-adv/gateway_client.c +++ b/net/batman-adv/gateway_client.c @@ -670,6 +670,16 @@ out: return 0; } +/** + * batadv_gw_dump_entry - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @gw_node: TODO + * + * Return: TODO + */ static int batadv_gw_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -732,6 +742,13 @@ out: return ret; } +/** + * batadv_gw_dump - TODO + * @msg: TODO + * @cb: TODO + * + * Return: TODO + */ int batadv_gw_dump(struct sk_buff *msg, struct netlink_callback *cb) { struct batadv_hard_iface *primary_if = NULL; diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 3127d28..7683da4 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c @@ -615,6 +615,15 @@ int batadv_algo_seq_print_text(struct seq_file *seq, void *offset) return 0; } +/** + * batadv_algo_dump_entry - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_algo_ops: TODO + * + * Return: TODO + */ static int batadv_algo_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_algo_ops *bat_algo_ops) { @@ -636,6 +645,13 @@ static int batadv_algo_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, return -EMSGSIZE; } +/** + * batadv_algo_dump - TODO + * @msg: TODO + * @cb: TODO + * + * Return: TODO + */ int batadv_algo_dump(struct sk_buff *msg, struct netlink_callback *cb) { int portid = NETLINK_CB(cb->skb).portid; diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index 671d5b6..c68497f 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -30,6 +31,8 @@ #include #include #include +#include +#include #include #include @@ -49,13 +52,51 @@ struct genl_family batadv_netlink_family = { .netnsok = true, }; +static 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 }, + [BATADV_ATTR_MESH_ADDRESS] = { .len = ETH_ALEN }, + [BATADV_ATTR_HARD_IFINDEX] = { .type = NLA_U32 }, + [BATADV_ATTR_HARD_IFNAME] = { .type = NLA_STRING }, + [BATADV_ATTR_HARD_ADDRESS] = { .len = ETH_ALEN }, + [BATADV_ATTR_ACTIVE] = { .type = NLA_FLAG }, + [BATADV_ATTR_ORIG_ADDRESS] = { .len = ETH_ALEN }, + [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 }, + [BATADV_ATTR_NEIGH_ADDRESS] = { .len = ETH_ALEN }, + [BATADV_ATTR_TQ] = { .type = NLA_U8 }, + [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 }, +}; + +/** + * batadv_netlink_mesh_info_put - Fill generic information about mesh interface + * @msg: netlink message to be sent back + * @soft_iface: interface for which the data should be taken + * + * Return: 0 on success, < 0 on error + */ static int batadv_netlink_mesh_info_put(struct sk_buff *msg, struct net_device *soft_iface) { - int ret = -ENOBUFS; struct batadv_priv *bat_priv = netdev_priv(soft_iface); struct batadv_hard_iface *primary_if = NULL; struct net_device *hard_iface; + int ret = -ENOBUFS; if (nla_put_string(msg, BATADV_ATTR_VERSION, BATADV_SOURCE_VERSION) || nla_put_string(msg, BATADV_ATTR_ALGO_NAME, @@ -88,15 +129,22 @@ batadv_netlink_mesh_info_put(struct sk_buff *msg, struct net_device *soft_iface) return ret; } +/** + * batadv_netlink_mesh_info_put - Handle BATADV_CMD_GET_MESH_INFO + * @skb: received netlink message + * @info: receiver information + * + * Return: 0 on success, < 0 on error + */ static int batadv_netlink_get_mesh_info(struct sk_buff *skb, struct genl_info *info) { struct net *net = genl_info_net(info); - int ret; + struct net_device *soft_iface; struct sk_buff *msg = NULL; void *msg_head; int ifindex; - struct net_device *soft_iface; + int ret; if (!info->attrs[BATADV_ATTR_MESH_IFINDEX]) return -EINVAL; @@ -141,6 +189,15 @@ batadv_netlink_get_mesh_info(struct sk_buff *skb, struct genl_info *info) return genlmsg_reply(msg, info); } +/** + * batadv_netlink_dump_hardif_entry - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @hard_iface: TODO + * + * Return: TODO + */ static int batadv_netlink_dump_hardif_entry(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_hard_iface *hard_iface) @@ -174,6 +231,13 @@ batadv_netlink_dump_hardif_entry(struct sk_buff *msg, u32 portid, u32 seq, return -EMSGSIZE; } +/** + * batadv_netlink_dump_hardifs - TODO + * @msg: TODO + * @cb: TODO + * + * Return: TODO + */ static int batadv_netlink_dump_hardifs(struct sk_buff *msg, struct netlink_callback *cb) { @@ -224,23 +288,18 @@ batadv_netlink_dump_hardifs(struct sk_buff *msg, struct netlink_callback *cb) return msg->len; } -static struct nla_policy batadv_netlink_policy[BATADV_ATTR_MAX + 1] = { - [BATADV_ATTR_MESH_IFINDEX] = { .type = NLA_U32 }, - [BATADV_ATTR_HARD_IFINDEX] = { .type = NLA_U32 }, -}; - static struct genl_ops batadv_netlink_ops[] = { { - .cmd = BATADV_CMD_GET_ROUTING_ALGOS, + .cmd = BATADV_CMD_GET_MESH_INFO, .flags = GENL_ADMIN_PERM, .policy = batadv_netlink_policy, - .dumpit = batadv_algo_dump, + .doit = batadv_netlink_get_mesh_info, }, { - .cmd = BATADV_CMD_GET_MESH_INFO, + .cmd = BATADV_CMD_GET_ROUTING_ALGOS, .flags = GENL_ADMIN_PERM, .policy = batadv_netlink_policy, - .doit = batadv_netlink_get_mesh_info, + .dumpit = batadv_algo_dump, }, { .cmd = BATADV_CMD_GET_HARDIFS, @@ -286,6 +345,9 @@ static struct genl_ops batadv_netlink_ops[] = { }, }; +/** + * batadv_netlink_register - Register batadv genl netlink family + */ void __init batadv_netlink_register(void) { int ret; @@ -296,6 +358,9 @@ void __init batadv_netlink_register(void) pr_warn("unable to register netlink family"); } +/** + * batadv_netlink_unregister - Unregister batadv genl netlink family + */ void batadv_netlink_unregister(void) { genl_unregister_family(&batadv_netlink_family); diff --git a/net/batman-adv/netlink.h b/net/batman-adv/netlink.h index ae0eeb9..89b7c5b 100644 --- a/net/batman-adv/netlink.h +++ b/net/batman-adv/netlink.h @@ -28,6 +28,13 @@ struct nlmsghdr; void batadv_netlink_register(void); void batadv_netlink_unregister(void); +/** + * batadv_netlink_get_ifindex - TODO + * @nlh: TODO + * @attrtype: TODO + * + * Return: TODO + */ static inline int batadv_netlink_get_ifindex(const struct nlmsghdr *nlh, int attrtype) { diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 0455e54..71b63e7 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c @@ -1416,8 +1416,7 @@ int batadv_orig_dump(struct sk_buff *msg, struct netlink_callback *cb) int ret; int ifindex, hard_ifindex; - ifindex = batadv_netlink_get_ifindex(cb->nlh, - BATADV_ATTR_MESH_IFINDEX); + ifindex = batadv_netlink_get_ifindex(cb->nlh, BATADV_ATTR_MESH_IFINDEX); if (!ifindex) return -EINVAL; diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index be42b12..6a1eba3 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c @@ -1063,6 +1063,16 @@ out: return 0; } +/** + * batadv_tt_local_dump_entry - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @common: TODO + * + * Return: TODO + */ static int batadv_tt_local_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -1111,6 +1121,17 @@ batadv_tt_local_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, return -EMSGSIZE; } +/** + * batadv_tt_local_dump_bucket - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @head: TODO + * @idx_s: TODO + * + * Return: TODO + */ static int batadv_tt_local_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -1137,6 +1158,13 @@ batadv_tt_local_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq, return 0; } +/** + * batadv_tt_local_dump - TODO + * @msg: TODO + * @cb: TODO + * + * Return: TODO + */ int batadv_tt_local_dump(struct sk_buff *msg, struct netlink_callback *cb) { struct net *net = sock_net(cb->skb->sk); @@ -1841,6 +1869,17 @@ out: return 0; } +/** + * batadv_tt_global_dump_subentry - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @common: TODO + * @orig: TODO + * @best: TODO + * + * Return: TODO + */ static int batadv_tt_global_dump_subentry(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_tt_common_entry *common, @@ -1890,6 +1929,17 @@ batadv_tt_global_dump_subentry(struct sk_buff *msg, u32 portid, u32 seq, return -EMSGSIZE; } +/** + * batadv_tt_global_dump_entry - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @common: TODO + * @sub_s: TODO + * + * Return: TODO + */ static int batadv_tt_global_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -1922,6 +1972,18 @@ batadv_tt_global_dump_entry(struct sk_buff *msg, u32 portid, u32 seq, return 0; } +/** + * batadv_tt_global_dump_bucket - TODO + * @msg: TODO + * @portid: TODO + * @seq: TODO + * @bat_priv: TODO + * @head: TODO + * @idx_s: TODO + * @sub: TODO + * + * Return: TODO + */ static int batadv_tt_global_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq, struct batadv_priv *bat_priv, @@ -1949,6 +2011,13 @@ batadv_tt_global_dump_bucket(struct sk_buff *msg, u32 portid, u32 seq, return 0; } +/** + * batadv_tt_global_dump - TODO + * @msg: TODO + * @cb: TODO + * + * Return: TODO + */ int batadv_tt_global_dump(struct sk_buff *msg, struct netlink_callback *cb) { struct net *net = sock_net(cb->skb->sk);