]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Propagate from the main branch:
authorguy <guy>
Wed, 16 Jun 2004 00:16:48 +0000 (00:16 +0000)
committerguy <guy>
Wed, 16 Jun 2004 00:16:48 +0000 (00:16 +0000)
revision 1.33
date: 2004/06/16 00:12:35;  author: guy;  state: Exp;  lines: +29 -4
From Shinsuke Suzuki <[email protected]>: a patch to support some DHCPv6
options.  It includes the following two features:

- decode the names of all the DHCPv6 Options defined in
  RFC3315
- support DHCPv6-Lifetime option, as defined in
  draft-ietf-dhc-lifetime-00.txt

Note that the latter doesn't have an official DHCPv6 type number, so
it's subject to change.
----------------------------
revision 1.32
date: 2004/01/21 03:53:08;  author: itojun;  state: Exp;  lines: +8 -11
use official assigned numbers for DHCPv6 prefix delegation options.
suz@kame

print-dhcp6.c

index d55193206a7bdfd98ac9d1ba9331244c9bb361a2..df0b6190129279031c8e9fc16abb551365ff2b4d 100644 (file)
  * RFC3315: DHCPv6
  * supported DHCPv6 options: 
  *  RFC3319,
- *  draft-ietf-dhc-dhcpv6-opt-dnsconfig-04.txt,
- *  draft-ietf-dhc-dhcpv6-opt-prefix-delegation-05.txt
- *  draft-ietf-dhc-dhcpv6-opt-timeconfig-02.txt,
+ *  RFC3633,
+ *  RFC3646,
+ *  draft-ietf-dhc-dhcpv6-opt-timeconfig-03.txt,
+ *  draft-ietf-dhc-lifetime-00.txt,
  */
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.27.2.4 2003-11-18 23:26:14 guy Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-dhcp6.c,v 1.27.2.5 2004-06-16 00:16:48 guy Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -133,25 +134,23 @@ struct dhcp6_relay {
 #define DH6OPT_SIP_SERVER_A 22
 #define DH6OPT_DNS 23
 #define DH6OPT_DNSNAME 24
+#define DH6OPT_IA_PD 25
+#define DH6OPT_IA_PD_PREFIX 26
 
 /*
- * The option type has not been assigned for the following options.
- * We temporarily adopt values used in the service specification document
+ * The old prefix delegation option used in the service specification document
  * (200206xx version) by NTT Communications.
- * Note that we'll change the following definitions if different type values
- * are officially assigned.
  */
 #define DH6OPT_PREFIX_DELEGATION 30
 #define DH6OPT_PREFIX_INFORMATION 31
 #define DH6OPT_PREFIX_REQUEST 32
 
 /*
- * The followings are also unassigned numbers.
- * We temporarily use values as of KAME snap 20031013.
+ * The following one is an unassigned number.
+ * We temporarily use values as of KAME snap 20040322.
  */
-#define DH6OPT_IA_PD 33
-#define DH6OPT_IA_PD_PREFIX 34
 #define DH6OPT_NTP_SERVERS 35
+#define DH6OPT_LIFETIME 36
 
 struct dhcp6opt {
        u_int16_t dh6opt_type;
@@ -199,10 +198,20 @@ dhcp6opt_name(int type)
                return "elapsed time";
        case DH6OPT_RELAY_MSG:
                return "relay message";
+       case DH6OPT_AUTH:
+               return "authentication";
+       case DH6OPT_UNICAST:
+               return "server unicast";
        case DH6OPT_STATUS_CODE:
                return "status code";
        case DH6OPT_RAPID_COMMIT:
                return "rapid commit";
+       case DH6OPT_USER_CLASS:
+               return "user class";
+       case DH6OPT_VENDOR_CLASS:
+               return "vendor class";
+       case DH6OPT_VENDOR_OPTS:
+               return "vendor-specific info";
        case DH6OPT_INTERFACE_ID:
                return "interface ID";
        case DH6OPT_RECONF_MSG:
@@ -210,11 +219,13 @@ dhcp6opt_name(int type)
        case DH6OPT_RECONF_ACCEPT:
                return "reconfigure accept";
        case DH6OPT_SIP_SERVER_D:
-               return "SIP Servers Domain";
+               return "SIP servers domain";
        case DH6OPT_SIP_SERVER_A:
-               return "SIP Servers Address";
+               return "SIP servers address";
        case DH6OPT_DNS:
                return "DNS";
+       case DH6OPT_DNSNAME:
+               return "DNS name";
        case DH6OPT_PREFIX_DELEGATION:
                return "prefix delegation";
        case DH6OPT_PREFIX_INFORMATION:
@@ -225,6 +236,8 @@ dhcp6opt_name(int type)
                return "IA_PD prefix";
        case DH6OPT_NTP_SERVERS:
                return "NTP Server";
+       case DH6OPT_LIFETIME:
+               return "lifetime";
        default:
                snprintf(genstr, sizeof(genstr), "opt_%d", type);
                return(genstr);
@@ -487,6 +500,15 @@ dhcp6opt_print(const u_char *cp, const u_char *ep)
                        }
                        printf(")");
                        break;
+               case DH6OPT_LIFETIME:
+                       if (optlen != 4) {
+                               printf(" ?)");
+                               break;
+                       }
+                       memcpy(&val32, dh6o + 1, sizeof(val32));
+                       val32 = ntohl(val32);
+                       printf(" %d)", (int)val32);
+                       break;
                default:
                        printf(")");
                        break;