Commit graph

258 commits

Author SHA1 Message Date
Andrey V. Elsukov 6a5d9be9fe Due to dropped mbuf in netisr queue route(8) can fall into infinity
loop of reading the rtsock's feed. When it used by some scripts,
this leads to growing number of not finished route(8) instances and
thus growing number of rtsock consumers. Add SIGALRM handler to prevent this.

Reviewed by:	melifaro
Obtained from:	Yandex LLC
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2016-07-27 08:26:34 +00:00
Glen Barber 52259a98ad MFH
Sponsored by:	The FreeBSD Foundation
2016-03-02 16:14:46 +00:00
Bryan Drewery bd18fd57db DIRDEPS_BUILD: Regenerate without local dependencies.
These are no longer needed after the recent 'beforebuild: depend' changes
and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports
skipping 'make depend'.

Sponsored by:	EMC / Isilon Storage Division
2016-02-24 17:20:11 +00:00
Glen Barber 406d87b1c3 Explicitly add more files to the 'runtime' package.
Sponsored by:	The FreeBSD Foundation
2016-02-09 20:19:31 +00:00
Ryan Stone 60d978a75b Fix /sbin/route to never look up (invalid) interface names through DNS
/sbin/route has a bug where if it is passed an interface name that does
not exist, it falls through and winds up interpreting it as a hostname.
It fails out eventually, but on a system where DNS lookup is broken you
can end up waiting for up to 60 seconds waiting for the DNS lookup to
timeout.  I'm not quite sure what happens if the DNS lookup somehow
succeeds but I doubt that can end well.

Reviewed by:	markj, cem
MFC after:	2 weeks
Sponsored by:	EMC/Isilon Storage Division
2015-09-17 16:56:49 +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
Alexander V. Chernikov 69c4b56a74 Eliminate incorrect IPv6 mask guessing:
RFC 2374 concept of 'IPv6 Aggregatable Global Unicast Address Format' was
deprecated by RFC 3587 12 years ago.

Before:

15:06 [1] edge# netstat -rn6 | grep 2a02:6b8::
2a02:6b8::/32                     2a02:978:2::1                 UGS         em0
15:06 [1] edge# route -6n get 2a02:6b8::
route: writing to routing socket: No such process

After:
15:07 [1] edge# /usr/obj/usr/src/sbin/route/route -n6 get 2a02:6b8::
   route to: 2a02:6b8::
destination: 2a02:6b8::
       mask: ffff:ffff::
    gateway: 2a02:978:2::1
        fib: 0
  interface: em0
      flags: <UP,GATEWAY,DONE,STATIC>
 recvpipe  sendpipe  ssthresh  rtt,msec    mtu        weight    expire
       0         0         0         0      1500         1         0

MFC after:	2 weeks
2015-01-16 11:17:30 +00:00
Simon J. Gerraty 9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Alexander V. Chernikov 7f948f12f6 Finish r274175: do control plane MTU tracking.
Update route MTU in case of ifnet MTU change.
Add new RTF_FIXEDMTU to track explicitly specified MTU.

Old behavior:
ifconfig em0 mtu 1500->9000 -> all routes traversing em0 do not change MTU.
User has to manually update all routes.
ifconfig em0 mtu 9000->1500 -> all routes traversing em0 do not change MTU.
However, if ip[6]_output finds route with rt_mtu > interface mtu, rt_mtu
gets updated.

New behavior:
ifconfig em0 mtu 1500->9000 -> all interface routes in all fibs gets updated
with new MTU unless RTF_FIXEDMTU flag set on them.
ifconfig em0 mtu 9000->1500 -> all routes in all fibs gets updated with new
MTU unless RTF_FIXEDMTU flag set on them AND rt_mtu is less than ifp mtu.

route add ... -mtu XXX automatically sets RTF_FIXEDMTU flag.
route change .. -mtu 0 automatically removes RTF_FIXEDMTU flag.

PR:		194238
MFC after:	1 month
CR:		D1125
2014-11-17 01:05:29 +00:00
Alexander V. Chernikov 670e8b3b8c Kill custom in_matroute() radix mathing function removing one rte mutex lock.
Initially in_matrote() in_clsroute() in their current state was introduced by
r4105 20 years ago. Instead of deleting inactive routes immediately, we kept them
in route table, setting RTPRF_OURS flag and some expire time. After that, either
GC came or RTPRF_OURS got removed on first-packet. It was a good solution
in that days (and probably another decade after that) to keep TCP metrics.
However, after moving metrics to TCP hostcache in r122922, most of in_rmx
functionality became unused. It might had been used for flushing icmp-originated
routes before rte mutexes/refcounting, but I'm not sure about that.

