aboutsummaryrefslogtreecommitdiffstats
path: root/packet-bootp.c
diff options
context:
space:
mode:
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2001-12-27 23:53:10 +0000
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>2001-12-27 23:53:10 +0000
commitfb3d422ec4283b9e7ebf4b67eeb56555f71176bf (patch)
tree3715445b98ba212baef012de7956df57e5589679 /packet-bootp.c
parenta181e75c93119372670a7a95fe32e030875c27f0 (diff)
RFC 2132 says
The end option marks the end of valid information in the vendor field. Subsequent octets should be filled with pad options. rather than "must be filled with pad options", so just treat stuff after the end option as padding by marking it all as padding, rather than treating stuff after the end option as additional options, so that if it's not all pad options (bytes containing 0), we don't treat that as an error. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@4456 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'packet-bootp.c')
-rw-r--r--packet-bootp.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/packet-bootp.c b/packet-bootp.c
index 71c28d1bc9..e51cc1002e 100644
--- a/packet-bootp.c
+++ b/packet-bootp.c
@@ -2,7 +2,7 @@
* Routines for BOOTP/DHCP packet disassembly
* Gilbert Ramirez <gram@alumni.rice.edu>
*
- * $Id: packet-bootp.c,v 1.60 2001/12/27 22:49:02 guy Exp $
+ * $Id: packet-bootp.c,v 1.61 2001/12/27 23:53:10 guy Exp $
*
* The information used comes from:
* RFC 951: Bootstrap Protocol
@@ -128,7 +128,7 @@ get_dhcp_type(guint8 byte)
/* Returns the number of bytes consumed by this option. */
static int
bootp_option(tvbuff_t *tvb, proto_tree *bp_tree, int voff, int eoff,
- gboolean first_pass, const char **dhcp_type_p,
+ gboolean first_pass, gboolean *at_end, const char **dhcp_type_p,
const guint8 **vendor_class_id_p)
{
char *text;
@@ -406,6 +406,7 @@ bootp_option(tvbuff_t *tvb, proto_tree *bp_tree, int voff, int eoff,
"End Option");
}
}
+ *at_end = TRUE;
consumed = 1;
return consumed;
}
@@ -1089,6 +1090,7 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
const guint8 *haddr;
int voff, eoff, tmpvoff; /* vendor offset, end offset */
guint32 ip_addr;
+ gboolean at_end;
const char *dhcp_type = NULL;
const guint8 *vendor_class_id = NULL;
@@ -1217,8 +1219,9 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
* and Vendor class identifier options.
*/
tmpvoff = voff;
- while (tmpvoff < eoff) {
- tmpvoff += bootp_option(tvb, 0, tmpvoff, eoff, TRUE,
+ at_end = FALSE;
+ while (tmpvoff < eoff && !at_end) {
+ tmpvoff += bootp_option(tvb, 0, tmpvoff, eoff, TRUE, &at_end,
&dhcp_type, &vendor_class_id);
}
@@ -1251,10 +1254,17 @@ dissect_bootp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/*
* OK, now build the protocol tree.
*/
- while (voff < eoff) {
- voff += bootp_option(tvb, bp_tree, voff, eoff, FALSE,
+ at_end = FALSE;
+ while (voff < eoff && !at_end) {
+ voff += bootp_option(tvb, bp_tree, voff, eoff, FALSE, &at_end,
&dhcp_type, &vendor_class_id);
}
+ if (voff < eoff) {
+ /*
+ * Padding after the end option.
+ */
+ proto_tree_add_text(bp_tree, tvb, voff, eoff - voff, "Padding");
+ }
}
void