diff options
-rw-r--r-- | src/firejail/checkcfg.c | 8 | ||||
-rw-r--r-- | src/fnet/main.c | 9 | ||||
-rw-r--r-- | src/fnet/veth.c | 9 |
3 files changed, 9 insertions, 17 deletions
diff --git a/src/firejail/checkcfg.c b/src/firejail/checkcfg.c index 68e93e16e..42ff31976 100644 --- a/src/firejail/checkcfg.c +++ b/src/firejail/checkcfg.c | |||
@@ -486,12 +486,4 @@ void print_compiletime_support(void) { | |||
486 | "disabled" | 486 | "disabled" |
487 | #endif | 487 | #endif |
488 | ); | 488 | ); |
489 | printf("\t- Wireless interface support is %s\n", | ||
490 | #ifdef IPVLAN_MODE_L2 | ||
491 | "enabled" | ||
492 | #else | ||
493 | "disabled" | ||
494 | #endif | ||
495 | ); | ||
496 | |||
497 | } | 489 | } |
diff --git a/src/fnet/main.c b/src/fnet/main.c index 5be15bc75..ec8b2cade 100644 --- a/src/fnet/main.c +++ b/src/fnet/main.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "fnet.h" | 20 | #include "fnet.h" |
21 | #include <sys/types.h> | 21 | #include <sys/types.h> |
22 | #include <sys/stat.h> | 22 | #include <sys/stat.h> |
23 | #include <sys/utsname.h> | ||
23 | 24 | ||
24 | int arg_quiet = 0; | 25 | int arg_quiet = 0; |
25 | 26 | ||
@@ -91,10 +92,7 @@ printf("\n"); | |||
91 | else if (argc == 6 && strcmp(argv[1], "create") == 0 && strcmp(argv[2], "macvlan") == 0) { | 92 | else if (argc == 6 && strcmp(argv[1], "create") == 0 && strcmp(argv[2], "macvlan") == 0) { |
92 | // use ipvlan for wireless devices | 93 | // use ipvlan for wireless devices |
93 | // ipvlan driver was introduced in Linux kernel 3.19 | 94 | // ipvlan driver was introduced in Linux kernel 3.19 |
94 | // detect both compile time and run time | 95 | |
95 | #ifndef IPVLAN_MODE_L2 // compile time | ||
96 | net_create_macvlan(argv[3], argv[4], atoi(argv[5])); | ||
97 | #else | ||
98 | // check kernel version | 96 | // check kernel version |
99 | struct utsname u; | 97 | struct utsname u; |
100 | int rv = uname(&u); | 98 | int rv = uname(&u); |
@@ -107,8 +105,6 @@ printf("\n"); | |||
107 | exit(1); | 105 | exit(1); |
108 | } | 106 | } |
109 | 107 | ||
110 | if (arg_debug) | ||
111 | printf("Linux kernel version %d.%d\n", major, minor); | ||
112 | if (major <= 3 && minor < 18) | 108 | if (major <= 3 && minor < 18) |
113 | net_create_macvlan(argv[3], argv[4], atoi(argv[5])); | 109 | net_create_macvlan(argv[3], argv[4], atoi(argv[5])); |
114 | else { | 110 | else { |
@@ -121,7 +117,6 @@ printf("\n"); | |||
121 | else // regular ethernet | 117 | else // regular ethernet |
122 | net_create_macvlan(argv[3], argv[4], atoi(argv[5])); | 118 | net_create_macvlan(argv[3], argv[4], atoi(argv[5])); |
123 | } | 119 | } |
124 | #endif | ||
125 | } | 120 | } |
126 | else if (argc == 7 && strcmp(argv[1], "config") == 0 && strcmp(argv[2], "interface") == 0) { | 121 | else if (argc == 7 && strcmp(argv[1], "config") == 0 && strcmp(argv[2], "interface") == 0) { |
127 | char *dev = argv[3]; | 122 | char *dev = argv[3]; |
diff --git a/src/fnet/veth.c b/src/fnet/veth.c index 36362f1c1..39a4f35d8 100644 --- a/src/fnet/veth.c +++ b/src/fnet/veth.c | |||
@@ -50,6 +50,13 @@ | |||
50 | #include <linux/veth.h> | 50 | #include <linux/veth.h> |
51 | #include <net/if.h> | 51 | #include <net/if.h> |
52 | 52 | ||
53 | // Debian Jessie and distributions before that don't have support for IPVLAN | ||
54 | // in /usr/include/linux/if_link.h. We only need a definition for IPVLAN_MODE_L2. | ||
55 | // The kernel version detection happens at run time. | ||
56 | #ifndef IFLA_IPVLAN_MAX | ||
57 | #define IPVLAN_MODE_L2 0 | ||
58 | #endif | ||
59 | |||
53 | struct iplink_req | 60 | struct iplink_req |
54 | { | 61 | { |
55 | struct nlmsghdr n; | 62 | struct nlmsghdr n; |
@@ -176,7 +183,6 @@ int net_create_macvlan(const char *dev, const char *parent, unsigned pid) { | |||
176 | return 0; | 183 | return 0; |
177 | } | 184 | } |
178 | 185 | ||
179 | #ifdef IPVLAN_MODE_L2 | ||
180 | int net_create_ipvlan(const char *dev, const char *parent, unsigned pid) { | 186 | int net_create_ipvlan(const char *dev, const char *parent, unsigned pid) { |
181 | int len; | 187 | int len; |
182 | struct iplink_req req; | 188 | struct iplink_req req; |
@@ -238,7 +244,6 @@ int net_create_ipvlan(const char *dev, const char *parent, unsigned pid) { | |||
238 | 244 | ||
239 | return 0; | 245 | return 0; |
240 | } | 246 | } |
241 | #endif | ||
242 | 247 | ||
243 | // move the interface dev in namespace of program pid | 248 | // move the interface dev in namespace of program pid |
244 | // when the interface is moved, netlink does not preserve interface configuration | 249 | // when the interface is moved, netlink does not preserve interface configuration |