From 68300e0f9f318daf5495b5e5ee7d56ad9cff99cf Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Wed, 29 Jan 2014 11:55:40 +0100 Subject: [PATCH] Don't export IAID as class if IAID is 1 (default) --- src/odhcp6c.c | 6 ++++-- src/script.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/odhcp6c.c b/src/odhcp6c.c index abb88f6..2668d94 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -115,7 +115,7 @@ int main(_unused int argc, char* const argv[]) int prefix_length = strtoul(optarg, &iaid_begin, 10); - if (*iaid_begin != '\0' && *iaid_begin != ',') { + if (*iaid_begin != '\0' && *iaid_begin != ',' && *iaid_begin != ':') { syslog(LOG_ERR, "invalid argument: '%s'", optarg); return 1; } @@ -124,8 +124,10 @@ int main(_unused int argc, char* const argv[]) if (*iaid_begin == ',' && (iaid_len = strlen(iaid_begin)) > 1) memcpy(&prefix.iaid, iaid_begin + 1, iaid_len > 4 ? 4 : iaid_len); + else if (*iaid_begin == ':') + prefix.iaid = htonl((uint32_t)strtoul(&iaid_begin[1], NULL, 16)); else - prefix.iaid = ++ia_pd_iaid_index; + prefix.iaid = htonl(++ia_pd_iaid_index); odhcp6c_add_state(STATE_IA_PD_INIT, &prefix, sizeof(prefix)); diff --git a/src/script.c b/src/script.c index 86a9395..92bc464 100644 --- a/src/script.c +++ b/src/script.c @@ -190,7 +190,7 @@ static void entry_to_env(const char *name, const void *data, size_t len, enum en if ((type == ENTRY_PREFIX || type == ENTRY_ADDRESS) && e[i].class) buf_len += snprintf(&buf[buf_len], 12, ",class=%u", e[i].class); - else if (type == ENTRY_PREFIX) + else if (type == ENTRY_PREFIX && ntohl(e[i].iaid) != 1) buf_len += snprintf(&buf[buf_len], 16, ",class=%08x", ntohl(e[i].iaid)); if (type == ENTRY_PREFIX && e[i].priority) { -- 2.39.5