* Display an individual arp entry */
| 462 | * Display an individual arp entry |
| 463 | */ |
| 464 | static int |
| 465 | get(char *host) |
| 466 | { |
| 467 | struct sockaddr_in *addr; |
| 468 | int found; |
| 469 | |
| 470 | addr = getaddr(host); |
| 471 | if (addr == NULL) |
| 472 | return (1); |
| 473 | |
| 474 | xo_set_version(ARP_XO_VERSION); |
| 475 | xo_open_container("arp"); |
| 476 | xo_open_list("arp-cache"); |
| 477 | |
| 478 | found = search(addr->sin_addr.s_addr, print_entry); |
| 479 | |
| 480 | if (found == 0) { |
| 481 | xo_emit("{d:hostname/%s} ({d:ip-address/%s}) -- no entry", |
| 482 | host, inet_ntoa(addr->sin_addr)); |
| 483 | if (rifname) |
| 484 | xo_emit(" on {d:interface/%s}", rifname); |
| 485 | xo_emit("\n"); |
| 486 | } |
| 487 | |
| 488 | xo_close_list("arp-cache"); |
| 489 | xo_close_container("arp"); |
| 490 | xo_finish(); |
| 491 | |
| 492 | return (found == 0); |
| 493 | } |
| 494 | |
| 495 | /* |
| 496 | * Delete an arp entry |
no test coverage detected