Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.2:ARM
dhcpcd
dhcpcd-3.2.3-ntp-runtime-servers.diff
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File dhcpcd-3.2.3-ntp-runtime-servers.diff of Package dhcpcd
diff -u dhcpcd-3.2.3-more-params//configure.c dhcpcd-3.2.3-ntp-runtime-servers/configure.c --- dhcpcd-3.2.3-more-params//configure.c 2008-09-03 11:19:39.000000000 +0200 +++ dhcpcd-3.2.3-ntp-runtime-servers/configure.c 2008-09-03 11:22:23.000000000 +0200 @@ -266,6 +266,41 @@ } #ifdef ENABLE_NTP +#ifdef NTP_RUNTIME_SERVERS +static int make_runtime_ntp (const char *ifname, const dhcp_t *dhcp) +{ + int retval = 0; + address_t *address; + char *b; + char servers[4096] = {'\0'}; + char buf_pid[16]; + char file[1024]; + FILE *f; + + b = servers; + snprintf(buf_pid, sizeof(buf_pid), "%d", getpid()); + snprintf(file, sizeof(file), NTP_RUNTIME_SERVERS,ifname); + logger (LOG_DEBUG, "ntp server file %s: %s", file, strerror (errno)); + + if (! (f = fopen (file, "w"))) + { + logger (LOG_ERR, "fopen `%s': %s", file, strerror (errno)); + return -1; + } + + char ipaddr4[INET_ADDRSTRLEN] = {'\0'}; + + STAILQ_FOREACH (address, dhcp->ntpservers, entries) + { + if(inet_ntop(AF_INET, address, ipaddr4, sizeof(ipaddr4))) { snprintf(servers + strlen(servers), sizeof(servers) - strlen(servers), "%s%s", (*servers ? " " : ""), ipaddr4); } + } + fprintf(f,NTP_RUNTIME_INFO,buf_pid,servers); + fclose(f); + retval = exec_cmd("/etc/init.d/ntp", "try-restart", (char *) NULL); + return retval; +} +#else + static int _make_ntp (const char *file, const char *ifname, const dhcp_t *dhcp) { FILE *f; @@ -397,6 +433,7 @@ return (retval); } #endif +#endif #ifdef ENABLE_NIS #define PREFIXSIZE 256 @@ -750,8 +787,12 @@ #ifdef ENABLE_NTP if (options->dontp && dhcp->ntpservers) +#ifdef NTP_RUNTIME_SERVERS + make_runtime_ntp(iface->name, dhcp); +#else make_ntp(iface->name, dhcp); #endif +#endif #ifdef ENABLE_NIS if (options->donis && (dhcp->nisservers || dhcp->nisdomain)) diff -u dhcpcd-3.2.3-more-params//configure.h dhcpcd-3.2.3-ntp-runtime-servers/configure.h --- dhcpcd-3.2.3-more-params//configure.h 2008-02-25 09:28:19.000000000 +0100 +++ dhcpcd-3.2.3-ntp-runtime-servers/configure.h 2008-09-03 11:24:24.000000000 +0200 @@ -32,6 +32,21 @@ #include "interface.h" #include "dhcp.h" +#define NTP_RUNTIME_SERVERS "/var/run/ntp/servers.%s" + +#define NTP_RUNTIME_INFO "### BEGIN INFO\n\ +#\n\ +# Modified_by: dhcpcd\n\ +# Process: /sbin/dhcpcd\n\ +# Process_id: %s\n\ +#\n\ +# Info: This is a temporary autogenerated config by the NTP init script.\n\ +# In the case of a restart these infomrmations are used to\n\ +# configure ntpd during runtime.\n\ +### END INFO\n\ +RUNTIME_SERVERS=\"%s\"\n\ +" + int configure (const options_t *options, interface_t *iface, const dhcp_t *dhcp, bool up);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor