b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: Jean-Jacques Sarton <jj.sarton@web.de>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] PATCH alfred
Date: Tue, 1 Nov 2016 15:17:58 +0100	[thread overview]
Message-ID: <14097889-e13c-70ae-3408-67fcf0271a96@web.de> (raw)

I had problem with alfre which don't start. I'am using netfs.

Swen has proposed a patch which remove the batadv_interface_check()
function.
May way is an other regarding the transitional period where the
old an new feature are to be supported.

Signed-off-by: jj.sarton@t-online.de


diff --git a/batadv_query.c b/batadv_query.c
index a671b79..c8732ef 100644
--- a/batadv_query.c
+++ b/batadv_query.c
@@ -136,7 +136,7 @@ int ipv6_to_mac(const struct in6_addr *addr, struct
ether_addr *mac)
        return 0;
 }

-int batadv_interface_check(const char *mesh_iface)
+int batadv_interface_check_debugfs(const char *mesh_iface)
 {
        char full_path[MAX_PATH + 1];
        FILE *f;
@@ -166,6 +166,18 @@ int batadv_interface_check(const char *mesh_iface)
        return 0;
 }

+int batadv_interface_check(const char *mesh_iface)
+{
+       int ret = 0;
+       enable_net_admin_capability(1);
+       ret = batadv_interface_check_netlink(mesh_iface);
+       enable_net_admin_capability(0);
+
+       if ( ret < 0 )
+               return batadv_interface_check_debugfs(mesh_iface);
+       return 0;
+}
+
 static int translate_mac_debugfs(const char *mesh_iface,
                                 const struct ether_addr *mac,
                                 struct ether_addr *mac_out)
diff --git a/netlink.c b/netlink.c
index 1b5695c..ca311e7 100644
--- a/netlink.c
+++ b/netlink.c
@@ -365,3 +365,30 @@ int get_tq_netlink(const char *mesh_iface, const
struct ether_addr *mac,

        return 0;
 }
+
+int batadv_interface_check_netlink(const char *mesh_iface)
+{
+       struct get_tq_netlink_opts opts = {
+               .tq = 0,
+               .found = false,
+               .query_opts = {
+                       .err = 0,
+               },
+       };
+       int ret = 0;
+
+       memset(&opts.mac, 0, ETH_ALEN);
+
+       ret = netlink_query_common(mesh_iface,  BATADV_CMD_GET_ORIGINATORS,
+                                  get_tq_netlink_cb, &opts.query_opts);
+       if (ret < 0)
+               return ret;
+
+       memset(&opts.mac, 0, ETH_ALEN);
+       ret = netlink_query_common(mesh_iface,  BATADV_CMD_GET_ORIGINATORS,
+                                  get_tq_netlink_cb, &opts.query_opts);
+
+       if (ret < 0)
+               return ret;
+       return 0;
+}
diff --git a/netlink.h b/netlink.h
index b08e872..9bc75a1 100644
--- a/netlink.h
+++ b/netlink.h
@@ -49,6 +49,7 @@ int translate_mac_netlink(const char *mesh_iface,
const struct ether_addr *mac,
                          struct ether_addr *mac_out);
 int get_tq_netlink(const char *mesh_iface, const struct ether_addr *mac,
                   uint8_t *tq);
+int batadv_interface_check_netlink(const char *mesh_iface);

 extern struct nla_policy batadv_netlink_policy[];


             reply	other threads:[~2016-11-01 14:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-01 14:17 Jean-Jacques Sarton [this message]
2016-11-01 14:27 ` [B.A.T.M.A.N.] PATCH alfred Sven Eckelmann
2016-11-01 14:38 Jean-Jacques Sarton
2016-11-01 14:57 ` Simon Wunderlich
2016-11-01 14:59 ` 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=14097889-e13c-70ae-3408-67fcf0271a96@web.de \
    --to=jj.sarton@web.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).