summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-09-10 05:30:33 +0200
committerRenato Westphal <renato@opensourcerouting.org>2019-09-10 05:37:00 +0200
commitbf54ca8213ce444dd5a6f18a8027efdd6a69be11 (patch)
tree78cd03c689a1d661cfdf414864e4cb7e9d2c31de
parentlib, zebra: add new MPLS zapi message with route replace semantics (diff)
downloadfrr-bf54ca8213ce444dd5a6f18a8027efdd6a69be11.tar.xz
frr-bf54ca8213ce444dd5a6f18a8027efdd6a69be11.zip
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>
Diffstat (limited to '')
-rw-r--r--ospfd/ospf_sr.c53
1 files changed, 2 insertions, 51 deletions
diff --git a/ospfd/ospf_sr.c b/ospfd/ospf_sr.c
index 91737085b..ff2039bec 100644
--- a/ospfd/ospf_sr.c
+++ b/ospfd/ospf_sr.c
@@ -639,67 +639,18 @@ static int ospf_zebra_send_mpls_labels(int cmd, struct sr_nhlfe nhlfe)
return zebra_send_mpls_labels(zclient, cmd, &zl);
}
-/* Request zebra to install/remove FEC in FIB */
-static int ospf_zebra_send_mpls_ftn(int cmd, struct sr_nhlfe nhlfe)
-{
- struct zapi_route api;
- struct zapi_nexthop *api_nh;
-
- /* Support only IPv4 */
- if (nhlfe.prefv4.family != AF_INET)
- return -1;
-
- memset(&api, 0, sizeof(api));
- api.vrf_id = VRF_DEFAULT;
- api.type = ZEBRA_ROUTE_OSPF;
- api.safi = SAFI_UNICAST;
- memcpy(&api.prefix, &nhlfe.prefv4, sizeof(struct prefix_ipv4));
-
- if (cmd == ZEBRA_ROUTE_ADD) {
- /* Metric value. */
- SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
- api.metric = OSPF_SR_DEFAULT_METRIC;
- /* Nexthop */
- SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
- api_nh = &api.nexthops[0];
- IPV4_ADDR_COPY(&api_nh->gate.ipv4, &nhlfe.nexthop);
- api_nh->type = NEXTHOP_TYPE_IPV4_IFINDEX;
- api_nh->ifindex = nhlfe.ifindex;
- /* MPLS labels */
- SET_FLAG(api.message, ZAPI_MESSAGE_LABEL);
- api_nh->labels[0] = nhlfe.label_out;
- api_nh->label_num = 1;
- api_nh->vrf_id = VRF_DEFAULT;
- api.nexthop_num = 1;
- }
-
- if (IS_DEBUG_OSPF_SR)
- zlog_debug(" |- %s FEC %u for %s/%u via %u",
- cmd == ZEBRA_ROUTE_ADD ? "Add" : "Delete",
- nhlfe.label_out, inet_ntoa(nhlfe.prefv4.prefix),
- nhlfe.prefv4.prefixlen, nhlfe.ifindex);
-
- return zclient_route_send(cmd, zclient, &api);
-}
-
/* Add new NHLFE entry for SID */
static inline void add_sid_nhlfe(struct sr_nhlfe nhlfe)
{
- if ((nhlfe.label_in != 0) && (nhlfe.label_out != 0)) {
+ if ((nhlfe.label_in != 0) && (nhlfe.label_out != 0))
ospf_zebra_send_mpls_labels(ZEBRA_MPLS_LABELS_ADD, nhlfe);
- if (nhlfe.label_out != MPLS_LABEL_IMPLICIT_NULL)
- ospf_zebra_send_mpls_ftn(ZEBRA_ROUTE_ADD, nhlfe);
- }
}
/* Remove NHLFE entry for SID */
static inline void del_sid_nhlfe(struct sr_nhlfe nhlfe)
{
- if ((nhlfe.label_in != 0) && (nhlfe.label_out != 0)) {
+ if ((nhlfe.label_in != 0) && (nhlfe.label_out != 0))
ospf_zebra_send_mpls_labels(ZEBRA_MPLS_LABELS_DELETE, nhlfe);
- if (nhlfe.label_out != MPLS_LABEL_IMPLICIT_NULL)
- ospf_zebra_send_mpls_ftn(ZEBRA_ROUTE_DELETE, nhlfe);
- }
}
/* Update NHLFE entry for SID */