diff options
author | vdhingra <vdhingra@vmware.com> | 2020-07-02 08:54:50 +0200 |
---|---|---|
committer | vdhingra <vdhingra@vmware.com> | 2020-07-16 17:40:45 +0200 |
commit | 314825ff9101ab1f02e99a1f1258346c9f99d171 (patch) | |
tree | 3956cefa625a14bdc22274c9fcef5a1f321edd7b /staticd/static_nb_config.c | |
parent | zebra: Moving afi-safi identity to lib (diff) | |
download | frr-314825ff9101ab1f02e99a1f1258346c9f99d171.tar.xz frr-314825ff9101ab1f02e99a1f1258346c9f99d171.zip |
staticd: Added afi-safi as a key in route-list
To address the ip mroute command there is a need to add
safi as a key. So adding the afi-safi-type identityref
as a key.
Signed-off-by: VishalDhingra <vdhingra@vmware.com>
Diffstat (limited to 'staticd/static_nb_config.c')
-rw-r--r-- | staticd/static_nb_config.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/staticd/static_nb_config.c b/staticd/static_nb_config.c index 282299eef..40c4d85fb 100644 --- a/staticd/static_nb_config.c +++ b/staticd/static_nb_config.c @@ -421,11 +421,25 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr struct route_node *rn; const struct lyd_node *vrf_dnode; struct prefix prefix; + const char *afi_safi; + afi_t prefix_afi; afi_t afi; - safi_t safi = SAFI_UNICAST; + safi_t safi; switch (args->event) { case NB_EV_VALIDATE: + yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); + afi_safi = yang_dnode_get_string(args->dnode, "./afi-safi"); + yang_afi_safi_identity2value(afi_safi, &afi, &safi); + prefix_afi = family2afi(prefix.family); + if (afi != prefix_afi) { + flog_warn( + EC_LIB_NB_CB_CONFIG_VALIDATE, + "route node %s creation failed", + yang_dnode_get_string(args->dnode, "./prefix")); + return NB_ERR_VALIDATION; + } + break; case NB_EV_PREPARE: case NB_EV_ABORT: break; @@ -436,15 +450,8 @@ int routing_control_plane_protocols_control_plane_protocol_staticd_route_list_cr s_vrf = vrf->info; yang_dnode_get_prefix(&prefix, args->dnode, "./prefix"); - afi = family2afi(prefix.family); - - if (afi == AFI_IP) { - if (IN_MULTICAST(ntohl(prefix.u.prefix4.s_addr))) - safi = SAFI_MULTICAST; - } else { - if (IN6_IS_ADDR_MULTICAST(&prefix.u.prefix6)) - safi = SAFI_MULTICAST; - } + afi_safi = yang_dnode_get_string(args->dnode, "./afi-safi"); + yang_afi_safi_identity2value(afi_safi, &afi, &safi); rn = static_add_route(afi, safi, &prefix, NULL, s_vrf); if (!rn) { |