Commit Graph

250 Commits

Author SHA1 Message Date
martin af2ed9cf6e Make route and netstat share the same struct progops (and initialization
code)
2020-04-03 16:20:51 +00:00
christos a17e9ce771 Add a prog_setsockopt (thanks kre@) 2020-04-02 18:32:31 +00:00
roy ae92cb1896 route: Enable receive error reporting on the routing socket 2020-03-14 22:26:39 +00:00
kamil 7cd593c092 Avoid undefined behavior
route.c:1523:20, left shift of 1073741824 by 1 places cannot be represented
in type 'int'
2020-02-22 00:42:15 +00:00
roy b433cf8862 route: address flags are more useful than interface flags for address msgs 2020-01-22 19:22:06 +00:00
roy cdc408b51e route: Decode the correct flags for interface address messages 2020-01-22 17:55:41 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
roy 99b959ff0d route(8): Show addres for RTM_LOSING
While here, add /* FALLTHROUGH */.
2019-09-02 00:30:01 +00:00
roy 68a5c140d2 route(8): show addrs for RTM_MISS 2019-08-31 18:20:08 +00:00
roy 2b94ade947 route(8): print RTM_CHANGE messages
XXX Pullup -9
2019-08-22 16:10:48 +00:00
sevan edae29ee93 Add rcsid 2019-06-30 11:38:16 +00:00
roy 5d499f6897 Resolve every route(4) message type before printing anything more about it
other than the type and length.

This solves the issue where RTM_ONEWADDR is received and it tries to
parse route information from it.
2018-08-14 20:53:07 +00:00
sevan 162b461b88 Remove references to XNS 2018-07-31 21:22:09 +00:00
roy 68900ca448 Handle the routing socket overflowing gracefully. 2018-03-23 11:57:33 +00:00
christos 97576db071 Use the definitions from the standard header files and replace homebrew
snprintb with the libutil one.
2017-12-13 17:42:44 +00:00
uwe 034a499654 Fix typo in flag name. We should probably just use IFFBITS string
that <net/if.h> defines.

PR bin/52815
2017-12-13 11:31:42 +00:00
christos 030580eaff user librumpres 2017-10-10 19:30:06 +00:00
manu c87959dccf Fix route and netstat -r output when built with -DSMALL
A missing \n caused the routing table to be printed all in one line
if -DSMALL was used.
2017-07-13 08:26:29 +00:00
wiz 1595760100 Use Ex. 2017-07-04 06:54:20 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
ozaki-r da803ed70d Restore ARP/NDP entries to route show and netstat -r
Requested by dyoung@ some time ago
2017-06-28 04:14:53 +00:00
wiz 45a8078c32 Remove unnecessary Pp. 2017-06-19 09:46:33 +00:00
ozaki-r a49d9c85a4 Support -c <count> option for route monitor
route command exits if it receives <count> routing messages where
<count> is a value specified by -c.

The option is useful to get only particular message(s) in a test script.
2017-06-16 04:40:16 +00:00
roy d8c60740ae Report the PID for the process changing the address. 2017-03-17 16:13:44 +00:00
ozaki-r 09973b35ac Separate nexthop caches from the routing table
By this change, nexthop caches (IP-MAC address pair) are not stored
in the routing table anymore. Instead nexthop caches are stored in
each network interface; we already have lltable/llentry data structure
for this purpose. This change also obsoletes the concept of cloning/cloned
routes. Cloned routes no longer exist while cloning routes still exist
with renamed to connected routes.

Noticeable changes are:
- Nexthop caches aren't listed in route show/netstat -r
  - sysctl(NET_RT_DUMP) doesn't return them
  - If RTF_LLDATA is specified, it returns nexthop caches
- Several definitions of routing flags and messages are removed
  - RTF_CLONING, RTF_XRESOLVE, RTF_LLINFO, RTF_CLONED and RTM_RESOLVE
- RTF_CONNECTED is added
  - It has the same value of RTF_CLONING for backward compatibility
- route's -xresolve, -[no]cloned and -llinfo options are removed
  - -[no]cloning remains because it seems there are users
  - -[no]connected is introduced and recommended
    to be used instead of -[no]cloning
- route show/netstat -r drops some flags
  - 'L' and 'c' are not seen anymore
  - 'C' now indicates a connected route
- Gateway value of a route of an interface address is now not
  a L2 address but "link#N" like a connected (cloning) route
- Proxy ARP: "arp -s ... pub" doesn't create a route

You can know details of behavior changes by seeing diffs under tests/.

