]> git.proxmox.com Git - mirror_frr.git/commitdiff
OSPFD: Update Segment Routing following reviews
authorOlivier Dugeon <olivier.dugeon@orange.com>
Mon, 22 Jan 2018 18:18:10 +0000 (19:18 +0100)
committerOlivier Dugeon <olivier.dugeon@orange.com>
Mon, 22 Jan 2018 18:18:10 +0000 (19:18 +0100)
 - 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>
doc/OSPF-SR.rst
lib/mpls.h
lib/route_types.txt
ospfd/ospf_sr.c
zebra/kernel_netlink.c
zebra/rt_netlink.c
zebra/rt_netlink.h
zebra/zebra_mpls.h

index f7ab742342ba397af3aa8e88bb9611e1c58d4b0d..4aa9f4f5e5ae0002bbc8ec7fd8691e6e9d6bab37 100644 (file)
@@ -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
 -------
index 9e7eeed34eb18551f96a94fb39654afdd7b637a6..9d103e669c726fd3fad2d320c7caf9a5bc127f6d 100644 (file)
 #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
index a72ee507b17f081dfa52d8613926a4ff1fa1187d..4e764a14c139ab898bbd9717542c99545662b30a 100644 (file)
@@ -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)"
index 8ac15154632321505f633887cbc68032943afb95..3c30a337d56f5ce9ee097cc492f2bc5a1d91352d 100644 (file)
@@ -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",
index d794c4c64d199faf8f8a72f8946bf4f852c420e9..1be2cbcaf54ea27b974cacfee3a58f9cb9a2bd5b 100644 (file)
@@ -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"},
index bb034b89395580b26f794c9aa9ffa98f106eb228..a77814668d4518d179abf30db4d5ea2b3081678d 100644 (file)
@@ -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;
index 79d5e14a625d6a66ae2399a2740c9aebedcdc9f1..51350fd6fb114d135a31d5f43f50e53d64df44b9 100644 (file)
@@ -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);
 
index 93e1162b6f166ce2f2dc31afcc47008d99f079bb..9d8ca34f82cbaa4e54d3b9a198994a14eef71bc8 100644 (file)
@@ -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;