Lines Matching refs:cfg

66 	struct nat64lsn_cfg *cfg;
68 cfg = (struct nat64lsn_cfg *)ipfw_objhash_lookup_name_type(ni, set,
71 return (cfg);
117 struct nat64lsn_cfg *cfg;
162 cfg = nat64lsn_init_instance(ch, 1 << (32 - uc->plen4));
163 strlcpy(cfg->name, uc->name, sizeof(cfg->name));
164 cfg->no.name = cfg->name;
165 cfg->no.etlv = IPFW_TLV_NAT64LSN_NAME;
166 cfg->no.set = uc->set;
168 cfg->base.plat_prefix = uc->prefix6;
169 cfg->base.plat_plen = uc->plen6;
170 cfg->base.flags = (uc->flags & NAT64LSN_FLAGSMASK) | NAT64_PLATPFX;
171 if (IN6_IS_ADDR_WKPFX(&cfg->base.plat_prefix))
172 cfg->base.flags |= NAT64_WKPFX;
174 cfg->prefix4 = addr4;
175 cfg->pmask4 = addr4 | ~mask4;
176 cfg->plen4 = uc->plen4;
178 cfg->max_chunks = uc->max_ports / NAT64_CHUNK_SIZE;
179 cfg->agg_prefix_len = uc->agg_prefix_len;
180 cfg->agg_prefix_max = uc->agg_prefix_max;
182 cfg->min_chunk = uc->min_port / NAT64_CHUNK_SIZE;
183 cfg->max_chunk = uc->max_port / NAT64_CHUNK_SIZE;
185 cfg->jmaxlen = uc->jmaxlen;
186 cfg->nh_delete_delay = uc->nh_delete_delay;
187 cfg->pg_delete_delay = uc->pg_delete_delay;
188 cfg->st_syn_ttl = uc->st_syn_ttl;
189 cfg->st_close_ttl = uc->st_close_ttl;
190 cfg->st_estab_ttl = uc->st_estab_ttl;
191 cfg->st_udp_ttl = uc->st_udp_ttl;
192 cfg->st_icmp_ttl = uc->st_icmp_ttl;
194 cfg->nomatch_verdict = IP_FW_DENY;
200 nat64lsn_destroy_instance(cfg);
204 if (ipfw_objhash_alloc_idx(CHAIN_TO_SRV(ch), &cfg->no.kidx) != 0) {
206 nat64lsn_destroy_instance(cfg);
209 ipfw_objhash_add(CHAIN_TO_SRV(ch), &cfg->no);
212 SRV_OBJECT(ch, cfg->no.kidx) = cfg;
213 nat64lsn_start_instance(cfg);
220 nat64lsn_detach_config(struct ip_fw_chain *ch, struct nat64lsn_cfg *cfg)
225 ipfw_objhash_del(CHAIN_TO_SRV(ch), &cfg->no);
226 ipfw_objhash_free_idx(CHAIN_TO_SRV(ch), cfg->no.kidx);
240 struct nat64lsn_cfg *cfg;
249 cfg = nat64lsn_find(CHAIN_TO_SRV(ch), oh->ntlv.name, oh->ntlv.set);
250 if (cfg == NULL) {
255 if (cfg->no.refcnt > 0) {
260 ipfw_reset_eaction_instance(ch, V_nat64lsn_eid, cfg->no.kidx);
261 SRV_OBJECT(ch, cfg->no.kidx) = NULL;
262 nat64lsn_detach_config(ch, cfg);
265 nat64lsn_destroy_instance(cfg);
272 export_stats(struct ip_fw_chain *ch, struct nat64lsn_cfg *cfg,
276 __COPY_STAT_FIELD(cfg, stats, opcnt64);
277 __COPY_STAT_FIELD(cfg, stats, opcnt46);
278 __COPY_STAT_FIELD(cfg, stats, ofrags);
279 __COPY_STAT_FIELD(cfg, stats, ifrags);
280 __COPY_STAT_FIELD(cfg, stats, oerrors);
281 __COPY_STAT_FIELD(cfg, stats, noroute4);
282 __COPY_STAT_FIELD(cfg, stats, noroute6);
283 __COPY_STAT_FIELD(cfg, stats, nomatch4);
284 __COPY_STAT_FIELD(cfg, stats, noproto);
285 __COPY_STAT_FIELD(cfg, stats, nomem);
286 __COPY_STAT_FIELD(cfg, stats, dropped);
288 __COPY_STAT_FIELD(cfg, stats, jcalls);
289 __COPY_STAT_FIELD(cfg, stats, jrequests);
290 __COPY_STAT_FIELD(cfg, stats, jhostsreq);
291 __COPY_STAT_FIELD(cfg, stats, jportreq);
292 __COPY_STAT_FIELD(cfg, stats, jhostfails);
293 __COPY_STAT_FIELD(cfg, stats, jportfails);
294 __COPY_STAT_FIELD(cfg, stats, jmaxlen);
295 __COPY_STAT_FIELD(cfg, stats, jnomem);
296 __COPY_STAT_FIELD(cfg, stats, jreinjected);
297 __COPY_STAT_FIELD(cfg, stats, screated);
298 __COPY_STAT_FIELD(cfg, stats, sdeleted);
299 __COPY_STAT_FIELD(cfg, stats, spgcreated);
300 __COPY_STAT_FIELD(cfg, stats, spgdeleted);
302 stats->hostcount = cfg->ihcount;
303 stats->tcpchunks = cfg->protochunks[NAT_PROTO_TCP];
304 stats->udpchunks = cfg->protochunks[NAT_PROTO_UDP];
305 stats->icmpchunks = cfg->protochunks[NAT_PROTO_ICMP];
310 nat64lsn_export_config(struct ip_fw_chain *ch, struct nat64lsn_cfg *cfg,
314 uc->flags = cfg->base.flags & NAT64LSN_FLAGSMASK;
315 uc->max_ports = cfg->max_chunks * NAT64_CHUNK_SIZE;
316 uc->agg_prefix_len = cfg->agg_prefix_len;
317 uc->agg_prefix_max = cfg->agg_prefix_max;
319 uc->jmaxlen = cfg->jmaxlen;
320 uc->nh_delete_delay = cfg->nh_delete_delay;
321 uc->pg_delete_delay = cfg->pg_delete_delay;
322 uc->st_syn_ttl = cfg->st_syn_ttl;
323 uc->st_close_ttl = cfg->st_close_ttl;
324 uc->st_estab_ttl = cfg->st_estab_ttl;
325 uc->st_udp_ttl = cfg->st_udp_ttl;
326 uc->st_icmp_ttl = cfg->st_icmp_ttl;
327 uc->prefix4.s_addr = htonl(cfg->prefix4);
328 uc->prefix6 = cfg->base.plat_prefix;
329 uc->plen4 = cfg->plen4;
330 uc->plen6 = cfg->base.plat_plen;
331 uc->set = cfg->no.set;
332 strlcpy(uc->name, cfg->no.name, sizeof(uc->name));
408 struct nat64lsn_cfg *cfg;
425 cfg = nat64lsn_find(ni, oh->ntlv.name, oh->ntlv.set);
426 if (cfg == NULL) {
430 nat64lsn_export_config(ch, cfg, uc);
438 cfg = nat64lsn_find(ni, oh->ntlv.name, oh->ntlv.set);
439 if (cfg == NULL) {
450 cfg->max_chunks = uc->max_ports / NAT64_CHUNK_SIZE;
451 cfg->jmaxlen = uc->jmaxlen;
452 cfg->nh_delete_delay = uc->nh_delete_delay;
453 cfg->pg_delete_delay = uc->pg_delete_delay;
454 cfg->st_syn_ttl = uc->st_syn_ttl;
455 cfg->st_close_ttl = uc->st_close_ttl;
456 cfg->st_estab_ttl = uc->st_estab_ttl;
457 cfg->st_udp_ttl = uc->st_udp_ttl;
458 cfg->st_icmp_ttl = uc->st_icmp_ttl;
459 cfg->base.flags &= ~NAT64LSN_FLAGSMASK;
460 cfg->base.flags |= uc->flags & NAT64LSN_FLAGSMASK;
480 struct nat64lsn_cfg *cfg;
496 cfg = nat64lsn_find(CHAIN_TO_SRV(ch), oh->ntlv.name, oh->ntlv.set);
497 if (cfg == NULL) {
502 export_stats(ch, cfg, &stats);
527 struct nat64lsn_cfg *cfg;
538 cfg = nat64lsn_find(CHAIN_TO_SRV(ch), oh->ntlv.name, oh->ntlv.set);
539 if (cfg == NULL) {
543 COUNTER_ARRAY_ZERO(cfg->base.stats.cnt, NAT64STATS);
553 export_pg_states(struct nat64lsn_cfg *cfg, struct nat64lsn_portgroup *pg,
603 get_next_idx(struct nat64lsn_cfg *cfg, uint32_t *addr, uint8_t *nat_proto,
619 if (*addr < cfg->pmask4) {
636 get_next_pg(struct nat64lsn_cfg *cfg, uint32_t *addr, uint8_t *nat_proto,
645 if (get_next_idx(cfg, addr, nat_proto, port) != 0) {
650 pg = GET_PORTGROUP(cfg, *addr, *nat_proto, *port);
663 get_first_pg(struct nat64lsn_cfg *cfg, uint32_t *addr, uint8_t *nat_proto,
668 pg = GET_PORTGROUP(cfg, *addr, *nat_proto, *port);
670 pg = get_next_pg(cfg, addr, nat_proto, port);
691 struct nat64lsn_cfg *cfg;
720 cfg = nat64lsn_find(CHAIN_TO_SRV(ch), oh->ntlv.name, oh->ntlv.set);
721 if (cfg == NULL) {
727 addr = cfg->prefix4;
731 if (addr < cfg->prefix4 || addr > cfg->pmask4) {
734 (uintmax_t)next_idx, addr, cfg->pmask4);
748 pg = get_first_pg(cfg, &addr, &nat_proto, &port);
759 pg_next = get_next_pg(cfg, &addr, &nat_proto, &port);
765 if (export_pg_states(cfg, pg, stg, sd) != 0) {
867 struct nat64lsn_cfg *cfg;
871 cfg = (struct nat64lsn_cfg *)SRV_OBJECT(ch, no->kidx);
873 nat64lsn_detach_config(ch, cfg);
874 nat64lsn_destroy_instance(cfg);