| 351 | } |
| 352 | |
| 353 | static int |
| 354 | setup_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 | |
| 394 | static int |
| 395 | estimate_redir_port(int *ac, char ***av) |
no test coverage detected