diff options
author | bms <bms@FreeBSD.org> | 2004-03-31 09:17:26 +0000 |
---|---|---|
committer | bms <bms@FreeBSD.org> | 2004-03-31 09:17:26 +0000 |
commit | 68fb152d91dbfeda2f1ab052c6c78cdc5d236344 (patch) | |
tree | 4be69f3369458972eebdcf559e348ee0518cec4f /contrib/tcpdump/print-ripng.c | |
parent | 723e16349061e4b947ce1e5be04cdf68e1441b71 (diff) | |
parent | 281e9d71408deb6e8c5046c746c2e97002b0e7fe (diff) | |
download | FreeBSD-src-68fb152d91dbfeda2f1ab052c6c78cdc5d236344.zip FreeBSD-src-68fb152d91dbfeda2f1ab052c6c78cdc5d236344.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r127668,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'contrib/tcpdump/print-ripng.c')
-rw-r--r-- | contrib/tcpdump/print-ripng.c | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/contrib/tcpdump/print-ripng.c b/contrib/tcpdump/print-ripng.c index ad6d3f8..3432207 100644 --- a/contrib/tcpdump/print-ripng.c +++ b/contrib/tcpdump/print-ripng.c @@ -20,8 +20,8 @@ */ #ifndef lint -static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-ripng.c,v 1.10 2001/11/16 08:59:22 itojun Exp $"; +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/print-ripng.c,v 1.15.2.2 2003/11/16 08:51:42 guy Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -30,19 +30,29 @@ static const char rcsid[] = #ifdef INET6 -#include <sys/param.h> -#include <sys/time.h> -#include <sys/types.h> -#include <sys/socket.h> +#include <tcpdump-stdinc.h> -#include <netinet/in.h> +#ifdef WIN32 +const struct in6_addr in6addr_any; /* :: */ +#endif /* WIN32 */ + +#ifdef __MINGW32__ +int +IN6_ADDR_EQUAL(const struct in6_addr *a, const struct in6_addr *b) +{ + return (memcmp(a, b, sizeof(struct in6_addr)) == 0); +} + +#define IN6_IS_ADDR_UNSPECIFIED(a) IN6_ADDR_EQUAL((a), &in6addr_any) + +#endif /* __MINGW32__ */ -#include <errno.h> #include <stdio.h> #include "route6d.h" #include "interface.h" #include "addrtoname.h" +#include "extract.h" static int rip6_entry_print(register const struct netinfo6 *ni, int metric) @@ -50,7 +60,7 @@ rip6_entry_print(register const struct netinfo6 *ni, int metric) int l; l = printf("%s/%d", ip6addr_string(&ni->rip6_dest), ni->rip6_plen); if (ni->rip6_tag) - l += printf(" [%d]", ntohs(ni->rip6_tag)); + l += printf(" [%d]", EXTRACT_16BITS(&ni->rip6_tag)); if (metric) l += printf(" (%d)", ni->rip6_metric); return l; @@ -61,14 +71,18 @@ ripng_print(const u_char *dat, unsigned int length) { register const struct rip6 *rp = (struct rip6 *)dat; register const struct netinfo6 *ni; - register int amt = snapend - dat; - register int i = min(length, amt) - - (sizeof(struct rip6) - sizeof(struct netinfo6)); + register u_int amt; + register u_int i; int j; int trunc; - if (i < 0) + if (snapend < dat) + return; + amt = snapend - dat; + i = min(length, amt); + if (i < (sizeof(struct rip6) - sizeof(struct netinfo6))) return; + i -= (sizeof(struct rip6) - sizeof(struct netinfo6)); switch (rp->rip6_cmd) { @@ -85,7 +99,8 @@ ripng_print(const u_char *dat, unsigned int length) else printf(" ripng-req %d:", j); trunc = ((i / sizeof(*ni)) * sizeof(*ni) != i); - for (ni = rp->rip6_nets; (i -= sizeof(*ni)) >= 0; ++ni) { + for (ni = rp->rip6_nets; i >= sizeof(*ni); + i -= sizeof(*ni), ++ni) { if (vflag > 1) printf("\n\t"); else @@ -100,7 +115,8 @@ ripng_print(const u_char *dat, unsigned int length) else printf(" ripng-resp %d:", j); trunc = ((i / sizeof(*ni)) * sizeof(*ni) != i); - for (ni = rp->rip6_nets; (i -= sizeof(*ni)) >= 0; ++ni) { + for (ni = rp->rip6_nets; i >= sizeof(*ni); + i -= sizeof(*ni), ++ni) { if (vflag > 1) printf("\n\t"); else |