So it looks like this is nearly impossible to make GC do its work nowadays:

in_rtkill() ignores non-RTPRF_OURS routes.
route can only become RTPRF_OURS after dropping last reference via rtfree()
which calls in_clsroute(), which, it turn, ignores UP and non-RTF_DYNAMIC routes.

Dynamic routes can still be installed via received redirect, but they
have default lifetime (no specific rt_expire) and no one has another trie walker
to call RTFREE() on them.

So, the changelist:
* remove custom rnh_match / rnh_close matching function.
* remove all GC functions
* partially revert r256695 (proto3 is no more used inside kernel,
  it is not possible to use rt_expire from user point of view, proto3 support
  is not complete)
* Finish r241884 (similar to this commit) and remove remaining IPv6 parts

MFC after:	1 month
2014-11-11 02:52:40 +00:00
Alexander V. Chernikov c8dce4fe5a Put "break" after err() to please coverity.
Reported by:	Coverity
CID:		1250795
2014-11-04 10:21:34 +00:00
Alexander V. Chernikov ad4278e8fd Print human-readable error for "route not found" case.
Submitted by:	vsevolod (initial version)
MFC after:	2 weeks
Sponsored by:	Yandex LLC
2014-10-31 13:37:47 +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 cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Alexander V. Chernikov 3deb3649d5 Fix incorrect netmasks being passed via rtsock.
Since radix has been ignoring sa_family in passed sockaddrs,
no one ever has bothered filling valid sa_family in netmasks.
Additionally, radix adjusts sa_len field in every netmask not to
compare zero bytes at all.

This leads us to rt_mask with sa_family of AF_UNSPEC (-1) and
arbitrary sa_len field (0 for default route, for example).

However, rtsock have been passing that rt_mask intact for ages,
requiring all rtsock consumers to make ther own local hacks.
We even have unfixed on in base:

do `route -n monitor` in one window and issue `route -n get addr`
for some directly-connected address. You will probably see the following:

got message of size 304 on Thu May  8 15:06:06 2014
RTM_GET: Report Metrics: len 304, pid: 30493, seq 1, errno 0, flags:<UP,DONE,PINNED>
locks:  inits:
sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
 10.0.0.0 link#1 (255) ffff ffff ff em0:8.0.27.c5.29.d4 10.0.0.92
_________________^^^^^^^^^^^^^^^^^^

after the change:

got message of size 312 on Thu May  8 15:44:07 2014
RTM_GET: Report Metrics: len 312, pid: 2895, seq 1, errno 0, flags:<UP,DONE,PINNED>
locks:  inits:
sockaddrs: <DST,GATEWAY,NETMASK,IFP,IFA>
 10.0.0.0 link#1 255.255.255.0 em0:8.0.27.c5.29.d4 10.0.0.92
_________________^^^^^^^^^^^^^^^^^^

Sponsored by:	Yandex LLC
MFC after:	1 month
2014-05-08 11:56:06 +00:00
Warner Losh c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty 3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Bjoern A. Zeeb a780104e1f When switching variables to flags in r243185 a few cases were missed.
After r263152 this leaves unused variables if route(8) is compiled
without INET support.
Switch the remaining variable accesses to flags and remove now obsolete
variables.

Reviewed by:	glebius
MFC after:	1 week
2014-04-16 12:29:45 +00:00
Gleb Smirnoff 45c203fce2 Remove AppleTalk support.
AppleTalk was a network transport protocol for Apple Macintosh devices
in 80s and then 90s. Starting with Mac OS X in 2000 the AppleTalk was
a legacy protocol and primary networking protocol is TCP/IP. The last
Mac OS X release to support AppleTalk happened in 2009. The same year
routing equipment vendors (namely Cisco) end their support.

Thus, AppleTalk won't be supported in FreeBSD 11.0-RELEASE.
2014-03-14 06:29:43 +00:00
Gleb Smirnoff 2c284d9395 Remove IPX support.
IPX was a network transport protocol in Novell's NetWare network operating
system from late 80s and then 90s. The NetWare itself switched to TCP/IP
as default transport in 1998. Later, in this century the Novell Open
Enterprise Server became successor of Novell NetWare. The last release
that claimed to still support IPX was OES 2 in 2007. Routing equipment
vendors (e.g. Cisco) discontinued support for IPX in 2011.

