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

Function setup_redir_addr

tools/ipfw/nat.c:353–392  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351}
352
353static int
354setup_redir_addr(char *buf, int *ac, char ***av)
355{
356 struct nat44_cfg_redir *r;
357 char *sep;
358 size_t space;
359
360 r = (struct nat44_cfg_redir *)buf;
361 r->mode = REDIR_ADDR;
362 /* Skip nat44_cfg_redir at beginning of buf. */
363 buf = &buf[sizeof(struct nat44_cfg_redir)];
364 space = sizeof(struct nat44_cfg_redir);
365
366 /* Extract local address. */
367 if (strchr(**av, ',') != NULL) {
368 struct nat44_cfg_spool *spool;
369
370 /* Setup LSNAT server pool. */
371 r->laddr.s_addr = INADDR_NONE;
372 sep = strtok(**av, ",");
373 while (sep != NULL) {
374 spool = (struct nat44_cfg_spool *)buf;
375 space += sizeof(struct nat44_cfg_spool);
376 StrToAddr(sep, &spool->addr);
377 spool->port = ~0;
378 r->spool_cnt++;
379 /* Point to the next possible nat44_cfg_spool. */
380 buf = &buf[sizeof(struct nat44_cfg_spool)];
381 sep = strtok(NULL, ",");
382 }
383 } else
384 StrToAddr(**av, &r->laddr);
385 (*av)++; (*ac)--;
386
387 /* Extract public address. */
388 StrToAddr(**av, &r->paddr);
389 (*av)++; (*ac)--;
390
391 return (space);
392}
393
394static int
395estimate_redir_port(int *ac, char ***av)

Callers 1

ipfw_config_natFunction · 0.85

Calls 3

strchrFunction · 0.85
strtokFunction · 0.85
StrToAddrFunction · 0.85

Tested by

no test coverage detected