Ethereal-dev: RE: [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: Jeff Foster <jfoste@xxxxxxxxxxxx>
Date: Mon, 25 Sep 2000 10:07:55 -0500

Per Frank Singleton 

> 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 ");

A little confused by the question, but here goes...  

I assume you are using a conversation base dissector that is created
after a dynamic port assignment.  In this case you can assume that
the port tests have been done by the lower level protocol dissector
and 'blindly' do the col_add_str.

Let me know if you need more help.

Jeff Foster
jfoste@xxxxxxxxxxxx