summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-dhcpv6.c
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2010-05-26 21:10:02 +0000
committerJaap Keuter <jaap.keuter@xs4all.nl>2010-05-26 21:10:02 +0000
commita541950ca80207eb50ad0cb7cee29a384e76d2b0 (patch)
treec134a9e88a3259c3afb3e01c87304e2c581cb650 /epan/dissectors/packet-dhcpv6.c
parent074b9660b64302b5bdb8696e1fd5d6aabedd30a0 (diff)
downloadwireshark-a541950ca80207eb50ad0cb7cee29a384e76d2b0.tar.gz
From Hadar Shoham:
Change DHCPv6 option 17.8 to be the same as BOOTP option 43.8 CableLabs specs treat 43.8\17.8 inconsistently as either binary (3 byte) or string (6 byte) Additional cleanup and extension of interface ID presentation by me. svn path=/trunk/; revision=32982
Diffstat (limited to 'epan/dissectors/packet-dhcpv6.c')
-rw-r--r--epan/dissectors/packet-dhcpv6.c53
1 files changed, 42 insertions, 11 deletions
diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c
index a6be1191f1..2cf66277e8 100644
--- a/epan/dissectors/packet-dhcpv6.c
+++ b/epan/dissectors/packet-dhcpv6.c
@@ -51,6 +51,7 @@
#include <epan/packet.h>
#include <epan/sminmpec.h>
#include <epan/strutil.h>
+#include <epan/arptypes.h>
#include "packet-arp.h"
static int proto_dhcpv6 = -1;
@@ -810,12 +811,26 @@ dissect_cablelabs_specific_opts(proto_tree *v_tree, tvbuff_t *tvb, int voff, int
case CL_OPTION_VENDOR_NAME :
case CL_OPTION_CONFIG_FILE_NAME :
case CL_OPTION_EMBEDDED_COMPONENT_LIST :
- case CL_OPTION_VENDOR_OUI :
opt_len = tlv_len;
field_len = tlv_len;
proto_item_append_text(ti, "\"%s\"",
tvb_format_stringzpad(tvb, sub_off, field_len));
break;
+
+ case CL_OPTION_VENDOR_OUI :
+ /* CableLabs specs treat 17.8 inconsistently
+ * as either binary (3b) or string (6b) */
+ opt_len = tlv_len;
+ if (tlv_len == 3) {
+ proto_item_append_text(ti, "%s",
+ bytes_to_str_punct(tvb_get_ptr(tvb, sub_off, 3), 3, ':'));
+ } else if (tlv_len == 6) {
+ proto_item_append_text(ti, "\"%s\"", tvb_format_stringzpad(tvb, sub_off, tlv_len));
+ } else {
+ proto_item_append_text(ti, "Suboption %d: suboption length isn't 3 or 6", type);
+ }
+ break;
+
case CL_OPTION_ORO :
field_len = 2;
opt_len = tlv_len;
@@ -1094,7 +1109,8 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
off += 4;
/* Right now, none of the options can be filtered at, so provide a hex
array for minimalistic filtering */
- proto_tree_add_item(subtree, hf_option_value, tvb, off, optlen, FALSE);
+ if (optlen)
+ proto_tree_add_item(subtree, hf_option_value, tvb, off, optlen, FALSE);
switch (opttype) {
case OPTION_CLIENTID:
@@ -1412,14 +1428,33 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
}
break;
case OPTION_INTERFACE_ID:
+ {
+ gint namelen;
+
if (optlen == 0) {
proto_tree_add_text(subtree, tvb, off,
optlen, "INTERFACE_ID: malformed option");
break;
}
- buf = tvb_get_ephemeral_string(tvb, off, optlen);
- proto_tree_add_text(subtree, tvb, off, optlen, "Interface-ID: %s", buf);
- break;
+
+ namelen = tvb_strnlen(tvb, off, optlen)+1;
+ if (namelen == 0)
+ {
+ buf = tvb_get_ephemeral_string(tvb, off, optlen);
+ proto_tree_add_text(subtree, tvb, off, optlen, "Interface-ID: %s", buf);
+ } else {
+ buf = tvb_get_ephemeral_string(tvb, off, namelen-1);
+ proto_tree_add_text(subtree, tvb, off, namelen, "Interface-ID: %s", buf);
+
+ temp_optlen = optlen - namelen;
+ off += namelen;
+ if (temp_optlen >= 6)
+ proto_tree_add_text(subtree, tvb, off,
+ temp_optlen, "Link-layer address: %s",
+ arphrdaddr_to_str(tvb_get_ptr(tvb, off, 6), 6, ARPHRD_ETHER));
+ }
+ }
+ break;
case OPTION_RECONF_MSG:
if (optlen != 1) {
proto_tree_add_text(subtree, tvb, off,
@@ -1587,12 +1622,8 @@ dhcpv6_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *bp_tree,
proto_tree_add_item(subtree, hf_clientfqdn_n, tvb, off, 1, FALSE);
proto_tree_add_item(subtree, hf_clientfqdn_o, tvb, off, 1, FALSE);
proto_tree_add_item(subtree, hf_clientfqdn_s, tvb, off, 1, FALSE);
-#if 0
- proto_tree_add_text(subtree, tvb, off, 1,
- "flags: %d",
- (guint32)tvb_get_guint8(tvb, off));
-#endif
- dhcpv6_domain(subtree, tvb, off-1, optlen+1);
+
+ dhcpv6_domain(subtree, tvb, off-1, optlen-1);
}
break;
case OPTION_PANA_AGENT: