2009-06-19 05:29:20 +00:00
|
|
|
/* packet-glbp.c
|
|
|
|
*
|
|
|
|
* Cisco's GLBP: Gateway Load Balancing Protocol
|
|
|
|
*
|
|
|
|
* Copyright 2007 Joerg Mayer (see AUTHORS file)
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2009-06-19 05:29:20 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Documentation:
|
|
|
|
* http://www.cisco.com/en/US/docs/ios/12_2t/12_2t15/feature/guide/ft_glbp.pdf
|
|
|
|
*
|
|
|
|
* TODO: This dissector has been written without specs, so much of it is
|
2009-06-22 06:28:10 +00:00
|
|
|
* guesswork. Also, there are still unknown elements in the message.
|
|
|
|
* Some debug output:
|
|
|
|
* GLBP: Fa0/0 Grp 1020 Hello out VG Active pri 100 vIP FE80::C800:8FF:FE64:AAAA
|
|
|
|
* hello 3000, hold 10000 VF 1 Active pri 167 vMAC 0007.b403.fc01
|
|
|
|
* GLBP: Fa0/0 Grp 1021 Hello out VG Active pri 100 vIP 10.20.20.100
|
|
|
|
* hello 3000, hold 10000 VF 1 Active pri 167 vMAC 0007.b403.fd01
|
2009-06-19 05:29:20 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2009-06-19 05:29:20 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <epan/packet.h>
|
2009-07-08 00:28:54 +00:00
|
|
|
#include <epan/expert.h>
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2013-12-14 12:45:57 +00:00
|
|
|
void proto_register_glbp(void);
|
|
|
|
void proto_reg_handoff_glbp(void);
|
|
|
|
|
2009-06-19 05:29:20 +00:00
|
|
|
static int proto_glbp = -1;
|
|
|
|
/* glbp header? */
|
|
|
|
static gint hf_glbp_version = -1;
|
2009-06-22 06:28:10 +00:00
|
|
|
static gint hf_glbp_unknown1 = -1;
|
2009-06-20 16:07:01 +00:00
|
|
|
static gint hf_glbp_group = -1;
|
2009-06-19 05:29:20 +00:00
|
|
|
static gint hf_glbp_unknown2 = -1;
|
2009-06-22 06:28:10 +00:00
|
|
|
static gint hf_glbp_ownerid = -1;
|
2009-06-20 16:07:01 +00:00
|
|
|
static gint hf_glbp_tlv = -1;
|
|
|
|
static gint hf_glbp_type = -1;
|
|
|
|
static gint hf_glbp_length = -1;
|
|
|
|
/* glbp type = 1 - hello */
|
2009-06-22 06:28:10 +00:00
|
|
|
static gint hf_glbp_hello_unknown10 = -1;
|
|
|
|
static gint hf_glbp_hello_vgstate = -1;
|
2009-06-20 16:07:01 +00:00
|
|
|
static gint hf_glbp_hello_unknown11 = -1;
|
|
|
|
static gint hf_glbp_hello_priority = -1;
|
|
|
|
static gint hf_glbp_hello_unknown12 = -1;
|
|
|
|
static gint hf_glbp_hello_helloint = -1;
|
|
|
|
static gint hf_glbp_hello_holdint = -1;
|
|
|
|
static gint hf_glbp_hello_redirect = -1;
|
|
|
|
static gint hf_glbp_hello_timeout = -1;
|
|
|
|
static gint hf_glbp_hello_unknown13 = -1;
|
2009-06-22 06:28:10 +00:00
|
|
|
static gint hf_glbp_hello_addrtype = -1;
|
|
|
|
static gint hf_glbp_hello_addrlen = -1;
|
|
|
|
static gint hf_glbp_hello_virtualipv4 = -1;
|
|
|
|
static gint hf_glbp_hello_virtualipv6 = -1;
|
|
|
|
static gint hf_glbp_hello_virtualunk = -1;
|
2009-06-20 16:07:01 +00:00
|
|
|
/* glbp type = 2 - Request/Response??? */
|
2009-06-22 06:28:10 +00:00
|
|
|
static gint hf_glbp_reqresp_forwarder = -1;
|
|
|
|
static gint hf_glbp_reqresp_vfstate = -1;
|
2009-06-20 16:07:01 +00:00
|
|
|
static gint hf_glbp_reqresp_unknown21 = -1;
|
2009-06-22 06:28:10 +00:00
|
|
|
static gint hf_glbp_reqresp_priority = -1;
|
|
|
|
static gint hf_glbp_reqresp_weight = -1;
|
|
|
|
static gint hf_glbp_reqresp_unknown22 = -1;
|
2009-06-20 16:07:01 +00:00
|
|
|
static gint hf_glbp_reqresp_virtualmac = -1;
|
|
|
|
/* glbp type = 3 - Auth */
|
|
|
|
static gint hf_glbp_auth_authtype = -1;
|
|
|
|
static gint hf_glbp_auth_authlength = -1;
|
|
|
|
static gint hf_glbp_auth_plainpass = -1;
|
|
|
|
static gint hf_glbp_auth_md5hash = -1;
|
|
|
|
static gint hf_glbp_auth_md5chainindex = -1;
|
|
|
|
static gint hf_glbp_auth_md5chainhash = -1;
|
|
|
|
static gint hf_glbp_auth_authunknown = -1;
|
2009-06-19 05:29:20 +00:00
|
|
|
/* unknown type */
|
2009-06-20 16:07:01 +00:00
|
|
|
static gint hf_glbp_unknown_data = -1;
|
2009-06-19 05:29:20 +00:00
|
|
|
|
|
|
|
static gint ett_glbp = -1;
|
2009-06-20 16:07:01 +00:00
|
|
|
static gint ett_glbp_tlv = -1;
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2013-05-31 23:11:43 +00:00
|
|
|
/* filterable expert infos */
|
|
|
|
static expert_field ei_glbp_ipv4_wrong_length = EI_INIT;
|
|
|
|
static expert_field ei_glbp_ipv6_wrong_length = EI_INIT;
|
|
|
|
static expert_field ei_glbp_tlv_length_too_small = EI_INIT;
|
|
|
|
static expert_field ei_glbp_tlv_invalid_bytes_used = EI_INIT;
|
|
|
|
|
2009-06-20 16:07:01 +00:00
|
|
|
static const value_string glbp_type_vals[] = {
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 1, "Hello" },
|
|
|
|
{ 2, "Request/Response?" },
|
|
|
|
{ 3, "Auth" },
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 0, NULL }
|
2009-06-19 05:29:20 +00:00
|
|
|
};
|
|
|
|
|
2009-06-22 06:28:10 +00:00
|
|
|
#if 0
|
|
|
|
static const value_string glbp_reqresp_forwarder_vals[] = {
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 0, "Request?" },
|
|
|
|
{ 2, "Response?" },
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 0, NULL }
|
2009-06-19 05:29:20 +00:00
|
|
|
};
|
2009-06-22 06:28:10 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static const value_string glbp_addr_type_vals[] = {
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 1, "IPv4" },
|
|
|
|
{ 2, "IPv6" },
|
2009-06-22 06:28:10 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 0, NULL }
|
2009-06-22 06:28:10 +00:00
|
|
|
};
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2009-06-20 16:07:01 +00:00
|
|
|
static const value_string glbp_auth_type_vals[] = {
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 0, "None" },
|
|
|
|
{ 1, "Plain text" },
|
|
|
|
{ 2, "MD5 string" },
|
|
|
|
{ 3, "MD5 chain" },
|
2009-06-20 16:07:01 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 0, NULL }
|
2009-06-20 16:07:01 +00:00
|
|
|
};
|
|
|
|
|
2009-06-19 05:29:20 +00:00
|
|
|
#if 0
|
|
|
|
static const value_string glbp_loadbalancing_vals[] = {
|
2011-10-20 14:07:54 +00:00
|
|
|
{ x, "None (AVG only)" },
|
|
|
|
{ x, "Weighted" },
|
|
|
|
{ x, "Host dependent" },
|
|
|
|
{ x, "Round robin" },
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 0, NULL }
|
2009-06-19 05:29:20 +00:00
|
|
|
};
|
2009-06-22 06:28:10 +00:00
|
|
|
#endif
|
2009-06-19 05:29:20 +00:00
|
|
|
|
|
|
|
static const value_string glbp_vgstate_vals[] = {
|
2009-06-22 06:28:10 +00:00
|
|
|
#if 0
|
2011-10-20 14:07:54 +00:00
|
|
|
{ x, "Disabled" },
|
|
|
|
{ x, "Initial" },
|
2009-06-22 06:28:10 +00:00
|
|
|
#endif
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 4, "Listen" },
|
|
|
|
{ 8, "Speak" },
|
|
|
|
{ 0x10, "Standby" },
|
|
|
|
{ 0x20, "Active" },
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 0, NULL }
|
2009-06-19 05:29:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string glbp_vfstate_vals[] = {
|
2009-06-22 06:28:10 +00:00
|
|
|
#if 0
|
2011-10-20 14:07:54 +00:00
|
|
|
{ x, "Disabled" },
|
|
|
|
{ x, "Initial" },
|
2009-06-22 06:28:10 +00:00
|
|
|
#endif
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 4, "Listen" },
|
|
|
|
{ 0x20, "Active" },
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ 0, NULL }
|
2009-06-19 05:29:20 +00:00
|
|
|
};
|
|
|
|
|
2009-07-06 13:00:04 +00:00
|
|
|
static int
|
2009-07-08 00:28:54 +00:00
|
|
|
dissect_glbp_hello(tvbuff_t *tvb, int offset,
|
2011-10-20 14:07:54 +00:00
|
|
|
packet_info *pinfo, proto_tree *tlv_tree)
|
2009-06-20 16:07:01 +00:00
|
|
|
{
|
2009-07-06 17:49:33 +00:00
|
|
|
guint8 addrtype;
|
|
|
|
guint8 addrlen;
|
2009-06-22 06:28:10 +00:00
|
|
|
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_unknown10, tvb, offset, 1, ENC_NA);
|
2009-06-22 06:28:10 +00:00
|
|
|
offset ++;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_vgstate, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-06-22 06:28:10 +00:00
|
|
|
offset ++;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_unknown11, tvb, offset, 1, ENC_NA);
|
2009-06-22 06:28:10 +00:00
|
|
|
offset ++;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_priority, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset++;
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_unknown12, tvb, offset, 2, ENC_NA);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset += 2;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_helloint, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset += 4;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_holdint, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset += 4;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_redirect, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset += 2;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_timeout, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset += 2;
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_unknown13, tvb, offset, 2, ENC_NA);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset += 2;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_addrtype, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
addrtype = tvb_get_guint8( tvb, offset);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset++;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_addrlen, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-06-22 06:28:10 +00:00
|
|
|
addrlen = tvb_get_guint8(tvb, offset);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset++;
|
2009-06-22 06:28:10 +00:00
|
|
|
switch (addrtype) {
|
|
|
|
case 1:
|
2009-07-08 00:28:54 +00:00
|
|
|
if (addrlen != 4) {
|
2013-09-09 00:44:09 +00:00
|
|
|
expert_add_info_format(pinfo, NULL, &ei_glbp_ipv4_wrong_length,
|
2013-05-31 23:11:43 +00:00
|
|
|
"Wrong IPv4 address length: %u", addrlen);
|
2009-07-08 00:28:54 +00:00
|
|
|
return offset + addrlen;
|
|
|
|
}
|
2011-08-26 17:02:33 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_virtualipv4, tvb, offset, addrlen, ENC_BIG_ENDIAN);
|
2009-06-22 06:28:10 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2009-07-08 00:28:54 +00:00
|
|
|
if (addrlen != 16) {
|
2013-09-09 00:44:09 +00:00
|
|
|
expert_add_info_format(pinfo, NULL, &ei_glbp_ipv6_wrong_length,
|
2013-05-31 23:11:43 +00:00
|
|
|
"Wrong IPv6 address length: %u", addrlen);
|
2009-07-08 00:28:54 +00:00
|
|
|
return offset + addrlen;
|
|
|
|
}
|
2011-10-10 00:39:31 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_virtualipv6, tvb, offset, addrlen, ENC_NA);
|
2009-06-22 06:28:10 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_hello_virtualunk, tvb, offset, addrlen, ENC_NA);
|
2009-06-22 06:28:10 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
offset += addrlen;
|
|
|
|
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
|
|
|
|
val_to_str(addrtype, glbp_addr_type_vals, "%d"));
|
2009-07-06 13:00:04 +00:00
|
|
|
|
|
|
|
return offset;
|
2009-06-20 16:07:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-07-06 13:00:04 +00:00
|
|
|
static int
|
2009-07-08 00:28:54 +00:00
|
|
|
dissect_glbp_reqresp(tvbuff_t *tvb, int offset,
|
2011-10-20 14:07:54 +00:00
|
|
|
packet_info *pinfo _U_, proto_tree *tlv_tree)
|
2009-06-20 16:07:01 +00:00
|
|
|
{
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_reqresp_forwarder, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-06-22 06:28:10 +00:00
|
|
|
offset++;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_reqresp_vfstate, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-06-22 06:28:10 +00:00
|
|
|
offset++;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_reqresp_unknown21, tvb, offset, 1, ENC_NA);
|
2009-06-22 06:28:10 +00:00
|
|
|
offset += 1;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_reqresp_priority, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset++;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_reqresp_weight, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-06-22 06:28:10 +00:00
|
|
|
offset++;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_reqresp_unknown22, tvb, offset, 7, ENC_NA);
|
2009-06-22 06:28:10 +00:00
|
|
|
offset += 7;
|
2011-10-20 14:07:54 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_reqresp_virtualmac, tvb, offset, 6, ENC_NA);
|
2009-07-06 13:00:04 +00:00
|
|
|
offset += 6;
|
|
|
|
|
|
|
|
return offset;
|
2009-06-20 16:07:01 +00:00
|
|
|
}
|
|
|
|
|
2009-07-06 13:00:04 +00:00
|
|
|
static int
|
2009-07-08 00:28:54 +00:00
|
|
|
dissect_glbp_auth(tvbuff_t *tvb, int offset,
|
2011-10-20 14:07:54 +00:00
|
|
|
packet_info *pinfo _U_, proto_tree *tlv_tree)
|
2009-06-20 16:07:01 +00:00
|
|
|
{
|
2009-07-06 17:49:33 +00:00
|
|
|
guint8 authtype;
|
|
|
|
guint8 authlength;
|
2009-06-20 16:07:01 +00:00
|
|
|
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_auth_authtype, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-06-20 16:07:01 +00:00
|
|
|
authtype = tvb_get_guint8(tvb, offset);
|
|
|
|
offset++;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_auth_authlength, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-06-20 16:07:01 +00:00
|
|
|
authlength = tvb_get_guint8(tvb, offset);
|
|
|
|
offset++;
|
|
|
|
switch(authtype) {
|
|
|
|
case 1:
|
2011-10-15 18:46:26 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_auth_plainpass, tvb, offset, authlength, ENC_ASCII|ENC_NA);
|
2009-07-06 13:00:04 +00:00
|
|
|
offset += authlength;
|
2009-06-20 16:07:01 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_auth_md5hash, tvb, offset, authlength, ENC_NA);
|
2009-07-06 13:00:04 +00:00
|
|
|
offset += authlength;
|
2009-06-20 16:07:01 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2011-08-26 17:02:33 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_auth_md5chainindex, tvb, offset, 4, ENC_BIG_ENDIAN);
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_auth_md5chainhash, tvb, offset+4, authlength-4, ENC_NA);
|
2009-07-06 13:00:04 +00:00
|
|
|
offset += authlength;
|
2009-06-20 16:07:01 +00:00
|
|
|
break;
|
|
|
|
default:
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_auth_authunknown, tvb, offset, authlength, ENC_NA);
|
2009-07-06 13:00:04 +00:00
|
|
|
offset += authlength;
|
2009-06-20 16:07:01 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-07-06 13:00:04 +00:00
|
|
|
|
|
|
|
return offset;
|
2009-06-20 16:07:01 +00:00
|
|
|
}
|
|
|
|
|
2009-07-06 13:00:04 +00:00
|
|
|
static int
|
2009-06-20 16:07:01 +00:00
|
|
|
dissect_glbp_unknown(tvbuff_t *tvb, int offset, guint32 length,
|
2011-10-20 14:07:54 +00:00
|
|
|
packet_info *pinfo _U_, proto_tree *tlv_tree)
|
2009-06-20 16:07:01 +00:00
|
|
|
{
|
2011-10-04 22:44:31 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_unknown_data, tvb, offset, length, ENC_NA);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset += length;
|
2009-07-06 13:00:04 +00:00
|
|
|
|
|
|
|
return offset;
|
2009-06-20 16:07:01 +00:00
|
|
|
}
|
|
|
|
|
2009-06-19 05:29:20 +00:00
|
|
|
static int
|
|
|
|
dissect_glbp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree *glbp_tree;
|
|
|
|
proto_tree *tlv_tree;
|
|
|
|
proto_item *ti;
|
|
|
|
guint8 type;
|
|
|
|
int offset = 0;
|
|
|
|
int lastoffset;
|
|
|
|
guint8 length;
|
|
|
|
guint16 group;
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2009-06-20 16:07:01 +00:00
|
|
|
group = tvb_get_ntohs(tvb, 2);
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2009-06-20 16:07:01 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "GLBP");
|
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "G: %d", group);
|
2009-06-19 05:45:40 +00:00
|
|
|
|
2012-07-12 17:22:47 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_glbp, tvb, 0, -1, ENC_NA);
|
|
|
|
glbp_tree = proto_item_add_subtree(ti, ett_glbp);
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2012-07-12 17:22:47 +00:00
|
|
|
/* glbp header? */
|
|
|
|
proto_tree_add_item(glbp_tree, hf_glbp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset++;
|
|
|
|
proto_tree_add_item(glbp_tree, hf_glbp_unknown1, tvb, offset, 1, ENC_BIG_ENDIAN);
|
|
|
|
offset++;
|
|
|
|
proto_tree_add_item(glbp_tree, hf_glbp_group, tvb, offset, 2, ENC_BIG_ENDIAN);
|
|
|
|
offset += 2;
|
|
|
|
proto_tree_add_item(glbp_tree, hf_glbp_unknown2, tvb, offset, 2, ENC_NA);
|
|
|
|
offset += 2;
|
|
|
|
proto_tree_add_item(glbp_tree, hf_glbp_ownerid, tvb, offset, 6, ENC_NA);
|
|
|
|
offset += 6;
|
2014-06-19 17:18:16 +00:00
|
|
|
while (tvb_length_remaining(tvb, offset) > 0) {
|
2012-07-12 17:22:47 +00:00
|
|
|
|
|
|
|
type = tvb_get_guint8(tvb, offset);
|
|
|
|
length = tvb_get_guint8(tvb, offset+1);
|
|
|
|
if (length < 2) {
|
2013-09-09 00:44:09 +00:00
|
|
|
expert_add_info_format(pinfo, NULL, &ei_glbp_tlv_length_too_small,
|
2013-05-31 23:11:43 +00:00
|
|
|
"Length %u too small", length);
|
2012-07-12 17:22:47 +00:00
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
length -= 2;
|
|
|
|
|
|
|
|
ti = proto_tree_add_item(glbp_tree, hf_glbp_tlv, tvb, offset, length+2, ENC_BIG_ENDIAN);
|
|
|
|
tlv_tree = proto_item_add_subtree(ti, ett_glbp_tlv);
|
|
|
|
proto_item_append_text(ti, " l=%d, t=%s", length+2,
|
|
|
|
val_to_str(type, glbp_type_vals, "%d"));
|
|
|
|
|
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_type, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset++;
|
2012-07-12 17:22:47 +00:00
|
|
|
proto_tree_add_item(tlv_tree, hf_glbp_length, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2009-06-20 16:07:01 +00:00
|
|
|
offset++;
|
2012-07-12 17:22:47 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, ", %s",
|
|
|
|
val_to_str(type, glbp_type_vals, "%d"));
|
|
|
|
|
|
|
|
lastoffset = offset;
|
|
|
|
switch(type) {
|
|
|
|
case 1: /* Hello */
|
|
|
|
offset = dissect_glbp_hello(tvb, offset, pinfo, tlv_tree);
|
|
|
|
break;
|
|
|
|
case 2: /* Request/Response */
|
|
|
|
offset = dissect_glbp_reqresp(tvb, offset, pinfo, tlv_tree);
|
|
|
|
break;
|
|
|
|
case 3: /* Plaintext auth */
|
|
|
|
offset = dissect_glbp_auth(tvb, offset, pinfo, tlv_tree);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
offset = dissect_glbp_unknown(tvb, offset, length, pinfo, tlv_tree);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (lastoffset >= offset) {
|
2013-05-31 23:11:43 +00:00
|
|
|
expert_add_info(pinfo, NULL, &ei_glbp_tlv_invalid_bytes_used);
|
2012-07-12 17:22:47 +00:00
|
|
|
return lastoffset;
|
2009-06-19 05:29:20 +00:00
|
|
|
}
|
2012-07-12 17:22:47 +00:00
|
|
|
/* Skip over trailing bytes before starting with the next element */
|
|
|
|
if (lastoffset + length > offset)
|
|
|
|
offset = lastoffset + length;
|
2009-06-19 05:29:20 +00:00
|
|
|
}
|
2009-06-20 16:07:01 +00:00
|
|
|
return offset;
|
2009-06-19 05:29:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
test_glbp(tvbuff_t *tvb, packet_info *pinfo)
|
|
|
|
{
|
2011-10-20 14:07:54 +00:00
|
|
|
guint32 unknown1;
|
2014-06-19 17:18:16 +00:00
|
|
|
if ( tvb_length(tvb) < 2)
|
2011-10-20 14:07:54 +00:00
|
|
|
return FALSE;
|
|
|
|
unknown1 = tvb_get_guint8(tvb, 1);
|
|
|
|
if (tvb_get_guint8(tvb, 0) != 1 /* version? */
|
|
|
|
|| unknown1 > 4
|
|
|
|
|| pinfo->srcport != pinfo->destport
|
2009-06-19 05:29:20 +00:00
|
|
|
#if 0 /* XXX */
|
2011-10-20 14:07:54 +00:00
|
|
|
|| unknown1 == 0 && pinfo->net_dst != ipv4:224.0.0.102
|
|
|
|
&& pinfo->net_dst != ipv6:...
|
|
|
|
|| unknown1 == 0 && pinfo->dl_src != ether:c2-00-7c-b8-00-00
|
2009-06-19 05:29:20 +00:00
|
|
|
#endif
|
2011-10-20 14:07:54 +00:00
|
|
|
) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
return TRUE;
|
2009-06-19 05:29:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2012-09-10 21:40:21 +00:00
|
|
|
dissect_glbp_static(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
2009-06-19 05:29:20 +00:00
|
|
|
{
|
2011-10-20 14:07:54 +00:00
|
|
|
if ( !test_glbp(tvb, pinfo) ) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
return dissect_glbp(tvb, pinfo, tree);
|
2009-06-19 05:29:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_glbp(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] = {
|
2011-10-20 14:07:54 +00:00
|
|
|
/* Header */
|
|
|
|
{ &hf_glbp_version,
|
|
|
|
{ "Version?", "glbp.version", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_unknown1,
|
|
|
|
{ "Unknown1", "glbp.unknown1", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_group,
|
|
|
|
{ "Group", "glbp.group", FT_UINT16, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_unknown2,
|
|
|
|
{ "Unknown2", "glbp.unknown2", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_ownerid,
|
|
|
|
{ "Owner ID", "glbp.ownerid", FT_ETHER, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_tlv,
|
|
|
|
{ "TLV", "glbp.tlv", FT_PROTOCOL, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_type,
|
|
|
|
{ "Type", "glbp.type", FT_UINT8, BASE_DEC, VALS(glbp_type_vals),
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_length,
|
|
|
|
{ "Length", "glbp.length", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
/* type = 1 - hello */
|
|
|
|
{ &hf_glbp_hello_unknown10,
|
|
|
|
{ "Unknown1-0", "glbp.hello.unknown10", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_vgstate,
|
|
|
|
{ "VG state?", "glbp.hello.vgstate", FT_UINT8, BASE_DEC, VALS(glbp_vgstate_vals),
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_unknown11,
|
|
|
|
{ "Unknown1-1", "glbp.hello.unknown11", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_priority,
|
|
|
|
{ "Priority", "glbp.hello.priority", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_unknown12,
|
|
|
|
{ "Unknown1-2", "glbp.hello.unknown12", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_helloint,
|
|
|
|
{ "Helloint", "glbp.hello.helloint", FT_UINT32, BASE_DEC, NULL,
|
|
|
|
0x0, "Hello interval [msec]", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_holdint,
|
|
|
|
{ "Holdint", "glbp.hello.holdint", FT_UINT32, BASE_DEC, NULL,
|
|
|
|
0x0, "Hold interval [msec]", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_redirect,
|
|
|
|
{ "Redirect", "glbp.hello.redirect", FT_UINT16, BASE_DEC, NULL,
|
|
|
|
0x0, "Redirect interval [sec]", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_timeout,
|
|
|
|
{ "Timeout", "glbp.hello.timeout", FT_UINT16, BASE_DEC, NULL,
|
|
|
|
0x0, "Forwarder timeout interval [sec]", HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_unknown13,
|
|
|
|
{ "Unknown1-3", "glbp.hello.unknown13", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_addrtype,
|
|
|
|
{ "Address type", "glbp.hello.addrtype", FT_UINT8, BASE_DEC, VALS(glbp_addr_type_vals),
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_addrlen,
|
|
|
|
{ "Address length", "glbp.hello.addrlen", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_virtualipv4,
|
|
|
|
{ "Virtual IPv4", "glbp.hello.virtualipv4", FT_IPv4, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_virtualipv6,
|
|
|
|
{ "Virtual IPv6", "glbp.hello.virtualipv6", FT_IPv6, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_hello_virtualunk,
|
|
|
|
{ "Virtual Unknown", "glbp.hello.virtualunk", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
/* type = 2 - request/response??? */
|
|
|
|
{ &hf_glbp_reqresp_forwarder,
|
|
|
|
{ "Forwarder?", "glbp.reqresp.forwarder", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
|
|
|
|
|
|
|
{ &hf_glbp_reqresp_vfstate,
|
|
|
|
{ "VF state?", "glbp.reqresp.vfstate", FT_UINT8, BASE_DEC, VALS(glbp_vfstate_vals),
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-20 16:07:01 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ &hf_glbp_reqresp_unknown21,
|
|
|
|
{ "Unknown2-1", "glbp.reqresp.unknown21", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-20 16:07:01 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ &hf_glbp_reqresp_priority,
|
|
|
|
{ "Priority", "glbp.reqresp.priority", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-22 06:28:10 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ &hf_glbp_reqresp_weight,
|
|
|
|
{ "Weight", "glbp.reqresp.weight", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-22 06:28:10 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ &hf_glbp_reqresp_unknown22,
|
|
|
|
{ "Unknown2-2", "glbp.reqresp.unknown22", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-22 06:28:10 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ &hf_glbp_reqresp_virtualmac,
|
|
|
|
{ "Virtualmac", "glbp.reqresp.virtualmac", FT_ETHER, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-20 16:07:01 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
/* type = 3 - auth */
|
2011-10-20 14:11:32 +00:00
|
|
|
{ &hf_glbp_auth_authtype,
|
|
|
|
{ "Authtype", "glbp.auth.authtype", FT_UINT8, BASE_DEC, VALS(glbp_auth_type_vals),
|
2011-10-20 14:07:54 +00:00
|
|
|
0x0, NULL, HFILL }},
|
2009-06-20 16:07:01 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ &hf_glbp_auth_authlength,
|
|
|
|
{ "Authlength", "glbp.auth.authlength", FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-20 16:07:01 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ &hf_glbp_auth_plainpass,
|
|
|
|
{ "Plain pass", "glbp.auth.plainpass", FT_STRING, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-20 16:07:01 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ &hf_glbp_auth_md5hash,
|
|
|
|
{ "MD5-string hash", "glbp.auth.md5hash", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-20 16:07:01 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ &hf_glbp_auth_md5chainindex,
|
|
|
|
{ "MD5-chain index", "glbp.auth.md5chainindex", FT_UINT32, BASE_DEC, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ &hf_glbp_auth_md5chainhash,
|
|
|
|
{ "MD5-chain hash", "glbp.auth.md5chainhash", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
{ &hf_glbp_auth_authunknown,
|
|
|
|
{ "Unknown auth value", "glbp.auth.authunknown", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-19 05:29:20 +00:00
|
|
|
|
2011-10-20 14:07:54 +00:00
|
|
|
/* type = unknown */
|
|
|
|
{ &hf_glbp_unknown_data,
|
|
|
|
{ "Unknown TLV data", "glbp.unknown.data", FT_BYTES, BASE_NONE, NULL,
|
|
|
|
0x0, NULL, HFILL }},
|
2009-06-19 05:29:20 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_glbp,
|
2009-06-20 16:07:01 +00:00
|
|
|
&ett_glbp_tlv,
|
2009-06-19 05:29:20 +00:00
|
|
|
};
|
|
|
|
|
2013-05-31 23:11:43 +00:00
|
|
|
static ei_register_info ei[] = {
|
|
|
|
{ &ei_glbp_ipv4_wrong_length,
|
|
|
|
{ "glbp.ipv4_wrong_length", PI_MALFORMED, PI_ERROR,
|
|
|
|
"Wrong IPv4 address length: %u",
|
|
|
|
EXPFILL }},
|
|
|
|
{ &ei_glbp_ipv6_wrong_length,
|
|
|
|
{ "glbp.ipv6_wrong_length", PI_MALFORMED, PI_ERROR,
|
|
|
|
"Wrong IPv6 address length: %u",
|
|
|
|
EXPFILL }},
|
|
|
|
{ &ei_glbp_tlv_length_too_small,
|
|
|
|
{ "glbp.tlv_length_too_small", PI_MALFORMED, PI_ERROR,
|
|
|
|
"Length %u too small",
|
|
|
|
EXPFILL }},
|
|
|
|
{ &ei_glbp_tlv_invalid_bytes_used,
|
|
|
|
{ "glbp.tlv_invalid_bytes_used", PI_MALFORMED, PI_ERROR,
|
|
|
|
"Zero or negative length",
|
|
|
|
EXPFILL }},
|
|
|
|
};
|
|
|
|
|
|
|
|
expert_module_t* expert_glbp;
|
|
|
|
|
2009-06-19 05:29:20 +00:00
|
|
|
proto_glbp = proto_register_protocol(
|
2011-10-20 14:07:54 +00:00
|
|
|
"Gateway Load Balancing Protocol", "GLBP", "glbp");
|
2009-06-19 05:29:20 +00:00
|
|
|
proto_register_field_array(proto_glbp, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2013-05-31 23:11:43 +00:00
|
|
|
expert_glbp = expert_register_protocol(proto_glbp);
|
|
|
|
expert_register_field_array(expert_glbp, ei, array_length(ei));
|
2009-06-19 05:29:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_glbp(void)
|
|
|
|
{
|
|
|
|
dissector_handle_t glbp_handle;
|
|
|
|
|
|
|
|
glbp_handle = new_create_dissector_handle(dissect_glbp_static, proto_glbp);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("udp.port", 3222, glbp_handle);
|
2009-06-19 05:29:20 +00:00
|
|
|
}
|
2014-09-29 18:07:49 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 2
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=2 tabstop=8 expandtab:
|
|
|
|
* :indentSize=2:tabSize=8:noTabs=true:
|
|
|
|
*/
|