Thus, IPX won't be supported in FreeBSD 11.0-RELEASE.
2014-03-14 02:58:48 +00:00
Alexander V. Chernikov 120dc21b86 Bump dates in nestat(1) and route(8) man pages.
Fix several small errors introduced by r260524.

Suggested by:	glebius
MFC after:	2 weeks
2014-01-11 09:44:00 +00:00
Alexander V. Chernikov 17ed2e8ea8 Add -4/-6 shorthand for -finet/-finet6 in route(8) and netstat(8).
MFC after:	2 weeks
2014-01-10 23:08:18 +00:00
Alexander V. Chernikov 88d2c8fc87 Do some more sanity checks in route(8): require netmask to have
the same address family as destination.

Found by:	jmg
MFC after:	2 weeks
2014-01-09 10:40:36 +00:00
Eitan Adler a1e8527fd1 route(1): Pull static data to the top of the file.
This is a pre-requisisite to some upcoming changes.

Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
Discussed on:	-hackers
2013-12-04 20:15:53 +00:00
Eitan Adler 2cd2dfc435 route(1): Pull static buffer out of the function and into function scope.
This will make it easier to link as a library.

Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
Discussed on:	-hackers
2013-12-04 20:13:29 +00:00
Eitan Adler 9474873899 route(1): Pull static buffer out of the function and into function scope.
This will make it easier to link as a library.

Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de> (older version)
Discussed on:	-hackers
2013-12-04 20:08:57 +00:00
Eitan Adler 2fc0b58544 route(1): Pull static variable out of the function and into function scope.
This will make it easier to link as a library.

Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de> (older version)
Discussed on:	-hackers
2013-12-04 20:07:34 +00:00
Eitan Adler b9f2ea4a57 route(1): Pull static buffer out of the function and into function scope.
This will make it easier to link as a library.

Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de> (older version)
Discussed on:	-hackers
2013-12-04 20:03:55 +00:00
Eitan Adler eeca71dbbf Avoid using a static buffer in atalk_ntoa. This will help allow users to call route(1) as a library.
Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de> (older version)
Discussed on:	-hackers
Reviwed by:	adri (different older version)
2013-12-04 05:06:56 +00:00
Eitan Adler 4cb3201829 Add const qualifier where appropriate
Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
2013-12-04 04:29:52 +00:00
Eitan Adler df0888760a Add const qualifier where appropriate
Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
2013-12-04 04:28:49 +00:00
Eitan Adler 9b80225631 Turn 'n' into a local variable. This is required for additional changes.
Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
2013-12-04 04:28:00 +00:00
Hiroki Sato 6c3bcdf0de Use long explicitly for the time difference. 2013-10-18 02:22:38 +00:00
Hiroki Sato de109e29ef - Add relative specification in expiration time.
- Add proto3 option for RTF_PROTO3.
- Use %lu for members of struct rt_metrics.
2013-10-17 19:04:05 +00:00
Simon J. Gerraty 3caf0790a8 Merge head@256284 2013-10-13 02:35:19 +00:00
Gleb Smirnoff 3bf351b29a When destination parameter is missing, exit with a clear synopsis,
instead of writing to kernel and printing EINVAL description.

PR:		bin/181532
Submitted by:	Kurt Jaeger <fbsd-pr opsec.eu>
Approved by:	re (hrs)
2013-10-08 08:16:17 +00:00
Simon J. Gerraty d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Hiroki Sato 15768a8b07 Fix boundary check of sockaddr array.
Reported by:	uqs
2013-08-01 04:50:46 +00:00
Hiroki Sato d2034d1b22 Fix a bug in cp += SA_SIZE() in RTA_* loop. This could prevent
RTA_IFP from displaying correctly in route get subcommand.

Spotted by:	dim
2013-07-24 04:05:48 +00:00
Hiroki Sato 9ae3241587 - Use getnameinfo() for both of AF_INET and AF_INET6 in routename().
- Add missing "static".
2013-07-21 14:27:07 +00:00
Hiroki Sato 1addf6e47a - Fix nflag in routename().
- Display a AF_LINK address in #linkN when sdl_{nlen,alen,slen) == 0 and
  sdl_index != 0.
