diff options
author | mlaier <mlaier@FreeBSD.org> | 2007-10-16 02:20:42 +0000 |
---|---|---|
committer | mlaier <mlaier@FreeBSD.org> | 2007-10-16 02:20:42 +0000 |
commit | 3b74598d7ea581deadb14ec8ba1c77c14295a7c8 (patch) | |
tree | 01f74f6819cfb28636e2f6d04efefacdfecafc5c /contrib/tcpdump/print-dhcp6.c | |
parent | 68a3d30d4eef678528761ead6b0743885324cdd0 (diff) | |
download | FreeBSD-src-3b74598d7ea581deadb14ec8ba1c77c14295a7c8.zip FreeBSD-src-3b74598d7ea581deadb14ec8ba1c77c14295a7c8.tar.gz |
Import of tcpdump v3.9.8
Diffstat (limited to 'contrib/tcpdump/print-dhcp6.c')
-rw-r--r-- | contrib/tcpdump/print-dhcp6.c | 122 |
1 files changed, 78 insertions, 44 deletions
diff --git a/contrib/tcpdump/print-dhcp6.c b/contrib/tcpdump/print-dhcp6.c index b304f87..9f4999d 100644 --- a/contrib/tcpdump/print-dhcp6.c +++ b/contrib/tcpdump/print-dhcp6.c @@ -32,13 +32,15 @@ * RFC3319, * RFC3633, * RFC3646, - * draft-ietf-dhc-dhcpv6-opt-timeconfig-03.txt, - * draft-ietf-dhc-lifetime-00.txt, + * RFC3898, + * RFC4075, + * RFC4242, + * RFC4280, */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.35 2004/07/06 22:16:03 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.35.2.1 2006/10/25 22:04:36 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -104,8 +106,8 @@ struct dhcp6_relay { #define DH6OPT_CLIENTID 1 #define DH6OPT_SERVERID 2 #define DH6OPT_IA_NA 3 -#define DH6OPT_IA_TMP 4 -#define DH6OPT_IADDR 5 +#define DH6OPT_IA_TA 4 +#define DH6OPT_IA_ADDR 5 #define DH6OPT_ORO 6 #define DH6OPT_PREFERENCE 7 # define DH6OPT_PREF_MAX 255 @@ -141,21 +143,18 @@ struct dhcp6_relay { #define DH6OPT_DNSNAME 24 #define DH6OPT_IA_PD 25 #define DH6OPT_IA_PD_PREFIX 26 - -/* - * The old prefix delegation option used in the service specification document - * (200206xx version) by NTT Communications. - */ -#define DH6OPT_PREFIX_DELEGATION 30 -#define DH6OPT_PREFIX_INFORMATION 31 -#define DH6OPT_PREFIX_REQUEST 32 - -/* - * The following one is an unassigned number. - * We temporarily use values as of KAME snap 20040322. - */ -#define DH6OPT_NTP_SERVERS 35 -#define DH6OPT_LIFETIME 36 +#define DH6OPT_NIS_SERVERS 27 +#define DH6OPT_NISP_SERVERS 28 +#define DH6OPT_NIS_NAME 29 +#define DH6OPT_NISP_NAME 30 +#define DH6OPT_NTP_SERVERS 31 +#define DH6OPT_LIFETIME 32 +#define DH6OPT_BCMCS_SERVER_D 33 +#define DH6OPT_BCMCS_SERVER_A 34 +#define DH6OPT_GEOCONF_CIVIC 36 +#define DH6OPT_REMOTE_ID 37 +#define DH6OPT_SUBSCRIBER_ID 38 +#define DH6OPT_CLIENT_FQDN 39 struct dhcp6opt { u_int16_t dh6opt_type; @@ -171,6 +170,14 @@ struct dhcp6_ia { u_int32_t dh6opt_ia_t2; }; +struct dhcp6_ia_addr { + u_int16_t dh6opt_ia_addr_type; + u_int16_t dh6opt_ia_addr_len; + struct in6_addr dh6opt_ia_addr_addr; + u_int32_t dh6opt_ia_addr_pltime; + u_int32_t dh6opt_ia_addr_vltime; +} __attribute__ ((__packed__)); + struct dhcp6_ia_prefix { u_int16_t dh6opt_ia_prefix_type; u_int16_t dh6opt_ia_prefix_len; @@ -205,6 +212,10 @@ dhcp6opt_name(int type) return "server ID"; case DH6OPT_IA_NA: return "IA_NA"; + case DH6OPT_IA_TA: + return "IA_TA"; + case DH6OPT_IA_ADDR: + return "IA_ADDR"; case DH6OPT_ORO: return "option request"; case DH6OPT_PREFERENCE: @@ -241,10 +252,6 @@ dhcp6opt_name(int type) return "DNS"; case DH6OPT_DNSNAME: return "DNS name"; - 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: @@ -253,6 +260,26 @@ dhcp6opt_name(int type) return "NTP Server"; case DH6OPT_LIFETIME: return "lifetime"; + case DH6OPT_NIS_SERVERS: + return "NIS server"; + case DH6OPT_NISP_SERVERS: + return "NIS+ server"; + case DH6OPT_NIS_NAME: + return "NIS domain name"; + case DH6OPT_NISP_NAME: + return "NIS+ domain name"; + case DH6OPT_BCMCS_SERVER_D: + return "BCMCS domain name"; + case DH6OPT_BCMCS_SERVER_A: + return "BCMCS server"; + case DH6OPT_GEOCONF_CIVIC: + return "Geoconf Civic"; + case DH6OPT_REMOTE_ID: + return "Remote ID"; + case DH6OPT_SUBSCRIBER_ID: + return "Subscriber ID"; + case DH6OPT_CLIENT_FQDN: + return "Client FQDN"; default: snprintf(genstr, sizeof(genstr), "opt_%d", type); return(genstr); @@ -298,9 +325,9 @@ dhcp6opt_print(const u_char *cp, const u_char *ep) size_t optlen; u_int16_t val16; u_int32_t val32; - struct in6_addr addr6; struct dhcp6_ia ia; struct dhcp6_ia_prefix ia_prefix; + struct dhcp6_ia_addr ia_addr; struct dhcp6_auth authopt; u_int authinfolen, authrealmlen; @@ -369,6 +396,29 @@ dhcp6opt_print(const u_char *cp, const u_char *ep) break; } break; + case DH6OPT_IA_ADDR: + if (optlen < sizeof(ia_addr) - 4) { + printf(" ?)"); + break; + } + memcpy(&ia_addr, (u_char *)dh6o, sizeof(ia_addr)); + printf(" %s", + ip6addr_string(&ia_addr.dh6opt_ia_addr_addr)); + ia_addr.dh6opt_ia_addr_pltime = + ntohl(ia_addr.dh6opt_ia_addr_pltime); + ia_addr.dh6opt_ia_addr_vltime = + ntohl(ia_addr.dh6opt_ia_addr_vltime); + printf(" pltime:%lu vltime:%lu", + (unsigned long)ia_addr.dh6opt_ia_addr_pltime, + (unsigned long)ia_addr.dh6opt_ia_addr_vltime); + if (optlen > sizeof(ia_addr) - 4) { + /* there are sub-options */ + dhcp6opt_print((u_char *)dh6o + + sizeof(ia_addr), + (u_char *)(dh6o + 1) + optlen); + } + printf(")"); + break; case DH6OPT_ORO: if (optlen % 2) { printf(" ?)"); @@ -526,6 +576,9 @@ dhcp6opt_print(const u_char *cp, const u_char *ep) case DH6OPT_SIP_SERVER_A: case DH6OPT_DNS: case DH6OPT_NTP_SERVERS: + case DH6OPT_NIS_SERVERS: + case DH6OPT_NISP_SERVERS: + case DH6OPT_BCMCS_SERVER_A: if (optlen % 16) { printf(" ?)"); break; @@ -535,25 +588,6 @@ dhcp6opt_print(const u_char *cp, const u_char *ep) printf(" %s", ip6addr_string(&tp[i])); printf(")"); break; - case DH6OPT_PREFIX_DELEGATION: - dhcp6opt_print((u_char *)(dh6o + 1), - (u_char *)(dh6o + 1) + optlen); - printf(")"); - break; - case DH6OPT_PREFIX_INFORMATION: - if (optlen % 21) - printf(" ?)"); - memcpy(&addr6, (u_char *)(dh6o + 1) + 5, - sizeof(addr6)); - printf(" %s/%d", ip6addr_string(&addr6), - (int)*((u_char *)(dh6o + 1) + 4)); - memcpy(&val32, dh6o + 1, sizeof(val32)); - val32 = ntohl(val32); - if (val32 == DHCP6_DURATITION_INFINITE) - printf(" lease-duration: infinite)"); - else - printf(" lease-duration: %u)", val32); - break; case DH6OPT_STATUS_CODE: if (optlen < 2) { printf(" ?)"); |