RFC 1058, on RIP V1, says:

Specific queries and debugging requests may be sent from ports
	other than 520, but they are directed to port 520 on the target
	machine.

and RFC 2453, on RIP V2, says:

	Specific queries may be sent from ports other than the RIP port,
	but they must be directed to the RIP port on the target machine.

so there is no requirement that RIP packets have 520 as both source and
destination port numbers.  It's therefore OK to register it as the
dissector for UDP port 520 - no need to handle it specially in the UDP
dissector as a reminder to make it check both source and destination
ports - so we do so.

svn path=/trunk/; revision=1855
This commit is contained in:
Guy Harris 2000-04-14 06:17:23 +00:00
parent 61167a3c28
commit d419701eea
3 changed files with 13 additions and 11 deletions

View File

@ -2,7 +2,7 @@
* Routines for RIPv1 and RIPv2 packet disassembly
* (c) Copyright Hannes R. Boehm <hannes@boehm.org>
*
* $Id: packet-rip.c,v 1.13 1999/11/16 11:42:50 guy Exp $
* $Id: packet-rip.c,v 1.14 2000/04/14 06:17:23 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -38,6 +38,8 @@
#include "packet.h"
#include "packet-rip.h"
#define UDP_PORT_RIP 520
static int proto_rip = -1;
static gint ett_rip = -1;
@ -48,7 +50,7 @@ static void dissect_ip_rip_vektor(guint8 version,
static void dissect_rip_authentication(const e_rip_authentication *rip_authentication,
int offset, proto_tree *tree);
void
static void
dissect_rip(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
e_riphdr rip_header;
e_rip_entry rip_entry;
@ -196,3 +198,9 @@ proto_register_rip(void)
/* proto_register_field_array(proto_rip, hf, array_length(hf));*/
proto_register_subtree_array(ett, array_length(ett));
}
void
proto_reg_handoff_rip(void)
{
dissector_add("udp.port", UDP_PORT_RIP, dissect_rip);
}

View File

@ -1,6 +1,6 @@
/* packet-rip.h (c) 1998 Hannes Boehm */
/* $Id: packet-rip.h,v 1.4 2000/02/15 21:02:59 gram Exp $ */
/* $Id: packet-rip.h,v 1.5 2000/04/14 06:17:23 guy Exp $ */
#define RIPv1 1
#define RIPv2 2
@ -33,5 +33,3 @@ typedef union _e_rip_entry {
e_rip_vektor vektor;
e_rip_authentication authentication;
} e_rip_entry;
void dissect_rip(const u_char *, int, frame_data *, proto_tree *);

View File

@ -1,7 +1,7 @@
/* packet-udp.c
* Routines for UDP packet disassembly
*
* $Id: packet-udp.c,v 1.62 2000/04/14 05:39:43 gram Exp $
* $Id: packet-udp.c,v 1.63 2000/04/14 06:17:22 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -74,7 +74,6 @@ typedef struct _e_udphdr {
/* UDP Ports -> should go in packet-udp.h */
#define UDP_PORT_TFTP 69
#define UDP_PORT_RIP 520
#define UDP_PORT_NCP 524
#define UDP_PORT_VINES 573
#define UDP_PORT_RX_LOW 7000
@ -131,10 +130,7 @@ decode_udp_ports( const u_char *pd, int offset, frame_data *fd,
/* XXX - we should do all of this through the table of ports. */
#define PORT_IS(port) (uh_sport == port || uh_dport == port)
if (PORT_IS(UDP_PORT_RIP)) {
/* we should check the source port too (RIP: UDP src and dst port 520) */
dissect_rip(pd, offset, fd, tree);
} else if (PORT_IS(UDP_PORT_NCP))
if (PORT_IS(UDP_PORT_NCP))
dissect_ncp(pd, offset, fd, tree); /* XXX -- need to handle nw_server_address */
else if ((uh_sport >= UDP_PORT_RX_LOW && uh_sport <= UDP_PORT_RX_HIGH) ||
(uh_dport >= UDP_PORT_RX_LOW && uh_dport <= UDP_PORT_RX_HIGH) ||