Lines Matching defs:ifs

269 ipf_kstat_init(ipf_stack_t *ifs, boolean_t from_gz)
271 ifs->ifs_kstatp[0] = net_kstat_create(ifs->ifs_netid,
275 if (ifs->ifs_kstatp[0] != NULL) {
276 bcopy(&ipf_kstat_tmp, ifs->ifs_kstatp[0]->ks_data,
278 ifs->ifs_kstatp[0]->ks_update = ipf_kstat_update;
279 ifs->ifs_kstatp[0]->ks_private = &ifs->ifs_frstats[0];
280 kstat_install(ifs->ifs_kstatp[0]);
283 ifs->ifs_kstatp[1] = net_kstat_create(ifs->ifs_netid,
287 if (ifs->ifs_kstatp[1] != NULL) {
288 bcopy(&ipf_kstat_tmp, ifs->ifs_kstatp[1]->ks_data,
290 ifs->ifs_kstatp[1]->ks_update = ipf_kstat_update;
291 ifs->ifs_kstatp[1]->ks_private = &ifs->ifs_frstats[1];
292 kstat_install(ifs->ifs_kstatp[1]);
297 ifs, ifs->ifs_kstatp[0], ifs->ifs_kstatp[1]);
303 ipf_kstat_fini(ipf_stack_t *ifs)
308 if (ifs->ifs_kstatp[i] != NULL) {
309 net_kstat_delete(ifs->ifs_netid, ifs->ifs_kstatp[i]);
310 ifs->ifs_kstatp[i] = NULL;
422 ipf_stack_t *ifs;
429 ifs = (ipf_stack_t *)kmem_alloc(sizeof (*ifs), KM_SLEEP);
430 bzero(ifs, sizeof (*ifs));
432 ifs->ifs_hook4_physical_in = B_FALSE;
433 ifs->ifs_hook4_physical_out = B_FALSE;
434 ifs->ifs_hook4_nic_events = B_FALSE;
435 ifs->ifs_hook4_loopback_in = B_FALSE;
436 ifs->ifs_hook4_loopback_out = B_FALSE;
437 ifs->ifs_hook6_physical_in = B_FALSE;
438 ifs->ifs_hook6_physical_out = B_FALSE;
439 ifs->ifs_hook6_nic_events = B_FALSE;
440 ifs->ifs_hook6_loopback_in = B_FALSE;
441 ifs->ifs_hook6_loopback_out = B_FALSE;
446 RWLOCK_INIT(&ifs->ifs_ipf_global, "ipf filter load/unload mutex");
447 RWLOCK_INIT(&ifs->ifs_ipf_mutex, "ipf filter rwlock");
448 RWLOCK_INIT(&ifs->ifs_ipf_frcache, "ipf cache rwlock");
449 ifs->ifs_netid = id;
450 ifs->ifs_zone = zid;
451 ifs->ifs_gz_controlled = from_gz;
452 ifs->ifs_gz_cont_ifs = ifs_gz;
454 ipf_kstat_init(ifs, from_gz);
457 cmn_err(CE_CONT, "IP Filter:stack_create zone=%d", ifs->ifs_zone);
463 WRITE_ENTER(&ifs->ifs_ipf_global);
464 ipftuneable_alloc(ifs);
465 RWLOCK_EXIT(&ifs->ifs_ipf_global);
468 if (ifs->ifs_zone == GLOBAL_ZONEID)
473 ipf_stacks->ifs_pnext = &ifs->ifs_next;
474 ifs->ifs_next = ipf_stacks;
475 ifs->ifs_pnext = &ipf_stacks;
476 ipf_stacks = ifs;
479 return (ifs);
485 ipf_stack_t *ifs = NULL;
497 ifs = ipf_stack_create_one(id, zid, B_TRUE, NULL);
499 return (ipf_stack_create_one(id, zid, B_FALSE, ifs));
515 ipf_stack_t *ifs;
548 for (ifs = ipf_stacks; ifs != NULL; ifs = ifs->ifs_next) {
549 if (ifs->ifs_zone == zone && ifs->ifs_gz_controlled == gz_stack)
553 if (ifs != NULL) {
554 READ_ENTER(&ifs->ifs_ipf_global);
557 return (ifs);
560 static int ipf_detach_check_zone(ipf_stack_t *ifs)
566 READ_ENTER(&ifs->ifs_ipf_global);
567 if (ifs->ifs_fr_running == 1) {
568 RWLOCK_EXIT(&ifs->ifs_ipf_global);
575 if (ifs->ifs_ipfilter[0][ifs->ifs_fr_active] ||
576 ifs->ifs_ipfilter[1][ifs->ifs_fr_active] ||
577 ifs->ifs_ipfilter6[0][ifs->ifs_fr_active] ||
578 ifs->ifs_ipfilter6[1][ifs->ifs_fr_active]) {
579 RWLOCK_EXIT(&ifs->ifs_ipf_global);
583 RWLOCK_EXIT(&ifs->ifs_ipf_global);
591 ipf_stack_t *ifs;
594 for (ifs = ipf_stacks; ifs != NULL; ifs = ifs->ifs_next)
595 if (ipf_detach_check_zone(ifs) != 0)
598 return ((ifs == NULL) ? 0 : -1);
610 ipf_stack_t *ifs = (ipf_stack_t *)arg;
615 if (ifs->ifs_gz_cont_ifs != NULL)
616 ipf_kstat_fini(ifs->ifs_gz_cont_ifs);
621 ipf_kstat_fini(ifs);
630 ipf_stack_destroy_one(const netid_t id, ipf_stack_t *ifs)
635 (void) printf("ipf_stack_destroy_one(%p)\n", (void *)ifs);
642 WRITE_ENTER(&ifs->ifs_ipf_global);
643 if (ifs->ifs_fr_running == -2) {
644 RWLOCK_EXIT(&ifs->ifs_ipf_global);
647 ifs->ifs_fr_running = -2;
648 tid = ifs->ifs_fr_timer_id;
649 ifs->ifs_fr_timer_id = NULL;
650 RWLOCK_EXIT(&ifs->ifs_ipf_global);
653 if (ifs->ifs_next != NULL)
654 ifs->ifs_next->ifs_pnext = ifs->ifs_pnext;
655 *ifs->ifs_pnext = ifs->ifs_next;
661 WRITE_ENTER(&ifs->ifs_ipf_global);
662 if (ipldetach(ifs) != 0) {
666 ipftuneable_free(ifs);
668 RWLOCK_EXIT(&ifs->ifs_ipf_global);
669 RW_DESTROY(&ifs->ifs_ipf_mutex);
670 RW_DESTROY(&ifs->ifs_ipf_frcache);
671 RW_DESTROY(&ifs->ifs_ipf_global);
673 KFREE(ifs);
686 ipf_stack_t *ifs = (ipf_stack_t *)arg;
691 if (ifs->ifs_gz_cont_ifs != NULL)
692 ipf_stack_destroy_one(id, ifs->ifs_gz_cont_ifs);
697 ipf_stack_destroy_one(id, ifs);
876 ipf_property_update(dip, ifs)
878 ipf_stack_t *ifs;
886 for (ipft = ifs->ifs_ipf_tuneables;