All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH 37/38] batctl: Use external netlink socket for debug tables
Date: Mon, 22 Oct 2018 00:55:23 +0200	[thread overview]
Message-ID: <20181021225524.8155-38-sven@narfation.org> (raw)
In-Reply-To: <20181021225524.8155-1-sven@narfation.org>

The netlink socket is used by the debug table functionality to retrieve the
tables. The initialization can be centralized and moved to the main
function (controlled by a flag) to share it between the other commands.

Since more commands will use netlink in the future, this flag can reduce
the implementation effort significantly.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 backbonetable.c |   7 ++--
 claimtable.c    |   7 ++--
 dat_cache.c     |   9 +++--
 debug.c         |   5 +--
 debug.h         |   2 +-
 gateways.c      |  11 +++---
 main.c          |  18 ++++++++-
 main.h          |   9 +++++
 mcast_flags.c   |  11 +++---
 neighbors.c     |   7 ++--
 netlink.c       | 100 ++++++++++++++++++++++++++++++++----------------
 netlink.h       |   7 +++-
 originators.c   |  11 +++---
 transglobal.c   |   7 ++--
 translocal.c    |   7 ++--
 15 files changed, 145 insertions(+), 73 deletions(-)

diff --git a/backbonetable.c b/backbonetable.c
index 2512142..d799d8c 100644
--- a/backbonetable.c
+++ b/backbonetable.c
@@ -103,11 +103,11 @@ static int bla_backbone_callback(struct nl_msg *msg, void *arg)
 	return NL_OK;
 }
 
