correct ordering mistake in SADB_DUMP.

correct bug in key length management in SA database.
improbe mbuf printing (for debugging only).
This commit is contained in:
itojun 2000-06-15 12:37:07 +00:00
parent 752b4566c4
commit f982a33213
3 changed files with 16 additions and 23 deletions

View File

@ -1,5 +1,5 @@
/* $NetBSD: key.c,v 1.21 2000/06/15 05:50:22 itojun Exp $ */
/* $KAME: key.c,v 1.130 2000/06/15 05:46:06 sakane Exp $ */
/* $NetBSD: key.c,v 1.22 2000/06/15 12:37:07 itojun Exp $ */
/* $KAME: key.c,v 1.131 2000/06/15 12:20:50 sakane Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -2717,9 +2717,6 @@ key_setsaval(sav, m, mhp)
error = ENOBUFS;
goto fail;
}
/* make length shift up for kernel*/
sav->key_auth->sadb_key_len = len;
}
/* Encryption key */
@ -2761,9 +2758,6 @@ key_setsaval(sav, m, mhp)
error = ENOBUFS;
goto fail;
}
/* make length shift up for kernel*/
sav->key_enc->sadb_key_len = len;
}
/* set iv */
@ -3194,7 +3188,7 @@ key_setdumpsa(sav, type, satype, seq, pid)
goto fail;
result = m;
for (i = SADB_EXT_MAX; i >= 0; i--) {
for (i = sizeof(dumporder)/sizeof(dumporder[0]) - 1; i >= 0; i--) {
m = NULL;
p = NULL;
switch (dumporder[i]) {
@ -3230,14 +3224,14 @@ key_setdumpsa(sav, type, satype, seq, pid)
case SADB_EXT_KEY_AUTH:
if (!sav->key_auth)
continue;
l = sav->key_auth->sadb_key_len;
l = PFKEY_UNUNIT64(sav->key_auth->sadb_key_len);
p = sav->key_auth;
break;
case SADB_EXT_KEY_ENCRYPT:
if (!sav->key_enc)
continue;
l = sav->key_enc->sadb_key_len;
l = PFKEY_UNUNIT64(sav->key_enc->sadb_key_len);
p = sav->key_enc;
break;

View File

@ -1,5 +1,5 @@
/* $NetBSD: key_debug.c,v 1.10 2000/06/12 10:40:47 itojun Exp $ */
/* $KAME: key_debug.c,v 1.20 2000/06/10 06:39:54 sakane Exp $ */
/* $NetBSD: key_debug.c,v 1.11 2000/06/15 12:37:09 itojun Exp $ */
/* $KAME: key_debug.c,v 1.21 2000/06/15 11:54:01 sakane Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -660,19 +660,20 @@ kdebug_mbuf(m0)
struct mbuf *m = m0;
int i, j;
kdebug_mbufhdr(m);
printf(" m_data=\n");
for (j = 0; m; m = m->m_next) {
kdebug_mbufhdr(m);
printf(" m_data:\n");
for (i = 0; i < m->m_len; i++) {
if (i != 0 && i % 32 == 0) printf("\n");
if (i % 4 == 0) printf(" ");
if (i && i % 32 == 0)
printf("\n");
if (i % 4 == 0)
printf(" ");
printf("%02x", mtod(m, u_char *)[i]);
j++;
}
printf("\n");
}
printf("\n");
return;
}
#endif /* _KERNEL */

View File

@ -1,5 +1,5 @@
/* $NetBSD: keydb.h,v 1.5 2000/06/12 10:40:48 itojun Exp $ */
/* $KAME: keydb.h,v 1.10 2000/03/25 07:24:13 sumikawa Exp $ */
/* $NetBSD: keydb.h,v 1.6 2000/06/15 12:37:10 itojun Exp $ */
/* $KAME: keydb.h,v 1.11 2000/06/15 12:20:50 sakane Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -79,9 +79,7 @@ struct secasvar {
u_int32_t flags; /* holder for SADB_KEY_FLAGS */
struct sadb_key *key_auth; /* Key for Authentication */
/* length has been shifted up to 3. */
struct sadb_key *key_enc; /* Key for Encryption */
/* length has been shifted up to 3. */
caddr_t iv; /* Initilization Vector */
u_int ivlen; /* length of IV */
#if 0