Mercurial > hg > dhcpcd
changeset 16:3c6d27bf2646 draft
Fix NIS, #define RESOLVCONF and send the parameter list with DISCOVER messages
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Tue, 05 Dec 2006 09:38:10 +0000 |
| parents | 89fd24932c4d |
| children | 615b5b71bdc3 |
| files | ChangeLog configure.c dhcp.c dhcpcd.c pathnames.h |
| diffstat | 5 files changed, 33 insertions(+), 42 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon Dec 04 21:13:04 2006 +0000 +++ b/ChangeLog Tue Dec 05 09:38:10 2006 +0000 @@ -1,4 +1,5 @@ -Send hostname/fqdn in DISCOVER and INFORM messages too. +NIS setup (yp.conf / domainname) works again. +Send hostname/fqdn and our parameter list in DISCOVER and INFORM messages too. Add more debug messages. Fix writing to resolv.conf when resolvconf not present. Include linux/if_addr.h for 2.6.19+ kernels, thanks to AlexExtreme.
--- a/configure.c Mon Dec 04 21:13:04 2006 +0000 +++ b/configure.c Tue Dec 05 09:38:10 2006 +0000 @@ -100,14 +100,13 @@ { FILE *f; struct stat buf; - char resolvconf[PATH_MAX]; + char resolvconf[PATH_MAX] = {0}; address_t *address; - memset (&buf, 0, sizeof (struct stat)); - if (stat ("/sbin/resolvconf", &buf) == 0) + if (stat (RESOLVCONF, &buf) == 0) { logger (LOG_DEBUG, "sending DNS information to resolvconf"); - snprintf (resolvconf, PATH_MAX, "/sbin/resolvconf -a %s", ifname); + snprintf (resolvconf, PATH_MAX, RESOLVCONF" -a %s", ifname); f = popen (resolvconf, "w"); if (! f) @@ -132,11 +131,8 @@ for (address = dhcp->dnsservers; address; address = address->next) fprintf (f, "nameserver %s\n", inet_ntoa (address->address)); - if (buf.st_ino) - { - pclose (f); - logger (LOG_DEBUG, "resolvconf completed"); - } + if (*resolvconf) + pclose (f); else fclose (f); } @@ -152,14 +148,14 @@ { struct stat buf; - if (stat ("/sbin/resolvconf", &buf) < 0) + if (stat (RESOLVCONF, &buf) < 0) return; logger (LOG_DEBUG, "removing information from resolvconf"); char *argc[4]; - argc[0] = "/sbin/resolvconf"; + argc[0] = RESOLVCONF; argc[1] = "-d"; argc[2] = ifname; argc[3] = NULL;
--- a/dhcp.c Mon Dec 04 21:13:04 2006 +0000 +++ b/dhcp.c Tue Dec 05 09:38:10 2006 +0000 @@ -153,36 +153,27 @@ n_params = p; *p++ = 0; - /* If we don't request one item, then we get defaults back which - we don't want */ - if (type == DHCP_DISCOVER) - { - *p++ = DHCP_DNSSERVER; - } - else - { - *p++ = DHCP_RENEWALTIME; - *p++ = DHCP_REBINDTIME; - *p++ = DHCP_NETMASK; - *p++ = DHCP_BROADCAST; - *p++ = DHCP_CSR; - /* RFC 3442 states classless static routes should be before routers - * and static routes as classless static routes override them both */ - *p++ = DHCP_ROUTERS; - *p++ = DHCP_STATICROUTE; - *p++ = DHCP_HOSTNAME; - *p++ = DHCP_DNSSEARCH; - *p++ = DHCP_DNSDOMAIN; - *p++ = DHCP_DNSSERVER; - *p++ = DHCP_NISDOMAIN; - *p++ = DHCP_NISSERVER; - *p++ = DHCP_NTPSERVER; - /* These parameters were requested by dhcpcd-2.0 and earlier - but we never did anything with them */ - /* *p++ = DHCP_DEFAULTIPTTL; - *p++ = DHCP_MASKDISCOVERY; - *p++ = DHCP_ROUTERDISCOVERY; */ - } + *p++ = DHCP_RENEWALTIME; + *p++ = DHCP_REBINDTIME; + *p++ = DHCP_NETMASK; + *p++ = DHCP_BROADCAST; + *p++ = DHCP_CSR; + /* RFC 3442 states classless static routes should be before routers + * and static routes as classless static routes override them both */ + *p++ = DHCP_ROUTERS; + *p++ = DHCP_STATICROUTE; + *p++ = DHCP_HOSTNAME; + *p++ = DHCP_DNSSEARCH; + *p++ = DHCP_DNSDOMAIN; + *p++ = DHCP_DNSSERVER; + *p++ = DHCP_NISDOMAIN; + *p++ = DHCP_NISSERVER; + *p++ = DHCP_NTPSERVER; + /* These parameters were requested by dhcpcd-2.0 and earlier + but we never did anything with them */ + /* *p++ = DHCP_DEFAULTIPTTL; + *p++ = DHCP_MASKDISCOVERY; + *p++ = DHCP_ROUTERDISCOVERY; */ *n_params = p - n_params - 1;
