Ethereal-dev: [ethereal-dev] Patch for OSPF MD5 decode.

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

From: Tony Hart <thart@xxxxxxxxx>
Date: Tue, 19 Oct 1999 12:22:07 +0000
Attached are the CVS diff's for MD5 authentication decode in OSPF
packets.  Please do with them what you will :-)  They've been tested
against Cisco's and others.


Thanks,
Tony

-- 
    Tony Hart                Email: mailto://thart@xxxxxxxxx
Index: packet-ospf.c
===================================================================
RCS file: /cvsroot/ethereal/packet-ospf.c,v
retrieving revision 1.13
diff -r1.13 packet-ospf.c
57a58,59
>     e_ospf_crypto *crypto;
>     int i, saved_len, ospflen;
62c64
<     char auth_data[9]="";
---
>     char auth_data[(2 * 16) + 1]="";
118a121
>                  crypto = (e_ospf_crypto *)ospfh.auth_data;
120c123,133
< 	         proto_tree_add_text(ospf_header_tree, offset + 16 , 8, "Auth Data (crypt)");
---
> 	         proto_tree_add_text(ospf_header_tree, offset + 18 , 1, "Auth Key ID: %d",
> 				     crypto->key_id);
> 	         proto_tree_add_text(ospf_header_tree, offset + 19 , 1, "Auth Data Length: %d",
> 				     crypto->length);
> 	         proto_tree_add_text(ospf_header_tree, offset + 20 , 4, "Auth Crypto Sequence Number: 0x%x",
> 				     ntohl(crypto->sequence_num));
> 
> 		 ospflen = ntohs(ospfh.length);
> 		 for (i = 0; i < crypto->length; i++)
> 		     sprintf(&auth_data[i*2],"%02x",pd[offset + ospflen + i]);
> 	         proto_tree_add_text(ospf_header_tree, offset + ospflen , 16, "Auth Data: %s", auth_data);
128a142,150
>     /* Temporarily adjust the captured length to match the size of the OSPF
>      * packet (since the dissect routines use it to work out where the end of
>      * the ospf packet is).
>      */
>     saved_len = pi.captured_len;
>     if (BYTES_ARE_IN_FRAME(offset, ntohs(ospfh.length))) {
> 	pi.captured_len = offset + ntohs(ospfh.length);
>     }
> 
130a153
> 
147a171
>             pi.captured_len = saved_len;
149a174
>     pi.captured_len = saved_len;
Index: packet-ospf.h
===================================================================
RCS file: /cvsroot/ethereal/packet-ospf.h,v
retrieving revision 1.4
diff -r1.4 packet-ospf.h
125a126,132
> typedef struct _e_ospf_crypto {
>     guint16	mbz;
>     guint8      key_id;
>     guint8      length;
>     guint32 	sequence_num;
> } e_ospf_crypto;
>