diff -u --new-file rarpd-ss981107/Makefile rarpd-p3/Makefile --- rarpd-ss981107/Makefile Sat Nov 7 06:29:54 1998 +++ rarpd-p3/Makefile Sat Jun 3 12:43:45 2000 @@ -1,5 +1,6 @@ CC=gcc CFLAGS=-O2 -Wall -g $(DEFINES) +PREFIX:=/usr OBJ=rarpd.o ethernet.o @@ -9,3 +10,6 @@ clean: rm -f $(OBJ) rarpd + +install: + install -s -u root -m 0775 rarpd ${PREFIX}/sbin diff -u --new-file rarpd-ss981107/README rarpd-p3/README --- rarpd-ss981107/README Mon Nov 9 04:59:54 1998 +++ rarpd-p3/README Sat Jun 3 22:20:26 2000 @@ -1,3 +1,5 @@ +The following is the original README from ANK's rarpd-ss981107. +---------------------------------------------------------------- This is user level rarpd daemon. Options: diff -u --new-file rarpd-ss981107/rarpd.8 rarpd-p3/rarpd.8 --- rarpd-ss981107/rarpd.8 Wed Dec 31 16:00:00 1969 +++ rarpd-p3/rarpd.8 Sat Jun 3 15:27:34 2000 @@ -0,0 +1,81 @@ +.TH rarpd 8 +.SH NAME +rarpd \- Serve rarp requests +.SH SYNOPSIS +rarpd [-a] [-A] [-d] [-o] [-v] [-b tftpdir] [-e] interface +.SH DESCRIPTION +rarpd serves reverse arp requests on interface. +It is a replacement for the kernel +RARP in Linux 2.2 and earlier releases. It is +used to translate MAC addresses into IP addresses. The mapping is read from +.I /etc/ethers. +See +.BR ethers(5) +for more information. + +Normally only hosts that have an file named after their hostname in the +.I /etc/tftpboot +directory are served. This check can be turned off with +.I -e. + +For rarpd to work +.B CONFIG_PACKET +must be enabled in the kernel. + +.SH OPTIONS +.TP +.B \-a +Listen on all interfaces instead of on only on the specified one. +.TP +.B \-A +Listen to RARP requests sent in packets with the ARP protocol too. +This is inefficient with a kernel without +.B CONFIG_FILTER +compiled in. Only IPv4 addresses are supported. The kernel's ARP table +is updated when a request is processed. +.TP +.B \-b tftpdir +Use another dir than +.I /etc/tftpboot +.TP +.B \-d +Don't go into background. +.TP +.B \-e +Don't check +.I /etc/tftpboot +and answer always instead. +.TP +.B \-o +Answer for offlink addresses too. Normally only mac addresses that map to +directly connected networks are served. The first IP address of the first +configured interface is used in this case as ARP source address. +.TP +.B \-v +Be verbose. + +.SH SIGNALS +.TP SIGHUP +Reread configuration files. + +.SH FILES +/etc/ethers +Ethernet mappings table. +.TP +/var/lib/rarp +Maintained by +.BR rarp(8). +Same format as +.BR ethers(5). + +.SH BUGS +\-e should be default. + +.SH VERSIONS +This program requires Linux 2.2 and up and working packet sockets. + +.SH SEE ALSO +.BR ethers(5) + +.SH AUTHORS +Program by Alexey Kuznetsov. Man page by Andi Kleen. diff -u --new-file rarpd-ss981107/rarpd.c rarpd-p3/rarpd.c --- rarpd-ss981107/rarpd.c Sat Jun 3 12:49:46 2000 +++ rarpd-p3/rarpd.c Sat Jun 3 12:48:06 2000 @@ -26,9 +26,16 @@ #include #include #include +#include /* needed for */ +/* #include */ /* On SuSE 6.3 use this (from ak) */ #include +#include /* ETH_P_RARP and so on. */ #include +#ifndef MSG_DONTWAIT +#define MSG_DONTWAIT 0x40 /* Nonblocking io */ +#endif + int do_reload = 1; int debug; @@ -51,12 +58,12 @@ int hatype; unsigned char lladdr[16]; unsigned char name[IFNAMSIZ]; - struct ifaddr *ifa_list; + struct ifadr *ifa_list; } *ifl_list; -struct ifaddr +struct ifadr /* struct ifaddr leaks from kernel and conflicts. */ { - struct ifaddr *next; + struct ifadr *next; __u32 prefix; __u32 mask; __u32 local; @@ -75,8 +82,7 @@ void usage() { - fprintf(stderr, "Usage: rarpd [ -dveaA ] [ -b tftpdir ] " - "[ interface ]\n"); + fprintf(stderr, "Usage: rarpd [ -dveaA ] [ -b tftpdir ] [ interface]\n"); exit(1); } @@ -89,7 +95,7 @@ int fd; struct ifreq *ifrp, *ifend; struct iflink *ifl; - struct ifaddr *ifa; + struct ifadr *ifa; struct ifconf ifc; struct ifreq ibuf[256]; @@ -180,7 +186,7 @@ if (ifa == NULL) { if (mask == 0 || prefix == 0) continue; - ifa = (struct ifaddr*)malloc(sizeof(*ifa)); + ifa = (struct ifadr*)malloc(sizeof(*ifa)); memset(ifa, 0, sizeof(*ifa)); ifa->local = addr; ifa->prefix = prefix; @@ -236,10 +242,10 @@ return dent != NULL; } -struct ifaddr *select_ipaddr(int ifindex, __u32 *sel_addr, __u32 **alist) +struct ifadr *select_ipaddr(int ifindex, __u32 *sel_addr, __u32 **alist) { struct iflink *ifl; - struct ifaddr *ifa; + struct ifadr *ifa; int retry = 0; int i; @@ -295,7 +301,7 @@ if (r == NULL) { if (hatype == ARPHRD_ETHER && halen == 6) { - struct ifaddr *ifa; + struct ifadr *ifa; struct hostent *hp; char ename[256]; static struct rarp_map emap = { @@ -364,7 +370,7 @@ { __u32 laddr = 0; struct iflink *ifl; - struct ifaddr *ifa; + struct ifadr *ifa; for (ifl=ifl_list; ifl; ifl = ifl->next) if (ifl->index == ifindex)