History log of /freebsd-10.1-release/sbin/route/
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
273188 16-Oct-2014 hrs

MFS r272855, 266846:

- Do not override sin6_scope_id in LLA when it is already set to non-zero.
This fixes destination list in output of netstat -r.
- Plug a memory leak.
- Add RTM_VERSION check.
- Fix a bug which can make sysctl() fail when -F is specified.
- Increase WID_IF_DEFAULT() from 6 to 8 (the default for AF_INET6) because
we have interfaces with longer names than 6 chars like epairN{a,b}.
- Style fixes.

MFS r272847:

- Add rwlock to struct dadq. A panic could occur when a large number of
addresses performed DAD at the same time.

MFS r272850:

- Replace Sun RPC license in TI-RPC library with a 3-clause BSD license,
with the explicit permission of Sun Microsystems in 2009.

- Replace Sun Industry Standards Source License for Sun RPC code with a
3-clause BSD license as specified by Oracle America, Inc. in 2010.
This license change was approved by Wim Coekaerts, Senior Vice
President, Linux and Virtualization at Oracle Corporation.

- Replace Sun RPC license with a 3-clause BSD license. This license change
was approved in 2010 by Wim Coekaerts, Senior Vice President, Linux and
Virtualization at Oracle Corporation.

- Replace Sun RPC license for TI-RPC library with a 3-clause BSD license,
with the explicit permission of Sun Microsystems in 2009.
The code in question in this file was copied from
lib/libc/rpc/pmap_getport.c.

MFS r272852,r272853:

- Add relative specification in expiration time.
- Add proto3 option for RTF_PROTO3.
- Use %lu for members of struct rt_metrics.
- Use long explicitly for the time difference.

MFS r272854:

- Return 0 if:

1. "-u N" specified, no -f, and mdN found,
2. no -u, "-f /pathname" specified, and mdN associated with
/pathname found,
3. "-u N" specified, "-f /pathname" specified, and both of them found,
4. "-l" specified and no -f,
5. "-l" specified, "-f /pathname" specified, and /pathname found.

otherwise return -1.

MFS r272856:

- Move configuration of IPv6 NDP flags to a point before handling ifconfig_IF.
This fixes a race that a non-IPv4 interface can get an EUI64 LLA even if it
has IFDISABLED nd6 flag at boot time.

MFS r272857:

- Cancel DAD for an ifa when the ifp has ND6_IFF_IFDISABLED as early as
possible and do not clear IN6_IFF_TENTATIVE. If IFDISABLED was accidentally
set after a DAD started, TENTATIVE could be cleared because no NA was
received due to IFDISABLED, and as a result it could prevent DAD when
manually clearing IFDISABLED after that.

MFS r272858:

- Fix an issue in range specification handling when a "-foo" is specified in
ifconfig_IF_aliasN.

MFS r272859:

- Fix EtherIP. TOS field must be initialized when the inner protocol is
PF_LINK, and multicast/broadcast flag should always be dropped because
the outer protocol uses unicast even when the inner address is not for
unicast. It had been broken since r236951 when gif_output() started to
use IFQ_HANDOFF().

MFS r272860:

- 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.

MFS r272861:

- Fix rc.d/gssd script to define the default values in a standard way.
- Use a parameter argument in jls(8) instead of doing grep.

MFS r272862, r272870:

- Restructure rc.d scripts for kerberos5 daemons.

MFS r272863:

- Return false status only when adding a route is failed. It could
erroneously return false due to an afexists() check loop in routing_start().

MFS r272864:

- Use ipv6_prefer when at least one ifconfig_IF_ipv6 is configured.

MFS r272865:

- Fix a bug which prevented mount.fstab parameter from being converted
when jail_JID_devfs_enable=NO.

MFS r272866:

- Fix header output when -P is specified and (ncpus - 1) != maxid.

MFS r272867:

- Fix a bug which could break extended attributes in a dump output.
This occurred when a file was >892kB long and had a large data (>1kB)
in the extended attributes.

