From 0e92dae9030b0aa8087b441d8fbfe2488464f8ad Mon Sep 17 00:00:00 2001 From: David Greenman Date: Thu, 10 Feb 1994 09:17:57 +0000 Subject: [PATCH] Fixed bug in decoding of RIP packets. RIP data is in "osockaddr" format; the fix is to import the structures from protocols/routed.h and change the sockaddr to osockaddr. We can't change the generic include file because too many other things rely on this in order to deal with the kernel routing socket (which is sockaddr format). --- usr.sbin/tcpdump/tcpdump/print-rip.c | 30 ++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/usr.sbin/tcpdump/tcpdump/print-rip.c b/usr.sbin/tcpdump/tcpdump/print-rip.c index d123fe9a48bb..a824ce64a93f 100644 --- a/usr.sbin/tcpdump/tcpdump/print-rip.c +++ b/usr.sbin/tcpdump/tcpdump/print-rip.c @@ -21,7 +21,7 @@ #ifndef lint static char rcsid[] = - "@(#) $Header: print-rip.c,v 1.12 91/04/19 10:46:46 mccanne Exp $ (LBL)"; + "@(#) $Header: /a/cvs/386BSD/src/contrib/tcpdump/tcpdump/print-rip.c,v 1.1.1.1 1993/06/12 14:42:07 rgrimes Exp $ (LBL)"; #endif #include @@ -33,13 +33,39 @@ static char rcsid[] = #include #include #include -#include #include #include "interface.h" #include "addrtoname.h" +#define RIPVERSION 1 + +struct netinfo { + struct osockaddr rip_dst; /* destination net/host */ + int rip_metric; /* cost of route */ +}; + +struct rip { + u_char rip_cmd; /* request/response */ + u_char rip_vers; /* protocol version # */ + u_char rip_res1[2]; /* pad to 32-bit boundary */ + union { + struct netinfo ru_nets[1]; /* variable length... */ + char ru_tracefile[1]; /* ditto ... */ + } ripun; +#define rip_nets ripun.ru_nets +#define rip_tracefile ripun.ru_tracefile +}; + +/* + * Packet types. + */ +#define RIPCMD_REQUEST 1 /* want info */ +#define RIPCMD_RESPONSE 2 /* responding to request */ +#define RIPCMD_TRACEON 3 /* turn tracing on */ +#define RIPCMD_TRACEOFF 4 /* turn it off */ + static void rip_entry_print(ni) register struct netinfo *ni;