X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/55e303ae13a4cf49d70f2294092726f2fffb9ef2..bb59bff194111743b33cc36712410b5656329d3c:/bsd/netkey/key_debug.c diff --git a/bsd/netkey/key_debug.c b/bsd/netkey/key_debug.c index 6db61a105..23a5fff24 100644 --- a/bsd/netkey/key_debug.c +++ b/bsd/netkey/key_debug.c @@ -55,17 +55,17 @@ #if !defined(KERNEL) || (defined(KERNEL) && defined(IPSEC_DEBUG)) -static void kdebug_sadb_prop __P((struct sadb_ext *)); -static void kdebug_sadb_identity __P((struct sadb_ext *)); -static void kdebug_sadb_supported __P((struct sadb_ext *)); -static void kdebug_sadb_lifetime __P((struct sadb_ext *)); -static void kdebug_sadb_sa __P((struct sadb_ext *)); -static void kdebug_sadb_address __P((struct sadb_ext *)); -static void kdebug_sadb_key __P((struct sadb_ext *)); -static void kdebug_sadb_x_sa2 __P((struct sadb_ext *)); +static void kdebug_sadb_prop(struct sadb_ext *); +static void kdebug_sadb_identity(struct sadb_ext *); +static void kdebug_sadb_supported(struct sadb_ext *); +static void kdebug_sadb_lifetime(struct sadb_ext *); +static void kdebug_sadb_sa(struct sadb_ext *); +static void kdebug_sadb_address(struct sadb_ext *); +static void kdebug_sadb_key(struct sadb_ext *); +static void kdebug_sadb_x_sa2(struct sadb_ext *); #ifdef KERNEL -static void kdebug_secreplay __P((struct secreplay *)); +static void kdebug_secreplay(struct secreplay *); #endif #ifndef KERNEL @@ -149,6 +149,12 @@ kdebug_sadb(base) case SADB_X_EXT_SA2: kdebug_sadb_x_sa2(ext); break; + case SADB_EXT_SESSION_ID: + kdebug_sadb_session_id(ext); + break; + case SADB_EXT_SASTAT: + kdebug_sadb_sastat(ext); + break; default: printf("kdebug_sadb: invalid ext_type %u was passed.\n", ext->sadb_ext_type); @@ -197,15 +203,15 @@ kdebug_sadb_prop(ext) "soft_bytes=%lu hard_bytes=%lu\n", comb->sadb_comb_soft_allocations, comb->sadb_comb_hard_allocations, - (unsigned long)comb->sadb_comb_soft_bytes, - (unsigned long)comb->sadb_comb_hard_bytes); + (u_int32_t)comb->sadb_comb_soft_bytes, + (u_int32_t)comb->sadb_comb_hard_bytes); printf(" soft_alloc=%lu hard_alloc=%lu " "soft_bytes=%lu hard_bytes=%lu }\n", - (unsigned long)comb->sadb_comb_soft_addtime, - (unsigned long)comb->sadb_comb_hard_addtime, - (unsigned long)comb->sadb_comb_soft_usetime, - (unsigned long)comb->sadb_comb_hard_usetime); + (u_int32_t)comb->sadb_comb_soft_addtime, + (u_int32_t)comb->sadb_comb_hard_addtime, + (u_int32_t)comb->sadb_comb_soft_usetime, + (u_int32_t)comb->sadb_comb_hard_usetime); comb++; } printf("}\n"); @@ -230,7 +236,7 @@ kdebug_sadb_identity(ext) switch (id->sadb_ident_type) { default: printf(" type=%d id=%lu", - id->sadb_ident_type, (u_long)id->sadb_ident_id); + id->sadb_ident_type, (u_int32_t)id->sadb_ident_id); if (len) { #ifdef KERNEL ipsec_hexdump((caddr_t)(id + 1), len); /*XXX cast ?*/ @@ -389,6 +395,47 @@ kdebug_sadb_x_sa2(ext) return; } +static void +kdebug_sadb_session_id(ext) + struct sadb_ext *ext; +{ + struct sadb_session_id *p = (__typeof__(p))ext; + + /* sanity check */ + if (ext == NULL) + panic("kdebug_sadb_session_id: NULL pointer was passed.\n"); + + printf("sadb_session_id{ id0=%llx, id1=%llx}\n", + p->sadb_session_id_v[0], + p->sadb_session_id_v[1]); + + return; +} + +static void +kdebug_sadb_sastat(ext) + struct sadb_ext *ext; +{ + struct sadb_sastat *p = (__typeof__(p))ext; + struct sastat *stats; + int i; + + /* sanity check */ + if (ext == NULL) + panic("kdebug_sadb_sastat: NULL pointer was passed.\n"); + + printf("sadb_sastat{ dir=%u num=%u\n", + p->sadb_sastat_dir, p->sadb_sastat_list_len); + stats = (__typeof__(stats))(p + 1); + for (i = 0; i < p->sadb_sastat_list_len; i++) { + printf(" spi=%x,\n", + stats[i].spi); + } + printf("}\n"); + + return; +} + void kdebug_sadb_x_policy(ext) struct sadb_ext *ext; @@ -470,6 +517,7 @@ kdebug_secpolicy(sp) switch (sp->policy) { case IPSEC_POLICY_DISCARD: + case IPSEC_POLICY_GENERATE: printf(" type=discard }\n"); break; case IPSEC_POLICY_NONE: @@ -483,8 +531,6 @@ kdebug_secpolicy(sp) printf(" level=%u\n", isr->level); kdebug_secasindex(&isr->saidx); - if (isr->sav != NULL) - kdebug_secasv(isr->sav); } printf(" }\n"); } @@ -512,8 +558,9 @@ kdebug_secpolicyindex(spidx) if (spidx == NULL) panic("kdebug_secpolicyindex: NULL pointer was passed.\n"); - printf("secpolicyindex{ dir=%u prefs=%u prefd=%u ul_proto=%u\n", - spidx->dir, spidx->prefs, spidx->prefd, spidx->ul_proto); + printf("secpolicyindex{ dir=%u prefs=%u prefd=%u ul_proto=%u internal_if=%s\n", + spidx->dir, spidx->prefs, spidx->prefd, spidx->ul_proto, + (spidx->internal_if) ? spidx->internal_if->if_xname : "N/A"); ipsec_hexdump((caddr_t)&spidx->src, ((struct sockaddr *)&spidx->src)->sa_len); @@ -625,21 +672,27 @@ kdebug_mbufhdr(m) if (m == NULL) return; - printf("mbuf(%p){ m_next:%p m_nextpkt:%p m_data:%p " - "m_len:%d m_type:0x%02x m_flags:0x%02x }\n", - m, m->m_next, m->m_nextpkt, m->m_data, - m->m_len, m->m_type, m->m_flags); + printf("mbuf(0x%llx){ m_next:0x%llx m_nextpkt:0x%llx m_data:0x%llx " + "m_len:%d m_type:0x%02x m_flags:0x%02x }\n", + (uint64_t)VM_KERNEL_ADDRPERM(m), + (uint64_t)VM_KERNEL_ADDRPERM(m->m_next), + (uint64_t)VM_KERNEL_ADDRPERM(m->m_nextpkt), + (uint64_t)VM_KERNEL_ADDRPERM(m->m_data), + m->m_len, m->m_type, m->m_flags); if (m->m_flags & M_PKTHDR) { - printf(" m_pkthdr{ len:%d rcvif:%p }\n", - m->m_pkthdr.len, m->m_pkthdr.rcvif); + printf(" m_pkthdr{ len:%d rcvif:0x%llx }\n", + m->m_pkthdr.len, + (uint64_t)VM_KERNEL_ADDRPERM(m->m_pkthdr.rcvif)); } if (m->m_flags & M_EXT) { - printf(" m_ext{ ext_buf:%p ext_free:%p " - "ext_size:%u ext_ref:%p }\n", - m->m_ext.ext_buf, m->m_ext.ext_free, - m->m_ext.ext_size, m->m_ext.ext_refs); + printf(" m_ext{ ext_buf:0x%llx ext_free:0x%llx " + "ext_size:%u ext_ref:0x%llx }\n", + (uint64_t)VM_KERNEL_ADDRPERM(m->m_ext.ext_buf), + (uint64_t)VM_KERNEL_ADDRPERM(m->m_ext.ext_free), + m->m_ext.ext_size, + (uint64_t)VM_KERNEL_ADDRPERM(m->m_ext.ext_refs)); } return;