summaryrefslogtreecommitdiffstats
path: root/net.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2013-06-07 12:44:19 +0000
committerRoy Marples <roy@marples.name>2013-06-07 12:44:19 +0000
commit336dd1b83b3cec02226dfb3048e0be895aafbd37 (patch)
tree27e574d5939a3ad2485c54cbbf0583b8dbe72031 /net.c
parentab6080a39c66505a8e990a80a66bb1a8f2ada131 (diff)
downloaddhcpcd-336dd1b83b3cec02226dfb3048e0be895aafbd37.tar.xz
Move signal handling into dhcpcd.c
Log the PID of the signal caller Move syslog functions out of the signal handler if we're not exiting as it's not safe. Close existing IPv4 sockets when restarting an interface. Fix control handling keeping current flags and accepting new ones.
Diffstat (limited to 'net.c')
-rw-r--r--net.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/net.c b/net.c
index 04b29743..ae932243 100644
--- a/net.c
+++ b/net.c
@@ -241,8 +241,6 @@ discover_interfaces(int argc, char * const *argv)
const struct sockaddr_ll *sll;
#endif
-
-
if (getifaddrs(&ifaddrs) == -1)
return NULL;
@@ -289,23 +287,23 @@ discover_interfaces(int argc, char * const *argv)
continue;
p = argv[i];
} else {
+ p = ifa->ifa_name;
/* -1 means we're discovering against a specific
* interface, but we still need the below rules
* to apply. */
if (argc == -1 && strcmp(argv[0], ifa->ifa_name) != 0)
continue;
- for (i = 0; i < ifdc; i++)
- if (!fnmatch(ifdv[i], ifa->ifa_name, 0))
- break;
- if (i < ifdc)
- continue;
- for (i = 0; i < ifac; i++)
- if (!fnmatch(ifav[i], ifa->ifa_name, 0))
- break;
- if (ifac && i == ifac)
- continue;
- p = ifa->ifa_name;
}
+ for (i = 0; i < ifdc; i++)
+ if (!fnmatch(ifdv[i], p, 0))
+ break;
+ if (i < ifdc)
+ continue;
+ for (i = 0; i < ifac; i++)
+ if (!fnmatch(ifav[i], p, 0))
+ break;
+ if (ifac && i == ifac)
+ continue;
ifp = calloc(1, sizeof(*ifp));
if (ifp == NULL)