summaryrefslogtreecommitdiff
path: root/sbin/route
AgeCommit message (Collapse)Author
2020-07-07Stop using make_addr() which trims trailing zeros of the netmask, setYASUOKA Masahiko
family and length field. This fixes route(8) to handle "::/0" properly. Also fix "route add -inet 0.0.0.0 -prefixlen 0 (gateway)" to work properly. ok kn
2020-01-19add some explicit tagging macros; OK kn@ on a previous versionIngo Schwarze
2020-01-15Replace duplicate error message with gai_strerror(3)kn
getaddrinfo(3) may fail for multiple reasons, but error message should be unique in general. OK bluhm
2019-11-22The DNS proposal list can (soon) be empty to signal a withdraw, relaxFlorian Obser
the size constraint to allow this to pass through the kernel. Looks good to deraadt@
2019-11-22Teach route(8) about RTP_PROPOSAL_UMBClaudio Jeker
2019-11-21output RTM_PROPOSALs more similar to other route messagesFlorian Obser
no objection krw@ who has further suggestions for improvement
2019-11-16Missing comma after RTM_PROPOSAL source.Kenneth R Westerback
ok bluhm@
2019-11-16When printing RTM_PROPOSAL and unspecified message types, print theKenneth R Westerback
interface name if known. As all the other message types do. ok bluhm@
2019-11-16When printing RTM_PROPOSAL messages use "if#" like all the otherKenneth R Westerback
messages, not "ifidx". ok bluhm@
2019-11-16More %d -> %u for unsigned values.Kenneth R Westerback
2019-11-16Whitespace nit.Kenneth R Westerback
ok bluhm@
2019-11-16rtm_version, rtm_type, rtm_msglen, rtm_index, rtm_priority, ifan_whatKenneth R Westerback
are u_char or u_short. So use %u instead of %d in printf(). ok bluhm@
2019-11-16Remove "(void)" casts from the 2 printf() statements thatKenneth R Westerback
had them. ok bluhm@
2019-11-09Add RTP_PROPOSAL_SOLICIT to allow unwind(8) to solicit DNS proposalsFlorian Obser
from slaacd and dhclient when it starts. Discussed with deraadt who notes that it's a bit odd to have this as a route priority. One idea is to have this as a dedicated route message and not a priority. But we want to move this forward and learn how it can be used so we are going with this for now. OK deraadt
2019-10-27Print interface index and name for RTM_NEWADDR, RTM_DELADDR andKenneth R Westerback
RTM_CHGADDRATTR messages. Be consistant and eliminate ':' after all 'name's. ok bluhm@
2019-10-25Forgot to add '\30AUTOONF4" to ifnetflags[].Kenneth R Westerback
route will now show "AUTOCONF4" in flags.
2019-08-31The algorithm creating the routing addresses in route(8) and arp(6)Alexander Bluhm
were still not correct. While the values written to the kernel are fine, the bytes for padding were taken from memory after the sockaddr structs. In route(8) the union of sockaddrs can be made larger, so that the padding is taken from there. In arp(8) the size of the struct is known. Copy only the struct and advance over the padding. The memory has been zeroed before. Merge all address size fixes from arp(8) into ndp(8). OK claudio@
2019-08-29The kernel uses rtm_addrs as a bit field for addresses that areAlexander Bluhm
included in the routing message. The significance of the bits has to be consistent with the order of the addresss. In route(8) store addresses in ascending order of RTA values. This allows to use MPLS routes together with route labels. OK mpi@ claudio@
2019-08-29route(8) used inet/inet6 autodetection also for the link addressAlexander Bluhm
type. Provide the address family AF_LINK and storage size of struct sockaddr_dl to the kernel when creating an IFP routing address. OK mpi@
2019-04-30elaborate a little on how route priorities work;Jason McIntyre
help/ok claudio
2019-04-17signpost the location of the text explaining routing table output a little ↵Jason McIntyre
better...
2019-03-31Restore -t behaviourkn
revision 1.178 from 23.10.2015 accidentially removed the tflag bits, turning `-t' into a NOOP. Found out the hard way during debug. OK deraadt
2019-01-23Make route(8) show the same flags in RTM_IFINFO messages asKenneth R Westerback
ifconfig(8) shows in its display of interface information. ok bluhm@
2019-01-22PF_ROUTE -> AF_ROUTE in the scattered sock()/setsockopt() callsKenneth R Westerback
where the "wrong" #define was used. ok dlg@
2018-11-12Recognize and display new RTM_80211INFO messages.Kenneth R Westerback
Original diff from phessler@. Many suggestions and tweaks from claudio@, stsp@, anton@. ok claudio@ stsp@ anton@ phessler@
2018-10-15Trust the resolver to give us a sockaddr_in6 sized objectFlorian Obser
if we ask for AF_INET6. OK kn, deraadt
2018-08-31Dont print "default" for "0.0.0.0" if it is a host route.YASUOKA Masahiko
diff from asou at soum.co.jp ok claudio kn
2018-08-30Fix "route add 0.0.0.0/0 <gateway>" to work properly. Shift countYASUOKA Masahiko
beyonds the integer width results undefined behavior in C spec. Actually the count is masked by 0x1f on amd64. Found by asou at soum.co.jp ok claudio kn schwarze
2018-08-09Drop support for guessing an old-style class A, B, or C netmask fromIngo Schwarze
a bare dot-notation IP address by counting trailing zero octets. Instead, assume -host when neither -net nor -netmask nor -prefixlen is given. Error out when -net is requested but no netmask is specified. This removes the last use of the IN_CLASS* macros from this program. OK claudio@ kn@, and many agreed with the general direction during g2k18.
2018-07-17stop assuming prefix lengths, remove inet6_makenetandmask()kn
This removes any logic that implies IPv6 destination host addresses to be /64 subnets so they are taken as is. RFC 3587 deprecated this in 2003 and our manual page actually states: The route is assumed to be to a network if any of the following apply to destination: * [...] * it is an IPv6 address with a “/XX” suffix (where XX is the number of bits in the network portion of the address and is less than 128) * [...] If destination is a valid IP address or host name, it is presumed to be a route to a host. Stripping relevant code from `inet6_makenetandmask()' left the function as dummy wrapper around `prefixlen()', so zap it completely. Discussed with and positive feedback from many, OK benno henning
2018-07-14Document that route monitor also takes -T rtable as an argument.Sebastian Benoit
2018-07-14Make route monitor display changes in all routing domains by forcingSebastian Benoit
the route filter to set RTABLE_ANY. Previously only the routing table/rdomain of the route process was displayed (that being the kernel default). ok kn@ claudio@ and henning@
2018-07-13no longer interpret 0.192.168.4 in hosts(5) as 192.168.4/24Ingo Schwarze
OK phessler@ claudio@ benno@ kn@ "steh' nicht rum, committe das" henning@
2018-07-13Use "rtable" not "tableid" as argument name for rtablekn
Make rtable(4) usage documentation consistent with other programs. This is to have `man -k ar~rtable' show the full list without having to look for other variations of the same argument type. OK bluhm
2018-07-12RTM_CHGADDRATTR for route monitorFlorian Obser
OK phessler, benno, claudio
2018-07-11Use AF_UNSPEC not 0kn
2018-07-10Error out if -netmask/-prefixlen does not follow the destination parameterkn
Since the address string comes last, `-prefixlen 56 2001:db8::' silently installs a route for /64 since that's the currently implied prefix length. The manual page already states that these options must follow the destination parameter in order to have any effect. Discussed at length with many OK benno sthen bluhm jca
2018-07-09Kill fluff about how route(8) is of limited usefulnessJeremie Courreges-Anglas
Don't say that route(8) is mostly useful to set up a default route, which is almost a lie. What's more, I'm not sure new users struggling with route(8) should be pointed to ripd(8) (sic) or bgpd(8) as a solution to their problems. ok benno@ kn@
2018-07-01Retire support for unused RTM_LOCK messages, it's redundant w/ RTM_CHANGE.Martin Pieuchot
ok tb@, sthen@
2018-06-18Replace hardcoded constants with defineskn
OK mpi henning blum
2018-06-04Zap unused sockaddr.kn
OK bluhm deraadt jca
2018-05-01The -d flag should be a no-op in monitor mode since it does not modifyFlorian Obser
the routing table. However, if -d is provided route monitor lists all interfaces and their associated addresses and exits. This is confusing, unexpected and no longer needed (if ever). Make -d a proper no-op for route monitor and get rid of the interfaces function which didn't use the correct sysctl idiom anyway. OK benno
2018-05-01Sync p_rttables() to netstat(1) version. Pointed out by claudio andFlorian Obser
mpi. Remaining differences are pledge and priority handling which only route(8) has. While here switch flushroutes to get_sysctl() function. OK benno
2018-04-30* simplify code by no longer calling getnetbyname(3)Ingo Schwarze
* avoid double lookups for unresolvable names without -net * more fitting error message for unresolvable names after -net OK florian@
2018-04-30tableid is either initialized to the current routing table or to theFlorian Obser
one specified by the T flag. No need to pass a flag around if the tableid is valid. It always is. This code is now in sync between flushroutes() and p_rttables(). OK benno, no objection claudio
2018-04-30No need to get the whole routing table from the kernel if we areFlorian Obser
filtering by address family and / or priority; similar to what p_rttables() is doing. (At the time of writing we need to copy about 150MB for the whole table on a router that is in the default free zone). OK benno
2018-04-30Fix route monitor -AF filter.Florian Obser
While here make and to see that this is correct and not touching any global state make af a local variable and pass it around. Input & OK benno
2018-04-28remove references to /etc/networks; reminded by jmc@Ingo Schwarze
2018-04-28Improve / simplify pledges.Florian Obser
1) after schwarze@'s rampage (thanks!) we can drop rpath since asr is no longer opening /etc/networks behind our back 2) we have the "route" pledge for the NET_RT_DUMP sysctl so we can pledge earlier in main; flushroutes() and p_rttables() now tighten the pledge instead of being the first pledge 3) the pledge in monitor() was just a repeat of the main() pledge, it can go. OK schwarze, deraadt
2018-01-16Recycle IFF_NOTRAILERS into IFF_STATICARP and document ownerhsipMartin Pieuchot
of IFF* flags. inputs from jmc@, ok bluhm@, visa@