- Reduce unnecessary loop in pmsg_addrs().
- Remove iso_ntoa().  This is not used.
2013-07-21 11:59:41 +00:00
Hiroki Sato 247ba4776c - Simplify getaddr() and print_getmsg() by using RTAX_* instead of RTA_*
as the argument.
- Reduce unnecessary loop in print_getmsg().
2013-07-20 16:46:51 +00:00
Hiroki Sato b3e0158e59 Show "default" for the zero-filled address consistently when nflag == 0. 2013-07-20 15:58:43 +00:00
Hiroki Sato 74ff9accb4 Add cast to (void *) to the following cases to suppress warnings by
-Wcast-align.  These do not increase the alignment requirement:

- rtm = (struct rt_msghdr *)(rtm + rtm->rtm_msglen)
- struct sockaddr *sa = &sa0; sX = (struct sockaddr_X *)sa
2013-07-20 15:23:42 +00:00
Hiroki Sato 8207f478fc Fix a gcc warning.
Pointy hat to:	hrs
2013-07-18 02:34:25 +00:00
Hiroki Sato 171863ac75 Use NET_RT_DUMP.0.FIB leaf node instead of setting td_proc->p_fibnum. 2013-07-17 14:15:00 +00:00
Hiroki Sato 826b6d6978 - Add support of MK_INET_SUPPORT=no.
- Fix a bug in sodump() which prevented struct sockaddr_in6 from displaying.
- Fix a bug in in fiboptlist_csv() which could cause free() of uninitialized
  pointer.
- Style cleanups:
 . Add missing "static" keywords.
 . Use an array of struct sockaddr_storage instead of sockunion for rtmsg.
 . Use err() and errx() instead of pair of fprintf(stderr, "...") + exit(1).
 . Use nitems() macro.
 . Various style(9) fixes.
2013-07-17 14:05:20 +00:00
Hiroki Sato 0365230a1a Simplify keywords.h generation. 2013-07-17 13:47:13 +00:00
Hiroki Sato 7df84c2b74 Fix a bug that the gateway address was not shown when a -gateway modifier
was used.
2013-06-09 17:40:06 +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
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 9f18a157e8 Fix -iface and -interface modifiers.
Spotted by:	Ian FREISLICH
2013-01-08 17:24:43 +00:00
Hiroki Sato 0a16fa86cb - Fix strtol() error handling.
- Add a range condition of given FIB number and the related error messages.
- Fix free() problem.

Spotted by:	Artyom Mirgorodskiy
Discussed with:	glebius
2012-12-16 23:46:59 +00:00
Hiroki Sato 0bebb5448b - Move definition of V_deembed_scopeid to scope6_var.h.
- Deembed scope id in L3 address in in6_lltable_dump().
- Simplify scope id recovery in rtsock routines.
- Remove embedded scope id handling in ndp(8) and route(8) completely.
2012-12-05 19:45:24 +00:00
Gleb Smirnoff 7c283ae860 Fix fallout from r243019, which broke parsing of shortened network
prefixes.

Reported and tested by:	delphij
2012-12-04 20:05:01 +00:00
Hiroki Sato 5c9fa630f6 - Fix LOR in sa6_recoverscope() in rt_msg2()[1].
- Check V_deembed_scopeid before checking if sa_family == AF_INET6.
- Fix scope id handing in route(8)[2] and ifconfig(8).

Reported by:	rpaulo[1], Mateusz Guzik[1], peter[2]
2012-12-04 17:12:23 +00:00
Gleb Smirnoff f1e17e139d Flush stdout after RTM_IFANNOUNCE message.
PR:		bin/151600
Submitted by:	Eric van Gyzen <eric vangyzen.net>
2012-12-04 11:10:01 +00:00
Gleb Smirnoff 3fa6535388 No need to be root when running with -t or -d. 2012-12-04 10:24:50 +00:00
Hiroki Sato 6bbfef9004 Fill sin6_scope_id in sockaddr_in6 before passing it from the kernel to
userland via routing socket or sysctl.  This eliminates the following
KAME-specific sin6_scope_id handling routine from each userland utility:

 sin6.sin6_scope_id = ntohs(*(u_int16_t *)&sin6.sin6_addr.s6_addr[2]);

This behavior can be controlled by net.inet6.ip6.deembed_scopeid.  This is
set to 1 by default (sin6_scope_id will be filled in the kernel).

