Lines Matching refs:keystack
145 #define ks1dbg(keystack, a) if (keystack->keystack_debug != 0) printf a argument
146 #define ks2dbg(keystack, a) if (keystack->keystack_debug > 1) printf a argument
147 #define ks3dbg(keystack, a) if (keystack->keystack_debug > 2) printf a argument
204 keysock_stack_t *keystack = ns->netstack_keysock; in keysock_plumb_ipsec() local
211 keystack->keystack_plumbed = 0; /* we're trying again.. */ in keysock_plumb_ipsec()
214 keystack->keystack_netstack->netstack_stackid)); in keysock_plumb_ipsec()
304 keystack->keystack_plumbed = (err == 0) ? 1 : -1; in keysock_plumb_ipsec()
312 keystack->keystack_plumbed); in keysock_plumb_ipsec()
325 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_param_get() local
327 mutex_enter(&keystack->keystack_param_lock); in keysock_param_get()
329 mutex_exit(&keystack->keystack_param_lock); in keysock_param_get()
343 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_param_set() local
349 mutex_enter(&keystack->keystack_param_lock); in keysock_param_set()
356 mutex_exit(&keystack->keystack_param_lock); in keysock_param_set()
362 mutex_exit(&keystack->keystack_param_lock); in keysock_param_set()
419 keysock_stack_t *keystack; in keysock_stack_init() local
422 keystack = (keysock_stack_t *)kmem_zalloc(sizeof (*keystack), KM_SLEEP); in keysock_stack_init()
423 keystack->keystack_netstack = ns; in keysock_stack_init()
425 keystack->keystack_acquire_seq = 0xffffffff; in keysock_stack_init()
428 keystack->keystack_params = ksp; in keysock_stack_init()
431 (void) keysock_param_register(&keystack->keystack_g_nd, ksp, in keysock_stack_init()
434 mutex_init(&keystack->keystack_list_lock, NULL, MUTEX_DEFAULT, NULL); in keysock_stack_init()
435 mutex_init(&keystack->keystack_consumers_lock, in keysock_stack_init()
437 mutex_init(&keystack->keystack_param_lock, NULL, MUTEX_DEFAULT, NULL); in keysock_stack_init()
438 return (keystack); in keysock_stack_init()
458 keysock_stack_t *keystack = (keysock_stack_t *)arg; in keysock_stack_fini() local
460 nd_free(&keystack->keystack_g_nd); in keysock_stack_fini()
461 kmem_free(keystack->keystack_params, sizeof (lcl_param_arr)); in keysock_stack_fini()
462 keystack->keystack_params = NULL; in keysock_stack_fini()
464 mutex_destroy(&keystack->keystack_list_lock); in keysock_stack_fini()
465 mutex_destroy(&keystack->keystack_consumers_lock); in keysock_stack_fini()
466 mutex_destroy(&keystack->keystack_param_lock); in keysock_stack_fini()
468 kmem_free(keystack, sizeof (*keystack)); in keysock_stack_fini()
482 keysock_stack_t *keystack; in keysock_close() local
492 keystack = kc->kc_keystack; in keysock_close()
494 ks1dbg(keystack, ("Module close, removing a consumer (%d).\n", in keysock_close()
509 keystack->keystack_flushdump--; in keysock_close()
510 if (keystack->keystack_flushdump == 0) { in keysock_close()
523 mutex_enter(&keystack->keystack_consumers_lock); in keysock_close()
524 keystack->keystack_consumers[kc->kc_sa_type] = NULL; in keysock_close()
525 mutex_exit(&keystack->keystack_consumers_lock); in keysock_close()
530 keystack = ks->keysock_keystack; in keysock_close()
532 ks3dbg(keystack, in keysock_close()
535 atomic_dec_32(&keystack->keystack_num_extended); in keysock_close()
537 mutex_enter(&keystack->keystack_list_lock); in keysock_close()
541 mutex_exit(&keystack->keystack_list_lock); in keysock_close()
564 keysock_stack_t *keystack; in keysock_open() local
576 keystack = ns->netstack_keysock; in keysock_open()
577 ASSERT(keystack != NULL); in keysock_open()
579 ks3dbg(keystack, ("Entering keysock open.\n")); in keysock_open()
581 if (keystack->keystack_plumbed < 1) { in keysock_open()
582 netstack_t *ns = keystack->keystack_netstack; in keysock_open()
584 keystack->keystack_plumbed = 0; in keysock_open()
587 keystack->keystack_netstack->netstack_stackid); in keysock_open()
601 netstack_rele(keystack->keystack_netstack); in keysock_open()
611 kc->kc_keystack = keystack; in keysock_open()
622 ks1dbg(keystack, ( in keysock_open()
629 netstack_rele(keystack->keystack_netstack); in keysock_open()
640 ks2dbg(keystack, ("Ready to putnext KEYSOCK_HELLO.\n")); in keysock_open()
647 ks2dbg(keystack, ("Made it into PF_KEY socket open.\n")); in keysock_open()
652 netstack_rele(keystack->keystack_netstack); in keysock_open()
658 netstack_rele(keystack->keystack_netstack); in keysock_open()
670 ks->keysock_keystack = keystack; in keysock_open()
678 q->q_hiwat = keystack->keystack_recv_hiwat; in keysock_open()
686 WR(q)->q_hiwat = keystack->keystack_xmit_hiwat; in keysock_open()
687 WR(q)->q_lowat = keystack->keystack_xmit_lowat; in keysock_open()
694 mutex_enter(&keystack->keystack_list_lock); in keysock_open()
695 ks->keysock_next = keystack->keystack_list; in keysock_open()
696 ks->keysock_ptpn = &keystack->keystack_list; in keysock_open()
697 if (keystack->keystack_list != NULL) { in keysock_open()
698 keystack->keystack_list->keysock_ptpn = in keysock_open()
701 keystack->keystack_list = ks; in keysock_open()
702 mutex_exit(&keystack->keystack_list_lock); in keysock_open()
706 keystack->keystack_recv_hiwat); in keysock_open()
713 keystack->keystack_netstack->netstack_ipsec)) { in keysock_open()
848 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_opt_set() local
860 if (*i1 > keystack->keystack_max_buf) in keysock_opt_set()
865 if (*i1 > keystack->keystack_max_buf) { in keysock_opt_set()
967 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_wput_other() local
974 ks3dbg(keystack, ( in keysock_wput_other()
1041 if (nd_getset(q, keystack->keystack_g_nd, mp)) { in keysock_wput_other()
1079 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_error() local
1096 keysock_passup(mp, samsg, ks->keysock_serial, NULL, B_FALSE, keystack); in keysock_error()
1111 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_passdown() local
1115 ks3dbg(keystack, ("keysock_passdown: allocb failed.\n")); in keysock_passdown()
1135 keystack->keystack_flushdump--; in keysock_passdown()
1160 kc = keystack->keystack_consumers[satype]; in keysock_passdown()
1168 keystack->keystack_flushdump--; in keysock_passdown()
1192 ext_check(sadb_ext_t *ext, keysock_stack_t *keystack) in ext_check() argument
1231 ks1dbg(keystack, ( in ext_check()
1233 ks1dbg(keystack, ("%d bits, len is %d bytes.\n", in ext_check()
1314 keysock_stack_t *keystack) in keysock_get_ext() argument
1346 if (!ext_check(extv[0], keystack)) in keysock_get_ext()
1381 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_do_flushdump() local
1388 keystack); in keysock_do_flushdump()
1393 if (keystack->keystack_flushdump != 0) { in keysock_do_flushdump()
1413 keystack->keystack_flushdump_errno = 0; in keysock_do_flushdump()
1432 mutex_enter(&keystack->keystack_consumers_lock); in keysock_do_flushdump()
1434 if (keystack->keystack_consumers[i] != NULL) { in keysock_do_flushdump()
1454 mutex_enter(&keystack->keystack_consumers[i]->kc_lock); in keysock_do_flushdump()
1455 ASSERT((keystack->keystack_consumers[i]->kc_flags & in keysock_do_flushdump()
1457 keystack->keystack_consumers[i]->kc_flags |= in keysock_do_flushdump()
1459 mutex_exit(&(keystack->keystack_consumers[i]->kc_lock)); in keysock_do_flushdump()
1461 keystack->keystack_flushdump++; in keysock_do_flushdump()
1469 mutex_exit(&keystack->keystack_consumers_lock); in keysock_do_flushdump()
1475 mutex_exit(&keystack->keystack_consumers_lock); in keysock_do_flushdump()
1477 if (keystack->keystack_flushdump == 0) { in keysock_do_flushdump()
1580 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_inverse_acquire() local
1609 keystack->keystack_netstack); in keysock_inverse_acquire()
1614 ks->keysock_serial, NULL, B_FALSE, keystack); in keysock_inverse_acquire()
1631 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_extended_register() local
1656 keystack); in keysock_extended_register()
1667 atomic_inc_32(&keystack->keystack_num_extended); in keysock_extended_register()
1675 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_delpair_all() local
1681 if (keystack->keystack_consumers[i] != NULL) { in keysock_delpair_all()
1704 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_parse() local
1710 ks2dbg(keystack, ("Received possible PF_KEY message, type %d.\n", in keysock_parse()
1724 ks2dbg(keystack, in keysock_parse()
1737 ks3dbg(keystack, in keysock_parse()
1745 switch (keysock_get_ext(extv, samsg, msgsize, keystack)) { in keysock_parse()
1748 ks1dbg(keystack, ("Got duplicate extension of type %d.\n", in keysock_parse()
1755 ks1dbg(keystack, ("Got unknown extension of type %d.\n", in keysock_parse()
1761 ks1dbg(keystack, in keysock_parse()
1768 ks1dbg(keystack, in keysock_parse()
1873 keystack); in keysock_parse()
1902 ks2dbg(keystack, ("FLUSH message with extension.\n")); in keysock_parse()
1930 keystack); in keysock_parse()
1936 ks2dbg(keystack, ("Got unknown message type %d.\n", in keysock_parse()
1959 keysock_stack_t *keystack; in keysock_wput() local
1963 keystack = kc->kc_keystack; in keysock_wput()
1965 ks3dbg(keystack, ("In keysock_wput\n")); in keysock_wput()
1971 ks1dbg(keystack, ("Huh? wput for an consumer instance (%d)?\n", in keysock_wput()
1977 keystack = ks->keysock_keystack; in keysock_wput()
1979 ks3dbg(keystack, ("In keysock_wput\n")); in keysock_wput()
1986 ks2dbg(keystack, ("raw M_DATA in keysock.\n")); in keysock_wput()
1995 ks2dbg(keystack, in keysock_wput()
2002 ks2dbg(keystack, ("T_DATA_REQ\n")); in keysock_wput()
2008 ks3dbg(keystack, ("In default wput case (%d %d).\n", in keysock_wput()
2029 keysock_stack_t *keystack = kc->kc_keystack; in keysock_link_consumer() local
2031 mutex_enter(&keystack->keystack_consumers_lock); in keysock_link_consumer()
2033 if (keystack->keystack_consumers[satype] != NULL) { in keysock_link_consumer()
2042 mutex_exit(&keystack->keystack_consumers_lock); in keysock_link_consumer()
2045 keystack->keystack_consumers[satype] = kc; in keysock_link_consumer()
2050 mutex_exit(&keystack->keystack_consumers_lock); in keysock_link_consumer()
2053 mutex_enter(&keystack->keystack_list_lock); in keysock_link_consumer()
2054 for (ks = keystack->keystack_list; ks != NULL; in keysock_link_consumer()
2061 ks1dbg(keystack, in keysock_link_consumer()
2066 mutex_exit(&keystack->keystack_list_lock); in keysock_link_consumer()
2078 keysock_stack_t *keystack = kc->kc_keystack; in keysock_out_err() local
2082 ks1dbg(keystack, ("keysock_out_err: Can't alloc message.\n")); in keysock_out_err()
2123 keysock_consumer_t *kc, boolean_t persistent, keysock_stack_t *keystack) in keysock_passup() argument
2158 ks3dbg(keystack, in keysock_passup()
2184 ks3dbg(keystack, ("Delivering REGISTER.\n")); in keysock_passup()
2211 ks3dbg(keystack, ("Delivering ACQUIRE.\n")); in keysock_passup()
2221 if (allreg && keystack->keystack_num_extended > 0) in keysock_passup()
2232 ks3dbg(keystack, ("Delivering sender/promisc only (%d).\n", in keysock_passup()
2237 mutex_enter(&keystack->keystack_list_lock); in keysock_passup()
2238 for (ks = keystack->keystack_list; ks != NULL; ks = ks->keysock_next) { in keysock_passup()
2277 ks2dbg(keystack, ( in keysock_passup()
2298 ks1dbg(keystack, ( in keysock_passup()
2308 ks3dbg(keystack, in keysock_passup()
2319 mutex_exit(&keystack->keystack_list_lock); in keysock_passup()
2328 ks1dbg(keystack, in keysock_passup()
2343 ks2dbg(keystack, in keysock_passup()
2397 keysock_stack_t *keystack = kc->kc_keystack; in keysock_rput() local
2409 ks1dbg(keystack, in keysock_rput()
2435 ASSERT(keystack->keystack_flushdump != 0); in keysock_rput()
2443 keystack->keystack_flushdump_errno = in keysock_rput()
2451 if (atomic_dec_32_nv(&keystack->keystack_flushdump) != in keysock_rput()
2453 ks1dbg(keystack, in keysock_rput()
2461 (uint8_t)keystack->keystack_flushdump_errno; in keysock_rput()
2467 (samsg->sadb_msg_type == SADB_DUMP), keystack); in keysock_rput()
2476 ks1dbg(keystack, ("Hmmm, an IPsec info I'm not used to, 0x%x\n", in keysock_rput()
2489 keysock_stack_t *keystack = ns->netstack_keysock; in keysock_extended_reg() local
2491 return (keystack->keystack_num_extended != 0); in keysock_extended_reg()
2497 keysock_stack_t *keystack = ns->netstack_keysock; in keysock_next_seq() local
2499 return (atomic_dec_32_nv(&keystack->keystack_acquire_seq)); in keysock_next_seq()