summaryrefslogtreecommitdiffstats
path: root/sys/net/radix.c
Commit message (Collapse)AuthorAgeFilesLines
* whitespace cleanupluigi2010-07-151-2/+2
|
* One of the advantages of enabling ECMP (a.k.a RADIX_MPATH) is toqingli2010-03-091-0/+2
| | | | | | | | | | | | | | | | | | | | | allow for connection load balancing across interfaces. Currently the address alias handling method is colliding with the ECMP code. For example, when two interfaces are configured on the same prefix, only one prefix route is installed. So connection load balancing among the available interfaces is not possible. The other advantage of ECMP is for failover. The issue with the current code, is that the interface link-state is not reflected in the route entry. For example, if there are two interfaces on the same prefix, the cable on one interface is unplugged, new and existing connections should switch over to the other interface. This is not done today and packets go into a black hole. Also, there is a small bug in the kernel where deleting ECMP routes in the userland will always return an error even though the command is successfully executed. MFC after: 5 days
* Not only flush the ipfw tables when unloading ipfw or tearingbz2010-03-071-2/+0
| | | | | | | | down a virtual netowrk stack, but also free the Radix Node Head. Sponsored by: ISPsystem Reviewed by: julian MFC after: 5 days
* Introduce a function rn_detachhead() that will free thebz2010-03-061-0/+18
| | | | | | | | | | radix table root nodes. This is only needed (and available) in the virtualization case to free the resources when tearing down a virtual network stack. Sponsored by: ISPsystem Reviewed by: julian, zec MFC after: 5 days
* remove unnecessary casts leftover from a bogus fix to a previous bugluigi2010-03-021-1/+1
|
* Move the scan for max_keylen into route.c::route_init(),luigi2009-12-141-24/+2
| | | | | | | and make max_keylen an argument for rn_init(). This removes an unnecessary dependency on domain.h from radix.c MFC after: 7 days
* Make the code buildable in userland so it is easier to test it:luigi2009-12-121-8/+25
| | | | | | | | | | | | | | this requires a small reordering of headers and a few #defines to map functions not available in userland. Remove a useless #ifndef block at the beginning of the file. Introduce (temporarily) rn_init2(), see the comment in the code for the proper long term change. No ABI or functional change. MFC after: 7 days
* No functional changes (who dares to touch this code!) but:luigi2009-12-101-5/+8
| | | | | | | | | | - cast the result of LEN() to int as this is the main usage. - use LEN() in one place where it was forgotten. - Document the use of a static variable in rw mode. More small changes to follow. MFC after: 7 days
* remove assertion checks for now - ipfw uses its own lock for protecting its ↵kmacy2008-12-161-6/+0
| | | | radix tree instance
* assert that the radix node head is locked when manipulating the treekmacy2008-12-161-0/+7
|
* - convert radix node head lock from mutex to rwlockkmacy2008-12-071-0/+1
| | | | | | | | - make radix node head lock not recursive - fix LOR in rtexpunge - fix LOR in rtredirect Reviewed by: sam
* This patch provides the back end support for equal-cost multi-pathqingli2008-04-131-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (ECMP) for both IPv4 and IPv6. Previously, multipath route insertion is disallowed. For example, route add -net 192.103.54.0/24 10.9.44.1 route add -net 192.103.54.0/24 10.9.44.2 The second route insertion will trigger an error message of "add net 192.103.54.0/24: gateway 10.2.5.2: route already in table" Multiple default routes can also be inserted. Here is the netstat output: default 10.2.5.1 UGS 0 3074 bge0 => default 10.2.5.2 UGS 0 0 bge0 When multipath routes exist, the "route delete" command requires a specific gateway to be specified or else an error message would be displayed. For example, route delete default would fail and trigger the following error message: "route: writing to routing socket: No such process" "delete net default: not in table" On the other hand, route delete default 10.2.5.2 would be successful: "delete net default: gateway 10.2.5.2" One does not have to specify a gateway if there is only a single route for a particular destination. I need to perform more testings on address aliases and multiple interfaces that have the same IP prefixes. This patch as it stands today is not yet ready for prime time. Therefore, the ECMP code fragments are fully guarded by the RADIX_MPATH macro. Include the "options RADIX_MPATH" in the kernel configuration to enable this feature. Reviewed by: robert, sam, gnn, julian, kmacy
* The code in rn_walktree_from() that checks if we backed up too farqingli2006-02-071-1/+9
| | | | | | | | | | | | did not stop at the right node. Change the backtracking check from smaller-than to smaller-or-equal to prevent this from happening. While here fix one additional problem where the insertion of the default route traversed the entire tree. PR: kern/38752 Submitted by: qingli (before I became committer) Reviewed by: andre MFC after: 3 days
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* Readability fixes:luigi2004-04-211-12/+76
| | | | | | | | | | | | | | | | | | | | | | Clearly comment the assumptions on the structure of keys (addresses) and masks, and introduce a macro, LEN(p), to extract the size of these objects instead of using *(u_char *)p which might be confusing. Comment the confusion in the types used to pass around pointers to keys and masks, as a reminder to fix that at some point. Add a few comments on what some functions do. Comment a probably inefficient (but still correct) section of code in rn_walktree_from() The object code generated after this commit is the same as before. At some point we should also change same variable identifiers such as "t, tt, ttt" to fancier names such as "root, left, right" (just in case someone wants to understand the code!), replace misspelling of NULL as 0, remove 'register' declarations that make little sense these days.
* Add some comments, move a static array of constants in the only placeluigi2004-04-191-8/+16
| | | | | where it is used, and replace R_Malloc with R_Zalloc in a couple of places removing the corresponding bzero()'s
* + move MKGet()/MKFree() into the only file that can use them.luigi2004-04-181-13/+19
| | | | | | | | + remove useless wrappers around bcmp(), bcopy(), bzero(). The code assumes that bcmp() returns 0 if the size is 0, but this is true for both the libc and the libkern versions. + nuke Bcmp, Bzero, Bcopy from radix.h now that nobody uses them anymore.
* Remove advertising clause from University of California Regent'simp2004-04-071-4/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* While cleaning out my tree, fix another strict alias warning that wouldpeter2003-09-221-1/+1
| | | | be happening if we didn't stop compiling with -fno-strict-aliasing.
* Make the radix tree code compilable in userland. Requested by ru.hsu2003-02-081-0/+4
| | | | Some style fixes requested by bde.
* Typo in function name.ru2002-12-251-4/+4
|
* A month after pst@ has committed his revision 1.8, it wasru2002-12-251-3/+6
| | | | incorporated by UCB as revision 8.5. Do a diff reduction.
* SMP locking for radix nodes.hsu2002-12-241-0/+1
|
* o Untangle the confusion with the malloc flags {M_WAITOK, M_NOWAIT} andbmilekic2002-12-191-1/+0
| | | | | | | | | | the mbuf allocator flags {M_TRYWAIT, M_DONTWAIT}. o Fix a bpf_compat issue where malloc() was defined to just call bpf_alloc() and pass the 'canwait' flag(s) along. It's been changed to call bpf_alloc() but pass the corresponding M_TRYWAIT or M_DONTWAIT flag (and only one of those two). Submitted by: Hiten Pandya <hiten@unixdaemons.com> (hiten->commit_count++)
* Fix instances of macros with improperly parenthasized arguments.alfred2002-11-091-1/+1
| | | | Verified by: md5
* just merged cosmetic changes from KAME to ease sync between KAME and FreeBSD.suz2002-04-191-1/+1
| | | | | | | (based on freebsd4-snap-20020128) Reviewed by: ume MFC after: 1 week
* Fixed some style bugs in the removal of __P(()). The main ones werebde2002-03-241-5/+5
| | | | | | not removing tabs before "__P((", and not outdenting continuation lines to preserve non-KNF lining up of code with parentheses. Switch to KNF formatting and/or rewrap the whole prototype in some cases.
* Remove __P.alfred2002-03-191-13/+13
|
* Initialize rn_mklist in rn_newpair(). The undocumented assumptionwollman2000-10-271-0/+1
| | | | | | | | | seems to be that the nodes are bzero'd beforehand, but the submitter found that this was not always the case, and in any event defensive programming here costs epsilon squared. PR: 22244 Submitted by: Dave Gillam <daveg@chiaro.com>
* A couple months ago, Kirk and I were doing a walkthrough of the radix-treewollman2000-04-231-145/+190
| | | | | | | | 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.
* Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"peter1999-12-291-2/+2
| | | | | | is an application space macro and the applications are supposed to be free to use it as they please (but cannot). This is consistant with the other BSD's who made this change quite some time ago. More commits to come.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Never return the root node itself from rn_match(); return NULL instead.pb1999-06-251-2/+5
| | | | | | | | | | | | This caused a panic in rtfreee() called with a root node from the routing socket code (when processing a RTM_GET message looking for the default route while there is none). Since no existing code seems to have any use getting the root node from rn_match(), it seems cleaner never to return it rather than check for this condition at the caller's. PR: kern/12265
* Postpone route_init() until all domains are attached.luoqi1999-04-291-2/+1
|
* Temporary hack. The radix code shouldn't need this, it should bepeter1999-04-261-1/+2
| | | | | | | | able to expand the zeros, ones etc masks on the fly. It seems a good number of domains don't set the rn_maxkey variable anyway, and because this is a domain itself, there is no guarantee we've been called after a protocol that actually has set it (ie: inet), so start with a maxkey of a relatively sane size as a base point until it can adapt on the fly.
* Fixed printf format errors.bde1998-07-111-3/+4
|
* Unstaticized rn_delete() and rn_lookup(). They are used in dark cornersbde1997-11-241-9/+5
| | | | | | of netatalk (if NETATALKDEBUG is configured). Removed stray semicolons.
* Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are notpeter1997-02-221-1/+1
| | | | ready for it yet.
* 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.
* Another mega commit to staticize things.phk1995-12-141-13/+21
|
* Completed function declarations and/or added prototypes.bde1995-12-021-3/+17
|
* Remove trailing whitespace.rgrimes1995-05-301-13/+13
|
* Incorporate new radix code from UCB. This fixes the orphaned mask bugs.pst1995-04-281-146/+295
| | | | | | | | | This submission was done by hand-applying FreeBSD local modifications on top of the UCB code, rather than trying to patch the UCB code in on top of the FreeBSD code due to the extensive changes. Reviewed by: pst (been handling 30k routes for 4+ months) Obtained from: Sklower/Woody/Honing/Traina (8.4 UCB release)
* radix.c: correct exit condition in rn_walktree_from()wollman1995-03-231-2/+18
| | | | | route.c: be a little more careful when running deleting children of dying . routes
* Better fix for the deletion of parents of cloned routes problem,wollman1995-03-201-1/+80
| | | | | superseding the `nextchild' hack. This also provides a way forward to fix RTM_CHANGE and RTM_ADD as well.
* moved a message into a #ifdef DEBUG. This message comes out if a kernelphk1994-10-151-1/+3
| | | | | doesn't have any networking in it. For instance the new "MINI" install- kernel.
* Cosmetics: to silence gcc -wall.phk1994-10-081-12/+14
|
* Added $Id$dg1994-08-021-0/+1
|
* The big 4.4BSD Lite to FreeBSD 2.0.0 (Development) patch.rgrimes1994-05-251-1/+1
| | | | | Reviewed by: Rodney W. Grimes Submitted by: John Dyson and David Greenman
* BSD 4.4 Lite Kernel Sourcesrgrimes1994-05-241-0/+757
OpenPOWER on IntegriCloud