From ef9ddfbe36910afb0336375fec3cfed65a74897f Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 20 Jun 2018 15:15:07 +0200 Subject: executor: handle case when AF_INET is not enabled No AF_INET is somewhat crazy, but why not. --- executor/common_linux.h | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) (limited to 'executor') 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) -- cgit mrf-deployment