Commit Graph

86 Commits

Author SHA1 Message Date
Pedro F. Giffuni
8a16b7a18f General further adoption of SPDX licensing ID tags.
Mainly focus on files that use BSD 3-Clause license.

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.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.
2017-11-20 19:49:47 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +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
Hiroki Sato
373eea194d Purge varargs.h in favor of stdarg.h. 2017-01-13 08:01:27 +00:00
Hiroki Sato
1296e1b0b7 - Add static for functions and variables with internal linkage.
- Quiet down -Wcast-align warnings.
- Remove dead code.

There is no functionality change.
2017-01-13 06:22:49 +00:00
Hiroki Sato
c10340d440 - Fix dereference of NULL pointer which could cause a crash [1]
- Fix memory leak due to lack of freeaddrinfo() [2]

CID:	1018281 [1]
CID:	1225057 [2]
MFC after:	3 days
2017-01-12 18:44:58 +00:00
Alan Somers
c6e3715fbc Fix uninitialized variable CIDs in route6d
The variables in question are actually return arguments, but it's still good
form to initialize them.

Reported by:	Coverity
CID:		979679 979680
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
2017-01-12 16:22:28 +00:00
Enji Cooper
074a0dcceb Use nitems(mib) instead of hardcoding mib's length
MFC after:	3 days
2017-01-09 00:38:19 +00:00
Enji Cooper
240ecb400f Sort #includes
MFC after:	3 days
2017-01-09 00:37:09 +00:00
Enji Cooper
b3b69d9980 Clean up trailing whitespace
MFC after:	3 days
2017-01-09 00:33:27 +00:00
Don Lewis
b0882deadb Use strlcpy() instead of strncpy() when copying ifname to ensure
that it is NUL terminated.  Additional NUL padding is not required
for short names.

Reported by:	Coverity
CID:		1009974
MFC after:	1 week
2016-05-15 22:31:03 +00:00
Conrad Meyer
134fd583cb route6d(8): Fix potential double-free
In the case that the subsequent sysctl(3) call failed, 'buf' could be free(3)ed
repeatedly.  It isn't clear to me that that case is possible, but be clear and
do the right thing in case it is.

