summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-01-31 21:19:12 +0100
committerGitHub <noreply@github.com>2023-01-31 21:19:12 +0100
commitff075708b1c527710804bbf096fa81e52aad9363 (patch)
treec0161725eb3e227571911ba26cc6b113994f5a6e
parentf92d9f1ce94d96916d8adfbc38ec4798f0ca4bf9 (diff)
parent468e235ef4440c54a0ebb791d04273134f19bce3 (diff)
downloadvyos-build-ff075708b1c527710804bbf096fa81e52aad9363.tar.gz
vyos-build-ff075708b1c527710804bbf096fa81e52aad9363.zip
Merge pull request #300 from zdc/T4737-equuleus
frr: T4737: Fixed connected to BGP routes redistribution
-rw-r--r--packages/frr/patches/0002-zebra-Allow-one-connected-route-per-network-mask-on-.patch94
1 files changed, 94 insertions, 0 deletions
diff --git a/packages/frr/patches/0002-zebra-Allow-one-connected-route-per-network-mask-on-.patch b/packages/frr/patches/0002-zebra-Allow-one-connected-route-per-network-mask-on-.patch
new file mode 100644
index 00000000..7c826c7b
--- /dev/null
+++ b/packages/frr/patches/0002-zebra-Allow-one-connected-route-per-network-mask-on-.patch
@@ -0,0 +1,94 @@
+From 30eee3c450937a9bc2fd02527cff266f85a818ed Mon Sep 17 00:00:00 2001
+From: Taras Pudiak <taras@vyos.io>
+Date: Tue, 31 Jan 2023 18:18:44 +0200
+Subject: [PATCH] zebra: Allow one connected route per network mask on a
+ interface
+
+Backport of 92980561382fc04380414a6e2f6ca6746c2fe5e9 from FRR repository
+---
+ zebra/connected.c | 48 +++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 48 insertions(+)
+
+diff --git a/zebra/connected.c b/zebra/connected.c
+index 8c4ba163b..bc5941657 100644
+--- a/zebra/connected.c
++++ b/zebra/connected.c
+@@ -207,6 +207,9 @@ void connected_up(struct interface *ifp, struct connected *ifc)
+ };
+ struct zebra_vrf *zvrf;
+ uint32_t metric;
++ uint32_t count = 0;
++ struct listnode *cnode;
++ struct connected *c;
+
+ zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
+ if (!zvrf) {
+@@ -251,6 +254,28 @@ void connected_up(struct interface *ifp, struct connected *ifc)
+
+ metric = (ifc->metric < (uint32_t)METRIC_MAX) ?
+ ifc->metric : ifp->metric;
++
++ /*
++ * It's possible to add the same network and mask
++ * to an interface over and over. This would
++ * result in an equivalent number of connected
++ * routes. Just add one connected route in
++ * for all the addresses on an interface that
++ * resolve to the same network and mask
++ */
++ for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, c)) {
++ struct prefix cp;
++
++ PREFIX_COPY(&cp, CONNECTED_PREFIX(c));
++ apply_mask(&cp);
++
++ if (prefix_same(&cp, &p))
++ count++;
++
++ if (count >= 2)
++ return;
++ }
++
+ rib_add(afi, SAFI_UNICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_CONNECT,
+ 0, 0, &p, NULL, &nh, 0, zvrf->table_id, metric, 0, 0, 0);
+
+@@ -350,6 +375,9 @@ void connected_down(struct interface *ifp, struct connected *ifc)
+ .vrf_id = ifp->vrf_id,
+ };
+ struct zebra_vrf *zvrf;
++ uint32_t count = 0;
++ struct listnode *cnode;
++ struct connected *c;
+
+ zvrf = zebra_vrf_lookup_by_id(ifp->vrf_id);
+ if (!zvrf) {
+@@ -388,6 +416,26 @@ void connected_down(struct interface *ifp, struct connected *ifc)
+ break;
+ }
+
++ /*
++ * It's possible to have X number of addresses
++ * on a interface that all resolve to the same
++ * network and mask. Find them and just
++ * allow the deletion when are removing the last
++ * one.
++ */
++ for (ALL_LIST_ELEMENTS_RO(ifp->connected, cnode, c)) {
++ struct prefix cp;
++
++ PREFIX_COPY(&cp, CONNECTED_PREFIX(c));
++ apply_mask(&cp);
++
++ if (prefix_same(&p, &cp))
++ count++;
++
++ if (count >= 2)
++ return;
++ }
++
+ /*
+ * Same logic as for connected_up(): push the changes into the
+ * head.
+--
+2.37.2
+