Commit Graph

132 Commits

Author SHA1 Message Date
ginsbach
3997584e62 More style nits (KNF); casts and sizeof's are not followed by a space. 2005-08-09 19:43:24 +00:00
ginsbach
89cdec0594 switch is not a function, so add a space; sort switch elements
alphabetically (KNF).
2005-07-20 21:12:40 +00:00
ginsbach
d313757b82 * Exit non-zero error code when flushroute() fails operating on the
routing socket, e.g. running route flush as non-root.

* When quiet (-q) don't append error string to a non-existent
  diagnostic output (stdout).  The error diagnostic is still written
  to stderr.  [from FreeBSD]

* Use warn(3) in place of perror(3).
2005-07-15 21:29:54 +00:00
christos
dea4bd707c const poisoning. 2005-06-26 21:28:15 +00:00
dyoung
256aff6693 Teach route(8) to print the messages generated by net80211. 2005-06-25 06:38:35 +00:00
ginsbach
4d1075a78b Convert prefixlen() to ANSI function declaration. Missed by earlier
conversion.
2005-05-19 15:46:02 +00:00
ginsbach
0cb468118d Due to a limitation in inet_addr(3) it was not possible to specify a
netmask value of 0xffffffff (INADDR_NONE).  Fix by using inet_aton(3).
Note it was possible to specify the same mask as the dotted quad
255.255.255.255 because of a later call to gethostbyname(3).
[From FreeBSD]
2005-05-19 15:05:11 +00:00
ginsbach
d96d2a6f15 Adjust field width for route -n show similar to netstat -rn when displaying
INET6 route entries.
2005-05-13 14:58:47 +00:00
ginsbach
bb3f166314 Fix botched prior commit. Additional debugging error messages mistakenly
committed.
2005-05-13 01:59:47 +00:00
ginsbach
22f8a99e92 * Honor -net when using CIDR (net/mask) notation. This differs
from the default CIDR (host/mask) interpretation.  As discussed on
  tech-net.

* Use errx() in place of fprintf() and exit().  Make the error message
  formats consistent.