-static int netlink_print_bla_backbone(char *mesh_iface, char *orig_iface,
+static int netlink_print_bla_backbone(struct state *state, char *orig_iface,
 				      int read_opts, float orig_timeout,
 				      float watch_interval)
 {
-	return netlink_print_common(mesh_iface, orig_iface, read_opts,
+	return netlink_print_common(state, orig_iface, read_opts,
 				    orig_timeout, watch_interval,
 				    "Originator           VID   last seen (CRC   )\n",
 				    BATADV_CMD_GET_BLA_BACKBONE,
@@ -121,4 +121,5 @@ static struct debug_table_data batctl_debug_table_backbonetable = {
 };
 
 COMMAND_NAMED(DEBUGTABLE, backbonetable, "bbt", handle_debug_table,
-	      COMMAND_FLAG_MESH_IFACE, &batctl_debug_table_backbonetable, "");
+	      COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
+	      &batctl_debug_table_backbonetable, "");
diff --git a/claimtable.c b/claimtable.c
index ca79fc3..989879f 100644
--- a/claimtable.c
+++ b/claimtable.c
@@ -108,11 +108,11 @@ static int bla_claim_callback(struct nl_msg *msg, void *arg)
 	return NL_OK;
 }
 
-static int netlink_print_bla_claim(char *mesh_iface, char *orig_iface,
+static int netlink_print_bla_claim(struct state *state, char *orig_iface,
 				   int read_opts, float orig_timeout,
 				   float watch_interval)
 {
-	return netlink_print_common(mesh_iface, orig_iface, read_opts,
+	return netlink_print_common(state, orig_iface, read_opts,
 				    orig_timeout, watch_interval,
 				    "Client               VID      Originator        [o] (CRC   )\n",
 				    BATADV_CMD_GET_BLA_CLAIM,
@@ -126,4 +126,5 @@ static struct debug_table_data batctl_debug_table_claimtable = {
 };
 
 COMMAND_NAMED(DEBUGTABLE, claimtable, "cl", handle_debug_table,
-	      COMMAND_FLAG_MESH_IFACE, &batctl_debug_table_claimtable, "");
+	      COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
+	      &batctl_debug_table_claimtable, "");
diff --git a/dat_cache.c b/dat_cache.c
index 39f8f18..1e1f028 100644
--- a/dat_cache.c
+++ b/dat_cache.c
@@ -112,7 +112,7 @@ static int dat_cache_callback(struct nl_msg *msg, void *arg)
 	return NL_OK;
 }
 
-static int netlink_print_dat_cache(char *mesh_iface, char *orig_iface,
+static int netlink_print_dat_cache(struct state *state, char *orig_iface,
 				   int read_opts, float orig_timeout,
 				   float watch_interval)
 {
@@ -120,13 +120,13 @@ static int netlink_print_dat_cache(char *mesh_iface, char *orig_iface,
 	int ret;
 
 	ret = asprintf(&header, "Distributed ARP Table (%s):\n%s\n",
-		       mesh_iface,
+		       state->mesh_iface,
 		       "          IPv4             MAC        VID   last-seen");
 
 	if (ret < 0)
 		return ret;
 
-	ret = netlink_print_common(mesh_iface, orig_iface, read_opts,
+	ret = netlink_print_common(state, orig_iface, read_opts,
 				   orig_timeout, watch_interval, header,
 				   BATADV_CMD_GET_DAT_CACHE,
 				   dat_cache_callback);
@@ -142,4 +142,5 @@ static struct debug_table_data batctl_debug_table_dat_cache = {
 };
 
 COMMAND_NAMED(DEBUGTABLE, dat_cache, "dc", handle_debug_table,
-	      COMMAND_FLAG_MESH_IFACE, &batctl_debug_table_dat_cache, "");
+	      COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
+	      &batctl_debug_table_dat_cache, "");
diff --git a/debug.c b/debug.c
index 17dde92..b908e00 100644
--- a/debug.c
+++ b/debug.c
@@ -168,9 +168,8 @@ int handle_debug_table(struct state *state, int argc, char **argv)
 	}
 
 	if (debug_table->netlink_fn) {
-		err = debug_table->netlink_fn(
-			state->mesh_iface, orig_iface, read_opt, orig_timeout,
-			watch_interval);
+		err = debug_table->netlink_fn(state , orig_iface, read_opt,
+					      orig_timeout, watch_interval);
 		if (err != -EOPNOTSUPP)
 			return err;
 	}
diff --git a/debug.h b/debug.h
index 79c489a..525a46b 100644
--- a/debug.h
+++ b/debug.h
@@ -39,7 +39,7 @@
 struct debug_table_data {
 	const char *debugfs_name;
 	size_t header_lines;
-	int (*netlink_fn)(char *mesh_iface, char *hard_iface, int read_opt,
+	int (*netlink_fn)(struct state *state, char *hard_iface, int read_opt,
 			 float orig_timeout, float watch_interval);
 	unsigned int option_unicast_only:1;
 	unsigned int option_multicast_only:1;
diff --git a/gateways.c b/gateways.c
index d027a32..b0a36c7 100644
--- a/gateways.c
+++ b/gateways.c
@@ -126,7 +126,7 @@ static int gateways_callback(struct nl_msg *msg, void *arg)
 	return NL_OK;
 }
 
-static int netlink_print_gateways(char *mesh_iface, char *orig_iface,
+static int netlink_print_gateways(struct state *state, char *orig_iface,
 				  int read_opts, float orig_timeout,
 				  float watch_interval)
 {
@@ -134,9 +134,9 @@ static int netlink_print_gateways(char *mesh_iface, char *orig_iface,
 	char *info_header;
 	int ifindex;
 
-	ifindex = if_nametoindex(mesh_iface);
+	ifindex = if_nametoindex(state->mesh_iface);
 	if (!ifindex) {
-		fprintf(stderr, "Interface %s is unknown\n", mesh_iface);
+		fprintf(stderr, "Interface %s is unknown\n", state->mesh_iface);
 		return -ENODEV;
 	}
 
@@ -156,7 +156,7 @@ static int netlink_print_gateways(char *mesh_iface, char *orig_iface,
 	if (!header)
 		return -EINVAL;
 
-	return netlink_print_common(mesh_iface, orig_iface, read_opts,
+	return netlink_print_common(state, orig_iface, read_opts,
 				    orig_timeout, watch_interval,
 				    header,
 				    BATADV_CMD_GET_GATEWAYS,
@@ -170,4 +170,5 @@ static struct debug_table_data batctl_debug_table_gateways = {
 };
 
 COMMAND_NAMED(DEBUGTABLE, gateways, "gwl", handle_debug_table,
-	      COMMAND_FLAG_MESH_IFACE, &batctl_debug_table_gateways, "");
+	      COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
+	      &batctl_debug_table_gateways, "");
diff --git a/main.c b/main.c
index 9fc6bfb..ab7da45 100644
--- a/main.c
+++ b/main.c
@@ -21,7 +21,7 @@
  */
 
 
-
+#include <errno.h>
 #include <getopt.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -32,6 +32,7 @@
 #include "sys.h"
 #include "debug.h"
 #include "functions.h"
+#include "netlink.h"
 
 char mesh_dfl_iface[] = "bat0";
 char module_ver_path[] = "/sys/module/batman_adv/version";
@@ -180,8 +181,23 @@ int main(int argc, char **argv)
 		exit(EXIT_FAILURE);
 	}
 
+	if (cmd->flags & COMMAND_FLAG_NETLINK) {
+		ret = netlink_create(&state);
+		if (ret < 0 && ret != -EOPNOTSUPP) {
+			/* TODO handle -EOPNOTSUPP as error when fallbacks were
+			 * removed
+			 */
+			fprintf(stderr,
+				"Error - failed to connect to batadv\n");
+			exit(EXIT_FAILURE);
+		}
+	}
+
 	ret = cmd->handler(&state, argc, argv);
 
+	if (cmd->flags & COMMAND_FLAG_NETLINK)
+		netlink_destroy(&state);
+
 	return ret;
 
 err:
diff --git a/main.h b/main.h
index 2656dcf..4a48f61 100644
--- a/main.h
+++ b/main.h
@@ -25,6 +25,10 @@
 
 #include <stdint.h>
 
+#include <netlink/genl/ctrl.h>
+#include <netlink/genl/genl.h>
+#include <netlink/netlink.h>
+
 #ifndef SOURCE_VERSION
 #define SOURCE_VERSION "2018.4"
 #endif
@@ -61,6 +65,7 @@ extern char module_ver_path[];
 
 enum command_flags {
 	COMMAND_FLAG_MESH_IFACE = BIT(0),
+	COMMAND_FLAG_NETLINK = BIT(1),
 };
 
 enum command_type {
@@ -71,6 +76,10 @@ enum command_type {
 struct state {
 	char *mesh_iface;
 	const struct command *cmd;
+
+	struct nl_sock *sock;
+	struct nl_cb *cb;
+	int batadv_family;
 };
 
 struct command {
diff --git a/mcast_flags.c b/mcast_flags.c
index 9a1b819..bcbe17c 100644
--- a/mcast_flags.c
+++ b/mcast_flags.c
@@ -104,7 +104,7 @@ static int mcast_flags_callback(struct nl_msg *msg, void *arg)
 	return NL_OK;
 }
 
-static int netlink_print_mcast_flags(char *mesh_iface, char *orig_iface,
+static int netlink_print_mcast_flags(struct state *state, char *orig_iface,
 				     int read_opts, float orig_timeout,
 				     float watch_interval)
 {
@@ -115,9 +115,9 @@ static int netlink_print_mcast_flags(char *mesh_iface, char *orig_iface,
 	int ifindex;
 	int ret;
 
-	ifindex = if_nametoindex(mesh_iface);
+	ifindex = if_nametoindex(state->mesh_iface);
 	if (!ifindex) {
-		fprintf(stderr, "Interface %s is unknown\n", mesh_iface);
+		fprintf(stderr, "Interface %s is unknown\n", state->mesh_iface);
 		return -ENODEV;
 	}
 
@@ -159,7 +159,7 @@ static int netlink_print_mcast_flags(char *mesh_iface, char *orig_iface,
 	if (ret < 0)
 		return ret;
 
-	ret = netlink_print_common(mesh_iface, orig_iface, read_opts,
+	ret = netlink_print_common(state, orig_iface, read_opts,
 				   orig_timeout, watch_interval, header,
 				   BATADV_CMD_GET_MCAST_FLAGS,
 				   mcast_flags_callback);
@@ -175,4 +175,5 @@ static struct debug_table_data batctl_debug_table_mcast_flags = {
 };
 
 COMMAND_NAMED(DEBUGTABLE, mcast_flags, "mf", handle_debug_table,
-	      COMMAND_FLAG_MESH_IFACE, &batctl_debug_table_mcast_flags, "");
+	      COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
+	      &batctl_debug_table_mcast_flags, "");
diff --git a/neighbors.c b/neighbors.c
index c7a0f45..cd04be8 100644
--- a/neighbors.c
+++ b/neighbors.c
@@ -119,11 +119,11 @@ static int neighbors_callback(struct nl_msg *msg, void *arg)
 	return NL_OK;
 }
 
-static int netlink_print_neighbors(char *mesh_iface, char *orig_iface,
+static int netlink_print_neighbors(struct state *state, char *orig_iface,
 				   int read_opts, float orig_timeout,
 				   float watch_interval)
 {
-	return netlink_print_common(mesh_iface, orig_iface, read_opts,
+	return netlink_print_common(state, orig_iface, read_opts,
 				    orig_timeout, watch_interval,
 				    "IF             Neighbor              last-seen\n",
 				    BATADV_CMD_GET_NEIGHBORS,
@@ -137,4 +137,5 @@ static struct debug_table_data batctl_debug_table_neighbors = {
 };
 
 COMMAND_NAMED(DEBUGTABLE, neighbors, "n", handle_debug_table,
-	      COMMAND_FLAG_MESH_IFACE, &batctl_debug_table_neighbors, "");
+	      COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
+	      &batctl_debug_table_neighbors, "");
diff --git a/netlink.c b/netlink.c
index 26ae27d..8268037 100644
--- a/netlink.c
+++ b/netlink.c
@@ -109,6 +109,59 @@ struct nla_policy batadv_netlink_policy[NUM_BATADV_ATTR] = {
 	[BATADV_ATTR_MCAST_FLAGS_PRIV]		= { .type = NLA_U32 },
 };
 
+int netlink_create(struct state *state)
+{
+	int ret;
+
+	state->sock = NULL;
+	state->cb = NULL;
+	state->batadv_family = 0;
+
+	state->sock = nl_socket_alloc();
+	if (!state->sock)
+		return -ENOMEM;
+
+	ret = genl_connect(state->sock);
+	if (ret < 0)
+		goto err_free_sock;
+
+	state->batadv_family = genl_ctrl_resolve(state->sock, BATADV_NL_NAME);
+	if (state->batadv_family < 0) {
+		ret = -EOPNOTSUPP;
+		goto err_free_sock;
+	}
+
+	state->cb = nl_cb_alloc(NL_CB_DEFAULT);
+	if (!state->cb) {
+		ret = -ENOMEM;
+		goto err_free_family;
+	}
+
+	return 0;
+
+err_free_family:
+	state->batadv_family = 0;
+
+err_free_sock:
+	nl_socket_free(state->sock);
+	state->sock = NULL;
+
+	return ret;
+}
+
+void netlink_destroy(struct state *state)
+{
+	if (state->cb) {
+		nl_cb_put(state->cb);
+		state->cb = NULL;
+	}
+
+	if (state->sock) {
+		nl_socket_free(state->sock);
+		state->sock = NULL;
+	}
+}
+
 int last_err;
 char algo_name_buf[256] = "";
 int64_t mcast_flags = -EOPNOTSUPP;
@@ -456,7 +509,7 @@ int netlink_print_routing_algos(void)
 	return last_err;
 }
 
-int netlink_print_common(char *mesh_iface, char *orig_iface, int read_opt,
+int netlink_print_common(struct state *state, char *orig_iface, int read_opt,
 			 float orig_timeout, float watch_interval,
 			 const char *header, uint8_t nl_cmd,
 			 nl_recvmsg_msg_cb_t callback)
@@ -469,29 +522,19 @@ int netlink_print_common(char *mesh_iface, char *orig_iface, int read_opt,
 		.callback = callback,
 	};
 	int hardifindex = 0;
-	struct nl_sock *sock;
 	struct nl_msg *msg;
-	struct nl_cb *cb;
 	int ifindex;
-	int family;
 
-	sock = nl_socket_alloc();
-	if (!sock)
-		return -ENOMEM;
-
-	genl_connect(sock);
-
-	family = genl_ctrl_resolve(sock, BATADV_NL_NAME);
-	if (family < 0) {
+	if (!state->sock) {
 		last_err = -EOPNOTSUPP;
-		goto err_free_sock;
+		return last_err;
 	}
 
-	ifindex = if_nametoindex(mesh_iface);
+	ifindex = if_nametoindex(state->mesh_iface);
 	if (!ifindex) {
-		fprintf(stderr, "Interface %s is unknown\n", mesh_iface);
+		fprintf(stderr, "Interface %s is unknown\n", state->mesh_iface);
 		last_err = -ENODEV;
-		goto err_free_sock;
+		return last_err;
 	}
 
 	if (orig_iface) {
@@ -500,21 +543,15 @@ int netlink_print_common(char *mesh_iface, char *orig_iface, int read_opt,
 			fprintf(stderr, "Interface %s is unknown\n",
 				orig_iface);
 			last_err = -ENODEV;
-			goto err_free_sock;
+			return last_err;
 		}
 	}
 
-	cb = nl_cb_alloc(NL_CB_DEFAULT);
-	if (!cb) {
-		last_err = -ENOMEM;
-		goto err_free_sock;
-	}
-
 	bat_hosts_init(read_opt);
 
-	nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, netlink_print_common_cb, &opts);
-	nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, stop_callback, NULL);
-	nl_cb_err(cb, NL_CB_CUSTOM, print_error, NULL);
+	nl_cb_set(state->cb, NL_CB_VALID, NL_CB_CUSTOM, netlink_print_common_cb, &opts);
+	nl_cb_set(state->cb, NL_CB_FINISH, NL_CB_CUSTOM, stop_callback, NULL);
+	nl_cb_err(state->cb, NL_CB_CUSTOM, print_error, NULL);
 
 	do {
 		if (read_opt & CLR_CONT_READ)
@@ -530,20 +567,20 @@ int netlink_print_common(char *mesh_iface, char *orig_iface, int read_opt,
 		if (!msg)
 			continue;
 
-		genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, family, 0,
-			    NLM_F_DUMP, nl_cmd, 1);
+		genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, state->batadv_family,
+			    0, NLM_F_DUMP, nl_cmd, 1);
 
 		nla_put_u32(msg, BATADV_ATTR_MESH_IFINDEX, ifindex);
 		if (hardifindex)
 			nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX,
 				    hardifindex);
 
-		nl_send_auto_complete(sock, msg);
+		nl_send_auto_complete(state->sock, msg);
 
 		nlmsg_free(msg);
 
 		last_err = 0;
-		nl_recvmsgs(sock, cb);
+		nl_recvmsgs(state->sock, state->cb);
 
 		/* the header should still be printed when no entry was received */
 		if (!last_err)
@@ -556,9 +593,6 @@ int netlink_print_common(char *mesh_iface, char *orig_iface, int read_opt,
 
 	bat_hosts_free();
 
-err_free_sock:
-	nl_socket_free(sock);
-
 	return last_err;
 }
 
diff --git a/netlink.h b/netlink.h
index 0b21ac1..2526b07 100644
--- a/netlink.h
+++ b/netlink.h
@@ -27,6 +27,8 @@
 #include <netlink/genl/ctrl.h>
 #include <stdint.h>
 
+struct state;
+
 struct print_opts {
 	int read_opt;
 	float orig_timeout;
@@ -39,6 +41,9 @@ struct print_opts {
 
 struct ether_addr;
 
+int netlink_create(struct state *state);
+void netlink_destroy(struct state *state);
+
 int netlink_print_routing_algos(void);
 
 char *netlink_get_info(int ifindex, uint8_t nl_cmd, const char *header);
@@ -52,7 +57,7 @@ extern struct nla_policy batadv_netlink_policy[];
 
 int missing_mandatory_attrs(struct nlattr *attrs[], const int mandatory[],
 			    int num);
-int netlink_print_common(char *mesh_iface, char *orig_iface, int read_opt,
+int netlink_print_common(struct state *state, char *orig_iface, int read_opt,
 			 float orig_timeout, float watch_interval,
 			 const char *header, uint8_t nl_cmd,
 			 nl_recvmsg_msg_cb_t callback);
diff --git a/originators.c b/originators.c
index fd2aa66..a9c0606 100644
--- a/originators.c
+++ b/originators.c
@@ -177,7 +177,7 @@ static int originators_callback(struct nl_msg *msg, void *arg)
 	return NL_OK;
 }
 
-static int netlink_print_originators(char *mesh_iface, char *orig_iface,
+static int netlink_print_originators(struct state *state, char *orig_iface,
 				     int read_opts, float orig_timeout,
 				     float watch_interval)
 {
@@ -185,9 +185,9 @@ static int netlink_print_originators(char *mesh_iface, char *orig_iface,
 	char *info_header;
 	int ifindex;
 
-	ifindex = if_nametoindex(mesh_iface);
+	ifindex = if_nametoindex(state->mesh_iface);
 	if (!ifindex) {
-		fprintf(stderr, "Interface %s is unknown\n", mesh_iface);
+		fprintf(stderr, "Interface %s is unknown\n", state->mesh_iface);
 		return -ENODEV;
 	}
 
@@ -207,7 +207,7 @@ static int netlink_print_originators(char *mesh_iface, char *orig_iface,
 	if (!header)
 		return -EINVAL;
 
-	return netlink_print_common(mesh_iface, orig_iface, read_opts,
+	return netlink_print_common(state, orig_iface, read_opts,
 				    orig_timeout, watch_interval, header,
 				    BATADV_CMD_GET_ORIGINATORS,
 				    originators_callback);
@@ -222,4 +222,5 @@ static struct debug_table_data batctl_debug_table_originators = {
 };
 
 COMMAND_NAMED(DEBUGTABLE, originators, "o", handle_debug_table,
-	      COMMAND_FLAG_MESH_IFACE, &batctl_debug_table_originators, "");
+	      COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
+	      &batctl_debug_table_originators, "");
diff --git a/transglobal.c b/transglobal.c
index f67682a..da2d687 100644
--- a/transglobal.c
+++ b/transglobal.c
@@ -136,11 +136,11 @@ static int transglobal_callback(struct nl_msg *msg, void *arg)
 	return NL_OK;
 }
 
-static int netlink_print_transglobal(char *mesh_iface, char *orig_iface,
+static int netlink_print_transglobal(struct state *state, char *orig_iface,
 				     int read_opts, float orig_timeout,
 				     float watch_interval)
 {
-	return netlink_print_common(mesh_iface, orig_iface, read_opts,
+	return netlink_print_common(state, orig_iface, read_opts,
 				    orig_timeout, watch_interval,
 				    "   Client             VID Flags Last ttvn     Via        ttvn  (CRC       )\n",
 				    BATADV_CMD_GET_TRANSTABLE_GLOBAL,
@@ -156,4 +156,5 @@ static struct debug_table_data batctl_debug_table_transglobal = {
 };
 
 COMMAND_NAMED(DEBUGTABLE, transglobal, "tg", handle_debug_table,
-	      COMMAND_FLAG_MESH_IFACE, &batctl_debug_table_transglobal, "");
+	      COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
+	      &batctl_debug_table_transglobal, "");
diff --git a/translocal.c b/translocal.c
index 8b4cd59..a03b797 100644
--- a/translocal.c
+++ b/translocal.c
@@ -132,11 +132,11 @@ static int translocal_callback(struct nl_msg *msg, void *arg)
 	return NL_OK;
 }
 
-static int netlink_print_translocal(char *mesh_iface, char *orig_iface,
+static int netlink_print_translocal(struct state *state, char *orig_iface,
 				    int read_opts, float orig_timeout,
 				    float watch_interval)
 {
-	return netlink_print_common(mesh_iface, orig_iface, read_opts,
+	return netlink_print_common(state, orig_iface, read_opts,
 				    orig_timeout, watch_interval,
 				    "Client             VID Flags    Last seen (CRC       )\n",
 				    BATADV_CMD_GET_TRANSTABLE_LOCAL,
@@ -152,4 +152,5 @@ static struct debug_table_data batctl_debug_table_translocal = {
 };
 
 COMMAND_NAMED(DEBUGTABLE, translocal, "tl", handle_debug_table,
-	      COMMAND_FLAG_MESH_IFACE, &batctl_debug_table_translocal, "");
+	      COMMAND_FLAG_MESH_IFACE | COMMAND_FLAG_NETLINK,
+	      &batctl_debug_table_translocal, "");
-- 
2.19.1


  parent reply	other threads:[~2018-10-21 22:55 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-21 22:54 [B.A.T.M.A.N.] [PATCH 00/38] batctl: pre-netlink restructuring, part 1 Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 01/38] batctl: Drop unused define SOCKET_PATH_FMT Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 02/38] batctl: Use common code organization for statistics Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 03/38] batctl: Drop legacy vis_* related warning messages Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 04/38] batctl: Move loglevel command to separate file Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 05/38] batctl: Move log " Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 06/38] batctl: Move gw_mode " Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 07/38] batctl: Move routing_algo " Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 08/38] batctl: Rename tp_meter to throughputmeter Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 09/38] batctl: Introduce datastructure for subcommands Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 10/38] batctl: Add per command flags Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 11/38] batctl: Use command structure for remaining subcommands Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 12/38] batctl: Use getopt to parse main options Sven Eckelmann
2018-10-21 22:54 ` [B.A.T.M.A.N.] [PATCH 13/38] batctl: Store usage line next to command Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 14/38] batctl: Prepare command infrastructure for shared functions Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 15/38] batctl: Add type to command to structure usage output Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 16/38] batctl: Convert debug table to command infrastructure Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 17/38] batctl: Convert sysfs settings " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 18/38] batctl: Move backbonetable debug table to own file Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 19/38] batctl: Move claimtable " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 20/38] batctl: Move dat_cache " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 21/38] batctl: Move gateways " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 22/38] batctl: Move mcast_flags " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 23/38] batctl: Move nc_nodes " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 24/38] batctl: Move neighbors " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 25/38] batctl: Move originators " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 26/38] batctl: Move transglobal " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 27/38] batctl: Move translocal " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 28/38] batctl: Move aggregation setting " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 29/38] batctl: Move bonding " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 30/38] batctl: Move bridge_loop_avoidance " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 31/38] batctl: Move distributed_arp_table " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 32/38] batctl: Move fragmentation " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 33/38] batctl: Move isolation_mark " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 34/38] batctl: Move multicast_mode " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 35/38] batctl: Move network_coding " Sven Eckelmann
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 36/38] batctl: Move orig_interval " Sven Eckelmann
2018-10-21 23:02   ` [B.A.T.M.A.N.] [PATCH v2 " Sven Eckelmann
2018-10-21 22:55 ` Sven Eckelmann [this message]
2018-10-21 22:55 ` [B.A.T.M.A.N.] [PATCH 38/38] batctl: Add command to monitor for netlink events Sven Eckelmann
2018-10-22 16:42 ` [B.A.T.M.A.N.] [PATCH 00/38] batctl: pre-netlink restructuring, part 1 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=20181021225524.8155-38-sven@narfation.org \
    --to=sven@narfation.org \
    --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.