]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
Add RFC4833 support for TimeZone options.
authorRoy Marples <roy@marples.name>
Fri, 3 May 2013 13:38:54 +0000 (13:38 +0000)
committerRoy Marples <roy@marples.name>
Fri, 3 May 2013 13:38:54 +0000 (13:38 +0000)
dhcp.c
dhcp6.c
dhcp6.h
dhcpcd-hooks/Makefile
dhcpcd.8.in

diff --git a/dhcp.c b/dhcp.c
index 3b24bda7dfd5ab9ae2077f2c0ab0bcce973c3973..67bb766351a2545a73bd995b4122b858e8f87f68 100644 (file)
--- a/dhcp.c
+++ b/dhcp.c
@@ -190,6 +190,8 @@ const struct dhcp_opt const dhcp_opts[] = {
        { 91,   UINT32,         "client_last_transaction_time" },
        { 92,   IPV4A,          "associated_ip" },
        { 98,   STRING,         "uap_servers" },
+       { 100,  STRING,         "posix_timezone" },
+       { 101,  STRING,         "tzdb_timezone" },
        { 112,  IPV4A,          "netinfo_server_address" },
        { 113,  STRING,         "netinfo_server_tag" },
        { 114,  STRING,         "default_url" },
diff --git a/dhcp6.c b/dhcp6.c
index 1adeb4566c4f40c08e7e7f129fe1f95526abf441..13216bc57f6b549f933b69993c7ccc2be052b9e5 100644 (file)
--- a/dhcp6.c
+++ b/dhcp6.c
@@ -120,6 +120,8 @@ const struct dhcp_opt const dhcp6_opts[] = {
        { D6_OPTION_INFO_REFRESH_TIME,  UINT32,         "info_refresh_time" },
        { D6_OPTION_BCMS_SERVER_D,      RFC3397,        "bcms_server_d" },
        { D6_OPTION_BCMS_SERVER_A,      IPV6A,          "bcms_server_a" },
+       { D6_OPTION_POSIX_TIMEZONE,     STRING,         "posix_timezone" },
+       { D6_OPTION_TZDB_TIMEZONE,      STRING,         "tzdb_timezone" },
        { 0, 0, NULL }
 };
 
@@ -379,10 +381,9 @@ dhcp6_makemessage(struct interface *ifp)
        si = NULL;
        if (state->state != DH6S_RELEASE) {
                for (opt = dhcp6_opts; opt->option; opt++) {
-                       if (!(opt->type & REQUEST ||
-                           has_option_mask(ifo->requestmask6, opt->option)))
-                               continue;
-                       len += sizeof(*u16);
+                       if (opt->type & REQUEST ||
+                           has_option_mask(ifo->requestmask6, opt->option))
+                               len += sizeof(*u16);
                }
                if (len == 0)
                        len = sizeof(*u16) * 2;
@@ -567,11 +568,12 @@ dhcp6_makemessage(struct interface *ifp)
                o->len = 0;
                u16 = (uint16_t *)(void *)D6_OPTION_DATA(o);
                for (opt = dhcp6_opts; opt->option; opt++) {
-                       if (!(opt->type & REQUEST ||
-                           has_option_mask(ifo->requestmask6, opt->option)))
-                               continue;
-                       *u16++ = htons(opt->option);
-                       o->len += sizeof(*u16);
+                       if (opt->type & REQUEST ||
+                           has_option_mask(ifo->requestmask6, opt->option))
+                       {
+                               *u16++ = htons(opt->option);
+                               o->len += sizeof(*u16);
+                       }
                }
                if (o->len == 0) {
                        *u16++ = htons(D6_OPTION_DNS_SERVERS);
diff --git a/dhcp6.h b/dhcp6.h
index 861ca1cfd9fddf3223d3c68d97e7a4e6aae7b886..282b8375ef1065362e8d685cf240533ca5bfbb44 100644 (file)
--- a/dhcp6.h
+++ b/dhcp6.h
@@ -77,6 +77,8 @@
 #define D6_OPTION_INFO_REFRESH_TIME    32
 #define D6_OPTION_BCMS_SERVER_D                33
 #define D6_OPTION_BCMS_SERVER_A                34
+#define D6_OPTION_POSIX_TIMEZONE       41
+#define D6_OPTION_TZDB_TIMEZONE                42
 
 #include "dhcp.h"
 #include "ipv6.h"
index 7563d2d844f1558721ce26af610aeff90add2f95..acd1c182405720d2406a8c68ca893bd17381cf83 100644 (file)
@@ -4,7 +4,8 @@ include ${TOP}/config.mk
 
 SCRIPTSDIR=    ${LIBEXECDIR}/dhcpcd-hooks
 SCRIPTS=       01-test 02-dump
-SCRIPTS+=      10-mtu 20-resolv.conf 29-lookup-hostname 30-hostname
+SCRIPTS+=      10-mtu 15-timezone 20-resolv.conf
+SCRIPTS+=      29-lookup-hostname 30-hostname
 SCRIPTS+=      ${HOOKSCRIPTS}
 
 all:
index 83fd715fc007644c7a06100175cd3be39ca0dfb2..3e943b06d8b8b99b74d02fbd3fc4b14edf9ad060 100644 (file)
@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd April 5, 2013
+.Dd May 3, 2013
 .Dt DHCPCD 8
 .Os
 .Sh NAME
@@ -605,7 +605,7 @@ running on the
 .Sh STANDARDS
 RFC 951, RFC 1534, RFC 2131, RFC 2132, RFC 2855, RFC 3004, RFC 3315,RFC 3361,
 RFC 3633, RFC 3396, RFC 3397, RFC 3442, RFC 3927, RFC 4361, RFC 4390, RFC 4702, 
-RFC 4861, RFC 5227, RFC 5969, RFC 6106.
+RFC 4861, RFC 4833, RFC 5227, RFC 5969, RFC 6106.
 .Sh AUTHORS
 .An Roy Marples Aq roy@marples.name
 .Sh BUGS