Ethereal-dev: [ethereal-dev] 0.8.10: IPv6 fragmention header patch

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

From: Santeri Paavolainen <santtu@xxxxxx>
Date: Thu, 27 Jul 2000 14:37:58 +0300 (EEST)
IPv6 didn't display information about the fragmention header in the
dissect tree. Here's a patch to fix it.

*** ethereal-0.8.10-orig/packet-ipv6.c	Tue Jul  4 15:12:23 2000
--- ethereal-0.8.10/packet-ipv6.c	Thu Jul 27 14:30:29 2000
***************
*** 141,146 ****
--- 141,148 ----
      int *fragstart) {
      struct ip6_frag frag;
      int len;
+     proto_item *ti;
+     proto_tree *rthdr_tree;
  
      memcpy(&frag, (void *) &pd[offset], sizeof(frag));
      len = sizeof(frag);
***************
*** 150,155 ****
--- 152,190 ----
  	    "IPv6 fragment (nxt=%s (0x%02x) off=%u id=0x%x)",
  	    ipprotostr(frag.ip6f_nxt), frag.ip6f_nxt,
  	    *fragstart, frag.ip6f_ident);
+     }
+     if (tree) {
+ 	ti = proto_tree_add_text(tree, NullTVB, offset, len,
+ 				 "Fragmention Header");
+ 	rthdr_tree = proto_item_add_subtree(ti, ett_ipv6);
+ 	
+ 	proto_tree_add_text(rthdr_tree, NullTVB,
+ 			    offset + offsetof(struct ip6_frag, ip6f_nxt), 1,
+ 			    "Next header: %s (0x%02x)", 
+ 			    ipprotostr(frag.ip6f_nxt), frag.ip6f_nxt);
+ 
+ #if 0
+ 	proto_tree_add_text(rthdr_tree, NullTVB,
+ 			    offset + offsetof(struct ip6_frag, ip6f_reserved), 1,
+ 			    "Reserved: %u",
+ 			    frag.ip6f_reserved);
+ #endif
+ 
+ 	proto_tree_add_text(rthdr_tree, NullTVB,
+ 			    offset + offsetof(struct ip6_frag, ip6f_offlg), 2,
+ 			    "Offset: %u",
+ 			    ntohs(frag.ip6f_offlg) & 0xfff8);
+ 
+ 	proto_tree_add_text(rthdr_tree, NullTVB,
+ 			    offset + offsetof(struct ip6_frag, ip6f_offlg), 2,
+ 			    "More fragments: %s",
+ 				      frag.ip6f_offlg & IP6F_MORE_FRAG ?
+ 				      "Yes" : "No");
+ 
+ 	proto_tree_add_text(rthdr_tree, NullTVB,
+ 			    offset + offsetof(struct ip6_frag, ip6f_ident), 4,
+ 			    "Identification: 0x%08x",
+ 			    frag.ip6f_ident);
      }
      return len;
  }

-- 
santtu@xxxxxx                    I have become death, destroyer of the worlds.