|
|
| version 1.1.1.2, 2016/10/18 13:16:10 | version 1.1.1.3, 2021/03/16 23:40:57 |
|---|---|
| Line 39 | Line 39 |
| #include "arping.h" | #include "arping.h" |
| #define UNUSED(x) (void)(x) | |
| const char * | const char * |
| arping_lookupdev(uint32_t srcip, | arping_lookupdev(uint32_t srcip, |
| uint32_t dstip, | uint32_t dstip, |
| Line 48 arping_lookupdev(uint32_t srcip, | Line 50 arping_lookupdev(uint32_t srcip, |
| struct ifaddrs *cur; | struct ifaddrs *cur; |
| const char *ret = NULL; | const char *ret = NULL; |
| int match_count = 0; /* Matching interfaces */ | int match_count = 0; /* Matching interfaces */ |
| UNUSED(srcip); | |
| /* best match */ | /* best match */ |
| in_addr_t best_mask = 0; | in_addr_t best_mask = 0; |
| in_addr_t best_addr; | |
| /* Results */ | /* Results */ |
| static char ifname[IFNAMSIZ]; | static char ifname[IFNAMSIZ]; |
| Line 92 arping_lookupdev(uint32_t srcip, | Line 94 arping_lookupdev(uint32_t srcip, |
| if (ntohl(mask) > ntohl(best_mask)) { | if (ntohl(mask) > ntohl(best_mask)) { |
| memset(ifname, 0, sizeof(ifname)); | memset(ifname, 0, sizeof(ifname)); |
| strncpy(ifname, cur->ifa_name, sizeof(ifname)-1); | strncpy(ifname, cur->ifa_name, sizeof(ifname)-1); |
| best_addr = addr; | |
| best_mask = mask; | best_mask = mask; |
| } | } |
| } | } |