MFS r272868, r272869:

- Make net.inet.ip.sourceroute, net.inet.ip.accept_sourceroute, and
net.inet.ip.process_options vnet-aware.

MFS r272871:

- Revert changes in r269180. It could cause -c N option to enter an
infinite loop if no reply packet is received.

MFS r272874:

- Resurrect set_rcvar() as a function to define a rc.conf variable.
It defines a variable and its default value in load_rc_config() just after
rc.conf is loaded. "rcvar" command shows the current and the default
values.

MFS r272960:

- Do not add late flag when file= is specified because it has a bad
side-effect. The specified file should exist before the fstab line.

Approved by: re (gjb)


/freebsd-10.1-release/etc/defaults/rc.conf
/freebsd-10.1-release/etc/network.subr
/freebsd-10.1-release/etc/rc.d/Makefile
/freebsd-10.1-release/etc/rc.d/SERVERS
/freebsd-10.1-release/etc/rc.d/gssd
/freebsd-10.1-release/etc/rc.d/ip6addrctl
/freebsd-10.1-release/etc/rc.d/ipropd_master
/freebsd-10.1-release/etc/rc.d/ipropd_slave
/freebsd-10.1-release/etc/rc.d/jail
/freebsd-10.1-release/etc/rc.d/kadmind
/freebsd-10.1-release/etc/rc.d/kdc
/freebsd-10.1-release/etc/rc.d/kerberos
/freebsd-10.1-release/etc/rc.d/kfd
/freebsd-10.1-release/etc/rc.d/kpasswdd
/freebsd-10.1-release/etc/rc.d/routing
/freebsd-10.1-release/etc/rc.subr
/freebsd-10.1-release/include/rpcsvc/bootparam_prot.x
/freebsd-10.1-release/include/rpcsvc/key_prot.x
/freebsd-10.1-release/include/rpcsvc/klm_prot.x
/freebsd-10.1-release/include/rpcsvc/mount.x
/freebsd-10.1-release/include/rpcsvc/nfs_prot.x
/freebsd-10.1-release/include/rpcsvc/nis.x
/freebsd-10.1-release/include/rpcsvc/nis_callback.x
/freebsd-10.1-release/include/rpcsvc/nis_object.x
/freebsd-10.1-release/include/rpcsvc/nis_tags.h
/freebsd-10.1-release/include/rpcsvc/rex.x
/freebsd-10.1-release/include/rpcsvc/rnusers.x
/freebsd-10.1-release/include/rpcsvc/rstat.x
/freebsd-10.1-release/include/rpcsvc/sm_inter.x
/freebsd-10.1-release/include/rpcsvc/spray.x
/freebsd-10.1-release/include/rpcsvc/yp.x
/freebsd-10.1-release/include/rpcsvc/yppasswd.x
/freebsd-10.1-release/lib/libc/rpc/LICENSE
/freebsd-10.1-release/lib/libc/xdr/xdr.c
/freebsd-10.1-release/lib/libc/xdr/xdr_array.c
/freebsd-10.1-release/lib/libc/xdr/xdr_float.c
/freebsd-10.1-release/lib/libc/xdr/xdr_mem.c
/freebsd-10.1-release/lib/libc/xdr/xdr_rec.c
/freebsd-10.1-release/lib/libc/xdr/xdr_reference.c
/freebsd-10.1-release/lib/libc/xdr/xdr_sizeof.c
/freebsd-10.1-release/lib/libc/xdr/xdr_stdio.c
/freebsd-10.1-release/sbin/dump/traverse.c
/freebsd-10.1-release/sbin/mdconfig/mdconfig.c
/freebsd-10.1-release/sbin/ping6/ping6.c
keywords
route.8
route.c
/freebsd-10.1-release/sbin/swapon/swapon.c
/freebsd-10.1-release/sys/netinet/in_gif.c
/freebsd-10.1-release/sys/netinet/ip_fastfwd.c
/freebsd-10.1-release/sys/netinet/ip_options.c
/freebsd-10.1-release/sys/netinet/ip_options.h
/freebsd-10.1-release/sys/netinet6/in6_gif.c
/freebsd-10.1-release/sys/netinet6/nd6_nbr.c
/freebsd-10.1-release/usr.bin/netstat/route.c
/freebsd-10.1-release/usr.bin/vmstat/vmstat.c
/freebsd-10.1-release/usr.sbin/route6d/route6d.c
/freebsd-10.1-release/usr.sbin/ypbind/yp_ping.c
272461 03-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


