Correct the length of the SADB_EXT header in debug outputs

The length is shifted 3 bits in PF_KEY protocol.

Originally fixed by hsuenaga@IIJ
This commit is contained in:
ozaki-r 2017-04-26 03:16:06 +00:00
parent 8e5c8dbff1
commit 2ea60f03d0
2 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: key_debug.c,v 1.10 2012/01/09 15:25:13 drochner Exp $ */
/* $NetBSD: key_debug.c,v 1.11 2017/04/26 03:16:06 ozaki-r Exp $ */
/* $KAME: key_debug.c,v 1.29 2001/08/16 14:25:41 itojun Exp $ */
@ -133,7 +133,7 @@ kdebug_sadb(base)
while (tlen > 0) {
printf("sadb_ext{ len=%u type=%u }\n",
ext->sadb_ext_len, ext->sadb_ext_type);
PFKEY_UNUNIT64(ext->sadb_ext_len), ext->sadb_ext_type);
if (ext->sadb_ext_len == 0) {
printf("kdebug_sadb: invalid ext_len=0 was passed.\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: key_debug.c,v 1.16 2017/04/18 10:49:35 ozaki-r Exp $ */
/* $NetBSD: key_debug.c,v 1.17 2017/04/26 03:16:06 ozaki-r Exp $ */
/* $FreeBSD: src/sys/netipsec/key_debug.c,v 1.1.4.1 2003/01/24 05:11:36 sam Exp $ */
/* $KAME: key_debug.c,v 1.26 2001/06/27 10:46:50 sakane Exp $ */
@ -33,7 +33,7 @@
#ifdef _KERNEL
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: key_debug.c,v 1.16 2017/04/18 10:49:35 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: key_debug.c,v 1.17 2017/04/26 03:16:06 ozaki-r Exp $");
#endif
#if defined(_KERNEL_OPT)
@ -105,7 +105,7 @@ kdebug_sadb(const struct sadb_msg *base)
while (tlen > 0) {
printf("sadb_ext{ len=%u type=%u }\n",
ext->sadb_ext_len, ext->sadb_ext_type);
PFKEY_UNUNIT64(ext->sadb_ext_len), ext->sadb_ext_type);
if (ext->sadb_ext_len == 0) {
printf("kdebug_sadb: invalid ext_len=0 was passed.\n");