Proposed on tech-net and tech-kern:
  http://mail-index.netbsd.org/tech-net/2016/03/11/msg005701.html
2016-04-04 07:37:07 +00:00
christos 9c39ccca16 no need for <sys/mbuf.h> 2016-01-23 21:05:51 +00:00
christos 4f3d9e304d PR/50671: David Binderman: fix memory leak. 2016-01-17 15:59:26 +00:00
ozaki-r 44996ea918 Include a few additional libc functions in rump.route to make it work with inet6
getaddrinfo and if_nametoindex are newly added to interpret interface names
in IPv6 link-local addresses. if_nametoindex looks not used in rump.route,
but it is needed because it is used indirectly from getaddrinfo.

From s-yamaguchi@IIJ
2015-09-14 05:12:52 +00:00
ozaki-r 6011d36bd6 Fix rump.{netstat,route} shows host's interface names in link local addresses
Interface names of IPv6 link local addresses are resolved
by getnameinfo(3). So we need to rump-ify it as well as
if_indextoname and getifaddrs.
2015-05-15 06:58:59 +00:00
ozaki-r df66dd74ee Fix rump.route shows host's interface names
Let it use rump-ified if_indextoname and getifaddrs
to get rump kernel's interfaces, which is the same way
as ifconfig.
2015-04-22 03:07:55 +00:00
roy a37502b2b6 Add RTF_BROADCAST to mark routes used for the broadcast address when
they are created on the fly. This makes it clear what the route is for
and allows an optimisation in ip_output() by avoiding a call to
in_broadcast() because most of the time we do talk to a host.
It also avoids a needless allocation for the storage of llinfo_arp and
thus vanishes from arp(8) - it showed as incomplete anyway so this
is a nice side effect.

Guard against this and routes marked with RTF_BLACKHOLE in
ip_fastforward().
While here, guard against routes marked with RTF_BLACKHOLE in
ip6_fastforward().
RTF_BROADCAST is IPv4 only, so don't bother checking that here.
2015-03-23 18:33:17 +00:00
roy 43800a7e73 Teach route(8) about RTF_LOCAL. 2015-02-26 09:56:11 +00:00
christos 20d9dd5566 make netname4 match the netname6 signature avoiding a NULL pointer. 2015-01-07 22:38:32 +00:00
prlw1 f44489f8dc MKINET6=no build fixes
http://mail-index.netbsd.org/tech-net/2014/12/13/msg004898.html
2014-12-20 13:15:48 +00:00
roy 62cbe5902e Note that RTM_CHANGE can also change the gateway 2014-12-17 10:56:09 +00:00
christos 27fad02cd4 Complete the routing argument table by including the ID's used in the routing
display.
2014-12-01 20:30:27 +00:00
christos 2bd97efc9a PR/47704: Takahiro HAYASHI: Add -L flag 2014-11-12 03:34:08 +00:00
christos 521e0d5bd2 give a little more space 2014-11-08 00:47:32 +00:00
christos 74d147444a Now that the code can support tags and verbose route printing, enable them.
Also document previously undocumented flags.
2014-11-07 14:57:08 +00:00
christos 30f4c8e6f6 Factor out the netstat route printing code and use it here. There is no
point in having 2 different copies; fixes PR/49371
2014-11-06 21:29:32 +00:00
kefren beafc35b81 Remove esis reference 2013-11-05 07:42:48 +00:00
christos 740c6aa538 use correct function 2013-10-19 15:59:15 +00:00
christos 730b60ec52 use symbolic flags 2013-10-19 15:50:26 +00:00
christos f304780793 use scopeid functions 2013-10-19 00:39:39 +00:00
christos 77f96119f9 avoid pointer gymnastics 2013-10-18 21:01:00 +00:00
dholland af9796645f english usage patrol 2013-10-07 05:06:45 +00:00
kefren 708985b712 Add -tag description as suggested in PR/45071 2013-07-24 06:28:10 +00:00
joerg e240adbd0b Retire OSI network stack. OK core@ 2013-03-01 18:25:13 +00:00
uwe a855fb9e85 Fix fallout from 1.129 that converted sou::so_foo from unions to
pointers but missed (char *)&soup->so_foo => (char *)soup->so_foo in
mask_addr().  It worked by luck - unless it didn't: due to pointer
numerology on amd64 route add -net ClassC without explicit /24 prefix
length specification would result into /16 destination instead of /24.
2012-10-04 00:01:48 +00:00
christos 1e5d8920de remove useless rump headers. 2012-08-08 14:04:26 +00:00