This commit is contained in:
enkechen-panw 2025-04-29 16:20:41 +00:00 committed by GitHub
commit 25a0caf04c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 8 additions and 79 deletions

View file

@ -14,21 +14,6 @@
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1
},
{
"prefix": "10.0.10.1\/32",
"prefixLen": 32,
"protocol": "local",
"vrfId": 0,
"vrfName": "default",
"distance": 0,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 0,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1
},
{
"prefix": "10.0.10.1\/32",
"prefixLen": 32,
@ -86,21 +71,6 @@
}
],
"10.1.1.2\/32": [
{
"prefix": "10.1.1.2\/32",
"prefixLen": 32,
"protocol": "local",
"vrfId": 0,
"vrfName": "default",
"distance": 0,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 0,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1
},
{
"prefix": "10.1.1.2\/32",
"prefixLen": 32,

View file

@ -33,21 +33,6 @@
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1
},
{
"prefix": "10.0.20.1\/32",
"prefixLen": 32,
"protocol": "local",
"vrfId": 0,
"vrfName": "default",
"distance": 0,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 0,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1
},
{
"prefix": "10.0.20.1\/32",
"prefixLen": 32,
@ -86,21 +71,6 @@
}
],
"10.1.2.2\/32": [
{
"prefix": "10.1.2.2\/32",
"prefixLen": 32,
"protocol": "local",
"vrfId": 0,
"vrfName": "default",
"distance": 0,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 0,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1
},
{
"prefix": "10.1.2.2\/32",
"prefixLen": 32,

View file

@ -90,21 +90,6 @@
}
],
"10.1.3.2\/32": [
{
"prefix": "10.1.3.2\/32",
"prefixLen": 32,
"protocol": "local",
"vrfId": 0,
"vrfName": "default",
"distance": 0,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 0,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1
},
{
"prefix": "10.1.3.2\/32",
"prefixLen": 32,

View file

@ -230,6 +230,7 @@ void connected_up(struct interface *ifp, struct connected *ifc)
uint32_t count = 0;
struct connected *c;
bool install_local = true;
bool p_same;
zvrf = ifp->vrf->info;
if (!zvrf) {
@ -320,7 +321,8 @@ void connected_up(struct interface *ifp, struct connected *ifc)
return;
}
if (!CHECK_FLAG(ifc->flags, ZEBRA_IFA_NOPREFIXROUTE)) {
p_same = prefix_same(&p, &plocal);
if (!CHECK_FLAG(ifc->flags, ZEBRA_IFA_NOPREFIXROUTE) || p_same) {
connected_remove_kernel_for_connected(afi, SAFI_UNICAST, zvrf, &p, &nh);
rib_add(afi, SAFI_UNICAST, zvrf->vrf->vrf_id,
@ -333,7 +335,7 @@ void connected_up(struct interface *ifp, struct connected *ifc)
zvrf->table_id, metric, 0, 0, 0, false);
}
if (install_local) {
if (install_local && !p_same) {
rib_add(afi, SAFI_UNICAST, zvrf->vrf->vrf_id, ZEBRA_ROUTE_LOCAL,
0, flags, &plocal, NULL, &nh, 0, zvrf->table_id, 0, 0,
0, 0, false);
@ -436,6 +438,7 @@ void connected_down(struct interface *ifp, struct connected *ifc)
uint32_t count = 0;
struct connected *c;
bool remove_local = true;
bool p_same;
zvrf = ifp->vrf->info;
if (!zvrf) {
@ -524,7 +527,8 @@ void connected_down(struct interface *ifp, struct connected *ifc)
* Same logic as for connected_up(): push the changes into the
* head.
*/
if (!CHECK_FLAG(ifc->flags, ZEBRA_IFA_NOPREFIXROUTE)) {
p_same = prefix_same(&p, &plocal);
if (!CHECK_FLAG(ifc->flags, ZEBRA_IFA_NOPREFIXROUTE) || p_same) {
rib_delete(afi, SAFI_UNICAST, zvrf->vrf->vrf_id,
ZEBRA_ROUTE_CONNECT, 0, 0, &p, NULL, &nh, 0,
zvrf->table_id, 0, 0, false);
@ -534,7 +538,7 @@ void connected_down(struct interface *ifp, struct connected *ifc)
zvrf->table_id, 0, 0, false);
}
if (remove_local) {
if (remove_local && !p_same) {
rib_delete(afi, SAFI_UNICAST, zvrf->vrf->vrf_id,
ZEBRA_ROUTE_LOCAL, 0, 0, &plocal, NULL, &nh, 0,
zvrf->table_id, 0, 0, false);