/* specification: RFC 2407, RFC 2408, RFC 5996 */
#ifdef HAVE_CONFIG_H
-#include "config.h"
+#include <config.h>
#endif
/* The functions from print-esp.c used in this file are only defined when both
#undef HAVE_LIBCRYPTO
#endif
-#include <netdissect-stdinc.h>
+#include "netdissect-stdinc.h"
#include <string.h>
static int
iszero(const u_char *p, size_t l)
{
- while (l--) {
- if (*p++)
+ while (l != 0) {
+ if (*p)
return 0;
+ p++;
+ l--;
}
return 1;
}
switch (IP_V(ip)) {
case 4:
cookiecache[ninitiator].version = 4;
- UNALIGNED_MEMCPY(&cookiecache[ninitiator].iaddr.in4, &ip->ip_src, sizeof(struct in_addr));
- UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in4, &ip->ip_dst, sizeof(struct in_addr));
+ UNALIGNED_MEMCPY(&cookiecache[ninitiator].iaddr.in4,
+ ip->ip_src, sizeof(nd_ipv4));
+ UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in4,
+ ip->ip_dst, sizeof(nd_ipv4));
break;
case 6:
ip6 = (const struct ip6_hdr *)bp2;
cookiecache[ninitiator].version = 6;
- UNALIGNED_MEMCPY(&cookiecache[ninitiator].iaddr.in6, &ip6->ip6_src, sizeof(struct in6_addr));
- UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in6, &ip6->ip6_dst, sizeof(struct in6_addr));
+ UNALIGNED_MEMCPY(&cookiecache[ninitiator].iaddr.in6,
+ ip6->ip6_src, sizeof(nd_ipv6));
+ UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in6,
+ ip6->ip6_dst, sizeof(nd_ipv6));
break;
default:
return;
if (cookiecache[i].version != 4)
return 0;
if (initiator) {
- if (UNALIGNED_MEMCMP(&ip->ip_src, &cookiecache[i].iaddr.in4, sizeof(struct in_addr)) == 0)
+ if (UNALIGNED_MEMCMP(ip->ip_src, &cookiecache[i].iaddr.in4, sizeof(nd_ipv4)) == 0)
return 1;
} else {
- if (UNALIGNED_MEMCMP(&ip->ip_src, &cookiecache[i].raddr.in4, sizeof(struct in_addr)) == 0)
+ if (UNALIGNED_MEMCMP(ip->ip_src, &cookiecache[i].raddr.in4, sizeof(nd_ipv4)) == 0)
return 1;
}
break;
return 0;
ip6 = (const struct ip6_hdr *)bp2;
if (initiator) {
- if (UNALIGNED_MEMCMP(&ip6->ip6_src, &cookiecache[i].iaddr.in6, sizeof(struct in6_addr)) == 0)
+ if (UNALIGNED_MEMCMP(ip6->ip6_src, &cookiecache[i].iaddr.in6, sizeof(nd_ipv6)) == 0)
return 1;
} else {
- if (UNALIGNED_MEMCMP(&ip6->ip6_src, &cookiecache[i].raddr.in6, sizeof(struct in6_addr)) == 0)
+ if (UNALIGNED_MEMCMP(ip6->ip6_src, &cookiecache[i].raddr.in6, sizeof(nd_ipv6)) == 0)
return 1;
}
break;
u_int i;
ND_PRINT(" len=%u ", len);
for (i = 0; i < len; i++)
- safeputchar(ndo, EXTRACT_U_1(data + i));
+ fn_print_char(ndo, EXTRACT_U_1(data + i));
len = 0;
break;
}
if (len < 8)
ND_PRINT(" len=%u [bad: < 8]", len);
else {
- mask = data + sizeof(struct in_addr);
+ mask = data + sizeof(nd_ipv4);
ND_PRINT(" len=%u %s/%u.%u.%u.%u", len,
ipaddr_string(ndo, data),
EXTRACT_U_1(mask), EXTRACT_U_1(mask + 1),
if (len < 32)
ND_PRINT(" len=%u [bad: < 32]", len);
else {
- mask = (const u_char *)(data + sizeof(struct in6_addr));
+ mask = (const u_char *)(data + sizeof(nd_ipv6));
/*XXX*/
ND_PRINT(" len=%u %s/0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", len,
ip6addr_string(ndo, data),
else {
ND_PRINT(" len=%u %s-%s", len,
ipaddr_string(ndo, data),
- ipaddr_string(ndo, data + sizeof(struct in_addr)));
+ ipaddr_string(ndo, data + sizeof(nd_ipv4)));
}
len = 0;
break;
else {
ND_PRINT(" len=%u %s-%s", len,
ip6addr_string(ndo, data),
- ip6addr_string(ndo, data + sizeof(struct in6_addr)));
+ ip6addr_string(ndo, data + sizeof(nd_ipv6)));
}
len = 0;
break;
int depth)
{
const u_char *dat;
- volatile u_int dlen;
+ u_int dlen;
#ifdef HAVE_LIBCRYPTO
uint8_t np;
#endif
return cp;
trunc:
- ND_PRINT(" [|isakmp]");
+ nd_print_trunc(ndo);
return NULL;
}
numstr(u_int x)
{
static char buf[20];
- snprintf(buf, sizeof(buf), "#%u", x);
+ nd_snprintf(buf, sizeof(buf), "#%u", x);
return buf;
}
return cp;
trunc:
- ND_PRINT(" [|isakmp]");
+ nd_print_trunc(ndo);
return NULL;
}
const u_char *ep;
u_int major, minor;
+ ndo->ndo_protocol = "isakmp";
#ifdef HAVE_LIBCRYPTO
/* initialize SAs */
if (ndo->ndo_sa_list_head == NULL) {
ep = ndo->ndo_snapend;
if ((const struct isakmp *)ep < p + 1) {
- ND_PRINT("[|isakmp]");
+ nd_print_trunc(ndo);
return;
}
const u_char *bp, u_int length,
const u_char *bp2)
{
+ ndo->ndo_protocol = "isakmp_rfc3948";
ND_TCHECK_1(bp);
if(length == 1 && EXTRACT_U_1(bp)==0xff) {
ND_PRINT("isakmp-nat-keep-alive");
length -= advance + padlen;
nh = enh & 0xff;
- ip_print_inner(ndo, bp, length, nh, bp2);
+ ip_inner_print(ndo, bp, length, nh, bp2);
return;
}
trunc:
- ND_PRINT("[|isakmp]");
+ nd_print_trunc(ndo);
return;
}
-
-/*
- * Local Variables:
- * c-style: whitesmith
- * c-basic-offset: 8
- * End:
- */