diff options
author | Thomas Habets <habets@google.com> | 2021-04-30 20:16:55 +0100 |
---|---|---|
committer | Thomas Habets <thomas@habets.se> | 2021-05-08 18:11:25 +0100 |
commit | c07545f90f00cae5cf2f74ab7f7e654d88b49586 (patch) | |
tree | 6ffbe00e5054e8c72b96ec7650afe6d556b65111 | |
parent | bd33f11784be07271d690f027d5839f54840fad4 (diff) | |
download | arping-macfix.tar.gz |
Try lo0 if lo doesn't workmacfix
-rw-r--r-- | src/arping.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/arping.c b/src/arping.c index d9a5037..b5ee405 100644 --- a/src/arping.c +++ b/src/arping.c @@ -629,6 +629,8 @@ strip_newline(char* s) { * If this function retries with different parameter it will preserve * the original error message and print that. * Call with recursive=0. + * + * This function may recurse to try more interfaces. */ void do_libnet_init(const char *ifname, int recursive) @@ -659,6 +661,14 @@ do_libnet_init(const char *ifname, int recursive) return; } } else if (recursive) { + switch (recursive) { + case 1: + do_libnet_init("lo0", recursive+1); + if (libnet != NULL) { + return; + } + break; + } /* Continue original execution to get that * error message. */ return; @@ -1667,7 +1677,7 @@ static libnet_t* make_temp_libnet() { char ebuf[LIBNET_ERRBUF_SIZE]; - libnet_t* l = libnet_init(LIBNET_LINK, "lo", ebuf); + libnet_t* l = libnet_init(LIBNET_LINK, NULL, ebuf); if (!l) { fprintf(stderr, "arping: libnet_init(LIBNET_LINK, lo): %s\n", ebuf); exit(EXIT_FAILURE); |