Lines Matching full:cfg

66 static void nat64clat_free_config(struct nat64clat_cfg *cfg);
73 struct nat64clat_cfg *cfg; in nat64clat_alloc_config() local
75 cfg = malloc(sizeof(struct nat64clat_cfg), M_IPFW, M_WAITOK | M_ZERO); in nat64clat_alloc_config()
76 COUNTER_ARRAY_ALLOC(cfg->base.stats.cnt, NAT64STATS, M_WAITOK); in nat64clat_alloc_config()
77 cfg->no.name = cfg->name; in nat64clat_alloc_config()
78 cfg->no.etlv = IPFW_TLV_NAT64CLAT_NAME; in nat64clat_alloc_config()
79 cfg->no.set = set; in nat64clat_alloc_config()
80 strlcpy(cfg->name, name, sizeof(cfg->name)); in nat64clat_alloc_config()
81 return (cfg); in nat64clat_alloc_config()
85 nat64clat_free_config(struct nat64clat_cfg *cfg) in nat64clat_free_config() argument
88 COUNTER_ARRAY_FREE(cfg->base.stats.cnt, NAT64STATS); in nat64clat_free_config()
89 free(cfg, M_IPFW); in nat64clat_free_config()
93 nat64clat_export_config(struct ip_fw_chain *ch, struct nat64clat_cfg *cfg, in nat64clat_export_config() argument
96 uc->plat_prefix = cfg->base.plat_prefix; in nat64clat_export_config()
97 uc->plat_plen = cfg->base.plat_plen; in nat64clat_export_config()
98 uc->clat_prefix = cfg->base.clat_prefix; in nat64clat_export_config()
99 uc->clat_plen = cfg->base.clat_plen; in nat64clat_export_config()
100 uc->flags = cfg->base.flags & NAT64CLAT_FLAGSMASK; in nat64clat_export_config()
101 uc->set = cfg->no.set; in nat64clat_export_config()
102 strlcpy(uc->name, cfg->no.name, sizeof(uc->name)); in nat64clat_export_config()
125 struct nat64clat_cfg *cfg; in nat64clat_find() local
127 cfg = (struct nat64clat_cfg *)ipfw_objhash_lookup_name_type(ni, set, in nat64clat_find()
130 return (cfg); in nat64clat_find()
147 struct nat64clat_cfg *cfg; in nat64clat_create() local
172 cfg = nat64clat_alloc_config(uc->name, uc->set); in nat64clat_create()
173 cfg->base.plat_prefix = uc->plat_prefix; in nat64clat_create()
174 cfg->base.plat_plen = uc->plat_plen; in nat64clat_create()
175 cfg->base.clat_prefix = uc->clat_prefix; in nat64clat_create()
176 cfg->base.clat_plen = uc->clat_plen; in nat64clat_create()
177 cfg->base.flags = (uc->flags & NAT64CLAT_FLAGSMASK) | in nat64clat_create()
179 if (IN6_IS_ADDR_WKPFX(&cfg->base.plat_prefix)) in nat64clat_create()
180 cfg->base.flags |= NAT64_WKPFX; in nat64clat_create()
186 nat64clat_free_config(cfg); in nat64clat_create()
190 if (ipfw_objhash_alloc_idx(ni, &cfg->no.kidx) != 0) { in nat64clat_create()
192 nat64clat_free_config(cfg); in nat64clat_create()
195 ipfw_objhash_add(CHAIN_TO_SRV(ch), &cfg->no); in nat64clat_create()
197 SRV_OBJECT(ch, cfg->no.kidx) = cfg; in nat64clat_create()
217 struct nat64clat_cfg *cfg; in nat64clat_config() local
235 cfg = nat64clat_find(ni, oh->ntlv.name, oh->ntlv.set); in nat64clat_config()
236 if (cfg == NULL) { in nat64clat_config()
240 nat64clat_export_config(ch, cfg, uc); in nat64clat_config()
246 cfg = nat64clat_find(ni, oh->ntlv.name, oh->ntlv.set); in nat64clat_config()
247 if (cfg == NULL) { in nat64clat_config()
257 if (uc->plat_plen != cfg->base.plat_plen || in nat64clat_config()
258 !IN6_ARE_ADDR_EQUAL(&uc->plat_prefix, &cfg->base.plat_prefix)) { in nat64clat_config()
266 if (uc->clat_plen != cfg->base.clat_plen || in nat64clat_config()
267 !IN6_ARE_ADDR_EQUAL(&uc->clat_prefix, &cfg->base.clat_prefix)) { in nat64clat_config()
278 cfg->base.plat_prefix = uc->plat_prefix; in nat64clat_config()
279 cfg->base.plat_plen = uc->plat_plen; in nat64clat_config()
282 cfg->base.clat_prefix = uc->clat_prefix; in nat64clat_config()
283 cfg->base.clat_plen = uc->clat_plen; in nat64clat_config()
288 cfg->base.flags &= ~NAT64CLAT_FLAGSMASK; in nat64clat_config()
289 cfg->base.flags |= uc->flags & NAT64CLAT_FLAGSMASK; in nat64clat_config()
296 nat64clat_detach_config(struct ip_fw_chain *ch, struct nat64clat_cfg *cfg) in nat64clat_detach_config() argument
301 ipfw_objhash_del(CHAIN_TO_SRV(ch), &cfg->no); in nat64clat_detach_config()
302 ipfw_objhash_free_idx(CHAIN_TO_SRV(ch), cfg->no.kidx); in nat64clat_detach_config()
317 struct nat64clat_cfg *cfg; in nat64clat_destroy() local
327 cfg = nat64clat_find(CHAIN_TO_SRV(ch), oh->ntlv.name, oh->ntlv.set); in nat64clat_destroy()
328 if (cfg == NULL) { in nat64clat_destroy()
332 if (cfg->no.refcnt > 0) { in nat64clat_destroy()
337 ipfw_reset_eaction_instance(ch, V_nat64clat_eid, cfg->no.kidx); in nat64clat_destroy()
338 SRV_OBJECT(ch, cfg->no.kidx) = NULL; in nat64clat_destroy()
339 nat64clat_detach_config(ch, cfg); in nat64clat_destroy()
342 nat64clat_free_config(cfg); in nat64clat_destroy()
390 export_stats(struct ip_fw_chain *ch, struct nat64clat_cfg *cfg, in export_stats() argument
394 __COPY_STAT_FIELD(cfg, stats, opcnt64); in export_stats()
395 __COPY_STAT_FIELD(cfg, stats, opcnt46); in export_stats()
396 __COPY_STAT_FIELD(cfg, stats, ofrags); in export_stats()
397 __COPY_STAT_FIELD(cfg, stats, ifrags); in export_stats()
398 __COPY_STAT_FIELD(cfg, stats, oerrors); in export_stats()
399 __COPY_STAT_FIELD(cfg, stats, noroute4); in export_stats()
400 __COPY_STAT_FIELD(cfg, stats, noroute6); in export_stats()
401 __COPY_STAT_FIELD(cfg, stats, noproto); in export_stats()
402 __COPY_STAT_FIELD(cfg, stats, nomem); in export_stats()
403 __COPY_STAT_FIELD(cfg, stats, dropped); in export_stats()
419 struct nat64clat_cfg *cfg; in nat64clat_stats() local
435 cfg = nat64clat_find(CHAIN_TO_SRV(ch), oh->ntlv.name, oh->ntlv.set); in nat64clat_stats()
436 if (cfg == NULL) { in nat64clat_stats()
440 export_stats(ch, cfg, &stats); in nat64clat_stats()
465 struct nat64clat_cfg *cfg; in nat64clat_reset_stats() local
476 cfg = nat64clat_find(CHAIN_TO_SRV(ch), oh->ntlv.name, oh->ntlv.set); in nat64clat_reset_stats()
477 if (cfg == NULL) { in nat64clat_reset_stats()
481 COUNTER_ARRAY_ZERO(cfg->base.stats.cnt, NAT64STATS); in nat64clat_reset_stats()
509 struct nat64clat_cfg *cfg; in destroy_config_cb() local
513 cfg = (struct nat64clat_cfg *)SRV_OBJECT(ch, no->kidx); in destroy_config_cb()
515 nat64clat_detach_config(ch, cfg); in destroy_config_cb()
516 nat64clat_free_config(cfg); in destroy_config_cb()