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).
This commit is contained in:
David Greenman 1994-02-10 09:17:57 +00:00
parent 43ef94a93a
commit 0e92dae903
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=1140

View File

@ -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 <sys/param.h>
@ -33,13 +33,39 @@ static char rcsid[] =
#include <netinet/ip_var.h>
#include <netinet/udp.h>
#include <netinet/udp_var.h>
#include <protocols/routed.h>
#include <errno.h>
#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;