#endif
#include "ip.h"
-#ifdef INET6
#include "ip6.h"
-#endif
#include "netdissect.h"
+#include "strtoaddr.h"
#include "extract.h"
#include "ascii_strcasecmp.h"
#ifdef HAVE_LIBCRYPTO
union inaddr_u {
struct in_addr in4;
-#ifdef INET6
struct in6_addr in6;
-#endif
};
struct sa_list {
struct sa_list *next;
sa1.spi = spino;
-#ifdef INET6
- if (inet_pton(AF_INET6, spikey, &sa1.daddr.in6) == 1) {
+ if (strtoaddr6(spikey, &sa1.daddr.in6) == 1) {
sa1.daddr_version = 6;
- } else
-#endif
- if (inet_pton(AF_INET, spikey, &sa1.daddr.in4) == 1) {
- sa1.daddr_version = 4;
- } else {
- (*ndo->ndo_warning)(ndo, "print_esp: can not decode IP# %s\n", spikey);
- return;
- }
+ } else if (strtoaddr(spikey, &sa1.daddr.in4) == 1) {
+ sa1.daddr_version = 4;
+ } else {
+ (*ndo->ndo_warning)(ndo, "print_esp: can not decode IP# %s\n", spikey);
+ return;
+ }
}
if (decode) {
#ifdef HAVE_LIBCRYPTO
const struct ip *ip;
struct sa_list *sa = NULL;
-#ifdef INET6
const struct ip6_hdr *ip6 = NULL;
-#endif
int advance;
int len;
u_char *secret;
ip = (const struct ip *)bp2;
switch (IP_V(ip)) {
-#ifdef INET6
case 6:
ip6 = (const struct ip6_hdr *)bp2;
/* we do not attempt to decrypt jumbograms */
}
}
break;
-#endif /*INET6*/
case 4:
/* nexthdr & padding are in the last fragment */
if (EXTRACT_16BITS(&ip->ip_off) & IP_MF)