Gilbert Ramirez wrote:
> Thanks. To quickly filter for DHCP packets (as opposed to BOOTP) packets,
> the easy way would be to add a new BOOTP field "bootp.dhcp", which would
> be of FT_BOOLEAN type --- true if DHCP, false if not.
>
> The other approach would be to add another protocol, "DHCP", and quickly
> determine in the BOOTP dissector whether the packet is DHCP or regular
> BOOTP, and then use the appropriate protocol. There would be a lot
> of duplication of fields between BOOTP and DHCP, however. That's why
> I'm leaning towards the "bootp.dhcp" solution. What do you think?
I agree with you with the "bootp.dhcp" solution, and I made a new patch
with
support for "bootp.dhcp" field.
I attached the new patch to this e-mail so that somebody can commit it
to
CVS.
If there is something wrong with the patch, don't hesitate to tell me.
This is a duplicate e-mail because in the previous one I forgot to
attach the patch. :(
--
Air conditioned. Do _NOT_ open Windows.
Index: ethereal/packet-bootp.c
===================================================================
RCS file: /cvsroot/ethereal/packet-bootp.c,v
retrieving revision 1.31
diff -u -r1.31 packet-bootp.c
--- packet-bootp.c 2000/05/11 08:15:00 1.31
+++ packet-bootp.c 2000/05/18 07:12:54
@@ -57,10 +57,13 @@
static int hf_bootp_server = -1;
static int hf_bootp_file = -1;
static int hf_bootp_cookie = -1;
+static int hf_bootp_dhcp = -1;
static guint ett_bootp = -1;
static guint ett_bootp_option = -1;
+static char * is_dhcp ;
+
#define UDP_PORT_BOOTPS 67
enum field_type { none, ipv4, string, toggle, yes_no, special, opaque,
@@ -299,6 +302,7 @@
}
proto_tree_add_text(bp_tree, NullTVB, voff, 3, "Option %d: %s = DHCP %s",
code, text, opt53_text[i]);
+ is_dhcp = (char *) opt53_text[i];
break;
/* Parameter Request List */
@@ -562,6 +566,8 @@
int voff, eoff; /* vender offset, end offset */
guint32 ip_addr;
+ is_dhcp = NULL;
+
if (check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, "BOOTP");
@@ -670,6 +676,13 @@
while (voff < eoff) {
voff += bootp_option(pd, bp_tree, voff, eoff);
}
+ if (is_dhcp != NULL ) {
+ if (check_col(fd, COL_PROTOCOL))
+ col_add_str(fd, COL_PROTOCOL, "DHCP");
+ if (check_col(fd, COL_INFO))
+ col_add_fstr(fd, COL_INFO, "DHCP %-8s - Trans. ID 0x%x", is_dhcp, pntohl(&pd[offset+4]) );
+ proto_tree_add_item_hidden(bp_tree, hf_bootp_dhcp, NullTVB, 0, 0, 1);
+ }
}
}
@@ -677,6 +690,10 @@
proto_register_bootp(void)
{
static hf_register_info hf[] = {
+ { &hf_bootp_dhcp,
+ { "Frame is DHCP", "bootp.dhcp", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+ "" }},
+
{ &hf_bootp_type,
{ "Message type", "bootp.type", FT_UINT8, BASE_NONE, NULL, 0x0,
"" }},