270050 16-Aug-2014 bz

MFC r264539:

When switching variables to flags in r243185 a few cases were missed.
After r263152 (in head) 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


265701 08-May-2014 melifaro

Merge r260524,r260540

r260524:
Add -4/-6 shorthand for -finet/-finet6 in route(8) and netstat(8).

r260540:
Bump dates in nestat(1) and route(8) man pages.
Fix several small errors introduced by r260524.

Suggested by: glebius


256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


256137 08-Oct-2013 glebius

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)


253852 01-Aug-2013 hrs

Fix boundary check of sockaddr array.

Reported by: uqs


253589 24-Jul-2013 hrs

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


253519 21-Jul-2013 hrs

- Use getnameinfo() for both of AF_INET and AF_INET6 in routename().
- Add missing "static".


253517 21-Jul-2013 hrs

- 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.


253504 20-Jul-2013 hrs

- Simplify getaddr() and print_getmsg() by using RTAX_* instead of RTA_*
as the argument.
- Reduce unnecessary loop in print_getmsg().


253503 20-Jul-2013 hrs

Show "default" for the zero-filled address consistently when nflag == 0.


253502 20-Jul-2013 hrs

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


253443 18-Jul-2013 hrs

Fix a gcc warning.

Pointy hat to: hrs


253429 17-Jul-2013 hrs

Use NET_RT_DUMP.0.FIB leaf node instead of setting td_proc->p_fibnum.


253427 17-Jul-2013 hrs

- 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.


253424 17-Jul-2013 hrs

Simplify keywords.h generation.


251581 09-Jun-2013 hrs

Fix a bug that the gateway address was not shown when a -gateway modifier
was used.


246143 31-Jan-2013 glebius

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@


245168 08-Jan-2013 hrs

Fix -iface and -interface modifiers.

Spotted by: Ian FREISLICH


244325 16-Dec-2012 hrs

- 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


243903 05-Dec-2012 hrs

- 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.


243867 04-Dec-2012 glebius

Fix fallout from r243019, which broke parsing of shortened network
prefixes.

Reported and tested by: delphij


243866 04-Dec-2012 hrs

- 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]


243860 04-Dec-2012 glebius

Flush stdout after RTM_IFANNOUNCE message.

PR: bin/151600
Submitted by: Eric van Gyzen <eric vangyzen.net>


243859 04-Dec-2012 glebius

No need to be root when running with -t or -d.


243187 17-Nov-2012 hrs

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


243185 17-Nov-2012 hrs

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


243019 14-Nov-2012 glebius

Remove remnants of classful addressing. These magic transformations
of supplied arguments is not what a modern sysadmin expect.


233458 25-Mar-2012 joel

Remove superfluous paragraph macro.


233418 24-Mar-2012 joel

Document the show alias and add an EXAMPLES section.


230989 04-Feb-2012 hrs

Fix a possible infinite loop in "route flush" on 64-bit archs.

MFC after: 3 days


229766 07-Jan-2012 ume

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


216297 08-Dec-2010 glebius

- Fix array bounds checking. [1]
- Add message length checking.

PR: 151664 [1]
Submitted by: Alexey Illarionov <littlesavage rambler.ru> [1]
Reviewed by: yar


216296 08-Dec-2010 glebius

Add RTM_IEEE80211 to array of route message descriptions.

PR: 151664
Submitted by: Alexey Illarionov <littlesavage rambler.ru>


204406 27-Feb-2010 uqs

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)