2005-05-12 21:10:49 +00:00
ginsbach
a43fb90cb0 Fix macro NEXTADDR so that the names, like so_dst, are printed
rather than u.  The preprocessor doesn't do replacement within
strings, so the # string creation operator must be used.
2005-05-10 18:12:22 +00:00
xtraeme
69cbd40c14 Kill __P(), use ANSI function declarations. 2005-02-05 14:05:23 +00:00
lukem
7157011597 Only compile in IPv6 support if ${USE_INET6} != "no"
MKINET6 is for providing IPv6 infrastructure.
USE_INET6 is for compiling IPv6 support into the programs (needs MKINET6).
2005-01-10 02:58:58 +00:00
itojun
b95181fc9b NI_WITHSCOPEID was not picked up by IETF standardization process. 2004-11-16 05:59:32 +00:00
itojun
ba67da06a5 bump buffer size for any_ntoa(), for huge sa_len 2004-05-15 14:13:36 +00:00
itojun
7340ad20ce 2-byte read overrun for unknown sockaddr. from openbsd
XXX out[64], is it safe?  what if sa_len > 23?
2004-05-15 13:41:09 +00:00
jmmv
b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
lukem
f85d2d1c14 Use ${HOST_SH} instead of `sh'.
If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
2003-10-26 07:25:33 +00:00
itojun
d3e55680aa correct typo. PR misc/22944 2003-10-02 00:09:06 +00:00
itojun
83ddaf1cbf print prefixlen on -show 2003-10-01 06:24:19 +00:00
cube
5041ba1a4c Remove a comment that referred to a non-committed part of the patch I
submitted for bin/17613. Ok'd by mrg@.
2003-09-16 09:34:48 +00:00
agc
276d62f603 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22308, verified by myself.
2003-08-07 10:04:22 +00:00
wiz
7539e84445 Bump date for flushall description. 2003-08-07 09:46:17 +00:00
jrf
ce22377a7e This is an updated submitted patch originally written by Jim Rees
and sent in by Greg Hudson as seen in PR misc/3227. Basically what it
does is adds a flushall option which deletes all but localhost routes.
This is done by andoring in a flag called doall (1 means do all routes
including gateway, 0 means do a regular flush). I have seen some
platforms that do this. I tested it out on ipv4 only, it works as
advertised. Commit was approved by christos@.
2003-07-19 01:36:47 +00:00
christos
072bca2c13 PR/21856: Robert Elz: Changes to route(8) to allow /n instead of -prefixlen
for INET6
2003-06-11 15:45:20 +00:00
itojun
627957eb53 permit foo/bar notation, like "route add 10.0.0.0/8 127.0.0.1".
originally by provos
2003-06-03 04:41:42 +00:00
itojun
9cbeabfe77 strlcpy [a few mistakes found] 2003-05-17 23:02:28 +00:00
jrf
6867af7aad This addresses PR 17613 when certain methods of adding routes would
muck up the routing tables. The patch was submitted by Quentin Garnier
<netbsd@quatriemek.com> and tweaked a little after it was reviewed
by Christos Zoulas <christos@netbsd.org>. Final change/commit approved
by Christos.
2003-04-21 13:42:50 +00:00
jrf
dee179a37f Made a note in the code about the -d and -d options brought up in
PR 18674. Thanks to Chris Jones for pointing it out.
2003-04-03 02:39:50 +00:00
wiz
a9f7f104b6 Split .Nm with other macro arguments on two lines. 2003-02-25 07:53:39 +00:00
itojun
e33246f5c7 correct prefixlen handling for IPv4. 2002-10-18 00:21:23 +00:00
itojun
3c30f46849 Make prefixlen check to make sure its argument is present before deref
from openbsd
2002-10-18 00:16:25 +00:00
wiz
09cbac4e7f New sentence, new line. From Robert Elz. 2002-10-03 15:41:44 +00:00
grant
6742cb1812 sweep of errx/warnx, remove unnecessary trailing \n 2002-07-20 08:36:17 +00:00
itojun
d24b68cd4f permit DNS names to address portion. they will be considered as RTF_HOST
if specified as destination (as there's no getnetbyname in IPv6).
2002-06-10 21:18:53 +00:00
itojun
a1662dac72 if we're unsure about prefixlen, don't say "128". 2002-06-05 22:11:28 +00:00
itojun
65829ef6aa more correct ion to RTF_HOST handling. 2002-06-05 22:10:44 +00:00
itojun
fff7bbceef do not have -prefixlen 128 on RTF_HOST.
From: Dawid Szymanski <dawszy@arhea.net>
2002-06-04 22:20:00 +00:00
itojun
e534b69c1d raise RTF_HOST if destination is a host (/128). from ume 2002-05-20 23:01:32 +00:00
christos
69da3546f5 PR/15672: Love: route monitor missing info 2002-02-21 15:44:25 +00:00
hubertf
85cc2d10d5 the modifiers (-inet6, ...) do not only affect the behaviour of "flush",
but at least also of "get", so make the wording a bit more general.
2002-02-08 13:32:32 +00:00
ross
dc5571b22e Generate <>& symbolically. I'm avoiding .../dist/... directories for now. 2002-02-08 01:21:55 +00:00
wiz
7dd6e69db4 Punctuation fix, sort sections, sort SEE ALSO. 2001-11-16 12:08:49 +00:00
christos
4c4a8c2fb6 Make route exit with a non-zero error code when operations to the routing
socket fails. eg, running route add 1.2.3.4 5.6.7.8 as non root.
2001-11-15 21:25:08 +00:00
lukem
fd87fe6aaa fix -Wshadow warnings 2001-11-02 03:51:48 +00:00
atatat
cdc6282274 Provide a short output format for the get command that only prints the
address corresponding to RTA_GATEWAY, or nothing if it doesn't exist.
Modify the exit value of route depending on this, so that one can do
stuff like:

#!/bin/sh
gw=`route -sn get default 2>/dev/null`
if [ -z "$gw" ]; then
	echo no default route
	exit 1
fi
ping -w1 -c1 $gw >/dev/null 2>&1
if ! route -sn get $gw >/dev/null; then
	echo default gateway not responding
	exit 1
fi
echo default gateway is at $gw
2001-10-24 18:40:16 +00:00
atatat
2e4d1a174e Print a R on reject routes to indicate that they're not normal routes,
and check netmask (or prefix) length as well as the destination
address when determining if a route is a "default" or not.  This means
that the output from 'route show' will no longer say:

	Internet6:
	Destination       Gateway            Flags
	default           localhost          UG
	default           localhost          UG

but instead

	Internet6:
	Destination       Gateway            Flags
	::/104            localhost          UGR
	::/96             localhost          UGR

which makes much more sense.
2001-10-24 16:05:06 +00:00
christos
b77fb2a456 PR/14286: reed@reedmedia.net: Explain default. 2001-10-18 13:42:32 +00:00
bjh21
6ef5a92fbb When dumping the routing table, use getnameinfo() to print link-layer
addresses rather than doing it ourselves and falling back to link_ntoa().
2001-10-06 18:32:45 +00:00
itojun
d615372573 off-by-one error in -prefixlen arg validation (do not permit 129 on IPv6) 2001-07-20 08:31:55 +00:00