Louis Scalbert [Tue, 17 Jan 2023 16:02:07 +0000 (17:02 +0100)]
bgpd: add show bgp link-state link-state commands
Add the "show bgp link-state link-state" following commands:
> r3# show bgp link-state link-state ?
> <cr>
> all Display the entries for all address families
> detail-routes Display detailed version of all routes
> json JavaScript Object Notation
> neighbors Detailed information on TCP and BGP neighbor connections
> regexp Display routes matching the AS path regular expression
> summary Summary of BGP neighbor status
> version Display prefixes with matching version numbers
> wide Increase table width for longer prefixes
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Louis Scalbert [Tue, 17 Jan 2023 15:34:04 +0000 (16:34 +0100)]
bgpd: add bgp default link-state command
Add the "bgp default link-state" command to the "router bgp" context.
> router bgp 65000
> bgp default link-state
When this command is set, the "link-state/link-state" AFI/SAFI is
activated on all neighbors that are directly specified within the
"router bgp" unless explicitly deactivated:
Louis Scalbert [Tue, 17 Jan 2023 13:33:18 +0000 (14:33 +0100)]
bgpd: do not announce link-state routes to zebra
Link-state prefixes are only intended to be read for a link-state
consumer (i.e. a controler). They cannot be installed in Forwarding
Information Base (FIB).
Do not announce them to zebra.
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Louis Scalbert [Fri, 21 Apr 2023 10:04:08 +0000 (12:04 +0200)]
bgpd: display link-state prefixes detail
BGP link-state prefixes are displayed in the form of NLRI-TYPE /
Prefix-Length.
> r2# show bgp all
>
> For address family: Link State
> BGP table version is 8, local router ID is 192.0.2.2, vrf id 0
> Default local pref 100, local AS 65002
> Network Next Hop Metric LocPrf Weight Path
> *> Link/153 0 65001 i
> *> IPv6-Prefix/77 0 65001 i
> *> IPv4-Prefix/57 0 65001 i
> *> Node/49 0 65001 i
> *> Node/45 0 65001 i
Add a lib prefix display hook in bgpd to display properly all the details.
> r2# show bgp all
>
> For address family: Link State
> BGP table version is 8, local router ID is 192.0.2.2, vrf id 0
> Default local pref 100, local AS 65002
> Network Next Hop Metric LocPrf Weight Path
> *> Link OSPFv3 ID:0xffffffffffffffff {Local {AS:4294967295 ID:4294967295 Area:4294967295 Rtr:10.10.10.11:2.2.2.2} Remote {AS:4294967295 ID:4294967295 Area:4294967295 Rtr:10.10.10.10:1.1.1.1} IPv4:10.1.0.1 Neigh-IPv4:10.1.0.2 IPv6:2001::1 Neigh-IPv6:2001::2 MT:0,2}/153
> 0 65001 i
> *> IPv6-Prefix OSPFv3 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10} MT:2 OSPF-Route-Type:1 IPv6:12:12::12:12/128}/77
> 0 65001 i
> *> IPv4-Prefix OSPFv2 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10:1.1.1.1} IPv4:89.10.11.0/24}/57
> 0 65001 i
> *> Node OSPFv2 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10:1.1.1.1}}/49
> 0 65001 i
> *> Node OSPFv2 ID:0x20 {Local {AS:65001 ID:0 Area:0 Rtr:10.10.10.10}}/45
> 0 65001 i
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Louis Scalbert [Fri, 21 Apr 2023 09:59:33 +0000 (11:59 +0200)]
bgpd: do not display vty output headers for link-state prefixes
When displaying the link-state prefixes with "show bgp link-state
link-state" command, the following output headers are not needed:
> Status codes: s suppressed, d damped, h history, * valid, > best, = multipath,
> i internal, r RIB-failure, S Stale, R Removed
> Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
> Origin codes: i - IGP, e - EGP, ? - incomplete
> RPKI validation codes: V valid, I invalid, N Not found
Do not display these headers for link-state SAFI.
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Louis Scalbert [Wed, 19 Apr 2023 11:40:13 +0000 (13:40 +0200)]
bgpd: store bgp link-state prefixes
Add the ability to store link-state prefixes in the BGP table.
Store a raw copy of the BGP link state NLRI TLVs as received in the
packet in 'p.u.prefix_linkstate.ptr'.
Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com> Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Louis Scalbert [Fri, 6 Jan 2023 17:31:15 +0000 (18:31 +0100)]
lib: add link-state prefixes
Add to the library the link-state type of prefixes.
Link-state prefixes contain much more data than the current prefixes and
they only make sense for BGP Link-State. Storing all the data in "struct
prefix" is not relevant because it would increase the memory usage of
all daemons. Instead a pointer to a structure that contains all the
information is used. Printing link-state prefixes can be delegated to a
hook function.
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Jonas Gorski [Thu, 14 Sep 2023 15:04:16 +0000 (17:04 +0200)]
tools: make --quiet actually suppress output
When calling daemon_stop() with --quiet and e.g. the pidfile is empty,
it won't return early since while "$fail" is set, "$2" is "--quiet", so
the if condition isn't met and it will continue executing, resulting
in error messages in the log:
> Sep 14 14:48:33 localhost watchfrr[2085]: [YFT0P-5Q5YX] Forked background command [pid 2086]: /usr/lib/frr/watchfrr.sh restart all
> Sep 14 14:48:33 localhost frrinit.sh[2075]: /usr/lib/frr/frrcommon.sh: line 216: kill: `': not a pid or valid job spec
> Sep 14 14:48:33 localhost frrinit.sh[2075]: /usr/lib/frr/frrcommon.sh: line 216: kill: `': not a pid or valid job spec
> Sep 14 14:48:33 localhost frrinit.sh[2075]: /usr/lib/frr/frrcommon.sh: line 216: kill: `': not a pid or valid job spec
Fix this by moving the --quiet check into the block to log_failure_msg(),
and also add the check to all other invocations of log_*_msg() to make
--quiet properly suppress output.
Fixes: 19a99d89f088 ("tools: suppress unuseful warnings during restarting frr") Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
Philippe Guibert [Wed, 13 Sep 2023 09:36:23 +0000 (11:36 +0200)]
bgpd: fix forbiding 'redistribute table' usage on non default instances
The 'redistribute table' command can be used by configuration on a
non default BGP instance, but this command does not work for multiple
reasons:
- The route entries configured on a given table are always configured
from the default vrf. This constraint prevents from redistributing a
prefix from the default vrf to an other non default bgp instance.
- The importation of route entries requires 'ip import-table' on vrfs
and this command is not available
Fix this by preventing from configuring this kind of redistribution
on non default bgp instances.
Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Donald Sharp [Tue, 12 Sep 2023 17:05:05 +0000 (13:05 -0400)]
tests: snmp tests sometimes fail with `Unable to bind`
the snmp tests are using zebra.conf to setup the
address that they are binding to and immediately
after that they are starting snmpd. If snmpd
starts up *before* zebra has installed the address
the bind on the address will fail. Causing the entire
test to fail. Modify the snmpd.conf for all our
snmp tests to bind to all addresses. Things still
work and we no longer have an issue.
Louis Scalbert [Mon, 11 Sep 2023 16:33:23 +0000 (18:33 +0200)]
bgpd: fix vpn import from local vrf with no retain
The BGP "no retain" VPN option avoids storing VPN prefixes that are not
imported in the incoming BGP table (aka. Adj RIB in). When a VPN import
policy is changed, BGP does a soft clear so that a prefix refresh is
requested from the peers. However, the import from local VPN prefixes
is never requested.
Fix this issue by requesting a local import refresh.
Fixes: a486300b26 ("bgpd: implement retain route-target all behaviour") Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Add a new topotest `isis_srv6_topo1` for verifying SRv6 functionalities
in IS-IS (RFC 9352).
This topotest consists of nine tests:
* Network convergence after applying SRv6 configuration
* Disable SRv6 Locator on zebra on r1
* Enable SRv6 Locator on zebra on r1
* Disable SRv6 Locator on ISIS on r1
* Enable SRv6 Locator on ISIS on r1
* Disable SRv6 on ISIS on r1
* Enable SRv6 on ISIS on r1
* Disable SRv6 on zebra on r1
* Enable SRv6 on zebra on r1
The function `sid_exist` verifies if a given SRv6 SID has already been
allocated for a given IS-IS area. This commit extends `sid_exist` to
also consider adjacency SIDs when checking for the existence of the SID.
An SRv6 adjacency SID is a SID that is associated with a particular
adjacency. Adjacency SIDs are advertised using the SRv6 End.X SID
Sub-TLV (RFC 9352 section #8.1) or SRv6 LAN End.X SID Sub-TLV (RFC 9352
section #8.2).
This commit defines the following Adj SIDs management functions:
* srv6_endx_sid_add_single: add a new SRv6 Adjacency SID
* srv6_endx_sid_del: delete an SRv6 Adjacency SID
* isis_srv6_endx_sid_find: lookup SRv6 End.X SID by type
It also attaches some callbacks to the hooks isis_adj_state_change_hook,
isis_adj_ip_enabled_hook, isis_adj_ip_disabled_hook, which are
responsible for installing/removing an SRv6 Adjacency SID automatically
when the state of an IS-IS adjacency changes.
An SRv6 adjacency SID is a SID that is associated with a particular
adjacency. Adjacency SIDs are advertised using the SRv6 End.X SID
Sub-TLV (RFC 9352 section #8.1) or SRv6 LAN End.X SID Sub-TLV (RFC 9352
section #8.2).
This commit defines a data structure `srv6_adjacency` for storing
information about an SRv6 Adjacency SID. This data structure will be
used to support SRv6 Adjacency SIDs functionalities in future commits.
We need to allocate memory SRv6 SID Structure Sub-Sub-TLV in
isis_srv6.c. MTYPE_ISIS_SUBSUBTLV is statically defined in isis_tlvs.c
and therefore is not visible in isis_srv6.c. Let's make
MTYPE_ISIS_SUBSUBTLV non-static to provide visibility to the external
world..
Add SRv6 End.X SID Sub-TLV and SRv6 LAN End.X SID Sub-TLV codepoints
(defined in "IS-IS Sub-TLVs for TLVs Advertising Neighbor Information"
IANA registry). These codepoints will be used in future commits to
pack/unpack corresponding Sub-TLVs.
SRv6 End.X SID Sub-TLV (RFC 9352 section #8.1) and SRv6 LAN End.X SID
Sub-TLV (RFC 9352 section #8.2) contain a `flag` field. Currently, three
flags are defined:
* B-Flag: Backup flag
* S-Flag: Set flag
* P-Flag: Persistent flag
This commit defines three constants representing these flags.
isisd: Add SRv6 End.X SID to IS ext reach Sub-TLVs
Add SRv6 End.X SID Sub-TLV and SRv6 LAN End.X SID Sub-TLV to the
Extended IS Reachability Sub-TLVs data structure and perform proper
initialization/free when the Sub-TLVs data structure is
allocated/destroyed.
According to RFC 9352 section #5, the SRv6 Locators associated with
algorithms 0 and 1 should be also advertised in a Prefix Reachability
TLV (236 or 237) to allow legacy routers (i.e., routers that do not
support SRv6) installing a forwarding entry for algorithms 0 and 1 SRv6
traffic.
This commits extend IS-IS to advertise SRv6 Locators in IPv6
Reachability TLV.
Add a function to build an SRv6 SID Structure Sub-Sub-TLV (RFC 9352
section #9) to advertise the structure of a specific SRv6 End SID passed
as an argument.
General Sub-Sub-TLV processing functions (i.e., copy, format, free,
pack, and unpack) perform a lookup of the handler specific for a
Sub-Sub-TLV in the `tlv_table`, and then call the specific handler to
process the Sub-Sub-TLV.
This commit adds the handlers for the SRv6 Structure Sub-Sub-TLV (stored
in `subsubtlv_srv6_sid_structure_ops`) to the `tlv_table`.