Change struct sockaddr_storage member name, because following change
is very likely to become consensus as recent ietf/ipng mailing list discussion. Also recent KAME repository and other KAME patched BSDs also applied it. s/__ss_family/ss_family/ s/__ss_len/ss_len/ Makeworld is confirmed, and no application should be affected by this change yet.
This commit is contained in:
parent
5982897710
commit
e15c59c6ad
@ -480,16 +480,16 @@ in_lifaddr_ioctl(so, cmd, data, ifp, p)
|
||||
case SIOCALIFADDR:
|
||||
case SIOCDLIFADDR:
|
||||
/* address must be specified on ADD and DELETE */
|
||||
if (iflr->addr.__ss_family != AF_INET)
|
||||
if (iflr->addr.ss_family != AF_INET)
|
||||
return EINVAL;
|
||||
if (iflr->addr.__ss_len != sizeof(struct sockaddr_in))
|
||||
if (iflr->addr.ss_len != sizeof(struct sockaddr_in))
|
||||
return EINVAL;
|
||||
/* XXX need improvement */
|
||||
if (iflr->dstaddr.__ss_family
|
||||
&& iflr->dstaddr.__ss_family != AF_INET)
|
||||
if (iflr->dstaddr.ss_family
|
||||
&& iflr->dstaddr.ss_family != AF_INET)
|
||||
return EINVAL;
|
||||
if (iflr->dstaddr.__ss_family
|
||||
&& iflr->dstaddr.__ss_len != sizeof(struct sockaddr_in))
|
||||
if (iflr->dstaddr.ss_family
|
||||
&& iflr->dstaddr.ss_len != sizeof(struct sockaddr_in))
|
||||
return EINVAL;
|
||||
break;
|
||||
default: /*shouldn't happen*/
|
||||
@ -511,11 +511,11 @@ in_lifaddr_ioctl(so, cmd, data, ifp, p)
|
||||
bcopy(iflr->iflr_name, ifra.ifra_name,
|
||||
sizeof(ifra.ifra_name));
|
||||
|
||||
bcopy(&iflr->addr, &ifra.ifra_addr, iflr->addr.__ss_len);
|
||||
bcopy(&iflr->addr, &ifra.ifra_addr, iflr->addr.ss_len);
|
||||
|
||||
if (iflr->dstaddr.__ss_family) { /*XXX*/
|
||||
if (iflr->dstaddr.ss_family) { /*XXX*/
|
||||
bcopy(&iflr->dstaddr, &ifra.ifra_dstaddr,
|
||||
iflr->dstaddr.__ss_len);
|
||||
iflr->dstaddr.ss_len);
|
||||
}
|
||||
|
||||
ifra.ifra_mask.sin_family = AF_INET;
|
||||
|
@ -935,16 +935,16 @@ in6_lifaddr_ioctl(so, cmd, data, ifp, p)
|
||||
case SIOCALIFADDR:
|
||||
case SIOCDLIFADDR:
|
||||
/* address must be specified on ADD and DELETE */
|
||||
if (iflr->addr.__ss_family != AF_INET6)
|
||||
if (iflr->addr.ss_family != AF_INET6)
|
||||
return EINVAL;
|
||||
if (iflr->addr.__ss_len != sizeof(struct sockaddr_in6))
|
||||
if (iflr->addr.ss_len != sizeof(struct sockaddr_in6))
|
||||
return EINVAL;
|
||||
/* XXX need improvement */
|
||||
if (iflr->dstaddr.__ss_family
|
||||
&& iflr->dstaddr.__ss_family != AF_INET6)
|
||||
if (iflr->dstaddr.ss_family
|
||||
&& iflr->dstaddr.ss_family != AF_INET6)
|
||||
return EINVAL;
|
||||
if (iflr->dstaddr.__ss_family
|
||||
&& iflr->dstaddr.__ss_len != sizeof(struct sockaddr_in6))
|
||||
if (iflr->dstaddr.ss_family
|
||||
&& iflr->dstaddr.ss_len != sizeof(struct sockaddr_in6))
|
||||
return EINVAL;
|
||||
break;
|
||||
default: /*shouldn't happen*/
|
||||
@ -992,7 +992,7 @@ in6_lifaddr_ioctl(so, cmd, data, ifp, p)
|
||||
bcopy(iflr->iflr_name, ifra.ifra_name,
|
||||
sizeof(ifra.ifra_name));
|
||||
|
||||
bcopy(&iflr->addr, &ifra.ifra_addr, iflr->addr.__ss_len);
|
||||
bcopy(&iflr->addr, &ifra.ifra_addr, iflr->addr.ss_len);
|
||||
if (hostid) {
|
||||
/* fill in hostid part */
|
||||
ifra.ifra_addr.sin6_addr.s6_addr32[2] =
|
||||
@ -1001,9 +1001,9 @@ in6_lifaddr_ioctl(so, cmd, data, ifp, p)
|
||||
hostid->s6_addr32[3];
|
||||
}
|
||||
|
||||
if (iflr->dstaddr.__ss_family) { /*XXX*/
|
||||
if (iflr->dstaddr.ss_family) { /*XXX*/
|
||||
bcopy(&iflr->dstaddr, &ifra.ifra_dstaddr,
|
||||
iflr->dstaddr.__ss_len);
|
||||
iflr->dstaddr.ss_len);
|
||||
if (hostid) {
|
||||
ifra.ifra_dstaddr.sin6_addr.s6_addr32[2] =
|
||||
hostid->s6_addr32[2];
|
||||
|
@ -668,8 +668,8 @@ ipsec_setspidx_mbuf(spidx, dir, family, m)
|
||||
bzero(spidx, sizeof(*spidx));
|
||||
|
||||
spidx->dir = dir;
|
||||
spidx->src.__ss_len = spidx->dst.__ss_len = _SALENBYAF(family);
|
||||
spidx->src.__ss_family = spidx->dst.__ss_family = family;
|
||||
spidx->src.ss_len = spidx->dst.ss_len = _SALENBYAF(family);
|
||||
spidx->src.ss_family = spidx->dst.ss_family = family;
|
||||
spidx->prefs = spidx->prefd = _INALENBYAF(family) << 3;
|
||||
|
||||
{
|
||||
@ -878,8 +878,8 @@ ipsec4_setspidx_inpcb(m, pcb)
|
||||
|
||||
spidx = &pcb->inp_sp->sp_in->spidx;
|
||||
spidx->dir = IPSEC_DIR_INBOUND;
|
||||
spidx->src.__ss_len = spidx->dst.__ss_len = _SALENBYAF(AF_INET);
|
||||
spidx->src.__ss_family = spidx->dst.__ss_family = AF_INET;
|
||||
spidx->src.ss_len = spidx->dst.ss_len = _SALENBYAF(AF_INET);
|
||||
spidx->src.ss_family = spidx->dst.ss_family = AF_INET;
|
||||
spidx->prefs = _INALENBYAF(AF_INET) << 3;
|
||||
spidx->prefd = _INALENBYAF(AF_INET) << 3;
|
||||
spidx->ul_proto = pcb->inp_socket->so_proto->pr_protocol;
|
||||
@ -889,8 +889,8 @@ ipsec4_setspidx_inpcb(m, pcb)
|
||||
|
||||
spidx = &pcb->inp_sp->sp_out->spidx;
|
||||
spidx->dir = IPSEC_DIR_OUTBOUND;
|
||||
spidx->src.__ss_len = spidx->dst.__ss_len = _SALENBYAF(AF_INET);
|
||||
spidx->src.__ss_family = spidx->dst.__ss_family = AF_INET;
|
||||
spidx->src.ss_len = spidx->dst.ss_len = _SALENBYAF(AF_INET);
|
||||
spidx->src.ss_family = spidx->dst.ss_family = AF_INET;
|
||||
spidx->prefs = _INALENBYAF(AF_INET) << 3;
|
||||
spidx->prefd = _INALENBYAF(AF_INET) << 3;
|
||||
spidx->ul_proto = pcb->inp_socket->so_proto->pr_protocol;
|
||||
@ -957,8 +957,8 @@ ipsec6_setspidx_in6pcb(m, pcb)
|
||||
|
||||
spidx = &pcb->in6p_sp->sp_in->spidx;
|
||||
spidx->dir = IPSEC_DIR_INBOUND;
|
||||
spidx->src.__ss_len = spidx->dst.__ss_len = _SALENBYAF(AF_INET6);
|
||||
spidx->src.__ss_family = spidx->dst.__ss_family = AF_INET6;
|
||||
spidx->src.ss_len = spidx->dst.ss_len = _SALENBYAF(AF_INET6);
|
||||
spidx->src.ss_family = spidx->dst.ss_family = AF_INET6;
|
||||
spidx->prefs = _INALENBYAF(AF_INET6) << 3;
|
||||
spidx->prefd = _INALENBYAF(AF_INET6) << 3;
|
||||
spidx->ul_proto = pcb->in6p_socket->so_proto->pr_protocol;
|
||||
@ -968,8 +968,8 @@ ipsec6_setspidx_in6pcb(m, pcb)
|
||||
|
||||
spidx = &pcb->in6p_sp->sp_out->spidx;
|
||||
spidx->dir = IPSEC_DIR_OUTBOUND;
|
||||
spidx->src.__ss_len = spidx->dst.__ss_len = _SALENBYAF(AF_INET6);
|
||||
spidx->src.__ss_family = spidx->dst.__ss_family = AF_INET6;
|
||||
spidx->src.ss_len = spidx->dst.ss_len = _SALENBYAF(AF_INET6);
|
||||
spidx->src.ss_family = spidx->dst.ss_family = AF_INET6;
|
||||
spidx->prefs = _INALENBYAF(AF_INET6) << 3;
|
||||
spidx->prefd = _INALENBYAF(AF_INET6) << 3;
|
||||
spidx->ul_proto = pcb->in6p_socket->so_proto->pr_protocol;
|
||||
@ -1420,7 +1420,7 @@ ipsec_get_reqlevel(isr)
|
||||
/* sanity check */
|
||||
if (isr == NULL || isr->sp == NULL)
|
||||
panic("ipsec_get_reqlevel: NULL pointer is passed.\n");
|
||||
if (isr->sp->spidx.src.__ss_family != isr->sp->spidx.dst.__ss_family)
|
||||
if (isr->sp->spidx.src.ss_family != isr->sp->spidx.dst.ss_family)
|
||||
panic("ipsec_get_reqlevel: family mismatched.\n");
|
||||
|
||||
#define IPSEC_CHECK_DEFAULT(lev) \
|
||||
@ -1430,7 +1430,7 @@ ipsec_get_reqlevel(isr)
|
||||
(lev) = IPSEC_LEVEL_USE) : (lev))
|
||||
|
||||
/* set default level */
|
||||
switch (isr->sp->spidx.src.__ss_family) {
|
||||
switch (isr->sp->spidx.src.ss_family) {
|
||||
#ifdef INET
|
||||
case AF_INET:
|
||||
esp_trans_deflev = IPSEC_CHECK_DEFAULT(ip4_esp_trans_deflev);
|
||||
@ -1449,7 +1449,7 @@ ipsec_get_reqlevel(isr)
|
||||
#endif /* INET6 */
|
||||
default:
|
||||
panic("key_get_reqlevel: Unknown family. %d\n",
|
||||
isr->sp->spidx.src.__ss_family);
|
||||
isr->sp->spidx.src.ss_family);
|
||||
}
|
||||
|
||||
#undef IPSEC_CHECK_DEFAULT(lev)
|
||||
@ -1725,7 +1725,7 @@ ipsec_hdrsiz(sp)
|
||||
}
|
||||
|
||||
if (isr->saidx.mode == IPSEC_MODE_TUNNEL) {
|
||||
switch (isr->saidx.dst.__ss_family) {
|
||||
switch (isr->saidx.dst.ss_family) {
|
||||
case AF_INET:
|
||||
clen += sizeof(struct ip);
|
||||
break;
|
||||
@ -1737,7 +1737,7 @@ ipsec_hdrsiz(sp)
|
||||
default:
|
||||
printf("ipsec_hdrsiz: unknown AF %d "
|
||||
"in IPsec tunnel SA\n",
|
||||
isr->saidx.dst.__ss_family);
|
||||
isr->saidx.dst.ss_family);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1842,8 +1842,8 @@ ipsec4_encapsulate(m, sav)
|
||||
size_t plen;
|
||||
|
||||
/* can't tunnel between different AFs */
|
||||
if (sav->sah->saidx.src.__ss_family != sav->sah->saidx.dst.__ss_family
|
||||
|| sav->sah->saidx.src.__ss_family != AF_INET) {
|
||||
if (sav->sah->saidx.src.ss_family != sav->sah->saidx.dst.ss_family
|
||||
|| sav->sah->saidx.src.ss_family != AF_INET) {
|
||||
m_freem(m);
|
||||
return EINVAL;
|
||||
}
|
||||
@ -1947,8 +1947,8 @@ ipsec6_encapsulate(m, sav)
|
||||
size_t plen;
|
||||
|
||||
/* can't tunnel between different AFs */
|
||||
if (sav->sah->saidx.src.__ss_family != sav->sah->saidx.dst.__ss_family
|
||||
|| sav->sah->saidx.src.__ss_family != AF_INET6) {
|
||||
if (sav->sah->saidx.src.ss_family != sav->sah->saidx.dst.ss_family
|
||||
|| sav->sah->saidx.src.ss_family != AF_INET6) {
|
||||
m_freem(m);
|
||||
return EINVAL;
|
||||
}
|
||||
@ -2246,13 +2246,13 @@ ipsec_logsastr(sav)
|
||||
struct secasindex *saidx = &sav->sah->saidx;
|
||||
|
||||
/* validity check */
|
||||
if (sav->sah->saidx.src.__ss_family != sav->sah->saidx.dst.__ss_family)
|
||||
if (sav->sah->saidx.src.ss_family != sav->sah->saidx.dst.ss_family)
|
||||
panic("ipsec_logsastr: family mismatched.\n");
|
||||
|
||||
snprintf(buf, sizeof(buf), "SA(SPI=%u ", (u_int32_t)ntohl(sav->spi));
|
||||
for (p = buf; p && *p; p++)
|
||||
;
|
||||
if (saidx->src.__ss_family == AF_INET) {
|
||||
if (saidx->src.ss_family == AF_INET) {
|
||||
u_int8_t *s, *d;
|
||||
s = (u_int8_t *)&((struct sockaddr_in *)&saidx->src)->sin_addr;
|
||||
d = (u_int8_t *)&((struct sockaddr_in *)&saidx->dst)->sin_addr;
|
||||
@ -2261,7 +2261,7 @@ ipsec_logsastr(sav)
|
||||
s[0], s[1], s[2], s[3], d[0], d[1], d[2], d[3]);
|
||||
}
|
||||
#ifdef INET6
|
||||
else if (saidx->src.__ss_family == AF_INET6) {
|
||||
else if (saidx->src.ss_family == AF_INET6) {
|
||||
snprintf(p, sizeof(buf) - (p - buf),
|
||||
"src=%s",
|
||||
ip6_sprintf(&((struct sockaddr_in6 *)&saidx->src)->sin6_addr));
|
||||
@ -2381,7 +2381,7 @@ ipsec4_output(state, sp, flags)
|
||||
* build IPsec tunnel.
|
||||
*/
|
||||
/* XXX should be processed with other familiy */
|
||||
if (isr->sav->sah->saidx.src.__ss_family != AF_INET) {
|
||||
if (isr->sav->sah->saidx.src.ss_family != AF_INET) {
|
||||
printf("ipsec4_output: family mismatched "
|
||||
"between inner and outer spi=%u\n",
|
||||
(u_int32_t)ntohl(isr->sav->spi));
|
||||
@ -2694,7 +2694,7 @@ ipsec6_output_tunnel(state, sp, flags)
|
||||
* build IPsec tunnel.
|
||||
*/
|
||||
/* XXX should be processed with other familiy */
|
||||
if (isr->sav->sah->saidx.src.__ss_family != AF_INET6) {
|
||||
if (isr->sav->sah->saidx.src.ss_family != AF_INET6) {
|
||||
printf("ipsec4_output: family mismatched "
|
||||
"between inner and outer, spi=%u\n",
|
||||
(u_int32_t)ntohl(isr->sav->spi));
|
||||
@ -2906,7 +2906,7 @@ ipsec4_tunnel_validate(ip, nxt0, sav)
|
||||
#endif
|
||||
if (hlen != sizeof(struct ip))
|
||||
return 0;
|
||||
switch (sav->sah->saidx.dst.__ss_family) {
|
||||
switch (sav->sah->saidx.dst.ss_family) {
|
||||
case AF_INET:
|
||||
sin = (struct sockaddr_in *)&sav->sah->saidx.dst;
|
||||
if (bcmp(&ip->ip_dst, &sin->sin_addr, sizeof(ip->ip_dst)) != 0)
|
||||
@ -2937,7 +2937,7 @@ ipsec6_tunnel_validate(ip6, nxt0, sav)
|
||||
|
||||
if (nxt != IPPROTO_IPV6)
|
||||
return 0;
|
||||
switch (sav->sah->saidx.dst.__ss_family) {
|
||||
switch (sav->sah->saidx.dst.ss_family) {
|
||||
case AF_INET6:
|
||||
sin6 = ((struct sockaddr_in6 *)&sav->sah->saidx.dst);
|
||||
if (!IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &sin6->sin6_addr))
|
||||
|
@ -582,10 +582,10 @@ key_allocsa(family, src, dst, proto, spi)
|
||||
|
||||
if (key_bbcmp(src,
|
||||
_INADDRBYSA(&sav->sah->saidx.src),
|
||||
_INALENBYAF(sav->sah->saidx.src.__ss_family) << 3)
|
||||
_INALENBYAF(sav->sah->saidx.src.ss_family) << 3)
|
||||
&& key_bbcmp(dst,
|
||||
_INADDRBYSA(&sav->sah->saidx.dst),
|
||||
_INALENBYAF(sav->sah->saidx.dst.__ss_family) << 3))
|
||||
_INALENBYAF(sav->sah->saidx.dst.ss_family) << 3))
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
@ -1028,15 +1028,15 @@ key_sp2msg(sp)
|
||||
xisr->sadb_x_ipsecrequest_level = isr->level;
|
||||
|
||||
p += sizeof(*xisr);
|
||||
bcopy(&isr->saidx.src, p, isr->saidx.src.__ss_len);
|
||||
p += isr->saidx.src.__ss_len;
|
||||
bcopy(&isr->saidx.dst, p, isr->saidx.dst.__ss_len);
|
||||
p += isr->saidx.src.__ss_len;
|
||||
bcopy(&isr->saidx.src, p, isr->saidx.src.ss_len);
|
||||
p += isr->saidx.src.ss_len;
|
||||
bcopy(&isr->saidx.dst, p, isr->saidx.dst.ss_len);
|
||||
p += isr->saidx.src.ss_len;
|
||||
|
||||
xisr->sadb_x_ipsecrequest_len =
|
||||
PFKEY_ALIGN8(sizeof(*xisr)
|
||||
+ isr->saidx.src.__ss_len
|
||||
+ isr->saidx.dst.__ss_len);
|
||||
+ isr->saidx.src.ss_len
|
||||
+ isr->saidx.dst.ss_len);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1465,9 +1465,9 @@ key_getspmsglen(sp)
|
||||
|
||||
tlen = (sizeof(struct sadb_msg)
|
||||
+ sizeof(struct sadb_address)
|
||||
+ PFKEY_ALIGN8(_SALENBYAF(sp->spidx.src.__ss_family))
|
||||
+ PFKEY_ALIGN8(_SALENBYAF(sp->spidx.src.ss_family))
|
||||
+ sizeof(struct sadb_address)
|
||||
+ PFKEY_ALIGN8(_SALENBYAF(sp->spidx.dst.__ss_family)));
|
||||
+ PFKEY_ALIGN8(_SALENBYAF(sp->spidx.dst.ss_family)));
|
||||
|
||||
tlen += key_getspreqmsglen(sp);
|
||||
|
||||
@ -1496,8 +1496,8 @@ key_getspreqmsglen(sp)
|
||||
|
||||
for (isr = sp->req; isr != NULL; isr = isr->next) {
|
||||
len = sizeof(struct sadb_x_ipsecrequest)
|
||||
+ isr->saidx.src.__ss_len
|
||||
+ isr->saidx.dst.__ss_len;
|
||||
+ isr->saidx.src.ss_len
|
||||
+ isr->saidx.dst.ss_len;
|
||||
|
||||
tlen += PFKEY_ALIGN8(len);
|
||||
}
|
||||
@ -1776,14 +1776,14 @@ key_checkspidup(saidx, spi)
|
||||
struct secasvar *sav;
|
||||
|
||||
/* check address family */
|
||||
if (saidx->src.__ss_family != saidx->src.__ss_family) {
|
||||
if (saidx->src.ss_family != saidx->src.ss_family) {
|
||||
printf("key_checkspidup: address family mismatched.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* check all SAD */
|
||||
__LIST_FOREACH(sah, &sahtree, chain) {
|
||||
if (!key_ismyaddr(sah->saidx.dst.__ss_family,
|
||||
if (!key_ismyaddr(sah->saidx.dst.ss_family,
|
||||
_INADDRBYSA(&sah->saidx.dst)))
|
||||
continue;
|
||||
sav = key_getsavbyspi(sah, spi);
|
||||
@ -2105,9 +2105,9 @@ key_getmsglen(sav)
|
||||
|
||||
len += sizeof(struct sadb_sa);
|
||||
len += (sizeof(struct sadb_address)
|
||||
+ PFKEY_ALIGN8(_SALENBYAF(sav->sah->saidx.src.__ss_family)));
|
||||
+ PFKEY_ALIGN8(_SALENBYAF(sav->sah->saidx.src.ss_family)));
|
||||
len += (sizeof(struct sadb_address)
|
||||
+ PFKEY_ALIGN8(_SALENBYAF(sav->sah->saidx.dst.__ss_family)));
|
||||
+ PFKEY_ALIGN8(_SALENBYAF(sav->sah->saidx.dst.ss_family)));
|
||||
|
||||
if (sav->key_auth != NULL)
|
||||
len += sav->key_auth->sadb_key_len;
|
||||
@ -2310,7 +2310,7 @@ key_setdumpsa(newmsg, sav, type, satype, seq, pid)
|
||||
p = key_setsadbaddr(p,
|
||||
SADB_EXT_ADDRESS_SRC,
|
||||
(struct sockaddr *)&sav->sah->saidx.src,
|
||||
_INALENBYAF(sav->sah->saidx.src.__ss_family) << 3,
|
||||
_INALENBYAF(sav->sah->saidx.src.ss_family) << 3,
|
||||
IPSEC_ULPROTO_ANY);
|
||||
break;
|
||||
|
||||
@ -2318,7 +2318,7 @@ key_setdumpsa(newmsg, sav, type, satype, seq, pid)
|
||||
p = key_setsadbaddr(p,
|
||||
SADB_EXT_ADDRESS_DST,
|
||||
(struct sockaddr *)&sav->sah->saidx.dst,
|
||||
_INALENBYAF(sav->sah->saidx.dst.__ss_family) << 3,
|
||||
_INALENBYAF(sav->sah->saidx.dst.ss_family) << 3,
|
||||
IPSEC_ULPROTO_ANY);
|
||||
break;
|
||||
|
||||
@ -2634,8 +2634,8 @@ key_cmpsaidx_exactly(saidx0, saidx1)
|
||||
|| saidx0->mode != saidx1->mode)
|
||||
return 0;
|
||||
|
||||
if (bcmp(&saidx0->src, &saidx1->src, saidx0->src.__ss_len) != 0
|
||||
|| bcmp(&saidx0->dst, &saidx1->dst, saidx0->dst.__ss_len) != 0)
|
||||
if (bcmp(&saidx0->src, &saidx1->src, saidx0->src.ss_len) != 0
|
||||
|| bcmp(&saidx0->dst, &saidx1->dst, saidx0->dst.ss_len) != 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
@ -2663,8 +2663,8 @@ key_cmpsaidx_withmode(saidx0, saidx1)
|
||||
return 0;
|
||||
|
||||
if (saidx0->proto != saidx1->proto
|
||||
|| saidx0->src.__ss_family != saidx1->src.__ss_family
|
||||
|| saidx0->dst.__ss_family != saidx1->dst.__ss_family)
|
||||
|| saidx0->src.ss_family != saidx1->src.ss_family
|
||||
|| saidx0->dst.ss_family != saidx1->dst.ss_family)
|
||||
return 0;
|
||||
|
||||
if (saidx0->mode != IPSEC_MODE_ANY
|
||||
@ -2672,7 +2672,7 @@ key_cmpsaidx_withmode(saidx0, saidx1)
|
||||
return 0;
|
||||
|
||||
{
|
||||
int sa_len = _INALENBYAF(saidx0->src.__ss_family);
|
||||
int sa_len = _INALENBYAF(saidx0->src.ss_family);
|
||||
|
||||
if (bcmp(_INADDRBYSA(&saidx0->src), _INADDRBYSA(&saidx1->src), sa_len)
|
||||
|| bcmp(_INADDRBYSA(&saidx0->dst), _INADDRBYSA(&saidx1->dst), sa_len))
|
||||
@ -2707,8 +2707,8 @@ key_cmpspidx_exactly(spidx0, spidx1)
|
||||
|| spidx0->ul_proto != spidx1->ul_proto)
|
||||
return 0;
|
||||
|
||||
if (bcmp(&spidx0->src, &spidx1->src, spidx0->src.__ss_len) != 0
|
||||
|| bcmp(&spidx0->dst, &spidx1->dst, spidx0->dst.__ss_len) != 0)
|
||||
if (bcmp(&spidx0->src, &spidx1->src, spidx0->src.ss_len) != 0
|
||||
|| bcmp(&spidx0->dst, &spidx1->dst, spidx0->dst.ss_len) != 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
@ -2734,8 +2734,8 @@ key_cmpspidx_withmask(spidx0, spidx1)
|
||||
if (spidx0 == NULL || spidx1 == NULL)
|
||||
return 0;
|
||||
|
||||
if (spidx0->src.__ss_family != spidx1->src.__ss_family
|
||||
|| spidx0->dst.__ss_family != spidx1->dst.__ss_family)
|
||||
if (spidx0->src.ss_family != spidx1->src.ss_family
|
||||
|| spidx0->dst.ss_family != spidx1->dst.ss_family)
|
||||
return 0;
|
||||
|
||||
/* if spidx.ul_proto == IPSEC_ULPROTO_ANY, ignore. */
|
||||
@ -3868,13 +3868,13 @@ key_acquire(saidx, spidx)
|
||||
/* create new sadb_msg to reply. */
|
||||
len = sizeof(struct sadb_msg)
|
||||
+ sizeof(struct sadb_address)
|
||||
+ PFKEY_ALIGN8(saidx->src.__ss_len)
|
||||
+ PFKEY_ALIGN8(saidx->src.ss_len)
|
||||
+ sizeof(struct sadb_address)
|
||||
+ PFKEY_ALIGN8(saidx->dst.__ss_len)
|
||||
+ PFKEY_ALIGN8(saidx->dst.ss_len)
|
||||
+ sizeof(struct sadb_ident)
|
||||
+ PFKEY_ALIGN8(spidx->src.__ss_len)
|
||||
+ PFKEY_ALIGN8(spidx->src.ss_len)
|
||||
+ sizeof(struct sadb_ident)
|
||||
+ PFKEY_ALIGN8(spidx->dst.__ss_len)
|
||||
+ PFKEY_ALIGN8(spidx->dst.ss_len)
|
||||
+ sizeof(struct sadb_prop)
|
||||
+ sizeof(struct sadb_comb); /* XXX to be multiple */
|
||||
|
||||
@ -3904,12 +3904,12 @@ key_acquire(saidx, spidx)
|
||||
p = key_setsadbaddr(p,
|
||||
SADB_EXT_ADDRESS_SRC,
|
||||
(struct sockaddr *)&saidx->src,
|
||||
_INALENBYAF(saidx->src.__ss_family) << 3,
|
||||
_INALENBYAF(saidx->src.ss_family) << 3,
|
||||
IPSEC_ULPROTO_ANY);
|
||||
p = key_setsadbaddr(p,
|
||||
SADB_EXT_ADDRESS_DST,
|
||||
(struct sockaddr *)&saidx->dst,
|
||||
_INALENBYAF(saidx->dst.__ss_family) << 3,
|
||||
_INALENBYAF(saidx->dst.ss_family) << 3,
|
||||
IPSEC_ULPROTO_ANY);
|
||||
|
||||
/* set sadb_address for spidx's. */
|
||||
@ -3919,7 +3919,7 @@ key_acquire(saidx, spidx)
|
||||
SADB_EXT_IDENTITY_SRC,
|
||||
SADB_X_IDENTTYPE_ADDR,
|
||||
(caddr_t)&spidx->src,
|
||||
spidx->src.__ss_len,
|
||||
spidx->src.ss_len,
|
||||
*(u_int64_t *)&id);
|
||||
|
||||
id.sadb_x_ident_id_addr.prefix = spidx->prefd;
|
||||
@ -3928,7 +3928,7 @@ key_acquire(saidx, spidx)
|
||||
SADB_EXT_IDENTITY_DST,
|
||||
SADB_X_IDENTTYPE_ADDR,
|
||||
(caddr_t)&spidx->dst,
|
||||
spidx->dst.__ss_len,
|
||||
spidx->dst.ss_len,
|
||||
*(u_int64_t *)&id);
|
||||
|
||||
/* create proposal extension */
|
||||
@ -4373,9 +4373,9 @@ key_expire(sav)
|
||||
+ sizeof(struct sadb_lifetime)
|
||||
+ sizeof(struct sadb_lifetime)
|
||||
+ sizeof(struct sadb_address)
|
||||
+ PFKEY_ALIGN8(sav->sah->saidx.src.__ss_len)
|
||||
+ PFKEY_ALIGN8(sav->sah->saidx.src.ss_len)
|
||||
+ sizeof(struct sadb_address)
|
||||
+ PFKEY_ALIGN8(sav->sah->saidx.dst.__ss_len);
|
||||
+ PFKEY_ALIGN8(sav->sah->saidx.dst.ss_len);
|
||||
|
||||
KMALLOC(newmsg, struct sadb_msg *, len);
|
||||
if (newmsg == NULL) {
|
||||
@ -4414,14 +4414,14 @@ key_expire(sav)
|
||||
p = key_setsadbaddr(p,
|
||||
SADB_EXT_ADDRESS_SRC,
|
||||
(struct sockaddr *)&sav->sah->saidx.src,
|
||||
_INALENBYAF(sav->sah->saidx.src.__ss_family) << 3,
|
||||
_INALENBYAF(sav->sah->saidx.src.ss_family) << 3,
|
||||
IPSEC_ULPROTO_ANY);
|
||||
|
||||
/* set sadb_address for destination */
|
||||
p = key_setsadbaddr(p,
|
||||
SADB_EXT_ADDRESS_DST,
|
||||
(struct sockaddr *)&sav->sah->saidx.dst,
|
||||
_INALENBYAF(sav->sah->saidx.dst.__ss_family) << 3,
|
||||
_INALENBYAF(sav->sah->saidx.dst.ss_family) << 3,
|
||||
IPSEC_ULPROTO_ANY);
|
||||
|
||||
error = key_sendall(newmsg, len);
|
||||
|
@ -478,9 +478,9 @@ kdebug_secpolicyindex(spidx)
|
||||
printf("secpolicyindex{ dir=%u prefs=%u prefd=%u ul_proto=%u\n",
|
||||
spidx->dir, spidx->prefs, spidx->prefd, spidx->ul_proto);
|
||||
|
||||
ipsec_hexdump((caddr_t)&spidx->src, spidx->src.__ss_len);
|
||||
ipsec_hexdump((caddr_t)&spidx->src, spidx->src.ss_len);
|
||||
printf("\n");
|
||||
ipsec_hexdump((caddr_t)&spidx->dst, spidx->dst.__ss_len);
|
||||
ipsec_hexdump((caddr_t)&spidx->dst, spidx->dst.ss_len);
|
||||
printf("}\n");
|
||||
|
||||
return;
|
||||
@ -497,9 +497,9 @@ kdebug_secasindex(saidx)
|
||||
printf("secasindex{ mode=%u proto=%u\n",
|
||||
saidx->mode, saidx->proto);
|
||||
|
||||
ipsec_hexdump((caddr_t)&saidx->src, saidx->src.__ss_len);
|
||||
ipsec_hexdump((caddr_t)&saidx->src, saidx->src.ss_len);
|
||||
printf("\n");
|
||||
ipsec_hexdump((caddr_t)&saidx->dst, saidx->dst.__ss_len);
|
||||
ipsec_hexdump((caddr_t)&saidx->dst, saidx->dst.ss_len);
|
||||
printf("\n");
|
||||
|
||||
return;
|
||||
|
@ -171,8 +171,8 @@ struct sockproto {
|
||||
_SS_PAD1SIZE - _SS_ALIGNSIZE)
|
||||
|
||||
struct sockaddr_storage {
|
||||
u_char __ss_len; /* address length */
|
||||
sa_family_t __ss_family; /* address family */
|
||||
u_char ss_len; /* address length */
|
||||
sa_family_t ss_family; /* address family */
|
||||
char __ss_pad1[_SS_PAD1SIZE];
|
||||
int64_t __ss_align; /* force desired structure storage alignment */
|
||||
char __ss_pad2[_SS_PAD2SIZE];
|
||||
|
Loading…
Reference in New Issue
Block a user