| 357 | } |
| 358 | |
| 359 | static void |
| 360 | in6_getaddr(const char *s, int which) |
| 361 | { |
| 362 | struct sockaddr_in6 *sin = sin6tab[which]; |
| 363 | #ifndef FSTACK |
| 364 | struct addrinfo hints, *res; |
| 365 | int error = -1; |
| 366 | #endif |
| 367 | |
| 368 | newaddr &= 1; |
| 369 | |
| 370 | sin->sin6_len = sizeof(*sin); |
| 371 | if (which != MASK) |
| 372 | sin->sin6_family = AF_INET6; |
| 373 | |
| 374 | if (which == ADDR) { |
| 375 | char *p = NULL; |
| 376 | if((p = strrchr(s, '/')) != NULL) { |
| 377 | *p = '\0'; |
| 378 | in6_getprefix(p + 1, MASK); |
| 379 | explicit_prefix = 1; |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | #ifdef FSTACK |
| 384 | if (inet_pton(AF_INET6_LINUX, s, &sin->sin6_addr) != 1) |
| 385 | errx(1, "%s: bad value", s); |
| 386 | return; |
| 387 | #else |
| 388 | if (sin->sin6_family == AF_INET6) { |
| 389 | bzero(&hints, sizeof(struct addrinfo)); |
| 390 | hints.ai_family = AF_INET6; |
| 391 | error = getaddrinfo(s, NULL, &hints, &res); |
| 392 | if (error != 0) { |
| 393 | if (inet_pton(AF_INET6, s, &sin->sin6_addr) != 1) |
| 394 | errx(1, "%s: bad value", s); |
| 395 | } else { |
| 396 | bcopy(res->ai_addr, sin, res->ai_addrlen); |
| 397 | freeaddrinfo(res); |
| 398 | } |
| 399 | } |
| 400 | #endif |
| 401 | } |
| 402 | |
| 403 | static int |
| 404 | prefix(void *val, int size) |
nothing calls this directly
no test coverage detected