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(struct in_addr));
+ UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in4, &ip->ip_dst, sizeof(struct in_addr));
break;
#ifdef INET6
case 6:
ip6 = (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(struct in6_addr));
+ UNALIGNED_MEMCPY(&cookiecache[ninitiator].raddr.in6, &ip6->ip6_dst, sizeof(struct in6_addr));
break;
#endif
default:
return;
}
- unaligned_memcpy(&cookiecache[ninitiator].initiator, in, sizeof(*in));
+ UNALIGNED_MEMCPY(&cookiecache[ninitiator].initiator, in, sizeof(*in));
ninitiator = (ninitiator + 1) % MAXINITIATORS;
}
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(struct in_addr)) == 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(struct in_addr)) == 0)
return 1;
}
break;
return 0;
ip6 = (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(struct in6_addr)) == 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(struct in6_addr)) == 0)
return 1;
}
break;
p = (struct ikev1_pl_sa *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&sa, ext, sizeof(sa));
+ UNALIGNED_MEMCPY(&sa, ext, sizeof(sa));
doi = ntohl(sa.doi);
sit = ntohl(sa.sit);
if (doi != 1) {
np = (u_char *)ext + sizeof(sa);
if (sit != 0x01) {
ND_TCHECK2(*(ext + 1), sizeof(ident));
- unaligned_memcpy(&ident, ext + 1, sizeof(ident));
+ UNALIGNED_MEMCPY(&ident, ext + 1, sizeof(ident));
ND_PRINT((ndo," ident=%u", (u_int32_t)ntohl(ident)));
np += sizeof(ident);
}
p = (struct ikev1_pl_p *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&prop, ext, sizeof(prop));
+ UNALIGNED_MEMCPY(&prop, ext, sizeof(prop));
ND_PRINT((ndo," #%d protoid=%s transform=%d",
prop.p_no, PROTOIDSTR(prop.prot_id), prop.num_t));
if (prop.spi_size) {
p = (struct ikev1_pl_t *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&t, ext, sizeof(t));
+ UNALIGNED_MEMCPY(&t, ext, sizeof(t));
switch (proto) {
case 1:
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_KE)));
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ND_PRINT((ndo," key len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
p = (struct ikev1_pl_id *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&id, ext, sizeof(id));
+ UNALIGNED_MEMCPY(&id, ext, sizeof(id));
if (sizeof(*p) < item_len) {
data = (u_char *)(p + 1);
len = item_len - sizeof(*p);
p = (struct ipsecdoi_id *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&id, ext, sizeof(id));
+ UNALIGNED_MEMCPY(&id, ext, sizeof(id));
ND_PRINT((ndo," idtype=%s", STR_OR_ID(id.type, ipsecidtypestr)));
if (id.proto_id) {
#ifndef WIN32
p = (struct ikev1_pl_cert *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&cert, ext, sizeof(cert));
+ UNALIGNED_MEMCPY(&cert, ext, sizeof(cert));
ND_PRINT((ndo," len=%d", item_len - 4));
ND_PRINT((ndo," type=%s", STR_OR_ID((cert.encode), certstr)));
if (2 < ndo->ndo_vflag && 4 < item_len) {
p = (struct ikev1_pl_cert *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&cert, ext, sizeof(cert));
+ UNALIGNED_MEMCPY(&cert, ext, sizeof(cert));
ND_PRINT((ndo," len=%d", item_len - 4));
ND_PRINT((ndo," type=%s", STR_OR_ID((cert.encode), certstr)));
if (2 < ndo->ndo_vflag && 4 < item_len) {
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_HASH)));
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ND_PRINT((ndo," len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_SIG)));
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ND_PRINT((ndo," len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_NONCE)));
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ND_PRINT((ndo," n len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
p = (struct ikev1_pl_n *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&n, ext, sizeof(n));
+ UNALIGNED_MEMCPY(&n, ext, sizeof(n));
doi = ntohl(n.doi);
proto = n.prot_id;
if (doi != 1) {
p = (struct ikev1_pl_d *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&d, ext, sizeof(d));
+ UNALIGNED_MEMCPY(&d, ext, sizeof(d));
doi = ntohl(d.doi);
proto = d.prot_id;
if (doi != 1) {
ND_PRINT((ndo,"%s:", NPSTR(ISAKMP_NPTYPE_VID)));
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ND_PRINT((ndo," len=%d", ntohs(e.len) - 4));
if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) {
ND_PRINT((ndo," "));
struct isakmp_gen e;
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ikev2_pay_print(ndo, NPSTR(tpay), e.critical);
ND_PRINT((ndo," len=%d", ntohs(e.len) - 4));
p = (struct ikev2_t *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&t, ext, sizeof(t));
+ UNALIGNED_MEMCPY(&t, ext, sizeof(t));
ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_T), t.h.critical);
t_id = ntohs(t.t_id);
p = (struct ikev2_p *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&prop, ext, sizeof(prop));
+ UNALIGNED_MEMCPY(&prop, ext, sizeof(prop));
ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_P), prop.h.critical);
ND_PRINT((ndo," #%u protoid=%s transform=%d len=%u",
int osa_length, sa_length;
ND_TCHECK(*ext1);
- unaligned_memcpy(&e, ext1, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext1, sizeof(e));
ikev2_pay_print(ndo, "sa", e.critical);
osa_length= ntohs(e.len);
k = (struct ikev2_ke *)ext;
ND_TCHECK(*ext);
- unaligned_memcpy(&ke, ext, sizeof(ke));
+ UNALIGNED_MEMCPY(&ke, ext, sizeof(ke));
ikev2_pay_print(ndo, NPSTR(tpay), ke.h.critical);
ND_PRINT((ndo," len=%u group=%s", ntohs(ke.h.len) - 8,
unsigned char *typedata;
ND_TCHECK(*ext);
- unaligned_memcpy(&id, ext, sizeof(id));
+ UNALIGNED_MEMCPY(&id, ext, sizeof(id));
ikev2_pay_print(ndo, NPSTR(tpay), id.h.critical);
id_len = ntohs(id.h.len);
unsigned int len;
ND_TCHECK(*ext);
- unaligned_memcpy(&a, ext, sizeof(a));
+ UNALIGNED_MEMCPY(&a, ext, sizeof(a));
ikev2_pay_print(ndo, NPSTR(tpay), a.h.critical);
len = ntohs(a.h.len);
struct isakmp_gen e;
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ikev2_pay_print(ndo, "nonce", e.critical);
ND_PRINT((ndo," len=%d", ntohs(e.len) - 4));
p = (struct ikev2_n *)ext;
ND_TCHECK(*p);
- unaligned_memcpy(&n, ext, sizeof(n));
+ UNALIGNED_MEMCPY(&n, ext, sizeof(n));
ikev2_pay_print(ndo, NPSTR(ISAKMP_NPTYPE_N), n.h.critical);
showspi = 1;
int i, len;
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ikev2_pay_print(ndo, NPSTR(tpay), e.critical);
ND_PRINT((ndo," len=%d vid=", ntohs(e.len) - 4));
volatile int dlen;
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ikev2_pay_print(ndo, NPSTR(tpay), e.critical);
dlen = ntohs(e.len)-4;
cp = (u_char *)ext;
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
/*
* Since we can't have a payload length of less than 4 bytes,
while (np) {
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ND_TCHECK2(*ext, ntohs(e.len));
cp = (u_char *)ext;
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
/*
* Since we can't have a payload length of less than 4 bytes,
pcount++;
ND_TCHECK(*ext);
- unaligned_memcpy(&e, ext, sizeof(e));
+ UNALIGNED_MEMCPY(&e, ext, sizeof(e));
ND_TCHECK2(*ext, ntohs(e.len));
return;
}
- unaligned_memcpy(&base, p, sizeof(base));
+ UNALIGNED_MEMCPY(&base, p, sizeof(base));
ND_PRINT((ndo,"isakmp"));
major = (base.vers & ISAKMP_VERS_MAJOR)