Commit graph

258 commits

Author SHA1 Message Date
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
Ruslan Ermilov 9806e23132 Mechanically kill hard sentence breaks. 2004-07-02 21:45:06 +00:00
Bruce M Simpson 3a7d7a8b39 When parsing an argument as an address in getaddr(), heed the -host option
in all cases.  The failure mode in the PR is easily reproducible without
this patch.

PR:		bin/43139
2004-06-16 06:29:41 +00:00
Ruslan Ermilov d04b5dfe6c Assorted markup, grammar, and spelling fixes. 2004-05-17 08:35:43 +00:00
Christian S.J. Peron 9251dd77ca Teach route(8) how to deal with root being in a prison. If prison
root is allowed to create raw sockets, then they will be able to create
routing sockets, too.  However prison-root is not able to manipulate
routing tables.  So when route(8) attempts to write to a routing
socket and recieves EPERM from the kernel, exit rather than moving
on with execution.

Approved by:    bmilekic (mentor)
2004-05-07 15:33:17 +00:00
Andre Oppermann 9063f422e2 Link state change notification of ethernet media to the routing socket.
o Print the link state for interface messages in monitor mode.

No objections by:	sam, wpaul, ru, bms
Brucification by:	bde
2004-05-03 16:30:32 +00:00
Doug Ambrisko 41b0ee744a For both ifconfig and route if we didn't get enough memory from the
prior sysctl due to the structure growing between calls try again.

Also try again for deleting routes if things fail.  We've seen
route -f fail this way which does not actually flush all routes.
This fixes it.  It will whine but it will do the work.

PR:		56732
Obtained from:	IronPort
2004-04-30 22:34:12 +00:00
Luigi Rizzo 0b46c08590 Replace ROUNDUP/ADVANCE with SA_SIZE 2004-04-13 11:24:43 +00:00
Mark Murray 4c723140a4 Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp
2004-04-09 19:58:40 +00:00
Johan Karlsson 604d24db95 style.Makefile(5):
Use WARNS?= instead of WARNS=.
2004-02-23 20:25:27 +00:00
Hajimu UMEMOTO 711eaadb3c link-local multicast address must be converted to KAME specific
embeded scopeid form.

Reported by:	dwmalone
MFC after:	3 days
2003-12-07 11:11:26 +00:00
Christian Brueffer 76a8862646 Add a describtion for the '-d' flag
While I'm here, add a missing comma

PR:		41787
Obtained from:	OpenBSD
MFC after:	5 days
2003-11-10 14:28:33 +00:00
Bruce M Simpson a441e6c4c5 Add the -xresolve flag to the route(8) man page.
Reviewed by:	ru
2003-09-26 17:03:09 +00:00
Andrey A. Chernov 90862ca23d LANG->LC_ALL
Pointed by:     ru
2003-08-04 21:31:53 +00:00
Andrey A. Chernov b13fdf9999 Fix problem differently, use 
LANG=C tr 'a-z' 'A-Z'                                                         
for hypotetical case that script may generate non-ascii characters
2003-08-04 15:25:39 +00:00
Andrey A. Chernov 7f0ea49c84 Use tr '[:lower:]' '[:upper:]' to work with any locale 2003-08-04 14:32:56 +00:00
Ruslan Ermilov 1becd59e62 There is an undocument feature that ``route -vnd flush'' prints
a nice dump of the entire routing table.  Allow non-root users
to see it too.
2003-04-16 12:06:53 +00:00
Peter Wemm 059c32d2eb Kill #ifdef NS code 2003-03-05 19:18:05 +00:00
Kelly Yancey ed92abc56b Since route(8) itself is no longer setuid, we can get a meaningful
answer for the euid.  As a result, fix it such that setuid scripts or
programs may call route(8) to do work on their behalf.

