Commit Graph

101 Commits

Author SHA1 Message Date
Olivier Dugeon
b61264a8a3 ospfd: OSPF Segment Routing improvement
- Improve parsing of Router Information, especially when a router
   stops advertising Segment Routing capabilities
 - Finish conversion to '%pFX' and '%pI4'

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-06-03 19:35:44 +02:00
Olivier Dugeon
b37eb79c01 ospfd: Add ECMP support to OSPF Segment Routing
* Change sr_prefix structure in ospf_sr.h to add support to ECMP
 * Add new Segment Routing information to ospf_paths in ospf_route.h
 * Backport MPLS label configuration from IS-IS Segment Routing implementation
 * Re-write log message in ospf_sr.c and ospf_ext.c

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2020-06-03 19:31:50 +02:00
Quentin Young
772270f3b6 *: sprintf -> snprintf
Replace sprintf with snprintf where straightforward to do so.

- sprintf's into local scope buffers of known size are replaced with the
  equivalent snprintf call
- snprintf's into local scope buffers of known size that use the buffer
  size expression now use sizeof(buffer)
- sprintf(buf + strlen(buf), ...) replaced with snprintf() into temp
  buffer followed by strlcat

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2020-04-20 19:14:33 -04:00
Donatas Abraitis
c4efd0f423 *: Do not cast to the same type
Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-04-08 17:15:06 +03:00
Mark Stapp
4945002d71 *: encode zapi labels message using nexthops
Use the zapi_nexthop struct with the mpls_labels
zapi messages instead of the special-purpose (and
more limited) nexthop struct that was being used.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2020-02-14 16:16:21 -05:00
Renato Westphal
bf54ca8213 ospfd: avoid installing SR FTNs twice
There's no need to install MPLS FTNs using the ZEBRA_ROUTE_ADD
message since the ZEBRA_MPLS_LABELS_ADD message already does that
(in addition to installing an MPLS LSP).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-10 00:37:00 -03:00
Renato Westphal
ea6b290bf6 lib, zebra: add new MPLS zapi message with route replace semantics
This new message makes it possible to install/reinstall LSPs with
multiple nexthops using a single ZAPI message.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-10 00:01:10 -03:00
Renato Westphal
b3c49d0e77 lib, zebra: enhance the MPLS zapi messages
* Add ability to specify the nexthop type;
* Add ability to install or not a FTN (in addition to an LSP).

These two additions will be useful to install local SR Prefix-SIDs
configured with the no-PHP option.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-06 21:06:11 -03:00
Renato Westphal
635a039eef lib, zebra: rename LSP type used for OSPF SR
SR support for IS-IS is coming so we need to be able to distinguish
OSPF and IS-IS LSPs.

While here, add missing case statement for LDP on
lsp_type_from_re_type().

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-06 21:06:11 -03:00
Renato Westphal
e132dea064 zebra: identify MPLS FTNs by route type and instance
Use the route type and instance instead of the route distance
to identify MPLS FTNs. This is a more robust approach since the
routing daemons can modify the distance of their announced routes
via configuration, which can cause inconsistencies.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-06 21:06:11 -03:00
Renato Westphal
bad6b0e72e lib: introduce encode/decode functions for the MPLS zapi messages
Do this for the following reasons:
* Improve modularity of the code by separating the decoding of the
  ZAPI messages from their processing;
* Create an API that is easier to use by the client daemons.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2019-09-06 21:06:11 -03:00
Quentin Young
d8b87afe7c lib: hashing functions should take const arguments
It doesn't make much sense for a hash function to modify its argument,
so const the hash input.

BGP does it in a couple places, those cast away the const. Not great but
not any worse than it was.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-14 21:23:08 +00:00
Quentin Young
9165c5f5ff *: remove trailing newlines from zlog messages
Zlog puts its own newlines on, and doing this makes logs look nasty.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-03-14 18:41:15 +00:00
Tim Bray
e3b78da875 *: Rename backet to bucket
Presume typo from original author

Signed-off-by: Tim Bray <tim@kooky.org>
2019-02-25 16:22:36 +00:00
David Lamparter
064518517c Merge branch 'pull/3197'
...with a nit fix

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-23 12:31:25 +02:00
Renato Westphal
98c06e8618 ospfd: fix issue with the "no segment-routing prefix A.B.C.D/M" command
Add a missing check to bail out earlier when SR is not configured. The
same command without the "no" prefix has the same check as it prevents
unexpected things (i.e. crashes) from happening.

