From: Olivier Dugeon Date: Mon, 22 Jan 2018 18:18:10 +0000 (+0100) Subject: OSPFD: Update Segment Routing following reviews X-Git-Tag: frr-4.0-dev~2^2~9 X-Git-Url: https://git.proxmox.com/?p=mirror_frr.git;a=commitdiff_plain;h=7726c479644269fc573dd6aad72ea9c163599fd6 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 --- diff --git a/doc/OSPF-SR.rst b/doc/OSPF-SR.rst index f7ab74234..4aa9f4f5e 100644 --- a/doc/OSPF-SR.rst +++ b/doc/OSPF-SR.rst @@ -6,6 +6,7 @@ DON'T use it for production network. Implementation details ---------------------- +### Concepts Segment Routing used 3 differents OPAQUE LSA in OSPF to carry the various information: @@ -22,6 +23,8 @@ latter is mandatory for the implementation as it provides the Callback to Segment Routing functions (see below) when an Extended Link / Prefix or Router Information is received. +### Overview + Following files where modified or added: - ospd_ri.[c,h] have been modified to add the new TLVs for Segment Routing. - ospf_ext.[c,h] implement RFC7684 as base support of Extended Link and Prefix @@ -45,7 +48,7 @@ The figure below shows the relation between the various files: - ospf_ri.c send back to ospf_sr.c received Router Information LSA and update Self Router Information LSA with paramters provided by ospf_sr.c i.e. SRGB and MSD. It use ospf_opaque.c functions to send/received these Opaque LSAs. - - ospf_ext.c send bacl to ospf_sr.c received Extended Prefix and Link Opaque + - ospf_ext.c send back to ospf_sr.c received Extended Prefix and Link Opaque LSA and send self Extended Prefix and Link Opaque LSA through ospf_opaque.c functions. @@ -84,6 +87,27 @@ The figure below shows the relation between the various files: Figure1: Overview of Segment Routing interaction +### Module interactions + +To process incoming LSA, the code is based on the capability to call `hook()` functions when LSA are inserted or delete to / from the LSDB and the possibility to register particular treatment for Opaque LSA. The first point is provided by the OSPF API feature and the second by the Opaque implementation itself. Indeed, it is possible to register callback function for a given Opaque LSA ID (see `ospf_register_opaque_functab()` function defined in `ospf_opaque.c`). Each time a new LSA is added to the LSDB, the `new_lsa_hook()` function previously register for this LSA type is called. For Opaque LSA it is the `ospf_opaque_lsa_install_hook()`. For deletion, it is `ospf_opaque_lsa_delete_hook()`. + +Note that incoming LSA which is already present in the LSDB will be inserted after the old instance of this LSA remove from the LSDB. Thus, after the first time, each incoming LSA will trigger a `delete` following by an `install`. This is not very helpfull to handle real LSA deletion. In fact, LSA deletion is done by Flushing LSA i.e. flood LSA after seting its age to MAX_AGE. Then, a garbage function has the role to remove all LSA with `age == MAX_AGE` in the LSDB. So, to handle LSA Flush, the best is to look to the LSA age to determine if it is an installation or a future deletion i.e. the flushed LSA is first store in the LSDB with MAX_AGE waiting for the garbage collector function. + +#### Router Information LSAs + +To activate Segment Routing, new CLI command `segment-routing on` has been introduced. When this command is activated, function `ospf_router_info_update_sr()` is called to indicate to Router Information process that Segment Routing TLVs must be flood. Same function is called to modify the Segment Routing Global Block (SRGB) and Maximum Stack Depth (MSD) TLV. Only Shortest Path First (SPF) Algorithm is supported, so no possiblity to modify this TLV is offer by the code. + +When Opaque LSA Tyep 4 i.e. Router Information are stored in LSDB, function `ospf_opaque_lsa_install_hook()` will call the previously registered function `ospf_router_info_lsa_update()`. In turn, the function will simply trigger `ospf_sr_ri_lsa_update()` or `ospf_sr_ri_lsa_delete` in function of the LSA age. Before, it verifies that the LSA Opaque Type is 4 (Router Information). Self Opaque LSA are not send back to the Segment Routing functions as information are already stored. + +#### Extended Link Prefix LSAs + +Like for Router Information, Segment Routing is activate at the Extended Link/Prefix level with new `segment-routing on` command. This trigger automtically the flooding of Extended Link LSA for all ospf interface where adjacency is full. For Extended Prefix LSA, the new CLI command `segment-routing prefix ...` will trigger the flooding of Prefix SID TLV/SubTLVs. + +When Opaque LSA Type 7 i.e. Extended Prefix and Type 8 i.e. Extended Link are store in the LSDB, `ospf_ext_pref_update_lsa()` respectively `ospf_ext_link_update_lsa()` are called like for Router Information LSA. In turn, they respectively trigger `ospf_sr_ext_prefix_lsa_update()` / `ospf_sr_ext_link_lsa_update()` or `ospf_sr_ext_prefix_lsa_delete()` / `ospf_sr_ext_link_lsa_delete()` if the LSA age is equel to MAX_AGE. + +#### Zebra + +When a new MPLS entry of new Forwarding Equivalent Class (FEC) must be add or delete in the data plane, `add_sid_nhlfe()` respectively `del_sid_nhlfe()` are called. Once check the validity of labels, they send to ZEBRA layer a new labels through `ZEBRA_MPLS_LABELS_ADD` command, respectively `ZEBRA_MPLS_LABELS_DELETE` command for deletion. This is completed by a new labelled route through `ZEBRA_ROUTE_ADD` command, respectively `ZEBRA_ROUTE_DELETE` command. Configuration ------------- @@ -113,9 +137,11 @@ SID. Known limitations ----------------- + - Runs only within default VRF - Only single Area is supported. ABR is not yet supported - Only SPF algorithm is supported - Extended Prefix Range is not supported + - MPLS table are not flush at startup. Thus, restarting zebra process is mandatory to remove old MPLS entries in the data plane after a crash of ospfd daemon. Credits ------- diff --git a/lib/mpls.h b/lib/mpls.h index 9e7eeed34..9d103e669 100644 --- a/lib/mpls.h +++ b/lib/mpls.h @@ -41,7 +41,13 @@ #define MPLS_MAX_UNRESERVED_LABEL 1048575 /* Default min and max SRGB label range */ -#define MPLS_DEFAULT_MIN_SRGB_LABEL 10000 +/* Even if the SRGB allows to manage different Label space between routers, + * if an operator want to use the same SRGB for all its router, we must fix + * a common range. However, Cisco start its SRGB at 16000 and Juniper ends + * its SRGB at 16384 for OSPF. Thus, by fixing the minimum SRGB label to + * 8000 we could deal with both Cisco and Juniper. + */ +#define MPLS_DEFAULT_MIN_SRGB_LABEL 8000 #define MPLS_DEFAULT_MAX_SRGB_LABEL 50000 #define MPLS_DEFAULT_MIN_SRGB_SIZE 5000 #define MPLS_DEFAULT_MAX_SRGB_SIZE 20000 diff --git a/lib/route_types.txt b/lib/route_types.txt index a72ee507b..4e764a14c 100644 --- a/lib/route_types.txt +++ b/lib/route_types.txt @@ -78,7 +78,6 @@ ZEBRA_ROUTE_BGP_DIRECT, bgp-direct, NULL, 'b', 0, 0, "BGP-Direct" ZEBRA_ROUTE_BGP_DIRECT_EXT, bgp-direct-to-nve-groups, NULL, 'e', 0, 0, "BGP2VNC" ZEBRA_ROUTE_BABEL, babel, babeld, 'A', 1, 1, "Babel" ZEBRA_ROUTE_SHARP, sharp, sharpd, 'D', 1, 1, "SHARP" -ZEBRA_ROUTE_OSPF_SR, ospf-sr, ospfd, 's', 1, 0, "OSPF-SR" ZEBRA_ROUTE_ALL, wildcard, none, '-', 0, 0, "-" @@ -104,4 +103,3 @@ ZEBRA_ROUTE_LDP, "Label Distribution Protocol (LDP)" ZEBRA_ROUTE_VNC_DIRECT, "VNC direct (not via zebra) routes" ZEBRA_ROUTE_BABEL, "Babel routing protocol (Babel)" ZEBRA_ROUTE_SHARP, "Super Happy Advanced Routing Protocol (sharpd)" -ZEBRA_ROUTE_OSPF_SR, "OSPF Segment Routing (OSPF-SR)" diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c index 8ac151546..3c30a337d 100644 --- a/ospfd/ospf_sr.c +++ b/ospfd/ospf_sr.c @@ -1702,6 +1702,12 @@ DEFUN(ospf_sr_enable, if (OspfSR.enabled) return CMD_SUCCESS; + if (ospf->vrf_id != VRF_DEFAULT) { + vty_out(vty, "Segment Routing is only supported in default " + "VRF\n"); + return CMD_WARNING_CONFIG_FAILED; + } + if (IS_DEBUG_OSPF_EVENT) zlog_debug("SR: Segment Routing: OFF -> ON"); @@ -2135,7 +2141,7 @@ DEFUN (show_ip_opsf_srdb, if (!OspfSR.enabled) { vty_out(vty, "Segment Routing is disabled on this router\n"); - return CMD_WARNING_CONFIG_FAILED; + return CMD_WARNING; } vty_out(vty, "\n OSPF Segment Routing database for ID %s\n\n", diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c index d794c4c64..1be2cbcaf 100644 --- a/zebra/kernel_netlink.c +++ b/zebra/kernel_netlink.c @@ -102,7 +102,6 @@ static const struct message rtproto_str[] = { {RTPROT_MROUTED, "mroute"}, {RTPROT_BGP, "BGP"}, {RTPROT_OSPF, "OSPF"}, - {RTPROT_OSPF_SR, "OSPF-SR"}, {RTPROT_ISIS, "IS-IS"}, {RTPROT_RIP, "RIP"}, {RTPROT_RIPNG, "RIPNG"}, diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c index bb034b893..a77814668 100644 --- a/zebra/rt_netlink.c +++ b/zebra/rt_netlink.c @@ -98,8 +98,7 @@ static inline int is_selfroute(int proto) || (proto == RTPROT_ISIS) || (proto == RTPROT_RIPNG) || (proto == RTPROT_NHRP) || (proto == RTPROT_EIGRP) || (proto == RTPROT_LDP) || (proto == RTPROT_BABEL) - || (proto == RTPROT_RIP) || (proto == RTPROT_SHARP) - || (proto == RTPROT_OSPF_SR)) { + || (proto == RTPROT_RIP) || (proto == RTPROT_SHARP)) { return 1; } @@ -119,9 +118,6 @@ static inline int zebra2proto(int proto) case ZEBRA_ROUTE_OSPF6: proto = RTPROT_OSPF; break; - case ZEBRA_ROUTE_OSPF_SR: - proto = RTPROT_OSPF_SR; - break; case ZEBRA_ROUTE_STATIC: proto = RTPROT_STATIC; break; diff --git a/zebra/rt_netlink.h b/zebra/rt_netlink.h index 79d5e14a6..51350fd6f 100644 --- a/zebra/rt_netlink.h +++ b/zebra/rt_netlink.h @@ -52,7 +52,6 @@ #define RTPROT_EIGRP 192 #define RTPROT_LDP 193 #define RTPROT_SHARP 194 -#define RTPROT_OSPF_SR 195 void rt_netlink_init(void); diff --git a/zebra/zebra_mpls.h b/zebra/zebra_mpls.h index 93e1162b6..9d8ca34f8 100644 --- a/zebra/zebra_mpls.h +++ b/zebra/zebra_mpls.h @@ -455,7 +455,7 @@ static inline int re_type_from_lsp_type(enum lsp_types_t lsp_type) case ZEBRA_LSP_BGP: return ZEBRA_ROUTE_BGP; case ZEBRA_LSP_SR: - return ZEBRA_ROUTE_OSPF_SR; + return ZEBRA_ROUTE_OSPF; case ZEBRA_LSP_NONE: default: return ZEBRA_ROUTE_KERNEL;