Reviewed by:	ru
MFC after:	3 days
2003-01-25 01:28:11 +00:00
Philippe Charnier 629e80effb The .Nm utility. 2002-07-06 19:35:14 +00:00
Hajimu UMEMOTO 56c5d32d37 Don't have -prefixlen 128 on host routes.
Obtained from:	KAME
2002-06-08 19:49:22 +00:00
Garrett Wollman 5c7417c4d1 Avoid construction which results in label at end of block. 2002-05-30 21:41:42 +00:00
Ruslan Ermilov 999ffea58a Respect -q with "add" and "delete". Document who respects -q.
PR:		bin/38531
2002-05-25 12:51:34 +00:00
Hajimu UMEMOTO 720bbc8244 Allow prefix/prefixlen syntax for IPv6 to have consistency
with IPv4.
2002-05-21 18:11:31 +00:00
Hajimu UMEMOTO 188450c746 Have RTF_HOST for /128 destionation. 2002-05-21 11:43:53 +00:00
Hajimu UMEMOTO 5818927a00 Try to guess prefixlen for guessable cases.
- /0 if matches ::/128
- /64 if matches 2000::/3 and lowermost 64 bit is all 0
- /128 if matches 2000::/3 and lowermost 64 bit is non-zero 0

Obtained from:	KAME/NetBSD
2002-05-20 15:01:19 +00:00
Ruslan Ermilov df422a1217 Removed the cruft that became cruft after rev. 1.4.
Fixed CLEANFILES.
2002-04-12 11:12:37 +00:00
Warner Losh d476a036e2 o remove __P
o remove main prototype
2002-03-21 13:20:49 +00:00
David E. O'Brien 3d438ad61f Remove 'register' keyword.
It does not help modern compilers, and some may take some hit from it.
(I also found several functions that listed *every* of its 10 local vars with
 "register" -- just how many free registers do people think machines have?)
2002-03-20 17:55:10 +00:00
Ruslan Ermilov 7b6edd044b Introduce an interface announcement message for the routing
socket so that routing daemons and other interested parties
know when an interface is attached/detached.

PR:		kern/33747
Obtained from:	NetBSD
MFC after:	2 weeks
2002-01-18 14:33:04 +00:00
David E. O'Brien 2d68bf45bf Default to WARNS=2.
Binary builds that cannot handle this must explicitly set WARNS=0.

Reviewed by:	mike
2001-12-04 02:19:58 +00:00
Ruslan Ermilov 5acabd8cdd Bring in latest CSRG revisions to this file. 2001-10-17 09:11:23 +00:00
Ruslan Ermilov 162c0b2eff Synch with NetBSD and OpenBSD.
Allow non-superuser to open, listen to, and send safe commands on the
routing socket.  Superuser priviledge is required for all commands
but RTM_GET.

