diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-09-26 19:16:53 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2012-09-26 19:16:53 +0200 |
commit | c5a1d00fc40a9c55024cfc7f92b0a455975ba503 (patch) | |
tree | fc75f5b07b8fa696e5270de2b79ca12683351343 /ffd/netif.c | |
parent | 9eeec649fb91784d26cbfcad876cff1d6b950408 (diff) | |
download | ffd-c5a1d00fc40a9c55024cfc7f92b0a455975ba503.tar ffd-c5a1d00fc40a9c55024cfc7f92b0a455975ba503.zip |
Keep track of interfaces
Diffstat (limited to 'ffd/netif.c')
-rw-r--r-- | ffd/netif.c | 19 |
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"); } |