2008-06-22 00:14:33 +00:00
|
|
|
/* packet-bat.c
|
|
|
|
* Routines for B.A.T.M.A.N. Layer 3 dissection
|
2011-02-07 23:14:54 +00:00
|
|
|
* Copyright 2008-2010 Sven Eckelmann <sven@narfation.org>
|
2008-06-22 00:14:33 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/prefs.h>
|
|
|
|
#include <epan/tap.h>
|
|
|
|
#include <epan/addr_resolv.h>
|
2013-12-15 23:44:12 +00:00
|
|
|
void proto_register_bat(void);
|
|
|
|
void proto_reg_handoff_bat(void);
|
|
|
|
|
2010-06-03 00:26:27 +00:00
|
|
|
/* Start content from packet-bat.h */
|
|
|
|
#define BAT_BATMAN_PORT 4305
|
|
|
|
#define BAT_GW_PORT 4306
|
|
|
|
#define BAT_VIS_PORT 4307
|
|
|
|
|
|
|
|
#define UNIDIRECTIONAL 0x80
|
|
|
|
#define DIRECTLINK 0x40
|
|
|
|
|
|
|
|
struct batman_packet_v5 {
|
|
|
|
guint8 version; /* batman version field */
|
|
|
|
guint8 flags; /* 0x80: UNIDIRECTIONAL link, 0x40: DIRECTLINK flag, ... */
|
|
|
|
guint8 ttl;
|
|
|
|
guint8 gwflags; /* flags related to gateway functions: gateway class */
|
|
|
|
guint16 seqno;
|
|
|
|
guint16 gwport;
|
|
|
|
address orig;
|
|
|
|
address old_orig;
|
|
|
|
guint8 tq;
|
|
|
|
guint8 hna_len;
|
|
|
|
};
|
|
|
|
#define BATMAN_PACKET_V5_SIZE 18
|
|
|
|
|
|
|
|
struct gw_packet {
|
|
|
|
guint8 type;
|
|
|
|
};
|
|
|
|
#define GW_PACKET_SIZE 1
|
|
|
|
|
2014-10-03 14:13:07 +00:00
|
|
|
#define TUNNEL_DATA 0x01
|
|
|
|
#define TUNNEL_IP_REQUEST 0x02
|
|
|
|
#define TUNNEL_IP_INVALID 0x03
|
2010-06-03 00:26:27 +00:00
|
|
|
#define TUNNEL_KEEPALIVE_REQUEST 0x04
|
2014-10-03 14:13:07 +00:00
|
|
|
#define TUNNEL_KEEPALIVE_REPLY 0x05
|
2010-06-03 00:26:27 +00:00
|
|
|
|
2014-10-03 14:13:07 +00:00
|
|
|
#define DATA_TYPE_NEIGH 1
|
2010-06-03 00:26:27 +00:00
|
|
|
#define DATA_TYPE_SEC_IF 2
|
2014-10-03 14:13:07 +00:00
|
|
|
#define DATA_TYPE_HNA 3
|
2010-06-03 00:26:27 +00:00
|
|
|
|
|
|
|
struct vis_packet_v22 {
|
|
|
|
address sender_ip;
|
|
|
|
guint8 version;
|
|
|
|
guint8 gw_class;
|
|
|
|
guint16 tq_max;
|
|
|
|
};
|
|
|
|
#define VIS_PACKET_V22_SIZE 8
|
|
|
|
|
|
|
|
struct vis_data_v22 {
|
|
|
|
guint8 type;
|
|
|
|
guint16 data;
|
|
|
|
address ip;
|
|
|
|
};
|
|
|
|
#define VIS_PACKET_V22_DATA_SIZE 7
|
|
|
|
|
|
|
|
struct vis_packet_v23 {
|
|
|
|
address sender_ip;
|
|
|
|
guint8 version;
|
|
|
|
guint8 gw_class;
|
|
|
|
guint8 tq_max;
|
|
|
|
};
|
|
|
|
#define VIS_PACKET_V23_SIZE 7
|
|
|
|
|
|
|
|
struct vis_data_v23 {
|
|
|
|
guint8 type;
|
|
|
|
guint8 data;
|
|
|
|
address ip;
|
|
|
|
};
|
|
|
|
#define VIS_PACKET_V23_DATA_SIZE 6
|
|
|
|
/* End content from packet-bat.h */
|
2008-06-22 00:14:33 +00:00
|
|
|
|
2008-10-06 20:24:02 +00:00
|
|
|
/* trees */
|
|
|
|
static gint ett_bat_batman = -1;
|
|
|
|
static gint ett_bat_batman_flags = -1;
|
|
|
|
static gint ett_bat_batman_gwflags = -1;
|
|
|
|
static gint ett_bat_batman_hna = -1;
|
|
|
|
static gint ett_bat_gw = -1;
|
|
|
|
static gint ett_bat_vis = -1;
|
|
|
|
static gint ett_bat_vis_entry = -1;
|
|
|
|
|
|
|
|
/* hfs */
|
|
|
|
static int hf_bat_batman_version = -1;
|
|
|
|
static int hf_bat_batman_flags = -1;
|
|
|
|
static int hf_bat_batman_ttl = -1;
|
|
|
|
static int hf_bat_batman_gwflags = -1;
|
2014-08-01 14:08:57 +00:00
|
|
|
static int hf_bat_batman_gwflags_dl_speed = -1;
|
|
|
|
static int hf_bat_batman_gwflags_ul_speed = -1;
|
2008-10-06 20:24:02 +00:00
|
|
|
static int hf_bat_batman_seqno = -1;
|
|
|
|
static int hf_bat_batman_gwport = -1;
|
|
|
|
static int hf_bat_batman_orig = -1;
|
|
|
|
static int hf_bat_batman_old_orig = -1;
|
|
|
|
static int hf_bat_batman_tq = -1;
|
|
|
|
static int hf_bat_batman_hna_len = -1;
|
|
|
|
static int hf_bat_batman_hna_network = -1;
|
|
|
|
static int hf_bat_batman_hna_netmask = -1;
|
|
|
|
|
|
|
|
static int hf_bat_gw_type = -1;
|
|
|
|
static int hf_bat_gw_ip = -1;
|
|
|
|
|
|
|
|
static int hf_bat_vis_vis_orig = -1;
|
|
|
|
static int hf_bat_vis_version = -1;
|
|
|
|
static int hf_bat_vis_gwflags = -1;
|
|
|
|
static int hf_bat_max_tq_v22 = -1;
|
|
|
|
static int hf_bat_max_tq_v23 = -1;
|
|
|
|
static int hf_bat_vis_data_type = -1;
|
|
|
|
static int hf_bat_vis_netmask = -1;
|
|
|
|
static int hf_bat_vis_tq_v22 = -1;
|
|
|
|
static int hf_bat_vis_tq_v23 = -1;
|
|
|
|
static int hf_bat_vis_data_ip = -1;
|
|
|
|
|
|
|
|
/* flags */
|
|
|
|
static int hf_bat_batman_flags_unidirectional = -1;
|
|
|
|
static int hf_bat_batman_flags_directlink = -1;
|
|
|
|
|
|
|
|
static const value_string gw_packettypenames[] = {
|
2014-10-03 14:13:07 +00:00
|
|
|
{ TUNNEL_DATA, "DATA" },
|
|
|
|
{ TUNNEL_IP_REQUEST, "IP_REQUEST" },
|
|
|
|
{ TUNNEL_IP_INVALID, "IP_INVALID" },
|
2008-10-06 20:24:02 +00:00
|
|
|
{ TUNNEL_KEEPALIVE_REQUEST, "KEEPALIVE_REQUEST" },
|
2014-10-03 14:13:07 +00:00
|
|
|
{ TUNNEL_KEEPALIVE_REPLY, "KEEPALIVE_REPLY" },
|
2008-10-06 20:24:02 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string vis_packettypenames[] = {
|
2014-10-03 14:13:07 +00:00
|
|
|
{ DATA_TYPE_NEIGH, "NEIGH" },
|
2008-10-06 20:24:02 +00:00
|
|
|
{ DATA_TYPE_SEC_IF, "SEC_IF" },
|
2014-10-03 14:13:07 +00:00
|
|
|
{ DATA_TYPE_HNA, "HNA" },
|
2008-10-06 20:24:02 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
/* supported packet dissectors */
|
|
|
|
static void dissect_bat_batman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
2010-06-04 01:32:21 +00:00
|
|
|
static int dissect_bat_batman_v5(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
static void dissect_bat_gw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
|
|
|
|
|
|
|
static void dissect_bat_vis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
|
|
|
static void dissect_bat_vis_v22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
|
|
|
static void dissect_vis_entry_v22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
|
|
|
static void dissect_bat_vis_v23(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
|
|
|
static void dissect_vis_entry_v23(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
|
|
|
|
|
|
|
static void dissect_bat_hna(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree);
|
|
|
|
|
|
|
|
/* other dissectors */
|
|
|
|
static dissector_handle_t ip_handle;
|
|
|
|
static dissector_handle_t data_handle;
|
|
|
|
|
|
|
|
static int proto_bat_plugin = -1;
|
2008-06-22 00:14:33 +00:00
|
|
|
|
|
|
|
/* tap */
|
2008-10-06 20:24:02 +00:00
|
|
|
static int bat_tap = -1;
|
|
|
|
static int bat_follow_tap = -1;
|
|
|
|
|
|
|
|
/* values changed by preferences */
|
|
|
|
static guint global_bat_batman_udp_port = BAT_BATMAN_PORT;
|
2014-10-03 14:13:07 +00:00
|
|
|
static guint global_bat_gw_udp_port = BAT_GW_PORT;
|
|
|
|
static guint global_bat_vis_udp_port = BAT_VIS_PORT;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_bat_batman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
guint8 version;
|
2010-06-04 01:32:21 +00:00
|
|
|
int offset = 0;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
/* set protocol name */
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BAT_BATMAN");
|
2009-09-24 17:30:20 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
version = tvb_get_guint8(tvb, 0);
|
|
|
|
switch (version) {
|
|
|
|
case 5:
|
2013-03-28 16:02:41 +00:00
|
|
|
while (tvb_reported_length_remaining(tvb, offset) > 0) {
|
2010-06-04 01:32:21 +00:00
|
|
|
offset = dissect_bat_batman_v5(tvb, offset, pinfo, tree);
|
|
|
|
}
|
2008-10-06 20:24:02 +00:00
|
|
|
break;
|
|
|
|
default:
|
2010-06-03 00:26:27 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "Unsupported Version %d", version);
|
2008-10-06 20:24:02 +00:00
|
|
|
call_dissector(data_handle, tvb, pinfo, tree);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dissect_bat_gwflags(tvbuff_t *tvb, guint8 gwflags, int offset, proto_item *tgw)
|
|
|
|
{
|
|
|
|
proto_tree *gwflags_tree;
|
|
|
|
guint8 s = (gwflags & 0x80) >> 7;
|
2010-06-03 00:26:27 +00:00
|
|
|
guint8 downbits = (gwflags & 0x78) >> 3;
|
2008-10-06 20:24:02 +00:00
|
|
|
guint8 upbits = (gwflags & 0x07);
|
2014-10-03 14:13:07 +00:00
|
|
|
guint down, up;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
down = 32 * (s + 2) * (1 << downbits);
|
|
|
|
up = ((upbits + 1) * down) / 8;
|
|
|
|
|
|
|
|
gwflags_tree = proto_item_add_subtree(tgw, ett_bat_batman_gwflags);
|
2014-08-01 14:08:57 +00:00
|
|
|
proto_tree_add_uint_format_value(gwflags_tree, hf_bat_batman_gwflags_dl_speed, tvb, offset, 1, down, "%dkbit", down);
|
|
|
|
proto_tree_add_uint_format_value(gwflags_tree, hf_bat_batman_gwflags_ul_speed, tvb, offset, 1, up, "%dkbit", up);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2010-06-04 01:32:21 +00:00
|
|
|
static int dissect_bat_batman_v5(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
|
2008-10-06 20:24:02 +00:00
|
|
|
{
|
2014-11-29 20:41:12 +00:00
|
|
|
proto_item *tgw;
|
|
|
|
proto_tree *bat_batman_tree = NULL;
|
2008-10-06 20:24:02 +00:00
|
|
|
struct batman_packet_v5 *batman_packeth;
|
|
|
|
guint32 old_orig, orig;
|
|
|
|
gint i;
|
2014-11-29 20:41:12 +00:00
|
|
|
static const int * batman_flags[] = {
|
|
|
|
&hf_bat_batman_flags_unidirectional,
|
|
|
|
&hf_bat_batman_flags_directlink,
|
|
|
|
NULL
|
|
|
|
};
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
tvbuff_t *next_tvb;
|
|
|
|
|
2013-09-12 22:03:31 +00:00
|
|
|
batman_packeth = wmem_new(wmem_packet_scope(), struct batman_packet_v5);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2010-06-04 01:32:21 +00:00
|
|
|
batman_packeth->version = tvb_get_guint8(tvb, offset+0);
|
|
|
|
batman_packeth->flags = tvb_get_guint8(tvb, offset+1);
|
|
|
|
batman_packeth->ttl = tvb_get_guint8(tvb, offset+2);
|
|
|
|
batman_packeth->gwflags = tvb_get_guint8(tvb, offset+3);
|
|
|
|
batman_packeth->seqno = tvb_get_ntohs(tvb, offset+4);
|
|
|
|
batman_packeth->gwport = tvb_get_ntohs(tvb, offset+6);
|
|
|
|
orig = tvb_get_ipv4(tvb, offset+8);
|
2015-01-06 19:54:03 +00:00
|
|
|
TVB_SET_ADDRESS(&batman_packeth->orig, AT_IPv4, tvb, offset+8, 4);
|
2010-06-04 01:32:21 +00:00
|
|
|
old_orig = tvb_get_ipv4(tvb, offset+12);
|
2015-01-06 19:54:03 +00:00
|
|
|
TVB_SET_ADDRESS(&batman_packeth->old_orig, AT_IPv4, tvb, offset+12, 4);
|
2010-06-04 01:32:21 +00:00
|
|
|
batman_packeth->tq = tvb_get_guint8(tvb, offset+16);
|
|
|
|
batman_packeth->hna_len = tvb_get_guint8(tvb, offset+17);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
/* Set info column */
|
2010-06-03 00:26:27 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "Seq=%u", batman_packeth->seqno);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
/* Set tree info */
|
|
|
|
if (tree) {
|
2010-06-04 01:32:21 +00:00
|
|
|
proto_item *ti;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2014-12-21 13:02:26 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_bat_plugin, tvb, offset, BATMAN_PACKET_V5_SIZE,
|
2009-09-24 17:30:20 +00:00
|
|
|
"B.A.T.M.A.N., Orig: %s (%s)",
|
2014-12-21 13:02:26 +00:00
|
|
|
get_hostname(orig), address_to_str(wmem_packet_scope(), &batman_packeth->orig));
|
2008-10-06 20:24:02 +00:00
|
|
|
bat_batman_tree = proto_item_add_subtree(ti, ett_bat_batman);
|
2010-06-04 01:32:21 +00:00
|
|
|
}
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2010-06-04 01:32:21 +00:00
|
|
|
/* items */
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_batman_tree, hf_bat_batman_version, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2010-06-04 01:32:21 +00:00
|
|
|
offset += 1;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2014-11-29 20:41:12 +00:00
|
|
|
proto_tree_add_bitmask(bat_batman_tree, tvb, offset, hf_bat_batman_flags,
|
|
|
|
ett_bat_batman_flags, batman_flags, ENC_NA);
|
2010-06-04 01:32:21 +00:00
|
|
|
offset += 1;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_batman_tree, hf_bat_batman_ttl, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2010-06-04 01:32:21 +00:00
|
|
|
offset += 1;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
tgw = proto_tree_add_item(bat_batman_tree, hf_bat_batman_gwflags, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2010-06-04 01:32:21 +00:00
|
|
|
dissect_bat_gwflags(tvb, batman_packeth->gwflags, offset, tgw);
|
|
|
|
offset += 1;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_batman_tree, hf_bat_batman_seqno, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2010-06-04 01:32:21 +00:00
|
|
|
offset += 2;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_batman_tree, hf_bat_batman_gwport, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2010-06-04 01:32:21 +00:00
|
|
|
offset += 2;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2010-06-04 01:32:21 +00:00
|
|
|
proto_tree_add_ipv4(bat_batman_tree, hf_bat_batman_orig, tvb, offset, 4, orig);
|
|
|
|
offset += 4;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2010-06-04 01:32:21 +00:00
|
|
|
proto_tree_add_ipv4(bat_batman_tree, hf_bat_batman_old_orig, tvb, offset, 4, old_orig);
|
|
|
|
offset += 4;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_batman_tree, hf_bat_batman_tq, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2010-06-04 01:32:21 +00:00
|
|
|
offset += 1;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_batman_tree, hf_bat_batman_hna_len, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2010-06-04 01:32:21 +00:00
|
|
|
offset += 1;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2010-06-04 01:32:21 +00:00
|
|
|
tap_queue_packet(bat_tap, pinfo, batman_packeth);
|
2010-06-03 00:26:27 +00:00
|
|
|
|
2010-06-04 01:32:21 +00:00
|
|
|
for (i = 0; i < batman_packeth->hna_len; i++) {
|
2014-06-06 14:35:50 +00:00
|
|
|
next_tvb = tvb_new_subset_length(tvb, offset, 5);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
if (have_tap_listener(bat_follow_tap)) {
|
|
|
|
tap_queue_packet(bat_follow_tap, pinfo, next_tvb);
|
|
|
|
}
|
|
|
|
|
2010-06-04 01:32:21 +00:00
|
|
|
dissect_bat_hna(next_tvb, pinfo, bat_batman_tree);
|
|
|
|
offset += 5;
|
2008-10-06 20:24:02 +00:00
|
|
|
}
|
2010-06-04 01:32:21 +00:00
|
|
|
|
|
|
|
return offset;
|
2008-10-06 20:24:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void dissect_bat_hna(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
|
|
|
|
{
|
|
|
|
guint32 hna;
|
|
|
|
guint8 hna_netmask;
|
|
|
|
|
|
|
|
hna = tvb_get_ipv4(tvb, 0);
|
|
|
|
hna_netmask = tvb_get_guint8(tvb, 4);
|
|
|
|
|
|
|
|
|
|
|
|
/* Set tree info */
|
|
|
|
if (tree) {
|
2010-06-03 00:26:27 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *bat_batman_hna_tree;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
if (PTREE_DATA(tree)->visible) {
|
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_bat_plugin, tvb, 0, 5,
|
2009-09-24 17:30:20 +00:00
|
|
|
"B.A.T.M.A.N. HNA: %s/%d",
|
2011-02-16 03:08:45 +00:00
|
|
|
tvb_ip_to_str(tvb, 0), hna_netmask);
|
2008-10-06 20:24:02 +00:00
|
|
|
} else {
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_bat_plugin, tvb, 0, 5, ENC_NA);
|
2008-10-06 20:24:02 +00:00
|
|
|
}
|
|
|
|
bat_batman_hna_tree = proto_item_add_subtree(ti, ett_bat_batman_hna);
|
|
|
|
|
|
|
|
proto_tree_add_ipv4(bat_batman_hna_tree, hf_bat_batman_hna_network, tvb, 0, 4, hna);
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_batman_hna_tree, hf_bat_batman_hna_netmask, tvb, 4, 1, ENC_BIG_ENDIAN);
|
2008-10-06 20:24:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void dissect_bat_gw(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
struct gw_packet *gw_packeth;
|
|
|
|
guint32 ip;
|
|
|
|
int ip_pos;
|
|
|
|
|
|
|
|
tvbuff_t *next_tvb;
|
2013-03-28 16:02:41 +00:00
|
|
|
gint length_remaining;
|
2008-10-06 20:24:02 +00:00
|
|
|
int offset = 0;
|
|
|
|
|
2013-09-12 22:03:31 +00:00
|
|
|
gw_packeth = wmem_new(wmem_packet_scope(), struct gw_packet);
|
2008-10-06 20:24:02 +00:00
|
|
|
gw_packeth->type = tvb_get_guint8(tvb, 0);
|
|
|
|
|
|
|
|
switch (gw_packeth->type) {
|
|
|
|
case TUNNEL_IP_INVALID:
|
|
|
|
ip_pos = 13;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ip_pos = 1;
|
|
|
|
}
|
|
|
|
ip = tvb_get_ipv4(tvb, ip_pos);
|
|
|
|
|
|
|
|
/* set protocol name */
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BAT_GW");
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
/* Set info column */
|
2011-09-26 08:25:18 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "Type=%s",
|
|
|
|
val_to_str(gw_packeth->type, gw_packettypenames, "Unknown (0x%02x)"));
|
|
|
|
if (ip != 0) {
|
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " IP: %s (%s)",
|
|
|
|
get_hostname(ip), tvb_ip_to_str(tvb, ip_pos));
|
2008-10-06 20:24:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Set tree info */
|
|
|
|
if (tree) {
|
2010-06-03 00:26:27 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *bat_gw_entry_tree;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
if (PTREE_DATA(tree)->visible) {
|
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_bat_plugin, tvb, 0, 1,
|
2009-09-24 17:30:20 +00:00
|
|
|
"B.A.T.M.A.N. GW [%s]",
|
|
|
|
val_to_str(gw_packeth->type, gw_packettypenames, "Unknown (0x%02x)"));
|
2008-10-06 20:24:02 +00:00
|
|
|
} else {
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_bat_plugin, tvb, 0, 1, ENC_NA);
|
2008-10-06 20:24:02 +00:00
|
|
|
}
|
|
|
|
bat_gw_entry_tree = proto_item_add_subtree(ti, ett_bat_gw);
|
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_gw_entry_tree, hf_bat_gw_type, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2013-07-15 18:05:14 +00:00
|
|
|
/*offset += 1;*/
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
if (gw_packeth->type != TUNNEL_DATA && ip != 0) {
|
|
|
|
proto_tree_add_ipv4(bat_gw_entry_tree, hf_bat_gw_ip, tvb, ip_pos, 4, ip);
|
2013-07-15 18:05:14 +00:00
|
|
|
/*offset = ip_pos + 4;*/
|
2008-10-06 20:24:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-03 00:26:27 +00:00
|
|
|
/* Calculate offset even when we got no tree */
|
|
|
|
offset = 1;
|
|
|
|
if (gw_packeth->type != TUNNEL_DATA && ip != 0)
|
|
|
|
offset = ip_pos + 4;
|
|
|
|
|
2008-10-06 20:24:02 +00:00
|
|
|
length_remaining = tvb_reported_length_remaining(tvb, offset);
|
2013-03-28 16:02:41 +00:00
|
|
|
if (length_remaining > 0) {
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
if (have_tap_listener(bat_follow_tap)) {
|
|
|
|
tap_queue_packet(bat_follow_tap, pinfo, next_tvb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gw_packeth->type == TUNNEL_DATA) {
|
|
|
|
call_dissector(ip_handle, next_tvb, pinfo, tree);
|
|
|
|
} else {
|
|
|
|
call_dissector(data_handle, next_tvb, pinfo, tree);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dissect_bat_vis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
guint8 version;
|
|
|
|
|
|
|
|
/* set protocol name */
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BAT_VIS");
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
version = tvb_get_guint8(tvb, 4);
|
|
|
|
switch (version) {
|
|
|
|
case 22:
|
|
|
|
dissect_bat_vis_v22(tvb, pinfo, tree);
|
|
|
|
break;
|
|
|
|
case 23:
|
|
|
|
dissect_bat_vis_v23(tvb, pinfo, tree);
|
|
|
|
break;
|
|
|
|
default:
|
2010-06-03 00:26:27 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "Unsupported Version %d", version);
|
2008-10-06 20:24:02 +00:00
|
|
|
call_dissector(data_handle, tvb, pinfo, tree);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dissect_bat_vis_v22(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
struct vis_packet_v22 *vis_packeth;
|
|
|
|
guint32 sender_ip;
|
|
|
|
proto_tree *bat_vis_tree = NULL;
|
|
|
|
|
|
|
|
tvbuff_t *next_tvb;
|
2013-03-28 16:02:41 +00:00
|
|
|
gint length_remaining, i;
|
2008-10-06 20:24:02 +00:00
|
|
|
int offset = 0;
|
|
|
|
|
2013-09-12 22:03:31 +00:00
|
|
|
vis_packeth = wmem_new(wmem_packet_scope(), struct vis_packet_v22);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
sender_ip = tvb_get_ipv4(tvb, 0);
|
2015-01-06 19:54:03 +00:00
|
|
|
TVB_SET_ADDRESS(&vis_packeth->sender_ip, AT_IPv4, tvb, 0, 4);
|
2008-10-06 20:24:02 +00:00
|
|
|
vis_packeth->version = tvb_get_guint8(tvb, 4);
|
|
|
|
vis_packeth->gw_class = tvb_get_guint8(tvb, 5);
|
|
|
|
vis_packeth->tq_max = tvb_get_ntohs(tvb, 6);
|
|
|
|
|
|
|
|
/* set protocol name */
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BAT_VIS");
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
/* Set info column */
|
2011-09-26 08:25:18 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "Src: %s (%s)",
|
2014-12-21 13:02:26 +00:00
|
|
|
get_hostname(sender_ip), address_to_str(wmem_packet_scope(), &vis_packeth->sender_ip));
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
/* Set tree info */
|
|
|
|
if (tree) {
|
2010-06-03 00:26:27 +00:00
|
|
|
proto_item *ti;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2014-12-21 13:02:26 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_bat_plugin, tvb, 0, VIS_PACKET_V22_SIZE,
|
2009-09-24 17:30:20 +00:00
|
|
|
"B.A.T.M.A.N. Vis, Src: %s (%s)",
|
2014-12-21 13:02:26 +00:00
|
|
|
get_hostname(sender_ip), address_to_str(wmem_packet_scope(), &vis_packeth->sender_ip));
|
2008-10-06 20:24:02 +00:00
|
|
|
bat_vis_tree = proto_item_add_subtree(ti, ett_bat_vis);
|
|
|
|
|
|
|
|
/* items */
|
|
|
|
proto_tree_add_ipv4(bat_vis_tree, hf_bat_vis_vis_orig, tvb, offset, 4, sender_ip);
|
|
|
|
offset += 4;
|
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_tree, hf_bat_vis_version, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2008-10-06 20:24:02 +00:00
|
|
|
offset += 1;
|
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_tree, hf_bat_vis_gwflags, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2008-10-06 20:24:02 +00:00
|
|
|
offset += 1;
|
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_tree, hf_bat_max_tq_v22, tvb, offset, 2, ENC_BIG_ENDIAN);
|
2013-07-15 18:05:14 +00:00
|
|
|
/*offset += 2;*/
|
2008-10-06 20:24:02 +00:00
|
|
|
}
|
|
|
|
|
2010-06-03 00:26:27 +00:00
|
|
|
/* Calculate offset even when we got no tree */
|
|
|
|
offset = VIS_PACKET_V22_SIZE;
|
|
|
|
|
2008-10-06 20:24:02 +00:00
|
|
|
tap_queue_packet(bat_tap, pinfo, vis_packeth);
|
|
|
|
|
|
|
|
length_remaining = tvb_reported_length_remaining(tvb, offset);
|
|
|
|
|
|
|
|
for (i = 0; i < length_remaining; i += VIS_PACKET_V22_DATA_SIZE) {
|
2014-06-06 14:35:50 +00:00
|
|
|
next_tvb = tvb_new_subset_length(tvb, offset, VIS_PACKET_V22_DATA_SIZE);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
if (have_tap_listener(bat_follow_tap)) {
|
|
|
|
tap_queue_packet(bat_follow_tap, pinfo, next_tvb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bat_vis_tree != NULL) {
|
|
|
|
dissect_vis_entry_v22(next_tvb, pinfo, tree);
|
|
|
|
}
|
|
|
|
|
|
|
|
offset += VIS_PACKET_V22_DATA_SIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
length_remaining = tvb_reported_length_remaining(tvb, offset);
|
2013-03-28 16:02:41 +00:00
|
|
|
if (length_remaining > 0) {
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
if (have_tap_listener(bat_follow_tap)) {
|
|
|
|
tap_queue_packet(bat_follow_tap, pinfo, next_tvb);
|
|
|
|
}
|
|
|
|
|
|
|
|
call_dissector(data_handle, next_tvb, pinfo, tree);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dissect_vis_entry_v22(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
|
|
|
|
{
|
|
|
|
struct vis_data_v22 *vis_datah;
|
|
|
|
guint32 ip;
|
|
|
|
|
2013-09-12 22:03:31 +00:00
|
|
|
vis_datah = wmem_new(wmem_packet_scope(), struct vis_data_v22);
|
2008-10-06 20:24:02 +00:00
|
|
|
vis_datah->type = tvb_get_guint8(tvb, 0);
|
|
|
|
vis_datah->data = tvb_get_ntohs(tvb, 1);
|
|
|
|
ip = tvb_get_ipv4(tvb, 3);
|
2015-01-06 19:54:03 +00:00
|
|
|
TVB_SET_ADDRESS(&vis_datah->ip, AT_IPv4, tvb, 3, 4);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Set tree info */
|
|
|
|
if (tree) {
|
2010-06-03 00:26:27 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *bat_vis_entry_tree;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2014-12-21 13:02:26 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_bat_plugin, tvb, 0, 7,
|
2009-09-24 17:30:20 +00:00
|
|
|
"VIS Entry: [%s] %s (%s)",
|
|
|
|
val_to_str(vis_datah->type, vis_packettypenames, "Unknown (0x%02x)"),
|
2014-12-21 13:02:26 +00:00
|
|
|
get_hostname(ip), address_to_str(wmem_packet_scope(), &vis_datah->ip));
|
2008-10-06 20:24:02 +00:00
|
|
|
bat_vis_entry_tree = proto_item_add_subtree(ti, ett_bat_vis_entry);
|
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_entry_tree, hf_bat_vis_data_type, tvb, 0, 1, ENC_BIG_ENDIAN);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
switch (vis_datah->type) {
|
|
|
|
case DATA_TYPE_NEIGH:
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_entry_tree, hf_bat_vis_tq_v22, tvb, 1, 2, ENC_BIG_ENDIAN);
|
2008-10-06 20:24:02 +00:00
|
|
|
break;
|
|
|
|
case DATA_TYPE_HNA:
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_entry_tree, hf_bat_vis_netmask, tvb, 1, 1, ENC_BIG_ENDIAN);
|
2008-10-06 20:24:02 +00:00
|
|
|
break;
|
|
|
|
case DATA_TYPE_SEC_IF:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
proto_tree_add_ipv4(bat_vis_entry_tree, hf_bat_vis_data_ip, tvb, 3, 4, ip);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dissect_bat_vis_v23(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
struct vis_packet_v23 *vis_packeth;
|
|
|
|
guint32 sender_ip;
|
|
|
|
proto_tree *bat_vis_tree = NULL;
|
|
|
|
|
|
|
|
tvbuff_t *next_tvb;
|
2013-03-28 16:02:41 +00:00
|
|
|
gint length_remaining, i;
|
2008-10-06 20:24:02 +00:00
|
|
|
int offset = 0;
|
|
|
|
|
2013-09-12 22:03:31 +00:00
|
|
|
vis_packeth = wmem_new(wmem_packet_scope(), struct vis_packet_v23);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
sender_ip = tvb_get_ipv4(tvb, 0);
|
2015-01-06 19:54:03 +00:00
|
|
|
TVB_SET_ADDRESS(&vis_packeth->sender_ip, AT_IPv4, tvb, 0, 4);
|
2008-10-06 20:24:02 +00:00
|
|
|
vis_packeth->version = tvb_get_guint8(tvb, 4);
|
|
|
|
vis_packeth->gw_class = tvb_get_guint8(tvb, 5);
|
|
|
|
vis_packeth->tq_max = tvb_get_guint8(tvb, 6);
|
|
|
|
|
|
|
|
/* set protocol name */
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BAT_VIS");
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
/* Set info column */
|
2011-09-26 08:25:18 +00:00
|
|
|
col_add_fstr(pinfo->cinfo, COL_INFO, "Src: %s (%s)",
|
2014-12-21 13:02:26 +00:00
|
|
|
get_hostname(sender_ip), address_to_str(wmem_packet_scope(), &vis_packeth->sender_ip));
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
/* Set tree info */
|
|
|
|
if (tree) {
|
2010-06-03 00:26:27 +00:00
|
|
|
proto_item *ti;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2014-12-21 13:02:26 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_bat_plugin, tvb, 0, VIS_PACKET_V23_SIZE,
|
2009-09-24 17:30:20 +00:00
|
|
|
"B.A.T.M.A.N. Vis, Src: %s (%s)",
|
2014-12-21 13:02:26 +00:00
|
|
|
get_hostname(sender_ip), address_to_str(wmem_packet_scope(), &vis_packeth->sender_ip));
|
2008-10-06 20:24:02 +00:00
|
|
|
bat_vis_tree = proto_item_add_subtree(ti, ett_bat_vis);
|
2008-06-22 00:14:33 +00:00
|
|
|
|
2008-10-06 20:24:02 +00:00
|
|
|
/* items */
|
|
|
|
proto_tree_add_ipv4(bat_vis_tree, hf_bat_vis_vis_orig, tvb, offset, 4, sender_ip);
|
|
|
|
offset += 4;
|
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_tree, hf_bat_vis_version, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2008-10-06 20:24:02 +00:00
|
|
|
offset += 1;
|
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_tree, hf_bat_vis_gwflags, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2008-10-06 20:24:02 +00:00
|
|
|
offset += 1;
|
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_tree, hf_bat_max_tq_v23, tvb, offset, 1, ENC_BIG_ENDIAN);
|
2013-07-15 18:05:14 +00:00
|
|
|
/*offset += 1;*/
|
2008-10-06 20:24:02 +00:00
|
|
|
}
|
|
|
|
|
2010-06-03 00:26:27 +00:00
|
|
|
/* Calculate offset even when we got no tree */
|
|
|
|
offset = VIS_PACKET_V23_SIZE;
|
|
|
|
|
2008-10-06 20:24:02 +00:00
|
|
|
tap_queue_packet(bat_tap, pinfo, vis_packeth);
|
|
|
|
|
|
|
|
length_remaining = tvb_reported_length_remaining(tvb, offset);
|
|
|
|
|
|
|
|
for (i = 0; i < length_remaining; i += VIS_PACKET_V23_DATA_SIZE) {
|
2014-06-06 14:35:50 +00:00
|
|
|
next_tvb = tvb_new_subset_length(tvb, offset, VIS_PACKET_V23_DATA_SIZE);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
if (have_tap_listener(bat_follow_tap)) {
|
|
|
|
tap_queue_packet(bat_follow_tap, pinfo, next_tvb);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (bat_vis_tree != NULL) {
|
|
|
|
dissect_vis_entry_v23(next_tvb, pinfo, tree);
|
|
|
|
}
|
|
|
|
|
|
|
|
offset += VIS_PACKET_V23_DATA_SIZE;
|
|
|
|
}
|
|
|
|
|
|
|
|
length_remaining = tvb_reported_length_remaining(tvb, offset);
|
2013-03-28 16:02:41 +00:00
|
|
|
if (length_remaining > 0) {
|
2009-08-16 12:36:22 +00:00
|
|
|
next_tvb = tvb_new_subset_remaining(tvb, offset);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
if (have_tap_listener(bat_follow_tap)) {
|
|
|
|
tap_queue_packet(bat_follow_tap, pinfo, next_tvb);
|
|
|
|
}
|
|
|
|
|
|
|
|
call_dissector(data_handle, next_tvb, pinfo, tree);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void dissect_vis_entry_v23(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
|
|
|
|
{
|
|
|
|
struct vis_data_v23 *vis_datah;
|
|
|
|
guint32 ip;
|
|
|
|
|
2013-09-12 22:03:31 +00:00
|
|
|
vis_datah = wmem_new(wmem_packet_scope(), struct vis_data_v23);
|
2008-10-06 20:24:02 +00:00
|
|
|
vis_datah->type = tvb_get_guint8(tvb, 0);
|
|
|
|
vis_datah->data = tvb_get_guint8(tvb, 1);
|
|
|
|
ip = tvb_get_ipv4(tvb, 2);
|
2015-01-06 19:54:03 +00:00
|
|
|
TVB_SET_ADDRESS(&vis_datah->ip, AT_IPv4, tvb, 2, 4);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Set tree info */
|
|
|
|
if (tree) {
|
2010-06-03 00:26:27 +00:00
|
|
|
proto_item *ti;
|
|
|
|
proto_tree *bat_vis_entry_tree;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
2014-12-21 13:02:26 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_bat_plugin, tvb, 0, 7,
|
2009-09-24 17:30:20 +00:00
|
|
|
"VIS Entry: [%s] %s (%s)",
|
|
|
|
val_to_str(vis_datah->type, vis_packettypenames, "Unknown (0x%02x)"),
|
2014-12-21 13:02:26 +00:00
|
|
|
get_hostname(ip), address_to_str(wmem_packet_scope(), &vis_datah->ip));
|
2008-10-06 20:24:02 +00:00
|
|
|
bat_vis_entry_tree = proto_item_add_subtree(ti, ett_bat_vis_entry);
|
|
|
|
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_entry_tree, hf_bat_vis_data_type, tvb, 0, 1, ENC_BIG_ENDIAN);
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
switch (vis_datah->type) {
|
|
|
|
case DATA_TYPE_NEIGH:
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_entry_tree, hf_bat_vis_tq_v23, tvb, 1, 1, ENC_BIG_ENDIAN);
|
2008-10-06 20:24:02 +00:00
|
|
|
break;
|
|
|
|
case DATA_TYPE_HNA:
|
2011-09-26 08:25:18 +00:00
|
|
|
proto_tree_add_item(bat_vis_entry_tree, hf_bat_vis_netmask, tvb, 1, 1, ENC_BIG_ENDIAN);
|
2008-10-06 20:24:02 +00:00
|
|
|
break;
|
|
|
|
case DATA_TYPE_SEC_IF:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
proto_tree_add_ipv4(bat_vis_entry_tree, hf_bat_vis_data_ip, tvb, 2, 4, ip);
|
|
|
|
}
|
|
|
|
}
|
2009-03-03 19:26:45 +00:00
|
|
|
|
2008-06-22 00:14:33 +00:00
|
|
|
void proto_register_bat(void)
|
|
|
|
{
|
2010-06-03 00:26:27 +00:00
|
|
|
module_t *bat_module;
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_bat_batman_version,
|
|
|
|
{ "Version", "bat.batman.version",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_flags,
|
|
|
|
{ "Flags", "bat.batman.flags",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_ttl,
|
|
|
|
{ "Time to Live", "bat.batman.ttl",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_gwflags,
|
|
|
|
{ "Gateway Flags", "bat.batman.gwflags",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
2014-08-01 14:08:57 +00:00
|
|
|
{ &hf_bat_batman_gwflags_dl_speed,
|
|
|
|
{ "Download Speed", "bat.batman.gwflags.dl_speed",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
|
|
|
{ &hf_bat_batman_gwflags_ul_speed,
|
|
|
|
{ "Upload Speed", "bat.batman.gwflags.ul_speed",
|
|
|
|
FT_UINT32, BASE_DEC, NULL, 0x0,
|
|
|
|
NULL, HFILL }
|
|
|
|
},
|
2008-10-06 20:24:02 +00:00
|
|
|
{ &hf_bat_batman_seqno,
|
|
|
|
{ "Sequence number", "bat.batman.seq",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_gwport,
|
|
|
|
{ "Gateway Port", "bat.batman.gwport",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_orig,
|
|
|
|
{ "Originator", "bat.batman.orig",
|
|
|
|
FT_IPv4, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_old_orig,
|
|
|
|
{ "Received from", "bat.batman.old_orig",
|
|
|
|
FT_IPv4, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_tq,
|
|
|
|
{ "Transmission Quality", "bat.batman.tq",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_hna_len,
|
|
|
|
{ "Number of HNAs", "bat.batman.hna_len",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_flags_unidirectional,
|
|
|
|
{ "Unidirectional", "bat.batman.flags.unidirectional",
|
2009-07-07 14:54:15 +00:00
|
|
|
FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x80,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_flags_directlink,
|
|
|
|
{ "DirectLink", "bat.batman.flags.directlink",
|
2009-07-07 14:54:15 +00:00
|
|
|
FT_BOOLEAN, 8, TFS(&tfs_set_notset), 0x40,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_hna_network,
|
|
|
|
{ "HNA Network", "bat.batman.hna_network",
|
|
|
|
FT_IPv4, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_batman_hna_netmask,
|
|
|
|
{ "HNA Netmask", "bat.batman.hna_netmask",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_gw_type,
|
|
|
|
{ "Type", "bat.gw.type",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(gw_packettypenames), 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_gw_ip,
|
|
|
|
{ "IP", "bat.gw.ip",
|
|
|
|
FT_IPv4, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_vis_vis_orig,
|
|
|
|
{ "Originator", "bat.vis.sender_ip",
|
|
|
|
FT_IPv4, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_vis_version,
|
|
|
|
{ "Version", "bat.vis.version",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_vis_gwflags,
|
|
|
|
{ "Gateway Flags", "bat.vis.gwflags",
|
|
|
|
FT_UINT8, BASE_HEX, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_max_tq_v22,
|
|
|
|
{ "Maximum Transmission Quality", "bat.vis.tq_max",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_max_tq_v23,
|
|
|
|
{ "Maximum Transmission Quality", "bat.vis.tq_max",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_vis_data_type,
|
|
|
|
{ "Type", "bat.vis.data_type",
|
|
|
|
FT_UINT8, BASE_DEC, VALS(vis_packettypenames), 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_vis_tq_v22,
|
|
|
|
{ "Transmission Quality", "bat.vis.tq",
|
|
|
|
FT_UINT16, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_vis_tq_v23,
|
|
|
|
{ "Transmission Quality", "bat.vis.tq",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_vis_netmask,
|
|
|
|
{ "Netmask", "bat.vis.netmask",
|
|
|
|
FT_UINT8, BASE_DEC, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL}
|
2008-10-06 20:24:02 +00:00
|
|
|
},
|
|
|
|
{ &hf_bat_vis_data_ip,
|
|
|
|
{ "IP", "bat.vis.data_ip",
|
|
|
|
FT_IPv4, BASE_NONE, NULL, 0x0,
|
From Kovarththanan Rajaratnam via bug 3548:
(1) Trailing/leading spaces are removed from 'name's/'blurb's
(2) Duplicate 'blurb's are replaced with NULL
(3) Empty ("") 'blurb's are replaced with NULL
(4) BASE_NONE, NULL, 0x0 are used for 'display', 'strings' and 'bitmask' fields
for FT_NONE, FT_BYTES, FT_IPv4, FT_IPv6, FT_ABSOLUTE_TIME, FT_RELATIVE_TIME,
FT_PROTOCOL, FT_STRING and FT_STRINGZ field types
(5) Only allow non-zero value for 'display' if 'bitmask' is non-zero
svn path=/trunk/; revision=28770
2009-06-18 21:30:42 +00:00
|
|
|
NULL, HFILL }
|
2008-10-06 20:24:02 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Setup protocol subtree array */
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_bat_batman,
|
|
|
|
&ett_bat_batman_flags,
|
|
|
|
&ett_bat_batman_gwflags,
|
|
|
|
&ett_bat_batman_hna,
|
|
|
|
&ett_bat_gw,
|
|
|
|
&ett_bat_vis,
|
|
|
|
&ett_bat_vis_entry
|
|
|
|
};
|
2008-06-22 00:14:33 +00:00
|
|
|
|
|
|
|
proto_bat_plugin = proto_register_protocol(
|
2009-09-24 17:30:20 +00:00
|
|
|
"B.A.T.M.A.N. Layer 3 Protocol",
|
|
|
|
"BAT", /* short name */
|
|
|
|
"bat" /* abbrev */
|
|
|
|
);
|
2008-06-22 00:14:33 +00:00
|
|
|
|
|
|
|
/* Register our configuration options for B.A.T.M.A.N. */
|
|
|
|
bat_module = prefs_register_protocol(proto_bat_plugin, proto_reg_handoff_bat);
|
|
|
|
|
2008-10-06 20:24:02 +00:00
|
|
|
proto_register_field_array(proto_bat_plugin, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
|
|
|
|
prefs_register_uint_preference(bat_module, "batman.bat.port", "BAT UDP Port",
|
2009-09-24 17:30:20 +00:00
|
|
|
"Set the port for B.A.T.M.A.N. BAT "
|
|
|
|
"messages (if other than the default of 4305)",
|
|
|
|
10, &global_bat_batman_udp_port);
|
2008-10-06 20:24:02 +00:00
|
|
|
prefs_register_uint_preference(bat_module, "batman.gw.port", "GW UDP Port",
|
2009-09-24 17:30:20 +00:00
|
|
|
"Set the port for B.A.T.M.A.N. Gateway "
|
|
|
|
"messages (if other than the default of 4306)",
|
|
|
|
10, &global_bat_gw_udp_port);
|
2008-10-06 20:24:02 +00:00
|
|
|
prefs_register_uint_preference(bat_module, "batman.vis.port", "VIS UDP Port",
|
2009-09-24 17:30:20 +00:00
|
|
|
"Set the port for B.A.T.M.A.N. VIS "
|
|
|
|
"messages (if other than the default of 4307)",
|
|
|
|
10, &global_bat_vis_udp_port);
|
2008-06-22 00:14:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void proto_reg_handoff_bat(void)
|
|
|
|
{
|
|
|
|
static gboolean inited = FALSE;
|
2008-10-06 20:24:02 +00:00
|
|
|
static dissector_handle_t batman_handle;
|
|
|
|
static dissector_handle_t gw_handle;
|
|
|
|
static dissector_handle_t vis_handle;
|
|
|
|
static guint batman_udp_port;
|
|
|
|
static guint gw_udp_port;
|
|
|
|
static guint vis_udp_port;
|
2008-06-22 00:14:33 +00:00
|
|
|
|
|
|
|
if (!inited) {
|
|
|
|
bat_tap = register_tap("batman");
|
|
|
|
bat_follow_tap = register_tap("batman_follow");
|
2008-10-06 20:24:02 +00:00
|
|
|
|
|
|
|
batman_handle = create_dissector_handle(dissect_bat_batman, proto_bat_plugin);
|
|
|
|
gw_handle = create_dissector_handle(dissect_bat_gw, proto_bat_plugin);
|
|
|
|
vis_handle = create_dissector_handle(dissect_bat_vis, proto_bat_plugin);
|
|
|
|
|
|
|
|
ip_handle = find_dissector("ip");
|
|
|
|
data_handle = find_dissector("data");
|
|
|
|
|
2008-06-22 00:14:33 +00:00
|
|
|
inited = TRUE;
|
2008-10-06 20:24:02 +00:00
|
|
|
} else {
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_delete_uint("udp.port", batman_udp_port, batman_handle);
|
|
|
|
dissector_delete_uint("udp.port", gw_udp_port, gw_handle);
|
|
|
|
dissector_delete_uint("udp.port", vis_udp_port, vis_handle);
|
2008-06-22 00:14:33 +00:00
|
|
|
}
|
2008-07-09 19:10:54 +00:00
|
|
|
|
2008-10-06 20:24:02 +00:00
|
|
|
batman_udp_port = global_bat_batman_udp_port;
|
|
|
|
gw_udp_port = global_bat_gw_udp_port;
|
|
|
|
vis_udp_port = global_bat_vis_udp_port;
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("udp.port", batman_udp_port, batman_handle);
|
|
|
|
dissector_add_uint("udp.port", gw_udp_port, gw_handle);
|
|
|
|
dissector_add_uint("udp.port", vis_udp_port, vis_handle);
|
2008-10-06 21:47:39 +00:00
|
|
|
}
|
2014-10-03 14:13:07 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines - http://www.wireshark.org/tools/modelines.html
|
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|