| 165 | } |
| 166 | |
| 167 | static int |
| 168 | nat64lsn_states_cb(ipfw_nat64lsn_cfg *cfg, const char *name, uint8_t set) |
| 169 | { |
| 170 | ipfw_obj_header *oh; |
| 171 | ipfw_obj_data *od; |
| 172 | void *buf; |
| 173 | uint64_t next_idx; |
| 174 | size_t sz; |
| 175 | |
| 176 | if (name != NULL && strcmp(cfg->name, name) != 0) |
| 177 | return (ESRCH); |
| 178 | |
| 179 | if (set != 0 && cfg->set != set) |
| 180 | return (ESRCH); |
| 181 | |
| 182 | next_idx = 0; |
| 183 | sz = 4096; |
| 184 | if ((buf = calloc(1, sz)) == NULL) |
| 185 | err(EX_OSERR, NULL); |
| 186 | do { |
| 187 | oh = (ipfw_obj_header *)buf; |
| 188 | oh->opheader.version = 1; /* Force using ov new API */ |
| 189 | od = (ipfw_obj_data *)(oh + 1); |
| 190 | nat64lsn_fill_ntlv(&oh->ntlv, cfg->name, set); |
| 191 | od->head.type = IPFW_TLV_OBJDATA; |
| 192 | od->head.length = sizeof(*od) + sizeof(next_idx); |
| 193 | *((uint64_t *)(od + 1)) = next_idx; |
| 194 | if (do_get3(IP_FW_NAT64LSN_LIST_STATES, &oh->opheader, &sz)) |
| 195 | err(EX_OSERR, "Error reading nat64lsn states"); |
| 196 | next_idx = nat64lsn_print_states(buf); |
| 197 | sz = 4096; |
| 198 | memset(buf, 0, sz); |
| 199 | } while (next_idx != 0xFF); |
| 200 | |
| 201 | free(buf); |
| 202 | return (0); |
| 203 | } |
| 204 | |
| 205 | static struct _s_x nat64statscmds[] = { |
| 206 | { "reset", TOK_RESET }, |
nothing calls this directly
no test coverage detected