Corrected arguments to key_allocsa called from

{esp6, ah6}_ctlinput.  Previous ones were uninitialized
auto variables, which were completely bogus.

Obtained from:	KAME
MFC after:	1 week
This commit is contained in:
Hajimu UMEMOTO 2002-03-25 10:46:24 +00:00
parent bc6d68df97
commit f8cfc6f789
2 changed files with 11 additions and 7 deletions

View File

@ -974,7 +974,7 @@ ah6_ctlinput(cmd, sa, d)
struct mbuf *m; struct mbuf *m;
struct ip6ctlparam *ip6cp = NULL; struct ip6ctlparam *ip6cp = NULL;
int off; int off;
struct sockaddr_in6 sa6_src, sa6_dst; struct sockaddr_in6 *sa6_src, *sa6_dst;
if (sa->sa_family != AF_INET6 || if (sa->sa_family != AF_INET6 ||
sa->sa_len != sizeof(struct sockaddr_in6)) sa->sa_len != sizeof(struct sockaddr_in6))
@ -1021,9 +1021,11 @@ ah6_ctlinput(cmd, sa, d)
* Check to see if we have a valid SA corresponding to * Check to see if we have a valid SA corresponding to
* the address in the ICMP message payload. * the address in the ICMP message payload.
*/ */
sa6_src = ip6cp->ip6c_src;
sa6_dst = (struct sockaddr_in6 *)sa;
sav = key_allocsa(AF_INET6, sav = key_allocsa(AF_INET6,
(caddr_t)&sa6_src.sin6_addr, (caddr_t)&sa6_src->sin6_addr,
(caddr_t)&sa6_dst.sin6_addr, (caddr_t)&sa6_dst->sin6_addr,
IPPROTO_AH, ahp->ah_spi); IPPROTO_AH, ahp->ah_spi);
if (sav) { if (sav) {
if (sav->state == SADB_SASTATE_MATURE || if (sav->state == SADB_SASTATE_MATURE ||

View File

@ -898,7 +898,7 @@ esp6_ctlinput(cmd, sa, d)
struct ip6_hdr *ip6; struct ip6_hdr *ip6;
struct mbuf *m; struct mbuf *m;
int off; int off;
struct sockaddr_in6 sa6_src, sa6_dst; struct sockaddr_in6 *sa6_src, *sa6_dst;
if (sa->sa_family != AF_INET6 || if (sa->sa_family != AF_INET6 ||
sa->sa_len != sizeof(struct sockaddr_in6)) sa->sa_len != sizeof(struct sockaddr_in6))
@ -963,10 +963,12 @@ esp6_ctlinput(cmd, sa, d)
* Check to see if we have a valid SA corresponding to * Check to see if we have a valid SA corresponding to
* the address in the ICMP message payload. * the address in the ICMP message payload.
*/ */
sa6_src = ip6cp->ip6c_src;
sa6_dst = (struct sockaddr_in6 *)sa;
sav = key_allocsa(AF_INET6, sav = key_allocsa(AF_INET6,
(caddr_t)&sa6_src.sin6_addr, (caddr_t)&sa6_src->sin6_addr,
(caddr_t)&sa6_dst, IPPROTO_ESP, (caddr_t)&sa6_dst->sin6_addr,
espp->esp_spi); IPPROTO_ESP, espp->esp_spi);
if (sav) { if (sav) {
if (sav->state == SADB_SASTATE_MATURE || if (sav->state == SADB_SASTATE_MATURE ||
sav->state == SADB_SASTATE_DYING) sav->state == SADB_SASTATE_DYING)