MCPcopy Create free account
hub / github.com/F-Stack/f-stack / nat64lsn_config

Function nat64lsn_config

tools/ipfw/nat64lsn.c:546–650  ·  view source on GitHub ↗

* Configures existing nat64lsn instance * ipfw nat64lsn config * Request: [ ipfw_obj_header ipfw_nat64lsn_cfg ] */

Source from the content-addressed store, hash-verified

544 * Request: [ ipfw_obj_header ipfw_nat64lsn_cfg ]
545 */
546static void
547nat64lsn_config(const char *name, uint8_t set, int ac, char **av)
548{
549 char buf[sizeof(ipfw_obj_header) + sizeof(ipfw_nat64lsn_cfg)];
550 ipfw_nat64lsn_cfg *cfg;
551 ipfw_obj_header *oh;
552 size_t sz;
553 char *opt;
554 int tcmd;
555
556 if (ac == 0)
557 errx(EX_USAGE, "config options required");
558 memset(&buf, 0, sizeof(buf));
559 oh = (ipfw_obj_header *)buf;
560 cfg = (ipfw_nat64lsn_cfg *)(oh + 1);
561 sz = sizeof(buf);
562
563 nat64lsn_fill_ntlv(&oh->ntlv, name, set);
564 if (do_get3(IP_FW_NAT64LSN_CONFIG, &oh->opheader, &sz) != 0)
565 err(EX_OSERR, "failed to get config for instance %s", name);
566
567 while (ac > 0) {
568 tcmd = get_token(nat64newcmds, *av, "option");
569 opt = *av;
570 ac--; av++;
571
572 switch (tcmd) {
573 case TOK_MAX_PORTS:
574 NEED1("Max per-user ports required");
575 cfg->max_ports = nat64lsn_parse_int(*av, opt);
576 ac--; av++;
577 break;
578 case TOK_JMAXLEN:
579 NEED1("job queue length required");
580 cfg->jmaxlen = nat64lsn_parse_int(*av, opt);
581 ac--; av++;
582 break;
583 case TOK_HOST_DEL_AGE:
584 NEED1("host delete delay required");
585 cfg->nh_delete_delay = (uint16_t)nat64lsn_parse_int(
586 *av, opt);
587 ac--; av++;
588 break;
589 case TOK_PG_DEL_AGE:
590 NEED1("portgroup delete delay required");
591 cfg->pg_delete_delay = (uint16_t)nat64lsn_parse_int(
592 *av, opt);
593 ac--; av++;
594 break;
595 case TOK_TCP_SYN_AGE:
596 NEED1("tcp syn age required");
597 cfg->st_syn_ttl = (uint16_t)nat64lsn_parse_int(
598 *av, opt);
599 ac--; av++;
600 break;
601 case TOK_TCP_CLOSE_AGE:
602 NEED1("tcp close age required");
603 cfg->st_close_ttl = (uint16_t)nat64lsn_parse_int(

Callers 1

ipfw_nat64lsn_handlerFunction · 0.70

Calls 6

memsetFunction · 0.85
nat64lsn_fill_ntlvFunction · 0.85
do_get3Function · 0.85
nat64lsn_parse_intFunction · 0.85
do_set3Function · 0.85
get_tokenFunction · 0.70

Tested by

no test coverage detected