diff options
author | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2010-11-03 03:12:11 +0100 |
---|---|---|
committer | Håkon Nessjøen <haakon.nessjoen@gmail.com> | 2010-11-03 03:12:11 +0100 |
commit | 749229fa367aed0bb14822a4e2fbbf112d06033e (patch) | |
tree | c8a5167ee358912057d4edd7334218a122f73918 | |
parent | 1c11ee970aaa1dde00028508517e2f8964cd54ea (diff) | |
download | MAC-Telnet-749229fa367aed0bb14822a4e2fbbf112d06033e.tar.gz MAC-Telnet-749229fa367aed0bb14822a4e2fbbf112d06033e.zip |
Skip loopback interfaces. They seldom/never have a MAC address, and you probably won't run a MAC-Telnet server there. Speeds up autodetect.
-rw-r--r-- | mactelnet.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mactelnet.c b/mactelnet.c index 762d7b5..7f60712 100644 --- a/mactelnet.c +++ b/mactelnet.c @@ -247,6 +247,11 @@ int findInterface() { while (success = getIps(devicename, 128, &myip)) { char str[INET_ADDRSTRLEN]; + /* Skip loopback interfaces */ + if (memcmp("lo", devicename, 2) == 0) { + continue; + } + inet_ntop(AF_INET, &(myip.sin_addr), str, INET_ADDRSTRLEN); /* Initialize receiving socket on the device chosen */ |