1999-10-12 23:12:06 +00:00
|
|
|
/* packet-ripng.c
|
|
|
|
* Routines for RIPng disassembly
|
|
|
|
* (c) Copyright Jun-ichiro itojun Hagino <itojun@itojun.org>
|
|
|
|
* derived from packet-rip.c
|
|
|
|
*
|
2001-04-24 02:50:00 +00:00
|
|
|
* $Id: packet-ripng.c,v 1.20 2001/04/24 02:50:00 guy Exp $
|
1999-10-12 23:12:06 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
2001-04-23 18:19:03 +00:00
|
|
|
* By Gerald Combs <gerald@ethereal.com>
|
1999-10-12 23:12:06 +00:00
|
|
|
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_NETINET_IN_H
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#endif
|
|
|
|
|
2000-11-17 21:00:40 +00:00
|
|
|
#include <string.h>
|
1999-10-12 23:12:06 +00:00
|
|
|
#include <glib.h>
|
|
|
|
#include "packet.h"
|
|
|
|
#include "packet-ripng.h"
|
|
|
|
|
1999-10-18 00:37:35 +00:00
|
|
|
#ifndef offsetof
|
|
|
|
#define offsetof(type, member) ((size_t)(&((type *)0)->member))
|
|
|
|
#endif
|
|
|
|
|
1999-10-12 23:12:06 +00:00
|
|
|
static int proto_ripng = -1;
|
1999-10-15 13:21:14 +00:00
|
|
|
static int hf_ripng_cmd = -1;
|
|
|
|
static int hf_ripng_version = -1;
|
1999-10-12 23:12:06 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_ripng = -1;
|
|
|
|
static gint ett_ripng_addr = -1;
|
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
#define UDP_PORT_RIPNG 521
|
|
|
|
|
Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="
statements.
Move the setting of the Protocol column in various dissectors before
anything is fetched from the packet, and also clear the Info column at
that point in those and some other dissectors, so that if an exception
is thrown, the columns don't reflect the previous protocol.
Don't use
col_add_fstr(..., "%s", string);
Use
col_add_str(..., string);
as it does the same thing, but doesn't drag all the heavy *printf
machinery in.
Fix the DDTP dissector to set the Info column regardless of whether
we're building a protocol tree or not, and to set it to "Encrypted
payload" if the payload is encrypted. Also fix a typo in a field name.
Register the FTP data dissector as being associated with the FTP data
protocol, not the FTP protocol (the removed "CHECK_DISPLAY_AS_DATA()"
call checked "proto_ftp_data", and the removed "pinfo->current_proto ="
line set it to "FTP-DATA", so it should be associated with
"proto_ftp_data").
Make the H1 dissector check whether the frame has at least 2 bytes in it
before checking the first two bytes; heuristic dissectors must not throw
exceptions until they've accepted the packet as one of theirs.
Use "tvb_format_text()" rather than "tvb_get_ptr()" and "format_text()"
in some dissectors where the result of "tvb_get_ptr()" is used only in
the "format_text()" call.
In the Quake dissector, don't check whether there are at least 4 bytes
in the packet - if we return, the packet won't be dissected at all (it's
not as if some other dissector will get to handle it), and, if we don't
return, we'll throw an exception if there aren't at least 4 bytes in the
packet, so the packet will be marked as short or malformed, as
appropriate.
In the RIPng dissector, associate the table of strings for the command
field with the command field, so that the dissector doesn't have to
format the string for the protocol tree entry itself, and so that the
filter construction dialog box can let you select "Request" or
"Response" from a list rather than requiring you to know the values for
"Request" and "Response".
Make "dissect_rpc()" static, as it's called only through a heuristic
dissector list.
Use "col_set_str()" to set the COL_PROTOCOL column for RPC protocols;
the string used is from a table provided by the dissector, and is a
string constant.
Don't format the Info column for WSP into a buffer and then format that
buffer into the column with "%s" - "col_add_fstr()" can do the
formatting for you, without having to allocate your own buffer (or run
through the *printf machinery twice).
Don't fetch fields from the WTP packet until you're ready to use them,
so that you don't throw an exception before you even set the Protocol
column or clear the Info column.
Use "pinfo->destport", not "pi.destport", in the Zebra dissector when
checking whether the packet is a request or reply, and do the check by
comparing with "pinfo->match_port" rather than TCP_PORT_ZEBRA (so that
if the dissector is ever registered on another port, it still correctly
determines whether the packet is a request or reply - the Network
Monitor HTTP dissector has port 80 wired into its brain, which is a bit
irritating if you're trying to get it to dissect HTTP proxy traffic on
port 3128 or proxy administration UI traffic on port 3132).
svn path=/trunk/; revision=2931
2001-01-22 08:03:46 +00:00
|
|
|
static const value_string cmdvals[] = {
|
|
|
|
{ RIP6_REQUEST, "Request" },
|
|
|
|
{ RIP6_RESPONSE, "Response" },
|
|
|
|
{ 0, NULL },
|
|
|
|
};
|
|
|
|
|
2000-04-08 07:07:42 +00:00
|
|
|
static void
|
2001-04-24 02:50:00 +00:00
|
|
|
dissect_ripng(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) {
|
|
|
|
int offset = 0;
|
1999-10-12 23:12:06 +00:00
|
|
|
struct rip6 rip6;
|
|
|
|
struct netinfo6 ni6;
|
|
|
|
proto_tree *ripng_tree = NULL;
|
1999-10-18 00:37:35 +00:00
|
|
|
proto_tree *subtree = NULL;
|
|
|
|
proto_item *ti;
|
1999-10-12 23:12:06 +00:00
|
|
|
|
2001-04-24 02:50:00 +00:00
|
|
|
if (check_col(pinfo->fd, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->fd, COL_PROTOCOL, "RIPng");
|
|
|
|
if (check_col(pinfo->fd, COL_INFO))
|
|
|
|
col_clear(pinfo->fd, COL_INFO);
|
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
|
|
|
|
1999-10-12 23:12:06 +00:00
|
|
|
/* avoid alignment problem */
|
2001-04-24 02:50:00 +00:00
|
|
|
tvb_memcpy(tvb, (guint8 *)&rip6, offset, sizeof(rip6));
|
1999-10-12 23:12:06 +00:00
|
|
|
|
2001-04-24 02:50:00 +00:00
|
|
|
if (check_col(pinfo->fd, COL_PROTOCOL))
|
|
|
|
col_add_fstr(pinfo->fd, COL_PROTOCOL, "RIPng version %u", rip6.rip6_vers);
|
|
|
|
if (check_col(pinfo->fd, COL_INFO))
|
|
|
|
col_add_str(pinfo->fd, COL_INFO,
|
Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="
statements.
Move the setting of the Protocol column in various dissectors before
anything is fetched from the packet, and also clear the Info column at
that point in those and some other dissectors, so that if an exception
is thrown, the columns don't reflect the previous protocol.
Don't use
col_add_fstr(..., "%s", string);
Use
col_add_str(..., string);
as it does the same thing, but doesn't drag all the heavy *printf
machinery in.
Fix the DDTP dissector to set the Info column regardless of whether
we're building a protocol tree or not, and to set it to "Encrypted
payload" if the payload is encrypted. Also fix a typo in a field name.
Register the FTP data dissector as being associated with the FTP data
protocol, not the FTP protocol (the removed "CHECK_DISPLAY_AS_DATA()"
call checked "proto_ftp_data", and the removed "pinfo->current_proto ="
line set it to "FTP-DATA", so it should be associated with
"proto_ftp_data").
Make the H1 dissector check whether the frame has at least 2 bytes in it
before checking the first two bytes; heuristic dissectors must not throw
exceptions until they've accepted the packet as one of theirs.
Use "tvb_format_text()" rather than "tvb_get_ptr()" and "format_text()"
in some dissectors where the result of "tvb_get_ptr()" is used only in
the "format_text()" call.
In the Quake dissector, don't check whether there are at least 4 bytes
in the packet - if we return, the packet won't be dissected at all (it's
not as if some other dissector will get to handle it), and, if we don't
return, we'll throw an exception if there aren't at least 4 bytes in the
packet, so the packet will be marked as short or malformed, as
appropriate.
In the RIPng dissector, associate the table of strings for the command
field with the command field, so that the dissector doesn't have to
format the string for the protocol tree entry itself, and so that the
filter construction dialog box can let you select "Request" or
"Response" from a list rather than requiring you to know the values for
"Request" and "Response".
Make "dissect_rpc()" static, as it's called only through a heuristic
dissector list.
Use "col_set_str()" to set the COL_PROTOCOL column for RPC protocols;
the string used is from a table provided by the dissector, and is a
string constant.
Don't format the Info column for WSP into a buffer and then format that
buffer into the column with "%s" - "col_add_fstr()" can do the
formatting for you, without having to allocate your own buffer (or run
through the *printf machinery twice).
Don't fetch fields from the WTP packet until you're ready to use them,
so that you don't throw an exception before you even set the Protocol
column or clear the Info column.
Use "pinfo->destport", not "pi.destport", in the Zebra dissector when
checking whether the packet is a request or reply, and do the check by
comparing with "pinfo->match_port" rather than TCP_PORT_ZEBRA (so that
if the dissector is ever registered on another port, it still correctly
determines whether the packet is a request or reply - the Network
Monitor HTTP dissector has port 80 wired into its brain, which is a bit
irritating if you're trying to get it to dissect HTTP proxy traffic on
port 3128 or proxy administration UI traffic on port 3132).
svn path=/trunk/; revision=2931
2001-01-22 08:03:46 +00:00
|
|
|
val_to_str(rip6.rip6_cmd, cmdvals, "Unknown command (%u)"));
|
1999-10-12 23:12:06 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2001-04-24 02:50:00 +00:00
|
|
|
ti = proto_tree_add_item(tree, proto_ripng, tvb, offset,
|
|
|
|
tvb_length_remaining(tvb, offset), FALSE);
|
1999-11-16 11:44:20 +00:00
|
|
|
ripng_tree = proto_item_add_subtree(ti, ett_ripng);
|
1999-10-12 23:12:06 +00:00
|
|
|
|
2001-04-24 02:50:00 +00:00
|
|
|
proto_tree_add_uint(ripng_tree, hf_ripng_cmd, tvb, offset, 1,
|
Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="
statements.
Move the setting of the Protocol column in various dissectors before
anything is fetched from the packet, and also clear the Info column at
that point in those and some other dissectors, so that if an exception
is thrown, the columns don't reflect the previous protocol.
Don't use
col_add_fstr(..., "%s", string);
Use
col_add_str(..., string);
as it does the same thing, but doesn't drag all the heavy *printf
machinery in.
Fix the DDTP dissector to set the Info column regardless of whether
we're building a protocol tree or not, and to set it to "Encrypted
payload" if the payload is encrypted. Also fix a typo in a field name.
Register the FTP data dissector as being associated with the FTP data
protocol, not the FTP protocol (the removed "CHECK_DISPLAY_AS_DATA()"
call checked "proto_ftp_data", and the removed "pinfo->current_proto ="
line set it to "FTP-DATA", so it should be associated with
"proto_ftp_data").
Make the H1 dissector check whether the frame has at least 2 bytes in it
before checking the first two bytes; heuristic dissectors must not throw
exceptions until they've accepted the packet as one of theirs.
Use "tvb_format_text()" rather than "tvb_get_ptr()" and "format_text()"
in some dissectors where the result of "tvb_get_ptr()" is used only in
the "format_text()" call.
In the Quake dissector, don't check whether there are at least 4 bytes
in the packet - if we return, the packet won't be dissected at all (it's
not as if some other dissector will get to handle it), and, if we don't
return, we'll throw an exception if there aren't at least 4 bytes in the
packet, so the packet will be marked as short or malformed, as
appropriate.
In the RIPng dissector, associate the table of strings for the command
field with the command field, so that the dissector doesn't have to
format the string for the protocol tree entry itself, and so that the
filter construction dialog box can let you select "Request" or
"Response" from a list rather than requiring you to know the values for
"Request" and "Response".
Make "dissect_rpc()" static, as it's called only through a heuristic
dissector list.
Use "col_set_str()" to set the COL_PROTOCOL column for RPC protocols;
the string used is from a table provided by the dissector, and is a
string constant.
Don't format the Info column for WSP into a buffer and then format that
buffer into the column with "%s" - "col_add_fstr()" can do the
formatting for you, without having to allocate your own buffer (or run
through the *printf machinery twice).
Don't fetch fields from the WTP packet until you're ready to use them,
so that you don't throw an exception before you even set the Protocol
column or clear the Info column.
Use "pinfo->destport", not "pi.destport", in the Zebra dissector when
checking whether the packet is a request or reply, and do the check by
comparing with "pinfo->match_port" rather than TCP_PORT_ZEBRA (so that
if the dissector is ever registered on another port, it still correctly
determines whether the packet is a request or reply - the Network
Monitor HTTP dissector has port 80 wired into its brain, which is a bit
irritating if you're trying to get it to dissect HTTP proxy traffic on
port 3128 or proxy administration UI traffic on port 3132).
svn path=/trunk/; revision=2931
2001-01-22 08:03:46 +00:00
|
|
|
rip6.rip6_cmd);
|
2001-04-24 02:50:00 +00:00
|
|
|
proto_tree_add_uint(ripng_tree, hf_ripng_version, tvb, offset + 1, 1,
|
1999-10-15 13:21:14 +00:00
|
|
|
rip6.rip6_vers);
|
1999-10-12 23:12:06 +00:00
|
|
|
|
|
|
|
offset += 4;
|
2001-04-24 02:50:00 +00:00
|
|
|
while (tvb_reported_length_remaining(tvb, offset) > 0) {
|
|
|
|
tvb_memcpy(tvb, (guint8 *)&ni6, offset, sizeof(ni6));
|
2000-05-17 04:09:32 +00:00
|
|
|
if (ni6.rip6_tag) {
|
2001-04-24 02:50:00 +00:00
|
|
|
ti = proto_tree_add_text(ripng_tree, tvb, offset,
|
2000-05-17 04:09:32 +00:00
|
|
|
sizeof(ni6), "IP Address: %s/%u, Metric: %u, tag: 0x%04x",
|
|
|
|
ip6_to_str(&ni6.rip6_dest),
|
|
|
|
ni6.rip6_plen,
|
|
|
|
ni6.rip6_metric,
|
|
|
|
ntohs(ni6.rip6_tag));
|
|
|
|
} else {
|
2001-04-24 02:50:00 +00:00
|
|
|
ti = proto_tree_add_text(ripng_tree, tvb, offset,
|
2000-05-17 04:09:32 +00:00
|
|
|
sizeof(ni6), "IP Address: %s/%u, Metric: %u",
|
|
|
|
ip6_to_str(&ni6.rip6_dest),
|
|
|
|
ni6.rip6_plen,
|
|
|
|
ni6.rip6_metric);
|
|
|
|
}
|
|
|
|
subtree = proto_item_add_subtree(ti, ett_ripng_addr);
|
2001-04-24 02:50:00 +00:00
|
|
|
proto_tree_add_text(subtree, tvb,
|
2000-05-17 04:09:32 +00:00
|
|
|
offset + offsetof(struct netinfo6, rip6_dest),
|
|
|
|
sizeof(ni6.rip6_dest), "IP Address: %s",
|
|
|
|
ip6_to_str(&ni6.rip6_dest));
|
2001-04-24 02:50:00 +00:00
|
|
|
proto_tree_add_text(subtree, tvb,
|
2000-05-17 04:09:32 +00:00
|
|
|
offset + offsetof(struct netinfo6, rip6_tag),
|
|
|
|
sizeof(ni6.rip6_tag), "Tag: 0x%04x",
|
1999-10-12 23:12:06 +00:00
|
|
|
ntohs(ni6.rip6_tag));
|
2001-04-24 02:50:00 +00:00
|
|
|
proto_tree_add_text(subtree, tvb,
|
2000-05-17 04:09:32 +00:00
|
|
|
offset + offsetof(struct netinfo6, rip6_plen),
|
|
|
|
sizeof(ni6.rip6_plen), "Prefix length: %u",
|
|
|
|
ni6.rip6_plen);
|
2001-04-24 02:50:00 +00:00
|
|
|
proto_tree_add_text(subtree, tvb,
|
2000-05-17 04:09:32 +00:00
|
|
|
offset + offsetof(struct netinfo6, rip6_metric),
|
|
|
|
sizeof(ni6.rip6_metric), "Metric: %u",
|
1999-10-12 23:12:06 +00:00
|
|
|
ni6.rip6_metric);
|
2000-05-17 04:09:32 +00:00
|
|
|
|
|
|
|
offset += sizeof(ni6);
|
|
|
|
}
|
1999-10-12 23:12:06 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_register_ripng(void)
|
|
|
|
{
|
1999-10-15 13:21:14 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_ripng_cmd,
|
|
|
|
{ "Command", "ripng.cmd",
|
Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="
statements.
Move the setting of the Protocol column in various dissectors before
anything is fetched from the packet, and also clear the Info column at
that point in those and some other dissectors, so that if an exception
is thrown, the columns don't reflect the previous protocol.
Don't use
col_add_fstr(..., "%s", string);
Use
col_add_str(..., string);
as it does the same thing, but doesn't drag all the heavy *printf
machinery in.
Fix the DDTP dissector to set the Info column regardless of whether
we're building a protocol tree or not, and to set it to "Encrypted
payload" if the payload is encrypted. Also fix a typo in a field name.
Register the FTP data dissector as being associated with the FTP data
protocol, not the FTP protocol (the removed "CHECK_DISPLAY_AS_DATA()"
call checked "proto_ftp_data", and the removed "pinfo->current_proto ="
line set it to "FTP-DATA", so it should be associated with
"proto_ftp_data").
Make the H1 dissector check whether the frame has at least 2 bytes in it
before checking the first two bytes; heuristic dissectors must not throw
exceptions until they've accepted the packet as one of theirs.
Use "tvb_format_text()" rather than "tvb_get_ptr()" and "format_text()"
in some dissectors where the result of "tvb_get_ptr()" is used only in
the "format_text()" call.
In the Quake dissector, don't check whether there are at least 4 bytes
in the packet - if we return, the packet won't be dissected at all (it's
not as if some other dissector will get to handle it), and, if we don't
return, we'll throw an exception if there aren't at least 4 bytes in the
packet, so the packet will be marked as short or malformed, as
appropriate.
In the RIPng dissector, associate the table of strings for the command
field with the command field, so that the dissector doesn't have to
format the string for the protocol tree entry itself, and so that the
filter construction dialog box can let you select "Request" or
"Response" from a list rather than requiring you to know the values for
"Request" and "Response".
Make "dissect_rpc()" static, as it's called only through a heuristic
dissector list.
Use "col_set_str()" to set the COL_PROTOCOL column for RPC protocols;
the string used is from a table provided by the dissector, and is a
string constant.
Don't format the Info column for WSP into a buffer and then format that
buffer into the column with "%s" - "col_add_fstr()" can do the
formatting for you, without having to allocate your own buffer (or run
through the *printf machinery twice).
Don't fetch fields from the WTP packet until you're ready to use them,
so that you don't throw an exception before you even set the Protocol
column or clear the Info column.
Use "pinfo->destport", not "pi.destport", in the Zebra dissector when
checking whether the packet is a request or reply, and do the check by
comparing with "pinfo->match_port" rather than TCP_PORT_ZEBRA (so that
if the dissector is ever registered on another port, it still correctly
determines whether the packet is a request or reply - the Network
Monitor HTTP dissector has port 80 wired into its brain, which is a bit
irritating if you're trying to get it to dissect HTTP proxy traffic on
port 3128 or proxy administration UI traffic on port 3132).
svn path=/trunk/; revision=2931
2001-01-22 08:03:46 +00:00
|
|
|
FT_UINT8, BASE_DEC, VALS(cmdvals),
|
|
|
|
0x0, "" }},
|
1999-10-15 13:21:14 +00:00
|
|
|
{ &hf_ripng_version,
|
|
|
|
{ "Version", "ripng.version",
|
Remove more "CHECK_DISPLAY_AS_DATA()" calls and "pinfo->current_proto ="
statements.
Move the setting of the Protocol column in various dissectors before
anything is fetched from the packet, and also clear the Info column at
that point in those and some other dissectors, so that if an exception
is thrown, the columns don't reflect the previous protocol.
Don't use
col_add_fstr(..., "%s", string);
Use
col_add_str(..., string);
as it does the same thing, but doesn't drag all the heavy *printf
machinery in.
Fix the DDTP dissector to set the Info column regardless of whether
we're building a protocol tree or not, and to set it to "Encrypted
payload" if the payload is encrypted. Also fix a typo in a field name.
Register the FTP data dissector as being associated with the FTP data
protocol, not the FTP protocol (the removed "CHECK_DISPLAY_AS_DATA()"
call checked "proto_ftp_data", and the removed "pinfo->current_proto ="
line set it to "FTP-DATA", so it should be associated with
"proto_ftp_data").
Make the H1 dissector check whether the frame has at least 2 bytes in it
before checking the first two bytes; heuristic dissectors must not throw
exceptions until they've accepted the packet as one of theirs.
Use "tvb_format_text()" rather than "tvb_get_ptr()" and "format_text()"
in some dissectors where the result of "tvb_get_ptr()" is used only in
the "format_text()" call.
In the Quake dissector, don't check whether there are at least 4 bytes
in the packet - if we return, the packet won't be dissected at all (it's
not as if some other dissector will get to handle it), and, if we don't
return, we'll throw an exception if there aren't at least 4 bytes in the
packet, so the packet will be marked as short or malformed, as
appropriate.
In the RIPng dissector, associate the table of strings for the command
field with the command field, so that the dissector doesn't have to
format the string for the protocol tree entry itself, and so that the
filter construction dialog box can let you select "Request" or
"Response" from a list rather than requiring you to know the values for
"Request" and "Response".
Make "dissect_rpc()" static, as it's called only through a heuristic
dissector list.
Use "col_set_str()" to set the COL_PROTOCOL column for RPC protocols;
the string used is from a table provided by the dissector, and is a
string constant.
Don't format the Info column for WSP into a buffer and then format that
buffer into the column with "%s" - "col_add_fstr()" can do the
formatting for you, without having to allocate your own buffer (or run
through the *printf machinery twice).
Don't fetch fields from the WTP packet until you're ready to use them,
so that you don't throw an exception before you even set the Protocol
column or clear the Info column.
Use "pinfo->destport", not "pi.destport", in the Zebra dissector when
checking whether the packet is a request or reply, and do the check by
comparing with "pinfo->match_port" rather than TCP_PORT_ZEBRA (so that
if the dissector is ever registered on another port, it still correctly
determines whether the packet is a request or reply - the Network
Monitor HTTP dissector has port 80 wired into its brain, which is a bit
irritating if you're trying to get it to dissect HTTP proxy traffic on
port 3128 or proxy administration UI traffic on port 3132).
svn path=/trunk/; revision=2931
2001-01-22 08:03:46 +00:00
|
|
|
FT_UINT8, BASE_DEC, NULL,
|
|
|
|
0x0, "" }},
|
1999-10-15 13:21:14 +00:00
|
|
|
};
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_ripng,
|
|
|
|
&ett_ripng_addr,
|
|
|
|
};
|
1999-10-15 13:21:14 +00:00
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_ripng = proto_register_protocol("RIPng", "RIPng", "ripng");
|
1999-10-15 13:21:14 +00:00
|
|
|
proto_register_field_array(proto_ripng, hf, array_length(hf));
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
1999-10-12 23:12:06 +00:00
|
|
|
}
|
2000-04-08 07:07:42 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_ripng(void)
|
|
|
|
{
|
2001-04-24 02:50:00 +00:00
|
|
|
dissector_add("udp.port", UDP_PORT_RIPNG, dissect_ripng, proto_ripng);
|
2000-04-08 07:07:42 +00:00
|
|
|
}
|