Ethereal-dev: [Ethereal-dev] PPP Protocol Reject messages

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

From: Pasi Eronen <pasi.eronen@xxxxxxxx>
Date: Thu, 28 Nov 2002 16:01:03 +0200 (EET)
Hi,

Currently the PPP dissector doesn't dissect the packet inside
a LCP Protocol Reject message, but shows it just as hex. The following
patch adds support for this.

Could someone take a look at it and commit it? (I've tested it
for the one case I have encountered; I guess LCP Protocol Rejects
aren't very common)

Best regards,
Pasi

-- 
Pasi Eronen                         E-mail pasi.eronen@xxxxxxxx
Nixu Oy                             Tel +358 50 5123499
Mäkelänkatu 91, 00610 Helsinki      Fax +358 9 4781030
*** packet-ppp.c-1.98	Thu Nov 28 15:32:24 2002
--- packet-ppp.c	Thu Nov 28 15:54:59 2002
***************
*** 2355,2367 ****
      case PROTREJ:
        if(tree) {
!       	protocol = tvb_get_ntohs(tvb, offset);
! 	proto_tree_add_text(fh_tree, tvb, offset, 2, "Rejected protocol: %s (0x%04x)",
! 		val_to_str(protocol, ppp_vals, "Unknown"), protocol);
  	offset += 2;
  	length -= 2;
! 	if (length > 0)
!           proto_tree_add_text(fh_tree, tvb, offset, length, "Rejected packet (%d byte%s)",
! 				length, plurality(length, "", "s"));
! 		/* XXX - should be dissected as a PPP packet */
        }
        break;
--- 2355,2376 ----
      case PROTREJ:
        if(tree) {
! 	tvbuff_t *next_tvb;
! 	protocol = tvb_get_ntohs(tvb, offset);
! 	proto_tree_add_text(fh_tree, tvb, offset, 2,
! 			    "Rejected protocol: %s (0x%04x)",
! 			    val_to_str(protocol, ppp_vals, "Unknown"),
! 			    protocol);
  	offset += 2;
  	length -= 2;
! 	if (length > 0) {
!           proto_tree_add_text(fh_tree, tvb, offset, length,
! 			      "Rejected packet (%d byte%s)",
! 			      length, plurality(length, "", "s"));
! 	  next_tvb = tvb_new_subset(tvb, offset, length, length);
!   	  if (!dissector_try_port(subdissector_table, protocol,
! 				  next_tvb, pinfo, fh_tree)) {
! 	    call_dissector(data_handle,next_tvb, pinfo, fh_tree);
!   	  }
!         }
        }
        break;