Ethereal-dev: [ethereal-dev] Patches for SINEC H1-Dissector, request for CVS-tarballs
Hello,
attached are patches for the SINEC H1 Dissector (packet-h1.c
packet-h1.h)
and a patch for packet-osi.c, which allows an easier integration of
other
OSI-based high-level protocols.
The H1-patch improves the handling of decoding the different fields.
We had some bogous packets which crashed ethereal.
The patches are against 0.8.7. I know, that there are updates for
packet-osi and
packet-h1 in the CVS, but our firewall blocks CVS.
Is there a chance to create daily or at least weekly tarballs?
I think that it would make life easier for a lot of people.
Btw.: A hint about the val_to_str function should be added to the
README.developer.
It's a very important function, because the simple match_strval leads to
crashes with
bogous packets. But I simply didn't found it earlier.......
Gerrit
--
Dr.-Ing. Gerrit Gehnen Abt. LT
ATR Industrie-Elektronik Textilstraße 2, 41751 Viersen, Germany
Tel. (+49)2162 485-362 Fax (+49)2162 485-100
http://www.atrie.de
--- packet-h1.h.org Thu Mar 2 08:27:05 2000
+++ packet-h1.h Thu Apr 27 23:23:20 2000
@@ -24,4 +24,4 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-void dissect_h1(const u_char *, int, frame_data *, proto_tree *);
+gboolean dissect_h1(const u_char *, int, frame_data *, proto_tree *);
--- packet-h1.c.org Thu Apr 13 12:53:21 2000
+++ packet-h1.c Thu Apr 27 23:20:15 2000
@@ -90,7 +90,7 @@
{0x00, "No error"},
{0x02, "Requested block does not exist"},
{0x03, "Requested block too small"},
- {0xFF, "Error, reason unkown"},
+ {0xFF, "Error, reason unknown"},
{0, NULL}
};
@@ -101,7 +101,7 @@
static gint ett_empty = -1;
-void
+gboolean
dissect_h1 (const u_char * pd, int offset, frame_data * fd, proto_tree * tree)
{
proto_tree *h1_tree = NULL;
@@ -113,8 +113,10 @@
unsigned int position = 2;
- if (pd[offset] == 'S' && pd[offset + 1] == '5')
- {
+ if (!(pd[offset] == 'S' && pd[offset + 1] == '5')) {
+ return FALSE;
+ }
+
if (check_col (fd, COL_PROTOCOL))
col_add_str (fd, COL_PROTOCOL, "H1");
if (check_col (fd, COL_INFO))
@@ -151,8 +153,8 @@
if (check_col (fd, COL_INFO))
{
col_append_str (fd, COL_INFO,
- match_strval (pd[offset + position + 2],
- opcode_vals));
+ val_to_str (pd[offset + position + 2],
+ opcode_vals,"Unknown Opcode (0x%2.2x)"));
}
break;
case REQUEST_BLOCK:
@@ -184,8 +186,8 @@
if (check_col (fd, COL_INFO))
{
col_append_fstr (fd, COL_INFO, " %s %d",
- match_strval (pd[offset + position + 2],
- org_vals),
+ val_to_str (pd[offset + position + 2],
+ org_vals,"Unknown Type (0x%2.2x)"),
pd[offset + position + 3]);
col_append_fstr (fd, COL_INFO, " DW %d",
pd[offset + position + 4] * 0x100 +
@@ -213,8 +215,8 @@
if (check_col (fd, COL_INFO))
{
col_append_fstr (fd, COL_INFO, " %s",
- match_strval (pd[offset + position + 2],
- returncode_vals));
+ val_to_str (pd[offset + position + 2],
+ returncode_vals,"Unknown Returcode (0x%2.2x"));
}
break;
case EMPTY_BLOCK:
@@ -239,11 +241,7 @@
} /* ..while */
dissect_data (pd, offset + pd[offset + 2], fd, tree);
- }
- else
- {
- dissect_data (pd, offset, fd, tree);
- }
+ return TRUE;
}
--- packet-osi.c.org Thu Apr 13 12:53:36 2000
+++ packet-osi.c Thu Apr 27 23:23:29 2000
@@ -430,11 +430,12 @@
offset += li + 1;
if (uses_inactive_subset){
- dissect_h1(pd, offset, fd, tree);
- }
- else {
- dissect_data(pd, offset, fd, tree);
- }
+ if (dissect_h1(pd, offset, fd, tree)) {
+ return 0;
+ }
+ /* Fill in other Dissectors using inactive subset here */
+ }
+ dissect_data(pd, offset, fd, tree);
return 0;