From 5217b2bb6c26f70f6fe570a340045a372020d06b Mon Sep 17 00:00:00 2001 From: Maico Le Pape Date: Tue, 30 Jul 2013 23:10:54 +0200 Subject: [PATCH] Add support for colored address in IA_NA Signed-off-by: Maico Le Pape --- src/dhcpv6.c | 9 +++++++++ src/script.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) 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); } -- 2.25.1