1 /* $OpenBSD: rarpd.c,v 1.80 2022/10/04 07:01:38 kn Exp $ */ 2 /* $NetBSD: rarpd.c,v 1.25 1998/04/23 02:48:33 mrg Exp $ */ 3 4 /* 5 * Copyright (c) 1990 The Regents of the University of California. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that: (1) source code distributions 10 * retain the above copyright notice and this paragraph in its entirety, (2) 11 * distributions including binary code include the above copyright notice and 12 * this paragraph in its entirety in the documentation or other materials 13 * provided with the distribution, and (3) all advertising materials mentioning 14 * features or use of this software display the following acknowledgement: 15 * ``This product includes software developed by the University of California, 16 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 17 * the University nor the names of its contributors may be used to endorse 18 * or promote products derived from this software without specific prior 19 * written permission. 20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 21 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 23 */ 24 25 /* 26 * rarpd - Reverse ARP Daemon 27 */ 28 29 #include <sys/socket.h> 30 #include <sys/ioctl.h> 31 #include <net/bpf.h> 32 #include <net/if.h> 33 #include <net/if_dl.h> 34 #include <net/if_types.h> 35 #include <netinet/in.h> 36 #include <netinet/if_ether.h> 37 38 #include <stdio.h> 39 #include <stdlib.h> 40 #include <syslog.h> 41 #include <string.h> 42 #include <stdarg.h> 43 #include <unistd.h> 44 #include <limits.h> 45 #include <errno.h> 46 #include <fcntl.h> 47 #include <netdb.h> 48 #include <arpa/inet.h> 49 #include <dirent.h> 50 #include <poll.h> 51 #include <ifaddrs.h> 52 53 /* 54 * The structures for each interface. 55 */ 56 struct if_addr { 57 in_addr_t ia_ipaddr; /* IP address of this interface */ 58 in_addr_t ia_netmask; /* subnet or net mask */ 59 struct if_addr *ia_next; 60 }; 61 62 struct if_info { 63 int ii_fd; /* BPF file descriptor */ 64 char ii_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 65 u_char ii_eaddr[ETHER_ADDR_LEN]; /* Ethernet address of this iface */ 66 struct if_addr *ii_addrs; /* Networks this interface is on */ 67 struct if_info *ii_next; 68 }; 69 /* 70 * The list of all interfaces that are being listened to. rarp_loop() 71 * "selects" on the descriptors in this list. 72 */ 73 struct if_info *iflist; 74 75 int rarp_open(char *); 76 void init_one(char *); 77 void init_all(void); 78 void rarp_loop(void); 79 void lookup_addrs(char *, struct if_info *); 80 __dead void usage(void); 81 void rarp_process(struct if_info *, u_char *); 82 void rarp_reply(struct if_info *, struct if_addr *, 83 struct ether_header *, u_int32_t, struct hostent *); 84 void arptab_init(void); 85 int arptab_set(u_char *, u_int32_t); 86 __dead void error(const char *, ...); 87 void warning(const char *, ...); 88 void debug(const char *, ...); 89 u_int32_t ipaddrtonetmask(u_int32_t); 90 int rarp_bootable(u_int32_t); 91 92 int aflag = 0; /* listen on "all" interfaces */ 93 int dflag = 0; /* print debugging messages */ 94 int fflag = 0; /* don't fork */ 95 int lflag = 0; /* log all replies */ 96 int tflag = 0; /* tftpboot check */ 97 98 #ifndef TFTP_DIR 99 #define TFTP_DIR "/tftpboot" 100 #endif 101 102 int 103 main(int argc, char *argv[]) 104 { 105 extern char *__progname; 106 int op; 107 108 /* All error reporting is done through syslogs. */ 109 openlog(__progname, LOG_PID | LOG_CONS, LOG_DAEMON); 110 111 opterr = 0; 112 while ((op = getopt(argc, argv, "adflt")) != -1) { 113 switch (op) { 114 case 'a': 115 ++aflag; 116 break; 117 case 'd': 118 ++dflag; 119 break; 120 case 'f': 121 ++fflag; 122 break; 123 case 'l': 124 ++lflag; 125 break; 126 case 't': 127 ++tflag; 128 break; 129 default: 130 usage(); 131 } 132 } 133 argc -= optind; 134 argv += optind; 135 136 if ((aflag && argc > 0) || (!aflag && argc == 0)) 137 usage(); 138 139 if (aflag) 140 init_all(); 141 else 142 while (argc > 0) { 143 init_one(argv[0]); 144 argc--; 145 argv++; 146 } 147 148 if ((!fflag) && (!dflag)) { 149 if (daemon(0, 0) == -1) 150 error("failed to daemonize: %s", strerror(errno)); 151 } 152 rarp_loop(); 153 exit(0); 154 } 155 156 /* 157 * Add 'ifname' to the interface list. Lookup its IP address and network 158 * mask and Ethernet address, and open a BPF file for it. 159 */ 160 void 161 init_one(char *ifname) 162 { 163 struct if_info *p; 164 int fd; 165 166 /* first check to see if this "if" was already opened? */ 167 for (p = iflist; p; p = p->ii_next) 168 if (!strncmp(p->ii_name, ifname, IFNAMSIZ)) 169 return; 170 171 fd = rarp_open(ifname); 172 if (fd < 0) 173 return; 174 175 p = malloc(sizeof(*p)); 176 if (p == 0) 177 error("malloc: %s", strerror(errno)); 178 179 p->ii_next = iflist; 180 iflist = p; 181 182 p->ii_fd = fd; 183 strncpy(p->ii_name, ifname, IFNAMSIZ); 184 p->ii_addrs = NULL; 185 lookup_addrs(ifname, p); 186 } 187 /* 188 * Initialize all "candidate" interfaces that are in the system 189 * configuration list. A "candidate" is up, not loopback and not 190 * point to point. 191 */ 192 void 193 init_all(void) 194 { 195 struct ifaddrs *ifap, *ifa; 196 struct sockaddr_dl *sdl; 197 198 if (getifaddrs(&ifap) != 0) 199 error("getifaddrs: %s", strerror(errno)); 200 201 for (ifa = ifap; ifa; ifa = ifa->ifa_next) { 202 if (ifa->ifa_addr == NULL) 203 continue; 204 sdl = (struct sockaddr_dl *)ifa->ifa_addr; 205 if (sdl->sdl_family != AF_LINK || sdl->sdl_type != IFT_ETHER || 206 sdl->sdl_alen != 6) 207 continue; 208 209 if ((ifa->ifa_flags & 210 (IFF_UP | IFF_LOOPBACK | IFF_POINTOPOINT)) != IFF_UP) 211 continue; 212 init_one(ifa->ifa_name); 213 } 214 freeifaddrs(ifap); 215 } 216 217 __dead void 218 usage(void) 219 { 220 (void) fprintf(stderr, "usage: rarpd [-adflt] if0 [... ifN]\n"); 221 exit(1); 222 } 223 224 static struct bpf_insn insns[] = { 225 BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 12), 226 BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ETHERTYPE_REVARP, 0, 3), 227 BPF_STMT(BPF_LD | BPF_H | BPF_ABS, 20), 228 BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, ARPOP_REVREQUEST, 0, 1), 229 BPF_STMT(BPF_RET | BPF_K, sizeof(struct ether_arp) + 230 sizeof(struct ether_header)), 231 BPF_STMT(BPF_RET | BPF_K, 0), 232 }; 233 234 static struct bpf_program filter = { 235 sizeof insns / sizeof(insns[0]), 236 insns 237 }; 238 239 /* 240 * Open a BPF file and attach it to the interface named 'device'. 241 * Set immediate mode, and set a filter that accepts only RARP requests. 242 */ 243 int 244 rarp_open(char *device) 245 { 246 int fd, immediate; 247 struct ifreq ifr; 248 u_int dlt; 249 250 if ((fd = open("/dev/bpf", O_RDWR)) == -1) 251 error("/dev/bpf: %s", strerror(errno)); 252 253 /* Set immediate mode so packets are processed as they arrive. */ 254 immediate = 1; 255 if (ioctl(fd, BIOCIMMEDIATE, &immediate) == -1) { 256 error("BIOCIMMEDIATE: %s", strerror(errno)); 257 } 258 259 (void) strncpy(ifr.ifr_name, device, sizeof ifr.ifr_name); 260 if (ioctl(fd, BIOCSETIF, (caddr_t)&ifr) == -1) { 261 if (aflag) { /* for -a skip not ethernet interfaces */ 262 close(fd); 263 return -1; 264 } 265 error("BIOCSETIF: %s", strerror(errno)); 266 } 267 268 /* 269 * Check that the data link layer is an Ethernet; this code 270 * won't work with anything else. 271 */ 272 if (ioctl(fd, BIOCGDLT, (caddr_t) &dlt) == -1) 273 error("BIOCGDLT: %s", strerror(errno)); 274 if (dlt != DLT_EN10MB) { 275 if (aflag) { /* for -a skip not ethernet interfaces */ 276 close(fd); 277 return -1; 278 } 279 error("%s is not an ethernet", device); 280 } 281 /* Set filter program. */ 282 if (ioctl(fd, BIOCSETF, (caddr_t)&filter) == -1) 283 error("BIOCSETF: %s", strerror(errno)); 284 return fd; 285 } 286 /* 287 * Perform various sanity checks on the RARP request packet. Return 288 * false on failure and log the reason. 289 */ 290 static int 291 rarp_check(u_char *p, int len) 292 { 293 struct ether_header *ep = (struct ether_header *) p; 294 struct ether_arp *ap = (struct ether_arp *) (p + sizeof(*ep)); 295 296 (void) debug("got a packet"); 297 298 if (len < sizeof(*ep) + sizeof(*ap)) { 299 warning("truncated request"); 300 return 0; 301 } 302 /* XXX This test might be better off broken out... */ 303 if (ntohs (ep->ether_type) != ETHERTYPE_REVARP || 304 ntohs (ap->arp_hrd) != ARPHRD_ETHER || 305 ntohs (ap->arp_op) != ARPOP_REVREQUEST || 306 ntohs (ap->arp_pro) != ETHERTYPE_IP || 307 ap->arp_hln != 6 || ap->arp_pln != 4) { 308 warning("request fails sanity check"); 309 return 0; 310 } 311 if (memcmp((char *) &ep->ether_shost, (char *) &ap->arp_sha, 6) != 0) { 312 warning("ether/arp sender address mismatch"); 313 return 0; 314 } 315 if (memcmp((char *) &ap->arp_sha, (char *) &ap->arp_tha, 6) != 0) { 316 warning("ether/arp target address mismatch"); 317 return 0; 318 } 319 return 1; 320 } 321 322 /* 323 * Loop indefinitely listening for RARP requests on the 324 * interfaces in 'iflist'. 325 */ 326 void 327 rarp_loop(void) 328 { 329 int cc, fd, numfd = 0, i; 330 u_int bufsize; 331 struct pollfd *pfd; 332 u_char *buf, *bp, *ep; 333 struct if_info *ii; 334 335 if (iflist == 0) 336 error("no interfaces"); 337 if (ioctl(iflist->ii_fd, BIOCGBLEN, (caddr_t)&bufsize) == -1) 338 error("BIOCGBLEN: %s", strerror(errno)); 339 340 arptab_init(); 341 342 if (tflag) 343 if (unveil(TFTP_DIR, "r") == -1) 344 error("unveil %s", TFTP_DIR); 345 if (unveil("/etc/ethers", "r") == -1) 346 error("unveil /etc/ethers"); 347 if (pledge("stdio rpath dns", NULL) == -1) 348 error("pledge"); 349 350 buf = malloc((size_t) bufsize); 351 if (buf == 0) 352 error("malloc: %s", strerror(errno)); 353 /* 354 * Initialize the set of descriptors to listen to. 355 */ 356 for (ii = iflist; ii; ii = ii->ii_next) 357 numfd++; 358 pfd = reallocarray(NULL, numfd, sizeof(*pfd)); 359 if (pfd == NULL) 360 error("reallocarray: %s", strerror(errno)); 361 for (i = 0, ii = iflist; ii; ii = ii->ii_next, i++) { 362 pfd[i].fd = ii->ii_fd; 363 pfd[i].events = POLLIN; 364 } 365 366 while (1) { 367 if (poll(pfd, numfd, -1) == -1) { 368 if (errno == EINTR) 369 continue; 370 error("poll: %s", strerror(errno)); 371 } 372 for (i = 0, ii = iflist; ii; ii = ii->ii_next, i++) { 373 if (pfd[i].revents == 0) 374 continue; 375 fd = ii->ii_fd; 376 again: 377 cc = read(fd, (char *)buf, bufsize); 378 /* Don't choke when we get ptraced */ 379 if (cc == -1 && errno == EINTR) 380 goto again; 381 if (cc == -1) 382 error("read: %s", strerror(errno)); 383 /* Loop through the packet(s) */ 384 #define bhp ((struct bpf_hdr *)bp) 385 bp = buf; 386 ep = bp + cc; 387 while (bp < ep) { 388 int caplen, hdrlen; 389 390 caplen = bhp->bh_caplen; 391 hdrlen = bhp->bh_hdrlen; 392 if (rarp_check(bp + hdrlen, caplen)) 393 rarp_process(ii, bp + hdrlen); 394 bp += BPF_WORDALIGN(hdrlen + caplen); 395 } 396 } 397 } 398 free(pfd); 399 } 400 401 /* 402 * True if this server can boot the host whose IP address is 'addr'. 403 * This check is made by looking in the tftp directory for the 404 * configuration file. 405 */ 406 int 407 rarp_bootable(u_int32_t addr) 408 { 409 struct dirent *dent; 410 char ipname[40]; 411 static DIR *dd = 0; 412 DIR *d; 413 414 (void) snprintf(ipname, sizeof ipname, "%08X", addr); 415 /* If directory is already open, rewind it. Otherwise, open it. */ 416 if ((d = dd)) 417 rewinddir(d); 418 else { 419 if (chdir(TFTP_DIR) == -1) 420 error("chdir: %s", strerror(errno)); 421 d = opendir("."); 422 if (d == 0) 423 error("opendir: %s", strerror(errno)); 424 dd = d; 425 } 426 while ((dent = readdir(d))) 427 if (strncmp(dent->d_name, ipname, 8) == 0) 428 return 1; 429 return 0; 430 } 431 432 433 /* 434 * Given a list of IP addresses, 'alist', return the first address that 435 * is on network 'net'; 'netmask' is a mask indicating the network portion 436 * of the address. 437 */ 438 static u_int32_t 439 choose_ipaddr(u_int32_t **alist, u_int32_t net, u_int32_t netmask) 440 { 441 for (; *alist; ++alist) { 442 if ((**alist & netmask) == net) 443 return **alist; 444 } 445 return 0; 446 } 447 /* 448 * Answer the RARP request in 'pkt', on the interface 'ii'. 'pkt' has 449 * already been checked for validity. The reply is overlaid on the request. 450 */ 451 void 452 rarp_process(struct if_info *ii, u_char *pkt) 453 { 454 char ename[HOST_NAME_MAX+1]; 455 u_int32_t target_ipaddr; 456 struct ether_header *ep; 457 struct ether_addr *ea; 458 struct hostent *hp; 459 struct in_addr in; 460 struct if_addr *ia; 461 462 ep = (struct ether_header *) pkt; 463 ea = (struct ether_addr *) &ep->ether_shost; 464 465 debug("%s", ether_ntoa(ea)); 466 if (ether_ntohost(ename, ea) != 0) { 467 debug("ether_ntohost failed"); 468 return; 469 } 470 if ((hp = gethostbyname(ename)) == 0) { 471 debug("gethostbyname (%s) failed", ename); 472 return; 473 } 474 475 /* Choose correct address from list. */ 476 if (hp->h_addrtype != AF_INET) 477 error("cannot handle non IP addresses"); 478 for (target_ipaddr = 0, ia = ii->ii_addrs; ia; ia = ia->ia_next) { 479 target_ipaddr = choose_ipaddr((u_int32_t **) hp->h_addr_list, 480 ia->ia_ipaddr & ia->ia_netmask, ia->ia_netmask); 481 if (target_ipaddr) 482 break; 483 } 484 485 if (target_ipaddr == 0) { 486 for (ia = ii->ii_addrs; ia; ia = ia->ia_next) { 487 in.s_addr = ia->ia_ipaddr & ia->ia_netmask; 488 warning("cannot find %s on net %s", 489 ename, inet_ntoa(in)); 490 } 491 return; 492 } 493 if (tflag == 0 || rarp_bootable(htonl(target_ipaddr))) 494 rarp_reply(ii, ia, ep, target_ipaddr, hp); 495 debug("reply sent"); 496 } 497 498 /* 499 * Lookup the ethernet address of the interface attached to the BPF 500 * file descriptor 'fd'; return it in 'eaddr'. 501 */ 502 void 503 lookup_addrs(char *ifname, struct if_info *p) 504 { 505 struct ifaddrs *ifap, *ifa; 506 struct sockaddr_dl *sdl; 507 u_char *eaddr = p->ii_eaddr; 508 struct if_addr *ia, **iap = &p->ii_addrs; 509 struct in_addr in; 510 int found = 0; 511 512 if (getifaddrs(&ifap) != 0) 513 error("getifaddrs: %s", strerror(errno)); 514 515 for (ifa = ifap; ifa; ifa = ifa->ifa_next) { 516 if (strcmp(ifa->ifa_name, ifname)) 517 continue; 518 if (ifa->ifa_addr == NULL) 519 continue; 520 sdl = (struct sockaddr_dl *) ifa->ifa_addr; 521 if (sdl->sdl_family == AF_LINK && 522 sdl->sdl_type == IFT_ETHER && sdl->sdl_alen == 6) { 523 memcpy((caddr_t)eaddr, (caddr_t)LLADDR(sdl), 6); 524 if (dflag) 525 fprintf(stderr, "%s: %x:%x:%x:%x:%x:%x\n", 526 ifa->ifa_name, 527 eaddr[0], eaddr[1], eaddr[2], 528 eaddr[3], eaddr[4], eaddr[5]); 529 found = 1; 530 } else if (sdl->sdl_family == AF_INET) { 531 ia = malloc(sizeof (struct if_addr)); 532 if (ia == NULL) 533 error("lookup_addrs: malloc: %s", 534 strerror(errno)); 535 ia->ia_next = NULL; 536 ia->ia_ipaddr = 537 ((struct sockaddr_in *) ifa->ifa_addr)-> 538 sin_addr.s_addr; 539 ia->ia_netmask = 540 ((struct sockaddr_in *) ifa->ifa_netmask)-> 541 sin_addr.s_addr; 542 /* Figure out a mask from the IP address class. */ 543 if (ia->ia_netmask == 0) 544 ia->ia_netmask = 545 ipaddrtonetmask(ia->ia_ipaddr); 546 if (dflag) { 547 in.s_addr = ia->ia_ipaddr; 548 fprintf(stderr, "\t%s\n", 549 inet_ntoa(in)); 550 } 551 *iap = ia; 552 iap = &ia->ia_next; 553 } 554 } 555 freeifaddrs(ifap); 556 if (!found) 557 error("lookup_addrs: Never saw interface `%s'!", ifname); 558 } 559 560 /* 561 * Build a reverse ARP packet and sent it out on the interface. 562 * 'ep' points to a valid ARPOP_REVREQUEST. The ARPOP_REVREPLY is built 563 * on top of the request, then written to the network. 564 * 565 * RFC 903 defines the ether_arp fields as follows. The following comments 566 * are taken (more or less) straight from this document. 567 * 568 * ARPOP_REVREQUEST 569 * 570 * arp_sha is the hardware address of the sender of the packet. 571 * arp_spa is undefined. 572 * arp_tha is the 'target' hardware address. 573 * In the case where the sender wishes to determine his own 574 * protocol address, this, like arp_sha, will be the hardware 575 * address of the sender. 576 * arp_tpa is undefined. 577 * 578 * ARPOP_REVREPLY 579 * 580 * arp_sha is the hardware address of the responder (the sender of the 581 * reply packet). 582 * arp_spa is the protocol address of the responder (see the note below). 583 * arp_tha is the hardware address of the target, and should be the same as 584 * that which was given in the request. 585 * arp_tpa is the protocol address of the target, that is, the desired address. 586 * 587 * Note that the requirement that arp_spa be filled in with the responder's 588 * protocol is purely for convenience. For instance, if a system were to use 589 * both ARP and RARP, then the inclusion of the valid protocol-hardware 590 * address pair (arp_spa, arp_sha) may eliminate the need for a subsequent 591 * ARP request. 592 */ 593 void 594 rarp_reply(struct if_info *ii, struct if_addr *ia, struct ether_header *ep, 595 u_int32_t ipaddr, struct hostent *hp) 596 { 597 struct ether_arp *ap = (struct ether_arp *) (ep + 1); 598 int len, n; 599 600 /* 601 * Poke the kernel arp tables with the ethernet/ip address 602 * combination given. When processing a reply, we must 603 * do this so that the booting host (i.e. the guy running 604 * rarpd), won't try to ARP for the hardware address of the 605 * guy being booted (he cannot answer the ARP). 606 */ 607 if (arptab_set((u_char *)&ap->arp_sha, ipaddr) > 0) 608 syslog(LOG_ERR, "couldn't update arp table"); 609 610 /* Build the rarp reply by modifying the rarp request in place. */ 611 ep->ether_type = htons(ETHERTYPE_REVARP); 612 ap->ea_hdr.ar_hrd = htons(ARPHRD_ETHER); 613 ap->ea_hdr.ar_pro = htons(ETHERTYPE_IP); 614 ap->arp_op = htons(ARPOP_REVREPLY); 615 616 memcpy((char *) &ep->ether_dhost, (char *) &ap->arp_sha, 6); 617 memcpy((char *) &ep->ether_shost, (char *) ii->ii_eaddr, 6); 618 memcpy((char *) &ap->arp_sha, (char *) ii->ii_eaddr, 6); 619 620 memcpy((char *) ap->arp_tpa, (char *) &ipaddr, 4); 621 /* Target hardware is unchanged. */ 622 memcpy((char *) ap->arp_spa, (char *) &ia->ia_ipaddr, 4); 623 624 if (lflag) { 625 struct ether_addr ea; 626 627 memcpy(&ea.ether_addr_octet, &ap->arp_sha, 6); 628 syslog(LOG_INFO, "%s asked; %s replied", hp->h_name, 629 ether_ntoa(&ea)); 630 } 631 632 len = sizeof(*ep) + sizeof(*ap); 633 n = write(ii->ii_fd, (char *) ep, len); 634 if (n != len) 635 warning("write: only %d of %d bytes written", n, len); 636 } 637 /* 638 * Get the netmask of an IP address. 639 */ 640 u_int32_t 641 ipaddrtonetmask(u_int32_t addr) 642 { 643 if (IN_CLASSA(addr)) 644 return IN_CLASSA_NET; 645 if (IN_CLASSB(addr)) 646 return IN_CLASSB_NET; 647 if (IN_CLASSC(addr)) 648 return IN_CLASSC_NET; 649 error("unknown IP address class: %08X", addr); 650 } 651 652 void 653 warning(const char *fmt,...) 654 { 655 va_list ap; 656 657 if (dflag) { 658 (void) fprintf(stderr, "rarpd: warning: "); 659 va_start(ap, fmt); 660 (void) vfprintf(stderr, fmt, ap); 661 va_end(ap); 662 (void) fprintf(stderr, "\n"); 663 } 664 va_start(ap, fmt); 665 vsyslog(LOG_ERR, fmt, ap); 666 va_end(ap); 667 } 668 669 __dead void 670 error(const char *fmt,...) 671 { 672 va_list ap; 673 674 if (dflag) { 675 (void) fprintf(stderr, "rarpd: error: "); 676 va_start(ap, fmt); 677 (void) vfprintf(stderr, fmt, ap); 678 va_end(ap); 679 (void) fprintf(stderr, "\n"); 680 } 681 va_start(ap, fmt); 682 vsyslog(LOG_ERR, fmt, ap); 683 va_end(ap); 684 exit(1); 685 } 686 687 void 688 debug(const char *fmt,...) 689 { 690 va_list ap; 691 692 if (dflag) { 693 va_start(ap, fmt); 694 (void) fprintf(stderr, "rarpd: "); 695 (void) vfprintf(stderr, fmt, ap); 696 va_end(ap); 697 (void) fprintf(stderr, "\n"); 698 } 699 } 700