diff options
author | SUZUKI, Shinsuke <suz@kame.net> | 2005-12-11 06:10:10 +0000 |
---|---|---|
committer | SUZUKI, Shinsuke <suz@kame.net> | 2005-12-11 06:10:10 +0000 |
commit | 013e805485be9c41cf89aeaba8b30a3403287de9 (patch) | |
tree | c7bcac36159477588c140290b88065da082b4dcb | |
parent | c6b9e62f830f310df612af664c07fb63efddb39c (diff) |
* Assign an official option number for Information Refresh Timer
* Removed old prefix delegation options, since these options numbers
coinsides with Information Refresh Timer.
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | Makefile.in | 7 | ||||
-rw-r--r-- | common.c | 143 | ||||
-rw-r--r-- | dhcp6.h | 26 |
4 files changed, 11 insertions, 170 deletions
@@ -1,4 +1,9 @@ + --- 20051211 tar ball released --- +2005-12-11 SUZUKI, Shinsuke <suz@kame.net> + * Assign an official option number for Information Refresh Timer + * Removed old prefix delegation options, since these options numbers + coinsides with Information Refresh Timer. --- 20050723a tar ball released --- 2005-07-22 JINMEI, Tatuya <jinmei@isl.rdc.toshiba.co.jp> diff --git a/Makefile.in b/Makefile.in index 2d48569..e241f5d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -25,7 +25,7 @@ # SUCH DAMAGE. # -# $Id: Makefile.in,v 1.2 2005-12-11 05:52:23 suzsuz Exp $ +# $Id: Makefile.in,v 1.3 2005-12-11 06:10:10 suzsuz Exp $ # $KAME: Makefile.in,v 1.45 2005/10/16 16:25:38 suz Exp $ # @@ -53,11 +53,8 @@ mandir= @mandir@ CFLAGS+= @DHCPOPT_DNS@ @DH6OPT_DNSNAME@ \ @DH6OPT_IA_PD@ @DH6OPT_IA_PD_PREFIX@ \ - -DCONF_DH6OPT_PREFIX_DELEGATION=@dhcpopt_pdel@ \ - -DCONF_DH6OPT_PREFIX_INFORMATION=@dhcpopt_pinfo@ \ - -DCONF_DH6OPT_PREFIX_REQUEST=@dhcpopt_preq@ \ + @DH6OPT_REFRESHTIME@ \ -DCONF_DH6OPT_NTP=@dhcpopt_ntp@ \ - -DCONF_DH6OPT_REFRESHTIME=@dhcpopt_refreshtime@ GENSRCS=cfparse.c cftoken.c CLIENTOBJS= dhcp6c.o common.o config.o prefixconf.o dhcp6c_ia.o timer.o \ @@ -109,8 +109,6 @@ static int copyin_option __P((int, struct dhcp6opt *, struct dhcp6opt *, static int copy_option __P((u_int16_t, u_int16_t, void *, struct dhcp6opt **, struct dhcp6opt *, int *)); static ssize_t gethwid __P((char *, int, const char *, u_int16_t *)); -static int get_delegated_prefixes __P((char *, char *, - struct dhcp6_optinfo *)); static char *sprint_uint64 __P((char *, int, u_int64_t)); static char *sprint_auth __P((struct dhcp6_optinfo *)); @@ -1531,10 +1529,6 @@ dhcp6_get_options(p, ep, optinfo) dhcp6_clear_list(&sublist); break; - case DH6OPT_PREFIX_DELEGATION: - if (get_delegated_prefixes(cp, cp + optlen, optinfo)) - goto fail; - break; #ifdef USE_DH6OPT_REFRESHTIME case DH6OPT_REFRESHTIME: if (optlen != 4) @@ -1871,103 +1865,6 @@ copyin_option(type, p, ep, list) return (-1); } -static int -get_delegated_prefixes(p, ep, optinfo) - char *p, *ep; - struct dhcp6_optinfo *optinfo; -{ - char *np, *cp; - struct dhcp6opt opth; - struct dhcp6opt_prefix_info pi; - struct dhcp6_prefix prefix; - int optlen, opt; - - for (; p + sizeof(struct dhcp6opt) <= ep; p = np) { - /* XXX: alignment issue */ - memcpy(&opth, p, sizeof(opth)); - optlen = ntohs(opth.dh6opt_len); - opt = ntohs(opth.dh6opt_type); - - cp = p + sizeof(opth); - np = cp + optlen; - dprintf(LOG_DEBUG, "", " prefix delegation option: %s, " - "len %d", dhcp6optstr(opt), optlen); - - if (np > ep) { - dprintf(LOG_INFO, FNAME, "malformed DHCP options"); - return (-1); - } - - switch(opt) { - case DH6OPT_PREFIX_INFORMATION: - if (optlen != sizeof(pi) - 4) - goto malformed; - - memcpy(&pi, p, sizeof(pi)); - - if (pi.dh6_pi_plen > 128) { - dprintf(LOG_INFO, FNAME, - "invalid prefix length (%d)", - pi.dh6_pi_plen); - goto malformed; - } - - /* clear padding bits in the prefix address */ - prefix6_mask(&pi.dh6_pi_paddr, pi.dh6_pi_plen); - - /* copy the information into internal format */ - memset(&prefix, 0, sizeof(prefix)); - prefix.addr = pi.dh6_pi_paddr; - prefix.plen = pi.dh6_pi_plen; - /* XXX */ - prefix.vltime = ntohl(pi.dh6_pi_duration); - prefix.pltime = ntohl(pi.dh6_pi_duration); - - if (prefix.vltime != DHCP6_DURATITION_INFINITE) { - dprintf(LOG_DEBUG, "", - " prefix information: " - "%s/%d duration %lu", - in6addr2str(&prefix.addr, 0), - prefix.plen, prefix.vltime); - } else { - dprintf(LOG_DEBUG, "", - " prefix information: " - "%s/%d duration infinity", - in6addr2str(&prefix.addr, 0), - prefix.plen); - } - - if (dhcp6_find_listval(&optinfo->prefix_list, - DHCP6_LISTVAL_PREFIX6, &prefix, 0)) { - dprintf(LOG_INFO, FNAME, - "duplicated prefix (%s/%d)", - in6addr2str(&prefix.addr, 0), - prefix.plen); - goto nextoption; - } - - if (dhcp6_add_listval(&optinfo->prefix_list, - DHCP6_LISTVAL_PREFIX6, &prefix, NULL) == NULL) { - dprintf(LOG_ERR, FNAME, - "failed to copy a prefix"); - goto fail; - } - } - - nextoption: - ; - } - - return (0); - - malformed: - dprintf(LOG_INFO, - "", " malformed prefix delegation option: type %d, len %d", - opt, optlen); - fail: - return (-1); -} - static char * sprint_uint64(buf, buflen, i64) char *buf; @@ -2385,42 +2282,6 @@ dhcp6_set_options(type, optbp, optep, optinfo) len += optlen; } - if (!TAILQ_EMPTY(&optinfo->prefix_list)) { - char *tp; - struct dhcp6_listval *dp; - struct dhcp6opt_prefix_info pi; - - tmpbuf = NULL; - optlen = dhcp6_count_list(&optinfo->prefix_list) * - sizeof(struct dhcp6opt_prefix_info); - if ((tmpbuf = malloc(optlen)) == NULL) { - dprintf(LOG_ERR, FNAME, - "memory allocation failed for options"); - goto fail; - } - for (dp = TAILQ_FIRST(&optinfo->prefix_list), tp = tmpbuf; dp; - dp = TAILQ_NEXT(dp, link), tp += sizeof(pi)) { - /* - * XXX: We need a temporary structure due to alignment - * issue. - */ - memset(&pi, 0, sizeof(pi)); - pi.dh6_pi_type = htons(DH6OPT_PREFIX_INFORMATION); - pi.dh6_pi_len = htons(sizeof(pi) - 4); - pi.dh6_pi_duration = htonl(dp->val_prefix6.vltime); - pi.dh6_pi_plen = dp->val_prefix6.plen; - memcpy(&pi.dh6_pi_paddr, &dp->val_prefix6.addr, - sizeof(struct in6_addr)); - memcpy(tp, &pi, sizeof(pi)); - } - if (copy_option(DH6OPT_PREFIX_DELEGATION, optlen, tmpbuf, &p, - optep, &len) != 0) { - goto fail; - } - free(tmpbuf); - - } - if (optinfo->relaymsg_len) { if (copy_option(DH6OPT_RELAY_MSG, optinfo->relaymsg_len, optinfo->relaymsg_msg, &p, optep, &len) != 0) { @@ -3001,10 +2862,6 @@ dhcp6optstr(type) case DH6OPT_NTP: return ("NTP server"); #endif - case DH6OPT_PREFIX_DELEGATION: - return ("prefix delegation"); - case DH6OPT_PREFIX_INFORMATION: - return ("prefix information"); case DH6OPT_IA_PD: return ("IA_PD"); case DH6OPT_IA_PD_PREFIX: @@ -286,25 +286,16 @@ struct dhcp6_relay { #ifndef DH6OPT_IA_PD_PREFIX #define DH6OPT_IA_PD_PREFIX 26 #endif - -/* - * The old prefix delegation option used in the service specification document - * (200206xx version) by NTT Communications. - */ -#define DH6OPT_PREFIX_DELEGATION CONF_DH6OPT_PREFIX_DELEGATION -#define DH6OPT_PREFIX_INFORMATION CONF_DH6OPT_PREFIX_INFORMATION -#define DH6OPT_PREFIX_REQUEST CONF_DH6OPT_PREFIX_REQUEST +#ifndef DH6OPT_REFRESHTIME +#define DH6OPT_REFRESHTIME 32 + #define DH6OPT_REFRESHTIME_UNDEF -1 +#endif /* The followings are KAME specific. */ #if CONF_DH6OPT_NTP > 0 #define USE_DH6OPT_NTP #endif #define DH6OPT_NTP CONF_DH6OPT_NTP -#if CONF_DH6OPT_REFRESHTIME > 0 -#define USE_DH6OPT_REFRESHTIME -#endif -#define DH6OPT_REFRESHTIME CONF_DH6OPT_REFRESHTIME -# define DH6OPT_REFRESHTIME_UNDEF -1 struct dhcp6opt { u_int16_t dh6opt_type; @@ -327,15 +318,6 @@ struct dhcp6opt_stcode { u_int16_t dh6_stcode_code; } __attribute__ ((__packed__)); -/* Prefix Information */ -struct dhcp6opt_prefix_info { - u_int16_t dh6_pi_type; - u_int16_t dh6_pi_len; - u_int32_t dh6_pi_duration; - u_int8_t dh6_pi_plen; - struct in6_addr dh6_pi_paddr; -} __attribute__ ((__packed__)); - /* * General format of Identity Association. * This format applies to Prefix Delegation (IA_PD) and Non-temporary Addresses |