aboutsummaryrefslogtreecommitdiffstats
path: root/executor
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-06-20 15:15:07 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-06-22 16:40:45 +0200
commitef9ddfbe36910afb0336375fec3cfed65a74897f (patch)
tree3eb68ba2494f9aefb0b3484b37db746b5354be01 /executor
parent095ef80678981c78c6726af6a3a50a7c8f667d52 (diff)
executor: handle case when AF_INET is not enabled
No AF_INET is somewhat crazy, but why not.
Diffstat (limited to 'executor')
-rw-r--r--executor/common_linux.h32
1 files changed, 28 insertions, 4 deletions
diff --git a/executor/common_linux.h b/executor/common_linux.h
index fe7458d3a..abfccdd6e 100644
--- a/executor/common_linux.h
+++ b/executor/common_linux.h
@@ -1621,8 +1621,14 @@ static void checkpoint_arptables(void)
int fd;
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (fd == -1)
+ if (fd == -1) {
+ switch (errno) {
+ case EAFNOSUPPORT:
+ case ENOPROTOOPT:
+ return;
+ }
fail("socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)");
+ }
for (i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) {
struct arpt_table_desc* table = &arpt_tables[i];
strcpy(table->info.name, table->name);
@@ -1668,8 +1674,14 @@ static void reset_arptables()
int fd;
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (fd == -1)
+ if (fd == -1) {
+ switch (errno) {
+ case EAFNOSUPPORT:
+ case ENOPROTOOPT:
+ return;
+ }
fail("socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)");
+ }
for (i = 0; i < sizeof(arpt_tables) / sizeof(arpt_tables[0]); i++) {
struct arpt_table_desc* table = &arpt_tables[i];
if (table->info.valid_hooks == 0)
@@ -1721,8 +1733,14 @@ static void checkpoint_ebtables(void)
int fd;
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (fd == -1)
+ if (fd == -1) {
+ switch (errno) {
+ case EAFNOSUPPORT:
+ case ENOPROTOOPT:
+ return;
+ }
fail("socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)");
+ }
for (i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) {
struct ebt_table_desc* table = &ebt_tables[i];
strcpy(table->replace.name, table->name);
@@ -1757,8 +1775,14 @@ static void reset_ebtables()
int fd;
fd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- if (fd == -1)
+ if (fd == -1) {
+ switch (errno) {
+ case EAFNOSUPPORT:
+ case ENOPROTOOPT:
+ return;
+ }
fail("socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)");
+ }
for (i = 0; i < sizeof(ebt_tables) / sizeof(ebt_tables[0]); i++) {
struct ebt_table_desc* table = &ebt_tables[i];
if (table->replace.valid_hooks == 0)