mirror of
https://git.proxmox.com/git/mirror_frr
synced 2026-02-01 17:19:52 +00:00
doc: more organizing & updating
* Add chapter on BGPD * Add diagram for git workflow * Convert next-hop tracking documents to ReST * Update & organize workflow document * Move ldpd docs back up to the parent directory Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
b30de70968
commit
b22ba015ef
8
doc/developer/bgpd.rst
Normal file
8
doc/developer/bgpd.rst
Normal file
@ -0,0 +1,8 @@
|
||||
BGPD
|
||||
=========================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
next-hop-tracking
|
||||
|
||||
@ -231,7 +231,7 @@ latex_elements = {
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'FRR.tex', u'FRR Developer\'s Documentation',
|
||||
(master_doc, 'FRR.tex', u'FRR Developer\'s Manual',
|
||||
u'FRR', 'manual'),
|
||||
]
|
||||
|
||||
@ -261,7 +261,7 @@ latex_documents = [
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'frr', u'FRR Developer\'s Documentation',
|
||||
(master_doc, 'frr', u'FRR Developer\'s Manual',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
@ -275,7 +275,7 @@ man_pages = [
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'FRR', u'FRR Developer\'s Documentation',
|
||||
(master_doc, 'FRR', u'FRR Developer\'s Manual',
|
||||
author, 'FRR', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
BIN
doc/developer/git_branches.png
Normal file
BIN
doc/developer/git_branches.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
@ -6,5 +6,6 @@ Welcome to FRR's documentation!
|
||||
|
||||
workflow
|
||||
library
|
||||
bgpd
|
||||
building
|
||||
|
||||
|
||||
352
doc/developer/next-hop-tracking.rst
Normal file
352
doc/developer/next-hop-tracking.rst
Normal file
@ -0,0 +1,352 @@
|
||||
Next Hop Tracking
|
||||
==================
|
||||
|
||||
Next hop tracking is an optimization feature that reduces the processing time
|
||||
involved in the BGP bestpath algorithm by monitoring changes to the routing
|
||||
table.
|
||||
|
||||
Background
|
||||
-----------
|
||||
|
||||
Recursive routes are of the form:
|
||||
|
||||
::
|
||||
|
||||
p/m --> n
|
||||
[Ex: 1.1.0.0/16 --> 2.2.2.2]
|
||||
|
||||
where 'n' itself is resolved through another route as follows:
|
||||
|
||||
::
|
||||
|
||||
p2/m --> h, interface
|
||||
[Ex: 2.2.2.0/24 --> 3.3.3.3, eth0]
|
||||
|
||||
Usually, BGP routes are recursive in nature and BGP nexthops get resolved
|
||||
through an IGP route. IGP usually adds its routes pointing to an interface
|
||||
(these are called non-recursive routes).
|
||||
|
||||
When BGP receives a recursive route from a peer, it needs to validate the
|
||||
nexthop. The path is marked valid or invalid based on the reachability status
|
||||
of the nexthop. Nexthop validation is also important for BGP decision process
|
||||
as the metric to reach the nexthop is a parameter to best path selection
|
||||
process.
|
||||
|
||||
As it goes with routing, this is a dynamic process. Route to the nexthop can
|
||||
change. The nexthop can become unreachable or reachable. In the current BGP
|
||||
implementation, the nexthop validation is done periodically in the scanner run.
|
||||
The default scanner run interval is one minute. Every minute, the scanner task
|
||||
walks the entire BGP table. It checks the validity of each nexthop with Zebra
|
||||
(the routing table manager) through a request and response message exchange
|
||||
between BGP and Zebra process. BGP process is blocked for that duration. The
|
||||
mechanism has two major drawbacks:
|
||||
|
||||
- The scanner task runs to completion. That can potentially starve the other
|
||||
tasks for long periods of time, based on the BGP table size and number of
|
||||
nexthops.
|
||||
|
||||
- Convergence around routing changes that affect the nexthops can be long
|
||||
(around a minute with the default intervals). The interval can be shortened
|
||||
to achieve faster reaction time, but it makes the first problem worse, with
|
||||
the scanner task consuming most of the CPU resources.
|
||||
|
||||
The next-hop tracking feature makes this process event-driven. It eliminates
|
||||
periodic nexthop validation and introduces an asynchronous communication path
|
||||
between BGP and Zebra for route change notifications that can then be acted
|
||||
upon.
|
||||
|
||||
Goal
|
||||
----
|
||||
|
||||
Stating the obvious, the main goal is to remove the two limitations we
|
||||
discussed in the previous section. The goals, in a constructive tone,
|
||||
are the following:
|
||||
|
||||
- **Fairness**: the scanner run should not consume an unjustly high amount of
|
||||
CPU time. This should give an overall good performance and response time to
|
||||
other events (route changes, session events, IO/user interface).
|
||||
|
||||
- **Convergence**: BGP must react to nexthop changes instantly and provide
|
||||
sub-second convergence. This may involve diverting the routes from one
|
||||
nexthop to another.
|
||||
|
||||
Overview of changes
|
||||
------------------------
|
||||
|
||||
The changes are in both BGP and Zebra modules. The short summary is
|
||||
the following:
|
||||
|
||||
- Zebra implements a registration mechanism by which clients can
|
||||
register for next hop notification. Consequently, it maintains a
|
||||
separate table, per (VRF, AF) pair, of next hops and interested
|
||||
client-list per next hop.
|
||||
|
||||
- When the main routing table changes in Zebra, it evaluates the next
|
||||
hop table: for each next hop, it checks if the route table
|
||||
modifications have changed its state. If so, it notifies the
|
||||
interested clients.
|
||||
|
||||
- BGP is one such client. It registers the next hops corresponding to
|
||||
all of its received routes/paths. It also threads the paths against
|
||||
each nexthop structure.
|
||||
|
||||
- When BGP receives a next hop notification from Zebra, it walks the
|
||||
corresponding path list. It makes them valid or invalid depending
|
||||
on the next hop notification. It then re-computes best path for the
|
||||
corresponding destination. This may result in re-announcing those
|
||||
destinations to peers.
|
||||
|
||||
Design
|
||||
------
|
||||
|
||||
Modules
|
||||
~~~~~~~
|
||||
|
||||
The core design introduces an "nht" (next hop tracking) module in BGP
|
||||
and "rnh" (recursive nexthop) module in Zebra. The "nht" module
|
||||
provides the following APIs:
|
||||
|
||||
+----------------------------+--------------------------------------------------+
|
||||
| Function | Action |
|
||||
+============================+==================================================+
|
||||
| bgp_find_or_add_nexthop() | find or add a nexthop in BGP nexthop table |
|
||||
+----------------------------+--------------------------------------------------+
|
||||
| bgp_find_nexthop() | find a nexthop in BGP nexthop table |
|
||||
+----------------------------+--------------------------------------------------+
|
||||
| bgp_parse_nexthop_update() | parse a nexthop update message coming from zebra |
|
||||
+----------------------------+--------------------------------------------------+
|
||||
|
||||
The "rnh" module provides the following APIs:
|
||||
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| Function | Action |
|
||||
+============================+==========================================================================================================+
|
||||
| zebra_add_rnh() | add a recursive nexthop |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| zebra_delete_rnh() | delete a recursive nexthop |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| zebra_lookup_rnh() | lookup a recursive nexthop |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| zebra_add_rnh_client() | register a client for nexthop notifications against a recursive nexthop |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| zebra_remove_rnh_client() | remove the client registration for a recursive nexthop |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| zebra_evaluate_rnh_table() | (re)evaluate the recursive nexthop table (most probably because the main routing table has changed). |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------------+
|
||||
| zebra_cleanup_rnh_client() | Cleanup a client from the "rnh" module data structures (most probably because the client is going away). |
|
||||
+----------------------------+----------------------------------------------------------------------------------------------------------+
|
||||
|
||||
4.2. Control flow
|
||||
|
||||
The next hop registration control flow is the following:
|
||||
|
||||
::
|
||||
|
||||
<==== BGP Process ====>|<==== Zebra Process ====>
|
||||
|
|
||||
receive module nht module | zserv module rnh module
|
||||
----------------------------------------------------------------------
|
||||
| | |
|
||||
bgp_update_ | | |
|
||||
main() | bgp_find_or_add_ | |
|
||||
| nexthop() | |
|
||||
| | |
|
||||
| | zserv_nexthop_ |
|
||||
| | register() |
|
||||
| | | zebra_add_rnh()
|
||||
| | |
|
||||
|
||||
|
||||
The next hop notification control flow is the following:
|
||||
|
||||
::
|
||||
|
||||
<==== Zebra Process ====>|<==== BGP Process ====>
|
||||
|
|
||||
rib module rnh module | zebra module nht module
|
||||
----------------------------------------------------------------------
|
||||
| | |
|
||||
meta_queue_ | | |
|
||||
process() | zebra_evaluate_ | |
|
||||
| rnh_table() | |
|
||||
| | |
|
||||
| | bgp_read_nexthop_ |
|
||||
| | update() |
|
||||
| | | bgp_parse_
|
||||
| | | nexthop_update()
|
||||
| | |
|
||||
|
||||
|
||||
zclient message format
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
ZEBRA_NEXTHOP_REGISTER and ZEBRA_NEXTHOP_UNREGISTER messages are
|
||||
encoded in the following way:
|
||||
|
||||
::
|
||||
|
||||
. 0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| AF | prefix len |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
. Nexthop prefix .
|
||||
. .
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
. .
|
||||
. .
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| AF | prefix len |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
. Nexthop prefix .
|
||||
. .
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
``ZEBRA_NEXTHOP_UPDATE`` message is encoded as follows:
|
||||
|
||||
::
|
||||
|
||||
. 0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| AF | prefix len |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
. Nexthop prefix getting resolved .
|
||||
. .
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| metric |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| #nexthops |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| nexthop type |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
. resolving Nexthop details .
|
||||
. .
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
. .
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| nexthop type |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
. resolving Nexthop details .
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
BGP data structure
|
||||
~~~~~~~~~~~~~~~~~~
|
||||
Legend:
|
||||
|
||||
::
|
||||
|
||||
/\ struct bgp_node: a BGP destination/route/prefix
|
||||
\/
|
||||
|
||||
[ ] struct bgp_info: a BGP path (e.g. route received from a peer)
|
||||
|
||||
_
|
||||
(_) struct bgp_nexthop_cache: a BGP nexthop
|
||||
|
||||
/\ NULL
|
||||
\/--+ ^
|
||||
| :
|
||||
+--[ ]--[ ]--[ ]--> NULL
|
||||
/\ :
|
||||
\/--+ :
|
||||
| :
|
||||
+--[ ]--[ ]--> NULL
|
||||
:
|
||||
_ :
|
||||
(_)...........
|
||||
|
||||
|
||||
Zebra data structure
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
RNH table::
|
||||
|
||||
O
|
||||
/ \
|
||||
O O
|
||||
/ \
|
||||
O O
|
||||
|
||||
struct rnh
|
||||
{
|
||||
u_char flags;
|
||||
struct route_entry *state;
|
||||
struct list *client_list;
|
||||
struct route_node *node;
|
||||
};
|
||||
|
||||
User interface changes
|
||||
~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
::
|
||||
|
||||
frr# show ip nht
|
||||
3.3.3.3
|
||||
resolved via kernel
|
||||
via 11.0.0.6, swp1
|
||||
Client list: bgp(fd 12)
|
||||
11.0.0.10
|
||||
resolved via connected
|
||||
is directly connected, swp2
|
||||
Client list: bgp(fd 12)
|
||||
11.0.0.18
|
||||
resolved via connected
|
||||
is directly connected, swp4
|
||||
Client list: bgp(fd 12)
|
||||
11.11.11.11
|
||||
resolved via kernel
|
||||
via 10.0.1.2, eth0
|
||||
Client list: bgp(fd 12)
|
||||
|
||||
frr# show ip bgp nexthop
|
||||
Current BGP nexthop cache:
|
||||
3.3.3.3 valid [IGP metric 0], #paths 3
|
||||
Last update: Wed Oct 16 04:43:49 2013
|
||||
|
||||
11.0.0.10 valid [IGP metric 1], #paths 1
|
||||
Last update: Wed Oct 16 04:43:51 2013
|
||||
|
||||
11.0.0.18 valid [IGP metric 1], #paths 2
|
||||
Last update: Wed Oct 16 04:43:47 2013
|
||||
|
||||
11.11.11.11 valid [IGP metric 0], #paths 1
|
||||
Last update: Wed Oct 16 04:43:47 2013
|
||||
|
||||
frr# show ipv6 nht
|
||||
frr# show ip bgp nexthop detail
|
||||
|
||||
frr# debug bgp nht
|
||||
frr# debug zebra nht
|
||||
|
||||
6. Sample test cases
|
||||
|
||||
r2----r3
|
||||
/ \ /
|
||||
r1----r4
|
||||
|
||||
- Verify that a change in IGP cost triggers NHT
|
||||
+ shutdown the r1-r4 and r2-r4 links
|
||||
+ no shut the r1-r4 and r2-r4 links and wait for OSPF to come back
|
||||
up
|
||||
+ We should be back to the original nexthop via r4 now
|
||||
- Verify that a NH becoming unreachable triggers NHT
|
||||
+ Shutdown all links to r4
|
||||
- Verify that a NH becoming reachable triggers NHT
|
||||
+ no shut all links to r4
|
||||
|
||||
Future work
|
||||
~~~~~~~~~~~
|
||||
|
||||
- route-policy for next hop validation (e.g. ignore default route)
|
||||
- damping for rapid next hop changes
|
||||
- prioritized handling of nexthop changes ((un)reachability vs. metric
|
||||
changes)
|
||||
- handling recursion loop, e.g::
|
||||
|
||||
11.11.11.11/32 -> 12.12.12.12
|
||||
12.12.12.12/32 -> 11.11.11.11
|
||||
11.0.0.0/8 -> <interface>
|
||||
- better statistics
|
||||
@ -1,326 +0,0 @@
|
||||
0. Introduction
|
||||
|
||||
This is the design specification for next hop tracking feature in
|
||||
Frr.
|
||||
|
||||
1. Background
|
||||
|
||||
Recursive routes are of the form:
|
||||
|
||||
p/m --> n
|
||||
[Ex: 1.1.0.0/16 --> 2.2.2.2]
|
||||
|
||||
where 'n' itself is resolved through another route as follows:
|
||||
|
||||
p2/m --> h, interface
|
||||
[Ex: 2.2.2.0/24 --> 3.3.3.3, eth0]
|
||||
|
||||
Usually, BGP routes are recursive in nature and BGP nexthops get
|
||||
resolved through an IGP route. IGP usually adds its routes pointing to
|
||||
an interface (these are called non-recursive routes).
|
||||
|
||||
When BGP receives a recursive route from a peer, it needs to validate
|
||||
the nexthop. The path is marked valid or invalid based on the
|
||||
reachability status of the nexthop. Nexthop validation is also
|
||||
important for BGP decision process as the metric to reach the nexthop
|
||||
is a parameter to best path selection process.
|
||||
|
||||
As it goes with routing, this is a dynamic process. Route to the
|
||||
nexthop can change. The nexthop can become unreachable or
|
||||
reachable. In the current BGP implementation, the nexthop validation
|
||||
is done periodically in the scanner run. The default scanner run
|
||||
interval is one minute. Every minute, the scanner task walks the
|
||||
entire BGP table. It checks the validity of each nexthop with Zebra
|
||||
(the routing table manager) through a request and response message
|
||||
exchange between BGP and Zebra process. BGP process is blocked for
|
||||
that duration. The mechanism has two major drawbacks:
|
||||
|
||||
(1) The scanner task runs to completion. That can potentially starve
|
||||
the other tasks for long periods of time, based on the BGP table
|
||||
size and number of nexthops.
|
||||
|
||||
(2) Convergence around routing changes that affect the nexthops can be
|
||||
long (around a minute with the default intervals). The interval
|
||||
can be shortened to achieve faster reaction time, but it makes the
|
||||
first problem worse, with the scanner task consuming most of the
|
||||
CPU resources.
|
||||
|
||||
"Next hop tracking" feature makes this process event-driven. It
|
||||
eliminates periodic nexthop validation and introduces an asynchronous
|
||||
communication path between BGP and Zebra for route change notifications
|
||||
that can then be acted upon.
|
||||
|
||||
2. Goal
|
||||
|
||||
Stating the obvious, the main goal is to remove the two limitations we
|
||||
discussed in the previous section. The goals, in a constructive tone,
|
||||
are the following:
|
||||
|
||||
- fairness: the scanner run should not consume an unjustly high amount
|
||||
of CPU time. This should give an overall good performance and
|
||||
response time to other events (route changes, session events,
|
||||
IO/user interface).
|
||||
|
||||
- convergence: BGP must react to nexthop changes instantly and provide
|
||||
sub-second convergence. This may involve diverting the routes from
|
||||
one nexthop to another.
|
||||
|
||||
3. Overview of the changes
|
||||
|
||||
The changes are in both BGP and Zebra modules. The short summary is
|
||||
the following:
|
||||
|
||||
- Zebra implements a registration mechanism by which clients can
|
||||
register for next hop notification. Consequently, it maintains a
|
||||
separate table, per (VRF, AF) pair, of next hops and interested
|
||||
client-list per next hop.
|
||||
|
||||
- When the main routing table changes in Zebra, it evaluates the next
|
||||
hop table: for each next hop, it checks if the route table
|
||||
modifications have changed its state. If so, it notifies the
|
||||
interested clients.
|
||||
|
||||
- BGP is one such client. It registers the next hops corresponding to
|
||||
all of its received routes/paths. It also threads the paths against
|
||||
each nexthop structure.
|
||||
|
||||
- When BGP receives a next hop notification from Zebra, it walks the
|
||||
corresponding path list. It makes them valid or invalid depending
|
||||
on the next hop notification. It then re-computes best path for the
|
||||
corresponding destination. This may result in re-announcing those
|
||||
destinations to peers.
|
||||
|
||||
4. Design
|
||||
|
||||
4.1. Modules
|
||||
|
||||
The core design introduces an "nht" (next hop tracking) module in BGP
|
||||
and "rnh" (recursive nexthop) module in Zebra. The "nht" module
|
||||
provides the following APIs:
|
||||
|
||||
bgp_find_or_add_nexthop() : find or add a nexthop in BGP nexthop table
|
||||
bgp_find_nexthop() : find a nexthop in BGP nexthop table
|
||||
bgp_parse_nexthop_update() : parse a nexthop update message coming
|
||||
from zebra
|
||||
|
||||
The "rnh" module provides the following APIs:
|
||||
|
||||
zebra_add_rnh() : add a recursive nexthop
|
||||
zebra_delete_rnh() : delete a recursive nexthop
|
||||
zebra_lookup_rnh() : lookup a recursive nexthop
|
||||
|
||||
zebra_add_rnh_client() : register a client for nexthop notifications
|
||||
against a recursive nexthop
|
||||
|
||||
zebra_remove_rnh_client(): remove the client registration for a
|
||||
recursive nexthop
|
||||
|
||||
zebra_evaluate_rnh_table(): (re)evaluate the recursive nexthop table
|
||||
(most probably because the main routing
|
||||
table has changed).
|
||||
|
||||
zebra_cleanup_rnh_client(): Cleanup a client from the "rnh" module
|
||||
data structures (most probably because the
|
||||
client is going away).
|
||||
|
||||
4.2. Control flow
|
||||
|
||||
The next hop registration control flow is the following:
|
||||
|
||||
<==== BGP Process ====>|<==== Zebra Process ====>
|
||||
|
|
||||
receive module nht module | zserv module rnh module
|
||||
----------------------------------------------------------------------
|
||||
| | |
|
||||
bgp_update_ | | |
|
||||
main() | bgp_find_or_add_ | |
|
||||
| nexthop() | |
|
||||
| | |
|
||||
| | zserv_nexthop_ |
|
||||
| | register() |
|
||||
| | | zebra_add_rnh()
|
||||
| | |
|
||||
|
||||
|
||||
The next hop notification control flow is the following:
|
||||
|
||||
<==== Zebra Process ====>|<==== BGP Process ====>
|
||||
|
|
||||
rib module rnh module | zebra module nht module
|
||||
----------------------------------------------------------------------
|
||||
| | |
|
||||
meta_queue_ | | |
|
||||
process() | zebra_evaluate_ | |
|
||||
| rnh_table() | |
|
||||
| | |
|
||||
| | bgp_read_nexthop_ |
|
||||
| | update() |
|
||||
| | | bgp_parse_
|
||||
| | | nexthop_update()
|
||||
| | |
|
||||
|
||||
|
||||
4.3. zclient message format
|
||||
|
||||
ZEBRA_NEXTHOP_REGISTER and ZEBRA_NEXTHOP_UNREGISTER messages are
|
||||
encoded in the following way:
|
||||
|
||||
/*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | AF | prefix len |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* . Nexthop prefix .
|
||||
* . .
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* . .
|
||||
* . .
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | AF | prefix len |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* . Nexthop prefix .
|
||||
* . .
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
ZEBRA_NEXTHOP_UPDATE message is encoded as follows:
|
||||
|
||||
/*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | AF | prefix len |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* . Nexthop prefix getting resolved .
|
||||
* . .
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | metric |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | #nexthops |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | nexthop type |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* . resolving Nexthop details .
|
||||
* . .
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* . .
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* | nexthop type |
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
* . resolving Nexthop details .
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
*/
|
||||
|
||||
4.4. BGP data structure
|
||||
|
||||
Legend:
|
||||
|
||||
/\ struct bgp_node: a BGP destination/route/prefix
|
||||
\/
|
||||
|
||||
[ ] struct bgp_info: a BGP path (e.g. route received from a peer)
|
||||
|
||||
_
|
||||
(_) struct bgp_nexthop_cache: a BGP nexthop
|
||||
|
||||
|
||||
|
||||
/\ NULL
|
||||
\/--+ ^
|
||||
| :
|
||||
+--[ ]--[ ]--[ ]--> NULL
|
||||
/\ :
|
||||
\/--+ :
|
||||
| :
|
||||
+--[ ]--[ ]--> NULL
|
||||
:
|
||||
_ :
|
||||
(_).............
|
||||
|
||||
|
||||
4.5. Zebra data structure
|
||||
|
||||
rnh table:
|
||||
|
||||
O
|
||||
/ \
|
||||
O O
|
||||
/ \
|
||||
O O
|
||||
|
||||
struct rnh
|
||||
{
|
||||
u_char flags;
|
||||
struct route_entry *state;
|
||||
struct list *client_list;
|
||||
struct route_node *node;
|
||||
};
|
||||
|
||||
5. User interface changes
|
||||
|
||||
frr# show ip nht
|
||||
3.3.3.3
|
||||
resolved via kernel
|
||||
via 11.0.0.6, swp1
|
||||
Client list: bgp(fd 12)
|
||||
11.0.0.10
|
||||
resolved via connected
|
||||
is directly connected, swp2
|
||||
Client list: bgp(fd 12)
|
||||
11.0.0.18
|
||||
resolved via connected
|
||||
is directly connected, swp4
|
||||
Client list: bgp(fd 12)
|
||||
11.11.11.11
|
||||
resolved via kernel
|
||||
via 10.0.1.2, eth0
|
||||
Client list: bgp(fd 12)
|
||||
|
||||
frr# show ip bgp nexthop
|
||||
Current BGP nexthop cache:
|
||||
3.3.3.3 valid [IGP metric 0], #paths 3
|
||||
Last update: Wed Oct 16 04:43:49 2013
|
||||
|
||||
11.0.0.10 valid [IGP metric 1], #paths 1
|
||||
Last update: Wed Oct 16 04:43:51 2013
|
||||
|
||||
11.0.0.18 valid [IGP metric 1], #paths 2
|
||||
Last update: Wed Oct 16 04:43:47 2013
|
||||
|
||||
11.11.11.11 valid [IGP metric 0], #paths 1
|
||||
Last update: Wed Oct 16 04:43:47 2013
|
||||
|
||||
frr# show ipv6 nht
|
||||
frr# show ip bgp nexthop detail
|
||||
|
||||
frr# debug bgp nht
|
||||
frr# debug zebra nht
|
||||
|
||||
6. Sample test cases
|
||||
|
||||
r2----r3
|
||||
/ \ /
|
||||
r1----r4
|
||||
|
||||
- Verify that a change in IGP cost triggers NHT
|
||||
+ shutdown the r1-r4 and r2-r4 links
|
||||
+ no shut the r1-r4 and r2-r4 links and wait for OSPF to come back
|
||||
up
|
||||
+ We should be back to the original nexthop via r4 now
|
||||
- Verify that a NH becoming unreachable triggers NHT
|
||||
+ Shutdown all links to r4
|
||||
- Verify that a NH becoming reachable triggers NHT
|
||||
+ no shut all links to r4
|
||||
|
||||
7. Future work
|
||||
|
||||
- route-policy for next hop validation (e.g. ignore default route)
|
||||
- damping for rapid next hop changes
|
||||
- prioritized handling of nexthop changes ((un)reachability vs. metric
|
||||
changes)
|
||||
- handling recursion loop, e.g.
|
||||
11.11.11.11/32 -> 12.12.12.12
|
||||
12.12.12.12/32 -> 11.11.11.11
|
||||
11.0.0.0/8 -> <interface>
|
||||
- better statistics
|
||||
@ -1,67 +1,52 @@
|
||||
Developing for FRRouting
|
||||
Process & Workflow
|
||||
========================
|
||||
|
||||
General note on this document
|
||||
-----------------------------
|
||||
FRR is a large project developed by many different groups. This section
|
||||
documents standards for code style & quality, commit messages, pull requests
|
||||
and best practices that all contributors are asked to follow.
|
||||
|
||||
This document is "descriptive/post-factual" in that it documents
|
||||
pratices that are in use; it is not "definitive/pre-factual" in
|
||||
prescribing practices.
|
||||
|
||||
This means that when a procedure changes, it is agreed upon, then put
|
||||
into practice, and then documented here. If this document doesn't match
|
||||
reality, it's the document that needs to be updated, not reality.
|
||||
This section is "descriptive/post-factual" in that it documents pratices that
|
||||
are in use; it is not "definitive/pre-factual" in prescribing practices. This
|
||||
means that when a procedure changes, it is agreed upon, then put into practice,
|
||||
and then documented here. If this document doesn't match reality, it's the
|
||||
document that needs to be updated, not reality.
|
||||
|
||||
Git Structure
|
||||
-------------
|
||||
|
||||
The master Git for FRRouting resides on Github at
|
||||
`https://github.com/frrouting/frr <https://github.com/FRRouting/frr>`__
|
||||
The master Git for FRR resides on `Github
|
||||
<https://github.com/frrouting/frr>`__.
|
||||
|
||||
.. figure:: git_branches.svg
|
||||
:alt: git branches continually merging to the left from 3 lanes;
|
||||
float-right
|
||||
.. figure:: git_branches.png
|
||||
|
||||
git branches continually merging to the left from 3 lanes;
|
||||
float-right
|
||||
|
||||
There is one main branch for development and a release branch for each
|
||||
major release.
|
||||
|
||||
New contributions are done against the head of the master branch. The CI
|
||||
systems will pick up the Github Pull Requests or the new patch from
|
||||
Patchwork, run some basic build and functional tests.
|
||||
|
||||
For each major release (1.0, 1.1 etc) a new release branch is created
|
||||
based on the master.
|
||||
|
||||
There was an attempt to use a "develop" branch automatically maintained
|
||||
by the CI system. This is not currently in active use, though the system
|
||||
is operational. If the "develop" branch is in active use and this
|
||||
paragraph is still here, this document obviously wasn't updated.
|
||||
There is one main branch for development, ``master``. For each major release
|
||||
(2.0, 3.0 etc) a new release branch is created based on the master. Subsequent
|
||||
point releases based on a major branch are marked by tagging.
|
||||
|
||||
Programming language, Tools and Libraries
|
||||
-----------------------------------------
|
||||
|
||||
The core of FRRouting is written in C (gcc or clang supported) and makes
|
||||
The core of FRR is written in C (gcc or clang supported) and makes
|
||||
use of GNU compiler extensions. A few non-essential scripts are
|
||||
implemented in Perl and Python. FRRouting requires the following tools
|
||||
implemented in Perl and Python. FRR requires the following tools
|
||||
to build distribution packages: automake, autoconf, texinfo, libtool and
|
||||
gawk and various libraries (i.e. libpam and libjson-c).
|
||||
|
||||
If your contribution requires a new library or other tool, then please
|
||||
highlight this in your description of the change. Also make sure it’s
|
||||
supported by all FRRouting platform OSes or provide a way to build
|
||||
supported by all FRR platform OSes or provide a way to build
|
||||
without the library (potentially without the new feature) on the other
|
||||
platforms.
|
||||
|
||||
Documentation should be written in Tex (.texi) or Markdown (.md) format
|
||||
with a preference for Markdown.
|
||||
Documentation should be written in reStructuredText. Sphinx extensions may be
|
||||
utilized but pure ReST is preferred where possible. See `Documentation
|
||||
<#documentation>`__.
|
||||
|
||||
Mailing lists
|
||||
-------------
|
||||
|
||||
Italicized lists are private.
|
||||
The FRR development group maintains multiple mailing lists for use by the
|
||||
community. Italicized lists are private.
|
||||
|
||||
+----------------------------------+--------------------------------+
|
||||
| Topic | List |
|
||||
@ -80,19 +65,31 @@ Italicized lists are private.
|
||||
Changelog
|
||||
~~~~~~~~~
|
||||
|
||||
The changelog will be the base for the release notes. A changelog entry
|
||||
for your changes is usually not required and will be added based on your
|
||||
commit messages by the maintainers. However, you are free to include an
|
||||
update to the changelog with some better description. The changelog will
|
||||
be the base for the release notes.
|
||||
The changelog will be the base for the release notes. A changelog entry for
|
||||
your changes is usually not required and will be added based on your commit
|
||||
messages by the maintainers. However, you are free to include an update to the
|
||||
changelog with some better description.
|
||||
|
||||
Submitting Patches and Enhancements
|
||||
-----------------------------------
|
||||
|
||||
FRR accepts patches from two sources:
|
||||
|
||||
- Email (git format-patch)
|
||||
- Github pull request
|
||||
|
||||
Contributors are highly encouraged to use Github's fork-and-pr workflow. It is
|
||||
easier for us to review it, test it, try it and discuss it on Github than it is
|
||||
via email, thus your patch will get more attention more quickly on Github.
|
||||
|
||||
The base branch for new contributions and non-critical bug fixes should be
|
||||
``master``. Please ensure your pull request is based on this branch when you
|
||||
submit it.
|
||||
|
||||
Pre-submission Checklist
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- Format code (see `Developer's Guidelines <#developers-guidelines>`__)
|
||||
- Format code (see `Code Formatting <#developers-guidelines>`__)
|
||||
- Verify and acknowledge license (see `License for
|
||||
contributions <#license-for-contributions>`__)
|
||||
- Ensure you have properly signed off (see `Signing
|
||||
@ -115,14 +112,14 @@ Pre-submission Checklist
|
||||
License for contributions
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
FRRouting is under a “GPLv2 or later” license. Any code submitted must
|
||||
FRR is under a “GPLv2 or later” license. Any code submitted must
|
||||
be released under the same license (preferred) or any license which
|
||||
allows redistribution under this GPLv2 license (eg MIT License).
|
||||
|
||||
Signing Off
|
||||
~~~~~~~~~~~
|
||||
|
||||
Code submitted to FRRouting must be signed off. We have the same
|
||||
Code submitted to FRR must be signed off. We have the same
|
||||
requirements for using the signed-off-by process as the Linux kernel. In
|
||||
short, you must include a signed-off-by tag in every patch.
|
||||
|
||||
@ -142,6 +139,8 @@ to be a helpful resource.
|
||||
In short, when you sign off on a commit, you assert your agreement to
|
||||
all of the following:
|
||||
|
||||
::
|
||||
|
||||
Developer's Certificate of Origin 1.1
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
@ -171,7 +170,7 @@ What do I submit my changes against?
|
||||
|
||||
We've documented where we would like to have the different fixes applied
|
||||
at
|
||||
https://github.com/FRRouting/frr/wiki/Where-Do-I-create-a-Pull-Request-against%3F
|
||||
https://github.com/FRR/frr/wiki/Where-Do-I-create-a-Pull-Request-against%3F
|
||||
If you are unsure where your submission goes, look at that document or
|
||||
ask a project maintainer.
|
||||
|
||||
@ -219,12 +218,9 @@ After submitting your changes
|
||||
|
||||
- You should automatically receive an email with the test results
|
||||
within less than 2 hrs of the submission. If you don’t get the
|
||||
email, then check status on the github pull request (if submitted
|
||||
by pull request) or on Patchwork at
|
||||
https://patchwork.frrouting.org (if submitted as patch to mailing
|
||||
list).
|
||||
email, then check status on the Github pull request.
|
||||
- Please notify the development mailing list if you think something
|
||||
doesn’t work.
|
||||
doesn't work.
|
||||
|
||||
- If the tests failed:
|
||||
|
||||
@ -253,8 +249,8 @@ After submitting your changes
|
||||
community members.
|
||||
- Your submission is done once it is merged to the master branch.
|
||||
|
||||
Developer's Guidelines
|
||||
----------------------
|
||||
Coding Practices & Style
|
||||
------------------------
|
||||
|
||||
Commit messages
|
||||
~~~~~~~~~~~~~~~
|
||||
@ -392,13 +388,12 @@ BSD coding style applies to:
|
||||
Documentation
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
FRRouting is a large and complex software project developed by many
|
||||
different people over a long period of time. Without adequate
|
||||
documentation, it can be exceedingly difficult to understand code
|
||||
segments, APIs and other interfaces. In the interest of keeping the
|
||||
project healthy and maintainable, you should make every effort to
|
||||
document your code so that other people can understand what it does
|
||||
without needing to closely read the code itself.
|
||||
FRR is a large and complex software project developed by many different people
|
||||
over a long period of time. Without adequate documentation, it can be
|
||||
exceedingly difficult to understand code segments, APIs and other interfaces.
|
||||
In the interest of keeping the project healthy and maintainable, you should
|
||||
make every effort to document your code so that other people can understand
|
||||
what it does without needing to closely read the code itself.
|
||||
|
||||
Some specific guidelines that contributors should follow are:
|
||||
|
||||
@ -440,10 +435,13 @@ used for.
|
||||
- **For new code in ``lib/``, these guidelines are hard requirements.**
|
||||
|
||||
If you are contributing code that adds significant user-visible
|
||||
functionality or introduces a new API, please document it in ``doc/``.
|
||||
Markdown and LaTeX are acceptable formats, although Markdown is
|
||||
currently preferred for new documentation. This may change in the near
|
||||
future.
|
||||
functionality please document it in ``doc/``. If you make significant changes
|
||||
to portions of the codebase covered in the Developer's Manual, please
|
||||
update the relevant sections. If you add a major feature or introduce a new
|
||||
API, please document the architecture and API to the best of your abilities in
|
||||
the Developer's Manual.
|
||||
|
||||
Documentation should be in reStructuredText.
|
||||
|
||||
Finally, if you come across some code that is undocumented and feel like
|
||||
going above and beyond, document it! We absolutely appreciate and accept
|
||||
|
||||
Loading…
Reference in New Issue
Block a user