Commit Graph

15 Commits

Author SHA1 Message Date
Hiroki Sato
ef23194991 - Add IFT_L2VLAN (vlan(4)) support.
- Add -P option to support PID file.  When -a is specified /var/run/rarpd.pid
  is used, and when an interface is specified /var/run/rarpd.<ifname>.pid is
  used by default.
2012-07-09 08:11:16 +00:00
Maxime Henrion
3c322bdfbf Lower WARNS to 3 so that this still compiles on non x86 architectures. 2003-07-11 17:15:19 +00:00
Maxime Henrion
cd025b3cd7 Huge cleanup of the rarpd(8) code :
- Use getifaddrs() instead of rolling our own buggy one.  Previously,
  rarpd(8) would fail to see some interfaces because of a hardcoded limit.
  It now successfully sees any interface in the system, and this also makes
  the code _much_ simpler.
- Replace strncpy() calls with strlcpy() calls.  Some uses of strncpy()
  were bogus ; the code wasn't ensuring that the string was NUL terminated.
- Don't try to guard about select() FD_* macros being undefined.
- Use IF_NAMESIZE and ETHER_ADDR_LEN macros where appropriate.
- Add static keywords to function definitions for consistency, since
  the prototypes have it (I wonder why GCC didn't complain about this).
- Remove compat code for very old BSD versions and SunOS.
- Remove code for systems not having the dirent.h header.
- The code is now WARNS=5 clean so mark it as such.
- Don't add -DTFTP_DIR="/tftpboot" to the build command line since it's
  the default.

MFC after:	2 weeks
2003-07-11 14:13:21 +00:00
David E. O'Brien
90e655ea4e Perform a major cleanup of the usr.sbin Makefiles.
These are not perfectly in agreement with each other style-wise, but they
are orders of orders of magnitude more consistent style-wise than before.
2001-07-20 06:20:32 +00:00
Peter Pentchev
e376b9ff16 Add a -d command-line option; when used in conjunction with -f, rarpd
sends error messages to stderr, normal output to stdout, instead of
logging everything via syslog.

Turn off the FORMAT_AUDIT in the Makefile, until I can figure out how
to disable the check for one single line in the source :(

Reviewed by:	dd, silence on -audit
MFC after:	1 month
2001-06-18 06:48:33 +00:00
Peter Pentchev
f351b05a52 WARNS=2 cleanup, ANSIfication, manpage mdoc(7) cleanup.
Once again, as explained in my messages to -audit, the ANSIfication comes
as part of the preparation to add a new -d command-line flag to send
output to stdout/stderr.  That commit will come in a week, pending any
further comments/objections.  For those who have missed the -audit mails,
it's at http://people.FreeBSD.org/~roam/bsd/rarpd/usr.sbin-rarpd-d.patch

Asbestos suit:	on ;)
Reviewed by:	dd, silence on -audit
MFC after:	1 month
2001-06-11 09:29:34 +00:00
Ruslan Ermilov
345e52e742 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
Ruslan Ermilov
c73e22c3d4 Set the default manual section for usr.sbin/ to 8. 2001-03-20 18:17:26 +00:00
Peter Wemm
97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Peter Wemm
476602a9d0 Revert $FreeBSD$ to $Id$ 1997-02-22 16:15:28 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Bill Paul
867de4336b Fix up new rarpd.
This includes the following changes:

- Support for poking ARP entries into the local table is now built
  in, so the arptab.c module I hacked together is no longer needed.

- rarp_process() and rarp_reply() now accept a len argument which is
  passed down from rarp_loop() which tells rarp_reply() exactly how
  long the original RARP frame was. (Usually, it's 60 bytes, which is
  the minimum.) Previously, the length was calculated using the sum
  of sizeof(struct ether_header) + sizeof(struct ether_arp) (plus the
  ethernet frame header, I think). The result was a total packet
  length of 42 bytes. Now, rarp_reply() sends out packets that are
  the same size as those it recieves (60 bytes). This agrees with the
  behavior of rarpd on SunOS (as observed with tcpdump). The unused
  extra bytes are zeroed.
1996-11-18 22:07:41 +00:00
Bill Paul
84e41ecfbe Get rid of ether_addr.c: it's been moved to libc. Also add proper
declaration for ether_ntohost(). (Does anyone know what header file
is supposed to contain the declarations for the ether_addr functions?
I can't them in the SunOS includes anywhere.)
1995-04-02 01:35:54 +00:00
Bill Paul
112072599b Gave rarpd back the ability to poke temporary entries into the arp
table; arptab.c is really a hacked up version of arp.c that only
supports adding temporary entries. (This stuff is nasty -- I wish I
knew what was so wrong with SIOCSARP/SIOCGARP/etc... that made the
BSD developers decide to take it out.) The idea here is that the
client issuing the rarp is expected to be in the middle of booting
and would therefore be unable to answer arp queries from other machines
on the wire. Having rarpd stuff a temporary entry for the booting
host into the local arp table helps keep arp requests from going unanswered.

Also added ether_print() and ether_ntoa() to the ether_addr.c module.
Eventually I'll get ether_aton() and ether_hostton() written and
then this file can be dropped straight into libc. (Assuming no one
objects, of course. :)
1995-03-03 22:20:15 +00:00
Bill Paul
9636a39a61 Obtained from: An old BPF release packaged with the tcpdump-2.0 source code.
"Yes Virginia, there is a rarpd."

(Before anyone asks, this *not* the rarpd from NetBSD. It did come from
the same place as theirs, however.)

This is a port of the rarpd program included with the tcpdump-2.0
source code (which I finally unearthed after scrounging around
some of the darker corners of the Internet). It's as close to the
original as I could keep it except for the following changes:

- The original program was based on an older version of the Berkeley
  Packet Filter which used different filter programming instructions.
  Fortunately, an updated RARP packet filter is available right in the
  BPF man page so this was easy to fix.

- The old code didn't know how to deal with variable length addresses
  in ifreq buffers. This has been fixed.

- Some byte order weirdness had to be fixed. The sanity checks in
  rarp_check() needed some htons()es, and the rarp_reply() function
  needed to properly set the ether_type field in the ethernet header
  to ETHERTYPE_REVARP before transmitting the packet, otherwise
  the bytes in ether_type would wind up reversed. It is important to note
  that using htons(ETHERTYPE_REVARP) will not work. This is odd, because
  the NetBSD rarpd uses htons(ETHERTYPE_REVARP). (Praise be to tcpdump:
  I would never have been able to track this silliness down without it.)

- The update_arptab() function has been castrated. It depends on
  SIOCSARP which has been deprecated in 4.4BSD. The NetBSD people
  don't seem to be using this function either. It wouldn't be too
  hard to replace this with equivalent code from arp.c, but it
  might not be necessary.

- I put together an ether_ntohost() support function that allows
  both local (/etc/ethers) and NIS lookups. This stuff should go
  in libc at some point, but nothing else seems to need it for now,
  so it can wait a while.

As you may have guessed, you need to have the Berkeley Packet Filter in
your kernel in order to use this program. The good news is that together
with the recently added bootparamd, you can use finally use a FreeBSD
box to boot Sun boxes over the network. (This was my whole motivation
for getting this stuff to work: I have this one subnet that has a whole
bunch of Sun3 X-terminals on it with only two Sun4 workstations, both
of which are locked in peoples' offices. If those two machines crash
(and they do every so often) then none of the X-terms will boot. Now I
can use a spare PC that I have as a boot server. :)
1995-03-02 06:41:40 +00:00