diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2021-05-07 01:49:40 +0200 |
---|---|---|
committer | Igor Ryzhov <iryzhov@nfware.com> | 2021-05-31 21:12:55 +0200 |
commit | 36eef8586d80173a9d64e4b802584014b3780558 (patch) | |
tree | 1f423b7d10f02c029f3a31c63510e3d75a9148c2 /tests/topotests/ospf6_topo1_vrf | |
parent | bgpd: pass correct vrf_id to vrf_socket when creating bgp view socket (diff) | |
download | frr-36eef8586d80173a9d64e4b802584014b3780558.tar.xz frr-36eef8586d80173a9d64e4b802584014b3780558.zip |
lib: fix binding to a vrf
There are two possible use-cases for the `vrf_bind` function:
- bind socket to an interface in a vrf
- bind socket to a vrf device
For the former case, there's one problem - success is returned when the
interface is not found. In that case, the socket is left unbound without
throwing an error.
For the latter case, there are multiple possible problems:
- If the name is not set, then the socket is left unbound (zebra, vrrp).
- If the name is "default" and there's an interface with that name in the
default VRF, then the socket is bound to that interface.
- In most daemons, if the router is configured before the VRF is actually
created, we're trying to open and bind the socket right after the
daemon receives a VRF registration from zebra. We may not receive the
VRF-interface registration from zebra yet at that point. Therefore,
`if_lookup_by_name` fails, and the socket is left unbound.
This commit fixes all the issues and updates the function description.
Suggested-by: Pat Ruddy <pat@voltanet.io>
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'tests/topotests/ospf6_topo1_vrf')
-rwxr-xr-x | tests/topotests/ospf6_topo1_vrf/test_ospf6_topo1_vrf.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/topotests/ospf6_topo1_vrf/test_ospf6_topo1_vrf.py b/tests/topotests/ospf6_topo1_vrf/test_ospf6_topo1_vrf.py index fa2784ee7..e1857abc4 100755 --- a/tests/topotests/ospf6_topo1_vrf/test_ospf6_topo1_vrf.py +++ b/tests/topotests/ospf6_topo1_vrf/test_ospf6_topo1_vrf.py @@ -92,10 +92,7 @@ from lib import topotest from lib.topogen import Topogen, TopoRouter, get_topogen from lib.topolog import logger from lib.topotest import iproute2_is_vrf_capable -from lib.common_config import ( - required_linux_kernel_version, - adjust_router_l3mdev, -) +from lib.common_config import required_linux_kernel_version ##################################################### ## @@ -159,6 +156,11 @@ class NetworkTopo(Topo): def setup_module(mod): "Sets up the pytest environment" + # Required linux kernel version for this suite to run. + result = required_linux_kernel_version("5.0") + if result is not True: + pytest.skip("Kernel requirements are not met") + tgen = Topogen(NetworkTopo, mod.__name__) tgen.start_topology() @@ -197,9 +199,6 @@ def setup_module(mod): for cmd in cmds2: output = tgen.net[rname].cmd(cmd.format(rname)) - # adjust handling of vrf traffic - adjust_router_l3mdev(tgen, rname) - for rname, router in tgen.routers().items(): router.load_config( TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) |