OpenBSD CVS

CVS log for src/usr.sbin/bgpd/rde_rib.c


[BACK] Up to [local] / src / usr.sbin / bgpd

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.262 / (download) - annotate - [select for diffs], Wed May 29 10:34:56 2024 UTC (3 days, 10 hours ago) by claudio
Branch: MAIN
CVS Tags: HEAD
Changes since 1.261: +8 -5 lines
Diff to previous 1.261 (colored)

Rename nexthop_compare to nexthop_cmp and make it static inline.
OK henning@ sthen@

Revision 1.261 / (download) - annotate - [select for diffs], Mon Oct 16 10:25:46 2023 UTC (7 months, 2 weeks ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.260: +2 -2 lines
Diff to previous 1.260 (colored)

Improve IPv6 link-local address handling

When a session is established determine the possible interface scope of that
session. The scope is only set when the remote address is directly connected.
This interface scope is passed to the RDE that uses this information when
link-local nexthops are received. Again checking that a link-local nexthop
is actually acceptable.

OK tb@

Revision 1.260 / (download) - annotate - [select for diffs], Sun Apr 23 11:39:10 2023 UTC (13 months, 1 week ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.259: +5 -2 lines
Diff to previous 1.259 (colored)

Add the same AID filter to prefix_flowspec_dump() like in the other
prefix/rib dump functions.
OK tb@

Revision 1.259 / (download) - annotate - [select for diffs], Wed Apr 19 13:23:33 2023 UTC (13 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.258: +87 -1 lines
Diff to previous 1.258 (colored)

Implement a way to announce flowspec rules without hitting Adj-RIB-In
and Loc-RIB. Flowspec objects are collected in a single flowrib RIB
and then directly distributed into the various Adj-RIB-Outs.
For this to work add a bypass in the filter logic (flowspec AFI/SAFI
are currently accepted without any rule). The filter language lacks
a way to allow prefixes based on AFI/SAFI which is the minimum needed.
OK tb@

Revision 1.258 / (download) - annotate - [select for diffs], Fri Apr 7 13:49:03 2023 UTC (13 months, 3 weeks ago) by claudio
Branch: MAIN
Changes since 1.257: +20 -15 lines
Diff to previous 1.257 (colored)

Pass a pt_entry pointer to rib_get() and rib_add().
Add rib_get_addr() to behave like rib_get() did before.
OK tb@

Revision 1.257 / (download) - annotate - [select for diffs], Wed Mar 29 10:46:11 2023 UTC (14 months ago) by claudio
Branch: MAIN
Changes since 1.256: +20 -15 lines
Diff to previous 1.256 (colored)

Switch prefix_adjout_get and new prefix_adjout_first to use a pt_entry
as argument instead of the bgpd_addr + prefixlen.

Do the same with prefix_adjout_update but leave prefix_adjout_lookup
and prefix_adjout_match since those are used by bgpctl code that does
not use pt_entry structs.

With this most of the update code no longer needs struct bgpd_addr and
pt_getaddr().
OK tb@

Revision 1.256 / (download) - annotate - [select for diffs], Tue Mar 28 15:17:34 2023 UTC (14 months ago) by claudio
Branch: MAIN
Changes since 1.255: +1 -81 lines
Diff to previous 1.255 (colored)

Instead of exracting the prefix into a bgpd_addr and passing that to
prefix_write() rename prefix_write() to pt_write() and pass a pt_entry to
the function. Removes an extra conversion step.
OK tb@

Revision 1.255 / (download) - annotate - [select for diffs], Thu Feb 9 13:43:23 2023 UTC (15 months, 3 weeks ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.254: +12 -12 lines
Diff to previous 1.254 (colored)

Instead of relaying struct peer from the SE to the RDE to fill out 10
stat numbers, just send the peerid and have the RDE response with the
stats. The control code will then merge these counters into the real
peer struct and send that to bgpctl. This reduces the number of bytes
sent around a fair bit.
OK tb@

Revision 1.254 / (download) - annotate - [select for diffs], Tue Jan 24 11:28:41 2023 UTC (16 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.253: +3 -1 lines
Diff to previous 1.253 (colored)

Implement ASPA validation and reload logic on ASPA set changes.

For this use the validation state (vstate) in struct prefix and
struct filterstate to store both the ASPA and ROA validity.
Introduce helper functions to set and get the various states for
struct prefix and make sure struct filterstate is also setup properly.
Change the ASPA state in rde_aspath to be AFI/AID and role independent
by storing all 4 possible outcomes. Also add a ASPA generation count
which is used to update the rde_aspath ASPA state cache on reloads.
Rework the rde_aspa.c code to be AFI/AID and role independent. Doing
this for roles is trivial but AFI switch goes deep and is so unnecessary.
The reload is combined with the ROA reload logic and renamed to RPKI
softreload.

OK tb@

Revision 1.253 / (download) - annotate - [select for diffs], Fri Jan 20 10:28:22 2023 UTC (16 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.252: +3 -3 lines
Diff to previous 1.252 (colored)

Bad indent

Revision 1.252 / (download) - annotate - [select for diffs], Wed Jan 18 17:40:17 2023 UTC (16 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.251: +8 -8 lines
Diff to previous 1.251 (colored)

Use the vstate of the filterstate struct instead of passing an extra copy
to the various prefix update functions.
While there fix a filterstate leak in up_generate_updates().
With and OK tb@

Revision 1.251 / (download) - annotate - [select for diffs], Wed Dec 28 21:30:16 2022 UTC (17 months ago) by jmc
Branch: MAIN
Changes since 1.250: +3 -3 lines
Diff to previous 1.250 (colored)

spelling fixes; from paul tagliamonte
any parts of his diff not taken are noted on tech

Revision 1.250 / (download) - annotate - [select for diffs], Wed Oct 12 11:26:05 2022 UTC (19 months, 2 weeks ago) by jsg
Branch: MAIN
Changes since 1.249: +2 -2 lines
Diff to previous 1.249 (colored)

use correct type with sizeof
ok miod@ claudio@ tb@

Revision 1.249 / (download) - annotate - [select for diffs], Mon Sep 12 10:03:17 2022 UTC (20 months, 2 weeks ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.248: +102 -9 lines
Diff to previous 1.248 (colored)

Introduce tree walkers that only walk a subtree of the RIB.

In some cases only a "small" part of the RIB needs to be looked at. Like
bgpctl show rib 10/8 or-longer that only needs to travers nodes under
10/8 all other RIB entries do not matter. By setting the start node to
the RB_NFIND(10/8) the all nodes below this point can be skipped.
Using prefix_compare() while walking the tree with RB_NEXT() the walker
know when it steps outside of the 10/8 subtree and stops.
With this the or-longer commands become a lot faster.

Looks good to tb@

Revision 1.248 / (download) - annotate - [select for diffs], Thu Sep 1 13:19:11 2022 UTC (21 months ago) by claudio
Branch: MAIN
Changes since 1.247: +2 -4 lines
Diff to previous 1.247 (colored)

This code no longer needs siphash.h and also cleanup some leftover
prototypes and members that were not removed in the previous RB tree
conversions.
OK benno@ tb@

Revision 1.247 / (download) - annotate - [select for diffs], Tue Aug 30 18:50:21 2022 UTC (21 months ago) by claudio
Branch: MAIN
Changes since 1.246: +19 -72 lines
Diff to previous 1.246 (colored)

Switch nexthop hash to a RB tree.
OK benno@

Revision 1.246 / (download) - annotate - [select for diffs], Mon Aug 29 18:18:55 2022 UTC (21 months ago) by claudio
Branch: MAIN
Changes since 1.245: +3 -6 lines
Diff to previous 1.245 (colored)

Instead of a global aspath cache copy the aspath attribute per rde_aspath
struct. It uses a bit more memory but improves performance a lot on really
big systems because aspath_get() becomes a very hot function.
OK tb@

Revision 1.245 / (download) - annotate - [select for diffs], Mon Aug 29 16:43:07 2022 UTC (21 months ago) by claudio
Branch: MAIN
Changes since 1.244: +34 -123 lines
Diff to previous 1.244 (colored)

Switch rde_aspath to a RB tree instead of a hash table.
OK tb@

Revision 1.244 / (download) - annotate - [select for diffs], Thu Aug 25 08:10:25 2022 UTC (21 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.243: +3 -5 lines
Diff to previous 1.243 (colored)

Connected routes use the BGP exit nexthop while other routes need to use
the nexthop from the covering route. Move this logic from RDE to the
kroute code so it is all in one place.
OK tb@

Revision 1.243 / (download) - annotate - [select for diffs], Wed Aug 10 14:17:01 2022 UTC (21 months, 3 weeks ago) by claudio
Branch: MAIN
Changes since 1.242: +4 -7 lines
Diff to previous 1.242 (colored)

More kroute_nexthop cleanup. Mainly use direct assignment instead of
memcpy(). Additionally replace a bzero() with memset() and remove to
superfluous bzero calls.
OK tb@

Revision 1.237.2.1 / (download) - annotate - [select for diffs], Mon Aug 1 11:02:16 2022 UTC (22 months ago) by tb
Branch: OPENBSD_7_1
Changes since 1.237: +16 -36 lines
Diff to previous 1.237 (colored) next main 1.238 (colored)

Properly handle nexthop state changes in the decision process

In rev 1.90 of rde_decide.c the re->active cache of the best prefix was
replaced with a call to prefix_best(). This introduced a bug because the
nexthop state at that time may have changed already. As a result when
a nexthop became unreachable prefix_evaluate() had oldbest = NULL and
newbest = NULL and did not withdraw the prefix from FIB and Adj-RIB-Out.

To fix this store the nexthop state per prefix and introduce
prefix_evaluate_nexthop() which removes the prefix from the decision list,
updates the nexthop state of the prefix and reinserts the prefix. Doing
this ensures that prefix_best() always reports the same result once the
decison process is done. prefix_best() and prefix_eligible() only depend
on data stored on the prefix itself.

from claudio, backport tb

this is patches/7.1/common/008_bgpd.patch.sig

Revision 1.242 / (download) - annotate - [select for diffs], Thu Jul 28 13:11:51 2022 UTC (22 months ago) by deraadt
Branch: MAIN
Changes since 1.241: +4 -4 lines
Diff to previous 1.241 (colored)

whitespace found during a read-thru; ok claudio

Revision 1.241 / (download) - annotate - [select for diffs], Mon Jul 25 16:37:55 2022 UTC (22 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.240: +16 -36 lines
Diff to previous 1.240 (colored)

Properly handle nexthop state changes in the decision process

In rev 1.90 of rde_decide.c the re->active cache of the best prefix was
replaced with a call to prefix_best(). This introduced a bug because the
nexthop state at that time may have changed already. As a result when
a nexthop became unreachable prefix_evaluate() had oldbest = NULL and
newbest = NULL and did not withdraw the prefix from FIB and Adj-RIB-Out.

To fix this store the nexthop state per prefix and introduce
prefix_evaluate_nexthop() which removes the prefix from the decision list,
updates the nexthop state of the prefix and reinserts the prefix. Doing
this ensures that prefix_best() always reports the same result once the
decison process is done. prefix_best() and prefix_eligible() only depend
on data stored on the prefix itself.

OK tb@

Revision 1.240 / (download) - annotate - [select for diffs], Fri Jul 8 10:01:52 2022 UTC (22 months, 3 weeks ago) by claudio
Branch: MAIN
Changes since 1.239: +26 -10 lines
Diff to previous 1.239 (colored)

Pass path_id_tx to the Adj-RIB-Out

Adjust prefix_adjout_update() to properly handle path_id_tx.
Move the lookup of the prefix out of prefix_adjout_update() and to
up_generate_updates(). While that code uses prefix_adjout_lookup() to
find the current prefix in the Adj-RIB-Out and add-path aware function
will use prefix_adjout_get().

In up_generate_default() just use 0 for path_id_tx since for this peer
that is the only prefix installed into the Adj-RIB-Out.

OK tb@

Revision 1.239 / (download) - annotate - [select for diffs], Fri Jul 8 08:11:25 2022 UTC (22 months, 3 weeks ago) by claudio
Branch: MAIN
Changes since 1.238: +23 -19 lines
Diff to previous 1.238 (colored)

Assign a local path_id to all prefixes

For add-path a unique path_id needs to be assigne to all prefixes.
Use a random number since the RFC explicitly mentions that there is no
meaning what the value means. The local path_id is inherited to all
the RIBs. Adj-RIB-Out handling is not yet down.
OK tb@

Revision 1.238 / (download) - annotate - [select for diffs], Mon May 23 13:40:12 2022 UTC (2 years ago) by deraadt
Branch: MAIN
Changes since 1.237: +2 -2 lines
Diff to previous 1.237 (colored)

whitespaces found when I went checking for something else

Revision 1.237 / (download) - annotate - [select for diffs], Tue Mar 22 10:53:08 2022 UTC (2 years, 2 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE
Branch point for: OPENBSD_7_1
Changes since 1.236: +5 -5 lines
Diff to previous 1.236 (colored)

Switch from a LIST to TAILQ for the structure to store prefixes on a
rib_entry. Mostly mechanical, this simplifies prefix_insert() and
prefix_remove() since the redo queue can now just use TAILQ_INSERT_TAIL().
rde_softreconfig_sync_reeval() needs to use TAILQ_CONCAT() to move
the list of prefixes over to the local TAILQ_HEAD to reapply them later.
OK tb@

Revision 1.236 / (download) - annotate - [select for diffs], Mon Mar 21 17:35:56 2022 UTC (2 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.235: +2 -2 lines
Diff to previous 1.235 (colored)

Remove the active prefix cache in struct rib_entry. I need the space
and it also makes less sense to track this with ECMP or add-path.
Replace the re->active access with prefix_best(re) which does the
check on the spot.
Feedback and OK tb@

Revision 1.235 / (download) - annotate - [select for diffs], Mon Mar 21 13:33:20 2022 UTC (2 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.234: +4 -2 lines
Diff to previous 1.234 (colored)

Adjust how RIB are reloaded when their flags (esp. no evaluate) changes.
First flush all affected Adj-RIB-Out and then in a second step re-evaluate
the RIB itself. The no evaluate case becomes simpler. Fix the way
prefixes are re-evaluated, the list remove needs to be explict and not
part of prefix_evaluate() as in most other cases since this list is not
part of the rib_entry.
OK tb@

Revision 1.234 / (download) - annotate - [select for diffs], Tue Mar 15 16:50:29 2022 UTC (2 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.233: +7 -8 lines
Diff to previous 1.233 (colored)

Replace the eor member of struct prefix with a flag. Saves a byte that
will be reused soon.
OK denis@ tb@

Revision 1.233 / (download) - annotate - [select for diffs], Tue Mar 15 14:39:34 2022 UTC (2 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.232: +37 -40 lines
Diff to previous 1.232 (colored)

Refactor prefix_adjout_update(). Move the new prefix logic up and
then just fall through the update path. This is more in line with
prefix_update() and will make further work simpler.
OK tb@

Revision 1.232 / (download) - annotate - [select for diffs], Wed Mar 2 16:51:43 2022 UTC (2 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.231: +16 -18 lines
Diff to previous 1.231 (colored)

Adapt prefix_adjout_update() the same way as prefix_adjout_withdraw()
and to the accounting in the function.
OK tb@

Revision 1.231 / (download) - annotate - [select for diffs], Wed Mar 2 14:44:46 2022 UTC (2 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.230: +28 -19 lines
Diff to previous 1.230 (colored)

Refactor prefix_adjout_withdraw()

Just pass the prefix to be withdrawn to the function and move the lookup
up. Adjust how the various accounting vars are updated so that the
values are decremented in the right cases. Do the same accounting dance
for prefix_adjout_destroy(). Adjust rde_up_flush_upcall() to directly
call prefix_adjout_withdraw() without calling it via up_generate_updates().
OK tb@

Revision 1.230 / (download) - annotate - [select for diffs], Tue Mar 1 09:39:36 2022 UTC (2 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.229: +1 -2 lines
Diff to previous 1.229 (colored)

Remove another empty line

Revision 1.229 / (download) - annotate - [select for diffs], Tue Mar 1 09:38:06 2022 UTC (2 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.228: +19 -20 lines
Diff to previous 1.228 (colored)

Reshuffle functions for better order and remove an excessive empty line.

Revision 1.228 / (download) - annotate - [select for diffs], Mon Feb 28 14:32:01 2022 UTC (2 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.227: +59 -110 lines
Diff to previous 1.227 (colored)

Instead of handrolling what is mostly prefix_link/prefix_unlink in
prefix_move() and prefix_adjout_update() use the functions by
refactoring them a bit so they work in these cases.
Move the pftable update and prefix evaluate call to prefix_add
make nexthop_link() a noop for prefixes of the Adj-RIB-Out and
in prefix_unlink() don't clear p->pt after the pt_unref() call.
In prefix_adjout_* functions make sure to call prefix_unlink() when
a prefix is linked and gets removed or replaced.
OK tb@

Revision 1.227 / (download) - annotate - [select for diffs], Fri Feb 25 12:56:12 2022 UTC (2 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.226: +4 -10 lines
Diff to previous 1.226 (colored)

The pointer returned by pt_fill() can be directly used in most cases.
There is no need for an extra local variable.
Noticed by and OK tb@

Revision 1.226 / (download) - annotate - [select for diffs], Fri Feb 25 11:36:54 2022 UTC (2 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.225: +65 -19 lines
Diff to previous 1.225 (colored)

For add-path send the Adj-RIB-Out needs to handle multiple paths per
prefix. For this extend the RB trees of the Adj-RIB-Out to also consider
the path_id. Add functions to lookup a prefix without path_id so that
bgpctl works. Rename functions so that all Adj-RIB-Out specific functions
start with prefix_adjout_

For now the path_id_tx in the Adj-RIB-Out is forced to 0 since
up_generate_updates() is not ready to handle more than one path per prefix.

OK tb@

Revision 1.225 / (download) - annotate - [select for diffs], Sun Feb 6 09:51:19 2022 UTC (2 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.224: +54 -54 lines
Diff to previous 1.224 (colored)

Switch from u_intX_t types to stdint.h uintX_t. Mostly mechanical with
a few reindents.
OK florian@ tb@

Revision 1.224 / (download) - annotate - [select for diffs], Mon Aug 9 08:15:35 2021 UTC (2 years, 9 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.223: +25 -19 lines
Diff to previous 1.223 (colored)

Implement reception of multiple paths per BGP session. This is one
side of RFC7911 and the send portion will follow.

The path-id is extracted from the NLRI encoding an put into struct
prefix.  To do this the prefix_by_peer() function gets a path-id
argument.  If a session is not path-id enabled this argument will
be always 0. If a session is path-id enabled the value is taken
from the NLRI and can be anything, including 0. The value has no
meaning in itself. Still to make sure the decision process is able
to break a tie the path-id is checked as the last step (this is not
part of the RFC but required).

OK benno@

Revision 1.223 / (download) - annotate - [select for diffs], Tue Jul 27 07:50:02 2021 UTC (2 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.222: +34 -15 lines
Diff to previous 1.222 (colored)

Restructure struct prefix a bit and move the rib pointer to the union
that splits the normal RIB linkage vs the adjrib-out linkage. This is
done to make a bit of space to put an extra add-path related id into
the struct without blowing its size over 128 bytes.
Long run this struct should be split up but the necessary changes are
too large right now so this is the 2nd best option.
OK benno@

Revision 1.222 / (download) - annotate - [select for diffs], Thu Jun 17 08:16:04 2021 UTC (2 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.221: +2 -2 lines
Diff to previous 1.221 (colored)

Better error message when a bad nexthop is passed to nexthop_hash().
OK job@

Revision 1.221 / (download) - annotate - [select for diffs], Tue May 4 09:27:09 2021 UTC (3 years ago) by claudio
Branch: MAIN
Changes since 1.220: +4 -15 lines
Diff to previous 1.220 (colored)

More comment changes to reflect reality. No functional change.

Revision 1.220 / (download) - annotate - [select for diffs], Mon Jan 18 12:15:36 2021 UTC (3 years, 4 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.219: +14 -45 lines
Diff to previous 1.219 (colored)

Change struct bgpd_addr VPN encoding. Instead of including two almost
equal versions put the RD and lable stack right into struct bgpd_addr.
For non-VPN addresses these extra fields are ignored. Since VPN and non-VPN
addresses encode the prefix in the same way now some code can be simplified.
In most cases a fallthrough or reuse of encoding functions is now possible.
It should also reduce the size of struct bgpd_addr a bit.
OK denis@

Revision 1.219 / (download) - annotate - [select for diffs], Wed Jan 13 11:34:01 2021 UTC (3 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.218: +5 -18 lines
Diff to previous 1.218 (colored)

Extend prefix_evaluate() to also be used when withdrawing a prefix.
Doing the LIST_REMOVE() outside of prefix_evalute() is no longer valid.
As a benefit it is now simply possible to re-evaluate a prefix by passing
it to prefix_evaluate() for both removal and insertion. prefix_evaluate()
will then take care to ensure that a update is sent out if necessary.

Also move rde_send_kroute() call to rde_generate_updates() to make it a
bit easier to plug this module into a regress test.

OK denis@

Revision 1.218 / (download) - annotate - [select for diffs], Fri Dec 4 11:57:13 2020 UTC (3 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.217: +16 -13 lines
Diff to previous 1.217 (colored)

Reference count prefixes added to a pftable. This allows to export
prefixes from multiple sessions into the same table. Before a prefix
was removed from the table on the first withdraw (even though there
was an alternative around).
Requested by, tested and OK dlg@

Revision 1.217 / (download) - annotate - [select for diffs], Thu Nov 5 11:51:13 2020 UTC (3 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.216: +2 -2 lines
Diff to previous 1.216 (colored)

Refactor the filterset handling of nexthops. Instead of depending on
bgpd_process and changing the behaviour that way add a new filterset
type ACTION_SET_NEXTHOP_REF which is used when the nexthop reference
of the union is used. Adjust the RDE to convert ACTION_SET_NEXTHOP to
ACTION_SET_NEXTHOP_REF when receiving the filtersets.
OK benno@

Revision 1.216 / (download) - annotate - [select for diffs], Thu Nov 5 11:20:34 2020 UTC (3 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.215: +2 -2 lines
Diff to previous 1.215 (colored)

Fix comment to better reflect reality

Revision 1.215 / (download) - annotate - [select for diffs], Sat Jan 25 23:54:21 2020 UTC (4 years, 4 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.214: +10 -4 lines
Diff to previous 1.214 (colored)

In nexthop_update() only add a nexthop to the nexthop_runners queue if
there is actual work to do (nh->next_prefix != NULL). If next_prefix
is NULL there is a possibility that nexthop_unref() is called before
the nexthop is removed from the nexthop_runners queue resulting in a
use-after-free access in nexthop_runner().
For consistency add a debug message in nexthop_unlink() if the nexthop
is removed from the nexthop_runners queue because the last prefix is gone.
OK procter@

Revision 1.214 / (download) - annotate - [select for diffs], Fri Jan 10 14:52:57 2020 UTC (4 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.213: +6 -6 lines
Diff to previous 1.213 (colored)

Reorder assignements a bit so that all hashed values are together
and the refcnt, hash and flags are also grouped.

Revision 1.213 / (download) - annotate - [select for diffs], Thu Jan 9 15:50:34 2020 UTC (4 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.212: +3 -7 lines
Diff to previous 1.212 (colored)

Instead of calling SipHash24_Update() in path_hash for each element of
struct rde_aspath define aspath_hashstart and aspath_hashend and update
all values in one call. Inspired by struct process and its ps_startcopy.
OK deraadt@

Revision 1.212 / (download) - annotate - [select for diffs], Thu Jan 9 11:55:25 2020 UTC (4 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.211: +8 -8 lines
Diff to previous 1.211 (colored)

Convert the lastchange of a prefix from time(NULL) to getmonotime() which
uses CLOCK_MONOTONIC. Convert the control messages to return the relative
age of the prefix instead of the absolute age. Adjust the mrt dump code
to stil dump the route age in seconds since epoch as defined in the RFC.
With this all times in bgpd are now based on CLOCK_MONOTONIC.
OK denis@

Revision 1.211 / (download) - annotate - [select for diffs], Wed Jan 8 18:01:22 2020 UTC (4 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.210: +2 -2 lines
Diff to previous 1.210 (colored)

eye burning whitespace

Revision 1.207.2.1 / (download) - annotate - [select for diffs], Wed Oct 30 20:02:19 2019 UTC (4 years, 7 months ago) by benno
Branch: OPENBSD_6_6
Changes since 1.207: +25 -15 lines
Diff to previous 1.207 (colored) next main 1.208 (colored)

bgpd(8) can crash on nexthop changes or during startup in certain
configurations.

This is OpenBSD 6.6 errata 003 and combines the following commits from
-current:

---------------------------------------------
CVSROOT:        /cvs
Module name:    src
Changes by:     claudio@cvs.openbsd.org 2019/10/29 00:47:04

Modified files:
        usr.sbin/bgpd  : rde_rib.c

Log message:
Replace the fatal non existing prefix call with a pt_add() call that
actually inserts the missing prefix in the prefix tree. While for
regular updates to the Adj-RIB-Out this case is indeed not reachable
it is reachable when using 'export default-route'.
Problem reported and fix tested by Esa Kuusisto.
OK benno@
---------------------------------------------
CVSROOT:        /cvs
Module name:    src
Changes by:     claudio@cvs.openbsd.org 2019/10/29 23:27:50

Modified files:
        usr.sbin/bgpd  : rde.c rde.h rde_rib.c

Log message:
Add PREFIX_FLAG_STALE to mark prefixes in the Adj-RIB-Out as stale during
graceful reload. At the same time extend peer_dump() to force all updates
getting sent by adding every entry in the Adj-RIB-Out to the update tree
unless they are PREFIX_FLAG_DEAD or PREFIX_FLAG_STALE. The latter will be
removed during that stage since peer_dump() just did a full update of the
Adj-RIB-Out. Also fix prefix_withdraw to check the correct prefix flags
before removing a prefix from the update or withdraw tree.
OK benno@
---------------------------------------------
CVSROOT:        /cvs
Module name:    src
Changes by:     claudio@cvs.openbsd.org 2019/10/29 00:42:05

Modified files:
        usr.sbin/bgpd  : rde_rib.c

Log message:
Fix two cases where the nexthop_runners tail queue can get corrupted.
First by requeuing an element that is already on the list and second
by freeing a nexthop that is still on the list resulting in a use after
free. This should fix bgpd crashes seen by various people.
Problem report including backtrace from benno@
OK benno@

Revision 1.210 / (download) - annotate - [select for diffs], Wed Oct 30 05:27:50 2019 UTC (4 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.209: +16 -12 lines
Diff to previous 1.209 (colored)

Add PREFIX_FLAG_STALE to mark prefixes in the Adj-RIB-Out as stale during
graceful reload. At the same time extend peer_dump() to force all updates
getting sent by adding every entry in the Adj-RIB-Out to the update tree
unless they are PREFIX_FLAG_DEAD or PREFIX_FLAG_STALE. The latter will be
removed during that stage since peer_dump() just did a full update of the
Adj-RIB-Out. Also fix prefix_withdraw to check the correct prefix flags
before removing a prefix from the update or withdraw tree.
OK benno@

Revision 1.209 / (download) - annotate - [select for diffs], Tue Oct 29 06:47:04 2019 UTC (4 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.208: +2 -2 lines
Diff to previous 1.208 (colored)

Replace the fatal non existing prefix call with a pt_add() call that
actually inserts the missing prefix in the prefix tree. While for
regular updates to the Adj-RIB-Out this case is indeed not reachable
it is reachable when using 'export default-route'.
Problem reported and fix tested by Esa Kuusisto.
OK benno@

Revision 1.208 / (download) - annotate - [select for diffs], Tue Oct 29 06:42:05 2019 UTC (4 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.207: +9 -3 lines
Diff to previous 1.207 (colored)

Fix two cases where the nexthop_runners tail queue can get corrupted.
First by requeuing an element that is already on the list and second
by freeing a nexthop that is still on the list resulting in a use after
free. This should fix bgpd crashes seen by various people.
Problem report including backtrace from benno@
OK benno@

Revision 1.207 / (download) - annotate - [select for diffs], Fri Sep 27 14:50:39 2019 UTC (4 years, 8 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE
Branch point for: OPENBSD_6_6
Changes since 1.206: +4 -8 lines
Diff to previous 1.206 (colored)

Move the rde_send_pftable_commit() our of the prefix_update and withdraw
function and up higher in the call stack. While there also make sure that
flushing announced networks does the pftable dance. This is now also using
prefix_withdraw like most other code. Reshuffle rde_update_dispatch() a bit
so that all returns are before the first update or withdraw call. After that
the code always exits via the end of the function where the commit happens.
OK benno@

Revision 1.206 / (download) - annotate - [select for diffs], Wed Aug 14 11:57:21 2019 UTC (4 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.205: +42 -34 lines
Diff to previous 1.205 (colored)

Rework the way ribs are stored in the RDE. Instead of a flat array that
gets enlarged use an array of pointers, so pointers to struct rib entries
remain valid after adding new RIBs. Also remove the global ribs pointer
and rib_valid() since they are no longer used since all the code uses now
rib_byid() instead.
OK benno@

Revision 1.205 / (download) - annotate - [select for diffs], Wed Aug 14 07:39:04 2019 UTC (4 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.204: +23 -33 lines
Diff to previous 1.204 (colored)

There is no longer a reason to use two structs for RIBs where one is part
of the other. Just merge struct rib_desc into struct rib. Makes code simpler.
OK benno@

Revision 1.204 / (download) - annotate - [select for diffs], Fri Aug 9 14:12:21 2019 UTC (4 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.203: +72 -70 lines
Diff to previous 1.203 (colored)

Move prefix_update to the right spot and also move some prototypes down.

Revision 1.203 / (download) - annotate - [select for diffs], Fri Aug 9 13:44:27 2019 UTC (4 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.202: +14 -14 lines
Diff to previous 1.202 (colored)

Rename some of the prefix functions to make it clearer. Also rename
path_update to prefix_update since this is now more working on a prefix.
OK clang

Revision 1.202 / (download) - annotate - [select for diffs], Wed Aug 7 10:26:41 2019 UTC (4 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.201: +43 -15 lines
Diff to previous 1.201 (colored)

Improve RIB reload behaviour. Especially when the rtable changes or the
route evaluation is modified. In both cases the softreconfig code will
now walk the RIB and ensure that everything is in proper sync.
Additionally remove 'route-collector yes|no' from the bgpd config, instead
use 'rde rib Loc-RIB no evaluate' with the benefit that you can alter
the setting now during runtime.
Tested and OK benno@

Revision 1.201 / (download) - annotate - [select for diffs], Wed Jul 24 20:54:54 2019 UTC (4 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.200: +59 -52 lines
Diff to previous 1.200 (colored)

rib_dump_terminate() and rib_dump_abort() need to free any possibly
locked entry (rib or prefix) before removing the context else elements
may remain locked for the rest of the run time (which is equal to a
memory leak).
OK benno@

Revision 1.200 / (download) - annotate - [select for diffs], Tue Jul 23 14:19:17 2019 UTC (4 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.199: +6 -4 lines
Diff to previous 1.199 (colored)

Use the correct prefix size when writing out AID_VPN_IPv4 and AID_VPN_IPv6
prefixes.

Revision 1.199 / (download) - annotate - [select for diffs], Wed Jul 17 10:13:26 2019 UTC (4 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.198: +345 -74 lines
Diff to previous 1.198 (colored)

Change the Adj-RIB-Out to a per peer set of RB trees. The way RIB data
structures are linked does not scale for the Adj-RIB-Out and so inserts
and updates into the Adj-RIB-Out did not scale because of some linear
list traversals in hot paths.

A synthetic test with 4000 peers announcing one prefix each showed that
the initial convergence time dropped from around 1 hout to around 6min.

Note: because the Adj-RIB-Out is now per peer the order in which prefixes
are dumped in 'bgpctl show rib out' changed.

Tested and OK job@, benno@, phessler@

Revision 1.198 / (download) - annotate - [select for diffs], Mon Jul 1 14:47:56 2019 UTC (4 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.197: +7 -8 lines
Diff to previous 1.197 (colored)

Must update the nexthop state before dropping the nexthop reference
for NEXTHOP_LOOKUP else nexthop_unref() triggers a safety check.

Revision 1.197 / (download) - annotate - [select for diffs], Mon Jul 1 07:33:46 2019 UTC (4 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.196: +2 -4 lines
Diff to previous 1.196 (colored)

Remove no longer needed local variable oasp.

Revision 1.196 / (download) - annotate - [select for diffs], Mon Jul 1 07:07:08 2019 UTC (4 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.195: +27 -50 lines
Diff to previous 1.195 (colored)

Unify the way object in the RDE are reference counted. The affected
structures are pt_entry, rde_aspath, rde_communities, and nexthop.
The functions are always called *_ref and *_unref also the behaviour
when the last reference is removed is unified and now the object is
removed inside of the unref function. The actual bean-counting is not
modified by this diff.
OK benno@

Revision 1.195 / (download) - annotate - [select for diffs], Sat Jun 22 05:44:05 2019 UTC (4 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.194: +16 -16 lines
Diff to previous 1.194 (colored)

Add a direct pointer from struct prefix to struct pt_entry.
This changes makes it possible to not use the struct rib_entry pointer
which will be used to optimize the Adj-RIB-Out.
Also adjust pt_ref() and pt_unref() so that the code can be written
a bit more compact. Also prefix_cmp() no longer needs to go via
rib_compare() and calls pt_prefix_cmp() directly.
OK phessler@

Revision 1.194 / (download) - annotate - [select for diffs], Thu Jun 20 19:32:16 2019 UTC (4 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.193: +4 -19 lines
Diff to previous 1.193 (colored)

prefix_add() is only called by path_update() and path_update already
knows if the prefix exists or not (by calling prefix_get()). So doing
the same check again in prefix_add() is silly and actually rather
expensive with lots of peers.
OK phessler@

Revision 1.193 / (download) - annotate - [select for diffs], Thu Jun 20 13:38:21 2019 UTC (4 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.192: +2 -2 lines
Diff to previous 1.192 (colored)

prefix_updateall() is only used internally, make it a static function.

Revision 1.192 / (download) - annotate - [select for diffs], Thu Jun 20 13:18:19 2019 UTC (4 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.191: +108 -50 lines
Diff to previous 1.191 (colored)

Change nexthop_update to run the list walk over all prefixes to run
asynchronously and therefor other tasks can make progress at the same
time. Additionally prefixes belonging to a RIB which does not run the
the decision process are no longer linked into the nexthop list.
This replaces the early return in prefix_updateall() and reduces the
time spent in nexthop_update().
OK benno@

Revision 1.191 / (download) - annotate - [select for diffs], Mon Jun 17 11:02:20 2019 UTC (4 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.190: +51 -23 lines
Diff to previous 1.190 (colored)

Completley rewrite the community matching and handling code. All community
attributes are put into a new data structure when parsing the UPDATE.
The filter code can quickly lookup and modify this data structure.
When creating an UPDATE the data is put back into wire format.
Setups using a lot of communities benefit a lot from this.
Input and OK benno@

Revision 1.190 / (download) - annotate - [select for diffs], Thu Mar 7 07:42:36 2019 UTC (5 years, 2 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.189: +8 -1 lines
Diff to previous 1.189 (colored)

Do a better job at cleaning up the config on shutdown. Remove bits that
were missed before (e.g. network related objects). This helps to detect
memory leaks.
Start using new_config() and free_config() in all places where bgpd_config
structure are used. This way the struct is properly initialised and cleaned
up. Introduce copy_config() to only copy the values into the other struct
leaving the pointers as they were.
Looks good to benno@

Revision 1.189 / (download) - annotate - [select for diffs], Mon Jan 21 02:07:56 2019 UTC (5 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.188: +160 -37 lines
Diff to previous 1.188 (colored)

Use Adj-RIB-Out to push UPDATE messages to peers instead of having another
set of RB trees of prefixes and atribute. Refactor most of the update code
which removes some strange buffer handling. By building the output queue
directly in the Adj-RIB-Out the top memory usage during startup is greatly
reduced which should help busy server.
Tested by phessler@ and myself

Revision 1.188 / (download) - annotate - [select for diffs], Sun Dec 30 13:53:07 2018 UTC (5 years, 5 months ago) by denis
Branch: MAIN
Changes since 1.187: +34 -1 lines
Diff to previous 1.187 (colored)

add support for IPv6 VPN routes

The kernel bits are missing as of now. With input from claudio@ and kn@

OK claudio@

Revision 1.187 / (download) - annotate - [select for diffs], Tue Dec 11 09:02:14 2018 UTC (5 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.186: +1 -6 lines
Diff to previous 1.186 (colored)

Refactor aspath code a bit. Move cached source_as (for origin validation)
into struct aspath and pass that struct to aspath_match().
OK denis@

Revision 1.186 / (download) - annotate - [select for diffs], Wed Nov 14 12:14:41 2018 UTC (5 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.185: +2 -6 lines
Diff to previous 1.185 (colored)

Adjust comment.

Revision 1.185 / (download) - annotate - [select for diffs], Sun Nov 4 12:34:54 2018 UTC (5 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.184: +22 -2 lines
Diff to previous 1.184 (colored)

Introduce a real Adj-RIB-Out. At the same time remove the update_rib
introduced before 6.4 because it now can be replaced with the real RIB.
Main changes are:
- simplified 'show rib' handling since everything is now a real RIB
- path_update() is now returning if a prefix was not modified, added or moved
- softreconfig out case is simpler since path_update does all the magic now
- Adjust shutdown code to work with the Adj-RIB-Out
Tested and OK denis@, benno@

Revision 1.184 / (download) - annotate - [select for diffs], Wed Oct 31 14:50:07 2018 UTC (5 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.183: +59 -52 lines
Diff to previous 1.183 (colored)

Remove tail queues which link peer, aspath and prefix together. These
lists are no longer needed and make it possible to share rde_aspath between
peers & prefixes. Instead of the lists the rde_aspath is now reference counted.
With this struct prefix is now the central place where everything is connected
to making the RIB a bit easier to handle.
With input and OK denis@

Revision 1.183 / (download) - annotate - [select for diffs], Wed Oct 31 14:45:36 2018 UTC (5 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.182: +3 -1 lines
Diff to previous 1.182 (colored)

Never remove the default RIBs from the RDE.
OK denis@

Revision 1.182 / (download) - annotate - [select for diffs], Mon Oct 29 09:28:31 2018 UTC (5 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.181: +8 -85 lines
Diff to previous 1.181 (colored)

Replace some walkers using the aspath/prefix lists with a rib_dump walker.
network_flush() is now using rib_dump_new to walk the Adj-RIB-In and
remove all dynamically added announcements. peer_flush() got generalized
and is now used also in peer_down(). It also uses a walker to remove all
prefixes of a peer but does it in a synchronous way for now.
OK benno@

Revision 1.181 / (download) - annotate - [select for diffs], Fri Oct 26 08:55:36 2018 UTC (5 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.180: +2 -2 lines
Diff to previous 1.180 (colored)

Use proper type in sizeof()
OK phessler@

Revision 1.180 / (download) - annotate - [select for diffs], Wed Oct 24 08:26:37 2018 UTC (5 years, 7 months ago) by claudio
Branch: MAIN
Changes since 1.179: +157 -49 lines
Diff to previous 1.179 (colored)

Major refactoring of the RIB handling code. Mainly change how the RIB is
walked. rib_dump_r() is now an internal function and instead the code gets
an additional callback for throttling the rib_dump code. This removes a
lot of similar code used to make sure the RDE is not walking to fast and
replaces it with simpler callbacks. The other big change is the removal
of struct rib pointers in other data structures. The rib pointers are not
stable because of a realloc() call happening when extending the array so
instead use the RIB ID as a reference.
Tested and OK denis@ and benno@

Revision 1.179 / (download) - annotate - [select for diffs], Sat Sep 29 08:11:11 2018 UTC (5 years, 8 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.178: +26 -16 lines
Diff to previous 1.178 (colored)

Implement origin validation in bgpd. This introduces two new tables, the
roa-set for RPKI based origin validation and a origin-set which allows to
lookup a source-as / prefix pair.
For RPKI a config can be built like this:
  roa-set {
          165.254.255.0/24 source-as 15562
          193.0.0.0/21 maxlen 24 source-as 3333
  }
  deny from any ovs invalid
  match from any ovs valid set community local-as:42
  match from any ovs not-found set community local-as:43
Origin sets are similar but only match when the source-as / prefix pair is
valid.
  match from any origin-set ARINDB set community local-as:44
Committing this now so that further work can be done in tree.
OK benno@, job@

Revision 1.178 / (download) - annotate - [select for diffs], Thu Sep 20 11:06:04 2018 UTC (5 years, 8 months ago) by benno
Branch: MAIN
Changes since 1.177: +4 -4 lines
Diff to previous 1.177 (colored)

whitespace cleanup, ok claudio@

Revision 1.177 / (download) - annotate - [select for diffs], Mon Sep 17 17:06:33 2018 UTC (5 years, 8 months ago) by sthen
Branch: MAIN
Changes since 1.176: +2 -2 lines
Diff to previous 1.176 (colored)

typo in comment

Revision 1.176 / (download) - annotate - [select for diffs], Sun Sep 9 12:33:51 2018 UTC (5 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.175: +37 -93 lines
Diff to previous 1.175 (colored)

Clean up prefix flag handling. First of all the dynamic networks no longer
need this and are now treated equally to the network statement in the config.
This makes bgpctl network delete <net> also remove a network which was defined
in the config.
While there remove the other use of flag which was done to support Adj-RIB-Out
but the direction we're taking is no longer needing that. Makes code simpler
again.
OK benno@

Revision 1.175 / (download) - annotate - [select for diffs], Wed Aug 8 06:54:50 2018 UTC (5 years, 9 months ago) by benno
Branch: MAIN
Changes since 1.174: +2 -2 lines
Diff to previous 1.174 (colored)

hide rib[] internals in new rib_valid() function
ok claudio@

Revision 1.174 / (download) - annotate - [select for diffs], Mon Aug 6 08:13:31 2018 UTC (5 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.173: +2 -4 lines
Diff to previous 1.173 (colored)

Pass the stale timestamp to path_remove_stale() removes a asp->peer dereference

Revision 1.173 / (download) - annotate - [select for diffs], Fri Aug 3 16:31:22 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.172: +95 -98 lines
Diff to previous 1.172 (colored)

Move nexthop and nexthop flags from the rde_aspath to struct prefix.
struct prefix will be slowly becomming the hub of the rib.
OK phessler@ job@

Revision 1.172 / (download) - annotate - [select for diffs], Sun Jul 22 16:59:08 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.171: +6 -2 lines
Diff to previous 1.171 (colored)

Move nexthop into struct filterstate (including nexthop flags) and use
them whereever possible. In some places (path_update, softreconfig_out
handler) the nexthop state is temporarily folded back into the rde_aspath.
Tested and OK benno@

Revision 1.171 / (download) - annotate - [select for diffs], Mon Jul 16 09:09:20 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.170: +3 -3 lines
Diff to previous 1.170 (colored)

Use struct filterstate in rde_update_dispatch() and pass it down to
functions like rde_update_update and path_update. This will allow to
move more pointers from rde_aspath to the prefix.
Looks good benno@

Revision 1.170 / (download) - annotate - [select for diffs], Wed Jul 11 19:05:41 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.169: +42 -16 lines
Diff to previous 1.169 (colored)

improve the path hash function (instead of just hashing the aspath put
most other attrs into the hash as well). At the same time use the full
64 bit of SipHash in various places.
Tested by and OK benno@ phessler@

Revision 1.169 / (download) - annotate - [select for diffs], Wed Jul 11 16:34:36 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.168: +27 -1 lines
Diff to previous 1.168 (colored)

On IMSG_CTL_SHOW_RIB_MEM also send back information of some of the
hash structures used in the RDE. Makes it fairly obvious that more
is needed in that area.
OK phessler@ benno@

Revision 1.168 / (download) - annotate - [select for diffs], Tue Jul 10 07:58:13 2018 UTC (5 years, 10 months ago) by benno
Branch: MAIN
Changes since 1.167: +2 -2 lines
Diff to previous 1.167 (colored)

Actually clear the right thing in rib_free()
Found by and with claudio.
ok phessler@ claudio@

Revision 1.167 / (download) - annotate - [select for diffs], Mon Jul 9 15:35:59 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.166: +2 -2 lines
Diff to previous 1.166 (colored)

Wrong function name in error message

Revision 1.166 / (download) - annotate - [select for diffs], Mon Jul 9 14:08:48 2018 UTC (5 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.165: +13 -6 lines
Diff to previous 1.165 (colored)

Introduce a struct filterstate and pass this to rde_filter instead of
passing the asp. This is no longer using asp_get() and should be therefor
be a bit lighter. Will also allow to put more stuff into the state.
OK denis@ sthen@

Revision 1.165 / (download) - annotate - [select for diffs], Fri Jun 29 11:45:50 2018 UTC (5 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.164: +35 -31 lines
Diff to previous 1.164 (colored)

Prepare the ground for allowing temporary aspath object living on the stack.
To do this path_copy() gets a second argument (dst, src) and a new function
path_prep() is introduced to initialize an aspath object. The current
path_copy() usage is replaced with path_copy(path_get(), asp) which does
the same. Additionally some const where added to the *_copy functions to
make it more obvious which is the source and target. Also the pftable_ref()
and rtlabel_ref() functions return now the id instead of void.
OK sthen@

Revision 1.164 / (download) - annotate - [select for diffs], Thu Jun 28 08:55:56 2018 UTC (5 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.163: +16 -16 lines
Diff to previous 1.163 (colored)

Instead of passing the rde_aspath to nexthop_modify() pass pointers to
the nexthop and the flags.

Revision 1.163 / (download) - annotate - [select for diffs], Thu Jun 28 08:07:21 2018 UTC (5 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.162: +1 -3 lines
Diff to previous 1.162 (colored)

Pass a struct prefix to rde_filter and remove some of the arguments which
are now fetched from struct prefix. Currently some trickery is needed
for export default-route but this will get better once Adj-RIB-Out comes.
OK benno@

Revision 1.162 / (download) - annotate - [select for diffs], Wed Jun 27 13:14:44 2018 UTC (5 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.161: +9 -5 lines
Diff to previous 1.161 (colored)

Just put the aspath and the peer directly into the prefix struct.
Needed for upcoming changes.

Revision 1.161 / (download) - annotate - [select for diffs], Mon Jun 25 14:28:33 2018 UTC (5 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.160: +54 -40 lines
Diff to previous 1.160 (colored)

Properly start reference counting struct nexthop. This removes the need for
some ugly workaround to make sure nexthop objects don't disapear while
still being referenced. During initial lookup of a nexthop a extra reference
is pulled but even that is now a bit cleaner than before.
Tested by job@, dennis@, benno@ OK job@ dennis@

Revision 1.160 / (download) - annotate - [select for diffs], Thu Jun 21 17:26:16 2018 UTC (5 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.159: +4 -15 lines
Diff to previous 1.159 (colored)

Nothing is using the active and prefix count in struct rde_aspath.
Remove them to make the code simpler.
OK deraadt@ gsoares@

Revision 1.159 / (download) - annotate - [select for diffs], Sat Feb 10 05:54:31 2018 UTC (6 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.158: +24 -8 lines
Diff to previous 1.158 (colored)

Follow rfc8277 more closely and make make sure bgpd is encoding VPNv4
withdraws they way other systems are doing it. Interop problem discovered
by Andrew Thrift. Tested by Andrew and job@.

Revision 1.158 / (download) - annotate - [select for diffs], Wed Feb 7 00:02:02 2018 UTC (6 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.157: +53 -22 lines
Diff to previous 1.157 (colored)

Add plumbing inside of the prefix handling to put prefixes on either the
prefixes or updates list depending on flags passed to the functions.
While there also introduce a similar flag for rde_aspath and adjust
path_compare so that this flag is ignored (liked the linked one).
OK benno@

Revision 1.157 / (download) - annotate - [select for diffs], Mon Feb 5 23:29:59 2018 UTC (6 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.156: +67 -24 lines
Diff to previous 1.156 (colored)

Switch a few lists to tailqs. Mainly the prefix list per aspath needs
to be a queue so that we can use it in the Adj-RIB-Out case.
OK benno@

Revision 1.156 / (download) - annotate - [select for diffs], Mon Feb 5 03:55:54 2018 UTC (6 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.155: +31 -38 lines
Diff to previous 1.155 (colored)

Change struct prefix a bit. Make the aspath pointer opaque and remove the
direct pointer to the pt_prefix struct. To getter functions prefix_aspath()
and prefix_peer() added to make access of the opaque pointers possible.
Looks good henning@ and benno@

Revision 1.155 / (download) - annotate - [select for diffs], Sun Feb 4 05:08:16 2018 UTC (6 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.154: +4 -3 lines
Diff to previous 1.154 (colored)

Clenaup RIB handling in the RDE. Introduce some defines for Adj-RIB-In and
Adj-RIB-Out and use them consistently. Makes code easier to read.
OK benno@

Revision 1.154 / (download) - annotate - [select for diffs], Sun May 28 12:21:36 2017 UTC (7 years ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.153: +4 -40 lines
Diff to previous 1.153 (colored)

Implement an XON/XOFF protocol between the RDE and the SE to throttle
per control session and peer the generation of imsg in the RDE. This
reduces the memory pressure in the SE substantially and also a bit in
the RDE. Makes the RDE more responsive for bgpctl commands.
Tested by me with 100 peers * 2000 prefixes and by phessler@ on an AMS-IX
border router with 200+ session. Convergance time got quite a bit better.
OK phessler@

Revision 1.153 / (download) - annotate - [select for diffs], Wed Jan 25 03:21:55 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.152: +20 -12 lines
Diff to previous 1.152 (colored)

Hopefully the last of the struct rib rototilling. Peer just points to a
struct rib and not rib_desc since the full descriptor is almost never needed.
This should now allow the update code to be changed.

Revision 1.152 / (download) - annotate - [select for diffs], Wed Jan 25 00:15:38 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.151: +3 -3 lines
Diff to previous 1.151 (colored)

Switch rde_generate_update and rde_send_kroute to accept a struct rib instead
of the id. For this we move the rtableid into struct rib. Also move the update
code in rib.c up to where the kroute code is. Makes more senses like that.

Revision 1.151 / (download) - annotate - [select for diffs], Tue Jan 24 23:38:12 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.150: +30 -13 lines
Diff to previous 1.150 (colored)

Save some space in struct rib_entry so it is back to 64bytes (on 64bit archs).
Doing this by folding the lock flag into a pointer and providing an accessor
function for the rib pointer. This is an acceptable middle path for this
important structure.
OK benno@ on an earlier version

Revision 1.150 / (download) - annotate - [select for diffs], Tue Jan 24 04:22:42 2017 UTC (7 years, 4 months ago) by benno
Branch: MAIN
Changes since 1.149: +2 -1 lines
Diff to previous 1.149 (colored)

sync log.c from relayd et al to bgpd.

there is still a little difference regarding handling of the verbosity
value that will be handled later.

ok claudio@ florian@

Revision 1.149 / (download) - annotate - [select for diffs], Mon Jan 23 22:53:52 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.148: +15 -15 lines
Diff to previous 1.148 (colored)

Rename rib pointer in struct prefix to re since it points to a rib_entry.
While there also remove a comment that is since a few years at least.
OK gcc

Revision 1.148 / (download) - annotate - [select for diffs], Mon Jan 23 22:47:59 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.147: +30 -25 lines
Diff to previous 1.147 (colored)

Introduce a struct rib sitting between struct rib_desc and struct rib_tree.
This way the tree becomes a bit better decoupled.

Revision 1.147 / (download) - annotate - [select for diffs], Mon Jan 23 13:08:47 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.146: +11 -11 lines
Diff to previous 1.146 (colored)

Revert the struct rib_tree rename. I need a struct in between because of
how struct rib_entry is used.

Revision 1.146 / (download) - annotate - [select for diffs], Mon Jan 23 12:25:19 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.145: +7 -10 lines
Diff to previous 1.145 (colored)

More rototilling, make rib_new and rib_find return a point to struct rib_desc

Revision 1.145 / (download) - annotate - [select for diffs], Mon Jan 23 11:46:02 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.144: +11 -11 lines
Diff to previous 1.144 (colored)

Now rename struct rib_tree to struct rib. Again OK gcc

Revision 1.144 / (download) - annotate - [select for diffs], Mon Jan 23 11:43:40 2017 UTC (7 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.143: +16 -16 lines
Diff to previous 1.143 (colored)

Rename struct rib to struct rib_desc. Mechanical change, OK gcc

Revision 1.143 / (download) - annotate - [select for diffs], Sat Aug 27 01:26:22 2016 UTC (7 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.142: +2 -1 lines
Diff to previous 1.142 (colored)

Pull in <time.h> for one or more of gmtime, strftime, strptime, time,
timegm, and tzset

ok deraadt@

Revision 1.142 / (download) - annotate - [select for diffs], Sat Mar 14 03:52:42 2015 UTC (9 years, 2 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9, OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.141: +3 -3 lines
Diff to previous 1.141 (colored)

rename rde_free_filter() to filterlist_free() and start using it outside
of the RDE to free the filterlists. Also refactor common code to merge
filterlists into its own function. Makes the code look nicer.

Revision 1.141 / (download) - annotate - [select for diffs], Thu Dec 18 19:28:44 2014 UTC (9 years, 5 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.140: +9 -8 lines
Diff to previous 1.140 (colored)

two more uses of siphash. better hash for ipv4. maybe not needed for rbtree
hint, but still pretty. ok deraadt

Revision 1.140 / (download) - annotate - [select for diffs], Fri Dec 12 18:15:51 2014 UTC (9 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.139: +6 -2 lines
Diff to previous 1.139 (colored)

convert some hash tables (the easy ones) to siphash. ok benno.

Revision 1.139 / (download) - annotate - [select for diffs], Wed Oct 8 16:15:37 2014 UTC (9 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.138: +3 -4 lines
Diff to previous 1.138 (colored)

Use reallocarray() throughout to spot multiplicative int overflow.
ok henning benno

Revision 1.138 / (download) - annotate - [select for diffs], Wed Aug 14 20:34:27 2013 UTC (10 years, 9 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.137: +12 -4 lines
Diff to previous 1.137 (colored)

Rewrite the internals of the RDE reload logic.
This is the first step to make bgpd reload non blocking in the RDE.
It also speeds up the reload time a fair bit in some cases (mainly if
you run with multiple RIBs and have larger filtersets) and it should also
fix a few edge cases on reloads.
Testing done by benno@, florian@ and sthen@ OK henning@ and benno@

Revision 1.137 / (download) - annotate - [select for diffs], Wed Jul 17 14:09:13 2013 UTC (10 years, 10 months ago) by benno
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.136: +10 -2 lines
Diff to previous 1.136 (colored)

on graceful restart, the number of prefixes could be counted wrong,
triping max-prefix.  fix it this way, at least until prefix accounting
is done better.
diff from florian@
ok claudio@

Revision 1.136 / (download) - annotate - [select for diffs], Mon May 20 11:26:13 2013 UTC (11 years ago) by claudio
Branch: MAIN
Changes since 1.135: +2 -1 lines
Diff to previous 1.135 (colored)

D'oh, add missing break in prefix_writebuf(). Another find by blambert@
who is to shy to commit these by himself.

Revision 1.135 / (download) - annotate - [select for diffs], Thu Mar 14 14:52:52 2013 UTC (11 years, 2 months ago) by florian
Branch: MAIN
Changes since 1.134: +2 -2 lines
Diff to previous 1.134 (colored)

correct struct in sizeof(); found by llvm
OK sthen@

Revision 1.134 / (download) - annotate - [select for diffs], Wed Sep 12 05:56:22 2012 UTC (11 years, 8 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.133: +31 -1 lines
Diff to previous 1.133 (colored)

Better graceful restart support (implementing more then just the EoR record).
This implements only the "Restarting Client" bits of the RFC -- in other
words bgpd will keep the FIB when the client restarts but it will not do GR
when restarting itself. The capability is still off by default (you need
"announce restart yes" to enable it).
Tested by Anders Berggren. OK sthen@

Revision 1.133 / (download) - annotate - [select for diffs], Sun Jul 1 11:55:13 2012 UTC (11 years, 11 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.132: +2 -2 lines
Diff to previous 1.132 (colored)

typo in comment, s/withdrawl/withdrawal/

Revision 1.132 / (download) - annotate - [select for diffs], Tue May 22 20:44:06 2012 UTC (12 years ago) by claudio
Branch: MAIN
Changes since 1.131: +2 -2 lines
Diff to previous 1.131 (colored)

Flush the right networks, the dynamic ones not the static ones.
OK henning@, sthen@

Revision 1.131 / (download) - annotate - [select for diffs], Wed Sep 21 08:59:01 2011 UTC (12 years, 8 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.130: +24 -21 lines
Diff to previous 1.130 (colored)

Fix nexthop_modify() to reset the flags when called. Until now
set nexthop-self was sticky and so later set nexthop <IP> were
not applied.
Problem found and fix tested by Tony Sarendal. OK henning@

Revision 1.130 / (download) - annotate - [select for diffs], Tue Sep 20 21:19:06 2011 UTC (12 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.129: +1 -61 lines
Diff to previous 1.129 (colored)

Move a few functions into util.c because bgpctl will need them soon.

Revision 1.129 / (download) - annotate - [select for diffs], Sat Sep 17 16:29:44 2011 UTC (12 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.128: +26 -1 lines
Diff to previous 1.128 (colored)

Implement new mrt table dump format as specified in draft-ietf-grow-mrt.
Tested with IP and IPv6 sessions and against the libbgpdump parser.
OK henning@

Revision 1.128 / (download) - annotate - [select for diffs], Fri Jan 14 20:07:00 2011 UTC (13 years, 4 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.127: +2 -1 lines
Diff to previous 1.127 (colored)

plug memleak in err path; from zinovik, ok claudio

Revision 1.127 / (download) - annotate - [select for diffs], Mon May 3 13:09:38 2010 UTC (14 years, 1 month ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.126: +4 -3 lines
Diff to previous 1.126 (colored)

Make it possible to load multiple routing tables at the same time and use
those for alternate RIBs. This allows to use "rde rib TESTIT rtable 1".
NOTE: nexthop verification has changed for alternate tables. For now
nexthop will only be verified against the main routing table (id 0).
Because of this "nexthop qualify via bgp" may now compare the nexthops
against bgpd routes from a different RIB.
Tested by sthen@, OK to move on by henning@

Revision 1.126 / (download) - annotate - [select for diffs], Tue Apr 20 09:02:12 2010 UTC (14 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.125: +10 -17 lines
Diff to previous 1.125 (colored)

prefix_unlink() must remove the rib entry. Currently this was only done
in prefix_destroy() but there is another caller of prefix_unlink() which
missed the rib_remove() resulting in tree corruption and possible crashes.
Doing the remove in prefix_unlink() is better since we do the same with the
prefix and rib & prefix are linked. Fix some comments to match code and
remove double call to pt_empty()/pt_remove().
Found while hacking on something else.

Revision 1.125 / (download) - annotate - [select for diffs], Wed Apr 7 09:44:11 2010 UTC (14 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.124: +5 -5 lines
Diff to previous 1.124 (colored)

Call nexthop_delete() a bit later in nexthop_update(). The nh->state needs
to be changed before calling nexthop_delete() or the nexthop will not be
correclty removed in the unlikly event when all aspathes move to a different
nexthop while the lookup happens.
sthen@ agrees with the logic.

Revision 1.124 / (download) - annotate - [select for diffs], Tue Apr 6 13:25:08 2010 UTC (14 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.123: +4 -16 lines
Diff to previous 1.123 (colored)

Switch to a more address family independent nexthop imsg. Instead of passing
struct kroute or kroute6 pack the needed info into a struct bgpd_addr.
No flames comming out of my and sthen@'s bgpd routers.

Revision 1.123 / (download) - annotate - [select for diffs], Mon Mar 29 09:06:56 2010 UTC (14 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.122: +6 -7 lines
Diff to previous 1.122 (colored)

We always allocate rib ids dynamicaly so there is no need for allowing
fixed id allocation. Makes code simpler.
OK henning

Revision 1.122 / (download) - annotate - [select for diffs], Fri Mar 26 15:38:39 2010 UTC (14 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.121: +2 -2 lines
Diff to previous 1.121 (colored)

Be more careful when walking the tree looking for a non-empty element,
we may actually hit the end of the tree (at least in theory).

Revision 1.121 / (download) - annotate - [select for diffs], Wed Mar 3 13:52:39 2010 UTC (14 years, 3 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.120: +2 -2 lines
Diff to previous 1.120 (colored)

Replace enum rib_state with enum reconf_action since their doing the same.
NEW is now REINIT, ACTIVE is KEEP and DELETE and NONE stay the same.

Revision 1.120 / (download) - annotate - [select for diffs], Wed Jan 13 06:02:37 2010 UTC (14 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.119: +45 -9 lines
Diff to previous 1.119 (colored)

Add support for BGP MPLS VPN aka RFC 4364. This is only the RDE part so
that it is possible to use OpenBGPD as a route-reflector for VPNv4.
Some clean up of the BGP MP code so that multiple protocols are easier
supported. kroute/kernel support not yet done but comming.
OK henning@, reyk@

Revision 1.119 / (download) - annotate - [select for diffs], Sun Jan 10 00:15:09 2010 UTC (14 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.118: +5 -5 lines
Diff to previous 1.118 (colored)

Switch rib_dump() to use AID instead of AFs. OK henning@

Revision 1.118 / (download) - annotate - [select for diffs], Tue Dec 1 14:28:05 2009 UTC (14 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.117: +27 -26 lines
Diff to previous 1.117 (colored)

Use an artificial address family id in struct bgpd_addr and almost everywhere
else. Adds conversion functions to map AFI/SAFI and the Unix AF_ values
from and into AID used in bgpd.  This is needed to support things like MPLS
VPN and other upcomming changes that need to play a lot with AFI/SAFI pairs.
Mostly mechanical change, henning@ has no particular issues with this.
Must go in so that I can continue working.

Revision 1.117 / (download) - annotate - [select for diffs], Mon Oct 5 12:03:45 2009 UTC (14 years, 8 months ago) by claudio
Branch: MAIN
Changes since 1.116: +2 -2 lines
Diff to previous 1.116 (colored)

Load prefixes into new created RIBs at reload time by walking over the
Adj-RIB-In. This only works correctly when softreconfig in is enabled
(which is the default). This is needed to allow dynamic creation of
additional RIBs. OK henning@

Revision 1.116 / (download) - annotate - [select for diffs], Mon Jun 29 14:13:48 2009 UTC (14 years, 11 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.115: +3 -3 lines
Diff to previous 1.115 (colored)

Protect the other rde_send_kroute() with a F_RIB_NOFIB check.

Revision 1.115 / (download) - annotate - [select for diffs], Sun Jun 7 00:30:23 2009 UTC (14 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.114: +13 -3 lines
Diff to previous 1.114 (colored)

First attempt at reload support for RIBs. There is some magic that I do
not fully understand but at least no flames are comming out of my test
box anymore.

Revision 1.114 / (download) - annotate - [select for diffs], Thu Jun 4 21:53:43 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.113: +20 -1 lines
Diff to previous 1.113 (colored)

Implement rib_find and add a rib id to struct rde_peer.

Revision 1.113 / (download) - annotate - [select for diffs], Thu Jun 4 04:46:42 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.112: +9 -9 lines
Diff to previous 1.112 (colored)

Add "rde rib <name>" to the config and allow the rde to use these other RIBs.
Still a bit hackish, reload is missing and printconf as well. Looks good h@

Revision 1.112 / (download) - annotate - [select for diffs], Wed Jun 3 20:22:04 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.111: +11 -8 lines
Diff to previous 1.111 (colored)

Allocate all rib contextes for tree walks and don't use static stack memory.
This will make interruptable walks a lot easier.

Revision 1.111 / (download) - annotate - [select for diffs], Wed Jun 3 20:20:10 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.110: +33 -4 lines
Diff to previous 1.110 (colored)

Initial stab at rib_free() until now unused.

Revision 1.110 / (download) - annotate - [select for diffs], Wed Jun 3 20:17:59 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.109: +5 -16 lines
Diff to previous 1.109 (colored)

Better way to allocate new RIBs.

Revision 1.109 / (download) - annotate - [select for diffs], Wed Jun 3 19:54:53 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.108: +10 -12 lines
Diff to previous 1.108 (colored)

Make prefix_destroy more generic and use it in prefix_remove this is possible
because path_remove was changed to remove the prefixes in a slightly different
way.

Revision 1.108 / (download) - annotate - [select for diffs], Tue Jun 2 00:09:02 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.107: +21 -1 lines
Diff to previous 1.107 (colored)

Move the rest of the rib dump functions into rde_rib.c where it belongs.

Revision 1.107 / (download) - annotate - [select for diffs], Mon Jun 1 23:54:50 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.106: +1 -2 lines
Diff to previous 1.106 (colored)

Use only one list to queue the dump contextes on. Use the list in struct
rib_context instead of the ctl specific rde_dump_ctx to make it more general.

Revision 1.106 / (download) - annotate - [select for diffs], Mon Jun 1 22:54:02 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.105: +2 -2 lines
Diff to previous 1.105 (colored)

Do not call the upcall twice on some prefixes. Move the upcall back to
where it was beforhands.

Revision 1.105 / (download) - annotate - [select for diffs], Mon Jun 1 22:49:06 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.104: +24 -51 lines
Diff to previous 1.104 (colored)

Holy simplification batman. Use the per rib entry flags to lock entries
when interrupting rib dumps and now we no longer need evil RB magic to find
the next entry on restart.

Revision 1.104 / (download) - annotate - [select for diffs], Mon Jun 1 21:20:17 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.103: +6 -5 lines
Diff to previous 1.103 (colored)

Instead of storing a pointer to the RIB head in the RIB element use that
space for a flags field and the RIB id. In the end bgpd will be able to
lock RIB elements and therefore make it possible to interrupt all tree
walks.

Revision 1.103 / (download) - annotate - [select for diffs], Wed May 27 06:58:15 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.102: +23 -25 lines
Diff to previous 1.102 (colored)

Move update and withdraw code into own functions to simplify the necessary
changes to make multiple RIB functional. Also change the way we account the
prefixes per peer (for maxprefix check). Every prefix that was added to any
RIB is counted. OK henning@

Revision 1.102 / (download) - annotate - [select for diffs], Thu May 21 15:47:03 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.101: +12 -8 lines
Diff to previous 1.101 (colored)

Make it possible to turn off the decision process per RIB. This is mainly
used for the Adj-Rib-In. Also initialize the Adj-Rib-In correctly and mark
it a noevaluate.

Revision 1.101 / (download) - annotate - [select for diffs], Sun May 17 14:45:25 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.100: +9 -17 lines
Diff to previous 1.100 (colored)

F_LOCAL and F_ORIGINAL are gone. The Adj-Rib-In is now a distinct tree.
Fix pf table code by checking if the aspath has a pftableid set or not
instead of doing the F_LOCAL dance. This works because the in the
Adj-Rib-In it is impossible to set pftableid.

Revision 1.100 / (download) - annotate - [select for diffs], Sun May 17 13:20:12 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.99: +15 -12 lines
Diff to previous 1.99 (colored)

rib_dump_r needs to check the af of the prefix because there is no rib per
address family. In rib_restart fix a possible use after free.

Revision 1.99 / (download) - annotate - [select for diffs], Sun May 17 12:25:15 2009 UTC (15 years ago) by claudio
Branch: MAIN
Changes since 1.98: +352 -165 lines
Diff to previous 1.98 (colored)

Rework most of the RDE to allow multiple RIBs. This is mostly preparation
work by changing the way the RDE DB is built. struct prefix and struct
pt_entry are simplified and extended with a rib_entry where the decision
tree is run on. From now on a prefix can only reside on one particular RIB
which simplifies the code a bit. Currently there are two fixed ribs
(adj-rib-in and the local-rib) which needs to be made more dynamic in
upcomming commits.
This is work in progress, the RDE seems to work for me and sthen@ (no flames
comming out of our testrouters but there is still a lot missing)
Move into the tree to simplify developement -- henning@

Revision 1.98 / (download) - annotate - [select for diffs], Thu Apr 23 19:23:27 2009 UTC (15 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.97: +19 -13 lines
Diff to previous 1.97 (colored)

Rework the way we handle announced networks. Instead of two freak rde_peers
use one that is less freaky. Merge bgpctl and config networks into one tree.
First step of a larger change in the RDE and this goes now in to allow to
move forward.

Revision 1.97 / (download) - annotate - [select for diffs], Fri Nov 21 17:41:22 2008 UTC (15 years, 6 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.96: +22 -7 lines
Diff to previous 1.96 (colored)

Track nexthops when the underlying route is changing. Until now true nexthops
were only resolved when they were added. This calls for troubles if something
like ospfd starts to change the underlying routes.
Tested by gollo@, OK henning@

Revision 1.96 / (download) - annotate - [select for diffs], Fri Jun 1 04:17:30 2007 UTC (17 years ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.95: +2 -12 lines
Diff to previous 1.95 (colored)

Remove a stupid wrapper function that does nothing more then calling another
function with the same arguments.

Revision 1.95 / (download) - annotate - [select for diffs], Fri May 11 11:27:59 2007 UTC (17 years ago) by claudio
Branch: MAIN
Changes since 1.94: +5 -5 lines
Diff to previous 1.94 (colored)

Various spelling fixes from Stuart Henderson.

Revision 1.94 / (download) - annotate - [select for diffs], Mon Apr 2 12:51:06 2007 UTC (17 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.93: +2 -2 lines
Diff to previous 1.93 (colored)

Typo.

Revision 1.93 / (download) - annotate - [select for diffs], Thu Feb 22 08:34:18 2007 UTC (17 years, 3 months ago) by henning
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.92: +2 -3 lines
Diff to previous 1.92 (colored)

KNF

Revision 1.92 / (download) - annotate - [select for diffs], Thu Jan 11 22:00:17 2007 UTC (17 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.91: +2 -2 lines
Diff to previous 1.91 (colored)

Correct logic in path_update() so that moves are only done when needed.
Previously prefix changes of neighbors with softreconfig in disabled where
using prefix_add() instead of prefix_move(). Luckily prefix_add() has
additional logic to detect this case and calls prefix_move() itself.
This made backtraces of a totaly different issue so strange that I was
hunting a bug for weeks at the completely wrong spot. Doh!

Revision 1.91 / (download) - annotate - [select for diffs], Tue Dec 12 10:34:22 2006 UTC (17 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.90: +10 -9 lines
Diff to previous 1.90 (colored)

Change nexthop_delete() to be more obvious what's going on. No functional
change. OK henning@

Revision 1.90 / (download) - annotate - [select for diffs], Tue Dec 12 10:30:33 2006 UTC (17 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.89: +3 -1 lines
Diff to previous 1.89 (colored)

Even IPv6 has a prefixlen limit. This ensures that we do not overflow the
struct in6_addr later on. OK henning@

Revision 1.89 / (download) - annotate - [select for diffs], Tue Dec 12 10:26:47 2006 UTC (17 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.88: +4 -3 lines
Diff to previous 1.88 (colored)

In path_remove() remove only local prefixes from the pftable.
OK henning@

Revision 1.88 / (download) - annotate - [select for diffs], Thu Jun 1 22:29:47 2006 UTC (18 years ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.87: +4 -1 lines
Diff to previous 1.87 (colored)

Copy the pftableid in path_copy and correctly do the ref/unref dance in
path_copy and path_put. Diff from Kevin Brintnall, looks good henning@

Revision 1.87 / (download) - annotate - [select for diffs], Sun May 28 23:24:15 2006 UTC (18 years ago) by claudio
Branch: MAIN
Changes since 1.86: +27 -5 lines
Diff to previous 1.86 (colored)

Even better nexthop delete behaviour. Do not delete nexthop if they are used
by filter sets or if the nexthop is currently looked up. With this the
"nexthop_update: non-existent nexthop" warning should be history. OK henning@

Revision 1.86 / (download) - annotate - [select for diffs], Sun May 28 22:07:54 2006 UTC (18 years ago) by claudio
Branch: MAIN
Changes since 1.85: +4 -1 lines
Diff to previous 1.85 (colored)

Preload and pin nexthop used in filtersets so the are validiated when used.
This will fix problems with set nexthop on outgoing filters. Found by
gluk@ OK henning@

Revision 1.85 / (download) - annotate - [select for diffs], Tue Apr 4 12:03:26 2006 UTC (18 years, 2 months ago) by henning
Branch: MAIN
Changes since 1.84: +5 -1 lines
Diff to previous 1.84 (colored)

add "set nexthop self", force nexthop to be set to own address even with IBGP
requested & tested Falk Brockerhoff <fb@smartterra.de>, and tony sarendal
tested this too. claudio ok

Revision 1.84 / (download) - annotate - [select for diffs], Wed Mar 15 15:37:40 2006 UTC (18 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.83: +2 -2 lines
Diff to previous 1.83 (colored)

In nexthop_compare() if the two passed pointers point to the same object
the odds are better than good that there is no difference.

Revision 1.83 / (download) - annotate - [select for diffs], Tue Jan 24 13:34:33 2006 UTC (18 years, 4 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.82: +56 -17 lines
Diff to previous 1.82 (colored)

Finally start using the Adj-RIB-In. The most complex part is the modification
of path_update(). There are about 10 different ways how to update a path and
some of them are tricky. Looks good henning@

Revision 1.82 / (download) - annotate - [select for diffs], Tue Jan 24 13:00:35 2006 UTC (18 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.81: +17 -1 lines
Diff to previous 1.81 (colored)

It is possible that a prefix is part of two RIBs in that case prefix_remove()
needs to be extra careful and only remove the prefix from the specified RIB.
Looks good henning@

Revision 1.81 / (download) - annotate - [select for diffs], Tue Jan 24 10:05:24 2006 UTC (18 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.80: +2 -2 lines
Diff to previous 1.80 (colored)

KNF

Revision 1.80 / (download) - annotate - [select for diffs], Fri Jan 20 16:40:17 2006 UTC (18 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.79: +19 -9 lines
Diff to previous 1.79 (colored)

Proactively fix prefix counters. Currently only F_LOCAL prefixes exist but
as soon as F_ORIGINAL come the counters would no longer be correct and in the
end max-prefix would no longer work. Add additinal counters for F_ORIGINAL
prefixes and bump the correct conter depending on the prefix flags.
OK henning@

Revision 1.79 / (download) - annotate - [select for diffs], Fri Jan 20 16:06:12 2006 UTC (18 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.78: +33 -6 lines
Diff to previous 1.78 (colored)

Pass flags to prefix_move() so that a prefix that has both F_ORIGINAL and
F_LOCAL set can be moved correctly. This is more like a add as we have one
prefix more afterwards. Looks good henning@

Revision 1.78 / (download) - annotate - [select for diffs], Sat Jan 14 22:39:49 2006 UTC (18 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.77: +35 -24 lines
Diff to previous 1.77 (colored)

Small step in supporting the Adj-RIB-In additionaly to the Local-RIB.
First step is to define two flags F_LOCAL and F_ORIGINAL. These flags
are used to distinguish prefix in the Local-RIB and those in the Adj-
RIB-In. Adapt prefix API and add additional checks so that no Adj-RIB-
In prefixes get mistakenly selected. Currently no F_ORIGINAL prefixes
are created but this may change soon. Looks good Henning.

Revision 1.77 / (download) - annotate - [select for diffs], Thu Jan 12 14:05:13 2006 UTC (18 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.76: +8 -9 lines
Diff to previous 1.76 (colored)

Copy AS path in rde_filter() on demand instead of doing it before calling
rde_filter(). Adapt path_update() to this change too. path_update() does
a path_copy before linking the rde_aspath into the RIB. Looks good Henning.

Revision 1.76 / (download) - annotate - [select for diffs], Mon Jan 9 16:00:48 2006 UTC (18 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.75: +2 -2 lines
Diff to previous 1.75 (colored)

Ups. Inverse logic.

Revision 1.75 / (download) - annotate - [select for diffs], Thu Jan 5 17:33:40 2006 UTC (18 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.74: +7 -13 lines
Diff to previous 1.74 (colored)

Kill ENSURE(), remove ensure.h, say bye bye to fatal_ensure() and
one hip hip hooray from Henning.

Revision 1.74 / (download) - annotate - [select for diffs], Thu Jan 5 16:00:07 2006 UTC (18 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.73: +4 -29 lines
Diff to previous 1.73 (colored)

Cache optional BGP attributes (mostly communities) and use a simple
pointer plus a ref counter to link the attributes to the path object.
Saves +/- 10M on 11 full feeds. Looks good Henning

Revision 1.73 / (download) - annotate - [select for diffs], Wed Jan 4 16:13:07 2006 UTC (18 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.72: +22 -15 lines
Diff to previous 1.72 (colored)

Fix a mem leak of the unusual kind. In some cases a new aspath was added
to the RIB without checking if there was a equal path already available.
Modify path_update() so that we do not link a new aspath without calling
path_lookup() before to check if the aspath is not already in the RIB.
Found via bgpctl show rib mem. OK henning

Revision 1.72 / (download) - annotate - [select for diffs], Tue Jan 3 22:49:17 2006 UTC (18 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.71: +11 -2 lines
Diff to previous 1.71 (colored)

Track some (memory) statistics in the RDE. Accessible via bgpctl.

Revision 1.71 / (download) - annotate - [select for diffs], Fri Dec 30 14:07:40 2005 UTC (18 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.70: +6 -7 lines
Diff to previous 1.70 (colored)

Use sys/hash.h instead of own built functions that work similar.
While there reorder some structs to help with alignment.

Revision 1.70 / (download) - annotate - [select for diffs], Tue Nov 29 21:11:07 2005 UTC (18 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.69: +4 -6 lines
Diff to previous 1.69 (colored)

Add a flags field to struct prefix which will be used shortly. Remove the peer
pointer so that the size does not grow. Adding 4 bytes to struct prefix would
result in 64MB more memory usage on one of my systems.

Revision 1.69 / (download) - annotate - [select for diffs], Fri Jul 29 12:38:40 2005 UTC (18 years, 10 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.68: +19 -5 lines
Diff to previous 1.68 (colored)

Add another piece to the IPv6 puzzle. This time code to generate MP updates.
Does not affect IPv4 minimaly tested for IPv6 because we still don't have an
IPv6 capable neighbor. henning@ ya

Revision 1.68 / (download) - annotate - [select for diffs], Fri Jul 1 09:19:24 2005 UTC (18 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.67: +9 -7 lines
Diff to previous 1.67 (colored)

Make the pftable filter set use the name2id "cache" like the route labels.
This saves 14 bytes per aspath. OK henning@

Revision 1.67 / (download) - annotate - [select for diffs], Wed Jun 29 09:43:26 2005 UTC (18 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.66: +9 -1 lines
Diff to previous 1.66 (colored)

rtlabel support via filter sets. Just use "set rtlabel foobar" in filters
network and neighbor statements and the routes are labeled accordingly.
While doing that fix some mem-leaks by introducing filterset_free() and
remove the free on send option of send_filterset().
This took a bit longer because we need to carefully track the rtlabel id
refcnts or bad things may happen on reloads.
henning@ looks fine

Revision 1.66 / (download) - annotate - [select for diffs], Tue Apr 12 14:32:01 2005 UTC (19 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.65: +7 -1 lines
Diff to previous 1.65 (colored)

Introduce a per prefix weight.  The weight is used to tip prefixes with equal
long AS pathes in one or the other direction.  It weights a prefix at a very
late stage in the decision process. This is a nice bgpd feature to traffic
engineer networks where most AS pathes are equally long.
OK henning@

Revision 1.65 / (download) - annotate - [select for diffs], Sat Mar 26 12:46:52 2005 UTC (19 years, 2 months ago) by claudio
Branch: MAIN
Changes since 1.64: +3 -3 lines
Diff to previous 1.64 (colored)

Move the path_empty()/path_destroy() check out of the inner for-loop.
Makes the code more obvious. Idea from tedu@ OK henning@

Revision 1.64 / (download) - annotate - [select for diffs], Fri Mar 11 12:54:20 2005 UTC (19 years, 2 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.63: +5 -1 lines
Diff to previous 1.63 (colored)

Finally commit the transparent-as and nexthop no-modify stuff I wrote on the
way to FOSDEM. With transparent-as set to ye bgpd will not prepend his own
AS for sent updates. NB the neighbor needs to set "enforce neighbor-as no"
or it will not like the received AS paths. With set nexthop no-modify bgpd
will change the nexthop as done normaly.
OK henning@ man page update with help of jmc@

Revision 1.63 / (download) - annotate - [select for diffs], Tue Nov 23 13:07:01 2004 UTC (19 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.62: +10 -7 lines
Diff to previous 1.62 (colored)

Switch from a single filter_set to a linked list of sets. With this change
it is possible to specify multiple communities. This is also the first step
to better bgpd filters. OK henning@

Revision 1.62 / (download) - annotate - [select for diffs], Fri Nov 19 09:59:27 2004 UTC (19 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.61: +6 -5 lines
Diff to previous 1.61 (colored)

Only unlink and link the asp in nexthop_modify if the asp is linked.
OK henning@

Revision 1.61 / (download) - annotate - [select for diffs], Wed Nov 10 16:12:11 2004 UTC (19 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.60: +2 -2 lines
Diff to previous 1.60 (colored)

prefix_write() works also for IPv6. OK henning@

Revision 1.60 / (download) - annotate - [select for diffs], Wed Nov 10 12:41:58 2004 UTC (19 years, 6 months ago) by claudio
Branch: MAIN
Changes since 1.59: +6 -8 lines
Diff to previous 1.59 (colored)

Remove no longer needed code. OK henning@

Revision 1.59 / (download) - annotate - [select for diffs], Tue Aug 17 15:39:36 2004 UTC (19 years, 9 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.58: +3 -1 lines
Diff to previous 1.58 (colored)

Always update prefix timestamp even if nothing has changed. Without this
networks disappear after reload. OK henning@

Revision 1.58 / (download) - annotate - [select for diffs], Fri Aug 13 14:03:20 2004 UTC (19 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.57: +19 -1 lines
Diff to previous 1.57 (colored)

Fix minor issues with IPv6 dumps and add a function for dumping the RIB table
protocol independent. This new dump format is not (yet) supported by the
mrtd route_btoa tool. OK henning@

Revision 1.57 / (download) - annotate - [select for diffs], Thu Aug 12 10:24:16 2004 UTC (19 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.56: +5 -29 lines
Diff to previous 1.56 (colored)

Just ignore RFC2545 and the silly idea of using link local addresses as
nexthop. This makes the code a lot simpler. OK henning@

Revision 1.56 / (download) - annotate - [select for diffs], Tue Aug 10 13:02:08 2004 UTC (19 years, 9 months ago) by claudio
Branch: MAIN
Changes since 1.55: +6 -3 lines
Diff to previous 1.55 (colored)

switch nexthop in struct filter_set form struct in_addr to struct bgpd_addr
OK henning@

Revision 1.55 / (download) - annotate - [select for diffs], Fri Aug 6 12:04:08 2004 UTC (19 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.54: +307 -214 lines
Diff to previous 1.54 (colored)

Monster diff to get one step closer to IPv6 support.
Cleanup path attribute handling. First of all kill struct attr_flags, all
those infos are now in struct rde_aspath. Second move attribute parser
functions into rde.c, rde_attr.c is shared between bgpd and bgpctl.
Third reimplementation of the nexthop handling. Make it IPv6 ready and
fix some major bug relating to "set nexthop".
henning@ OK if it breaks nothing

Revision 1.54 / (download) - annotate - [select for diffs], Thu Aug 5 19:23:10 2004 UTC (19 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.53: +1 -73 lines
Diff to previous 1.53 (colored)

Get rid of some statistics stuff that is no longer needed but helped in the
beginning. OK henning@

Revision 1.53 / (download) - annotate - [select for diffs], Thu Aug 5 18:44:19 2004 UTC (19 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.52: +3 -2 lines
Diff to previous 1.52 (colored)

Cleanup aspath specific functions and api. Mainly switch to a refcnt based
allocation. This helps to save a bit of RAM. looks good henning@

Revision 1.52 / (download) - annotate - [select for diffs], Thu Aug 5 16:26:56 2004 UTC (19 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.51: +4 -4 lines
Diff to previous 1.51 (colored)

struct prefix has a pointer to the peer so use it everywhere directly instead
of the detour via aspath.

Revision 1.51 / (download) - annotate - [select for diffs], Thu Aug 5 15:58:21 2004 UTC (19 years, 10 months ago) by claudio
Branch: MAIN
Changes since 1.50: +42 -2 lines
Diff to previous 1.50 (colored)

rename and move prefix_equal() to prefix_compare() which returns -1, 0, 1
similar to memcmp() and all other compare functions in bgpd. OK henning@

Revision 1.50 / (download) - annotate - [select for diffs], Mon Jul 5 02:13:44 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.49: +2 -2 lines
Diff to previous 1.49 (colored)

fix a few KNF fallouts

Revision 1.49 / (download) - annotate - [select for diffs], Tue Jun 22 23:17:01 2004 UTC (19 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.48: +8 -21 lines
Diff to previous 1.48 (colored)

Cleanup. jajaja henning@

Revision 1.48 / (download) - annotate - [select for diffs], Tue Jun 22 20:28:58 2004 UTC (19 years, 11 months ago) by claudio
Branch: MAIN
Changes since 1.47: +9 -4 lines
Diff to previous 1.47 (colored)

Make the RDE IPv6 ready missing is the message handling. The internal
prefix tree changed form a hash table to a per AF RB tree.
OK henning@ some ideas are from Brent Graveland.

Revision 1.47 / (download) - annotate - [select for diffs], Tue Jun 22 07:22:31 2004 UTC (19 years, 11 months ago) by henning
Branch: MAIN
Changes since 1.46: +3 -3 lines
Diff to previous 1.46 (colored)

introduce kroute6, which will be used to build a seperate v6 table
(smashing them into the v4 table would raise the memory requirements far too
much), and make kroute_nexthop (where we are not under such memory pressure,
you don't have a hundred thousand nexthops) v4/v6. change existing callers
to use the v4 part, claudio ok

Revision 1.46 / (download) - annotate - [select for diffs], Sat May 8 19:17:20 2004 UTC (20 years ago) by henning
Branch: MAIN
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (colored)

KNF

Revision 1.45 / (download) - annotate - [select for diffs], Fri May 7 10:06:15 2004 UTC (20 years, 1 month ago) by djm
Branch: MAIN
Changes since 1.44: +12 -1 lines
Diff to previous 1.44 (colored)

add a filter option to dump prefixes learned in UPDATEs into a PF table,
intended for building realtime BGP blacklists (e.g. with spamd);
ok claudio & henning

Revision 1.44 / (download) - annotate - [select for diffs], Fri Apr 30 18:42:05 2004 UTC (20 years, 1 month ago) by henning
Branch: MAIN
Changes since 1.43: +1 -13 lines
Diff to previous 1.43 (colored)

remove MAX_PREFIX_PER_AS debug gunk, claudio djm ok

Revision 1.43 / (download) - annotate - [select for diffs], Wed Apr 28 07:05:27 2004 UTC (20 years, 1 month ago) by claudio
Branch: MAIN
Changes since 1.42: +3 -1 lines
Diff to previous 1.42 (colored)

Pointer that are used later in the code should be initalized. Fixes a crash
noticed by Henning. OK henning@

Revision 1.42 / (download) - annotate - [select for diffs], Thu Mar 11 14:22:23 2004 UTC (20 years, 2 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.41: +48 -1 lines
Diff to previous 1.41 (colored)

Shutdown the RDE cleanly on exit. Plug some memleaks. OK henning@

Revision 1.41 / (download) - annotate - [select for diffs], Fri Mar 5 22:21:32 2004 UTC (20 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.40: +3 -2 lines
Diff to previous 1.40 (colored)

Plug some memory leaks in rde. Based on a patch by Patrick Latifi.
Added attr_move() so that we can copy the attribute before calling the filter.
path_update() will now use the passed attribute so it can't be simply reused.
OK henning@

Revision 1.40 / (download) - annotate - [select for diffs], Mon Mar 1 16:02:01 2004 UTC (20 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.39: +5 -1 lines
Diff to previous 1.39 (colored)

Make it possible to diable the decision process. This is a feature only useful
for route-collectors. OK henning@

Revision 1.39 / (download) - annotate - [select for diffs], Fri Feb 27 20:53:56 2004 UTC (20 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.38: +13 -19 lines
Diff to previous 1.38 (colored)

remove unneded peer pointer in struct prefix and change a in_addr_t to
struct in_addr. OK henning@

Revision 1.38 / (download) - annotate - [select for diffs], Fri Feb 27 14:46:09 2004 UTC (20 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.37: +10 -14 lines
Diff to previous 1.37 (colored)

Cleanup no functional changes. OK henning@

Revision 1.37 / (download) - annotate - [select for diffs], Fri Feb 27 14:43:18 2004 UTC (20 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.36: +6 -2 lines
Diff to previous 1.36 (colored)

It is possible to end up in prefix_add with a prefix that needs to be moved.
This caused troubles with show rib because of an ENSURE.  OK henning@

Revision 1.36 / (download) - annotate - [select for diffs], Thu Feb 26 16:16:41 2004 UTC (20 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.35: +2 -5 lines
Diff to previous 1.35 (colored)

show rib infrastructure. At least full dumps and per as dumps. Per prefix
dump need some more work. OK henning@

Revision 1.35 / (download) - annotate - [select for diffs], Thu Feb 19 23:07:00 2004 UTC (20 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.34: +2 -5 lines
Diff to previous 1.34 (colored)

Add support for basic filters. Nothing optimized and it has some issues but
this is a huge step forward. OK henning@

Revision 1.34 / (download) - annotate - [select for diffs], Thu Feb 19 13:54:58 2004 UTC (20 years, 3 months ago) by claudio
Branch: MAIN
Changes since 1.33: +4 -12 lines
Diff to previous 1.33 (colored)

Make the code more portable. Add some missing header files and make the use
of the queue(3) makros more portable. OK henning@ some time ago.

Revision 1.33 / (download) - annotate - [select for diffs], Mon Feb 9 01:56:18 2004 UTC (20 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.32: +7 -7 lines
Diff to previous 1.32 (colored)

replace a bunch of u_long by u_int32_t

Revision 1.32 / (download) - annotate - [select for diffs], Wed Feb 4 09:18:03 2004 UTC (20 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.31: +1 -428 lines
Diff to previous 1.31 (colored)

Move BGP path attribute handling functions in a own file. henning@ conceptual ok

Revision 1.31 / (download) - annotate - [select for diffs], Mon Feb 2 19:14:11 2004 UTC (20 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

spaces

Revision 1.30 / (download) - annotate - [select for diffs], Mon Feb 2 18:56:25 2004 UTC (20 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.29: +20 -4 lines
Diff to previous 1.29 (colored)

Fix bug in the decision process. The decision process is unable to directly
detect changes of the active prefix. This bug is only triggered when a
nexthop changes state. While doing that clarify prefix_move a bit.
OK henning@

Revision 1.29 / (download) - annotate - [select for diffs], Mon Feb 2 16:46:16 2004 UTC (20 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

Use correct struct in sizeof for calloc. OK henning@

Revision 1.28 / (download) - annotate - [select for diffs], Tue Jan 27 21:56:21 2004 UTC (20 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

move strict kroute from in_addr_t for nexthop and prefix to struct in_addr
ok claudio

Revision 1.27 / (download) - annotate - [select for diffs], Thu Jan 22 20:34:56 2004 UTC (20 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.26: +4 -4 lines
Diff to previous 1.26 (colored)

use log_warnx and log_info. reclassify a few messages in the process and fix
a few messages.

ok claudio@

Revision 1.26 / (download) - annotate - [select for diffs], Sun Jan 18 00:44:44 2004 UTC (20 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

spacing

Revision 1.25 / (download) - annotate - [select for diffs], Sat Jan 17 19:35:36 2004 UTC (20 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.24: +61 -4 lines
Diff to previous 1.24 (colored)

Make it possible to announce own networks. In the RDE these prefixes are
attached to a pseudo peer and inserted like all other prefixes into the RIB.
OK henning@

Revision 1.24 / (download) - annotate - [select for diffs], Tue Jan 13 16:08:04 2004 UTC (20 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.23: +21 -10 lines
Diff to previous 1.23 (colored)

Fix the aspath_* functions to allow empty aspath. A empty aspath is one
with len 0. Needed vor ibgp and local network announcements.
OK henning@

Revision 1.23 / (download) - annotate - [select for diffs], Tue Jan 13 13:45:50 2004 UTC (20 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.22: +7 -1 lines
Diff to previous 1.22 (colored)

Implement a max-prefix and a announce none | self | all neighbor statement.
The first limits the number of sent prefixes per peer the latter controls
which prefix we do annouce to the neighbor.
Another looks good from henning@

Revision 1.22 / (download) - annotate - [select for diffs], Mon Jan 12 13:33:16 2004 UTC (20 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.21: +5 -1 lines
Diff to previous 1.21 (colored)

Nexthop announcement fixup. There are different rules for ibgp and ebgp.
For ibgp the nexthop is normally passed unmodified unless the nexthop is
equal to the remote peer ip. To ebgp peers the nexthop is changed to the
local session ip unless the remote peer ip and the nexthop are on the same
subnet. OK henning@

Revision 1.21 / (download) - annotate - [select for diffs], Sun Jan 11 22:08:04 2004 UTC (20 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

KNF

Revision 1.20 / (download) - annotate - [select for diffs], Sun Jan 11 21:59:45 2004 UTC (20 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.19: +2 -1 lines
Diff to previous 1.19 (colored)

set address family...

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jan 11 21:47:20 2004 UTC (20 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.18: +29 -23 lines
Diff to previous 1.18 (colored)

Move all struct in_addr to either struct bgpd_addr or in_addr_t whichever
is more appropriate. The rde uses now in most cases struct bgpd_addr.
OK henning@

Revision 1.18 / (download) - annotate - [select for diffs], Sun Jan 11 19:14:43 2004 UTC (20 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.17: +4 -4 lines
Diff to previous 1.17 (colored)

use struct bgpd_addr for nexthop and gateway in struct kroute_nexthop
(and thus the nexthop messages between parent and RDE)

ok claudio@

Revision 1.17 / (download) - annotate - [select for diffs], Sun Jan 11 02:39:05 2004 UTC (20 years, 4 months ago) by henning
Branch: MAIN
Changes since 1.16: +5 -5 lines
Diff to previous 1.16 (colored)

KNF

Revision 1.16 / (download) - annotate - [select for diffs], Sat Jan 10 22:25:42 2004 UTC (20 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.15: +77 -1 lines
Diff to previous 1.15 (colored)

Implement as path prepends. At least one prepend is needed for ebgp
neighbors. Fix a bug in the update generation. If no path attributes are
available e.g. a packet with only withdraws we need to set (and write) the
bgp path attribute field to zero. With this change we are able to send
valid updates to our neighbors with one exception: the nexthop field which
needs to be changed for ebgp neighbors.
OK henning@

Revision 1.15 / (download) - annotate - [select for diffs], Sat Jan 10 16:20:29 2004 UTC (20 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.14: +144 -118 lines
Diff to previous 1.14 (colored)

RDE update generation. First we queue all updates and withdraws on a per
peer basis. A queue runner will dequeue and package those messages to valid
bgp UPDATE messages and send them to the SE.
Not yet done is per peer type attribute handling (like aspath prepends and
nexthop modifications) and the queue runner could be a tad smarter. All in
all this gives us a good starting point for the missing parts.
OK henning@

Revision 1.14 / (download) - annotate - [select for diffs], Tue Jan 6 10:51:14 2004 UTC (20 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

2004 OK henning@

Revision 1.13 / (download) - annotate - [select for diffs], Tue Dec 30 13:03:27 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.12: +7 -7 lines
Diff to previous 1.12 (colored)

typos from david

Revision 1.12 / (download) - annotate - [select for diffs], Fri Dec 26 22:41:01 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.11: +2 -4 lines
Diff to previous 1.11 (colored)

"when you try to be very smart, something breaks horribly"
zap aspath->state, which was a copy of aspath->nexthop->state, for a tiny
little bit faster access. tho, it happened what had to happen, they ran
out of sync.
it's just not worth it.

also add a missinf LIST_INIT.

Revision 1.11 / (download) - annotate - [select for diffs], Fri Dec 26 21:51:57 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.10: +6 -2 lines
Diff to previous 1.10 (colored)

set true_nexthop = exit_nexthop for directly connected nexthops
(in other words, make sure true_nexthop always has the right ip address
for nexthops in state reachable)

Revision 1.10 / (download) - annotate - [select for diffs], Fri Dec 26 21:30:20 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.9: +1 -13 lines
Diff to previous 1.9 (colored)

move struct nexthop definition to rde.h

Revision 1.9 / (download) - annotate - [select for diffs], Fri Dec 26 18:07:33 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.8: +8 -8 lines
Diff to previous 1.8 (colored)

when this project started and i added the fatal() function, I made it take
the error number as parameter instead of accessing errno, because in one
place the error number was not in errno but fetched from a socket.
now, of course it makes much more sense to just set errno to the error number
just fecthed in this one place instead of having hundreds of fatal() calls
all transfer the errno round and round and round...
fix this, and also provide a fatalx, which does not care for errno and doesn't
invoke strerror.
oh, btw, in the place where we fetch the err # from the socket, we don't
call fatal anymore anyway...

Revision 1.8 / (download) - annotate - [select for diffs], Thu Dec 25 23:41:23 2003 UTC (20 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.7: +2 -3 lines
Diff to previous 1.7 (colored)

Turn the nexthop verification on. At least in the RDE.

ok henning@

Revision 1.7 / (download) - annotate - [select for diffs], Thu Dec 25 23:22:13 2003 UTC (20 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.6: +43 -58 lines
Diff to previous 1.6 (colored)

RDE part of the nexthop verification puzzle.
The RDE just tracks the nexthop IPs and reacts on nexthop messages
from the parent.

ok henning@

Revision 1.6 / (download) - annotate - [select for diffs], Wed Dec 24 11:39:43 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN
Changes since 1.5: +12 -12 lines
Diff to previous 1.5 (colored)

typos in comments, from jared

Revision 1.5 / (download) - annotate - [select for diffs], Mon Dec 22 06:42:19 2003 UTC (20 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.4: +4 -4 lines
Diff to previous 1.4 (colored)

spelling

Revision 1.4 / (download) - annotate - [select for diffs], Sun Dec 21 16:11:34 2003 UTC (20 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.3: +116 -92 lines
Diff to previous 1.3 (colored)

yet more from the castathon; most aspath functions where accessing non-
aligned memory (u_int16_t) therefor crashed the RDE on my sparc64. All
buffer specific functions use now void * instead of u_char * so most cast
are now history. Tested on sparc64 and i386. OK henning@

Revision 1.3 / (download) - annotate - [select for diffs], Fri Dec 19 19:24:08 2003 UTC (20 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +5 -3 lines
Diff to previous 1.2 (colored)

knf

Revision 1.2 / (download) - annotate - [select for diffs], Fri Dec 19 01:15:47 2003 UTC (20 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +13 -11 lines
Diff to previous 1.1 (colored)

knf & 64-bit cleanup; henning ok

Revision 1.1 / (download) - annotate - [select for diffs], Wed Dec 17 11:46:54 2003 UTC (20 years, 5 months ago) by henning
Branch: MAIN

welcome, bgpd
started by me some time ago with moral support from theo, the proceeded up to
the point where the session engine worked correctly. claudio jeker joined
then and did a lot of work in the RDE.
it is not particulary usefull as application right now as parts are still
missing but is imported to enable more people to work on it.
status:
BGP sessions get established fine, OPEN messages and then KEEPALIVEs
exchanged etc. session FSM works fine; NOTIFICATIONs are handled fine, and
all connection drops etc I provoked get handled fine.
Incoming UPDATE messgages are parsed well and the data entered to the RIB,
the decision process is not yet there, neither is outgoing UPDATEs or sync
to the kernel routing table.

not connected to the builds yet.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.