]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Resolve default values for SRv6 flavor attr
authorCarmine Scarpitta <carmine.scarpitta@uniroma2.it>
Mon, 20 Mar 2023 20:49:07 +0000 (21:49 +0100)
committerCarmine Scarpitta <carmine.scarpitta@uniroma2.it>
Mon, 11 Sep 2023 15:35:03 +0000 (17:35 +0200)
When zebra receives a Netlink message containing a seg6local nexthop,
let's use the default values for optional attributes `lcblock_len` and
`lcnode_fn_len`, if they are not specified.

Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
zebra/rt_netlink.c

index 3ea7252ca12f501d736651b1b01f6e5b5d5c8a87..00f809b80d18de040625f45b49a3dd6d3ba964bd 100644 (file)
@@ -567,6 +567,16 @@ parse_nexthop_unicast(ns_id_t ns_id, struct rtmsg *rtm, struct rtattr **tb,
        if (num_labels)
                nexthop_add_labels(&nh, ZEBRA_LSP_STATIC, num_labels, labels);
 
+       /* Resolve default values for SRv6 flavors */
+       if (seg6l_ctx.flv.flv_ops != ZEBRA_SEG6_LOCAL_FLV_OP_UNSPEC) {
+               if (seg6l_ctx.flv.lcblock_len == 0)
+                       seg6l_ctx.flv.lcblock_len =
+                               ZEBRA_DEFAULT_SEG6_LOCAL_FLV_LCBLOCK_LEN;
+               if (seg6l_ctx.flv.lcnode_func_len == 0)
+                       seg6l_ctx.flv.lcnode_func_len =
+                               ZEBRA_DEFAULT_SEG6_LOCAL_FLV_LCNODE_FN_LEN;
+       }
+
        if (seg6l_act != ZEBRA_SEG6_LOCAL_ACTION_UNSPEC)
                nexthop_add_srv6_seg6local(&nh, seg6l_act, &seg6l_ctx);