Fixes the following segfaults:
ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "no segment-routing prefix 1.1.1.1/32"
ospfd aborted: vtysh -c "configure terminal" -c "router ospf" -c "no segment-routing prefix 1.1.1.1/32 index 65535 no-php-flag"

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
2018-10-20 12:39:05 -03:00
Donald Sharp
74df8d6d9d *: Replace hash_cmp function return value to a bool
The ->hash_cmp and linked list ->cmp functions were sometimes
being used interchangeably and this really is not a good
thing.  So let's modify the hash_cmp function pointer to return
a boolean and convert everything to use the new syntax.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-10-19 13:14:45 -04:00
David Lamparter
6a154c8812 *: list_delete_and_null() -> list_delete()
Signed-off-by: David Lamparter <equinox@diac24.net>
2018-10-02 11:40:52 +02:00
Quentin Young
1c50c1c0d6 *: style for EC replacements
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 19:38:57 +00:00
Quentin Young
cf444bcf40 ospfd: OSPF_[ERR|WARN] -> EC_OSPF
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-13 18:56:04 +00:00
David Lamparter
e991eff5b5 Merge remote-tracking branch 'frr/master' into warnings
Conflicts:
	zebra/if_ioctl_solaris.c
	zebra/rtread_getmsg.c

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-12 21:58:39 +02:00
David Lamparter
b45ac5f5c6 *: fix config.h/zebra.h include order
config.h (or, transitively, zebra.h) must be the first include file
listed for autoconf things like _GNU_SOURCE and _POSIX_C_SOURCE to work
correctly.

Signed-off-by: David Lamparter <equinox@diac24.net>
2018-09-08 21:30:42 +02:00
Quentin Young
ade6974def *: style for flog_warn conversions
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-09-06 20:56:41 +00:00
Donald Sharp
dbb93f1b90 ospfd: Convert ospf_sr.c to use error-card subsystem.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-06 20:50:58 +00:00
Donald Sharp
89f60109a7 ospfd: Convert ospf_ext.c to use new error-code subsystem
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-06 20:50:58 +00:00
Donald Sharp
266469ebab ospfd: Cleanup some warnings that were not warnings
1) stream allocation cannot fail
2) some warnings were removed when functions safely ignored
the calling parameters being wrong.
3) some warnings were removed when functions did not consider
the state as an error since we did not return an error code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-09-06 20:50:58 +00:00
Don Slice
088f109866 bgpd, ospfd, pimd, zebra: Convert more use_json locations to bool
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
2018-09-04 17:39:04 +00:00
Russ White
4b0d7894cb
Merge pull request #2846 from donaldsharp/backet_data
Backet data
2018-08-16 11:32:41 -04:00
Donald Sharp
c4dddf32d3 ospfd: trust backet->data
The backet->data cannot be NULL, no need to check for it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-15 17:53:09 -04:00
Quentin Young
af4c27286d *: rename zlog_fer -> flog_err
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Chirag Shah
313d7993a3 ospfd: zlog_ferr facility
Ticket:CM-21333

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-14 20:02:05 +00:00
Donald Sharp
0ce1ca805d *: ALLOC calls cannot fail
There is no need to check for failure of a ALLOC call
as that any failure to do so will result in a assert
happening.  So we can safely remove all of this code.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-08-11 17:14:58 +02:00
Quentin Young
d7c0a89a3a
*: use C99 standard fixed-width integer types
The following types are nonstandard:
- u_char
- u_short
- u_int
- u_long
- u_int8_t
- u_int16_t
- u_int32_t

