From c9f737197cb40bd7070a263a1d5294ece32ffbf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Wed, 5 Oct 2016 09:49:14 +0000 Subject: [PATCH] Remove multiqueue (not used with mud) --- src/main.c | 3 +-- src/tun.c | 31 ++++++++++--------------------- src/tun.h | 2 +- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/src/main.c b/src/main.c index affc589..08e1e2f 100644 --- a/src/main.c +++ b/src/main.c @@ -266,7 +266,6 @@ int main (int argc, char **argv) { "dev", &dev, option_str }, { "mtu", &mtu, option_long }, { "keyfile", &keyfile, option_str }, - { "multiqueue", NULL, option_option }, { "statefile", &statefile, option_str }, { "timeout", >.timeout, option_long }, { "time-tolerance", &time_tolerance, option_long }, @@ -318,7 +317,7 @@ int main (int argc, char **argv) char *tun_name = NULL; - int tun_fd = tun_create(dev, &tun_name, option_is_set(opts, "multiqueue")); + int tun_fd = tun_create(dev, &tun_name); if (tun_fd==-1) { gt_log("couldn't create tun device\n"); diff --git a/src/tun.c b/src/tun.c index 6c9d617..d1a8542 100644 --- a/src/tun.c +++ b/src/tun.c @@ -28,7 +28,7 @@ #ifdef __APPLE__ -static int tun_create_by_id (char *name, size_t size, unsigned id, _unused_ int mq) +static int tun_create_by_id (char *name, size_t size, unsigned id) { int fd = socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL); @@ -63,21 +63,21 @@ static int tun_create_by_id (char *name, size_t size, unsigned id, _unused_ int return fd; } -static int tun_create_by_name (char *name, size_t size, char *dev_name, int mq) +static int tun_create_by_name (char *name, size_t size, char *dev_name) { unsigned id = 0; if (sscanf(dev_name, "utun%u", &id)!=1) return -1; - return tun_create_by_id(name, size, id, mq); + return tun_create_by_id(name, size, id); } #else /* not __APPLE__ */ #ifdef __linux__ -static int tun_create_by_name (char *name, size_t size, char *dev_name, int mq) +static int tun_create_by_name (char *name, size_t size, char *dev_name) { int fd = open("/dev/net/tun", O_RDWR); @@ -88,12 +88,6 @@ static int tun_create_by_name (char *name, size_t size, char *dev_name, int mq) .ifr_flags = IFF_TUN|IFF_NO_PI, }; - if (mq) { -#ifdef IFF_MULTI_QUEUE - ifr.ifr_flags |= IFF_MULTI_QUEUE; -#endif - } - str_cpy(ifr.ifr_name, dev_name, IFNAMSIZ-1); if (ioctl(fd, TUNSETIFF, &ifr)) { @@ -108,7 +102,7 @@ static int tun_create_by_name (char *name, size_t size, char *dev_name, int mq) #else /* not __linux__ not __APPLE__ */ -static int tun_create_by_name (char *name, size_t size, char *dev_name, _unused_ int mq) +static int tun_create_by_name (char *name, size_t size, char *dev_name) { char path[64]; @@ -120,32 +114,27 @@ static int tun_create_by_name (char *name, size_t size, char *dev_name, _unused_ #endif /* not __APPLE__ */ -static int tun_create_by_id (char *name, size_t size, unsigned id, int mq) +static int tun_create_by_id (char *name, size_t size, unsigned id) { char dev_name[64]; snprintf(dev_name, sizeof(dev_name), "tun%u", id); - return tun_create_by_name(name, size, dev_name, mq); + return tun_create_by_name(name, size, dev_name); } #endif -int tun_create (char *dev_name, char **ret_name, int mq) +int tun_create (char *dev_name, char **ret_name) { char name[64] = {0}; int fd = -1; -#ifndef IFF_MULTI_QUEUE - if (mq) - gt_na("IFF_MULTI_QUEUE"); -#endif - if (str_empty(dev_name)) { for (unsigned id=0; id<32 && fd==-1; id++) - fd = tun_create_by_id(name, sizeof(name), id, mq); + fd = tun_create_by_id(name, sizeof(name), id); } else { - fd = tun_create_by_name(name, sizeof(name), dev_name, mq); + fd = tun_create_by_name(name, sizeof(name), dev_name); } if (fd!=-1 && ret_name) diff --git a/src/tun.h b/src/tun.h index 0a92a9c..bb5e8cb 100644 --- a/src/tun.h +++ b/src/tun.h @@ -2,7 +2,7 @@ #include -int tun_create (char *, char **, int); +int tun_create (char *, char **); ssize_t tun_read (int, void *, size_t); ssize_t tun_write (int, const void *, size_t); int tun_set_mtu (char *, int);