[linux-merge]linux integration; annotated tag, v5.1-rc7, created. v5.1-rc7
by postmaster@open-mesh.org
The annotated tag, v5.1-rc7 has been created
at 460ea0a56a22ae104fa81a09cd5e9e510cdc4d71 (tag)
tagging 37624b58542fb9f2d9a70e6ea006ef8a5f66c30b (commit)
replaces v5.1-rc6
tagged by Linus Torvalds
on Sun Apr 28 17:04:20 2019 -0700
- Shortlog ------------------------------------------------------------
Linux 5.1-rc7
-----BEGIN PGP SIGNATURE-----
iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAlzGP4QeHHRvcnZhbGRz
QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGU10H/254js04AIRm2V6m
ULzSNiIcSOlRZt/Wv/iKth6OGxhifgJ5u6uazQ8+EjZ+ofSUNDwFE+JYzYekyLoi
g/wm78HwGkI5RnzzPS3zRuC8ld9rRq1LcH8AEx3VYT2VqYqurdmLy+vvdx84vyjW
8DHaLI53ufr46g2qcS1uXWWfetzyPV+iCTyDLUENv4L3sl6jTCmd5M4N1SHM9Kag
MEb9KXwzi95isdOBI8NZHfGuU+eV3S08MVJ0Hp99F3dLrYx4LLFiFej9qMvbIxfp
snuGoiXIzt0kNGxBQ36d0w6FEcvx2GWtfVQDWVA+9h5fDA1O1RkJ8LAo3HLDP8Cg
MOeNpS0=
=mWQq
-----END PGP SIGNATURE-----
-----------------------------------------------------------------------
--
linux integration
3 years, 9 months
[linux-merge]linux integration; annotated tag, v5.1-rc6, created. v5.1-rc6
by postmaster@open-mesh.org
The annotated tag, v5.1-rc6 has been created
at cd9f1e5b687b85a321f0a9c0bbf95eaf9b8a6b3d (tag)
tagging 085b7755808aa11f78ab9377257e1dad2e6fa4bb (commit)
replaces v5.1-rc5
tagged by Linus Torvalds
on Sun Apr 21 10:46:14 2019 -0700
- Shortlog ------------------------------------------------------------
Linux 5.1-rc6
-----BEGIN PGP SIGNATURE-----
iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAly8rGYeHHRvcnZhbGRz
QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGmZMH/1IRB0E1Qmzz8yzw
wj79UuRGYPqxDDSWW+wNc8sU4Ic7iYirn9APHAztCdQqsjmzU/OVLfSa3JhdBe5w
THo7pbGKBqEDcWnKfNk/21jXFNLZ1vr9BoQv2DGU2MMhHAyo/NZbalo2YVtpQPmM
OCRth5n+LzvH7rGrX7RYgWu24G9l3NMfgtaDAXBNXesCGFAjVRrdkU5CBAaabvtU
4GWh/nnutndOOLdByL3x+VZ3H3fIBnbNjcIGCglvvqzk7h3hrfGEl4UCULldTxcM
IFsfMUhSw1ENy7F6DHGbKIG90cdCJcrQ8J/ziEzjj/KLGALluutfFhVvr6YCM2J6
2RgU8CY=
=CfY1
-----END PGP SIGNATURE-----
-----------------------------------------------------------------------
--
linux integration
3 years, 9 months
[linux-merge]linux integration; annotated tag, v5.1-rc5, created. v5.1-rc5
by postmaster@open-mesh.org
The annotated tag, v5.1-rc5 has been created
at e55675cb6f80500a8aa6db808643f8b66a84bd38 (tag)
tagging dc4060a5dc2557e6b5aa813bf5b73677299d62d2 (commit)
replaces v5.1-rc4
tagged by Linus Torvalds
on Sun Apr 14 15:17:44 2019 -0700
- Shortlog ------------------------------------------------------------
Linux 5.1-rc5
-----BEGIN PGP SIGNATURE-----
iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAlyzsYgeHHRvcnZhbGRz
QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGMw0H/ir42KJiABBKSETD
0d38qXVclAI/123zl8EkSfDrBKOsuIpXUDxzKeoDMhMkiurMpK6bbEOTPJAQMZJe
nEYpq/bZQi+vO8Q/pMMpaC3ExlIRosd0JAR7TyDUh5ZAeeMuDNzmvMk/DPxXPbNt
0P1FWePDa7908ajCOW1T8ZrB9Ak8boo7TKkF3LBb00ks1mEkyp/l74MKOHdu+HYn
XIwncX/Jotl4BrKdNC2f/NXYLYk6MrJDGug8TxuHgIqiMWhhrcSqbxU1ri7iqFXB
cBYdFo6ZJ8CWHux8/5LY5CMjSqEtzKha2Ohuhy3MMu1RsICyFLQtHnxHJ1ytLSBt
DOPcDQ0=
=CEUD
-----END PGP SIGNATURE-----
-----------------------------------------------------------------------
--
linux integration
3 years, 9 months
[batctl] master: batctl: Fix check for batadv genl name resolve (36c45e0)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batctl
On branch : master
>---------------------------------------------------------------
commit 36c45e0d4a4db18bb85faf10fc24ee85dd3836f9
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Mon Apr 15 08:41:01 2019 +0200
batctl: Fix check for batadv genl name resolve
Fixes: ef66312939e6 ("batctl: Add netlink fallback for sysfs' iface_status")
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
>---------------------------------------------------------------
36c45e0d4a4db18bb85faf10fc24ee85dd3836f9
interface.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/interface.c b/interface.c
index 630dd91..5ff25a7 100644
--- a/interface.c
+++ b/interface.c
@@ -85,7 +85,7 @@ static char *get_iface_status_netlink(unsigned int meshif, unsigned int hardif,
goto err_free_sock;
batadv_family = genl_ctrl_resolve(sock, BATADV_NL_NAME);
- if (ret < 0)
+ if (batadv_family < 0)
goto err_free_sock;
cb = nl_cb_alloc(NL_CB_DEFAULT);
3 years, 9 months
[batctl] master: batctl: Support checking of meshif without sysfs (07967cd)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batctl
On branch : master
>---------------------------------------------------------------
commit 07967cd19702515d0b19956a2fa0f6908d0a0bce
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed Apr 3 20:01:17 2019 +0200
batctl: Support checking of meshif without sysfs
batctl checks whether the supplied interface is a batadv interface. And for
hardif filters, whether this hardif is part of the selected meshif. This
was done traditionally using the sysfs files which batman-adv creates.
It is now possible to build the kernel module without sysfs support. These
checks must therefore also work when sysfs is not available. And since the
sysfs interface support was replaced in batctl by netlink commands, the
check should also be implemented using using NETLINK_ROUTE.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
>---------------------------------------------------------------
07967cd19702515d0b19956a2fa0f6908d0a0bce
debug.c | 2 +-
functions.c | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------
functions.h | 2 +-
3 files changed, 176 insertions(+), 20 deletions(-)
diff --git a/debug.c b/debug.c
index 4a3b6cb..597d59c 100644
--- a/debug.c
+++ b/debug.c
@@ -115,7 +115,7 @@ int handle_debug_table(struct state *state, int argc, char **argv)
return EXIT_FAILURE;
}
- if (check_mesh_iface_ownership(state->mesh_iface, optarg) != EXIT_SUCCESS)
+ if (check_mesh_iface_ownership(state, optarg) != EXIT_SUCCESS)
return EXIT_FAILURE;
orig_iface = optarg;
diff --git a/functions.c b/functions.c
index 9720257..b52db08 100644
--- a/functions.c
+++ b/functions.c
@@ -1039,37 +1039,178 @@ int translate_mesh_iface(struct state *state)
return 0;
}
-int check_mesh_iface(struct state *state)
+struct rtnl_link_iface_data {
+ uint8_t kind_found:1;
+ uint8_t master_found:1;
+ char kind[IF_NAMESIZE];
+ unsigned int master;
+};
+
+static int query_rtnl_link_single_parse(struct nl_msg *msg, void *arg)
+{
+ static struct nla_policy link_policy[IFLA_MAX + 1] = {
+ [IFLA_LINKINFO] = { .type = NLA_NESTED },
+ [IFLA_MASTER] = { .type = NLA_U32 },
+ };
+ static struct nla_policy link_info_policy[IFLA_INFO_MAX + 1] = {
+ [IFLA_INFO_KIND] = { .type = NLA_STRING },
+ };
+
+ struct rtnl_link_iface_data *link_data = arg;
+ struct nlattr *li[IFLA_INFO_MAX + 1];
+ struct nlmsghdr *n = nlmsg_hdr(msg);
+ struct nlattr *tb[IFLA_MAX + 1];
+ char *type;
+ int ret;
+
+ if (!nlmsg_valid_hdr(n, sizeof(struct ifinfomsg)))
+ return NL_OK;
+
+ ret = nlmsg_parse(n, sizeof(struct ifinfomsg), tb, IFLA_MAX,
+ link_policy);
+ if (ret < 0)
+ return NL_OK;
+
+ if (tb[IFLA_MASTER]) {
+ link_data->master = nla_get_u32(tb[IFLA_MASTER]);
+ link_data->master_found = true;
+ }
+
+ /* parse subattributes linkinfo */
+ if (!tb[IFLA_LINKINFO])
+ return NL_OK;
+
+ ret = nla_parse_nested(li, IFLA_INFO_MAX, tb[IFLA_LINKINFO],
+ link_info_policy);
+ if (ret < 0)
+ return NL_OK;
+
+ if (li[IFLA_INFO_KIND]) {
+ type = nla_get_string(li[IFLA_INFO_KIND]);
+ strncpy(link_data->kind, type, sizeof(link_data->kind));
+ link_data->kind[sizeof(link_data->kind) - 1] = '\0';
+
+ link_data->kind_found = true;
+ }
+
+ return NL_STOP;
+}
+
+static int query_rtnl_link_single(int mesh_ifindex,
+ struct rtnl_link_iface_data *link_data)
+{
+ struct ifinfomsg ifinfo = {
+ .ifi_family = AF_UNSPEC,
+ .ifi_index = mesh_ifindex,
+ };
+ struct nl_cb *cb = NULL;
+ struct nl_sock *sock;
+ int ret;
+
+ link_data->kind_found = false;
+ link_data->master_found = false;
+
+ sock = nl_socket_alloc();
+ if (!sock)
+ return -1;
+
+ ret = nl_connect(sock, NETLINK_ROUTE);
+ if (ret < 0)
+ goto free_sock;
+
+ ret = nl_send_simple(sock, RTM_GETLINK, NLM_F_REQUEST,
+ &ifinfo, sizeof(ifinfo));
+ if (ret < 0)
+ goto free_sock;
+
+ cb = nl_cb_alloc(NL_CB_DEFAULT);
+ if (!cb)
+ goto free_sock;
+
+ nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, query_rtnl_link_single_parse,
+ link_data);
+ nl_recvmsgs(sock, cb);
+
+ nl_cb_put(cb);
+free_sock:
+ nl_socket_free(sock);
+
+ return 0;
+}
+
+int check_mesh_iface_netlink(struct state *state)
+{
+ struct rtnl_link_iface_data link_data;
+
+ query_rtnl_link_single(state->mesh_ifindex, &link_data);
+ if (!link_data.kind_found)
+ return -1;
+
+ if (strcmp(link_data.kind, "batadv") != 0)
+ return -1;
+
+ return 0;
+}
+
+static int check_mesh_iface_sysfs(struct state *state)
{
char path_buff[PATH_BUFF_LEN];
- int ret = -1;
DIR *dir;
- /* use the parent interface if this is a VLAN */
- if (state->vid >= 0)
- snprintf(path_buff, PATH_BUFF_LEN, SYS_VLAN_PATH,
- state->mesh_iface, state->vid);
- else
- snprintf(path_buff, PATH_BUFF_LEN, SYS_BATIF_PATH_FMT,
- state->mesh_iface);
-
/* try to open the mesh sys directory */
+ snprintf(path_buff, PATH_BUFF_LEN, SYS_BATIF_PATH_FMT,
+ state->mesh_iface);
+
dir = opendir(path_buff);
if (!dir)
- goto out;
+ return -1;
closedir(dir);
+ return 0;
+}
+
+int check_mesh_iface(struct state *state)
+{
+ int ret;
+
state->mesh_ifindex = if_nametoindex(state->mesh_iface);
if (state->mesh_ifindex == 0)
- goto out;
+ return -1;
- ret = 0;
-out:
- return ret;
+ ret = check_mesh_iface_netlink(state);
+ if (ret == 0)
+ return ret;
+
+ ret = check_mesh_iface_sysfs(state);
+ if (ret == 0)
+ return ret;
+
+ return -1;
}
-int check_mesh_iface_ownership(char *mesh_iface, char *hard_iface)
+static int check_mesh_iface_ownership_netlink(struct state *state,
+ char *hard_iface)
+{
+ struct rtnl_link_iface_data link_data;
+ unsigned int hardif_index;
+
+ hardif_index = if_nametoindex(hard_iface);
+ if (hardif_index == 0)
+ return EXIT_FAILURE;
+
+ query_rtnl_link_single(hardif_index, &link_data);
+ if (!link_data.master_found)
+ return EXIT_FAILURE;
+
+ if (state->mesh_ifindex != link_data.master)
+ return EXIT_FAILURE;
+
+ return EXIT_SUCCESS;
+}
+
+static int check_mesh_iface_ownership_sysfs(struct state *state,
+ char *hard_iface)
{
char path_buff[PATH_BUFF_LEN];
int res;
@@ -1087,15 +1228,30 @@ int check_mesh_iface_ownership(char *mesh_iface, char *hard_iface)
if (line_ptr[strlen(line_ptr) - 1] == '\n')
line_ptr[strlen(line_ptr) - 1] = '\0';
- if (strcmp(line_ptr, mesh_iface) != 0) {
+ if (strcmp(line_ptr, state->mesh_iface) != 0) {
fprintf(stderr, "Error - interface %s is part of batman network %s, not %s\n",
- hard_iface, line_ptr, mesh_iface);
+ hard_iface, line_ptr, state->mesh_iface);
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
+int check_mesh_iface_ownership(struct state *state, char *hard_iface)
+{
+ int ret;
+
+ ret = check_mesh_iface_ownership_netlink(state, hard_iface);
+ if (ret == EXIT_SUCCESS)
+ return EXIT_SUCCESS;
+
+ ret = check_mesh_iface_ownership_sysfs(state, hard_iface);
+ if (ret == EXIT_SUCCESS)
+ return ret;
+
+ return EXIT_FAILURE;
+}
+
static int get_random_bytes_syscall(void *buf __maybe_unused,
size_t buflen __maybe_unused)
{
diff --git a/functions.h b/functions.h
index 23186e5..02f7823 100644
--- a/functions.h
+++ b/functions.h
@@ -53,7 +53,7 @@ int netlink_simple_request(struct nl_msg *msg);
int translate_mesh_iface(struct state *state);
int get_algoname(const char *mesh_iface, char *algoname, size_t algoname_len);
int check_mesh_iface(struct state *state);
-int check_mesh_iface_ownership(char *mesh_iface, char *hard_iface);
+int check_mesh_iface_ownership(struct state *state, char *hard_iface);
void get_random_bytes(void *buf, size_t buflen);
void check_root_or_die(const char *cmd);
3 years, 9 months
[batctl] master: batctl: Add netlink fallback for sysfs' iface_status (ef66312)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batctl
On branch : master
>---------------------------------------------------------------
commit ef66312939e63e4a4c17ea257d93c515aae9a454
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed Apr 3 20:01:19 2019 +0200
batctl: Add netlink fallback for sysfs' iface_status
The batman-adv kernel module can now be compiled without support for sysfs.
But the status of an interface in the list generated by `batctl interface`
can only get the status via the per hardif sysfs file iface_status. To
still have some information, fallback to BATADV_CMD_GET_HARDIF if the sysfs
file is not available.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
>---------------------------------------------------------------
ef66312939e63e4a4c17ea257d93c515aae9a454
interface.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 91 insertions(+), 1 deletion(-)
diff --git a/interface.c b/interface.c
index 667a308..630dd91 100644
--- a/interface.c
+++ b/interface.c
@@ -24,6 +24,8 @@
#include "sys.h"
#include "functions.h"
+#define IFACE_STATUS_LEN 256
+
static void interface_usage(void)
{
fprintf(stderr, "Usage: batctl [options] interface [parameters] [add|del iface(s)]\n");
@@ -33,6 +35,92 @@ static void interface_usage(void)
fprintf(stderr, " \t -h print this help\n");
}
+static int get_iface_status_netlink_parse(struct nl_msg *msg, void *arg)
+{
+
+ struct nlattr *attrs[NUM_BATADV_ATTR];
+ struct nlmsghdr *nlh = nlmsg_hdr(msg);
+ char *iface_status = arg;
+ struct genlmsghdr *ghdr;
+
+ if (!genlmsg_valid_hdr(nlh, 0))
+ return NL_OK;
+
+ ghdr = nlmsg_data(nlh);
+ if (ghdr->cmd != BATADV_CMD_GET_HARDIF)
+ return NL_OK;
+
+ if (nla_parse(attrs, BATADV_ATTR_MAX, genlmsg_attrdata(ghdr, 0),
+ genlmsg_len(ghdr), batadv_netlink_policy))
+ return NL_OK;
+
+ if (attrs[BATADV_ATTR_ACTIVE])
+ strncpy(iface_status, "active\n", IFACE_STATUS_LEN);
+ else
+ strncpy(iface_status, "inactive\n", IFACE_STATUS_LEN);
+
+ iface_status[IFACE_STATUS_LEN - 1] = '\0';
+
+ return NL_STOP;
+}
+
+static char *get_iface_status_netlink(unsigned int meshif, unsigned int hardif,
+ char *iface_status)
+{
+ struct nl_sock *sock;
+ struct nl_msg *msg;
+ int batadv_family;
+ struct nl_cb *cb;
+ int ret;
+
+ strncpy(iface_status, "<error reading status>\n", IFACE_STATUS_LEN);
+ iface_status[IFACE_STATUS_LEN - 1] = '\0';
+
+ sock = nl_socket_alloc();
+ if (!sock)
+ return iface_status;
+
+ ret = genl_connect(sock);
+ if (ret < 0)
+ goto err_free_sock;
+
+ batadv_family = genl_ctrl_resolve(sock, BATADV_NL_NAME);
+ if (ret < 0)
+ goto err_free_sock;
+
+ cb = nl_cb_alloc(NL_CB_DEFAULT);
+ if (!cb)
+ goto err_free_sock;
+
+ nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, get_iface_status_netlink_parse,
+ iface_status);
+
+ msg = nlmsg_alloc();
+ if (!msg)
+ goto err_free_cb;
+
+ genlmsg_put(msg, NL_AUTO_PID, NL_AUTO_SEQ, batadv_family,
+ 0, 0, BATADV_CMD_GET_HARDIF, 1);
+
+ nla_put_u32(msg, BATADV_ATTR_MESH_IFINDEX, meshif);
+ nla_put_u32(msg, BATADV_ATTR_HARD_IFINDEX, hardif);
+
+ ret = nl_send_auto_complete(sock, msg);
+ if (ret < 0)
+ goto err_free_msg;
+
+ nl_recvmsgs(sock, cb);
+
+err_free_msg:
+ nlmsg_free(msg);
+err_free_cb:
+ nl_cb_put(cb);
+err_free_sock:
+ nl_socket_free(sock);
+
+ return iface_status;
+}
+
static struct nla_policy link_policy[IFLA_MAX + 1] = {
[IFLA_IFNAME] = { .type = NLA_STRING, .maxlen = IFNAMSIZ },
[IFLA_MASTER] = { .type = NLA_U32 },
@@ -45,6 +133,7 @@ struct print_interfaces_rtnl_arg {
static int print_interfaces_rtnl_parse(struct nl_msg *msg, void *arg)
{
struct print_interfaces_rtnl_arg *print_arg = arg;
+ char iface_status[IFACE_STATUS_LEN];
struct nlattr *attrs[IFLA_MAX + 1];
char path_buff[PATH_BUFF_LEN];
struct ifinfomsg *ifm;
@@ -75,7 +164,8 @@ static int print_interfaces_rtnl_parse(struct nl_msg *msg, void *arg)
snprintf(path_buff, sizeof(path_buff), SYS_IFACE_STATUS_FMT, ifname);
ret = read_file("", path_buff, USE_READ_BUFF | SILENCE_ERRORS, 0, 0, 0);
if (ret != EXIT_SUCCESS)
- status = "<error reading status>\n";
+ status = get_iface_status_netlink(master, ifm->ifi_index,
+ iface_status);
else
status = line_ptr;
3 years, 9 months
[batctl] master: batctl: Reimplement VLAN translation using helper (dd43728)
by postmaster@open-mesh.org
Repository : ssh://git@open-mesh.org/batctl
On branch : master
>---------------------------------------------------------------
commit dd4372842c7a5165b98cd72d5a1f924198eeb7fe
Author: Sven Eckelmann <sven(a)narfation.org>
Date: Wed Apr 3 20:01:18 2019 +0200
batctl: Reimplement VLAN translation using helper
The functionality to translate VLAN interfaces to mesh interfaces and VID
is using NETLINK_ROUTE like the query_rtnl_link_single helper function.
Only minimal changes are required to also provide the link to the
underlying device and the VID.
Signed-off-by: Sven Eckelmann <sven(a)narfation.org>
>---------------------------------------------------------------
dd4372842c7a5165b98cd72d5a1f924198eeb7fe
functions.c | 229 +++++++++++++++++++-----------------------------------------
1 file changed, 71 insertions(+), 158 deletions(-)
diff --git a/functions.c b/functions.c
index b52db08..bb7f517 100644
--- a/functions.c
+++ b/functions.c
@@ -760,149 +760,6 @@ out:
return mac_result;
}
-struct vlan_get_link_nl_arg {
- char *iface;
- int vid;
-};
-
-static struct nla_policy info_data_link_policy[IFLA_MAX + 1] = {
- [IFLA_LINKINFO] = { .type = NLA_NESTED },
- [IFLA_LINK] = { .type = NLA_U32 },
-};
-
-static struct nla_policy info_data_link_info_policy[IFLA_INFO_MAX + 1] = {
- [IFLA_INFO_DATA] = { .type = NLA_NESTED },
-};
-
-static struct nla_policy vlan_policy[IFLA_VLAN_MAX + 1] = {
- [IFLA_VLAN_ID] = { .type = NLA_U16 },
-};
-
-/**
- * vlan_get_link_parse - parse a get_link rtnl message and extract the important
- * data
- * @msg: the reply msg
- * @arg: pointer to the buffer which will store the return values
- *
- * Saves the vid in arg::vid in case of success or -1 otherwise
- */
-static int vlan_get_link_parse(struct nl_msg *msg, void *arg)
-{
- struct vlan_get_link_nl_arg *nl_arg = arg;
- struct nlmsghdr *n = nlmsg_hdr(msg);
- struct nlattr *tb[IFLA_MAX + 1];
- struct nlattr *li[IFLA_INFO_MAX + 1];
- struct nlattr *vi[IFLA_VLAN_MAX + 1];
- int ret;
- int idx;
-
- if (!nlmsg_valid_hdr(n, sizeof(struct ifinfomsg)))
- return -NLE_MSG_TOOSHORT;
-
- ret = nlmsg_parse(n, sizeof(struct ifinfomsg), tb, IFLA_MAX,
- info_data_link_policy);
- if (ret < 0)
- return ret;
-
- if (!tb[IFLA_LINK])
- return -NLE_MISSING_ATTR;
-
- /* parse subattributes linkinfo */
- if (!tb[IFLA_LINKINFO])
- return -NLE_MISSING_ATTR;
-
- ret = nla_parse_nested(li, IFLA_INFO_MAX, tb[IFLA_LINKINFO],
- info_data_link_info_policy);
- if (ret < 0)
- return ret;
-
- if (!li[IFLA_INFO_KIND])
- return -NLE_MISSING_ATTR;
-
- if (strcmp(nla_data(li[IFLA_INFO_KIND]), "vlan") != 0)
- goto err;
-
- /* parse subattributes info_data for vlan */
- if (!li[IFLA_INFO_DATA])
- return -NLE_MISSING_ATTR;
-
- ret = nla_parse_nested(vi, IFLA_VLAN_MAX, li[IFLA_INFO_DATA],
- vlan_policy);
- if (ret < 0)
- return ret;
-
- if (!vi[IFLA_VLAN_ID])
- return -NLE_MISSING_ATTR;
-
- /* get parent link name */
- idx = *(int *)nla_data(tb[IFLA_LINK]);
-
- if (!if_indextoname(idx, nl_arg->iface))
- goto err;
-
- /* get the corresponding vid */
- nl_arg->vid = *(int *)nla_data(vi[IFLA_VLAN_ID]);
-
-err:
- if (nl_arg->vid >= 0)
- return NL_STOP;
- else
- return NL_OK;
-}
-
-/**
- * vlan_get_link - convert a VLAN interface into its parent one
- * @ifname: the interface to convert
- * @parent: buffer where the parent interface name will be written
- * (minimum IF_NAMESIZE)
- *
- * Returns the vlan identifier on success or -1 on error
- */
-static int vlan_get_link(const char *ifname, char *parent)
-{
- struct nl_sock *sock;
- int ret;
- struct ifinfomsg ifinfo = {
- .ifi_family = AF_UNSPEC,
- .ifi_index = if_nametoindex(ifname),
- };
- struct nl_cb *cb = NULL;
- struct vlan_get_link_nl_arg arg = {
- .iface = parent,
- .vid = -1,
- };
-
- sock = nl_socket_alloc();
- if (!sock)
- goto err;
-
- ret = nl_connect(sock, NETLINK_ROUTE);
- if (ret < 0)
- goto err;
-
- ret = nl_send_simple(sock, RTM_GETLINK, NLM_F_REQUEST,
- &ifinfo, sizeof(ifinfo));
- if (ret < 0)
- goto err;
-
- cb = nl_cb_alloc(NL_CB_DEFAULT);
- if (!cb)
- goto err;
-
- nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, vlan_get_link_parse, &arg);
- ret = nl_recvmsgs(sock, cb);
- if (ret < 0)
- goto err;
-
-err:
- if (cb)
- nl_cb_put(cb);
- if (sock)
- nl_socket_free(sock);
-
- return arg.vid;
-}
-
int query_rtnl_link(int ifindex, nl_recvmsg_msg_cb_t func, void *arg)
{
struct ifinfomsg rt_hdr = {
@@ -1025,25 +882,15 @@ err_free_sock:
return err;
}
-int translate_mesh_iface(struct state *state)
-{
- state->vid = vlan_get_link(state->arg_iface, state->mesh_iface);
- if (state->vid < 0) {
- /* if there is no iface then the argument must be the
- * mesh interface
- */
- snprintf(state->mesh_iface, sizeof(state->mesh_iface), "%s",
- state->arg_iface);
- }
-
- return 0;
-}
-
struct rtnl_link_iface_data {
uint8_t kind_found:1;
uint8_t master_found:1;
+ uint8_t link_found:1;
+ uint8_t vid_found:1;
char kind[IF_NAMESIZE];
unsigned int master;
+ unsigned int link;
+ uint16_t vid;
};
static int query_rtnl_link_single_parse(struct nl_msg *msg, void *arg)
@@ -1051,13 +898,19 @@ static int query_rtnl_link_single_parse(struct nl_msg *msg, void *arg)
static struct nla_policy link_policy[IFLA_MAX + 1] = {
[IFLA_LINKINFO] = { .type = NLA_NESTED },
[IFLA_MASTER] = { .type = NLA_U32 },
+ [IFLA_LINK] = { .type = NLA_U32 },
};
static struct nla_policy link_info_policy[IFLA_INFO_MAX + 1] = {
[IFLA_INFO_KIND] = { .type = NLA_STRING },
+ [IFLA_INFO_DATA] = { .type = NLA_NESTED },
+ };
+ static struct nla_policy vlan_policy[IFLA_VLAN_MAX + 1] = {
+ [IFLA_VLAN_ID] = { .type = NLA_U16 },
};
struct rtnl_link_iface_data *link_data = arg;
struct nlattr *li[IFLA_INFO_MAX + 1];
+ struct nlattr *vi[IFLA_VLAN_MAX + 1];
struct nlmsghdr *n = nlmsg_hdr(msg);
struct nlattr *tb[IFLA_MAX + 1];
char *type;
@@ -1076,6 +929,11 @@ static int query_rtnl_link_single_parse(struct nl_msg *msg, void *arg)
link_data->master_found = true;
}
+ if (tb[IFLA_LINK]) {
+ link_data->link = nla_get_u32(tb[IFLA_LINK]);
+ link_data->link_found = true;
+ }
+
/* parse subattributes linkinfo */
if (!tb[IFLA_LINKINFO])
return NL_OK;
@@ -1093,6 +951,19 @@ static int query_rtnl_link_single_parse(struct nl_msg *msg, void *arg)
link_data->kind_found = true;
}
+ if (!li[IFLA_INFO_DATA])
+ return NL_OK;
+
+ ret = nla_parse_nested(vi, IFLA_VLAN_MAX, li[IFLA_INFO_DATA],
+ vlan_policy);
+ if (ret < 0)
+ return NL_OK;
+
+ if (vi[IFLA_VLAN_ID]) {
+ link_data->vid = nla_get_u16(vi[IFLA_VLAN_ID]);
+ link_data->vid_found = true;
+ }
+
return NL_STOP;
}
@@ -1109,6 +980,8 @@ static int query_rtnl_link_single(int mesh_ifindex,
link_data->kind_found = false;
link_data->master_found = false;
+ link_data->link_found = false;
+ link_data->vid_found = false;
sock = nl_socket_alloc();
if (!sock)
@@ -1138,7 +1011,47 @@ free_sock:
return 0;
}
-int check_mesh_iface_netlink(struct state *state)
+int translate_mesh_iface(struct state *state)
+{
+ struct rtnl_link_iface_data link_data;
+ unsigned int arg_ifindex;
+
+ arg_ifindex = if_nametoindex(state->arg_iface);
+ if (arg_ifindex == 0)
+ goto fallback_meshif;
+
+ query_rtnl_link_single(arg_ifindex, &link_data);
+ if (!link_data.vid_found)
+ goto fallback_meshif;
+
+ if (!link_data.link_found)
+ goto fallback_meshif;
+
+ if (!link_data.kind_found)
+ goto fallback_meshif;
+
+ if (strcmp(link_data.kind, "vlan") != 0)
+ goto fallback_meshif;
+
+ if (!if_indextoname(link_data.link, state->mesh_iface))
+ goto fallback_meshif;
+
+ state->vid = link_data.vid;
+
+ return 0;
+
+fallback_meshif:
+ /* if there is no vid then the argument must be the
+ * mesh interface
+ */
+ snprintf(state->mesh_iface, sizeof(state->mesh_iface), "%s",
+ state->arg_iface);
+ state->vid = -1;
+
+ return 0;
+}
+
+static int check_mesh_iface_netlink(struct state *state)
{
struct rtnl_link_iface_data link_data;
3 years, 9 months
[linux-merge]linux integration; annotated tag, v5.1-rc4, created. v5.1-rc4
by postmaster@open-mesh.org
The annotated tag, v5.1-rc4 has been created
at 1f3a6c30348e2205f75969e38c02f7d211fa01a9 (tag)
tagging 15ade5d2e7775667cf191cf2f94327a4889f8b9d (commit)
replaces v5.1-rc3
tagged by Linus Torvalds
on Sun Apr 7 14:10:11 2019 -1000
- Shortlog ------------------------------------------------------------
Linux 5.1-rc4
-----BEGIN PGP SIGNATURE-----
iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAlyqkWMeHHRvcnZhbGRz
QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGi5MIAISBCWrK6rU1dp31
B4leR8VR2lOvWHA2jwV+xJ3JWkUm6LY9kcuqY7YhQ+3hcwQ05cWCZIGj06i2W32g
UQWLV1YUSjRS0gCUxvB/qBesDWJ9Sa9Ut4hhJwRq0Kolk4e4Cc7t4jrjS5uWU4qS
LFB37xpuGbTAWqjSBG9j2AUzLpDzUzdmRQ79CTK3UzUiBGwSeGGCZmZk4sgJJOGc
flyQTOo1L83heEE2PH6JSpJHoN5PQhsAEYF7cX6BgTZ5CD+IbXpPPGSHD/rHyyI1
PKx23xlcjJqZOX9c3Suz0leXYbq1x/OZ4N6FPXSUcyTPHyyQSzu/Ymm6/kLKRGG0
jvgoqIU=
=BnNb
-----END PGP SIGNATURE-----
Anders Roxell (1):
batman-adv: fix warning in function batadv_v_elp_get_throughput
Sven Eckelmann (4):
batman-adv: Reduce claim hash refcnt only for removed entry
batman-adv: Reduce tt_local hash refcnt only for removed entry
batman-adv: Reduce tt_global hash refcnt only for removed entry
batman-adv: Fix genl notification for throughput_override
-----------------------------------------------------------------------
--
linux integration
3 years, 9 months
[linux-merge]linux integration; annotated tag, batadv-net-for-davem-20190328, deleted. v5.0-11593-g438b3d3fae43
by postmaster@open-mesh.org
The annotated tag, batadv-net-for-davem-20190328 has been deleted
was e5d61e9695ee7facfa5b61b9cb415bc12e244e44
-----------------------------------------------------------------------
tag batadv-net-for-davem-20190328
Here are some batman-adv bugfixes:
- Fix refcount underflows in bridge loop avoidance code,
by Sven Eckelmann (3 patches)
- Fix warning when CFG80211 isn't enabled, by Anders Roxell
- Fix genl notification for throughput override, by Sven Eckelmann
-----BEGIN PGP SIGNATURE-----
iQJKBAABCgA0FiEE1ilQI7G+y+fdhnrfoSvjmEKSnqEFAlyc6H0WHHN3QHNpbW9u
d3VuZGVybGljaC5kZQAKCRChK+OYQpKeoQh1D/sHYiFZsMDvwZ6s1ryUSwfj5ThX
3hgYsWzjN6MW2WMFpM/nQ448bLqvXveYOA0R+IpVWB5LOOmRFs7lgjx6J+Vq8SQk
dGx+dBrywqTLRzf5al5RPIW2sO4Z6JLXyGU0KioywSd61qj7ii8sRf0fK0tDy/Mr
EVvTsjs2nywj43b4dy5szJ1hELW5CEUAtNzGDZA0DogH9clhsTi1yG07eC8UrGpj
n0YrbB7SZFFQkNCpbN0DR7qeKwDEPedRQTlDxUtxXCE0acRyHai1qKFoMzEWMJZ0
tLqTMYNHRxCYTv3D8qLQVmq2cO6rCUodfjrMKdyiZs6pM5QR39sBhWfzH1WObo90
gMXM6hAkRGnLgUSh0Wbz1TkRMio8NgPNr9hAdUsuF5yYSni0RxZtGfCeUiby8Znk
IGLNHdmITgfFcxHuVtFpBspl3Bdsbnk0+PR4RMkiMtoPhz8RG2oltGpvZ9sG8hJ3
W8ZSI0f2LWueygwKEaiC4Kb7Kz1pgKiB5xPWdBK6+WfujRV+zK3+n+JSygLuJhlf
tYpRZk0A2JBHPzDC3B865FFo9089SBBN/WekohsVibnWN7MQnolnGhlFyekjic04
aPMvn+OX7vS9lnSSkBcsen0GFtqZFd7pzt9hWQkyHuJZ8b48KebjuL3Z4w0Uaz6c
WqUXAKKs2KPFIKEgFg==
=+6Ww
-----END PGP SIGNATURE-----
438b3d3fae4346a49fe12fa7cc1dc9327f006a91 batman-adv: Fix genl notification for throughput_override
-----------------------------------------------------------------------
--
linux integration
3 years, 10 months
[linux-merge]linux integration; annotated tag, batadv-next-for-davem-20190328, deleted. v5.0-11600-g32e727449c79
by postmaster@open-mesh.org
The annotated tag, batadv-next-for-davem-20190328 has been deleted
was 1ca53392a2d480d2ee8bee09350558d3531ce7c1
-----------------------------------------------------------------------
tag batadv-next-for-davem-20190328
This feature/cleanup patchset includes the following patches:
- Drop license boilerplate (obsoleted by SPDX license IDs),
by Sven Eckelmann
- Drop documentation for sysfs and debugfs Documentation,
by Sven Eckelmann (2 patches)
- Mark sysfs as optional and deprecated, by Sven Eckelmann (3 patches)
- Update MAINTAINERS Tree, Chat and Bugtracker,
by Sven Eckelmann (3 patches)
- Rename batadv_dat_send_data, by Sven Eckelmann
- update DAT entries with incoming ARP replies, by Linus Luessing
- add multicast-to-unicast support for limited destinations,
by Linus Luessing
-----BEGIN PGP SIGNATURE-----
iQJKBAABCgA0FiEE1ilQI7G+y+fdhnrfoSvjmEKSnqEFAlyc6uEWHHN3QHNpbW9u
d3VuZGVybGljaC5kZQAKCRChK+OYQpKeoSA9D/sEpVY0qOITIwzbttcyeDU5PPSD
OF4dVCf6Za6CqfnPRCdViKAGtC1FOz+X2BXtedrIxgsjSPFoRvRoi1XBdu4Bobv2
/4wx56rz3AeMoBZ1UyziUIS6Qam1x7vVYSRXk+QHqBYVc16YiIePpCqTuryrzuk4
4MMqXz+V0dqm7z7irRDe7W9/CdFRtZEDAS8o6cgw4IlL56Ul3Yz6xP6p3PRA+H6V
OWtVwmwcbX2KzZnrWDgql5NBhJ1bOfn2oDp1Y4RpLRmBp0iwg1qZdNZK2+MD2TTw
xxuz5lsZFhTBXNqGgeoGk87m2z0wNkvnj9UnkMPl3gb7j+FyyaAgvVY4M2s2qJv/
++wKDPPun/aGDOuo/rJdBTdlnToH17KS3jsDwhj4TooroI8uCCLWZQaYWkgjcugD
ZKsZlIqFrfH3rPAzOBwRZodoYkOPpz/+xHp3p/cg9ANifwqpxqq3PY35BoP4ZXRi
xUy79QgNIFxYXwrrqTrt3UrY8AGo1/OOHmA6nFQGZT79S648ZoG5vPDKFKRzTmcj
Mj2GXuBzMIkWayHgnH69Kv9vVZc7mZPi7lartsVq/aZtMCh3HbPNfKtNOYsu4QEq
6c2966jvFB+LdTibiJQWbe0s5Z96UaFQUxH5+gGdM5TS5TCIaG3udXoI1ou4YVJI
q6eOdAgblbD7oaNY4w==
=WB31
-----END PGP SIGNATURE-----
32e727449c792b689c2a06a8b4cc9fef6270c5a7 batman-adv: Add multicast-to-unicast support for multiple targets
-----------------------------------------------------------------------
--
linux integration
3 years, 10 months