Replace them with the C99 standard types:
- uint8_t
- unsigned short
- unsigned int
- unsigned long
- uint8_t
- uint16_t
- uint32_t

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-03-27 15:13:34 -04:00
Lou Berger
996c93142d *: conform with COMMUNITY.md formatting rules, via 'make indent'
Signed-off-by: Lou Berger <lberger@labn.net>
2018-03-06 14:04:32 -05:00
Rafael Zalamena
cc7d9cab99
Merge pull request #1789 from Orange-OpenSource/master
ospfd: Add json output for Segment Routing
2018-03-05 21:55:59 -03:00
Renato Westphal
41d19ab553
Merge pull request #1809 from donaldsharp/intf_json
vrf nexthop cleanups
2018-03-05 19:33:05 -03:00
Donald Sharp
df25d29213 ospfd: Cleanup ospf SR log messages
When OSPF SR is not configured one would expect
to not see any output from it at all in the debug
log with no debugs turned on.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-03-02 05:15:33 -05:00
Donald Sharp
f56ee10fc7 ospfd: Add vrf to nhlfe route add
So when a ospf SR is sending down routes to the kernel
ensure that the nexthop vrf_id is set appropriately.
Yes SR is in the default VRF.  But for people who
run across this code in the future, they will know
to do the right thing from it.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-28 19:16:51 -05:00
Olivier Dugeon
7666589034 ospfd: Add json output for Segment Routing
- To ease checking the Segment Routing conformity in topotest,
add json output to 'show ip ospf database segment-routing' CLI.
 - Update ospfd user guide accordingly
 - Update OSPF-SR documentation with supported features and interoperability

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-02-27 18:00:02 +01:00
Olivier Dugeon
d922605d28 OSPFD: Fix Segment Routing Lan Adjacency TLVs
- Lan Adjacency TLVs was incorrectly formatted due to an error in
TLV size computation. Add new macro to fix this issue
 - Update SR link nexthop when it corresponds to an LAN Adj SID. The nexthop
is set to the router id in the TLVi (as per draft), but we need the neighbor
IP address to set the corresponding MPLS LFIB entry

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-02-19 10:17:41 +01:00
Donald Sharp
9b50aa1fd3 ospfd: Fix some new SA issues found by coverity
Fix a || && mixup.
Add an assert for area to show we expect it to be non-null
going forward.
When memory is allocated if it fails we abort then
no need to check for null.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-13 23:40:54 -05:00
Donald Sharp
70e98a7fe7 *: Make code use a consisten definition of labels
Turns out we had 3 different ways to define labels
all of them overlapping with the same meanings.
Consolidate to 1.  This one choosen is consistent
naming wise with what the *bsd and linux kernels
use.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2018-02-08 20:31:37 -05:00
Olivier Dugeon
6aaf0fdd01 OSPFd: Fix Opaque LSA filtering in Segment Routing
Opaque LSA were incorrectly filtered. LSA Type 1 with a
router id set to 4.x.x.x or 7.x.x.x. or 8.x.x.x are not correctly
filtered and pass to Segment Routing as wrong Opaque LSA of type
Router Information, Extended Prefix respectively Extended Link.
 - Add Opaque LSA check to the filter

The CLI command 'segment-routing prefix' didn't check if a same prefix
already exist in SRDB resulting to multiple entries in the SRDB for the
same prefix.
 - Update prefix intead of adding a new one if already present in the SRDB

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-02-05 20:24:17 +01:00
Olivier Dugeon
bcf4475ec3 OSPFd: Fix ospfd crash during CI
When preforming CI test, CLI command 'no router ospf' followed by a
'router ospf' is performed to clean up the previous configuration.
Ospfd crash when configuring 'netwoark area'.

This is due to opsf_opaque_term() introduce in previous commit that cause this
crash. It remove not only Opaque LSA but also the list through the call to
'list_delete_and_null()' function. Same take place in 'ospf_mpls_te_term()',
'ospf_router_info_term()' and 'ospf_ext_term()' function.

New set of 'ospf_XXX_finish()' has been introduced to solve this issue while
keeping the possiblity to terminate properly the Opaque LSA and remove MPLS
LFIB entries set by Segment Routing.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-02-03 19:30:33 +01:00
Olivier Dugeon
db28a51f7e OSPFd: Correct Extended Prefix LSA refresh
- When Extended Prefix LSA need to be refresh, paramaters may be
taken from the wrong interface i.e. Extended Link instead of Prefix
resulting in producing an empty LSA body. Then, ospfd crash due to the
assert on LSA length in ospf_lsa_different() function: code check that
the LSA size is larger than LSA header i.e. LSA is not empty.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-02-01 14:30:34 +01:00
Olivier Dugeon
62c9979094 OSPFd: Clean up Segment Routing patch
- ospfd/ospf_te.c: Remove unregister function and call to
ospf_delete_opaque_functab() following the introduction of
ospf_opaque_term() function in ospfd.c for ospfd termination.
 - ospfd/ospf_sr.c: Set initial index value for node-msd CLI to
avaoid crash when using this command
 - ospfd/ospf_ext.c: Disable call to ospf_sr_update_prefix() if
Segment Routing, thus Extended Link/Prefix, is not enable
 - ospfd/ospf_opaque.c: Correct scheduling of Opaque LSA flooding

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-01-30 16:17:54 +01:00
Olivier Dugeon
7743f2f8c0 OSPFd: Update Segment Routing PR following review
Following various review, following files have been modfied:

 - All: Change u_intXX_t typedef to standard uintXX_t types
 - doc/OSPF-SR.rst: Update doc in particular the Linux Kernel configuration
