summaryrefslogtreecommitdiffstats
path: root/ffd/netif.c
diff options
context:
space:
mode:
Diffstat (limited to 'ffd/netif.c')
-rw-r--r--ffd/netif.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/ffd/netif.c b/ffd/netif.c
index d521a12..45b4e58 100644
--- a/ffd/netif.c
+++ b/ffd/netif.c
@@ -36,6 +36,7 @@
#include <linux/rtnetlink.h>
#include <net/if.h>
+#include <net/if_arp.h>
#include <sys/stat.h>
#include <sys/types.h>
@@ -81,6 +82,24 @@ static bool batadv_file_read(const char *ifname, const char *file, const char *f
return ret;
}
+netif_type_t netif_get_type(const char *ifname) {
+ int type;
+ if (netif_file_read(ifname, "type", "%i", &type) && type == ARPHRD_ETHER) {
+ if(netif_file_exists(ifname, "mesh"))
+ return IF_MESH;
+ else if(netif_file_exists(ifname, "bridge"))
+ return IF_BRIDGE;
+ else if(netif_file_exists(ifname, "tun_flags"))
+ return IF_VIRTUAL;
+ else if(netif_file_exists(ifname, "wireless"))
+ return IF_WIRELESS;
+ else
+ return IF_WIRED;
+ }
+
+ return IF_UNKNOWN;
+}
+
bool netif_is_mesh(const char *ifname) {
return netif_file_exists(ifname, "mesh");
}