From b5afadae8ed69c98f4e9e6a33dfaf570c5bd9b51 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Sun, 12 Apr 2015 09:15:22 +0200 Subject: [PATCH] Remove obsolete prefix class support Signed-off-by: Steven Barth --- src/dhcpv6.c | 23 +---------------------- src/odhcp6c.c | 4 +--- src/odhcp6c.h | 5 ----- src/ra.c | 2 +- src/script.c | 4 +--- 5 files changed, 4 insertions(+), 34 deletions(-) diff --git a/src/dhcpv6.c b/src/dhcpv6.c index 6ae6f7a..000d999 100644 --- a/src/dhcpv6.c +++ b/src/dhcpv6.c @@ -173,9 +173,6 @@ int init_dhcpv6(const char *ifname, unsigned int options, int sol_timeout) htons(DHCPV6_OPT_PD_EXCLUDE), htons(DHCPV6_OPT_SOL_MAX_RT), htons(DHCPV6_OPT_INF_MAX_RT), -#ifdef EXT_PREFIX_CLASS - htons(DHCPV6_OPT_PREFIX_CLASS), -#endif #ifdef EXT_CER_ID htons(DHCPV6_OPT_CER_ID), #endif @@ -1146,7 +1143,7 @@ static int dhcpv6_parse_ia(void *opt, void *end) // Update address IA dhcpv6_for_each_option(&ia_hdr[1], end, otype, olen, odata) { struct odhcp6c_entry entry = {IN6ADDR_ANY_INIT, 0, 0, - IN6ADDR_ANY_INIT, 0, 0, 0, 0, 0, 0}; + IN6ADDR_ANY_INIT, 0, 0, 0, 0, 0}; entry.iaid = ia_hdr->iaid; @@ -1171,14 +1168,6 @@ static int dhcpv6_parse_ia(void *opt, void *end) uint16_t stype, slen; uint8_t *sdata; -#ifdef EXT_PREFIX_CLASS - // Find prefix class, if any - dhcpv6_for_each_option(&prefix[1], odata + olen, - stype, slen, sdata) - if (stype == DHCPV6_OPT_PREFIX_CLASS && slen == 2) - entry.class = sdata[0] << 8 | sdata[1]; -#endif - // Parse PD-exclude bool ok = true; dhcpv6_for_each_option(odata + sizeof(*prefix) - 4U, @@ -1242,16 +1231,6 @@ static int dhcpv6_parse_ia(void *opt, void *end) entry.length = 128; entry.target = addr->addr; -#ifdef EXT_PREFIX_CLASS - 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.class = sdata[0] << 8 | sdata[1]; -#endif - odhcp6c_update_entry(STATE_IA_NA, &entry, 0, false); parsed_ia++; } diff --git a/src/odhcp6c.c b/src/odhcp6c.c index dce1e0e..2d82856 100644 --- a/src/odhcp6c.c +++ b/src/odhcp6c.c @@ -584,14 +584,12 @@ bool odhcp6c_update_entry(enum odhcp6c_state state, struct odhcp6c_entry *new, new->valid - x->valid < min_update_interval && new->preferred >= x->preferred && new->preferred != UINT32_MAX && - new->preferred - x->preferred < min_update_interval && - x->class == new->class) + new->preferred - x->preferred < min_update_interval) return false; x->valid = new->valid; x->preferred = new->preferred; x->t1 = new->t1; x->t2 = new->t2; - x->class = new->class; x->iaid = new->iaid; } else { odhcp6c_add_state(state, new, sizeof(*new)); diff --git a/src/odhcp6c.h b/src/odhcp6c.h index ff5b9e4..f7ddc96 100644 --- a/src/odhcp6c.h +++ b/src/odhcp6c.h @@ -65,10 +65,6 @@ enum dhcvp6_opt { DHCPV6_OPT_PD_EXCLUDE = 67, DHCPV6_OPT_SOL_MAX_RT = 82, DHCPV6_OPT_INF_MAX_RT = 83, -#ifdef EXT_PREFIX_CLASS - /* draft-bhandari-dhc-class-based-prefix, not yet standardized */ - DHCPV6_OPT_PREFIX_CLASS = EXT_PREFIX_CLASS, -#endif #ifdef EXT_CER_ID /* draft-donley-dhc-cer-id-option-03 */ DHCPV6_OPT_CER_ID = EXT_CER_ID, @@ -300,7 +296,6 @@ struct odhcp6c_entry { uint32_t preferred; uint32_t t1; uint32_t t2; - uint16_t class; uint32_t iaid; }; diff --git a/src/ra.c b/src/ra.c index 122f99e..5809fcd 100644 --- a/src/ra.c +++ b/src/ra.c @@ -274,7 +274,7 @@ bool ra_process(void) bool changed = false; uint8_t buf[1500], cmsg_buf[128]; struct nd_router_advert *adv = (struct nd_router_advert*)buf; - struct odhcp6c_entry entry = {IN6ADDR_ANY_INIT, 0, 0, IN6ADDR_ANY_INIT, 0, 0, 0, 0, 0, 0}; + struct odhcp6c_entry entry = {IN6ADDR_ANY_INIT, 0, 0, IN6ADDR_ANY_INIT, 0, 0, 0, 0, 0}; const struct in6_addr any = IN6ADDR_ANY_INIT; if (IN6_IS_ADDR_UNSPECIFIED(&lladdr)) { diff --git a/src/script.c b/src/script.c index 2c34216..f8d440f 100644 --- a/src/script.c +++ b/src/script.c @@ -163,9 +163,7 @@ static void entry_to_env(const char *name, const void *data, size_t len, enum en buf_len += snprintf(&buf[buf_len], 24, ",%u,%u", e[i].preferred, e[i].valid); } - 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 && ntohl(e[i].iaid) != 1) + 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.25.1