All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven.eckelmann@open-mesh.com>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH v5 3/4] batctl: Add attributes/command for BATADV_CMD_GET_MESH_INFO
Date: Thu,  5 May 2016 13:09:46 +0200	[thread overview]
Message-ID: <1462446587-5304-9-git-send-email-sven.eckelmann@open-mesh.com> (raw)
In-Reply-To: <1462446587-5304-1-git-send-email-sven.eckelmann@open-mesh.com>

BATADV_CMD_GET_MESH_INFO will be used as common function to retrieve
information from the kernel. This information can be used to display a
header for debugfs tables.

Signed-off-by: Sven Eckelmann <sven.eckelmann@open-mesh.com>
---
 batman_adv.h | 18 ++++++++++++++++++
 netlink.c    | 14 ++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/batman_adv.h b/batman_adv.h
index ba611a7..a908140 100644
--- a/batman_adv.h
+++ b/batman_adv.h
@@ -24,12 +24,28 @@
  * 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_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,
+	BATADV_ATTR_MESH_IFINDEX,
+	BATADV_ATTR_MESH_IFNAME,
+	BATADV_ATTR_MESH_ADDRESS,
+	BATADV_ATTR_HARD_IFINDEX,
+	BATADV_ATTR_HARD_IFNAME,
+	BATADV_ATTR_HARD_ADDRESS,
 	/* add attributes above here, update the policy in netlink.c */
 	__BATADV_ATTR_AFTER_LAST,
 	NUM_BATADV_ATTR = __BATADV_ATTR_AFTER_LAST,
@@ -40,11 +56,13 @@ enum batadv_nl_attrs {
  * 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_AFTER_LAST: internal use
  * @BATADV_CMD_MAX: highest used command number
  */
 enum batadv_nl_commands {
 	BATADV_CMD_UNSPEC,
+	BATADV_CMD_GET_MESH_INFO,
 	/* add new commands above here */
 	__BATADV_CMD_AFTER_LAST,
 	BATADV_CMD_MAX = __BATADV_CMD_AFTER_LAST - 1
diff --git a/netlink.c b/netlink.c
index 409953a..2404a25 100644
--- a/netlink.c
+++ b/netlink.c
@@ -22,7 +22,21 @@
 #include "netlink.h"
 #include "main.h"
 
+#include <net/ethernet.h>
+
 #include "batman_adv.h"
 
 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]	= { .type = NLA_UNSPEC,
+					    .minlen = ETH_ALEN,
+					    .maxlen = ETH_ALEN },
+	[BATADV_ATTR_HARD_IFINDEX]	= { .type = NLA_U32 },
+	[BATADV_ATTR_HARD_IFNAME]	= { .type = NLA_STRING },
+	[BATADV_ATTR_HARD_ADDRESS]	= { .type = NLA_UNSPEC,
+					    .minlen = ETH_ALEN,
+					    .maxlen = ETH_ALEN },
 };
-- 
2.8.1


  parent reply	other threads:[~2016-05-05 11:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-05 11:09 [B.A.T.M.A.N.] [PATCH/RFC v5 0/9] throughput meter Sven Eckelmann
2016-05-05 11:09 ` [B.A.T.M.A.N.] [PATCH v5 1/5] batman-adv: Add stripped down version of MAINTAINERS file Sven Eckelmann
2016-05-07 22:35   ` Marek Lindner
2016-05-05 11:09 ` [B.A.T.M.A.N.] [PATCH v5 2/5] batman-adv: add generic netlink family for batman-adv Sven Eckelmann
2016-05-05 11:09 ` [B.A.T.M.A.N.] [PATCH v5 3/5] batman-adv: add netlink command to query generic mesh information files Sven Eckelmann
2016-05-05 11:09 ` [B.A.T.M.A.N.] [PATCH v5 4/5] batman-adv: return netdev status in the TX path Sven Eckelmann
2016-05-05 11:09 ` [B.A.T.M.A.N.] [RFC v5 5/5] batman-adv: throughput meter implementation Sven Eckelmann
2016-05-05 11:09 ` [B.A.T.M.A.N.] [PATCH v5 1/4] batctl: Split list of objects in Makefile into separate lines Sven Eckelmann
2016-05-05 11:09 ` [B.A.T.M.A.N.] [PATCH v5 2/4] batctl: Add basic infrastructure to integrate netlink Sven Eckelmann
2016-05-05 11:09 ` Sven Eckelmann [this message]
2016-05-05 11:09 ` [B.A.T.M.A.N.] [RFC v5 4/4] batctl: introduce throughput meter support Sven Eckelmann
2016-05-09 12:44 ` [B.A.T.M.A.N.] [RFC v6 5/5] batman-adv: throughput meter implementation Sven Eckelmann
2016-05-09 12:45 ` [B.A.T.M.A.N.] [RFC v6 4/4] batctl: introduce throughput meter support Sven Eckelmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1462446587-5304-9-git-send-email-sven.eckelmann@open-mesh.com \
    --to=sven.eckelmann@open-mesh.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.