Checked in.
On Mon, 2 Jun 2003, Yaniv Kaul wrote:
> I've looked at the CVS and I saw that Guy fixed packet-cpha.c as follows:
>
> Use the new dissector API, and check whether the magic number and
> protocol version is OK and reject the packet if it's not, so that we
> don't grab all packets on port 8116 even if they're, for example, ONC
> RPC packets.
>
> However, what this causes, in case of an unknown protocol version, that the packet is not dissected at all. There's no error or anything.
> If the magic number is OK, but the protocol version is not, it should still output SOMETHING.
>
> Of course, working in Check Point, I see from time to time 'unknown'
> protocol versions. ;-)
>
> Attached please find a simplistic patch that makes sure version2str()
> always returns a non NULL value, therefore it'll always dissect, even if
> the protocol version is unknown (pending that the magic number is correct).
> In addition, it adds two version numbers, 540 & 541.
>
> Y.
>
> --- packet-cpha.orig.c 2003-06-02 15:35:01.000000000 +0300
> +++ packet-cpha.c 2003-06-02 15:46:04.000000000 +0300
> @@ -238,7 +238,7 @@
>
> if (check_col(pinfo->cinfo, COL_INFO))
> col_add_fstr(pinfo->cinfo, COL_INFO, "CPHAv%d: %s",
> - g_ntohs(hdr.ha_protocol_ver), opcode2str_short(opcode));
> + hdr.ha_protocol_ver, opcode2str_short(opcode));
>
> if (tree) {
> ti = proto_tree_add_item(tree, proto_cphap, tvb, offset, -1, FALSE);
> @@ -445,9 +445,17 @@
> version2str(guint16 version) {
> switch(version) {
> case 1: return "4.1";
> + break;
> case 6: return "NG Feature Pack 2";
> break;
> case 530: return "NG Feature Pack 3";
> + break;
> + case 540: return "NG with Application Intelligence (Early
> Availability)"
> + break;
> + case 541: return "NG with Application Intelligence";
> + break;
> + default: return "Unknown Version";
> + break;
> }
> return NULL;
> }
>
>
>