Lose `setuid root' bit of route(8).

Reviewed by:	wollman, dd
2001-08-31 12:31:09 +00:00
Brian Somers 9cfe90fe1f Handle snprintf() returning < 0 (not just -1)
MFC after:	2 weeks
2001-08-20 14:53:05 +00:00
Brian Somers 327e849ae1 Handle snprintf() returning -1.
MFC after:	2 weeks
2001-08-20 12:56:45 +00:00
Ruslan Ermilov d628d776c4 mdoc(7) police: utilize the new .Ex macro. 2001-08-15 09:09:47 +00:00
Ruslan Ermilov c4d9468ea0 mdoc(7) police:
Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.
2001-08-07 15:48:51 +00:00
Dima Dorfman 7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Ruslan Ermilov 1ce90245fb Due to the documented bug in inet_aton(3), it wasn't possible
to use 0xffffffff (INADDR_NONE) as a netmask value.  The fix
is to use inet_addr(3) which doesn't suffer from this problem.

PR:		bin/28873

Also, while here, fixed the bug when netmask value was ignored
(RTF_HOST flag was set) if the "destination gateway netmask"
syntax is used, e.g. ``route add 1.2.3.4 127.1 255.255.255.255''.
2001-07-11 16:11:15 +00:00
Ruslan Ermilov 5521ff5a4d mdoc(7) police: sort SEE ALSO xrefs (sort -b -f +2 -3 +1 -2). 2001-07-06 16:46:48 +00:00
Ruslan Ermilov 1c59bf7de3 Allow route(8) to create "proxy only" published ARP entries.
PR:		bin/12357
Submitted by:	Craig Leres <leres@ee.lbl.gov>
2001-06-12 13:31:53 +00:00
Ruslan Ermilov 86cd74127c Fixed the -iface breakage introduced with the latest KAME merge
in revision 1.48.  It is pretty valid and often feasible to use
a non-point-to-point interface as the gateway.  One might, for
example, use this to route some hosts through an ARP on a local
interface, without having to assign an additional IP address:

Script started on Tue Jun 12 16:16:09 2001
# ifconfig rl0 inet
rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
	inet 192.168.4.115 netmask 0xffffff00 broadcast 192.168.4.255
# netstat -arn -finet | grep -w rl0
192.168.4          link#1             UC          3        0     rl0 =>
192.168.4.65       0:d0:b7:16:9c:c6   UHLW        1        0     rl0   1197
# route add -net 192.168.100 -iface rl0
add net 192.168.100: gateway rl0
# ping 192.168.100.1
PING 192.168.100.1 (192.168.100.1): 56 data bytes
64 bytes from 192.168.100.1: icmp_seq=0 ttl=255 time=0.551 ms
64 bytes from 192.168.100.1: icmp_seq=1 ttl=255 time=0.268 ms
^C
--- 192.168.100.1 ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
round-trip min/avg/max/stddev = 0.268/0.410/0.551/0.142 ms
# netstat -arn -finet | grep -w rl0
192.168.4          link#1             UC          3        0     rl0 =>
192.168.4.65       0:d0:b7:16:9c:c6   UHLW        1        0     rl0   1165
192.168.100        link#1             UCSc        1        0     rl0 =>
192.168.100.1      0:d0:b7:16:9c:c6   UHLW        1        4     rl0   1192

Script done on Tue Jun 12 16:17:12 2001
2001-06-12 13:23:43 +00:00
Hajimu UMEMOTO 3384154590 Sync with recent KAME.
This work was based on kame-20010528-freebsd43-snap.tgz and some
critical problem after the snap was out were fixed.
There are many many changes since last KAME merge.

TODO:
  - The definitions of SADB_* in sys/net/pfkeyv2.h are still different
    from RFC2407/IANA assignment because of binary compatibility
    issue.  It should be fixed under 5-CURRENT.
  - ip6po_m member of struct ip6_pktopts is no longer used.  But, it
    is still there because of binary compatibility issue.  It should
    be removed under 5-CURRENT.

Reviewed by:	itojun
Obtained from:	KAME
MFC after:	3 weeks
2001-06-11 12:39:29 +00:00
Ruslan Ermilov 1d36c8992d When changing an indirect route, kernel routing code allocates
a route to the gateway and caches it in the route structure.
It may happen (if the routing table is screwed) that the gateway
route is the same route as the one being modified, in which case
a kernel reports EDQUOT.  Be more verbose about this:

# route add -net 10 192.168.4.65
add net 10: gateway 192.168.4.65
# netstat -rn -finet
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use     Netif Expire
default            192.168.4.65       UGSc        1        7      rl0
10                 192.168.4.65       UGSc        0        0      rl0
127.0.0.1          127.0.0.1          UH          0      178      lo0
192.168.4          link#1             UC          2        0      rl0 =>
192.168.4.65       0:d0:b7:16:9c:c6   UHLW        2        0      rl0   1123

Before:

# route change -net 10 10.0.0.1
route: writing to routing socket: Disc quota exceeded
change net 10: gateway 10.0.0.1: Disc quota exceeded

After:

# ./route change -net 10 10.0.0.1
route: writing to routing socket: Disc quota exceeded
change net 10: gateway 10.0.0.1: gateway uses the same route

PR:		bin/1093, misc/26833
2001-06-08 12:44:25 +00:00
Ruslan Ermilov 1b33d61d20 Change the host/bits syntax introduced in route.c,v 1.24 to the
net/bits syntax, for consistency with netstat(1) in particular.

OK'ed by:	phk
MFC after:	1 week
2001-06-08 09:07:34 +00:00
Ruslan Ermilov 334b4431fa - Exit 1 if "add", "change", or "delete" operation fails.
PR:		bin/12489

- Use inet_ntoa(3) where it should have been used.  This
  part of code simply wasn't converted to the "new" style
  after the routename() function was converted from the
  protocol-generic version to protocol-specific version
  in CSRG revision 5.6.

MFC after:	1 week
2001-06-07 13:50:24 +00:00
Dima Dorfman 19ab52cb4e mdoc(7) police: properly use a -diag list in the DIAGNOSTICS section.
Reviewed by:	ru
2001-04-13 19:59:47 +00:00
Ruslan Ermilov 0a5779d45b - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:33:27 +00:00
Ruslan Ermilov fe655281c5 Set the default manual section for sbin/ to 8. 2001-03-20 18:13:31 +00:00
Ruslan Ermilov 46eea498da mdoc(7) police: Change -filled displays (which just happen
to be the same as -ragged in the current implementation) to
-ragged.  With mdocNG, -filled displays produce the correct
output, formatted and justified to both margins.
2001-02-07 13:45:30 +00:00
Poul-Henning Kamp 3a36e32d8c Add a couple of newlines in the output from route monitor 2001-01-15 12:28:48 +00:00
David E. O'Brien 1a37aa566b Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.
2000-12-09 09:35:55 +00:00
Daniel Harris 32704e5747 Typo fix: forgot -> forget.
PR:		23113
Submitted by:	Jimmy Olgeni <olgeni@uli.it>
2000-11-26 23:26:51 +00:00
Ruslan Ermilov 7c7fb079b9 mdoc(7) police: use the new features of the Nm macro. 2000-11-20 16:52:27 +00:00
Ruslan Ermilov ce6da1a92a - Documented the host/bits syntax for destination argument.
- Documented that netmask could be specified with third argument.
2000-09-29 10:52:21 +00:00
Ruslan Ermilov 4eed20b85f Interpret the address argument as network-type address for `destination'
argument only.  Before that, the `route add default gateway' first tried
the `gateway' as network address and passed its name to getnetbyname(3),
which in the BIND resolution case does the T_PTR lookup on that name.
2000-09-29 10:50:11 +00:00
Ruslan Ermilov ecfe112d3e Fixed the case where argument of 0.0.0.0/8 would match the default route. 2000-09-29 10:37:16 +00:00
Yoshinobu Inoue b2fa7d408d Clear sin6_scope_id before passing routes into kernel, becaues kernel
don't support routes with sin6_scope_id set.
Without this fix, routes with IPv6 scoped addr won't work when it is
assigned by "route" command.

