diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-09-17 14:56:44 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-09-17 14:56:44 -0700 |
commit | 11f73ad248fa22461ca040baa8dc94b864509efa (patch) | |
tree | 5a0e2679a78a1dfbe2388b4bf2d55490a38ef989 /print-gre.c | |
parent | 2a85a1bba4c2e63094a259c5d0ed397f234ba5f3 (diff) | |
download | tcpdump-11f73ad248fa22461ca040baa8dc94b864509efa.tar.gz |
Don't require IPv6 library support in order to support IPv6 addresses.
Have our own routines to convert between IPv4/IPv6 addresses and
strings; that helps if, for example, we want to build binary versions of
tcpdump for Windows that can run both on NT 5 (W2K/WXP), which doesn't
have inet_ntop() or inet_pton(), and NT 6 (Vista/7/8/10), which do. It
also means that we don't require IPv6 library support on UN*X to print
addresses (if somebody wants to build tcpdump for older UN*Xes lacking
IPv6 support in the system library or in add-on libraries).
Get rid of files in the missing directory that we don't need, and
various no-longer-necessary autoconf tests.
Diffstat (limited to 'print-gre.c')
-rw-r--r-- | print-gre.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/print-gre.c b/print-gre.c index 89cbe076..187a5b9f 100644 --- a/print-gre.c +++ b/print-gre.c @@ -45,6 +45,7 @@ #include <string.h> #include "netdissect.h" +#include "addrtostr.h" #include "extract.h" #include "ethertype.h" @@ -330,8 +331,8 @@ static void gre_sre_ip_print(netdissect_options *ndo, uint8_t sreoff, uint8_t srelen, const u_char *bp, u_int len) { - struct in_addr a; const u_char *up = bp; + char buf[INET_ADDRSTRLEN]; if (sreoff & 3) { ND_PRINT((ndo, ", badoffset=%u", sreoff)); @@ -350,10 +351,9 @@ gre_sre_ip_print(netdissect_options *ndo, uint8_t sreoff, uint8_t srelen, if (len < 4 || srelen == 0) return; - memcpy(&a, bp, sizeof(a)); + addrtostr(bp, buf, sizeof(buf)); ND_PRINT((ndo, " %s%s", - ((bp - up) == sreoff) ? "*" : "", - inet_ntoa(a))); + ((bp - up) == sreoff) ? "*" : "", buf)); bp += 4; len -= 4; |