diff options
Diffstat (limited to 'osdep/LinuxNetLink.hpp')
-rw-r--r-- | osdep/LinuxNetLink.hpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/osdep/LinuxNetLink.hpp b/osdep/LinuxNetLink.hpp index 8ee42ee4..d0e83189 100644 --- a/osdep/LinuxNetLink.hpp +++ b/osdep/LinuxNetLink.hpp @@ -33,28 +33,23 @@ #include <asm/types.h> #include <linux/rtnetlink.h> #include <sys/socket.h> - +#include <linux/if.h> #include "../node/InetAddress.hpp" #include "Thread.hpp" +#include "../node/Hashtable.hpp" namespace ZeroTier { struct route_entry { - InetAddress target; - InetAddress via; - const char *iface; + InetAddress target; + InetAddress via; + int if_index; + char iface[IFNAMSIZ]; }; - typedef std::vector<route_entry> RouteList; -struct nl_req { - struct nlmsghdr nl; - struct rtmsg rt; - char buf[8192]; -}; - /** * Interface with Linux's RTNETLINK */ @@ -93,18 +88,27 @@ private: void _ipAddressAdded(struct nlmsghdr *nlp); void _ipAddressDeleted(struct nlmsghdr *nlp); - + void _requestInterfaceList(); void _requestIPv4Routes(); void _requestIPv6Routes(); Thread _t; bool _running; + RouteList _routes_ipv4; RouteList _routes_ipv6; uint32_t _seq; + struct iface_entry { + int index; + char ifacename[IFNAMSIZ]; + char mac[18]; + unsigned int mtu; + }; + Hashtable<int, iface_entry> _interfaces; + // socket communication vars; int _fd; struct sockaddr_nl _la; |