Reviewed by:	bz
2012-11-17 20:19:00 +00:00
Hiroki Sato 9ba63ff592 Add -fib modifier to specify FIB number. The FIB number can be in a
comma-separated list and/or range specification:

 # route add -inet 192.0.2.0/24 198.51.100.1 -fib 1,3-5,6

Although all of the subcommands supports the modifier, "monitor" does not
support the list or range specification at this moment.

Reviewed by:	bz
2012-11-17 19:54:23 +00:00
Gleb Smirnoff 23454ad0e2 Remove remnants of classful addressing. These magic transformations
of supplied arguments is not what a modern sysadmin expect.
2012-11-14 08:05:21 +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
Joel Dahl 091eeb4841 Remove superfluous paragraph macro. 2012-03-25 09:21:09 +00:00
Joel Dahl 46b035eb2e Document the show alias and add an EXAMPLES section. 2012-03-24 06:40:41 +00:00
Hiroki Sato 87a688aaa1 Fix a possible infinite loop in "route flush" on 64-bit archs.
MFC after:	3 days
2012-02-04 17:53:22 +00:00
Hajimu UMEMOTO 324930d7f8 Handle the internal scope address representation of the KAME IPv6
stack for the node-local multicast address.

Spotted by:	Rainer Bredehorn <Bredehorn__at__gmx.de>
MFC after:	1 week
2012-01-07 09:01:19 +00:00
Gleb Smirnoff 8d5fa60980 - Fix array bounds checking. [1]
- Add message length checking.

PR:		151664 [1]
Submitted by:	Alexey Illarionov <littlesavage rambler.ru> [1]
Reviewed by:	yar
2010-12-08 15:12:37 +00:00
Gleb Smirnoff 82641e1d1a Add RTM_IEEE80211 to array of route message descriptions.
PR:		151664
Submitted by:	Alexey Illarionov <littlesavage rambler.ru>
2010-12-08 15:10:27 +00:00
Ulrich Spörlein f62e48f536 route(8): make WARNS=3 clean
- add static and const where appropriate
- check pointers against NULL
- minor styling nits
- it is actually WARNS=6 clean for non-strict alignment platforms

This is shamelessly stolen from DragonflyBSD and reduces our diff.

PR:		bin/140078
Approved by:	ed (co-mentor)
2010-02-27 10:18:33 +00:00
Kip Macy 996de02413 remove stale references to RTF_CLONING and RTF_LLINFO
MFC after:	3 days
2009-09-04 18:52:26 +00:00
Philippe Charnier 80469c1b25 ANSIfy functions declarations, adjust prototypes. Rename local variable
to not conflict with err().
2009-08-25 04:09:09 +00:00
Kip Macy 427ac07f05 Extend route command:
- add show as alias for get
	- add weights to allow mpath to do more than equal cost
	- add sticky / nostick to disable / re-enable per-connection load balancing

This adds a field to rt_metrics_lite so network bits of world will need to be re-built.

Reviewed by:	jeli & qingli
2009-04-14 23:05:36 +00:00
Randall Stewart 5412227e19 Fix broken case where caused by last patch where
a user uses 0.0.0.0/0 as an alias for default.
Obtained from:	Mykola Dzham (freebsd@levsha.org.ua)
2009-04-11 10:08:26 +00:00
Randall Stewart 5695251a13 Ok, looking at the solution a bit closer, the level
calculation was too agressive. Instead we should only
look at each nibble. This makes it so we make
10.2.0.0 become 10.2/16 NOT 10.2/17.

Need to explore the non-cidr address issue. The two
may not be seperable..

MFC after:	1 week
2009-04-06 14:27:28 +00:00
Randall Stewart 7f749ed938 Class based addressing went out in the early 90's. Basically
if a entry is not route add -net xxx/bits then we should use
the addr (xxx) to establish the number of bits by looking at
the first non-zero bit. So if we enter
route add -net 10.1.1.0 10.1.3.5
this is the same as doing
route add -net 10.1.1.0/24
Since the 8th bit (zero counting) is set to 1 we set bits
to 32-8.

Users can of course still use the /x to change this behavior
or in cases where the network is in the trailing part
of the address, a "netmask" argument can be supplied to
override what is established from the interpretation of the
address itself. e.g:

route add -net 10.1.1.8 -netmask 0xff00ffff

