Commit graph

52 commits

Author SHA1 Message Date
Warner Losh 0b8224d1cc Remove copyright strings ifdef'd out
We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by:		Netflix
2023-11-26 22:23:58 -07:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Gordon Bergling 107597fbd4 rarpd(8): Fix a typo in a source code comment
- s/combinataion/combination/

Obtained from:	NetBSD
MFC after:	3 days
2023-03-27 08:45:30 +02:00
Pedro F. Giffuni 9b10f59a10 SPDX: mostly fixes to previous changes.
Introduce the recently approved BSD-1-Clause and replace 0BSD which
never did fit well our use cases.
2017-12-13 16:13:17 +00:00
Pedro F. Giffuni 1de7b4b805 various: general adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.
2017-11-27 15:37:16 +00:00
Patrick Kelsey 2f8c6c0a58 Fix userland tools that don't check the format of routing socket
messages before accessing message fields that may not be present,
removing dead/duplicate/misleading code along the way.

Document the message format for each routing socket message in
route.h.

Fix a bug in usr.bin/netstat introduced in r287351 that resulted in
pointer computation with essentially random 16-bit offsets and
dereferencing of the results.

Reviewed by:	ae
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D10330
2017-04-16 19:17:10 +00:00
Don Lewis 78db15ccf7 When clearing rtmsg, pass &rtmsg to bzero() instead of the address of
just the header

Reported by:	Coverity
CID:		1007568, 1194256
MFC after:	1 week
2016-05-17 04:03:45 +00:00
Marius Strobl 220fa950ce Add some missing newlines and static declarations.
MFC after:	3 days
2013-04-07 15:33:06 +00:00
Gleb Smirnoff 9711a168b9 Retire struct sockaddr_inarp.
Since ARP and routing are separated, "proxy only" entries
don't have any meaning, thus we don't need additional field
in sockaddr to pass SIN_PROXY flag.

New kernel is binary compatible with old tools, since sizes
of sockaddr_inarp and sockaddr_in match, and sa_family are
filled with same value.

The structure declaration is left for compatibility with
third party software, but in tree code no longer use it.

Reviewed by:	ru, andre, net@
2013-01-31 08:55:21 +00:00
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
Eitan Adler 9840ec1752 Fix warning when compiling with gcc46:
error: variable 'hostname' set but not used

Approved by:	dim, cperciva (mentor, blanket for pre-mentorship already-approved commits)
MFC after:	3 days
2012-01-20 01:37:23 +00:00
Gleb Smirnoff 441238cfdc Catch up with kernel using time_uptime to drive ARP timeouts.
Noticed by:	jilles
2010-12-06 09:37:56 +00:00
Warner Losh 486c8cc4c6 Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived software
(with permission of addtional copyright holders where appropriate)
2004-08-07 04:28:56 +00:00
Joerg Wunsch d7706da39f While walking over the list of interfaces obtained from getifaddrs(3),
rarpd clobbered any AF_INET information already configured for a given
interface name, so interfaces with more than one IP address made rarpd
listen only for the last address out of all IP aliases.

I changed this, so that AF_LINK information is always collected first
(to ensure the interface name gets its link-layer address associated),
but while looking for AF_INET addresses, the configuration is cloned
if there has already been one IP address seen for that interface name.

Thus, rarpd now effectively listens on all subnets.

MFC after:	1 week
2004-04-20 13:58:14 +00:00
Joerg Wunsch 27b1d6317f Fix a typo. 2004-04-20 13:26:52 +00:00
Philippe Charnier b0fed5c6b6 Make it clear that -a flag and interface parameter are mutually exclusive 2003-08-16 22:23:16 +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
John-Mark Gurney 9c6bbd7d32 make rarpd use in_addr_t instead of u_long since this is neccessary
on 64bit platforms

ok'd by: silence
2003-06-15 03:00:22 +00:00
David E. O'Brien b728350ee6 Use __FBSDID over rcsid[]. Protect copyright[] where needed. 2003-05-03 21:06:42 +00:00
David Malone 8662984e5e Add "-t" to useage message and comment. (The -t option was added
independently by Robert, but also proposed in the PR below).

PR:		38126
Submitted by:	Josh Elsasser <jre@vineyard.net>
MFC after:	1 month
2002-09-15 15:37:50 +00:00
Ollivier Robert 80077d2cc1 Fix buildworld breakage.
Submitted by:	Maxim Konovalov <maxim@macomnet.ru>
2002-05-09 14:15:57 +00:00
Robert Watson c3ce2b2baa o Allow rarpd to accept an additional '-t directory' argument, specifying
an alternative to /tftpboot.  This is useful it you're using tftpd
  with an alternative root (using -s), and would like rarpd to respond
  selectively to RARP requests using the same criteria as tftp.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2001-11-16 16:49:21 +00:00
Matt Jacob 01a0ec6ced make it compile on alpha again 2001-07-05 16:53:49 +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
Jonathan Lemon 2b4aa63478 Comply with POSIX rules:
o Use %u for printing u_int.
    o Cast sizeof() to u_long, and print with %lu

