added Windows support to n2n-route tool (#1023)

* added Windows support to n2n-route tool

* fixed includes

* more include fixes

* one more include addition

* more compile fixes

* wish I had a working Windows VM

* fixed some more Windows compile errors

* considered Windows-specific lib linkage

* promised to never code OS specific tools again

* removed invisible invalid characters

* where to get if_idx from

* retrieving interface index for route

* bracket...

* one more bracket...

* added optional gateway parameter to user-defined routes

* clarification

* clarification

* Windows needs special network init

* adapted waiting-for-key
This commit is contained in:
Logan oos Even
2023-02-03 17:01:57 +01:00
committed by GitHub
parent 24c1569c88
commit 2ee7dfdb98
5 changed files with 244 additions and 37 deletions
+4 -3
View File
@@ -92,8 +92,7 @@
#include <net/if_arp.h>
#include <net/if.h>
#include <linux/if_tun.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <net/route.h>
#endif /* #ifdef __linux__ */
#ifdef __FreeBSD__
@@ -108,7 +107,6 @@
#endif
#include <netinet/in.h>
#include <netinet/ip.h>
#include <netinet/udp.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
@@ -137,6 +135,9 @@
#include "n2n_typedefs.h"
#ifdef WIN32
#include <windows.h> /* for privilege check in tools/n2n-route */
#include <lmaccess.h> /* for privilege check in tools/n2n-route */
#include <lmapibuf.h> /* for privilege check in tools/n2n-route */
#include <winsock2.h> /* for tcp */
#define SHUT_RDWR SD_BOTH /* for tcp */
#include "wintap.h"