/* packet-fw1.c * Routines for Ethernet header disassembly of FW1 "monitor" files * Copyright 2002, Alfred Koebler * * $Id: packet-fw1.c,v 1.5 2002/08/28 21:00:13 jmayer Exp $ * * Ethereal - Network traffic analyzer * By Alfred Koebler * Copyright 2002 I.Consult * * To use this dissector use the command line option * -o eth.interpret_as_fw1_monitor:TRUE * * At the moment the way with the option is the best one. * A automatic way is not possible, because the file format isn't different * to the snoop file. * * With "fw monitor" it is possible to collect packets on several places. * The additional information: * - is it a incoming or outgoing packet * - is it before or after the firewall * i incoming before the firewall * I incoming after the firewall * o outcoming before the firewall * O outcoming after the firewall * - the name of the interface * * What's the problem ? * Think about one packet traveling across the firewall. * With ethereal you will see 4 lines in the Top Pane. * To analyze a problem it is helpful to see the additional information * in the protocol tree of the Middle Pane. * * The presentation of the summary line is designed in the following way: * Every time the next selected packet in the Top Pane includes a * "new" interface name the name is added to the list in the summary line. * The interface names are listed one after the other. * The position of the interface names didn't change. * * And who are the 4 places represented ? * The interface name represents the firewall module of the interface. * On the left side of the interface name is the interface module. * On the right side of the interface name is the "IP" module. * * Example for a ping from the firewall to another host: * For the four lines in the Top Pane you will see the according lines * in the Middle Pane: * El90x1 o * O El90x1 * i El90x1 * El90x1 I * * Example for a packet traversing through the Firewall, first through * the inner side firewall module then through the outer side firewall module: * i El90x1 El90x2 * El90x1 I El90x2 * El90x1 o E190x2 * El90x1 E190x2 O * * * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #include #include #include "prefs.h" #include "etypes.h" /* Place FW1 summary in proto tree */ static gboolean fw1_summary_in_tree = TRUE; /* Initialize the protocol and registered fields */ static int proto_fw1 = -1; static int hf_fw1_direction = -1; static int hf_fw1_interface = -1; static int hf_fw1_type = -1; static int hf_fw1_trailer = -1; /* Initialize the subtree pointers */ static gint ett_fw1 = -1; #define ETH_HEADER_SIZE 14 static dissector_handle_t eth_handle; static void dissect_fw1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti; proto_tree *volatile fh_tree = NULL; char direction[3]; char interface_name[20]; guint16 etype; char header[1000]; char *p_header; int i; int found; #define MAX_INTERFACES 20 static char *p_interfaces[MAX_INTERFACES]; static int interface_anzahl=0; /* Make entries in Protocol column and Info column on summary display */ if (check_col(pinfo->cinfo, COL_PROTOCOL)) col_set_str(pinfo->cinfo, COL_PROTOCOL, "FW1"); if (check_col(pinfo->cinfo, COL_INFO)) col_clear(pinfo->cinfo, COL_INFO); etype = tvb_get_ntohs(tvb, 12); if (tree) { sprintf(header, "FW1 Monitor"); /* fetch info to local variable */ direction[0] = tvb_get_guint8(tvb, 0); direction[1] = 0; tvb_get_nstringz0(tvb, 2, 10, interface_name); if (fw1_summary_in_tree) { /* Known interface name - if not, remember it */ found=1; for (i=0; i