From: Maico Le Pape Date: Tue, 30 Jul 2013 21:10:54 +0000 (+0200) Subject: Add support for colored address in IA_NA X-Git-Tag: debian/1.1+git20160131-1~133^2~2 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=5217b2bb6c26f70f6fe570a340045a372020d06b;p=odhcp6c.git Add support for colored address in IA_NA Signed-off-by: Maico Le Pape --- diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 7f2aa1a..01d1494 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -885,6 +885,15 @@ static uint32_t dhcpv6_parse_ia(void *opt, void *end) entry.length = 128; entry.target = addr->addr; + uint16_t stype, slen; + uint8_t *sdata; + + // Find prefix class, if any + dhcpv6_for_each_option(&addr[1], odata + olen, + stype, slen, sdata) + if (stype == DHCPV6_OPT_PREFIX_CLASS && slen == 2) + entry.prefix_class = ntohs(*((uint16_t*)sdata)); + odhcp6c_update_entry(STATE_IA_NA, &entry); } diff --git a/src/script.c b/src/script.c index 3cc7e2b..74aea64 100644 --- a/src/script.c +++ b/src/script.c @@ -187,7 +187,7 @@ static void entry_to_env(const char *name, const void *data, size_t len, enum en } else { buf_len += snprintf(&buf[buf_len], 24, ",%u,%u", e[i].preferred, e[i].valid); } - if (type == ENTRY_PREFIX && e[i].prefix_class) { + if ((type == ENTRY_PREFIX || type == ENTRY_ADDRESS) && e[i].prefix_class) { buf_len += snprintf(&buf[buf_len], 12, ",class=%u", e[i].prefix_class); }