diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-06-20 15:15:07 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-06-22 16:40:45 +0200 |
| commit | ef9ddfbe36910afb0336375fec3cfed65a74897f (patch) | |
| tree | 3eb68ba2494f9aefb0b3484b37db746b5354be01 /pkg/csource/linux_common.go | |
| parent | 095ef80678981c78c6726af6a3a50a7c8f667d52 (diff) | |
executor: handle case when AF_INET is not enabled
No AF_INET is somewhat crazy, but why not.
Diffstat (limited to 'pkg/csource/linux_common.go')
| -rw-r--r-- | pkg/csource/linux_common.go | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/pkg/csource/linux_common.go b/pkg/csource/linux_common.go index 2ceb0b9d4..8f293204f 100644 --- a/pkg/csource/linux_common.go +++ b/pkg/csource/linux_common.go @@ -2635,8 +2635,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); @@ -2682,8 +2688,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) @@ -2735,8 +2747,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); @@ -2771,8 +2789,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) |
