Add make-manuf, a script that:
[metze/wireshark/wip.git] / packet-bootp.c
index 80d4073b08f445251113faa58da45467374ea593..2f70c589e9fc6293589b800d5a2cdde0c3646b70 100644 (file)
@@ -2,12 +2,16 @@
  * Routines for BOOTP/DHCP packet disassembly
  * Gilbert Ramirez <gram@xiexie.org>
  *
- * $Id: packet-bootp.c,v 1.36 2000/07/09 22:46:53 guy Exp $
+ * $Id: packet-bootp.c,v 1.42 2000/11/19 08:53:55 guy Exp $
  *
  * The information used comes from:
- * RFC 2132: DHCP Options and BOOTP Vendor Extensions
+ * RFC  951: Bootstrap Protocol
  * RFC 1542: Clarifications and Extensions for the Bootstrap Protocol
  * RFC 2131: Dynamic Host Configuration Protocol
+ * RFC 2132: DHCP Options and BOOTP Vendor Extensions
+ * RFC 2489: Procedure for Defining New DHCP Options
+ * BOOTP and DHCP Parameters
+ *     http://www.isi.edu/in-notes/iana/assignments/bootp-dhcp-parameters
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -37,6 +41,7 @@
 # include <sys/types.h>
 #endif
 
+#include <string.h>
 #include <glib.h>
 #include "packet.h"
 #include "packet-arp.h"
@@ -74,7 +79,7 @@ struct opt_info {
        enum field_type ftype;
 };
 
-#define NUM_OPT_INFOS 77
+#define NUM_OPT_INFOS 128
 #define NUM_O63_SUBOPTS 11
 
 static int dissect_netware_ip_suboption(proto_tree *v_tree, const u_char *pd,
@@ -201,7 +206,58 @@ bootp_option(const u_char *pd, proto_tree *bp_tree, int voff, int eoff)
                /*  73 */ { "Default Finger Server",                            ipv4 },
                /*  74 */ { "Default IRC Server",                                       ipv4 },
                /*  75 */ { "StreetTalk Server",                                        ipv4 },
-               /*  76 */ { "StreetTalk Directory Assistance Server", ipv4 }
+               /*  76 */ { "StreetTalk Directory Assistance Server", ipv4 },
+               /*  77 */ { "User Class Information",                           opaque },
+               /*  78 */ { "Directory Agent Information",                      opaque },
+               /*  79 */ { "Service Location Agent Scope",                     opaque },
+               /*  80 */ { "Naming Authority",                                         opaque },
+               /*  81 */ { "Client Fully Qualified Domain Name",       opaque },
+               /*  82 */ { "Agent Circuit ID",                                         opaque },
+               /*  83 */ { "Agent Remote ID",                                          opaque },
+               /*  84 */ { "Agent Subnet Mask",                                        opaque },
+               /*  85 */ { "Novell Directory Services Servers",        opaque },
+               /*  86 */ { "Novell Directory Services Tree Name",      opaque },
+               /*  87 */ { "Novell Directory Services Context",        opaque },
+               /*  88 */ { "IEEE 1003.1 POSIX Timezone",                       opaque },
+               /*  89 */ { "Fully Qualified Domain Name",                      opaque },
+               /*  90 */ { "Authentication",                                           opaque },
+               /*  91 */ { "Vines TCP/IP Server Option",                       opaque },
+               /*  92 */ { "Server Selection Option",                          opaque },
+               /*  93 */ { "Client System Architecture",                       opaque },
+               /*  94 */ { "Client Network Device Interface",          opaque },
+               /*  95 */ { "Lightweight Directory Access Protocol",    opaque },
+               /*  96 */ { "IPv6 Transitions",                                         opaque },
+               /*  97 */ { "UUID/GUID-based Client Identifier",        opaque },
+               /*  98 */ { "Open Group's User Authentication",         opaque },
+               /*  99 */ { "Unassigned",                                                       opaque },
+               /* 100 */ { "Printer Name",                                                     opaque },
+               /* 101 */ { "MDHCP multicast address",                          opaque },
+               /* 102 */ { "Removed/unassigned",                                       opaque },
+               /* 103 */ { "Removed/unassigned",                                       opaque },
+               /* 104 */ { "Removed/unassigned",                                       opaque },
+               /* 105 */ { "Removed/unassigned",                                       opaque },
+               /* 106 */ { "Removed/unassigned",                                       opaque },
+               /* 107 */ { "Removed/unassigned",                                       opaque },
+               /* 108 */ { "Swap Path Option",                                         opaque },
+               /* 109 */ { "Unassigned",                                                       opaque },
+               /* 110 */ { "IPX Compability",                                          opaque },
+               /* 111 */ { "Unassigned",                                                       opaque },
+               /* 112 */ { "Netinfo Parent Server Address",            opaque },
+               /* 113 */ { "Netinfo Parent Server Tag",                        opaque },
+               /* 114 */ { "URL",                                                                      opaque },
+               /* 115 */ { "DHCP Failover Protocol",                           opaque },
+               /* 116 */ { "DHCP Auto-Configuration",                          opaque },
+               /* 117 */ { "Unassigned",                                                       opaque },
+               /* 118 */ { "Unassigned",                                                       opaque },
+               /* 119 */ { "Unassigned",                                                       opaque },
+               /* 120 */ { "Unassigned",                                                       opaque },
+               /* 121 */ { "Unassigned",                                                       opaque },
+               /* 122 */ { "Unassigned",                                                       opaque },
+               /* 123 */ { "Unassigned",                                                       opaque },
+               /* 124 */ { "Unassigned",                                                       opaque },
+               /* 125 */ { "Unassigned",                                                       opaque },
+               /* 126 */ { "Extension",                                                        opaque },
+               /* 127 */ { "Extension",                                                        opaque }
        };
 
        /* Options whose length isn't "vlen + 2". */
