Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zebra: set ZEBRA_IFC_DOWN on connected routes for inactive interfaces #11004

Merged
merged 1 commit into from
Apr 19, 2022

Conversation

1337kerberos
Copy link
Contributor

If you are in a situation where you have multiple addresses on an
interface, zebra creates one connected route for them.
The issue is that the rib entry is not created if addresses were
added before the interface was running.

We add the address to a running interface in a typical flow.
Therefore, we handle the route & rib creation within a single ADD event.
In the opposite case, we create the route entries without activating them.
These are considered to be active since ZEBRA_IFC_DOWN is not set.
On the following interface UP, we ignore the same ADDR_ADD as it overlaps
with the already active prefixes -> rib is never created.

The minimal reproducible setup:

ip link add name dummy0 type dummy
ip addr flush dev dummy0
ip link set dummy0 down
ip addr add 192.168.1.7/24 dev dummy0
ip addr add 192.168.1.8/24 dev dummy0
ip link set dummy0 up
sudo vtysh -c 'show ip route' | grep dummy0

Signed-off-by: Volodymyr Huti volodymyr.huti@gmail.com

Fixes #10160

@frrbot frrbot bot added the zebra label Apr 11, 2022
@1337kerberos
Copy link
Contributor Author

Thanks to @zdc for the original reproducer
The original issue was introduced in - #8514
However, the logic was modified a bit in - #8659

Open questions:
[ ] I have made symmetrical modifications for both IP4/6, but I`m not sure if the logic applies to IP6 routing
[ ] Is this case covered within tests?

  • If not, should we implement such a test?
  • If yes, the issue is not noticed, the test should be fixed

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Apr 11, 2022

Continuous Integration Result: SUCCESSFUL

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-4797/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

@mjstapp mjstapp self-requested a review April 12, 2022 15:38
@@ -326,7 +326,7 @@ void connected_add_ipv4(struct interface *ifp, int flags,
ifc->metric = metric;
/* If we get a notification from the kernel,
* we can safely assume the address is known to the kernel */
SET_FLAG(ifc->conf, ZEBRA_IFC_QUEUED);
SET_FLAG(ifc->conf, ZEBRA_IFC_DOWN | ZEBRA_IFC_QUEUED);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's only add the ZEBRA_IFC_DOWN flag if the interface is actually down

if (if_up(ifp))
SET_FLAG(ifc->conf, ZEBRA_IFC_DOWN);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have hidden it under if_is_operative(ifp) if I have understood you correctly

@donaldsharp
Copy link
Member

can you remove the merge commit with a rebase and a force push and I'll get this in

If you are in a situation where you have multiple addresses on an
interface, zebra creates one connected route for them.
The issue is that the rib entry is not created if addresses were
added before the interface was running.

We add the address to a running interface in a typical flow.
Therefore, we handle the route & rib creation within a single ADD event.
In the opposite case, we create the route entries without activating them.
These are considered to be active since ZEBRA_IFC_DOWN is not set.
On the following interface UP, we ignore the same ADDR_ADD as it overlaps
with the existing prefixes -> rib is never created.

The minimal reproducible setup:
-----------------------------------------
ip link add name dummy0 type dummy
ip addr flush dev dummy0
ip link set dummy0 down
ip addr add 192.168.1.7/24 dev dummy0
ip addr add 192.168.1.8/24 dev dummy0
ip link set dummy0 up
vtysh -c 'show ip route' | grep dummy0

Signed-off-by: Volodymyr Huti <v.huti@vyos.io>
@1337kerberos 1337kerberos changed the title zebra: default-initialze new connected routes with ZEBRA_IFC_DOWN zebra: set ZEBRA_IFC_DOWN on connected routes for inactive interfaces Apr 19, 2022
@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Apr 19, 2022

Continuous Integration Result: SUCCESSFUL

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-4957/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Apr 19, 2022

Continuous Integration Result: SUCCESSFUL

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-4960/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

@donaldsharp
Copy link
Member

@Mergifyio backport stable/8.2

@donaldsharp donaldsharp merged commit 945f6ce into FRRouting:master Apr 19, 2022
@mergify
Copy link

mergify bot commented Apr 19, 2022

backport stable/8.2

✅ Backports have been created

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Apr 19, 2022

Continuous Integration Result: SUCCESSFUL

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-4956/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

@NetDEF-CI
Copy link
Collaborator

NetDEF-CI commented Apr 19, 2022

Continuous Integration Result: SUCCESSFUL

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-4959/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-PULLREQ2-4955/

This is a comment from an automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.

ton31337 added a commit that referenced this pull request Apr 20, 2022
zebra: set ZEBRA_IFC_DOWN on connected routes for inactive interfaces (backport #11004)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FRR 8.1 after reboot doesn't see connected routes which was added via iproute2
3 participants