Ethereal-dev: [ethereal-dev] dynamic port and upper layers

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

From: Frank Singleton <frank.singleton@xxxxxxxxxxxx>
Date: Mon, 25 Sep 2000 08:19:29 -0500
Hi,

Ok, assume you track a dynamic port assignment on
layer "n".

Traditionally I had code like this in all my dissector layers 
from layer "n"  to layer "n+k" where k = 3 in my case.

if (check_col(pinfo->fd, COL_INFO)) {
    if (pi.srcport == TCP_STATIC_PORT_x || pi.destport ==
TCP_STATIC_PORT_x ) {
      col_add_str(pinfo->fd, COL_INFO, "protocol n ..n+k ");
    }
.. etc..
  }

This was ok for static port assignment, now I am adding dynamic.

However with dynamic port assignment, the upper layers cannot
update the COL_INFO fields etc.. with static code like that above.

So how does one go about massaging the upper level code to
update COL_INFO fields when the ports are unknown until runtime.

Or do I rip out the checks on pi.srcport || pi.destport
and just do this in the upper layers (blindly).

eg:
col_add_str(pinfo->fd, COL_INFO, "protocol n+1 ");

Thanks / Frank..

-- 
EUS/SV/Z Frank Singleton      ASO Americas BSS
Office : +1 972 583 3251      ECN 800 33251  
Pager  : +1 800 651 1184      Email : eusfrsi@xxxxxxxxxxxxxxx 
Amateur Radio: VK3FCS/KM5WS   Email : frank.singleton@xxxxxxxxxxxx

Hardware: HP Omnibook 4150 running Redhat Linux 6.2 (2.2.16 kernel).