Repository : ssh://git@open-mesh.org/batctl
On branch : master
commit e87cc59e1178b4d04e44a23257bd30ad39b29b6c Author: Sven Eckelmann sven@narfation.org Date: Sun Jan 22 13:21:07 2017 +0100
batctl: Return type of error on netlink_get_info error
It can happen that netlink_get_info will not return an algo string. This usually happens because BATADV_CMD_GET_MESH_INFO is not implemented in the kernel modules. But it is also possible that this happens because the user didn't have the correct rights to retrieve this type of information.
Signed-off-by: Sven Eckelmann sven@narfation.org Signed-off-by: Simon Wunderlich sw@simonwunderlich.de
e87cc59e1178b4d04e44a23257bd30ad39b29b6c netlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/netlink.c b/netlink.c index 9580aa3..7fb1ee1 100644 --- a/netlink.c +++ b/netlink.c @@ -1177,11 +1177,12 @@ int netlink_print_originators(char *mesh_iface, char *orig_iface, }
/* only parse routing algorithm name */ + last_err = -EINVAL; info_header = netlink_get_info(ifindex, BATADV_CMD_GET_ORIGINATORS, NULL); free(info_header);
if (strlen(algo_name_buf) == 0) - return -EOPNOTSUPP; + return last_err;
if (!strcmp("BATMAN_IV", algo_name_buf)) header = " Originator last-seen (#/255) Nexthop [outgoingIF]\n"; @@ -1244,11 +1245,12 @@ int netlink_print_gateways(char *mesh_iface, char *orig_iface, int read_opts, }
/* only parse routing algorithm name */ + last_err = -EINVAL; info_header = netlink_get_info(ifindex, BATADV_CMD_GET_ORIGINATORS, NULL); free(info_header);
if (strlen(algo_name_buf) == 0) - return -EOPNOTSUPP; + return last_err;
if (!strcmp("BATMAN_IV", algo_name_buf)) header = " Router ( TQ) Next Hop [outgoingIf] Bandwidth\n";