Implemented setting txqueuelen on created interface

This commit is contained in:
Mark Qvist 2020-06-01 22:25:10 +02:00
parent e7a831b41d
commit b438e5fb5a
2 changed files with 19 additions and 1 deletions

View File

@ -6,4 +6,6 @@
#define MTU_MIN 74
#define MTU_MAX 1522
#define MTU_DEFAULT 329
#define MTU_DEFAULT 329
#define TXQUEUELEN 10

16
TAP.c
View File

@ -64,6 +64,22 @@ int open_tap(void) {
exit(1);
}
// Configure TX queue length
if (ioctl(inet, SIOCGIFTXQLEN, &ifr) < 0) {
perror("Could not get interface flags from kernel");
close(inet);
cleanup();
exit(1);
} else {
ifr.ifr_qlen = TXQUEUELEN;
if (ioctl(inet, SIOCSIFTXQLEN, &ifr) < 0) {
perror("Could not set interface TX queue length");
close(inet);
cleanup();
exit(1);
}
}
if (!noup) {
if (ioctl(inet, SIOCGIFFLAGS, &ifr) < 0) {
perror("Could not get interface flags from kernel");