Ethereal-users: Re: [Ethereal-users] IGMP v1 or v2?

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

From: "Seehofer, Markus" <mseehofe@xxxxxxxxxxxxxxxx>
Date: Thu, 24 Jul 2003 11:38:41 +0200
Hello,

i've also done some changes in the igmp packet dissector.
IGMPv1 and IGMPv2 (both Query and Report) Messages are now
shown separately in the tree.
Sorry, but it's not possible for me to check in the sources in the cvs tree,
so i post the packet-igmp.c file and a diff to the current 0.9.13 file to
this list.
Hopefully someone can check in the file.

Best Regards,
Markus Seehofer

 <<packet-igmp.c>>  <<patch_igmp.txt>> 

Attachment: packet-igmp.c
Description: Binary data

*** packet-igmp.c	Tue Jul 22 10:01:41 2003
--- packet-igmp_org.c.orig	Tue Jul 22 09:36:54 2003
***************
*** 41,47 ****
  	0x07      20
  	0x08      20
  	0x11               8*     8*     >=12
!     0x12               8*     8*
  	0x13                                     x
  	0x16                      8
  	0x17                      8
--- 41,47 ----
  	0x07      20
  	0x08      20
  	0x11               8*     8*     >=12
!         0x12               8*     8*
  	0x13                                     x
  	0x16                      8
  	0x17                      8
***************
*** 791,803 ****
--- 791,809 ----
  		col_clear(pinfo->cinfo, COL_INFO);
  	}
  
+ 
+ 
  	type = tvb_get_guint8(tvb, offset);
  
+ 
+ 
  	/* version 0 */
  	if ((type&0xf0)==0){
  		offset = dissect_igmp_v0(tvb, pinfo, tree, type, offset);
+ 
  	}
  
+ 
  	switch (type) {
  
  	case IGMP_V1_HOST_MEMBERSHIP_QUERY:	/* 0x11 v1/v2/v3 */
***************
*** 806,821 ****
  			offset = dissect_igmp_v3_query(tvb, pinfo, tree, type, offset);
  		} else {
  			/* v1 and v2 differs in second byte of header */
! 			if (tvb_get_guint8(tvb, offset+1)) {
  				offset = dissect_igmp_v2(tvb, pinfo, tree, type, offset);
  			} else {
  				offset = dissect_igmp_v1(tvb, pinfo, tree, type, offset);
  			}
  		}
  		break;
  
! 	case IGMP_V1_HOST_MEMBERSHIP_REPORT: /* 0x12 v1 membership report */
  			offset = dissect_igmp_v1(tvb, pinfo, tree, type, offset);
  		break;
  
  	case IGMP_DVMRP:
--- 812,833 ----
  			offset = dissect_igmp_v3_query(tvb, pinfo, tree, type, offset);
  		} else {
  			/* v1 and v2 differs in second byte of header */
! 			if (tvb_get_guint8(tvb, offset)) {
  				offset = dissect_igmp_v2(tvb, pinfo, tree, type, offset);
  			} else {
  				offset = dissect_igmp_v1(tvb, pinfo, tree, type, offset);
  			}
  		}
  		break;
+ 		}
  
! 	case IGMP_V1_HOST_MEMBERSHIP_REPORT:	/* 0x12  v1/v2 */
! 		/* v1 and v2 differs in second byte of header */
! 		if (tvb_get_guint8(tvb, offset)) {
! 			offset = dissect_igmp_v2(tvb, pinfo, tree, type, offset);
! 		} else {
  			offset = dissect_igmp_v1(tvb, pinfo, tree, type, offset);
+ 		}
  		break;
  
  	case IGMP_DVMRP:
***************
*** 826,833 ****
  		offset = dissect_pimv1(tvb, pinfo, parent_tree, offset);
  		break;
  
! 	case IGMP_V2_MEMBERSHIP_REPORT:	/* 0x16 v2 membership report 	*/
! 	case IGMP_V2_LEAVE_GROUP:		/* 0x17 v2 leave message 		*/
  		offset = dissect_igmp_v2(tvb, pinfo, tree, type, offset);
  		break;
  
--- 838,845 ----
  		offset = dissect_pimv1(tvb, pinfo, parent_tree, offset);
  		break;
  
! 	case IGMP_V2_MEMBERSHIP_REPORT:
! 	case IGMP_V2_LEAVE_GROUP:
  		offset = dissect_igmp_v2(tvb, pinfo, tree, type, offset);
  		break;
  
***************
*** 874,879 ****
--- 886,892 ----
  	case IGMP_TYPE_0x26:
  		dst = g_htonl(MC_ALL_ROUTERS);
  		if (!memcmp(pinfo->dst.data, &dst, 4)) {
+ 
  			offset = dissect_mrdisc(tvb, pinfo, parent_tree, offset);
  		}
  		break;
***************
*** 883,888 ****
--- 896,902 ----
  		break;
  	}
  
+ 
  	proto_item_set_len(item, offset);
  }