2000-08-25 13:00:05 +00:00
|
|
|
/* packet-pppoe.c
|
|
|
|
* Routines for PPP Over Ethernet (PPPoE) packet disassembly (RFC2516)
|
2008-08-13 21:32:09 +00:00
|
|
|
* Up to date with http://www.iana.org/assignments/pppoe-parameters (2008-04-30)
|
2008-04-16 14:15:04 +00:00
|
|
|
*
|
2004-07-18 00:24:25 +00:00
|
|
|
* $Id$
|
1999-06-11 15:30:55 +00:00
|
|
|
*
|
2006-05-21 04:49:01 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
1999-06-11 15:30:55 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-06-11 15:30:55 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-06-11 15:30:55 +00:00
|
|
|
* 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.
|
2002-08-28 21:04:11 +00:00
|
|
|
*
|
1999-06-11 15:30:55 +00:00
|
|
|
* 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.
|
1999-06-11 15:30:55 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 02:03:38 +00:00
|
|
|
#include "config.h"
|
1999-06-11 15:30:55 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
2002-01-21 07:37:49 +00:00
|
|
|
#include <epan/packet.h>
|
|
|
|
#include <epan/strutil.h>
|
2005-09-17 00:02:31 +00:00
|
|
|
#include <epan/etypes.h>
|
2005-11-25 06:23:04 +00:00
|
|
|
#include <epan/prefs.h>
|
2007-09-02 22:49:56 +00:00
|
|
|
#include <epan/expert.h>
|
2009-10-18 13:36:01 +00:00
|
|
|
#include <epan/ppptypes.h>
|
1999-06-11 15:30:55 +00:00
|
|
|
|
2001-01-04 04:15:30 +00:00
|
|
|
static int proto_pppoed = -1;
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
/* Common to session and discovery protocols */
|
|
|
|
static gint hf_pppoe_version = -1;
|
|
|
|
static gint hf_pppoe_type = -1;
|
|
|
|
static gint hf_pppoe_code = -1;
|
|
|
|
static gint hf_pppoe_session_id = -1;
|
|
|
|
static gint hf_pppoe_payload_length = -1;
|
|
|
|
|
|
|
|
/* Discovery protocol fields */
|
|
|
|
static gint hf_pppoed_tags = -1;
|
|
|
|
static gint hf_pppoed_tag = -1;
|
|
|
|
static gint hf_pppoed_tag_length = -1;
|
2009-10-25 20:11:47 +00:00
|
|
|
static gint hf_pppoed_tag_length_8 = -1;
|
2005-11-25 06:23:04 +00:00
|
|
|
static gint hf_pppoed_tag_unknown_data = -1;
|
|
|
|
static gint hf_pppoed_tag_service_name = -1;
|
|
|
|
static gint hf_pppoed_tag_ac_name = -1;
|
|
|
|
static gint hf_pppoed_tag_host_uniq = -1;
|
|
|
|
static gint hf_pppoed_tag_ac_cookie = -1;
|
|
|
|
static gint hf_pppoed_tag_vendor_id = -1;
|
|
|
|
static gint hf_pppoed_tag_vendor_unspecified = -1;
|
2009-10-25 20:11:47 +00:00
|
|
|
static gint hf_pppoed_tag_vspec_tags = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_tag = -1;
|
2009-11-09 15:55:01 +00:00
|
|
|
static gint hf_pppoed_tag_vspec_circuit_id = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_remote_id = -1;
|
2009-10-25 20:11:47 +00:00
|
|
|
static gint hf_pppoed_tag_vspec_act_data_rate_up = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_act_data_rate_down = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_min_data_rate_up = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_min_data_rate_down = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_attainable_data_rate_up = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_attainable_data_rate_down = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_max_data_rate_up = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_max_data_rate_down = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_min_data_rate_up_lp = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_min_data_rate_down_lp = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_max_int_delay_up = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_act_int_delay_up = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_max_int_delay_down = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_act_int_delay_down = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_access_loop_encapsulation = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_access_loop_encap_data_link = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_access_loop_encap_encap_1 = -1;
|
|
|
|
static gint hf_pppoed_tag_vspec_access_loop_encap_encap_2 = -1;
|
2008-04-14 22:32:17 +00:00
|
|
|
static gint hf_pppoed_tag_credits = -1;
|
|
|
|
static gint hf_pppoed_tag_credits_fcn = -1;
|
|
|
|
static gint hf_pppoed_tag_credits_bcn = -1;
|
|
|
|
static gint hf_pppoed_tag_metrics = -1;
|
|
|
|
static gint hf_pppoed_tag_metrics_r = -1;
|
|
|
|
static gint hf_pppoed_tag_metrics_rlq = -1;
|
|
|
|
static gint hf_pppoed_tag_metrics_resource = -1;
|
|
|
|
static gint hf_pppoed_tag_metrics_latency = -1;
|
|
|
|
static gint hf_pppoed_tag_metrics_curr_drate = -1;
|
|
|
|
static gint hf_pppoed_tag_metrics_max_drate = -1;
|
2008-07-19 15:04:20 +00:00
|
|
|
static gint hf_pppoed_tag_mdr_units = -1;
|
|
|
|
static gint hf_pppoed_tag_cdr_units = -1;
|
2008-04-14 22:32:17 +00:00
|
|
|
static gint hf_pppoed_tag_seq_num = -1;
|
2008-07-19 15:04:20 +00:00
|
|
|
static gint hf_pppoed_tag_cred_scale = -1;
|
2005-11-25 06:23:04 +00:00
|
|
|
static gint hf_pppoed_tag_relay_session_id = -1;
|
2008-04-14 22:32:17 +00:00
|
|
|
static gint hf_pppoed_tag_hurl = -1;
|
|
|
|
static gint hf_pppoed_tag_motm = -1;
|
|
|
|
static gint hf_pppoed_tag_max_payload = -1;
|
|
|
|
static gint hf_pppoed_tag_ip_route_add = -1;
|
2005-11-25 06:23:04 +00:00
|
|
|
static gint hf_pppoed_tag_service_name_error = -1;
|
|
|
|
static gint hf_pppoed_tag_ac_system_error = -1;
|
|
|
|
static gint hf_pppoed_tag_generic_error = -1;
|
|
|
|
|
2008-08-13 21:32:09 +00:00
|
|
|
/* Session protocol fields */
|
|
|
|
static gint hf_pppoes_tags = -1;
|
2013-01-26 18:54:53 +00:00
|
|
|
/* static gint hf_pppoes_tag = -1; */
|
|
|
|
/* static gint hf_pppoes_tag_credits = -1; */
|
2008-08-13 21:32:09 +00:00
|
|
|
static gint hf_pppoes_tag_credits_fcn = -1;
|
|
|
|
static gint hf_pppoes_tag_credits_bcn = -1;
|
|
|
|
|
|
|
|
/* Session protocol fields */
|
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_pppoed = -1;
|
|
|
|
static gint ett_pppoed_tags = -1;
|
2009-10-25 20:11:47 +00:00
|
|
|
static gint ett_pppoed_tag_vspec_dslf_access_loop_encaps = -1;
|
1999-11-16 11:44:20 +00:00
|
|
|
|
2001-01-04 04:15:30 +00:00
|
|
|
static int proto_pppoes = -1;
|
|
|
|
|
2008-08-13 21:32:09 +00:00
|
|
|
static gint ett_pppoes = -1;
|
|
|
|
static gint ett_pppoes_tags = -1;
|
|
|
|
|
|
|
|
/* PPPoE parent fields */
|
|
|
|
|
|
|
|
static int proto_pppoe = -1;
|
|
|
|
static gint ett_pppoe = -1;
|
|
|
|
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
/* Handle for calling for ppp dissector to handle session data */
|
2001-03-30 06:10:54 +00:00
|
|
|
static dissector_handle_t ppp_handle;
|
2000-11-19 02:00:03 +00:00
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
|
|
|
|
/* Preference for showing discovery tag values and lengths */
|
|
|
|
static gboolean global_pppoe_show_tags_and_lengths = FALSE;
|
|
|
|
|
|
|
|
|
|
|
|
#define PPPOE_CODE_SESSION 0x00
|
2008-04-14 22:32:17 +00:00
|
|
|
#define PPPOE_CODE_PADO 0x07
|
|
|
|
#define PPPOE_CODE_PADI 0x09
|
2008-07-18 19:31:01 +00:00
|
|
|
#define PPPOE_CODE_PADG 0x0a
|
|
|
|
#define PPPOE_CODE_PADC 0x0b
|
|
|
|
#define PPPOE_CODE_PADQ 0x0c
|
2005-11-25 06:23:04 +00:00
|
|
|
#define PPPOE_CODE_PADR 0x19
|
|
|
|
#define PPPOE_CODE_PADS 0x65
|
|
|
|
#define PPPOE_CODE_PADT 0xa7
|
2008-04-14 22:32:17 +00:00
|
|
|
#define PPPOE_CODE_PADM 0xd3
|
|
|
|
#define PPPOE_CODE_PADN 0xd4
|
2005-11-25 06:23:04 +00:00
|
|
|
|
|
|
|
#define PPPOE_TAG_EOL 0x0000
|
|
|
|
#define PPPOE_TAG_SVC_NAME 0x0101
|
|
|
|
#define PPPOE_TAG_AC_NAME 0x0102
|
|
|
|
#define PPPOE_TAG_HOST_UNIQ 0x0103
|
|
|
|
#define PPPOE_TAG_AC_COOKIE 0x0104
|
|
|
|
#define PPPOE_TAG_VENDOR 0x0105
|
2008-04-14 22:32:17 +00:00
|
|
|
#define PPPOE_TAG_CREDITS 0x0106
|
|
|
|
#define PPPOE_TAG_METRICS 0x0107
|
|
|
|
#define PPPOE_TAG_SEQ_NUM 0x0108
|
2008-07-19 15:04:20 +00:00
|
|
|
#define PPPOE_TAG_CRED_SCALE 0x0109
|
2005-11-25 06:23:04 +00:00
|
|
|
#define PPPOE_TAG_RELAY_ID 0x0110
|
2008-04-14 22:32:17 +00:00
|
|
|
#define PPPOE_TAG_HURL 0x0111
|
|
|
|
#define PPPOE_TAG_MOTM 0x0112
|
|
|
|
#define PPPOE_TAG_MAX_PAYLD 0x0120
|
|
|
|
#define PPPOE_TAG_IP_RT_ADD 0x0121
|
2005-11-25 06:23:04 +00:00
|
|
|
#define PPPOE_TAG_SVC_ERR 0x0201
|
|
|
|
#define PPPOE_TAG_AC_ERR 0x0202
|
1999-06-11 15:30:55 +00:00
|
|
|
#define PPPOE_TAG_GENERIC_ERR 0x0203
|
|
|
|
|
2009-10-25 20:11:47 +00:00
|
|
|
#define PPPOE_VENDOR_ID_DSLF 3561
|
|
|
|
|
2009-11-09 15:55:01 +00:00
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_CIRCUIT_ID 0x01
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_REMOTE_ID 0x02
|
2009-10-25 20:11:47 +00:00
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACT_DATA_RATE_UP 0x81
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACT_DATA_RATE_DOWN 0x82
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_UP 0x83
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_DOWN 0x84
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ATTAINABLE_DATA_RATE_UP 0x85
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ATTAINABLE_DATA_RATE_DOWN 0x86
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_MAX_DATA_RATE_UP 0x87
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_MAX_DATA_RATE_DOWN 0x88
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_UP_LP 0x89
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_DOWN_LP 0x8a
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_MAX_INT_DELAY_UP 0x8b
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACT_INT_DELAY_UP 0x8c
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_MAX_INT_DELAY_DOWN 0x8d
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACT_INT_DELAY_DOWN 0x8e
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAPSULATION 0x90
|
|
|
|
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_DATA_LINK_ATM 0x00
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_DATA_LINK_ETH 0x01
|
|
|
|
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_1_NA 0x00
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_1_UNTAGGED_ETH 0x01
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_1_SINLE_TAGGED_ETH 0x02
|
|
|
|
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_NA 0x00
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_PPPOA_LLC 0x01
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_PPPOA_NULL 0x02
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_IPOA_LLC 0x03
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_IPOA_NULL 0x04
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_ETH_OVER_AAL5_LLC_WITH_FCS 0x05
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_ETH_OVER_AAL5_LLC_WITHOUT_FCS 0x06
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_ETH_OVER_AAL5_NULL_WITH_FCS 0x07
|
|
|
|
#define PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_ETH_OVER_AAL5_NULL_WITHOUT_FCS 0x08
|
|
|
|
|
2008-07-19 15:04:20 +00:00
|
|
|
#define PPPOE_CDR_MASK 0x06
|
|
|
|
#define PPPOE_MDR_MASK 0x18
|
|
|
|
#define PPPOE_RCV_ONLY_MASK 0x01
|
|
|
|
|
|
|
|
#define PPPOE_SCALE_KBPS 0x00
|
|
|
|
#define PPPOE_SCALE_MBPS 0x01
|
|
|
|
#define PPPOE_SCALE_GBPS 0x02
|
|
|
|
#define PPPOE_SCALE_TBPS 0x03
|
|
|
|
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
static const value_string code_vals[] = {
|
1999-06-11 15:30:55 +00:00
|
|
|
{PPPOE_CODE_SESSION, "Session Data" },
|
|
|
|
{PPPOE_CODE_PADO, "Active Discovery Offer (PADO)" },
|
|
|
|
{PPPOE_CODE_PADI, "Active Discovery Initiation (PADI)" },
|
2008-04-14 22:32:17 +00:00
|
|
|
{PPPOE_CODE_PADG, "Active Discovery Session-Grant (PADG)" },
|
|
|
|
{PPPOE_CODE_PADC, "Active Discovery Session-Credit Resp.(PADC)" },
|
|
|
|
{PPPOE_CODE_PADQ, "Active Discovery Quality (PADQ)" },
|
1999-06-11 15:30:55 +00:00
|
|
|
{PPPOE_CODE_PADR, "Active Discovery Request (PADR)" },
|
|
|
|
{PPPOE_CODE_PADS, "Active Discovery Session-confirmation (PADS)"},
|
|
|
|
{PPPOE_CODE_PADT, "Active Discovery Terminate (PADT)" },
|
2008-04-14 22:32:17 +00:00
|
|
|
{PPPOE_CODE_PADM, "Active Discovery Message (PADM)" },
|
|
|
|
{PPPOE_CODE_PADN, "Active Discovery Network (PADN)" },
|
2005-11-25 06:23:04 +00:00
|
|
|
{0, NULL }
|
|
|
|
};
|
1999-06-11 15:30:55 +00:00
|
|
|
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
static const value_string tag_vals[] = {
|
1999-06-11 15:30:55 +00:00
|
|
|
{PPPOE_TAG_EOL, "End-Of-List" },
|
|
|
|
{PPPOE_TAG_SVC_NAME, "Service-Name" },
|
|
|
|
{PPPOE_TAG_AC_NAME, "AC-Name" },
|
|
|
|
{PPPOE_TAG_HOST_UNIQ, "Host-Uniq" },
|
|
|
|
{PPPOE_TAG_AC_COOKIE, "AC-Cookie" },
|
|
|
|
{PPPOE_TAG_VENDOR, "Vendor-Specific" },
|
2008-04-14 22:32:17 +00:00
|
|
|
{PPPOE_TAG_CREDITS, "Credits" },
|
|
|
|
{PPPOE_TAG_METRICS, "Metrics" },
|
2009-05-01 07:17:10 +00:00
|
|
|
{PPPOE_TAG_SEQ_NUM, "Sequence Number" },
|
2008-07-19 15:04:20 +00:00
|
|
|
{PPPOE_TAG_CRED_SCALE, "Credit Scale Factor"},
|
1999-06-11 15:30:55 +00:00
|
|
|
{PPPOE_TAG_RELAY_ID, "Relay-Session-Id" },
|
2008-04-14 22:32:17 +00:00
|
|
|
{PPPOE_TAG_HURL, "HURL" },
|
|
|
|
{PPPOE_TAG_MOTM, "MOTM" },
|
|
|
|
{PPPOE_TAG_MAX_PAYLD, "PPP-Max-Payload" },
|
|
|
|
{PPPOE_TAG_IP_RT_ADD, "IP Route Add" },
|
1999-06-11 15:30:55 +00:00
|
|
|
{PPPOE_TAG_SVC_ERR, "Service-Name-Error"},
|
|
|
|
{PPPOE_TAG_AC_ERR, "AC-System-Error" },
|
|
|
|
{PPPOE_TAG_GENERIC_ERR,"Generic-Error" },
|
2005-11-25 06:23:04 +00:00
|
|
|
{0, NULL }
|
|
|
|
};
|
1999-06-11 15:30:55 +00:00
|
|
|
|
2009-10-25 20:11:47 +00:00
|
|
|
static const value_string vspec_tag_vals[] = {
|
2009-11-09 15:55:01 +00:00
|
|
|
{PPPOE_TAG_VSPEC_DSLF_CIRCUIT_ID, "Circuit-ID" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_REMOTE_ID, "Remote-ID" },
|
2009-10-25 20:11:47 +00:00
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACT_DATA_RATE_UP, "Actual-Data-Rate-Up" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACT_DATA_RATE_DOWN, "Actual-Data-Rate-Down" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_UP, "Min-Data-Rate-Up" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_DOWN, "Min-Data-Rate-Down" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ATTAINABLE_DATA_RATE_UP, "Attainable-Data-Rate-Up" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ATTAINABLE_DATA_RATE_DOWN, "Attainable-Data-Rate-Down" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_MAX_DATA_RATE_UP, "Max-Data-Rate-Up" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_MAX_DATA_RATE_DOWN, "Max-Data-Rate-Down" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_UP_LP, "Min-Data-Rate-Up-Low-Power" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_DOWN_LP, "Min-Data-Rate-Down-Low-Power" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_MAX_INT_DELAY_UP, "Max-Interleaving-Delay-Up" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACT_INT_DELAY_UP, "Actual-Interleaving-Delay-Up" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_MAX_INT_DELAY_DOWN, "Max-Interleaving-Delay-Down" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACT_INT_DELAY_DOWN, "Actual-Interleaving-Delay-Down"},
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAPSULATION, "Access-Loop-Encapsulation" },
|
|
|
|
{0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string vspec_tag_dslf_access_loop_encap_data_link_vals[] = {
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_DATA_LINK_ATM, "ATM AAL5"},
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_DATA_LINK_ETH, "Ethernet"},
|
|
|
|
{0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string vspec_tag_dslf_access_loop_encap_encap_1_vals[] = {
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_1_NA, "NA" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_1_UNTAGGED_ETH, "Untagged Ethernet" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_1_SINLE_TAGGED_ETH, "Single-tagged Ethernet"},
|
|
|
|
{0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string vspec_tag_dslf_access_loop_encap_encap_2_vals[] = {
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_NA, "NA" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_PPPOA_LLC, "PPPoA LLC" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_PPPOA_NULL, "PPPoA Null" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_IPOA_LLC, "IPoA LLC" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_IPOA_NULL, "IPoA Null" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_ETH_OVER_AAL5_LLC_WITH_FCS, "Ethernet over AAL5 LLC w FCS" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_ETH_OVER_AAL5_LLC_WITHOUT_FCS, "Ethernet over AAL5 LLC w/o FCS" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_ETH_OVER_AAL5_NULL_WITH_FCS, "Ethernet over AAL5 Null w FCS" },
|
|
|
|
{PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAP_ENCAPS_2_ETH_OVER_AAL5_NULL_WITHOUT_FCS,"Ethernet over AAL5 Null w/o FCS"},
|
|
|
|
{0, NULL }
|
|
|
|
};
|
|
|
|
|
2012-12-03 23:06:30 +00:00
|
|
|
static const value_string datarate_scale_vals[] = {
|
2008-07-19 15:04:20 +00:00
|
|
|
{PPPOE_SCALE_KBPS, "kilobits per second"},
|
|
|
|
{PPPOE_SCALE_MBPS, "megabits per second"},
|
|
|
|
{PPPOE_SCALE_GBPS, "gigabits per second"},
|
|
|
|
{PPPOE_SCALE_TBPS, "terabits per second"},
|
|
|
|
{0, NULL }
|
|
|
|
};
|
|
|
|
|
1999-06-11 15:30:55 +00:00
|
|
|
|
2012-05-08 07:01:04 +00:00
|
|
|
#define CASE_VSPEC_DSLF_TAG_UINT(tag_name, relation, length, hf_var) case tag_name: \
|
2009-11-09 15:55:01 +00:00
|
|
|
if (!(poe_tag_length relation length)) { \
|
|
|
|
expert_add_info_format(pinfo, pppoe_tree, PI_MALFORMED, PI_WARN, "%s: Wrong length: %u (expected %s %d)", \
|
2012-08-10 22:55:02 +00:00
|
|
|
val_to_str_const(poe_tag, vspec_tag_vals, "Unknown"), poe_tag_length, #relation, length); \
|
2009-11-09 15:55:01 +00:00
|
|
|
} else { \
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_var, tvb, \
|
2012-05-08 07:01:04 +00:00
|
|
|
tagstart+2, poe_tag_length, ENC_BIG_ENDIAN); \
|
|
|
|
} \
|
|
|
|
break;
|
|
|
|
|
|
|
|
#define CASE_VSPEC_DSLF_TAG_STRING(tag_name, relation, length, hf_var) case tag_name: \
|
|
|
|
if (!(poe_tag_length relation length)) { \
|
|
|
|
expert_add_info_format(pinfo, pppoe_tree, PI_MALFORMED, PI_WARN, "%s: Wrong length: %u (expected %s %d)", \
|
2012-08-10 22:55:02 +00:00
|
|
|
val_to_str_const(poe_tag, vspec_tag_vals, "Unknown"), poe_tag_length, #relation, length); \
|
2012-05-08 07:01:04 +00:00
|
|
|
} else { \
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_var, tvb, \
|
|
|
|
tagstart+2, poe_tag_length, ENC_ASCII|ENC_NA); \
|
2009-11-09 15:55:01 +00:00
|
|
|
} \
|
2009-10-25 20:11:47 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* Dissect Vendor-Specific Tags introduced by the DSLF */
|
|
|
|
static void
|
|
|
|
dissect_pppoe_subtags_dslf(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, proto_tree *tree,
|
|
|
|
int payload_length)
|
|
|
|
{
|
|
|
|
guint8 poe_tag;
|
|
|
|
guint8 poe_tag_length;
|
|
|
|
int tagstart;
|
|
|
|
|
|
|
|
proto_tree *pppoe_tree, *ti, *encaps_tree;
|
|
|
|
|
|
|
|
/* Start Decoding Here. */
|
|
|
|
if (tree)
|
|
|
|
{
|
|
|
|
/* Create tags subtree */
|
2011-10-04 22:44:31 +00:00
|
|
|
ti = proto_tree_add_item(tree, hf_pppoed_tag_vspec_tags, tvb, offset, payload_length, ENC_NA);
|
2009-10-25 20:11:47 +00:00
|
|
|
pppoe_tree = proto_item_add_subtree(ti, ett_pppoed_tags);
|
|
|
|
|
|
|
|
tagstart = offset;
|
|
|
|
|
|
|
|
/* Loop until all data seen or End-Of-List tag found */
|
|
|
|
while (tagstart <= offset + payload_length-2)
|
|
|
|
{
|
|
|
|
poe_tag = tvb_get_guint8(tvb, tagstart);
|
|
|
|
poe_tag_length = tvb_get_guint8(tvb, tagstart + 1);
|
|
|
|
|
|
|
|
/* Tag value and data length */
|
|
|
|
if (global_pppoe_show_tags_and_lengths)
|
|
|
|
{
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_vspec_tag, tvb, tagstart, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_length_8, tvb, tagstart+1, 1, ENC_BIG_ENDIAN);
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Show tag data */
|
|
|
|
switch (poe_tag)
|
|
|
|
{
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_STRING(PPPOE_TAG_VSPEC_DSLF_CIRCUIT_ID, <=, 63,
|
2009-11-09 15:55:01 +00:00
|
|
|
hf_pppoed_tag_vspec_circuit_id)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_STRING(PPPOE_TAG_VSPEC_DSLF_REMOTE_ID, <=, 63,
|
2009-11-09 15:55:01 +00:00
|
|
|
hf_pppoed_tag_vspec_remote_id)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_ACT_DATA_RATE_UP, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_act_data_rate_up)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_ACT_DATA_RATE_DOWN, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_act_data_rate_down)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_UP, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_min_data_rate_up)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_DOWN, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_min_data_rate_down)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_ATTAINABLE_DATA_RATE_UP, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_attainable_data_rate_up)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_ATTAINABLE_DATA_RATE_DOWN, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_attainable_data_rate_down)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_MAX_DATA_RATE_UP, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_max_data_rate_up)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_MAX_DATA_RATE_DOWN, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_max_data_rate_down)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_UP_LP, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_min_data_rate_up_lp)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_MIN_DATA_RATE_DOWN_LP, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_min_data_rate_down_lp)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_MAX_INT_DELAY_UP, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_max_int_delay_up)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_ACT_INT_DELAY_UP, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_act_int_delay_up)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_MAX_INT_DELAY_DOWN, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_max_int_delay_down)
|
2012-05-08 07:01:04 +00:00
|
|
|
CASE_VSPEC_DSLF_TAG_UINT(PPPOE_TAG_VSPEC_DSLF_ACT_INT_DELAY_DOWN, ==, 4,
|
2009-10-25 20:11:47 +00:00
|
|
|
hf_pppoed_tag_vspec_act_int_delay_down)
|
|
|
|
case PPPOE_TAG_VSPEC_DSLF_ACCESS_LOOP_ENCAPSULATION:
|
|
|
|
ti = proto_tree_add_item(pppoe_tree, hf_pppoed_tag_vspec_access_loop_encapsulation, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+2, 3, ENC_NA);
|
2009-10-25 20:11:47 +00:00
|
|
|
if (poe_tag_length != 3) {
|
|
|
|
expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN,
|
|
|
|
"%s: Wrong length: %u (expected 3)",
|
2012-08-10 22:55:02 +00:00
|
|
|
val_to_str_const(poe_tag, vspec_tag_vals, "Unknown"), poe_tag_length);
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
encaps_tree = proto_item_add_subtree(ti, ett_pppoed_tag_vspec_dslf_access_loop_encaps);
|
|
|
|
proto_tree_add_item(encaps_tree, hf_pppoed_tag_vspec_access_loop_encap_data_link,
|
2011-10-06 03:35:44 +00:00
|
|
|
tvb, tagstart+2, 1, ENC_BIG_ENDIAN);
|
2009-10-25 20:11:47 +00:00
|
|
|
proto_tree_add_item(encaps_tree, hf_pppoed_tag_vspec_access_loop_encap_encap_1,
|
2011-10-06 03:35:44 +00:00
|
|
|
tvb, tagstart+3, 1, ENC_BIG_ENDIAN);
|
2009-10-25 20:11:47 +00:00
|
|
|
proto_tree_add_item(encaps_tree, hf_pppoed_tag_vspec_access_loop_encap_encap_2,
|
2011-10-06 03:35:44 +00:00
|
|
|
tvb, tagstart+4, 1, ENC_BIG_ENDIAN);
|
2011-09-21 23:42:55 +00:00
|
|
|
|
2009-10-25 20:11:47 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (poe_tag_length > 0 )
|
|
|
|
{
|
|
|
|
/* Presumably unknown tag;
|
|
|
|
show tag value if we didn't do it above */
|
|
|
|
if (!global_pppoe_show_tags_and_lengths)
|
|
|
|
{
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag, tvb, tagstart, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_length_8, tvb, tagstart+1, 1, ENC_BIG_ENDIAN);
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_unknown_data, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+1, poe_tag_length, ENC_NA);
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tagstart += (2 + poe_tag_length);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
/* Dissect discovery protocol tags */
|
2000-04-16 22:59:37 +00:00
|
|
|
static void
|
2005-11-25 06:23:04 +00:00
|
|
|
dissect_pppoe_tags(tvbuff_t *tvb, packet_info *pinfo, int offset, proto_tree *tree,
|
|
|
|
int payload_length)
|
|
|
|
{
|
1999-06-11 15:30:55 +00:00
|
|
|
guint16 poe_tag;
|
|
|
|
guint16 poe_tag_length;
|
|
|
|
int tagstart;
|
2008-07-19 15:04:20 +00:00
|
|
|
guint16 poe_rsv = 0;
|
1999-06-11 15:30:55 +00:00
|
|
|
|
|
|
|
proto_tree *pppoe_tree;
|
|
|
|
proto_item *ti;
|
2009-08-10 21:46:30 +00:00
|
|
|
proto_item *pppoe_tree_tag_length_item = NULL;
|
2009-08-10 22:15:22 +00:00
|
|
|
proto_item *item;
|
1999-06-11 15:30:55 +00:00
|
|
|
|
|
|
|
/* Start Decoding Here. */
|
2005-11-25 06:23:04 +00:00
|
|
|
if (tree)
|
|
|
|
{
|
|
|
|
/* Create tags subtree */
|
2011-10-04 22:44:31 +00:00
|
|
|
ti = proto_tree_add_item(tree, hf_pppoed_tags, tvb, offset, payload_length-6, ENC_NA);
|
1999-11-16 11:44:20 +00:00
|
|
|
pppoe_tree = proto_item_add_subtree(ti, ett_pppoed_tags);
|
1999-06-11 15:30:55 +00:00
|
|
|
|
|
|
|
tagstart = offset;
|
2007-08-15 22:27:52 +00:00
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
/* Loop until all data seen or End-Of-List tag found */
|
2008-04-14 22:32:17 +00:00
|
|
|
while (tagstart <= payload_length-2)
|
2005-11-25 06:23:04 +00:00
|
|
|
{
|
2000-11-19 02:00:03 +00:00
|
|
|
poe_tag = tvb_get_ntohs(tvb, tagstart);
|
|
|
|
poe_tag_length = tvb_get_ntohs(tvb, tagstart + 2);
|
1999-06-11 15:30:55 +00:00
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
/* Tag value and data length */
|
|
|
|
if (global_pppoe_show_tags_and_lengths)
|
|
|
|
{
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag, tvb, tagstart, 2, ENC_BIG_ENDIAN);
|
2011-09-21 23:42:55 +00:00
|
|
|
pppoe_tree_tag_length_item =
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_length, tvb, tagstart+2, 2, ENC_BIG_ENDIAN);
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
2007-08-15 22:27:52 +00:00
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
/* Show tag data */
|
|
|
|
switch (poe_tag)
|
|
|
|
{
|
|
|
|
case PPPOE_TAG_SVC_NAME:
|
2008-04-14 22:32:17 +00:00
|
|
|
if (poe_tag_length > 0)
|
|
|
|
{
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_service_name, tvb,
|
2011-10-15 18:46:26 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_ASCII|ENC_NA);
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
2005-11-25 06:23:04 +00:00
|
|
|
break;
|
|
|
|
case PPPOE_TAG_AC_NAME:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_ac_name, tvb,
|
2011-10-15 18:46:26 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_ASCII|ENC_NA);
|
2005-11-25 06:23:04 +00:00
|
|
|
/* Show AC-Name in info column */
|
2013-06-14 01:56:28 +00:00
|
|
|
col_append_fstr(pinfo->cinfo, COL_INFO, " AC-Name='%s'",
|
2007-08-15 22:27:52 +00:00
|
|
|
tvb_get_ephemeral_string(tvb, tagstart+4, poe_tag_length));
|
2005-11-25 06:23:04 +00:00
|
|
|
break;
|
|
|
|
case PPPOE_TAG_HOST_UNIQ:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_host_uniq, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_NA);
|
2005-11-25 06:23:04 +00:00
|
|
|
break;
|
|
|
|
case PPPOE_TAG_AC_COOKIE:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_ac_cookie, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_NA);
|
2005-11-25 06:23:04 +00:00
|
|
|
break;
|
|
|
|
case PPPOE_TAG_VENDOR:
|
|
|
|
if (poe_tag_length >= 4)
|
|
|
|
{
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_vendor_id, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+4, 4, ENC_BIG_ENDIAN);
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
if (poe_tag_length > 4)
|
|
|
|
{
|
2009-10-25 20:11:47 +00:00
|
|
|
guint32 vendor_id = tvb_get_ntohl(tvb, tagstart+4);
|
|
|
|
switch (vendor_id)
|
|
|
|
{
|
|
|
|
case PPPOE_VENDOR_ID_DSLF:
|
|
|
|
dissect_pppoe_subtags_dslf(tvb,pinfo,tagstart+4+4,pppoe_tree,poe_tag_length-4);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_vendor_unspecified, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+4+4, poe_tag_length-4, ENC_NA);
|
2011-09-21 23:42:55 +00:00
|
|
|
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
break;
|
2008-04-14 22:32:17 +00:00
|
|
|
case PPPOE_TAG_CREDITS:
|
|
|
|
if (poe_tag_length == 4)
|
|
|
|
{
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_credits_fcn, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+4, 2, ENC_BIG_ENDIAN);
|
2008-04-14 22:32:17 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_credits_bcn, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+6, 2, ENC_BIG_ENDIAN);
|
2008-04-14 22:32:17 +00:00
|
|
|
} else {
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_credits, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_NA);
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PPPOE_TAG_METRICS:
|
|
|
|
if (poe_tag_length == 10)
|
|
|
|
{
|
2008-07-19 15:04:20 +00:00
|
|
|
poe_rsv = tvb_get_ntohs(tvb, tagstart+4);
|
|
|
|
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_mdr_units, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+4, 2, ENC_BIG_ENDIAN);
|
2008-07-19 15:04:20 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_cdr_units, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+4, 2, ENC_BIG_ENDIAN);
|
2008-07-19 15:04:20 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_metrics_r, tvb,
|
2011-10-10 00:39:31 +00:00
|
|
|
tagstart+4, 2, ENC_BIG_ENDIAN);
|
2008-04-14 22:32:17 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_metrics_rlq, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+6, 1, ENC_BIG_ENDIAN);
|
2008-04-14 22:32:17 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_metrics_resource, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+7, 1, ENC_BIG_ENDIAN);
|
2008-04-14 22:32:17 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_metrics_latency, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+8, 2, ENC_BIG_ENDIAN);
|
2008-07-19 15:04:20 +00:00
|
|
|
|
|
|
|
/* CDR */
|
|
|
|
ti = proto_tree_add_item(pppoe_tree, hf_pppoed_tag_metrics_curr_drate, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+10, 2, ENC_BIG_ENDIAN);
|
2008-07-19 15:04:20 +00:00
|
|
|
|
|
|
|
switch ((poe_rsv & PPPOE_CDR_MASK) >> 1)
|
|
|
|
{
|
|
|
|
case (PPPOE_SCALE_KBPS):
|
|
|
|
proto_item_append_text(ti, " kbps");
|
|
|
|
break;
|
|
|
|
case (PPPOE_SCALE_MBPS):
|
|
|
|
proto_item_append_text(ti, " mbps");
|
|
|
|
break;
|
|
|
|
case (PPPOE_SCALE_GBPS):
|
|
|
|
proto_item_append_text(ti, " gbps");
|
|
|
|
break;
|
|
|
|
case (PPPOE_SCALE_TBPS):
|
|
|
|
proto_item_append_text(ti, " tbps");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* MDR */
|
|
|
|
ti = proto_tree_add_item(pppoe_tree, hf_pppoed_tag_metrics_max_drate, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+12, 2, ENC_BIG_ENDIAN);
|
2008-07-19 15:04:20 +00:00
|
|
|
|
|
|
|
switch ((poe_rsv & PPPOE_MDR_MASK) >> 3)
|
|
|
|
{
|
|
|
|
case (PPPOE_SCALE_KBPS):
|
|
|
|
proto_item_append_text(ti, " kbps");
|
|
|
|
break;
|
|
|
|
case (PPPOE_SCALE_MBPS):
|
|
|
|
proto_item_append_text(ti, " mbps");
|
|
|
|
break;
|
|
|
|
case (PPPOE_SCALE_GBPS):
|
|
|
|
proto_item_append_text(ti, " gbps");
|
|
|
|
break;
|
|
|
|
case (PPPOE_SCALE_TBPS):
|
|
|
|
proto_item_append_text(ti, " tbps");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2008-04-14 22:32:17 +00:00
|
|
|
} else {
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_metrics, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_NA);
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case PPPOE_TAG_SEQ_NUM:
|
2009-08-10 21:07:15 +00:00
|
|
|
if (poe_tag_length == 2) {
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_seq_num, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_BIG_ENDIAN);
|
2009-08-10 21:07:15 +00:00
|
|
|
} else {
|
2009-08-10 22:15:22 +00:00
|
|
|
if (global_pppoe_show_tags_and_lengths) {
|
2009-08-10 21:07:15 +00:00
|
|
|
proto_item_append_text(pppoe_tree_tag_length_item, " [Wrong: should be 2]");
|
2009-08-10 22:15:22 +00:00
|
|
|
item = pppoe_tree_tag_length_item;
|
|
|
|
} else {
|
|
|
|
item = proto_tree_add_text(pppoe_tree, tvb, tagstart+4, poe_tag_length,
|
|
|
|
"%s: Wrong length: %u (expected 2)",
|
|
|
|
proto_registrar_get_name(hf_pppoed_tag_seq_num),
|
|
|
|
poe_tag_length);
|
|
|
|
}
|
2011-09-21 23:42:55 +00:00
|
|
|
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN,
|
2009-08-10 22:15:22 +00:00
|
|
|
"Sequence Number tag: Wrong length: %u (expected 2)",
|
2009-08-10 21:07:15 +00:00
|
|
|
poe_tag_length);
|
|
|
|
}
|
2008-04-14 22:32:17 +00:00
|
|
|
break;
|
2008-07-19 15:04:20 +00:00
|
|
|
case PPPOE_TAG_CRED_SCALE:
|
2009-08-10 21:07:15 +00:00
|
|
|
if (poe_tag_length == 2) {
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_cred_scale, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_BIG_ENDIAN);
|
2009-08-10 21:07:15 +00:00
|
|
|
} else {
|
2009-08-10 22:15:22 +00:00
|
|
|
if (global_pppoe_show_tags_and_lengths) {
|
2009-08-10 21:07:15 +00:00
|
|
|
proto_item_append_text(pppoe_tree_tag_length_item, " [Wrong: should be 2]");
|
2009-08-10 22:15:22 +00:00
|
|
|
item = pppoe_tree_tag_length_item;
|
|
|
|
} else {
|
|
|
|
item = proto_tree_add_text(pppoe_tree, tvb, tagstart+4, poe_tag_length,
|
|
|
|
"%s: Wrong length: %u (expected 2)",
|
|
|
|
proto_registrar_get_name(hf_pppoed_tag_cred_scale),
|
|
|
|
poe_tag_length);
|
|
|
|
}
|
2011-09-21 23:42:55 +00:00
|
|
|
expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN,
|
2009-08-10 22:15:22 +00:00
|
|
|
"Credit Scale Factor tag: Wrong length: %u (expected 2)",
|
2009-08-10 21:07:15 +00:00
|
|
|
poe_tag_length);
|
|
|
|
}
|
2008-07-19 15:04:20 +00:00
|
|
|
break;
|
2005-11-25 06:23:04 +00:00
|
|
|
case PPPOE_TAG_RELAY_ID:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_relay_session_id, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_NA);
|
2005-11-25 06:23:04 +00:00
|
|
|
break;
|
2008-04-14 22:32:17 +00:00
|
|
|
case PPPOE_TAG_HURL:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_hurl, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_NA);
|
2008-04-14 22:32:17 +00:00
|
|
|
break;
|
|
|
|
case PPPOE_TAG_MOTM:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_motm, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_NA);
|
2008-04-14 22:32:17 +00:00
|
|
|
break;
|
|
|
|
case PPPOE_TAG_MAX_PAYLD:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_max_payload, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_NA);
|
2008-04-14 22:32:17 +00:00
|
|
|
break;
|
|
|
|
case PPPOE_TAG_IP_RT_ADD:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_ip_route_add, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_NA);
|
2008-04-14 22:32:17 +00:00
|
|
|
break;
|
2005-11-25 06:23:04 +00:00
|
|
|
|
|
|
|
/* These error tag values should be interpreted as a utf-8 unterminated
|
|
|
|
strings. */
|
|
|
|
case PPPOE_TAG_SVC_ERR:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_service_name_error, tvb,
|
2011-10-15 18:46:26 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_ASCII|ENC_NA);
|
2005-11-25 06:23:04 +00:00
|
|
|
break;
|
|
|
|
case PPPOE_TAG_AC_ERR:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_ac_system_error, tvb,
|
2011-10-15 18:46:26 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_ASCII|ENC_NA);
|
2005-11-25 06:23:04 +00:00
|
|
|
break;
|
|
|
|
case PPPOE_TAG_GENERIC_ERR:
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_generic_error, tvb,
|
2011-10-15 18:46:26 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_ASCII|ENC_NA);
|
2005-11-25 06:23:04 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* Get out if see end-of-list tag */
|
|
|
|
case PPPOE_TAG_EOL:
|
|
|
|
return;
|
|
|
|
|
|
|
|
default:
|
|
|
|
if (poe_tag_length > 0 )
|
|
|
|
{
|
2005-11-28 00:48:17 +00:00
|
|
|
/* Presumably unknown tag;
|
|
|
|
show tag value if we didn't
|
|
|
|
do it above */
|
|
|
|
if (!global_pppoe_show_tags_and_lengths)
|
2008-04-14 22:32:17 +00:00
|
|
|
{
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag, tvb, tagstart, 2, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_length, tvb, tagstart+2, 2, ENC_BIG_ENDIAN);
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
2005-11-25 06:23:04 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_unknown_data, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+2, poe_tag_length, ENC_NA);
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
1999-06-11 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
tagstart += (4 + poe_tag_length);
|
1999-06-11 15:30:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
|
|
|
|
/* Discovery protocol, i.e. PPP session not yet established */
|
|
|
|
static void dissect_pppoed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
guint8 pppoe_code;
|
2006-12-22 22:15:38 +00:00
|
|
|
guint16 reported_payload_length;
|
1999-06-11 15:30:55 +00:00
|
|
|
|
2008-04-14 22:32:17 +00:00
|
|
|
proto_tree *pppoe_tree = NULL;
|
1999-06-11 15:30:55 +00:00
|
|
|
proto_item *ti;
|
|
|
|
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPPoED");
|
2009-08-09 08:14:59 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2001-01-04 04:15:30 +00:00
|
|
|
|
1999-06-11 15:30:55 +00:00
|
|
|
/* Start Decoding Here. */
|
2000-11-19 02:00:03 +00:00
|
|
|
pppoe_code = tvb_get_guint8(tvb, 1);
|
1999-06-11 15:30:55 +00:00
|
|
|
|
2013-06-14 01:56:28 +00:00
|
|
|
col_append_str(pinfo->cinfo, COL_INFO, val_to_str_const(pppoe_code, code_vals, "Unknown"));
|
1999-06-11 15:30:55 +00:00
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
/* Read length of payload */
|
2006-12-22 22:15:38 +00:00
|
|
|
reported_payload_length = tvb_get_ntohs(tvb, 4);
|
2001-01-04 04:15:30 +00:00
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
if (tree)
|
|
|
|
{
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_pppoed, tvb, 0, reported_payload_length+6, ENC_NA);
|
1999-11-16 11:44:20 +00:00
|
|
|
pppoe_tree = proto_item_add_subtree(ti, ett_pppoed);
|
2005-11-25 06:23:04 +00:00
|
|
|
|
|
|
|
/* Dissect fixed fields */
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoe_version, tvb, 0, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoe_type, tvb, 0, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoe_code, tvb, 1, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoe_session_id, tvb, 2, 2, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoe_payload_length, tvb, 4, 2, ENC_BIG_ENDIAN);
|
1999-06-11 15:30:55 +00:00
|
|
|
}
|
2007-08-15 22:27:52 +00:00
|
|
|
|
2005-12-07 00:35:16 +00:00
|
|
|
/* Now dissect any tags */
|
2006-12-22 22:15:38 +00:00
|
|
|
if (reported_payload_length > 0)
|
2005-12-07 00:35:16 +00:00
|
|
|
{
|
2008-04-14 22:32:17 +00:00
|
|
|
dissect_pppoe_tags(tvb, pinfo, 6, pppoe_tree, 6+reported_payload_length);
|
2005-12-07 00:35:16 +00:00
|
|
|
}
|
2005-11-25 06:23:04 +00:00
|
|
|
|
2001-01-04 04:15:30 +00:00
|
|
|
}
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
void proto_register_pppoed(void)
|
2001-01-04 04:15:30 +00:00
|
|
|
{
|
2005-11-25 06:23:04 +00:00
|
|
|
static hf_register_info hf[] =
|
|
|
|
{
|
|
|
|
/* Discovery tag fields */
|
|
|
|
{ &hf_pppoed_tags,
|
|
|
|
{ "PPPoE Tags", "pppoed.tags", FT_NONE, BASE_NONE,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag,
|
|
|
|
{ "Tag", "pppoed.tag", FT_UINT16, BASE_HEX,
|
2009-06-21 18:45:56 +00:00
|
|
|
VALS(tag_vals), 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_length,
|
|
|
|
{ "Tag Length", "pppoed.tag_length", FT_UINT16, BASE_DEC,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
2009-10-25 20:11:47 +00:00
|
|
|
{ &hf_pppoed_tag_length_8,
|
|
|
|
{ "Tag Length", "pppoed.tag_length_8", FT_UINT8, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
2005-11-25 06:23:04 +00:00
|
|
|
{ &hf_pppoed_tag_unknown_data,
|
2008-04-14 22:32:17 +00:00
|
|
|
{ "Unknown Data", "pppoed.tag.unknown_data", FT_BYTES, BASE_NONE,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_service_name,
|
|
|
|
{ "Service-Name", "pppoed.tags.service_name", FT_STRING, BASE_NONE,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_ac_name,
|
|
|
|
{ "AC-Name", "pppoed.tags.ac_name", FT_STRING, BASE_NONE,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_host_uniq,
|
2005-11-28 00:41:01 +00:00
|
|
|
{ "Host-Uniq", "pppoed.tags.host_uniq", FT_BYTES, BASE_NONE,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_ac_cookie,
|
2005-11-28 00:41:01 +00:00
|
|
|
{ "AC-Cookie", "pppoed.tags.ac_cookie", FT_BYTES, BASE_NONE,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vendor_id,
|
2009-10-25 20:11:47 +00:00
|
|
|
{ "Vendor id", "pppoed.tags.vendor_id", FT_UINT32, BASE_DEC,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vendor_unspecified,
|
2009-06-21 18:45:56 +00:00
|
|
|
{ "Vendor unspecified", "pppoed.tags.vendor_unspecified", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
2009-10-25 20:11:47 +00:00
|
|
|
{ &hf_pppoed_tag_vspec_tags,
|
|
|
|
{ "Vendor Specific PPPoE Tags", "pppoed.tags.vendorspecific.tags", FT_NONE, BASE_NONE,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_tag,
|
|
|
|
{ "Tag", "pppoed.tags.vendorspecific.tag", FT_UINT8, BASE_HEX,
|
2010-05-14 18:56:28 +00:00
|
|
|
VALS(vspec_tag_vals), 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
2009-11-09 15:55:01 +00:00
|
|
|
{ &hf_pppoed_tag_vspec_circuit_id,
|
|
|
|
{ "Circuit ID", "pppoed.tags.circuit_id", FT_STRING, BASE_NONE,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-11-09 15:55:01 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_remote_id,
|
|
|
|
{ "Remote ID", "pppoed.tags.remote_id", FT_STRING, BASE_NONE,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-11-09 15:55:01 +00:00
|
|
|
}
|
|
|
|
},
|
2009-10-25 20:11:47 +00:00
|
|
|
{ &hf_pppoed_tag_vspec_act_data_rate_up,
|
|
|
|
{ "Actual Data Rate Upstream", "pppoed.tags.act_data_rate_up", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_act_data_rate_down,
|
|
|
|
{ "Actual Data Rate Downstream", "pppoed.tags.act_data_rate_down", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_min_data_rate_up,
|
|
|
|
{ "Minimum Data Rate Upstream", "pppoed.tags.min_data_rate_up", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_min_data_rate_down,
|
|
|
|
{ "Minimum Data Rate Downstream", "pppoed.tags.min_data_rate_down", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_attainable_data_rate_up,
|
|
|
|
{ "Attainable DataRate Upstream", "pppoed.tags.attainable_data_rate_up", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_attainable_data_rate_down,
|
|
|
|
{ "Attainable DataRate Downstream", "pppoed.tags.attainable_data_rate_down", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_max_data_rate_up,
|
|
|
|
{ "Maximum Data Rate Upstream", "pppoed.tags.max_data_rate_up", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_max_data_rate_down,
|
|
|
|
{ "Maximum Data Rate Downstream", "pppoed.tags.max_data_rate_down", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_min_data_rate_up_lp,
|
|
|
|
{ "Min DataRate Upstream in low power state", "pppoed.tags.min_data_rate_up_lp", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_min_data_rate_down_lp,
|
|
|
|
{ "Minimum Data Rate Downstream in low power state", "pppoed.tags.min_data_rate_down_lp", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_max_int_delay_up,
|
|
|
|
{ "Max Interleaving Delay Upstream", "pppoed.tags.max_int_delay_up", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_act_int_delay_up,
|
|
|
|
{ "Actual Interleaving Delay Upstream", "pppoed.tags.act_int_delay_up", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_max_int_delay_down,
|
|
|
|
{ "Maximum Interleaving Delay Downstream", "pppoed.tags.max_int_delay_down", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_act_int_delay_down,
|
|
|
|
{ "Actual Interleaving Delay Downstream", "pppoed.tags.act_int_delay_down", FT_UINT32, BASE_DEC,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_access_loop_encapsulation,
|
|
|
|
{ "Access-Loop-Encapsulation", "pppoed.tags.access_loop_encap", FT_NONE, BASE_NONE,
|
2010-05-14 18:56:28 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2009-10-25 20:11:47 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_access_loop_encap_data_link,
|
|
|
|
{ "Data link", "pppoed.tags.access_loop_encap.data_link", FT_UINT8, BASE_HEX,
|
|
|
|
VALS(vspec_tag_dslf_access_loop_encap_data_link_vals), 0x0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_access_loop_encap_encap_1,
|
|
|
|
{ "Encaps 1", "pppoed.tags.access_loop_encap.encap_1", FT_UINT8, BASE_HEX,
|
|
|
|
VALS(vspec_tag_dslf_access_loop_encap_encap_1_vals), 0x0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_vspec_access_loop_encap_encap_2,
|
|
|
|
{ "Encaps 1", "pppoed.tags.access_loop_encap.encap_2", FT_UINT8, BASE_HEX,
|
|
|
|
VALS(vspec_tag_dslf_access_loop_encap_encap_2_vals), 0x0, NULL, HFILL
|
|
|
|
}
|
|
|
|
},
|
2008-04-14 22:32:17 +00:00
|
|
|
{ &hf_pppoed_tag_credits,
|
2009-06-21 18:45:56 +00:00
|
|
|
{ "Credits", "pppoed.tags.credits", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_credits_fcn,
|
2008-07-19 15:04:20 +00:00
|
|
|
{ "FCN", "pppoed.tags.credits.fcn", FT_UINT16, BASE_DEC,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_credits_bcn,
|
2008-07-19 15:04:20 +00:00
|
|
|
{ "BCN", "pppoed.tags.credits.bcn", FT_UINT16, BASE_DEC,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_metrics,
|
2009-06-21 18:45:56 +00:00
|
|
|
{ "Metrics", "pppoed.tags.metrics", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_metrics_r,
|
|
|
|
{ "Receive Only", "pppoed.tags.metrics.r", FT_BOOLEAN, 16,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, PPPOE_RCV_ONLY_MASK, NULL, HFILL
|
2008-07-19 15:04:20 +00:00
|
|
|
}
|
|
|
|
},
|
2008-08-13 21:32:09 +00:00
|
|
|
{ &hf_pppoed_tag_mdr_units,
|
2008-07-19 15:04:20 +00:00
|
|
|
{ "MDR Units", "pppoed.tags.metrics.mdr_units", FT_UINT16, BASE_HEX,
|
2009-06-21 18:45:56 +00:00
|
|
|
VALS(datarate_scale_vals), PPPOE_MDR_MASK, NULL, HFILL
|
2008-07-19 15:04:20 +00:00
|
|
|
}
|
|
|
|
},
|
2008-08-13 21:32:09 +00:00
|
|
|
{ &hf_pppoed_tag_cdr_units,
|
2008-07-19 15:04:20 +00:00
|
|
|
{ "CDR Units", "pppoed.tags.metrics.cdr_units", FT_UINT16, BASE_HEX,
|
2009-06-21 18:45:56 +00:00
|
|
|
VALS(datarate_scale_vals), PPPOE_CDR_MASK, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_metrics_rlq,
|
2008-07-19 15:04:20 +00:00
|
|
|
{ "Relative Link Quality", "pppoed.tags.metrics.rlq", FT_UINT8, BASE_DEC,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_metrics_resource,
|
2008-07-19 15:04:20 +00:00
|
|
|
{ "Resource", "pppoed.tags.metrics.resource", FT_UINT8, BASE_DEC,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_metrics_latency,
|
|
|
|
{ "Latency", "pppoed.tags.metrics.latency", FT_UINT16, BASE_DEC,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_metrics_curr_drate,
|
|
|
|
{ "Curr. datarate", "pppoed.tags.metrics.curr_drate", FT_UINT16, BASE_DEC,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_metrics_max_drate,
|
|
|
|
{ "Max. datarate", "pppoed.tags.metrics.max_drate", FT_UINT16, BASE_DEC,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_seq_num,
|
|
|
|
{ "Sequence Number", "pppoed.tags.seq_num", FT_UINT16, BASE_HEX,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
2008-08-13 21:32:09 +00:00
|
|
|
{ &hf_pppoed_tag_cred_scale,
|
2008-07-19 15:04:20 +00:00
|
|
|
{ "Credit Scale Factor", "pppoed.tags.credit_scale", FT_UINT16, BASE_DEC,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-07-19 15:04:20 +00:00
|
|
|
}
|
|
|
|
},
|
2005-11-25 06:23:04 +00:00
|
|
|
{ &hf_pppoed_tag_relay_session_id,
|
2005-11-28 00:41:01 +00:00
|
|
|
{ "Relay-Session-Id", "pppoed.tags.relay_session_id", FT_BYTES, BASE_NONE,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
2008-04-14 22:32:17 +00:00
|
|
|
{ &hf_pppoed_tag_hurl,
|
2009-06-21 18:45:56 +00:00
|
|
|
{ "HURL", "pppoed.tags.hurl", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_motm,
|
2009-06-21 18:45:56 +00:00
|
|
|
{ "MOTM", "pppoed.tags.motm", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_max_payload,
|
2009-06-21 18:45:56 +00:00
|
|
|
{ "PPP Max Palyload", "pppoed.tags.max_payload", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_ip_route_add,
|
2009-06-21 18:45:56 +00:00
|
|
|
{ "IP Route Add", "pppoed.tags.ip_route_add", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-04-14 22:32:17 +00:00
|
|
|
}
|
|
|
|
},
|
2005-11-25 06:23:04 +00:00
|
|
|
{ &hf_pppoed_tag_service_name_error,
|
|
|
|
{ "Service-Name-Error", "pppoed.tags.service_name_error", FT_STRING, BASE_NONE,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_ac_system_error,
|
|
|
|
{ "AC-System-Error", "pppoed.tags.ac_system_error", FT_STRING, BASE_NONE,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoed_tag_generic_error,
|
|
|
|
{ "Generic-Error", "pppoed.tags.generic_error", FT_STRING, BASE_NONE,
|
2009-06-21 18:45:56 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2005-11-25 06:23:04 +00:00
|
|
|
}
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
2005-11-25 06:23:04 +00:00
|
|
|
};
|
|
|
|
|
2001-01-04 04:15:30 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_pppoed,
|
2009-10-25 20:11:47 +00:00
|
|
|
&ett_pppoed_tags,
|
|
|
|
&ett_pppoed_tag_vspec_dslf_access_loop_encaps
|
2001-01-04 04:15:30 +00:00
|
|
|
};
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
module_t *pppoed_module;
|
1999-06-11 15:30:55 +00:00
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
/* Register protocol and fields */
|
|
|
|
proto_pppoed = proto_register_protocol("PPP-over-Ethernet Discovery",
|
|
|
|
"PPPoED", "pppoed");
|
2001-01-04 04:15:30 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2005-11-25 06:23:04 +00:00
|
|
|
proto_register_field_array(proto_pppoed, hf, array_length(hf));
|
|
|
|
|
|
|
|
/* Preference setting */
|
2008-04-14 22:32:17 +00:00
|
|
|
pppoed_module = prefs_register_protocol(proto_pppoed, NULL);
|
2005-11-25 06:23:04 +00:00
|
|
|
prefs_register_bool_preference(pppoed_module, "show_tags_and_lengths",
|
|
|
|
"Show tag values and lengths",
|
|
|
|
"Show values of tags and lengths of data fields",
|
|
|
|
&global_pppoe_show_tags_and_lengths);
|
2001-01-04 04:15:30 +00:00
|
|
|
}
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
void proto_reg_handoff_pppoed(void)
|
2001-01-04 04:15:30 +00:00
|
|
|
{
|
2001-12-03 04:00:26 +00:00
|
|
|
dissector_handle_t pppoed_handle;
|
|
|
|
|
|
|
|
pppoed_handle = create_dissector_handle(dissect_pppoed, proto_pppoed);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("ethertype", ETHERTYPE_PPPOED, pppoed_handle);
|
1999-06-11 15:30:55 +00:00
|
|
|
}
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
|
|
|
|
/* Session protocol, i.e. PPP session established */
|
|
|
|
static void dissect_pppoes(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|
|
|
{
|
|
|
|
guint8 pppoe_code;
|
2007-09-02 23:51:51 +00:00
|
|
|
guint16 reported_payload_length;
|
2008-08-13 21:32:09 +00:00
|
|
|
guint16 poe_tag_length;
|
2007-09-02 23:51:51 +00:00
|
|
|
gint actual_payload_length;
|
2005-11-25 06:23:04 +00:00
|
|
|
gint length, reported_length;
|
2008-08-13 21:32:09 +00:00
|
|
|
gint credit_offset = 0, tagstart = 0;
|
2009-10-18 13:36:01 +00:00
|
|
|
guint16 cp_code;
|
1999-06-11 15:30:55 +00:00
|
|
|
|
|
|
|
proto_tree *pppoe_tree;
|
2007-09-02 22:49:56 +00:00
|
|
|
proto_item *ti = NULL;
|
2000-11-19 02:00:03 +00:00
|
|
|
tvbuff_t *next_tvb;
|
|
|
|
|
2009-08-09 07:59:51 +00:00
|
|
|
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PPPoES");
|
2009-08-09 08:14:59 +00:00
|
|
|
col_clear(pinfo->cinfo, COL_INFO);
|
2001-01-04 04:15:30 +00:00
|
|
|
|
1999-06-11 15:30:55 +00:00
|
|
|
/* Start Decoding Here. */
|
2000-11-19 02:00:03 +00:00
|
|
|
pppoe_code = tvb_get_guint8(tvb, 1);
|
1999-06-11 15:30:55 +00:00
|
|
|
|
2013-06-14 01:56:28 +00:00
|
|
|
col_add_str(pinfo->cinfo, COL_INFO,
|
2012-08-10 22:55:02 +00:00
|
|
|
val_to_str_const(pppoe_code, code_vals, "Unknown"));
|
1999-06-11 15:30:55 +00:00
|
|
|
|
2006-12-22 22:15:38 +00:00
|
|
|
reported_payload_length = tvb_get_ntohs(tvb, 4);
|
2007-09-02 22:49:56 +00:00
|
|
|
actual_payload_length = tvb_reported_length_remaining(tvb, 6);
|
2001-01-04 04:15:30 +00:00
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
if (tree)
|
|
|
|
{
|
2011-10-21 02:10:19 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_pppoes, tvb, 0, 6, ENC_NA);
|
2008-08-13 21:32:09 +00:00
|
|
|
pppoe_tree = proto_item_add_subtree(ti, ett_pppoe);
|
2005-11-25 06:23:04 +00:00
|
|
|
|
2011-10-06 03:35:44 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoe_version, tvb, 0, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoe_type, tvb, 0, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoe_code, tvb, 1, 1, ENC_BIG_ENDIAN);
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoe_session_id, tvb, 2, 2, ENC_BIG_ENDIAN);
|
|
|
|
ti = proto_tree_add_item(pppoe_tree, hf_pppoe_payload_length, tvb, 4, 2, ENC_BIG_ENDIAN);
|
2005-11-25 06:23:04 +00:00
|
|
|
|
2008-08-13 21:32:09 +00:00
|
|
|
|
|
|
|
if (PPPOE_TAG_CREDITS == tvb_get_ntohs(tvb, 6))
|
|
|
|
{
|
|
|
|
tagstart = 6;
|
|
|
|
poe_tag_length = tvb_get_ntohs(tvb, tagstart + 2);
|
|
|
|
|
|
|
|
/* Create tags subtree */
|
2011-10-04 22:44:31 +00:00
|
|
|
ti = proto_tree_add_item(pppoe_tree, hf_pppoes_tags, tvb, tagstart, 8, ENC_NA);
|
2008-08-13 21:32:09 +00:00
|
|
|
pppoe_tree = proto_item_add_subtree(ti, ett_pppoes_tags);
|
|
|
|
|
|
|
|
/* Show tag data */
|
|
|
|
if (poe_tag_length == 4)
|
|
|
|
{
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoes_tag_credits_fcn, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+4, 2, ENC_BIG_ENDIAN);
|
2008-08-13 21:32:09 +00:00
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoes_tag_credits_bcn, tvb,
|
2011-10-06 03:35:44 +00:00
|
|
|
tagstart+6, 2, ENC_BIG_ENDIAN);
|
2008-08-13 21:32:09 +00:00
|
|
|
} else {
|
|
|
|
proto_tree_add_item(pppoe_tree, hf_pppoed_tag_credits, tvb,
|
2011-10-04 22:44:31 +00:00
|
|
|
tagstart+4, poe_tag_length, ENC_NA);
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
credit_offset = 8;
|
|
|
|
}
|
|
|
|
}
|
2009-02-25 11:25:12 +00:00
|
|
|
|
2007-09-02 22:49:56 +00:00
|
|
|
/*
|
|
|
|
* The only reason why the payload length from the header
|
|
|
|
* should differ from the remaining data in the packet
|
|
|
|
* would be if the total packet length, including Ethernet
|
|
|
|
* CRC, were < 64 bytes, so that padding was required.
|
|
|
|
*
|
|
|
|
* That means that you have 14 bytes of Ethernet header,
|
|
|
|
* 4 bytes of FCS, and fewer than 46 bytes of PPPoE packet.
|
|
|
|
*
|
|
|
|
* If that's not the case, we report a difference between
|
|
|
|
* the payload length in the packet, and the amount of
|
|
|
|
* data following the PPPoE header, as an error.
|
|
|
|
*/
|
2009-02-23 20:44:11 +00:00
|
|
|
if (tvb_reported_length(tvb) > 46) {
|
2009-02-25 11:25:12 +00:00
|
|
|
/*
|
|
|
|
* Be forgiving about a possible trailing FCS.
|
|
|
|
*
|
|
|
|
* XXX - this dissector currently doesn't know
|
|
|
|
* whether any extra data past the end of the PPP
|
|
|
|
* payload is an FCS or not.
|
|
|
|
*
|
|
|
|
* If we know that we have an FCS, or that we don't
|
|
|
|
* have an FCS, we should have been handed a tvbuff
|
|
|
|
* without the FCS, and we should just do the strict
|
|
|
|
* length check.
|
|
|
|
*
|
|
|
|
* If we don't know whether we have an FCS, then:
|
|
|
|
*
|
|
|
|
* if this isn't over Ethernet - the "E" in "PPPoE"
|
|
|
|
* nonwithstanding, it can also run on top of 802.11,
|
|
|
|
* for example - there's no trailer, so any data
|
|
|
|
* past the payload length is either an FCS or
|
|
|
|
* bogus;
|
|
|
|
*
|
|
|
|
* if this is over Ethernet, there shouldn't be
|
|
|
|
* a trailer, as the packet is long enough not to
|
|
|
|
* require a trailer, as per the above;
|
|
|
|
*
|
|
|
|
* so perhaps we should assume that if we have exactly
|
|
|
|
* 4 bytes of extra information, it's an FCS, otherwise
|
|
|
|
* it's not.
|
|
|
|
*
|
|
|
|
* Perhaps we need to have a routine to call to
|
|
|
|
* do all the length checking, etc., and call it
|
|
|
|
* from here and from other dissectors where the
|
|
|
|
* protocol has a length field, or have a way to
|
|
|
|
* tell the dissector that called us which field
|
|
|
|
* has the length field and have *that* dissector
|
|
|
|
* do the length checking and add the expert info
|
|
|
|
* to the length field, *after* it does all the
|
|
|
|
* FCS heuristics.
|
|
|
|
*/
|
2009-10-18 13:36:01 +00:00
|
|
|
|
|
|
|
/* retrieve the control protocol code if it's there */
|
|
|
|
cp_code = tvb_get_ntohs(tvb, 6);
|
|
|
|
/*
|
|
|
|
* The session payload length expressly does not include pad bytes
|
|
|
|
* when LCP or IPCP are present, so avoid the spurious error message
|
|
|
|
*/
|
|
|
|
if ((cp_code != PPP_LCP) && (cp_code != PPP_IPCP) &&
|
|
|
|
(reported_payload_length != actual_payload_length) &&
|
|
|
|
((reported_payload_length + 4) != actual_payload_length)) {
|
|
|
|
proto_item_append_text(ti, " [incorrect, should be %u]",
|
|
|
|
actual_payload_length);
|
|
|
|
expert_add_info_format(pinfo, ti, PI_MALFORMED,
|
|
|
|
PI_WARN, "Possible bad payload length %u != %u",
|
|
|
|
reported_payload_length, actual_payload_length);
|
2009-02-25 11:25:12 +00:00
|
|
|
}
|
2007-09-02 22:49:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Construct a tvbuff containing the PPP packet.
|
2000-11-19 02:00:03 +00:00
|
|
|
*/
|
2002-10-21 18:17:41 +00:00
|
|
|
length = tvb_length_remaining(tvb, 6);
|
|
|
|
reported_length = tvb_reported_length_remaining(tvb, 6);
|
2005-06-10 18:28:22 +00:00
|
|
|
DISSECTOR_ASSERT(length >= 0);
|
|
|
|
DISSECTOR_ASSERT(reported_length >= 0);
|
2002-10-21 18:17:41 +00:00
|
|
|
if (length > reported_length)
|
|
|
|
length = reported_length;
|
2006-12-22 22:15:38 +00:00
|
|
|
if ((guint)length > reported_payload_length)
|
|
|
|
length = reported_payload_length;
|
|
|
|
if ((guint)reported_length > reported_payload_length)
|
|
|
|
reported_length = reported_payload_length;
|
2008-08-13 21:32:09 +00:00
|
|
|
next_tvb = tvb_new_subset(tvb,(6 + credit_offset),
|
|
|
|
(length - credit_offset),
|
|
|
|
(reported_length - credit_offset));
|
2001-03-30 06:10:54 +00:00
|
|
|
call_dissector(ppp_handle,next_tvb,pinfo,tree);
|
1999-06-11 15:30:55 +00:00
|
|
|
}
|
2005-11-25 06:23:04 +00:00
|
|
|
|
|
|
|
void proto_register_pppoes(void)
|
1999-11-16 11:44:20 +00:00
|
|
|
{
|
2008-08-13 21:32:09 +00:00
|
|
|
|
|
|
|
static hf_register_info hf[] =
|
|
|
|
{
|
|
|
|
{ &hf_pppoes_tags,
|
|
|
|
{ "PPPoE Tags", "pppoes.tags", FT_NONE, BASE_NONE,
|
2009-06-19 02:09:52 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
|
|
|
},
|
2013-01-31 18:31:28 +00:00
|
|
|
#if 0
|
2008-08-13 21:32:09 +00:00
|
|
|
{ &hf_pppoes_tag,
|
|
|
|
{ "Tag", "pppoes.tag", FT_UINT16, BASE_HEX,
|
2009-06-19 02:09:52 +00:00
|
|
|
VALS(tag_vals), 0x0, NULL, HFILL
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
|
|
|
},
|
2013-01-31 18:31:28 +00:00
|
|
|
#endif
|
|
|
|
#if 0
|
2008-08-13 21:32:09 +00:00
|
|
|
{ &hf_pppoes_tag_credits,
|
2009-06-19 02:09:52 +00:00
|
|
|
{ "Credits", "pppoes.tags.credits", FT_BYTES, BASE_NONE,
|
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
|
|
|
},
|
2013-01-31 18:31:28 +00:00
|
|
|
#endif
|
2008-08-13 21:32:09 +00:00
|
|
|
{ &hf_pppoes_tag_credits_fcn,
|
|
|
|
{ "FCN", "pppoes.tags.credits.fcn", FT_UINT16, BASE_DEC,
|
2009-06-19 02:09:52 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoes_tag_credits_bcn,
|
|
|
|
{ "BCN", "pppoes.tags.credits.bcn", FT_UINT16, BASE_DEC,
|
2009-06-19 02:09:52 +00:00
|
|
|
NULL, 0x0, NULL, HFILL
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_pppoes,
|
|
|
|
&ett_pppoes_tags
|
|
|
|
};
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
/* Register protocol */
|
|
|
|
proto_pppoes = proto_register_protocol("PPP-over-Ethernet Session", "PPPoES", "pppoes");
|
2008-08-13 21:32:09 +00:00
|
|
|
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
proto_register_field_array(proto_pppoes, hf, array_length(hf));
|
|
|
|
}
|
|
|
|
|
|
|
|
void proto_register_pppoe(void)
|
|
|
|
{
|
|
|
|
static hf_register_info hf[] =
|
|
|
|
{
|
|
|
|
/* These fields common to discovery and session protocols */
|
|
|
|
{ &hf_pppoe_version,
|
|
|
|
{ "Version", "pppoe.version", FT_UINT8, BASE_DEC,
|
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, 0xf0, NULL, HFILL
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoe_type,
|
|
|
|
{ "Type", "pppoe.type", FT_UINT8, BASE_DEC,
|
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, 0x0f, NULL, HFILL
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoe_code,
|
|
|
|
{ "Code", "pppoe.code", FT_UINT8, BASE_HEX,
|
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
|
|
|
VALS(code_vals), 0x0, NULL, HFILL
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoe_session_id,
|
|
|
|
{ "Session ID", "pppoe.session_id", FT_UINT16, BASE_HEX,
|
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, 0x0, NULL, HFILL
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ &hf_pppoe_payload_length,
|
|
|
|
{ "Payload Length", "pppoe.payload_length", FT_UINT16, BASE_DEC,
|
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, 0x0, NULL, HFILL
|
2008-08-13 21:32:09 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_pppoe
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Register protocol */
|
|
|
|
proto_pppoe = proto_register_protocol("PPP-over-Ethernet", "PPPoE", "pppoe");
|
|
|
|
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
proto_register_field_array(proto_pppoe, hf, array_length(hf));
|
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
}
|
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
void proto_reg_handoff_pppoes(void)
|
Change the sub-dissector handoff registration routines so that the
sub-dissector table is not stored in the header_field_info struct, but
in a separate namespace. Dissector tables are now registered by name
and not by field ID. For example:
udp_dissector_table = register_dissector_table("udp.port");
Because of this different namespace, dissector tables can have names
that are not field names. This is useful for ethertype, since multiple
fields are "ethertypes".
packet-ethertype.c replaces ethertype.c (the name was changed so that it
would be named in the same fashion as all the filenames passed to make-reg-dotc)
Although it registers no protocol or field, it registers one dissector table:
ethertype_dissector_table = register_dissector_table("ethertype");
All protocols that can be called because of an ethertype field now register
that fact with dissector_add() calls.
In this way, one dissector_table services all ethertype fields
(hf_eth_type, hf_llc_type, hf_null_etype, hf_vlan_etype)
Furthermore, the code allows for names of protocols to exist in the
etype_vals, yet a dissector for that protocol doesn't exist. The name
of the dissector is printed in COL_INFO. You're welcome, Richard. :-)
svn path=/trunk/; revision=1848
2000-04-13 18:18:56 +00:00
|
|
|
{
|
2005-11-25 06:23:04 +00:00
|
|
|
dissector_handle_t pppoes_handle =
|
|
|
|
create_dissector_handle(dissect_pppoes, proto_pppoes);
|
2010-12-20 05:35:29 +00:00
|
|
|
dissector_add_uint("ethertype", ETHERTYPE_PPPOES, pppoes_handle);
|
2012-03-01 07:39:54 +00:00
|
|
|
dissector_add_uint("wtap_encap", WTAP_ENCAP_PPP_ETHER, pppoes_handle);
|
2000-11-19 02:00:03 +00:00
|
|
|
|
2005-11-25 06:23:04 +00:00
|
|
|
/* Get a handle for the PPP dissector */
|
2001-03-30 06:10:54 +00:00
|
|
|
ppp_handle = find_dissector("ppp");
|
Change the sub-dissector handoff registration routines so that the
sub-dissector table is not stored in the header_field_info struct, but
in a separate namespace. Dissector tables are now registered by name
and not by field ID. For example:
udp_dissector_table = register_dissector_table("udp.port");
Because of this different namespace, dissector tables can have names
that are not field names. This is useful for ethertype, since multiple
fields are "ethertypes".
packet-ethertype.c replaces ethertype.c (the name was changed so that it
would be named in the same fashion as all the filenames passed to make-reg-dotc)
Although it registers no protocol or field, it registers one dissector table:
ethertype_dissector_table = register_dissector_table("ethertype");
All protocols that can be called because of an ethertype field now register
that fact with dissector_add() calls.
In this way, one dissector_table services all ethertype fields
(hf_eth_type, hf_llc_type, hf_null_etype, hf_vlan_etype)
Furthermore, the code allows for names of protocols to exist in the
etype_vals, yet a dissector for that protocol doesn't exist. The name
of the dissector is printed in COL_INFO. You're welcome, Richard. :-)
svn path=/trunk/; revision=1848
2000-04-13 18:18:56 +00:00
|
|
|
}
|