| 88 | */ |
| 89 | #define nptv6_check_name table_check_name |
| 90 | void |
| 91 | ipfw_nptv6_handler(int ac, char *av[]) |
| 92 | { |
| 93 | const char *name; |
| 94 | int tcmd; |
| 95 | uint8_t set; |
| 96 | |
| 97 | if (g_co.use_set != 0) |
| 98 | set = g_co.use_set - 1; |
| 99 | else |
| 100 | set = 0; |
| 101 | ac--; av++; |
| 102 | |
| 103 | NEED1("nptv6 needs instance name"); |
| 104 | name = *av; |
| 105 | if (nptv6_check_name(name) != 0) { |
| 106 | if (strcmp(name, "all") == 0) { |
| 107 | name = NULL; |
| 108 | } else |
| 109 | errx(EX_USAGE, "nptv6 instance name %s is invalid", |
| 110 | name); |
| 111 | } |
| 112 | ac--; av++; |
| 113 | NEED1("nptv6 needs command"); |
| 114 | |
| 115 | tcmd = get_token(nptv6cmds, *av, "nptv6 command"); |
| 116 | if (name == NULL && tcmd != TOK_DESTROY && tcmd != TOK_LIST) |
| 117 | errx(EX_USAGE, "nptv6 instance name required"); |
| 118 | switch (tcmd) { |
| 119 | case TOK_CREATE: |
| 120 | ac--; av++; |
| 121 | nptv6_create(name, set, ac, av); |
| 122 | break; |
| 123 | case TOK_LIST: |
| 124 | nptv6_foreach(nptv6_show_cb, name, set, 1); |
| 125 | break; |
| 126 | case TOK_DESTROY: |
| 127 | if (name == NULL) |
| 128 | nptv6_foreach(nptv6_destroy_cb, NULL, set, 0); |
| 129 | else |
| 130 | nptv6_destroy(name, set); |
| 131 | break; |
| 132 | case TOK_STATS: |
| 133 | ac--; av++; |
| 134 | if (ac == 0) { |
| 135 | nptv6_stats(name, set); |
| 136 | break; |
| 137 | } |
| 138 | tcmd = get_token(nptv6statscmds, *av, "stats command"); |
| 139 | if (tcmd == TOK_RESET) |
| 140 | nptv6_reset_stats(name, set); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | |
| 145 | static void |
no test coverage detected