196833 04-Sep-2009 kmacy

remove stale references to RTF_CLONING and RTF_LLINFO

MFC after: 3 days


196527 25-Aug-2009 charnier

ANSIfy functions declarations, adjust prototypes. Rename local variable
to not conflict with err().


191080 14-Apr-2009 kmacy

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


190913 11-Apr-2009 rrs

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)


190775 06-Apr-2009 rrs

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


190758 06-Apr-2009 rrs

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


187384 18-Jan-2009 mav

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


186119 15-Dec-2008 qingli

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


178065 10-Apr-2008 ru

Fix printing of sockaddr prefixes in verbose mode.

PR: bin/122403
Submitted by: az
MFC after: 3 days


177496 22-Mar-2008 remko

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


173321 04-Nov-2007 mtm

Don't mask the address in inet_makenetandmask() according to what class
it appears to be in: there is also CIDR.

Noticed by: tegge


173261 01-Nov-2007 obrien

Document -t.


173124 29-Oct-2007 mtm

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


160747 27-Jul-2006 yar

Obey MK_INET6_SUPPORT.
This is also a good chance to apply style.Makefile(5) in some cases.


150820 02-Oct-2005 ru

Document that -q option is also applicable to the "change" command.

PR: docs/85095
Submitted by: Rostislav Krasny


150679 28-Sep-2005 tobez

Introduce "route del" as an alias to "route delete".

Reviewed by: arch


150415 21-Sep-2005 glebius

- 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]


146546 23-May-2005 ume

- 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


146187 13-May-2005 ume

NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 defines
NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special
for it, now.


146079 11-May-2005 jmallett

shutdown(2)'s how argument as 0 is nowhere near as cool as SHUT_RD


141846 13-Feb-2005 ru

Expand *n't contractions.


140415 18-Jan-2005 ru

Sort sections.


140368 17-Jan-2005 ru

Added the EXIT STATUS section where appropriate.


139987 10-Jan-2005 ru

Scheduled mdoc(7) sweep.


137189 04-Nov-2004 bms

Fix markup: .Dv -> .Va
Update document dates.

Prodded by: ru


137180 04-Nov-2004 bms

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


131488 02-Jul-2004 ru

Mechanically kill hard sentence breaks.


130569 16-Jun-2004 bms

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


129327 17-May-2004 ru

Assorted markup, grammar, and spelling fixes.


129034 07-May-2004 csjp

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)


128878 03-May-2004 andre

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


128782 30-Apr-2004 ambrisko

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


128186 13-Apr-2004 luigi

Replace ROUNDUP/ADVANCE with SA_SIZE


128073 09-Apr-2004 markm

Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp


126178 23-Feb-2004 johan

style.Makefile(5):
Use WARNS?= instead of WARNS=.


123234 07-Dec-2003 ume

link-local multicast address must be converted to KAME specific
embeded scopeid form.

Reported by: dwmalone
MFC after: 3 days


122423 10-Nov-2003 brueffer

Add a describtion for the '-d' flag

While I'm here, add a missing comma

PR: 41787
Obtained from: OpenBSD
MFC after: 5 days


120484 26-Sep-2003 bms

Add the -xresolve flag to the route(8) man page.

Reviewed by: ru


118449 04-Aug-2003 ache

LANG->LC_ALL

Pointed by: ru


118431 04-Aug-2003 ache

Fix problem differently, use 
LANG=C tr 'a-z' 'A-Z' 
for hypotetical case that script may generate non-ascii characters


118428 04-Aug-2003 ache

Use tr '[:lower:]' '[:upper:]' to work with any locale


113559 16-Apr-2003 ru

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.


111921 05-Mar-2003 peter

Kill #ifdef NS code


109811 25-Jan-2003 kbyanc

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


99503 06-Jul-2002 charnier

The .Nm utility.


98053 08-Jun-2002 ume

Don't have -prefixlen 128 on host routes.

Obtained from: KAME


97637 30-May-2002 wollman