Approved by: jkh

Reviewed by: ume
2000-03-11 20:52:01 +00:00
Yoshinobu Inoue 5dc2a47de7 Add an scope index embedded IPv6 link local addr creation support, by route
command.
This is a workaround for some kernel interface which can't treat sin6_scope_id,
yet.
2000-02-23 18:00:33 +00:00
Yoshinobu Inoue 94fafad064 Support IPv6 scoped addr in ifconfig and route
IPv6 scoped addr display is not yet supported by ifconfig
   and route. Now almost of IPv6 apps support it, so its support
   in ifconfig and route is important to keep consisetncy, and
   to avoid user confusion.

Approved by: jkh
2000-02-10 03:03:09 +00:00
Munechika SUMIKAWA d59590d848 Fix return value check for inet_pton().
Obtained from:	KAME Project
2000-01-25 13:54:47 +00:00
Yoshinobu Inoue 1e6f93d8f5 Merge bug fix from KAME repository.
This fix enables inet6 default route addition.

Suggested by: itojun
2000-01-08 14:28:46 +00:00
Yoshinobu Inoue 57a40e9ee7 Enable INET6 by default.
This should be OK on non INET6 enabled kernel.
1999-12-15 05:13:22 +00:00
Yoshinobu Inoue cfa1ca9dfa udp IPv6 support, IPv6/IPv4 tunneling support in kernel,
packet divert at kernel for IPv6/IPv4 translater daemon

