Lines Matching refs:keystack
140 #define ks1dbg(keystack, a) if (keystack->keystack_debug != 0) printf a argument
141 #define ks2dbg(keystack, a) if (keystack->keystack_debug > 1) printf a argument
142 #define ks3dbg(keystack, a) if (keystack->keystack_debug > 2) printf a argument
201 keysock_stack_t *keystack = ns->netstack_keysock; in keysock_plumb_ipsec() local
208 keystack->keystack_plumbed = 0; /* we're trying again.. */ in keysock_plumb_ipsec()
211 keystack->keystack_netstack->netstack_stackid)); in keysock_plumb_ipsec()
301 keystack->keystack_plumbed = (err == 0) ? 1 : -1; in keysock_plumb_ipsec()
309 keystack->keystack_plumbed); in keysock_plumb_ipsec()
326 keysock_stack_t *keystack = ks->keysock_keystack; local
328 mutex_enter(&keystack->keystack_param_lock);
330 mutex_exit(&keystack->keystack_param_lock);
349 keysock_stack_t *keystack = ks->keysock_keystack; local
355 mutex_enter(&keystack->keystack_param_lock);
362 mutex_exit(&keystack->keystack_param_lock);
368 mutex_exit(&keystack->keystack_param_lock);
425 keysock_stack_t *keystack; in keysock_stack_init() local
428 keystack = (keysock_stack_t *)kmem_zalloc(sizeof (*keystack), KM_SLEEP); in keysock_stack_init()
429 keystack->keystack_netstack = ns; in keysock_stack_init()
431 keystack->keystack_acquire_seq = 0xffffffff; in keysock_stack_init()
434 keystack->keystack_params = ksp; in keysock_stack_init()
437 (void) keysock_param_register(&keystack->keystack_g_nd, ksp, in keysock_stack_init()
440 mutex_init(&keystack->keystack_list_lock, NULL, MUTEX_DEFAULT, NULL); in keysock_stack_init()
441 mutex_init(&keystack->keystack_consumers_lock, in keysock_stack_init()
443 mutex_init(&keystack->keystack_param_lock, NULL, MUTEX_DEFAULT, NULL); in keysock_stack_init()
444 return (keystack); in keysock_stack_init()
464 keysock_stack_t *keystack = (keysock_stack_t *)arg; in keysock_stack_fini() local
466 nd_free(&keystack->keystack_g_nd); in keysock_stack_fini()
467 kmem_free(keystack->keystack_params, sizeof (lcl_param_arr)); in keysock_stack_fini()
468 keystack->keystack_params = NULL; in keysock_stack_fini()
470 mutex_destroy(&keystack->keystack_list_lock); in keysock_stack_fini()
471 mutex_destroy(&keystack->keystack_consumers_lock); in keysock_stack_fini()
472 mutex_destroy(&keystack->keystack_param_lock); in keysock_stack_fini()
474 kmem_free(keystack, sizeof (*keystack)); in keysock_stack_fini()
487 keysock_stack_t *keystack; in keysock_close() local
497 keystack = kc->kc_keystack; in keysock_close()
499 ks1dbg(keystack, ("Module close, removing a consumer (%d).\n", in keysock_close()
514 keystack->keystack_flushdump--; in keysock_close()
515 if (keystack->keystack_flushdump == 0) { in keysock_close()
528 mutex_enter(&keystack->keystack_consumers_lock); in keysock_close()
529 keystack->keystack_consumers[kc->kc_sa_type] = NULL; in keysock_close()
530 mutex_exit(&keystack->keystack_consumers_lock); in keysock_close()
535 keystack = ks->keysock_keystack; in keysock_close()
537 ks3dbg(keystack, in keysock_close()
540 atomic_dec_32(&keystack->keystack_num_extended); in keysock_close()
542 mutex_enter(&keystack->keystack_list_lock); in keysock_close()
546 mutex_exit(&keystack->keystack_list_lock); in keysock_close()
569 keysock_stack_t *keystack; in keysock_open() local
581 keystack = ns->netstack_keysock; in keysock_open()
582 ASSERT(keystack != NULL); in keysock_open()
584 ks3dbg(keystack, ("Entering keysock open.\n")); in keysock_open()
586 if (keystack->keystack_plumbed < 1) { in keysock_open()
587 netstack_t *ns = keystack->keystack_netstack; in keysock_open()
589 keystack->keystack_plumbed = 0; in keysock_open()
592 keystack->keystack_netstack->netstack_stackid); in keysock_open()
606 netstack_rele(keystack->keystack_netstack); in keysock_open()
616 kc->kc_keystack = keystack; in keysock_open()
627 ks1dbg(keystack, ( in keysock_open()
634 netstack_rele(keystack->keystack_netstack); in keysock_open()
645 ks2dbg(keystack, ("Ready to putnext KEYSOCK_HELLO.\n")); in keysock_open()
652 ks2dbg(keystack, ("Made it into PF_KEY socket open.\n")); in keysock_open()
657 netstack_rele(keystack->keystack_netstack); in keysock_open()
663 netstack_rele(keystack->keystack_netstack); in keysock_open()
675 ks->keysock_keystack = keystack; in keysock_open()
683 q->q_hiwat = keystack->keystack_recv_hiwat; in keysock_open()
691 WR(q)->q_hiwat = keystack->keystack_xmit_hiwat; in keysock_open()
692 WR(q)->q_lowat = keystack->keystack_xmit_lowat; in keysock_open()
699 mutex_enter(&keystack->keystack_list_lock); in keysock_open()
700 ks->keysock_next = keystack->keystack_list; in keysock_open()
701 ks->keysock_ptpn = &keystack->keystack_list; in keysock_open()
702 if (keystack->keystack_list != NULL) { in keysock_open()
703 keystack->keystack_list->keysock_ptpn = in keysock_open()
706 keystack->keystack_list = ks; in keysock_open()
707 mutex_exit(&keystack->keystack_list_lock); in keysock_open()
711 keystack->keystack_recv_hiwat); in keysock_open()
718 keystack->keystack_netstack->netstack_ipsec)) { in keysock_open()
859 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_opt_set() local
871 if (*i1 > keystack->keystack_max_buf) in keysock_opt_set()
876 if (*i1 > keystack->keystack_max_buf) { in keysock_opt_set()
903 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_wput_other() local
910 ks3dbg(keystack, ( in keysock_wput_other()
964 if (nd_getset(q, keystack->keystack_g_nd, mp)) { in keysock_wput_other()
1002 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_error() local
1019 keysock_passup(mp, samsg, ks->keysock_serial, NULL, B_FALSE, keystack); in keysock_error()
1034 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_passdown() local
1038 ks3dbg(keystack, ("keysock_passdown: allocb failed.\n")); in keysock_passdown()
1051 keystack->keystack_flushdump--; in keysock_passdown()
1076 kc = keystack->keystack_consumers[satype]; in keysock_passdown()
1084 keystack->keystack_flushdump--; in keysock_passdown()
1108 ext_check(sadb_ext_t *ext, keysock_stack_t *keystack) in ext_check() argument
1147 ks1dbg(keystack, ( in ext_check()
1149 ks1dbg(keystack, ("%d bits, len is %d bytes.\n", in ext_check()
1221 keysock_stack_t *keystack) in keysock_get_ext() argument
1253 if (!ext_check(extv[0], keystack)) in keysock_get_ext()
1288 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_do_flushdump() local
1295 keystack); in keysock_do_flushdump()
1300 if (keystack->keystack_flushdump != 0) { in keysock_do_flushdump()
1320 keystack->keystack_flushdump_errno = 0; in keysock_do_flushdump()
1339 mutex_enter(&keystack->keystack_consumers_lock); in keysock_do_flushdump()
1341 if (keystack->keystack_consumers[i] != NULL) { in keysock_do_flushdump()
1361 mutex_enter(&keystack->keystack_consumers[i]->kc_lock); in keysock_do_flushdump()
1362 ASSERT((keystack->keystack_consumers[i]->kc_flags & in keysock_do_flushdump()
1364 keystack->keystack_consumers[i]->kc_flags |= in keysock_do_flushdump()
1366 mutex_exit(&(keystack->keystack_consumers[i]->kc_lock)); in keysock_do_flushdump()
1368 keystack->keystack_flushdump++; in keysock_do_flushdump()
1376 mutex_exit(&keystack->keystack_consumers_lock); in keysock_do_flushdump()
1382 mutex_exit(&keystack->keystack_consumers_lock); in keysock_do_flushdump()
1384 if (keystack->keystack_flushdump == 0) { in keysock_do_flushdump()
1481 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_inverse_acquire() local
1510 keystack->keystack_netstack); in keysock_inverse_acquire()
1515 ks->keysock_serial, NULL, B_FALSE, keystack); in keysock_inverse_acquire()
1532 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_extended_register() local
1557 keystack); in keysock_extended_register()
1568 atomic_inc_32(&keystack->keystack_num_extended); in keysock_extended_register()
1576 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_delpair_all() local
1582 if (keystack->keystack_consumers[i] != NULL) { in keysock_delpair_all()
1605 keysock_stack_t *keystack = ks->keysock_keystack; in keysock_parse() local
1611 ks2dbg(keystack, ("Received possible PF_KEY message, type %d.\n", in keysock_parse()
1625 ks2dbg(keystack, in keysock_parse()
1638 ks3dbg(keystack, in keysock_parse()
1646 switch (keysock_get_ext(extv, samsg, msgsize, keystack)) { in keysock_parse()
1649 ks1dbg(keystack, ("Got duplicate extension of type %d.\n", in keysock_parse()
1656 ks1dbg(keystack, ("Got unknown extension of type %d.\n", in keysock_parse()
1662 ks1dbg(keystack, in keysock_parse()
1669 ks1dbg(keystack, in keysock_parse()
1762 keystack); in keysock_parse()
1791 ks2dbg(keystack, ("FLUSH message with extension.\n")); in keysock_parse()
1819 keystack); in keysock_parse()
1825 ks2dbg(keystack, ("Got unknown message type %d.\n", in keysock_parse()
1848 keysock_stack_t *keystack; in keysock_wput() local
1852 keystack = kc->kc_keystack; in keysock_wput()
1854 ks3dbg(keystack, ("In keysock_wput\n")); in keysock_wput()
1860 ks1dbg(keystack, ("Huh? wput for an consumer instance (%d)?\n", in keysock_wput()
1866 keystack = ks->keysock_keystack; in keysock_wput()
1868 ks3dbg(keystack, ("In keysock_wput\n")); in keysock_wput()
1875 ks2dbg(keystack, ("raw M_DATA in keysock.\n")); in keysock_wput()
1884 ks2dbg(keystack, in keysock_wput()
1891 ks2dbg(keystack, ("T_DATA_REQ\n")); in keysock_wput()
1897 ks3dbg(keystack, ("In default wput case (%d %d).\n", in keysock_wput()
1917 keysock_stack_t *keystack = kc->kc_keystack; in keysock_link_consumer() local
1919 mutex_enter(&keystack->keystack_consumers_lock); in keysock_link_consumer()
1921 if (keystack->keystack_consumers[satype] != NULL) { in keysock_link_consumer()
1930 mutex_exit(&keystack->keystack_consumers_lock); in keysock_link_consumer()
1933 keystack->keystack_consumers[satype] = kc; in keysock_link_consumer()
1938 mutex_exit(&keystack->keystack_consumers_lock); in keysock_link_consumer()
1941 mutex_enter(&keystack->keystack_list_lock); in keysock_link_consumer()
1942 for (ks = keystack->keystack_list; ks != NULL; in keysock_link_consumer()
1949 ks1dbg(keystack, in keysock_link_consumer()
1954 mutex_exit(&keystack->keystack_list_lock); in keysock_link_consumer()
1966 keysock_stack_t *keystack = kc->kc_keystack; in keysock_out_err() local
1970 ks1dbg(keystack, ("keysock_out_err: Can't alloc message.\n")); in keysock_out_err()
2011 keysock_consumer_t *kc, boolean_t persistent, keysock_stack_t *keystack) in keysock_passup() argument
2046 ks3dbg(keystack, in keysock_passup()
2072 ks3dbg(keystack, ("Delivering REGISTER.\n")); in keysock_passup()
2099 ks3dbg(keystack, ("Delivering ACQUIRE.\n")); in keysock_passup()
2109 if (allreg && keystack->keystack_num_extended > 0) in keysock_passup()
2120 ks3dbg(keystack, ("Delivering sender/promisc only (%d).\n", in keysock_passup()
2125 mutex_enter(&keystack->keystack_list_lock); in keysock_passup()
2126 for (ks = keystack->keystack_list; ks != NULL; ks = ks->keysock_next) { in keysock_passup()
2165 ks2dbg(keystack, ( in keysock_passup()
2186 ks1dbg(keystack, ( in keysock_passup()
2196 ks3dbg(keystack, in keysock_passup()
2207 mutex_exit(&keystack->keystack_list_lock); in keysock_passup()
2216 ks1dbg(keystack, in keysock_passup()
2231 ks2dbg(keystack, in keysock_passup()
2284 keysock_stack_t *keystack = kc->kc_keystack; in keysock_rput() local
2296 ks1dbg(keystack, in keysock_rput()
2322 ASSERT(keystack->keystack_flushdump != 0); in keysock_rput()
2330 keystack->keystack_flushdump_errno = in keysock_rput()
2338 if (atomic_dec_32_nv(&keystack->keystack_flushdump) != in keysock_rput()
2340 ks1dbg(keystack, in keysock_rput()
2348 (uint8_t)keystack->keystack_flushdump_errno; in keysock_rput()
2354 (samsg->sadb_msg_type == SADB_DUMP), keystack); in keysock_rput()
2363 ks1dbg(keystack, ("Hmmm, an IPsec info I'm not used to, 0x%x\n", in keysock_rput()
2375 keysock_stack_t *keystack = ns->netstack_keysock; in keysock_extended_reg() local
2377 return (keystack->keystack_num_extended != 0); in keysock_extended_reg()
2383 keysock_stack_t *keystack = ns->netstack_keysock; in keysock_next_seq() local
2385 return (atomic_dec_32_nv(&keystack->keystack_acquire_seq)); in keysock_next_seq()