aboutsummaryrefslogtreecommitdiff
path: root/sbin/route/route.c
Commit message (Collapse)AuthorAgeFilesLines
* Introduce "route del" as an alias to "route delete".Anton Berezin2005-09-281-0/+1
| | | | | | | Reviewed by: arch Notes: svn path=/head/; revision=150679
* - Understand EADDRINUSE, and forget EDQUOT. [1]Gleb Smirnoff2005-09-211-2/+6
| | | | | | | | | | | | - 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] Notes: svn path=/head/; revision=150415
* - do DNS lookup for symbolic names specified for a destinationHajimu UMEMOTO2005-05-231-4/+5
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=146546
* NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 definesHajimu UMEMOTO2005-05-131-6/+0
| | | | | | | | NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special for it, now. Notes: svn path=/head/; revision=146187
* shutdown(2)'s how argument as 0 is nowhere near as cool as SHUT_RDJuli Mallett2005-05-111-2/+2
| | | | Notes: svn path=/head/; revision=146079
* When parsing an argument as an address in getaddr(), heed the -host optionBruce M Simpson2004-06-161-1/+1
| | | | | | | | | | in all cases. The failure mode in the PR is easily reproducible without this patch. PR: bin/43139 Notes: svn path=/head/; revision=130569
* Teach route(8) how to deal with root being in a prison. If prisonChristian S.J. Peron2004-05-071-0/+4
| | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=129034
* Link state change notification of ethernet media to the routing socket.Andre Oppermann2004-05-031-1/+14
| | | | | | | | | | o Print the link state for interface messages in monitor mode. No objections by: sam, wpaul, ru, bms Brucification by: bde Notes: svn path=/head/; revision=128878
* For both ifconfig and route if we didn't get enough memory from theDoug Ambrisko2004-04-301-4/+22
| | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=128782
* Replace ROUNDUP/ADVANCE with SA_SIZELuigi Rizzo2004-04-131-8/+4
| | | | Notes: svn path=/head/; revision=128186
* Remove advertising clause from University of California Regent's license,Mark Murray2004-04-091-4/+0
| | | | | | | | | per letter dated July 22, 1999. Approved by: core, imp Notes: svn path=/head/; revision=128073
* link-local multicast address must be converted to KAME specificHajimu UMEMOTO2003-12-071-1/+1
| | | | | | | | | | embeded scopeid form. Reported by: dwmalone MFC after: 3 days Notes: svn path=/head/; revision=123234
* There is an undocument feature that ``route -vnd flush'' printsRuslan Ermilov2003-04-161-1/+1
| | | | | | | | a nice dump of the entire routing table. Allow non-root users to see it too. Notes: svn path=/head/; revision=113559
* Kill #ifdef NS codePeter Wemm2003-03-051-110/+0
| | | | Notes: svn path=/head/; revision=111921
* Since route(8) itself is no longer setuid, we can get a meaningfulKelly Yancey2003-01-251-1/+1
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=109811
* Don't have -prefixlen 128 on host routes.Hajimu UMEMOTO2002-06-081-8/+5
| | | | | | | Obtained from: KAME Notes: svn path=/head/; revision=98053
* Avoid construction which results in label at end of block.Garrett Wollman2002-05-301-2/+6
| | | | Notes: svn path=/head/; revision=97637
* Respect -q with "add" and "delete". Document who respects -q.Ruslan Ermilov2002-05-251-30/+31
| | | | | | | PR: bin/38531 Notes: svn path=/head/; revision=97278
* Allow prefix/prefixlen syntax for IPv6 to have consistencyHajimu UMEMOTO2002-05-211-15/+22
| | | | | | | with IPv4. Notes: svn path=/head/; revision=97073
* Have RTF_HOST for /128 destionation.Hajimu UMEMOTO2002-05-211-4/+9
| | | | Notes: svn path=/head/; revision=97062
* Try to guess prefixlen for guessable cases.Hajimu UMEMOTO2002-05-201-0/+33
| | | | | | | | | | | - /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 Notes: svn path=/head/; revision=96997
* o remove __PWarner Losh2002-03-211-3/+3
| | | | | | | o remove main prototype Notes: svn path=/head/; revision=92883
* Remove 'register' keyword.David E. O'Brien2002-03-201-30/+30
| | | | | | | | | 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?) Notes: svn path=/head/; revision=92806
* Introduce an interface announcement message for the routingRuslan Ermilov2002-01-181-1/+24
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=89498
* Bring in latest CSRG revisions to this file.Ruslan Ermilov2001-10-171-11/+11
| | | | Notes: svn path=/head/; revision=85048
* Synch with NetBSD and OpenBSD.Ruslan Ermilov2001-08-311-2/+2
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=82651
* Handle snprintf() returning < 0 (not just -1)Brian Somers2001-08-201-0/+4
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=81980
* Handle snprintf() returning -1.Brian Somers2001-08-201-4/+6
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=81976
* Due to the documented bug in inet_aton(3), it wasn't possibleRuslan Ermilov2001-07-111-2/+3
| | | | | | | | | | | | | | 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''. Notes: svn path=/head/; revision=79588
* Allow route(8) to create "proxy only" published ARP entries.Ruslan Ermilov2001-06-121-1/+10
| | | | | | | | PR: bin/12357 Submitted by: Craig Leres <leres@ee.lbl.gov> Notes: svn path=/head/; revision=78140
* Fixed the -iface breakage introduced with the latest KAME mergeRuslan Ermilov2001-06-121-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=78139
* Sync with recent KAME.Hajimu UMEMOTO2001-06-111-120/+114
| | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=78064
* When changing an indirect route, kernel routing code allocatesRuslan Ermilov2001-06-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=77908
* Change the host/bits syntax introduced in route.c,v 1.24 to theRuslan Ermilov2001-06-081-6/+5
| | | | | | | | | | net/bits syntax, for consistency with netstat(1) in particular. OK'ed by: phk MFC after: 1 week Notes: svn path=/head/; revision=77904
* - Exit 1 if "add", "change", or "delete" operation fails.Ruslan Ermilov2001-06-071-10/+8
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=77873
* Add a couple of newlines in the output from route monitorPoul-Henning Kamp2001-01-151-2/+4
| | | | Notes: svn path=/head/; revision=71061
* Add `_PATH_DEVZERO'.David E. O'Brien2000-12-091-1/+2
| | | | | | | Use _PATH_* where where possible. Notes: svn path=/head/; revision=69793
* Interpret the address argument as network-type address for `destination'Ruslan Ermilov2000-09-291-13/+12
| | | | | | | | | 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. Notes: svn path=/head/; revision=66449
* Fixed the case where argument of 0.0.0.0/8 would match the default route.Ruslan Ermilov2000-09-291-4/+4
| | | | Notes: svn path=/head/; revision=66448
* Clear sin6_scope_id before passing routes into kernel, becaues kernelYoshinobu Inoue2000-03-111-0/+1
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=57918
* Add an scope index embedded IPv6 link local addr creation support, by routeYoshinobu Inoue2000-02-231-0/+4
| | | | | | | | | command. This is a workaround for some kernel interface which can't treat sin6_scope_id, yet. Notes: svn path=/head/; revision=57396
* Support IPv6 scoped addr in ifconfig and routeYoshinobu Inoue2000-02-101-25/+71
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=57108
* Fix return value check for inet_pton().Munechika SUMIKAWA2000-01-251-1/+1
| | | | | | | Obtained from: KAME Project Notes: svn path=/head/; revision=56588
* Merge bug fix from KAME repository.Yoshinobu Inoue2000-01-081-7/+0
| | | | | | | | | This fix enables inet6 default route addition. Suggested by: itojun Notes: svn path=/head/; revision=55602
* udp IPv6 support, IPv6/IPv4 tunneling support in kernel,Yoshinobu Inoue1999-12-071-7/+143
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=54263
* Remove two more unnecessary function declarations/prototypes.Bill Fumerola1999-09-251-4/+0
| | | | Notes: svn path=/head/; revision=51640
* Include the proper headers, remove the unnecessary function declarations.Bill Fumerola1999-09-251-1/+2
| | | | Notes: svn path=/head/; revision=51639
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50476
* When incrementing through a SIOCGIFCONF list, enforce a lower limit ofArchie Cobbs1999-06-051-2/+3
| | | | | | | | | | | | 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. Notes: svn path=/head/; revision=47754
* Get rid of segfaults in a set-uid program.Ruslan Ermilov1999-06-011-8/+15
| | | | | | | | PR: 11823 Reviewed by: des Notes: svn path=/head/; revision=47668