This includes queue related patch submitted by jburkhol@home.com.

Submitted by: queue related patch from jburkhol@home.com
Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project
1999-12-07 17:39:16 +00:00
Nick Sayer c98a6e4f7b MFS: forego->forgo 1999-10-16 21:05:11 +00:00
Nick Sayer 693121cfcf spell check != grammar check. :-) 1999-10-16 20:18:35 +00:00
Bill Fumerola b41d4634e2 Remove two more unnecessary function declarations/prototypes. 1999-09-25 03:22:52 +00:00
Bill Fumerola c3922760ba Include the proper headers, remove the unnecessary function declarations. 1999-09-25 03:20:29 +00:00
Peter Wemm 7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Archie Cobbs eed2b804bf When incrementing through a SIOCGIFCONF list, enforce a lower limit of
sizeof(ifr->ifr_addr) for the variable length field ifr->ifr_addr.sa_len.
Otherwise the increment will be wrong in certain cases.

Obtained from:  Whistle source tree
For the record: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> suggests
                SIOCGIFCONF should be dropped in favor of a sysctl mechanism.
1999-06-05 05:55:07 +00:00
Ruslan Ermilov 1e3b39d361 Get rid of segfaults in a set-uid program.
PR:		11823
Reviewed by:	des
1999-06-01 13:14:07 +00:00
Guy Helmer 78c6551783 Mention the special destination "default" for default routes. Fix a
couple of formatting bugs.

PR:		docs/9960
1999-05-04 18:41:32 +00:00
David E. O'Brien be0cde6f10 Remove useless `BINOWN=root' now that it is the default. 1998-09-19 22:42:06 +00:00
Philippe Charnier 1cc580ef41 Comment is .\" not .|'. Add -d and -t flags to SYNOPSIS and usage(). Getopt
returns -1. Correct use of .Nm. Spelling. Add rcsid and remove unused
#include.
1998-07-28 06:25:35 +00:00
Warner Losh b1a3bc5ea0 style(9) corrections
Submitted by:	bde
1997-12-26 23:28:17 +00:00
Warner Losh 006b3faebb Two fixes:
1) Correct strncpy usage
	2) gethostbyaddr paranoia from Julian Assange
1997-12-24 00:59:49 +00:00
Julian Elischer ba68720f4f fix what appears to me to be absolutle bogus code
to do with netmasks.. we fed totally bogus data into the kernel
to do with default routes and it just believed us. this led to:
1/ kernel panics
2/ the default route refusing to be deleted or added
(depending on a number of factors, usually it worked ok.)
1997-07-18 09:05:12 +00:00
Philippe Charnier eee9b17e46 Sync beetween man page and usage string. 1997-06-18 06:30:34 +00:00
Poul-Henning Kamp 71044fa7ab Allow "modern" syntax:
route add -net 192.168.64.0/20 bla bla bla
1997-04-02 17:05:30 +00:00
Poul-Henning Kamp 8fd0ef3952 unifdef CCITT, ISO & CRUFT. 1997-04-02 16:52:45 +00:00
Peter Wemm c0ec1f37ef Revert $FreeBSD$ to $Id$ 1997-02-22 14:40:44 +00:00
Ollivier Robert a14390ccec Security patch from OpenBSD: fixes potential buffer overflow in a static
buffer (so more difficult to exploit but better safe than sorry). Found
by comparing FreeBSD & OpenBSD sources/logs for the auditing process.