Avoid construction which results in label at end of block.


97278 25-May-2002 ru

Respect -q with "add" and "delete". Document who respects -q.

PR: bin/38531


97073 21-May-2002 ume

Allow prefix/prefixlen syntax for IPv6 to have consistency
with IPv4.


97062 21-May-2002 ume

Have RTF_HOST for /128 destionation.


96997 20-May-2002 ume

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


94499 12-Apr-2002 ru

Removed the cruft that became cruft after rev. 1.4.
Fixed CLEANFILES.


92883 21-Mar-2002 imp

o remove __P
o remove main prototype


92806 20-Mar-2002 obrien

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?)


89498 18-Jan-2002 ru

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


87325 04-Dec-2001 obrien

Default to WARNS=2.
Binary builds that cannot handle this must explicitly set WARNS=0.

Reviewed by: mike


85048 17-Oct-2001 ru

Bring in latest CSRG revisions to this file.


82651 31-Aug-2001 ru

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


81980 20-Aug-2001 brian

Handle snprintf() returning < 0 (not just -1)

MFC after: 2 weeks


81976 20-Aug-2001 brian

Handle snprintf() returning -1.

MFC after: 2 weeks


81687 15-Aug-2001 ru

mdoc(7) police: utilize the new .Ex macro.


81251 07-Aug-2001 ru

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.


79754 15-Jul-2001 dd

Remove whitespace at EOL.


79588 11-Jul-2001 ru

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''.


79366 06-Jul-2001 ru

mdoc(7) police: sort SEE ALSO xrefs (sort -b -f +2 -3 +1 -2).


78140 12-Jun-2001 ru

Allow route(8) to create "proxy only" published ARP entries.

PR: bin/12357
Submitted by: Craig Leres <leres@ee.lbl.gov>


78139 12-Jun-2001 ru

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


78064 11-Jun-2001 ume

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


77908 08-Jun-2001 ru

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


77904 08-Jun-2001 ru

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


77873 07-Jun-2001 ru

- 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


75495 13-Apr-2001 dd

mdoc(7) police: properly use a -diag list in the DIAGNOSTICS section.

Reviewed by: ru


74815 26-Mar-2001 ru

- Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.


74531 20-Mar-2001 ru

Set the default manual section for sbin/ to 8.


72126 07-Feb-2001 ru

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.


71061 15-Jan-2001 phk

Add a couple of newlines in the output from route monitor


69793 09-Dec-2000 obrien

Add `_PATH_DEVZERO'.
Use _PATH_* where where possible.


69232 26-Nov-2000 dannyboy

Typo fix: forgot -> forget.

PR: 23113
Submitted by: Jimmy Olgeni <olgeni@uli.it>


68960 20-Nov-2000 ru

mdoc(7) police: use the new features of the Nm macro.


66450 29-Sep-2000 ru

- Documented the host/bits syntax for destination argument.
- Documented that netmask could be specified with third argument.


66449 29-Sep-2000 ru

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.


66448 29-Sep-2000 ru

Fixed the case where argument of 0.0.0.0/8 would match the default route.


57918 11-Mar-2000 shin

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


57396 23-Feb-2000 shin

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.


57108 10-Feb-2000 shin

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


56588 25-Jan-2000 sumikawa

Fix return value check for inet_pton().

Obtained from: KAME Project


55602 08-Jan-2000 shin

Merge bug fix from KAME repository.
This fix enables inet6 default route addition.

Suggested by: itojun


54624 15-Dec-1999 shin

Enable INET6 by default.
This should be OK on non INET6 enabled kernel.


54263 07-Dec-1999 shin

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


52323 16-Oct-1999 nsayer

MFS: forego->forgo


52320 16-Oct-1999 nsayer

spell check != grammar check. :-)


51640 25-Sep-1999 billf

Remove two more unnecessary function declarations/prototypes.


51639 25-Sep-1999 billf

Include the proper headers, remove the unnecessary function declarations.


50476 28-Aug-1999 peter

$Id$ -> $FreeBSD$


47754 05-Jun-1999 archie

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.


47668 01-Jun-1999 ru

Get rid of segfaults in a set-uid program.
PR: 11823
Reviewed by: des


46436 04-May-1999 ghelmer

Mention the special destination "default" for default routes. Fix a
couple of formatting bugs.

PR: docs/9960


39495 19-Sep-1998 obrien

Remove useless `BINOWN=root' now that it is the default.


