summaryrefslogtreecommitdiffstats
path: root/dhcpcd.c
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2009-01-12 16:39:01 +0000
committerRoy Marples <roy@marples.name>2009-01-12 16:39:01 +0000
commite467f4b21724ad4c3c9f7a3ee9af91c4385a8a88 (patch)
tree8337a6a5ba3d2bb2a4db5f23a2831fe32de2b0e4 /dhcpcd.c
parente0c05611c032b8a1e75a11aa8bdbfecf34acf785 (diff)
downloaddhcpcd-e467f4b21724ad4c3c9f7a3ee9af91c4385a8a88.tar.xz
Remove the limit for the number of connections to the control socket.
Send the dhcpcd-run-hooks enviornment to listeners on the control socket.
Diffstat (limited to 'dhcpcd.c')
-rw-r--r--dhcpcd.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/dhcpcd.c b/dhcpcd.c
index 325e4fd0..d79ff973 100644
--- a/dhcpcd.c
+++ b/dhcpcd.c
@@ -1098,14 +1098,34 @@ handle_signal(_unused void *arg)
}
int
-handle_args(int fd, int argc, char **argv)
+handle_args(struct fd_list *fd, int argc, char **argv)
{
struct interface *ifs, *ifp, *ifl, *ifn, *ift;
int do_exit = 0, do_release = 0, do_reboot = 0, opt, oi = 0;
+ char *s, *p;
+ size_t l, len;
- if (strcmp(*argv, "--version") == 0) {
- if (fd != -1) {
- write(fd, VERSION, strlen(VERSION));
+ if (fd != NULL) {
+ if (strcmp(*argv, "--version") == 0) {
+ write(fd->fd, VERSION, strlen(VERSION));
+ return 0;
+ } else if (strcmp(*argv, "--listinterfaces") == 0) {
+ l = 0;
+ for (ifp = ifaces; ifp; ifp = ifp->next)
+ l += strlen(ifp->name) + 1;
+ s = p = xmalloc(l);
+ for (ifp = ifaces; ifp; ifp = ifp->next) {
+ len = strlen(ifp->name);
+ memcpy(p, ifp->name, len);
+ p += len;
+ *p++ = ' ';
+ }
+ *--p = '\0';
+ write(fd->fd, s, l);
+ free(s);
+ return 0;
+ } else if (strcmp(*argv, "--listen") == 0) {
+ fd->listener = 1;
return 0;
}
}