should overide and place the proper CIDR mask in place.

PR:		131365
MFC after:	1 week
2009-04-06 10:09:20 +00:00
Alexander Motin b814ca8a4f Fix regression introduced in rev. 173124:
0.0.0.0/1 is not the same as 0.0.0.0/0.

MFC after:	1 month
2009-01-18 11:38:35 +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
Ruslan Ermilov d4f2098b47 Fix printing of sockaddr prefixes in verbose mode.
PR:		bin/122403
Submitted by:	az
MFC after:	3 days
2008-04-10 12:16:20 +00:00
Remko Lodder 6764f54349 In route.c in newroute() there's a call to exit(0) if the command was
'get'. Since rtmsg() always gets called and returns 0 on success and -1
on failure, it's possible to exit with a suitable exit code by calling
exit(ret != 0) instead, as is done at the end of newroute().

PR:		bin/112303
Submitted by:	bruce@cran.org.uk
MFC after:	1 week
2008-03-22 12:50:43 +00:00
Mike Makonnen 5ab965347e Don't mask the address in inet_makenetandmask() according to what class
it appears to be in: there is also CIDR.

Noticed by: tegge
2007-11-04 11:12:40 +00:00
David E. O'Brien 31a1fa7932 Document -t. 2007-11-01 19:54:59 +00:00
Mike Makonnen 530378f8b9 Fix an error in bit shifting logic for network addresses. The route
command would add incorrect routing entries if network numbers weren't
fully "spelled" out according to their class. For example:
  # route add 128.0/16   (works)
  # route add 128/16     (doesn't work)
  # route add 193.0.0/24 (works)
  # route add 193/24     (doesn't work)

Also, rework the way a netmask is deduced from network number if
it [netmask] is not specified.

Submitted by:	Nuno Antunes <nuno.antunes@gmail.com> (mostly)
MFC after:	1 week
2007-10-29 00:08:24 +00:00
Yaroslav Tykhiy 491bafe5c6 Obey MK_INET6_SUPPORT.
This is also a good chance to apply style.Makefile(5) in some cases.
2006-07-27 13:26:29 +00:00
Ruslan Ermilov 259fcfd358 Document that -q option is also applicable to the "change" command.
PR:		docs/85095
Submitted by:	Rostislav Krasny
2005-10-02 12:55:34 +00:00
Anton Berezin 064b93d5ea Introduce "route del" as an alias to "route delete".
Reviewed by:	arch
2005-09-28 12:12:15 +00:00
Gleb Smirnoff 7278e14c38 - Understand EADDRINUSE, and forget EDQUOT. [1]
- Add description for EEXIST.
- Change description for ENOBUFS. Routing socket can return
  this error for many different reasons, including general
  memory shortage, mbuf memory shortage and rtentry zone.

PR:		kern/64090 [1]
2005-09-21 12:24:46 +00:00
Hajimu UMEMOTO c60a8b32a2 - do DNS lookup for symbolic names specified for a destination
or gateway.
- improves error reporting using gai_strerror(3) instead of
  printing "bad value".
- remove "0" for servname argument for getaddrinfo(3).

Submitted by:	Andreas Kohn <andreas __at__ syndrom23.de>
MFC after:	1 week
2005-05-23 14:12:32 +00:00
Hajimu UMEMOTO 4f10131848 NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 defines
NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special
for it, now.
2005-05-13 16:31:11 +00:00
Juli Mallett b894acfb2a shutdown(2)'s how argument as 0 is nowhere near as cool as SHUT_RD 2005-05-11 02:50:41 +00:00
Ruslan Ermilov 0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov 6087df9e8b Sort sections. 2005-01-18 10:09:38 +00:00
Ruslan Ermilov a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Ruslan Ermilov 214144704b Scheduled mdoc(7) sweep. 2005-01-10 16:17:34 +00:00
Bruce M Simpson fa967069e0 Fix markup: .Dv -> .Va
Update document dates.

Prodded by:	ru
2004-11-04 08:29:28 +00:00
Bruce M Simpson 2c9743caad Document the fact that blackhole routes normally need to be bound
to lo(4) interfaces to have an effect, and that this is not needed
when using IP fast forwarding.

Sponsored by:	eXtensible Open Router Project <URL:http://www.xorp.org/>
MFC after:	3 weeks
2004-11-04 02:15:03 +00:00