Reviewed by:	Warner Losh
Obtained from:	OpenBSD
1997-02-20 22:16:39 +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
Wolfram Schneider af20215665 Sort cross references. 1997-01-13 00:25:51 +00:00
Garrett Wollman 97d1e20ef9 If the RTM_NEWMADDR and RTM_DELMADDR messages are defined
(in <net/route.h>), then interpret them appropriately.  This has
no effect until I commit the changes to multicast group
management (awaiting review).
1997-01-09 21:34:03 +00:00
Garrett Wollman 628d2ac1b0 Fix up programs which expect <net/if.h> to include <sys/time.h> to instead
do it themselves.  (Some of these programs actually depended on this
beyond compiling the definition of struct ifinfo!)  Also fix up some
other #include messes while we're at it.
1996-12-10 17:11:53 +00:00
Garrett Wollman 7948f68b85 Delete another unnecessary #include <sys/mbuf.h>. 1996-11-01 20:30:37 +00:00
Bill Fenner 4ba05f60ea setuid back to the original caller immediately after opening the route socket.
Opening the socket is the only privileged operation route requires.

Make a couple of static buffers bigger, and use strncpy() and snprintf() where
there's a chance of overflow.

Fixes PR bin/1903

Partially Submitted by: Ollivier Robert <roberto@keltia.freenix.fr>

Don't look up the network number if we're being asked to add a host route.

Fixes PR bin/1900

Submitted by:	Bruce A. Mah <bmah@cs.berkeley.edu> (pr bin/1900)
1996-10-27 17:42:14 +00:00
Jordan K. Hubbard 98ca8a3e5b Bring back NS support for this utility - we need it for the commercial Novell
server software.
1996-10-16 19:37:58 +00:00
Bruce Evans eaa86f9d7f Don't use __dead or __pure in user code. They were obfuscations
for gcc >= 2.5 and no-ops for gcc >= 2.6.  Converted to use __dead2
or __pure2 where it wasn't already done, except in math.h where use
of __pure was mostly wrong.
1996-09-14 03:00:32 +00:00
Julian Elischer 072a289aa4 back out a part of the previous patch that garrett objected to.. 1996-08-19 18:52:49 +00:00
Julian Elischer aa648cf84b Submitted by: Archie@whistle.com
if making a interface route, and it's a P2P link,
then also automatically lable it as an llinfo entry so that
gated and friends don't clobber it..
1996-08-13 22:20:20 +00:00
Julian Elischer 914b41c2dc Reviewed by: julian
Submitted by:	archie@whistle.com

This patch allows true interface routing to be controlled
from the command line..
you can now do:
route add default -interface ppp0
even if you have no clue what the address at the other end is..

this is part of a set of changes that allow true "unnumbered links"
such as netcom run between their sites..
In practice you should assign the address from one of your ethernet
interfaces to the local side of the P2P link so that IP doesn't
say that the packet comes from 255.255.255.255, but
there is no need whatsoever to assign an address of any kind
to the remote end of the link.. useful for frame relay links etc also.
1996-08-09 22:52:02 +00:00
Julian Elischer e56dd1bb4f Submitted by: archie@whistle.com
slight cleanups on yesterday's patches
1996-07-23 22:00:14 +00:00
Julian Elischer 3a67d2bc37 Submitted by: archie@whistle.com
appletalk cleanups
1996-07-23 01:18:47 +00:00
Julian Elischer 144b35344c changes to allow route to manipulate appletalk routes. 1996-07-09 19:02:28 +00:00
Garrett Wollman 00bbf73734 Update route(8) to print out current meanings of rt_flags RTF_* bits. 1996-05-08 20:48:59 +00:00
Mike Pritchard e40f3f85d4 Do not install the now unsupported netns and netiso
related man pages.  Comment out cross references to those man
pages from other man pages.
1996-04-08 05:15:09 +00:00
Mike Pritchard 2e32d69db1 Fix route to check if inet_addr and inet_network return INADDR_NONE,
instead of -1 which is never returned by those routines.
1996-02-17 21:13:32 +00:00
Garrett Wollman cbc17e711e XNS sort-of-support is no more. 1996-02-13 17:30:37 +00:00
Mike Pritchard bcff8e2ae4 Another round of man page cleanups.
Down to only about 100 items left to cleanup! :-)
1996-02-12 04:57:03 +00:00