Skip to content

Commit

Permalink
tests: turn off replay-window setting for most tests
Browse files Browse the repository at this point in the history
- This is causing some of the hand crafted UT to fail.

Signed-off-by: Christian Hopps <[email protected]>
  • Loading branch information
choppsv1 committed Sep 6, 2024
1 parent ffcfaeb commit 80a1bfb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tests/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,13 @@ def setup_tunnel_routes(r1con, r2con, tun_ipv6, network3):
return r1ipnh, r1ip6nh, r2ipnh, r2ip6nh


def esp_args_filter_dir(direction, esp_args):
"""Filter out esp args inappropriate for the direction."""
if direction != "in":
esp_args = re.sub(r"replay-window \d+", "", esp_args)
return esp_args


def esp_flags_filter_dir(direction, esp_flags):
"""Filter out esp flags inappropriate for the direction."""
if direction == "in":
Expand Down Expand Up @@ -523,6 +530,7 @@ async def setup_policy_tun(
trex=False,
r1only=False,
ipsec_intf="eth2",
esp_args="",
esp_flags="",
iptfs_opts="",
ipv4=True,
Expand Down Expand Up @@ -594,25 +602,25 @@ async def setup_policy_tun(
#
direction = "out" if r == r1 else "in"
eflags = esp_flags_filter_dir(direction, esp_flags)
esp_args = "replay-window 128" if direction == "in" else ""
eargs = esp_args_filter_dir(direction, esp_args)
repl.cmd_raises(
(
f"ip xfrm state add src {r1ip} dst {r2ip} proto esp "
f"spi {spi_1to2} mode {mode} {sa_auth} {sa_enc} "
f"{esp_args} {eflags} reqid {reqid_1to2} dir {direction} "
f"{eargs} {eflags} reqid {reqid_1to2} dir {direction} "
# f"reqid {reqid_1to2} "
)
+ iptfs_opts_filter_dir(direction, iptfs_opts)
)

direction = "in" if r == r1 else "out"
eflags = esp_flags_filter_dir(direction, esp_flags)
esp_args = "replay-window 128" if direction == "in" else ""
eargs = esp_args_filter_dir(direction, esp_args)
repl.cmd_raises(
(
f"ip xfrm state add src {r2ip} dst {r1ip} proto esp "
f"spi {spi_2to1} mode {mode} {sa_auth} {sa_enc} "
f"{esp_args} {eflags} reqid {reqid_2to1} dir {direction} "
f"{eargs} {eflags} reqid {reqid_2to1} dir {direction} "
# f"reqid {reqid_2to1} "
)
+ iptfs_opts_filter_dir(direction, iptfs_opts)
Expand Down Expand Up @@ -757,6 +765,7 @@ async def setup_routed_tun(
r1only=False,
ipsec_intf="eth2",
iptfs_opts="",
esp_args="",
esp_flags="",
ipv4=True,
ipv6=False,
Expand Down Expand Up @@ -835,23 +844,23 @@ async def setup_routed_tun(

direction = "out" if r == r1 else "in"
eflags = esp_flags_filter_dir(direction, esp_flags)
esp_args = "replay-window 128" if direction == "in" else ""
eargs = esp_args_filter_dir(direction, esp_args)
repl.cmd_raises(
(
f"ip xfrm state add src {r1ip} dst {r2ip} proto esp "
f"spi {spi_1to2} mode {mode} {sa_auth} {sa_enc} "
f"{esp_args} {eflags} if_id 55 reqid {reqid_1to2} dir {direction} "
f"{eargs} {eflags} if_id 55 reqid {reqid_1to2} dir {direction} "
)
+ iptfs_opts_filter_dir(direction, iptfs_opts)
)
direction = "in" if r == r1 else "out"
eflags = esp_flags_filter_dir(direction, esp_flags)
esp_args = "replay-window 128" if direction == "in" else ""
eargs = esp_args_filter_dir(direction, esp_args)
repl.cmd_raises(
(
f"ip xfrm state add src {r2ip} dst {r1ip} proto esp "
f"spi {spi_2to1} mode {mode} {sa_auth} {sa_enc} "
f"{esp_args} {eflags} if_id 55 reqid {reqid_2to1} dir {direction} "
f"{eargs} {eflags} if_id 55 reqid {reqid_2to1} dir {direction} "
)
+ iptfs_opts_filter_dir(direction, iptfs_opts)
)
Expand Down
2 changes: 2 additions & 0 deletions tests/flood/test_flood.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ async def test_policy_tun_agg(unet, astepf, tun_ipv6):
await setup_policy_tun(
unet,
mode="iptfs",
esp_args="replay-window 128",
iptfs_opts=f"init-delay {INIT_DELAY}",
ipv6=True,
tun_ipv6=tun_ipv6,
Expand All @@ -95,6 +96,7 @@ async def test_routed_tun_agg(unet, astepf, tun_ipv6):
await setup_routed_tun(
unet,
mode="iptfs",
esp_args="replay-window 128",
esp_flags="esn",
iptfs_opts=f"init-delay {INIT_DELAY}",
ipv6=True,
Expand Down

0 comments on commit 80a1bfb

Please sign in to comment.