@@ -567,10 +623,12 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
        guint32         ip_addr;
        const char      *dhcp_type;
 
+       OLD_CHECK_DISPLAY_AS_DATA(proto_bootp, pd, offset, fd, tree);
+
        dhcp_type = NULL;
 
        if (check_col(fd, COL_PROTOCOL))
-               col_add_str(fd, COL_PROTOCOL, "BOOTP");
+               col_set_str(fd, COL_PROTOCOL, "BOOTP");
 
        if (check_col(fd, COL_INFO)) {
                if (pd[offset] == 1) {
@@ -579,7 +637,7 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
                                        pd[offset+2], pd[offset+1]));
                }
                else {
-                       col_add_str(fd, COL_INFO, "Boot Reply");
+                       col_set_str(fd, COL_INFO, "Boot Reply");
                }
        }
 
@@ -631,8 +689,8 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
                                                                     pd[offset+2], pd[offset+1]));
                }
                else {
-                       proto_tree_add_bytes(bp_tree, hf_bootp_hw_addr, NullTVB, 
-                                                  offset + 28, 0, NULL);
+                       proto_tree_add_text(bp_tree,  NullTVB, 
+                                                  offset + 28, 0, "Client address not given");
                }
 
                /* The server host name is optional */
@@ -688,7 +746,7 @@ dissect_bootp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
        }
        if (dhcp_type != NULL ) {
                if (check_col(fd, COL_PROTOCOL))
-                       col_add_str(fd, COL_PROTOCOL, "DHCP");
+                       col_set_str(fd, COL_PROTOCOL, "DHCP");
                if (check_col(fd, COL_INFO))
                        col_add_fstr(fd, COL_INFO, "DHCP %-8s - Transaction ID 0x%x",
                            dhcp_type, pntohl(&pd[offset+4]));
@@ -779,5 +837,5 @@ proto_register_bootp(void)
 void
 proto_reg_handoff_bootp(void)
 {
-  dissector_add("udp.port", UDP_PORT_BOOTPS, dissect_bootp);
+  old_dissector_add("udp.port", UDP_PORT_BOOTPS, dissect_bootp);
 }