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

Function nat64lsn_states_cb

tools/ipfw/nat64lsn.c:167–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167static int
168nat64lsn_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
205static struct _s_x nat64statscmds[] = {
206 { "reset", TOK_RESET },

Callers

nothing calls this directly

Calls 7

strcmpFunction · 0.85
callocFunction · 0.85
nat64lsn_fill_ntlvFunction · 0.85
do_get3Function · 0.85
nat64lsn_print_statesFunction · 0.85
memsetFunction · 0.85
freeFunction · 0.50

Tested by

no test coverage detected