fixed subnet check to generate IPV4_ADDRESS when needed in sockaddr2id()

This commit is contained in:
vanhu 2007-03-22 10:26:19 +00:00
parent ae2d0d18ae
commit 27187d08ab
3 changed files with 13 additions and 13 deletions

View File

@ -1,3 +1,7 @@
2007-03-22 Yvan Vanhullebus <vanhu@netasq.com>
* src/racoon/{ipsec_doi.c|cfparse.y}: fixed subnet check to
generate IPV4_ADDRESS when needed in sockaddr2id().
2007-03-21 Yvan Vanhullebus <vanhu@netasq.com>
* src/racoon/schedule.h: checks if arg is NULL in SCHED_KILL.
* src/racoon/{handler.c|isakmp.c|isakmp_inf.c|pfkey.c}: NULL sched

View File

@ -1,4 +1,4 @@
/* $NetBSD: cfparse.y,v 1.19 2007/02/02 13:42:28 vanhu Exp $ */
/* $NetBSD: cfparse.y,v 1.20 2007/03/22 10:26:19 vanhu Exp $ */
/* Id: cfparse.y,v 1.66 2006/08/22 18:17:17 manubsd Exp */
@ -1215,10 +1215,8 @@ sainfo_id
return -1;
}
$$ = ipsecdoi_sockaddr2id(saddr,
$3 == (sizeof(struct in_addr) << 3) &&
$1 == IDTYPE_ADDRESS
? ~0 : $3,
$5);
$3 == ~0 ? (sizeof(struct in_addr) << 3): $3,
$5);
break;
#ifdef INET6
case AF_INET6:
@ -1227,11 +1225,9 @@ sainfo_id
racoon_free(saddr);
return -1;
}
$$ = ipsecdoi_sockaddr2id(saddr,
$3 == (sizeof(struct in6_addr) << 3) &&
$1 == IDTYPE_ADDRESS
? ~0 : $3,
$5);
$$ = ipsecdoi_sockaddr2id(saddr,
$3 == ~0 ? (sizeof(struct in6_addr) << 3): $3,
$5);
break;
#endif
default:

View File

@ -1,4 +1,4 @@
/* $NetBSD: ipsec_doi.c,v 1.27 2007/02/28 05:36:45 mgrooms Exp $ */
/* $NetBSD: ipsec_doi.c,v 1.28 2007/03/22 10:26:19 vanhu Exp $ */
/* Id: ipsec_doi.c,v 1.55 2006/08/17 09:20:41 vanhu Exp */
@ -4107,7 +4107,7 @@ ipsecdoi_sockaddr2id(saddr, prefixlen, ul_proto)
switch (saddr->sa_family) {
case AF_INET:
len1 = sizeof(struct in_addr);
if (prefixlen == ~0) {
if (prefixlen == (sizeof(struct in_addr) << 3)) {
type = IPSECDOI_ID_IPV4_ADDR;
len2 = 0;
} else {
@ -4120,7 +4120,7 @@ ipsecdoi_sockaddr2id(saddr, prefixlen, ul_proto)
#ifdef INET6
case AF_INET6:
len1 = sizeof(struct in6_addr);
if (prefixlen == ~0) {
if (prefixlen == (sizeof(struct in6_addr) << 3)) {
type = IPSECDOI_ID_IPV6_ADDR;
len2 = 0;
} else {