section
 - doc/ospfd.texi: Update CLI
 - ospfd/ospf_dump.[c,h]: Add new 'debug ospf sr' when performing 'sh run'
 - ospfd/ospf_ext.[c, h]: Various bug corrections notably to handle flooding of
Extended Prefix at startup. iFix TLVs size for LAN Adjacency.
Update Licence as per Community.md
 - ospfd/ospf_opaque.c: Add proper termination function call to remove MPLS entries
 - ospfd/ospf_ri.[c,h]: Bug corrections
 - ospfd/ospf_sr.[c,h]: Various bug corrections, notably to determine the nexthop
SR Node. Add support to 'no-php-flag'.
Update Licence as per Community.md
 - ospfd/ospfd.c: Add call to 'ospf_opaque_term()'

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-01-29 17:58:53 +01:00
Olivier Dugeon
93f0a26e19 OSPFD: Set Segment Routing patch conform to C99
- Change all u_intXX_t typedef to standard type uintXX_t
 - Correct removal of ZEBRA_OSPF_SR route in ospf_sr.c line 670

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-01-23 12:19:50 +01:00
Olivier Dugeon
7726c47964 OSPFD: Update Segment Routing following reviews
- Remove OSPD_SR route type
 - Check that Segment Routing is enable only in default VRF
 - Add comment for SRGB in lib/mpls.h
 - Update documentation

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-01-22 19:18:10 +01:00
Olivier Dugeon
fd3b19f252 OSPFD: Update Segment Routing implementation
- ospf_ext.c: Correct deferred pointer raised by valgrind
 - ospf_sr.c: Correct deffered pointer raised by valgrind. Modify
Segment Routing shutdown. This is due to the fact that RI LSA
4.0.0.0 is flush prior to 7.0.0.X & 8.0.0.X LSA. This trigger
SR-Node deletion which also remove all Extended Link / Prefix
leaving them unavailable when there are referenced by 7.0.0.X
& 8.0.0.X LSA flushing.
 - doc/OSPF-SR.rst: Correct Restructured Text syntax and add
Configuration example as well as Credit section

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-01-19 15:04:41 +01:00
Olivier Dugeon
cf9b9f77f6 OSPFD: Add Experimental Segment Routing support
This is an implementation of draft-ietf-ospf-segment-routing-extensions-24
and RFC7684 for Extended Link & Prefix Opaque LSA.
Look to doc/OSPF_SR.rst for implementation details & known limitations.

New files:

 - ospfd/ospf_sr.h: Segment Routing structure definition (SubTLVs + SRDB)
 - ospfd/ospf_sr.c: Main functions for Segment Routing support
 - ospfd/ospf_ext.h: TLVs and SubTLVs definition for RFC7684
 - ospfd/ospf_ext.c: RFC7684 Extended Link / Prefix implementation
 - doc/OSPF-SRr.rst: Documentation

Modified Files:

 - doc/ospfd.texi: Add new Segment Routing CLI command definition
 - lib/command.h: Add new string command for Segment Routing CLI
 - lib/mpls.h: Add default value for SRGB
 - lib/route_types.txt: Add new OSPF Segment Routing route type
 - ospfd/ospf_dump.[c,h]: Add OSPF SR debug
 - ospfd/ospf_memory.[c,h]: Add new Segment Routing memory type
 - ospfd/ospf_opaque.[c,h]: Add ospf_sr_init() starting function
 - ospfd/ospf_ri.c: Add new functions to Set/Get Segment Routing TLVs
Add new ospf_router_info_lsa_upadte() to send Opaque LSA to ospf_sr.c()
 - ospfd/ospf_ri.h: Add new Router Information SR SubTLVs
 - ospfd/ospf_spf.c: Add new scheduler when running SPF to trigger
update of NHLFE
 - ospfd/ospfd.h: Add new thread for Segment Routing scheduler
 - ospfd/subdir.am: Add new files
 - vtysh/Makefile.am: Add new ospf_sr.c file for vtysh
 - zebra/kernel_netlink.c: Add new OSPF_SR route type
 - zebra/rt_netlink.[c,h]: Add new OSPF_SR route type
 - zebra/zebra_mpls.h: Add new OSPF_SR route type

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2018-01-18 19:11:11 +01:00