37907 28-Jul-1998 charnier

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.


32008 26-Dec-1997 imp

style(9) corrections
Submitted by: bde


31958 24-Dec-1997 imp

Two fixes:
1) Correct strncpy usage
2) gethostbyaddr paranoia from Julian Assange


27500 18-Jul-1997 julian

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.)


26723 18-Jun-1997 charnier

Sync beetween man page and usage string.


24558 02-Apr-1997 phk

Allow "modern" syntax:
route add -net 192.168.64.0/20 bla bla bla


24554 02-Apr-1997 phk

unifdef CCITT, ISO & CRUFT.


22990 22-Feb-1997 peter

Revert $FreeBSD$ to $Id$


22953 20-Feb-1997 roberto

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


21673 14-Jan-1997 jkh

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.


21635 13-Jan-1997 wosch

Sort cross references.


21465 09-Jan-1997 wollman

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).


20287 10-Dec-1996 wollman

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.


19321 01-Nov-1996 wollman

Delete another unnecessary #include <sys/mbuf.h>.


19209 27-Oct-1996 fenner

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)


18965 16-Oct-1996 jkh

Bring back NS support for this utility - we need it for the commercial Novell
server software.


18286 14-Sep-1996 bde

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.


17674 19-Aug-1996 julian

back out a part of the previous patch that garrett objected to..


17591 13-Aug-1996 julian

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..


17486 09-Aug-1996 julian

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.


17265 23-Jul-1996 julian

Submitted by: archie@whistle.com

slight cleanups on yesterday's patches


17254 23-Jul-1996 julian

Submitted by: archie@whistle.com

appletalk cleanups


17046 09-Jul-1996 julian

changes to allow route to manipulate appletalk routes.


15690 08-May-1996 wollman

Update route(8) to print out current meanings of rt_flags RTF_* bits.


15136 08-Apr-1996 mpp

Do not install the now unsupported netns and netiso
related man pages. Comment out cross references to those man
pages from other man pages.


14132 17-Feb-1996 mpp

Fix route to check if inet_addr and inet_network return INADDR_NONE,
instead of -1 which is never returned by those routines.


14092 13-Feb-1996 wollman

XNS sort-of-support is no more.


14045 12-Feb-1996 mpp

Another round of man page cleanups.

Down to only about 100 items left to cleanup! :-)


13940 06-Feb-1996 wollman

Remove support for OSI networking in user-land (#ifdef OSI aor CCITT)
in preparation for its removal from the kernel source tree. NB: because
a function was deleted, libc is now at version 3.0 (was 2.2 previously).


13515 20-Jan-1996 mpp

Route calls the errx routine with the wrong number of arguments
when printing "route: bad address: ...".


13171 02-Jan-1996 wollman

Clean up GCC warnings, condition out some compatibility cruft, add $Id$.

Pointed-out-by: jmb


2787 15-Sep-1994 pst

Missing 'break' after setting interface route flag was causing interface
routes to not be properly marked as static.


2067 14-Aug-1994 jkh

Make keywords.h get properly built.
Submitted by: jkh


1855 05-Aug-1994 wollman

Convert to our man installation style. Also fixed long-standing bug
in `fastboot'/`fasthalt' in which the interpreter would hang around
after `reboot' or `halt' is run, causing an irritating ``Killed'' message.


1609 28-May-1994 rgrimes

Remove old style manual page depends so make install with NOMAN set
can run.


1559 26-May-1994 rgrimes

This commit was generated by cvs2svn to compensate for changes in r1558,
which included commits to RCS files with non-trunk default branches.