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

Function ipfw_config_nat

tools/ipfw/nat.c:767–952  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765}
766
767void
768ipfw_config_nat(int ac, char **av)
769{
770 ipfw_obj_header *oh;
771 struct nat44_cfg_nat *n; /* Nat instance configuration. */
772 int i, off, tok, ac1;
773 char *id, *buf, **av1, *end;
774 size_t len;
775
776 av++;
777 ac--;
778 /* Nat id. */
779 if (ac == 0)
780 errx(EX_DATAERR, "missing nat id");
781 id = *av;
782 i = (int)strtol(id, &end, 0);
783 if (i <= 0 || *end != '\0')
784 errx(EX_DATAERR, "illegal nat id: %s", id);
785 av++;
786 ac--;
787 if (ac == 0)
788 errx(EX_DATAERR, "missing option");
789
790 len = sizeof(*oh) + sizeof(*n);
791 ac1 = ac;
792 av1 = av;
793 while (ac1 > 0) {
794 tok = match_token(nat_params, *av1);
795 ac1--;
796 av1++;
797 switch (tok) {
798 case TOK_IP:
799 case TOK_IF:
800 ac1--;
801 av1++;
802 break;
803 case TOK_ALOG:
804 case TOK_DENY_INC:
805 case TOK_SAME_PORTS:
806 case TOK_SKIP_GLOBAL:
807 case TOK_UNREG_ONLY:
808 case TOK_UNREG_CGN:
809 case TOK_RESET_ADDR:
810 case TOK_ALIAS_REV:
811 case TOK_PROXY_ONLY:
812 break;
813 case TOK_REDIR_ADDR:
814 if (ac1 < 2)
815 errx(EX_DATAERR, "redirect_addr: "
816 "not enough arguments");
817 len += estimate_redir_addr(&ac1, &av1);
818 av1 += 2;
819 ac1 -= 2;
820 break;
821 case TOK_REDIR_PORT:
822 if (ac1 < 3)
823 errx(EX_DATAERR, "redirect_port: "
824 "not enough arguments");

Callers 1

main.cFile · 0.85

Calls 15

strtolFunction · 0.85
match_tokenFunction · 0.85
estimate_redir_addrFunction · 0.85
estimate_redir_portFunction · 0.85
isdigitFunction · 0.85
mallocFunction · 0.85
memsetFunction · 0.85
snprintfFunction · 0.85
inet_atonFunction · 0.85
set_addr_dynamicFunction · 0.85
setup_redir_addrFunction · 0.85
setup_redir_portFunction · 0.85

Tested by

no test coverage detected