Port Assignments

The job of the Port Assignments section is to return the key used by the Rules section in the personality files by looking up the port number and returning the value next to it.

NEXT_PROTOCOL (FromPortAssignment TCP src_port dst_port)

The first parameter indicates the port numbers in the TCP section should be used, and the other sections ignored. The second and third parameters are the field names for the source and destination ports.

Within a section, the format of each entry is:

[Port Assignments:section name]

<port number> ,<key>

For example, the section for TCP given in ip.personality is:

[Port Assignments:TCP]

25,0x7f000409

53,0x7f00040d

80,0x7f000408

138,0x7f00040b

139,0x7f00040a

5000,0x7f009006

67-68,0x7f000412

The first value is the port number. Notice that a range of port numbers may be specified and the range is inclusive. The port number may be either the source or destination port. If a match is found for the port number, the second value, the key, is returned to the NEXT_PROTOCOL method. The key may be any unique number.

This key is then used during a scan of the Rules section. For TCP, the protocol analyzer uses the next decoder ID as the key, but we could have just as easily used the port number. Any value can be used as the key. (For various technical reasons we could not use the port number as the key in the personality files and skip using the Port Assignments section entirely.)

If you use a port number already listed in the Port Assignments section for a different protocol than the standard one, you only need to change the entry in the appropriate personality file. Simply change the second decoder ID (which is the one to traverse to) to the decoder ID for your decoder.