Ethereal-dev: [Ethereal-dev] patch for packet-llc.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Daniel Lundqvist <daniel.lundqvist@xxxxxxxxxxxxxxx>
Date: Wed, 13 Aug 2003 15:00:38 +0200
Hi,

Here is a patch to allow dissectors to match, or what it's called, on llc.oui.

Don't know if this is the way to do it but it seems to work fine.

//Daniel Lundqvist
Index: packet-llc.c
===================================================================
RCS file: /cvs/import/ethereal/packet-llc.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 packet-llc.c
--- packet-llc.c	13 Aug 2003 09:59:23 -0000	1.1.1.1
+++ packet-llc.c	13 Aug 2003 12:12:51 -0000
@@ -65,6 +65,7 @@ static gint ett_llc = -1;
 static gint ett_llc_ctrl = -1;
 
 static dissector_table_t subdissector_table;
+static dissector_table_t oui_subdissector_table;
 static dissector_table_t cisco_subdissector_table;
 static dissector_table_t xid_subdissector_table;
 
@@ -506,7 +507,13 @@ dissect_snap(tvbuff_t *tvb, int offset, 
 			    etype);
 		}
 		next_tvb = tvb_new_subset(tvb, offset+5, -1, -1);
-		call_dissector(data_handle,next_tvb, pinfo, tree);
+		if (XDLC_IS_INFORMATION(control)) {
+		  /* do lookup with the oui subdissector table */
+		  if (!dissector_try_port(oui_subdissector_table,
+					  oui, next_tvb, pinfo, tree))
+		    call_dissector(data_handle,next_tvb, pinfo, tree);
+		} else
+		  call_dissector(data_handle,next_tvb, pinfo, tree);
 		break;
 	}
 }
@@ -563,6 +570,8 @@ proto_register_llc(void)
 /* subdissector code */
 	subdissector_table = register_dissector_table("llc.dsap",
 	  "LLC SAP", FT_UINT8, BASE_HEX);
+	oui_subdissector_table = register_dissector_table("llc.oui",
+	  "LLC OUI", FT_UINT24, BASE_HEX);
 	cisco_subdissector_table = register_dissector_table("llc.cisco_pid",
 	  "Cisco OUI PID", FT_UINT16, BASE_HEX);
 	xid_subdissector_table = register_dissector_table("llc.xid_dsap",