]> git.decadent.org.uk Git - odhcp6c.git/commitdiff
Don't export IAID as class if IAID is 1 (default)
authorSteven Barth <steven@midlink.org>
Wed, 29 Jan 2014 10:55:40 +0000 (11:55 +0100)
committerSteven Barth <steven@midlink.org>
Wed, 29 Jan 2014 10:55:40 +0000 (11:55 +0100)
src/odhcp6c.c
src/script.c

index abb88f6c52d35104980df8fa78a53dcc652998b0..2668d949bdedc9050572f3497ab06e62d04b9870 100644 (file)
@@ -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));
 
index 86a93955c2e1386acb7bb9be005e1b09c0c7ba1c..92bc46481b3bf993992916e32db9bc4785b2aa4c 100644 (file)
@@ -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) {