+static void
+kdebug_sadb_session_id(ext)
+struct sadb_ext *ext;
+{
+ struct sadb_session_id *p = ALIGNED_CAST(__typeof__(p))ext; // Wcast-align fix (void*) - sadb structs come from and aligned buffer
+
+ /* sanity check */
+ if (ext == NULL) {
+ printf("kdebug_sadb_session_id: NULL pointer was passed.\n");
+ return;
+ }
+
+ printf("sadb_session_id{ id0=%llx, id1=%llx}\n",
+ p->sadb_session_id_v[0],
+ p->sadb_session_id_v[1]);
+}
+
+static void
+kdebug_sadb_x_ipsecif(struct sadb_ext *ext)
+{
+ struct sadb_x_ipsecif *p = ALIGNED_CAST(__typeof__(p))ext;
+
+ if (ext == NULL) {
+ printf("sadb_x_ipsecif: NULL pointer was passed.\n");
+ return;
+ }
+
+ printf("sadb_x_ipsec_if{ ipsecif=%s outgoing=%s\n", p->sadb_x_ipsecif_ipsec_if, p->sadb_x_ipsecif_outgoing_if);
+ printf(" internal=%s disabled=%d }\n", p->sadb_x_ipsecif_internal_if, p->sadb_x_ipsecif_init_disabled);
+}
+
+static void
+kdebug_sadb_sastat(ext)
+struct sadb_ext *ext;
+{
+ struct sadb_sastat *p = ALIGNED_CAST(__typeof__(p))ext; // Wcast-align fix (void*) - sadb structs come from and aligned buffer
+ struct sastat *stats;
+ int i;
+
+ /* sanity check */
+ if (ext == NULL) {
+ printf("kdebug_sadb_sastat: NULL pointer was passed.\n");
+ return;
+ }
+
+ 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");
+}
+