aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2004-08-17 00:21:13 +0000
committerGuy Harris <guy@alum.mit.edu>2004-08-17 00:21:13 +0000
commit9e2658ed78291915219fae3824e856771a6bfe95 (patch)
tree5f909376e05d60173f04ac5af5517d57d0dfbd0a /epan
parentbd2930f29e400cbf10417c6628b943d935d2ca18 (diff)
Don't give up on the entire DHCPv6 packet if we find an error in
encapsulated options, just give up on the option in which they're encapsulated. Note that for the Relay Message option, we should perhaps dissect the option data as a DHCP message, not just a sequence of options. svn path=/trunk/; revision=11756
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-dhcpv6.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/epan/dissectors/packet-dhcpv6.c b/epan/dissectors/packet-dhcpv6.c
index 42a2743436..786a734aa5 100644
--- a/epan/dissectors/packet-dhcpv6.c
+++ b/epan/dissectors/packet-dhcpv6.c
@@ -210,7 +210,7 @@ dhcpv6_option(tvbuff_t *tvb, proto_tree *bp_tree, int off, int eoff,
opttype = tvb_get_ntohs(tvb, off);
optlen = tvb_get_ntohs(tvb, off + 2);
- /* truncated case */
+ /* all option data must be present */
if (eoff - off < 4 + optlen) {
*at_end = TRUE;
return 0;
@@ -310,8 +310,10 @@ dhcpv6_option(tvbuff_t *tvb, proto_tree *bp_tree, int off, int eoff,
while ((optlen - temp_optlen) > 0) {
temp_optlen += dhcpv6_option(tvb, subtree, off+temp_optlen,
off + optlen, at_end);
- if (*at_end)
- return 0;
+ if (*at_end) {
+ /* Bad option - just skip to the end */
+ temp_optlen = optlen;
+ }
}
break;
case OPTION_IA_TA:
@@ -327,8 +329,10 @@ dhcpv6_option(tvbuff_t *tvb, proto_tree *bp_tree, int off, int eoff,
while ((optlen - temp_optlen) > 0) {
temp_optlen += dhcpv6_option(tvb, subtree, off+temp_optlen,
off + optlen, at_end);
- if (*at_end)
- return 0;
+ if (*at_end) {
+ /* Bad option - just skip to the end */
+ temp_optlen = optlen;
+ }
}
break;
case OPTION_IAADDR:
@@ -367,8 +371,10 @@ dhcpv6_option(tvbuff_t *tvb, proto_tree *bp_tree, int off, int eoff,
while ((optlen - temp_optlen) > 0) {
temp_optlen += dhcpv6_option(tvb, subtree, off+temp_optlen,
off + optlen, at_end);
- if (*at_end)
- return 0;
+ if (*at_end) {
+ /* Bad option - just skip to the end */
+ temp_optlen = optlen;
+ }
}
}
break;
@@ -410,6 +416,8 @@ dhcpv6_option(tvbuff_t *tvb, proto_tree *bp_tree, int off, int eoff,
optlen, "RELAY-MSG: malformed option");
break;
} else {
+ /* XXX - shouldn't we be dissecting a full DHCP message
+ here? */
dhcpv6_option(tvb, subtree, off, off + optlen, at_end);
if (*at_end)
return 0;
@@ -644,8 +652,10 @@ dhcpv6_option(tvbuff_t *tvb, proto_tree *bp_tree, int off, int eoff,
while ((optlen - temp_optlen) > 0) {
temp_optlen += dhcpv6_option(tvb, subtree, off+temp_optlen,
off + optlen, at_end);
- if (*at_end)
- return 0;
+ if (*at_end) {
+ /* Bad option - just skip to the end */
+ temp_optlen = optlen;
+ }
}
}
break;