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

Function get

tools/ndp/ndp.c:533–564  ·  view source on GitHub ↗

* Display an individual neighbor cache entry */

Source from the content-addressed store, hash-verified

531 * Display an individual neighbor cache entry
532 */
533static void
534get(char *host)
535{
536 struct sockaddr_in6 *sin = &sin_m;
537 struct addrinfo hints, *res;
538 int gai_error;
539
540 sin_m = blank_sin;
541 bzero(&hints, sizeof(hints));
542 hints.ai_family = AF_INET6;
543 gai_error = getaddrinfo(host, NULL, &hints, &res);
544 if (gai_error) {
545 fprintf(stderr, "ndp: %s: %s\n", host,
546 gai_strerror(gai_error));
547 return;
548 }
549 sin->sin6_addr = ((struct sockaddr_in6 *)res->ai_addr)->sin6_addr;
550 sin->sin6_scope_id =
551 ((struct sockaddr_in6 *)res->ai_addr)->sin6_scope_id;
552 dump(sin, 0);
553 if (found_entry == 0) {
554#ifndef FSTACK
555 getnameinfo((struct sockaddr *)sin, sin->sin6_len, host_buf,
556 sizeof(host_buf), NULL ,0,
557 (nflag ? NI_NUMERICHOST : 0));
558#else
559 inet_ntop(AF_INET6_LINUX, &sin->sin6_addr, host_buf, sizeof(host_buf));
560#endif
561 printf("%s (%s) -- no entry\n", host, host_buf);
562 exit(1);
563 }
564}
565
566/*
567 * Delete a neighbor cache entry

Callers 1

mainFunction · 0.70

Calls 6

bzeroFunction · 0.85
getaddrinfoFunction · 0.85
gai_strerrorFunction · 0.85
inet_ntopFunction · 0.85
dumpFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected