summaryrefslogtreecommitdiffstats
path: root/sys/net/route.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* I'm not sure what was the problem at the time of revision 1.37ru2002-12-251-11/+0
| | | | | | | | when julian@ added it, but the commented out code had at least one bug -- not freeing the allocated mbuf. Anyway, this comment no longer applies as of revision 1.67, so remove it.
* Revision 1.67 changes correspond to CSRG revision 8.3.1.1 changes.ru2002-12-251-1/+1
|
* If the caller of rtrequest*(RTM_DELETE, ...) asked for a copy ofru2002-12-251-17/+5
| | | | | | the entry being removed (ret_nrt != NULL), increment the entry's rt_refcnt like we do it for RTM_ADD and RTM_RESOLVE, rather than messing around with 1->0 transitions for rtfree() all over.
* SMP locking for radix nodes.hsu2002-12-241-10/+27
|
* rn_walktree*() compute the next leaf before applying a functionru2002-12-231-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to current leaves because function may vanish the current node. If parent RTA_GENMASK route has a clone (a "cloning clone"), an rn_walktree_from() starting from parent will cause another walk starting from clone. If a function is either rt_fixdelete() or rt_fixchange(), this recursive walk may vanish the leaf that is remembered by an outer walk (the "next leaf" above), panicing a system when it resumes with an outer walk. The following script paniced my single-user mode booted system: : sysctl net.inet.ip.forwarding=1 : ipfw add 1 allow ip from any to any : ifconfig lo0 127.1 : route add -net 10 -genmask 255.255.255.0 127.1 : telnet 10.1 # rt_fixchange() panic : telnet 10.2 : telnet 10.1 : route delete -net 10 # rt_fixdelete() panic For the time being, avoid these races by disallowing recursive walks in rt_fixchange() and rt_fixdelete(). Also, make a slight optimization in the rtrequest(RTM_RESOLVE) case: there is no reason to call rt_fixchange() in this case. PR: kern/37606 MFC after: 5 days
* Lock up ifaddr reference counts.hsu2002-12-181-21/+8
|
* Massive cleanup of the ip_mroute code.luigi2002-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No functional changes, but: + the mrouting module now should behave the same as the compiled-in version (it did not before, some of the rsvp code was not loaded properly); + netinet/ip_mroute.c is now truly optional; + removed some redundant/unused code; + changed many instances of '0' to NULL and INADDR_ANY as appropriate; + removed several static variables to make the code more SMP-friendly; + fixed some minor bugs in the mrouting code (mostly, incorrect return values from functions). This commit is also a prerequisite to the addition of support for PIM, which i would like to put in before DP2 (it does not change any of the existing APIs, anyways). Note, in the process we found out that some device drivers fail to properly handle changes in IFF_ALLMULTI, leading to interesting behaviour when a multicast router is started. This bug is not corrected by this commit, and will be fixed with a separate commit. Detailed changes: -------------------- netinet/ip_mroute.c all the above. conf/files make ip_mroute.c optional net/route.c fix mrt_ioctl hook netinet/ip_input.c fix ip_mforward hook, move rsvp_input() here together with other rsvp code, and a couple of indentation fixes. netinet/ip_output.c fix ip_mforward and ip_mcast_src hooks netinet/ip_var.h rsvp function hooks netinet/raw_ip.c hooks for mrouting and rsvp functions, plus interface cleanup. netinet/ip_mroute.h remove an unused and optional field from a struct Most of the code is from Pavlin Radoslavov and the XORP project Reviewed by: sam MFC after: 1 week
* Ensure that packet counts are always reset to 0 whensilby2002-05-311-0/+1
| | | | | | | | a route is cloned. Previously, they took on the count of their parent route (which was sometimes nonzero.) Submitted by: Andre Oppermann <oppermann@pipeline.ch> MFC after: 5 days
* Remove __P.alfred2002-03-191-5/+5
|
* Fix a typo in a commentbrian2001-11-281-1/+1
|
* Pull post-4.4BSD change to sys/net/route.c from BSD/OS 4.2.ru2001-10-171-103/+153
| | | | | | | | | | | | | | | | | | | | Have sys/net/route.c:rtrequest1(), which takes ``rt_addrinfo *'' as the argument. Pass rt_addrinfo all the way down to rtrequest1 and ifa->ifa_rtrequest. 3rd argument of ifa->ifa_rtrequest is now ``rt_addrinfo *'' instead of ``sockaddr *'' (almost noone is using it anyways). Benefit: the following command now works. Previously we needed two route(8) invocations, "add" then "change". # route add -inet6 default ::1 -ifp gif0 Remove unsafe typecast in rtrequest(), from ``rtentry *'' to ``sockaddr *''. It was introduced by 4.3BSD-Reno and never corrected. Obtained from: BSD/OS, NetBSD MFC after: 1 month PR: kern/28360
* 64-bit fixes from CSRG.ru2001-10-171-2/+2
|
* Don't even attempt to clone host routes.ru2001-10-151-2/+4
| | | | MFC after: 1 week
* Don't bother passing p to rtioctl just so it can fail to pass it to mrt_ioctlfenner2001-07-251-6/+1
|
* As commented in defined in sys/net/route.c, rt_fixchange() has a badume2001-07-251-5/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | effect, which would cause unnecessary route deletion: * Unfortunately, this has the obnoxious * property of also triggering for insertion /above/ a pre-existing network * route and clones. Sigh. This may be fixed some day. The effect has been even worse, because recent versions of route.c set the parent rtentry for cloned routes from an interface-direct route. For example, suppose that we have an interface "ne0" that has an IPv4 subnet "10.0.0.0/24". Then we may have a cloned route like 10.0.0.1 on the interface, whose parent route is 10.0.0.0/24 (to the interface ne0). Now, when we add the default route (i.e. 0.0.0.0/0), rt_fixchange() will remove the cloned route 10.0.0.1. The (bad) effect also prevents rt_setgate from configuring rt_gwroute, which would not be an intended behavior. As suggested in the comments to rt_fixchange(), we need stricter check in the function, to prevent unintentional route deletion. This fix also solve the "IPV6 panic?" problem in nd6_timer(). Submitted by: JINMEI Tatuya <jinmei@isl.rdc.toshiba.co.jp> MFC after: 4 days
* When looking for an interface appropriate for the (new or changing)ru2001-06-041-1/+1
| | | | | | | | | route in ifa_ifwithroute(), as the last resort, look up the route to the gateway, not destination (to derive the interface from). PR: kern/27852 Submitted by: Iasen Kostoff <tbyte@tbyte.org> MFC after: 2 weeks
* net/route.c:ru2001-03-151-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A route generated from an RTF_CLONING route had the RTF_WASCLONED flag set but did not have a reference to the parent route, as documented in the rtentry(9) manpage. This prevented such routes from being deleted when their parent route is deleted. Now, for example, if you delete an IP address from a network interface, all ARP entries that were cloned from this interface route are flushed. This also has an impact on netstat(1) output. Previously, dynamically created ARP cache entries (RTF_STATIC flag is unset) were displayed as part of the routing table display (-r). Now, they are only printed if the -a option is given. netinet/in.c, netinet/in_rmx.c: When address is removed from an interface, also delete all routes that point to this interface and address. Previously, for example, if you changed the address on an interface, outgoing IP datagrams might still use the old address. The only solution was to delete and re-add some routes. (The problem is easily observed with the route(8) command.) Note, that if the socket was already bound to the local address before this address is removed, new datagrams generated from this socket will still be sent from the old address. PR: kern/20785, kern/21914 Reviewed by: wollman (the idea)
* A couple months ago, Kirk and I were doing a walkthrough of the radix-treewollman2000-04-231-1/+1
| | | | | | | | search routine, and scratching our heads over why it was so obfuscated. This delta fixes a number of confusing style bugs and renames several structure members to have more meaningful names. There remain a number of odd control-flow structures. These changes do not affect the generated code.
* Clear ro->ro_rt just after RTFREE().shin2000-01-151-0/+1
| | | | | | | | | Pleases let me make sure that no one touch the invalid ro_rt pointer, after splx(s) and before next ro_rt initialization. Though usually this seems to be already called at splnet, I still sometime experience kernel crash at rtfree() in my INET6 enabled environment where IPv6 connection is frequently used. (Off-course, it might be just due to another bug.)
* IPSEC support in the kernel.shin1999-12-221-1/+2
| | | | | | | | pr_input() routines prototype is also changed to support IPSEC and IPV6 chained protocol headers. Reviewed by: freebsd-arch, cvs-committers Obtained from: KAME project
* Fix a route table leak in rtalloc() and rtalloc_ign(). It isjdp1999-12-091-5/+12
| | | | | | | | | | | | | | possible for ro->ro_rt to be non-NULL even though the RTF_UP flag is cleared. (Example: a routing daemon or the "route" command deletes a cloned route in active use by a TCP connection.) In that case, the code was clobbering a reference to the routing table entry without decrementing the entry's reference count. The splnet() call probably isn't needed, but I haven't been able to prove that yet. It isn't significant from a performance standpoint since it is executed very rarely. Reviewed by: wollman and others in the freebsd-current mailing list
* rtcalloc() is removed because it turned out not to be necessary for FreeBSD.shin1999-12-091-10/+0
| | | | | | (It was added as a part of KAME patch) Specified by: jdp@polstra.com
* Only emit the ``wrong ifa'' message if the matching interfacebrian1999-11-231-3/+5
| | | | | | | | | | | | | | | | is neither IFF_LOOPBACK or IFF_POINTOPOINT. It's quite common (and probably more correct) to route local IP numbers via lo0 and it makes configuration easier to assign the hostname address to local POINTOPOINT links too. This message usually remains hidden because the loopback interface gets the highest interface number at boot time, but when the ethernet interface is added later, the message can get pretty annoying. Also, fix a typo. Not objected to by: freebsd-net
* KAME netinet6 basic part(no IPsec,no V6 Multicast Forwarding, no UDP/TCPshin1999-11-221-16/+30
| | | | | | | | | | for IPv6 yet) With this patch, you can assigne IPv6 addr automatically, and can reply to IPv6 ping. Reviewed by: freebsd-arch, cvs-committers Obtained from: KAME project
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Postpone route_init() until all domains are attached.luoqi1999-04-291-1/+4
|
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-2/+2
| | | | kernel compile
* Seventy-odd "its" / "it's" typos in comments fixed as per kern/6108.des1998-04-171-3/+3
|
* Staticize.eivind1998-02-091-2/+2
|
* Back out DIAGNOSTIC changes.eivind1998-02-061-2/+1
|
* Turn DIAGNOSTIC into a new-style option.eivind1998-02-041-1/+2
|
* Make INET a proper option.eivind1998-01-081-1/+2
| | | | | | | | | | | | This will not make any of object files that LINT create change; there might be differences with INET disabled, but hardly anything compiled before without INET anyway. Now the 'obvious' things will give a proper error if compiled without inet - ipx_ip, ipfw, tcp_debug. The only thing that _should_ work (but can't be made to compile reasonably easily) is sppp :-( This commit move struct arpcom from <netinet/if_ether.h> to <net/if_arp.h>.
* Removed unused #includes.bde1997-10-281-8/+1
|
* Fixed gratuitous ANSIisms.bde1997-09-161-5/+9
|
* Added used #include - don't depend on <sys/mbuf.h> includingbde1997-09-021-1/+2
| | | | <sys/malloc.h> (unless we only use the bogusly shared M*WAIT flags).
* Don't include <sys/ioctl.h> in the kernel. Stage 1: don't includebde1997-03-241-2/+1
| | | | | it when it is not used. In most cases, the reasons for including it went away when the special ioctl headers became self-sufficient.
* add a bunch of comments to describe what's going on.julian1997-03-051-16/+123
| | | | | | | This is some of the worst code I've had to wade through in ages and I don't want to have to start from scratch again next time. (I have a 2.2 version of these comments, can I commit them?)
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* fix mixleading comment (my error.. I wrote the comment)julian1997-01-261-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | 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.
* No code changes what so ever, but added about 150 lines of commentsjulian1996-09-101-4/+149
| | | | | | | | Sorry if this makes it harder to merge in lite2 stuff but hey.. At least I can figure out what is going on whenever I end up going through those files again.. do we have a policy regarding commenting existing code?
* Bugfix and simplification for rev 1.34: make sure that the routefenner1996-09-021-16/+6
| | | | | | is non-null before trying to delete it in rt_setgate(), which then allows removal of the special-case code from the RTM_ADD case. This should fix the panics that joerg and Phil Karn have been seeing.
* route.c:RTM_ADD does not check for a netmask before doing a tree walkpeter1996-08-241-2/+2
| | | | | | | | like it does elsewhere. This is probably only happens when incorrect args are given to route(8), or when running with non-IPv4 stacks but incorrect args to the route command is no excuse for panicing! Submitted by: Michael Clay <mclay@weareb.org>, PR#1532
* Disallow host routes that point to themselves. These routes serve nofenner1996-07-101-3/+32
| | | | | | | | | | | purpose, other than to get in the way of the ARP table and cause "can't allocate llinfo" errors. This change may cause gated or routed to start complaining when adding such routes. If so, these programs will need to be fixed to not try to add these routes. Reviewed by: wollman
* Eliminate panic("rtfree") caused by double-freeing the routefenner1996-03-291-5/+6
| | | | | | | | when rt == rt->rt_gwroute . rt == rt->gwroute shouldn't happen in the first place, but that's another problem. (try "route add -host <hostonmynet> <hostonmynet>; ping <hostonmynet>; route delete <hostonmynet>")
* Move or add #include <queue.h> in preparation for upcoming struct socketdg1996-03-111-1/+2
| | | | changes.
* Add more options into the conf/options and i386/conf/options.i386 filespeter1996-03-021-1/+3
| | | | | | and the #include hooks so that 'make depend' is more useful. This covers most of the options I regularly use (but not all) and some other easy ones.
* Fix memory leak in case of adding a host route on top of another one.wollman1996-01-241-1/+3
| | | | Pointed-out-by: Bill Fenner <fenner@parc.xerox.com>
* Another mega commit to staticize things.phk1995-12-141-6/+9
|
OpenPOWER on IntegriCloud