Reviewed by: wollman
2001-06-16 18:55:13 +00:00
Jonathan Lemon 818b5b7658 Undo last braino and fix properly. 2001-06-16 06:40:03 +00:00
Jonathan Lemon f4d3963efa Fix warning:
489: warning: int format, different type arg (arg 4)
2001-06-16 06:37:04 +00:00
Bruce Evans 87c5c2d426 Fixed world breakage on systems where ntohl() doesn't return u_long
(e.g., on alphas, or even on i386's with a POSIX-200x-conformant
ntohl() (ntohl() returns uint32_t which is u_int on i386's)).

Fixed related bugs and bogons while I'm here:
- ntohl() was "fixed" for printing in 1 place by casting to
  "(unsigned int )".  This breaks the value on systems where u_int
  is smaller than uint32_t, and has 2 style bugs.
- spell u_int consistently (never use "unsigned").
- break K&R support some more (don't cast malloc()'s arg to a wrong
  type...).
2001-06-13 11:56:00 +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
Philippe Charnier b7e469ad10 Remove incorrect section name. Incomplete -Wall cleaning. 1999-11-27 17:06:40 +00:00
Peter Wemm e46b89dc93 Fix warning: return type of main' is not int' 1999-09-15 01:58:44 +00:00
Peter Wemm 97d92980a9 $Id$ -> $FreeBSD$ 1999-08-28 01:35:59 +00:00
Alexander Langer 904b32a9c9 Sync usage string with reality: removed -n, added -s. 1998-12-06 16:31:47 +00:00
Ollivier Robert 88edbb05c3 Fix bug in rarpd:
Explanation of the bug: when processing its first request, rarpd
     opens a routing socket to send requests to the arp table. It keeps
     that socket open afterwards, while waiting for new RARP requests.

     Meanwhile, the data received on the routing socket fill up until
     they are about 8Kbytes in size. Any additional data is lost.

     When rarpd receives its next RARP request, it tries to access the
     ARP table via a routing socket call, then waits for the answer to
     its own request. This answer is lost because the received data is
     already filled: when looking for the reply, rarpd receives only
     8kbytes worth of data, then loops waiting forever.

     Someone please test it on -STABLE and commit it. We can close the PR
     when testing on STABLE is done.

PR:		bin/5669
Submitted by:	Pierre Beyssac <pb@fasterix.freenix.org>
1998-04-02 13:20:15 +00:00
Bruce Evans cc03533c8d Removed most unused includes of <net/if_var.h> outside the kernel. 1998-01-16 17:38:56 +00:00
Philippe Charnier aa40a0da51 Mdoc'ify man page. 1997-10-13 11:03:36 +00:00
Warner Losh 6c3f552a31 compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-31 05:11:47 +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
Garrett Wollman 702a1d0148 Update to match changes in <net/if.h>. 1997-01-03 20:19:50 +00:00
Bill Fenner a9695b96ac Add -s flag to always supply mapping if known, ignoring the
presence or absence of files in /tftpboot.
1996-11-27 20:45:10 +00:00
Bill Fenner b60287db00 Make the man page reflect reality. Add BUGS section about DNS.
Logging cleanups (including logging the requestor's MAC address instead
 of the server's).
1996-11-27 20:42:09 +00:00
Bill Paul 7632575be6 Although I got rarpd to work, it was largely through kludgery. Bill
Fenner was kind enough to point out the error of my ways. This incorporates
diffs from him which:

- Keep everything in network order.
- Log the booted ether & ip address, instead of my address on that net
- change several exit()'s to return()'s, so that rarpd continues running
  even if it thinks it's in a weird state.

One small tweak by me: in rarp_bootable(), we have to make sure to
construct 'ipname' in host byte order (if we don't, we have to
specify /tftpboot/<remote IP in hex> with <remote IP in hex> in
network byte order, which is confusing).

Also restored use of <dirent.h> rather than <sys/dir.h> as pointed
out by bde.

Also updated the man page so that the -v flag is documented.

With any luck, I won't have to touch this thing again.
1996-11-19 23:57:06 +00:00
Bill Paul 5a0da0a5bc Dohw! Left out one important htonl() in update_arptab().
Pointed out by: Bill Fenner
1996-11-18 23:32:55 +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
Bruce Evans 0c8ea4d48c Eliminated includes of the "temporary" backwards compatibility header
<sys/dir.h> in applications.  Maintained existing (inadequate) ifdefs
for dir.h vs dirent.h in libdialog, amd and rarpd, but didn't add any
new ones.
1996-09-24 08:08:11 +00:00
Bill Paul 81ff470f7a It appears that with FreeBSD-current, we need to set the ethernet
frame type in network byte order. The htons() that wasn't needed in
2.1 is now required in 2.2.

Ultimately, this rarpd should be replaced with the more recent one
supplied with the new BPF distribution.
1996-08-24 23:05:08 +00:00
Bill Paul cef6b9bc3e Use daemon() to deamonify ourselves. 1995-07-18 21:35:32 +00:00
Rodney W. Grimes 709e8f9ae1 Remove trailing whitespace. 1995-05-30 03:57:47 +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