ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Ethereal-dev: [Ethereal-dev] h225 conversation patch

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

From: "Pia Sahlberg" <piabar@xxxxxxxxxxx>
Date: Mon, 04 Aug 2003 11:07:43 +0000
please check in

patch to h225 to use conversations to teach ethereal about which ports
it can find h245 traffic on.

sorry for the non binary attachement that is probably mangled by friendly hotmail. hotmail has once again decided that i shouldnt have access to the attach file button. Any suggestions on what to change the identifier string from konqi to so that hotmail works better?


best regards
	ronnie s
---



--- ethereal-2003-08-04/packet-h225.c	2003-08-01 20:11:54.000000000 +1000
+++ ethereal-new/packet-h225.c	2003-08-04 20:55:33.000000000 +1000
@@ -29,6 +29,7 @@

#include <glib.h>
#include <epan/packet.h>
+#include <epan/conversation.h>

#include <stdio.h>
#include <string.h>
@@ -2271,13 +2272,17 @@
static int
dissect_h225_ipAddress_ip(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *tree)
{
+	guint32 *ip;
+
	/* byte aligned */
	if(offset&0x07){
		offset=(offset&0xfffffff8)+8;
	}
-	ipv4_address=tvb_get_letohl(tvb, offset>>3);
- proto_tree_add_ipv4(tree, hf_h225_ipAddress_ip, tvb, offset>>3, 4, ipv4_address);
-
+	ip=tvb_get_ptr(tvb, offset>>3, 4);
+	if(ip){
+		memcpy(&ipv4_address,ip,4);
+ proto_tree_add_ipv4(tree, hf_h225_ipAddress_ip, tvb, offset>>3, 4, ipv4_address);
+	}
	offset+=32;
	return offset;
}
@@ -2524,14 +2529,19 @@

offset=dissect_per_choice(tvb, offset, pinfo, tree, hf_h225_h245Address, ett_h225_TransportAddress, TransportAddress_choice, "h245Address", NULL);

-	if(ipv4_address!=0 && ipv4_port!=0 && h245_handle){
-		/* XXX FIXME
-		   This registers h245 for every tcp session to this port.
-		   We should really only register h245 for this port and
-		   only for this specific IP address  not for all ip addresses
-		*/
-		dissector_delete("tcp.port", ipv4_port, h245_handle);
-		dissector_add("tcp.port", ipv4_port, h245_handle);
+ if((!pinfo->fd->flags.visited) && ipv4_address!=0 && ipv4_port!=0 && h245_handle){
+		address src_addr;
+		conversation_t *conv=NULL;
+
+		src_addr.type=AT_IPv4;
+		src_addr.len=4;
+		src_addr.data=&ipv4_address;
+
+ conv=find_conversation(&src_addr, &src_addr, PT_TCP, ipv4_port, ipv4_port, NO_ADDR_B|NO_PORT_B);
+		if(!conv){
+ conv=conversation_new(&src_addr, &src_addr, PT_TCP, ipv4_port, ipv4_port, NO_ADDR_B|NO_PORT_B);
+			conversation_set_dissector(conv, h245_handle);
+		}
	}
	return offset;
}

_________________________________________________________________
ninemsn Extra Storage comes with McAfee Virus Scanning - to keep your Hotmail account and PC safe. Click here http://join.msn.com/