Reported by:	Coverity
CID:		272537
Sponsored by:	EMC / Isilon Storage Division
2016-05-11 22:33:20 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Gleb Smirnoff
56d5e0967c Stop including if_var.h from userland.
Sponsored by:	Nginx, Inc.
2015-04-06 09:42:23 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Hiroki Sato
d292a6c795 Recover sin6_scope_id of gateway addresses in riprecv() by using the if_index
where a RIP packet was received.  This fixes a bug which prevented gateway
addresses in fe80::/64 from being added.
2014-08-20 17:27:15 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Gleb Smirnoff
4e3f1ce854 Remove unneeded fake _KERNEL definition. 2014-03-23 09:15:14 +00:00
Gleb Smirnoff
66dcee729c Garbage collect long time obsoleted (or never used) stuff from routing API. 2014-03-15 06:49:32 +00:00
Gleb Smirnoff
af50ea380f Axe IFF_SMART. Fortunately this layering violating flag was never used,
it was just declared.
2013-11-05 12:52:56 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Joel Dahl
f5d1e6f5a3 Minor mdoc fix. 2012-11-18 16:58:08 +00:00
Hiroki Sato
0fa8505bb7 - Increase the number of retry for NET_RT_DUMP from 5 to 15.
- Use 2001:db8:: as an example instead of deprecated 3ffe:: address block.
- Add check for connected routes.
- Add support of RTM_IFANNOUNCE for dyanmically-added/removed interfaces.
- Add support of *, ?, and [ in the interface list.
- Add -P number to specify route flag which will never expire.
- Add -Q number to specify route flag which route6d will add to routes via RIP.
- Add -p pidfile to specify the process ID file.
2012-11-18 15:48:02 +00:00
Hiroki Sato
2cccf8942b Overhaul of route6d(8):
- Use queue(3) for linked-list.
- Use a consistent naming scheme for struct members.
- Use ANSI C style function declaration.
- Add check of RTM_VERSION mismatch.

There is no functional change.
2012-11-18 15:37:27 +00:00
Hiroki Sato
aef11ef65b Use sin6_scope_id instead of KAME-specific embedded scope id. 2012-11-18 15:11:47 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Ulrich Spörlein
3df5ecac8c Spelling fixes for usr.sbin/ 2011-12-30 10:58:14 +00:00
Dimitry Andric
2214781145 In usr.sbin/route6d/route6d.c, use the correct printf length modifier
for an ssize_t.

MFC after:	1 week
2011-12-18 00:03:03 +00:00
Ed Schouten
71ccf09269 The last big commit: let usr.sbin/ use WARNS=6 by default. 2010-01-02 11:07:44 +00:00
Qing Li
6e6b3f7cbc This main goals of this project are:
1. separating L2 tables (ARP, NDP) from the L3 routing tables
2. removing as much locking dependencies among these layers as
   possible to allow for some parallelism in the search operations
3. simplify the logic in the routing code,

The most notable end result is the obsolescent of the route
cloning (RTF_CLONING) concept, which translated into code reduction
in both IPv4 ARP and IPv6 NDP related modules, and size reduction in
struct rtentry{}. The change in design obsoletes the semantics of
RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland
applications such as "arp" and "ndp" have been modified to reflect
those changes. The output from "netstat -r" shows only the routing
entries.

Quite a few developers have contributed to this project in the
past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and
Andre Oppermann. And most recently:

- Kip Macy revised the locking code completely, thus completing
  the last piece of the puzzle, Kip has also been conducting
  active functional testing
- Sam Leffler has helped me improving/refactoring the code, and
  provided valuable reviews
- Julian Elischer setup the perforce tree for me and has helped
  me maintaining that branch before the svn conversion
2008-12-15 06:10:57 +00:00
Kevin Lo
784bddbc5b Cleanup of userland __P use 2007-11-07 10:53:41 +00:00
SUZUKI Shinsuke
5e5792a887 implemented more validation checks about incoming responses per RFC2080, and one additional heuristic check for safer operation.
Obtained from: KAME
MFC after: 1 week
2006-11-16 19:03:03 +00:00
Yaroslav Tykhiy
064aa4479f These IPv6-only tools have no explicit dependency on the INET6 macro.
Tested with:	cmp(1)
2006-07-27 15:31:13 +00:00
Ruslan Ermilov
6b806d21d1 Fixed the misplaced $FreeBSD$. 2005-02-09 18:07:17 +00:00
Hajimu UMEMOTO
cd8ce96d58 - need_trigger/idx should be u_int, not ssize_t.
- realloc pedant.
- set sin6_scope_id before sending (link-local/multicast) packets
- removed an incorrect comment
- don't age non-gateway host routes.
- not remove global addresses on loopback interface from routing table
  by route aging.

Obtained from:	KAME
2003-11-14 17:16:50 +00:00
Hajimu UMEMOTO
f768a332f8 - interface minimum MTU = 1280 in IPv6.
- simplify.

Obtained from:	KAME
2003-11-14 17:16:12 +00:00
Hajimu UMEMOTO
6d7256d9d6 our netstat is installed in /usr/bin. 2003-11-14 16:57:04 +00:00
SUZUKI Shinsuke
7a1413f972 fixe remote panic on short packet
Obtained from: KAME
2003-10-31 03:18:45 +00:00
Sam Leffler
d6bb3ab6ff remove unused variable
Supported by:	FreeBSD Foundation
2003-10-03 21:06:17 +00:00
Hajimu UMEMOTO
3b24803f01 rtm_seq is int, so seq/myseq should be int.
Obtained from:	KAME
MFC after:	1 week
2003-08-18 16:20:30 +00:00
Hajimu UMEMOTO
0d30357ff6 suppress outpt on dump request if -q is specified.
Obtained from:	KAME
MFC after:	1 week
2003-08-18 16:15:30 +00:00
Hajimu UMEMOTO
8ecfc219e1 atoi -> strtoul
Obtained from:	KAME
MFC after:	1 week
2003-08-18 16:09:59 +00:00
Hajimu UMEMOTO
c706c1cddc - port numbers are unsigned. use %u.
- %d is not 10 chars, but 12 chars.

Obtained from:	KAME
MFC after:	1 week
2003-08-18 15:58:23 +00:00
Hajimu UMEMOTO
651555cc54 explicitly specify IPPROTO_UDP when calling getaddrinfo().
Obtained from:	KAME
MFC after:	1 week
2003-08-18 15:54:08 +00:00