diff mbox series

[ovs-dev,1/2] test macros: Ensure ADD_VETH macro sets IPv6 LLA.

Message ID 20240715171928.1098718-2-martin.kalcok@canonical.com
State Superseded
Headers show
Series Add LRP option for mirroring of BGP traffic. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test fail github build: failed
ovsrobot/github-robot-_ovn-kubernetes fail github build: failed

Commit Message

Martin Kalcok July 15, 2024, 5:19 p.m. UTC
Test macro ADD_VET takes an optional argument to specify
MAC address for the interface. However this address is
set only after the interface is brought UP, causing it
to keep IPv6 Link Local Address based on its old MAC.

Toggling the interface down/up after a new MAC address
is set fixes this issue.

Signed-off-by: Martin Kalcok <martin.kalcok@canonical.com>
---
 tests/system-common-macros.at | 3 +++
 1 file changed, 3 insertions(+)

Comments

Martin Kalcok July 15, 2024, 6:56 p.m. UTC | #1
This change actually broke a bunch of other tests, which I did not
expect. I'll resubmit v2 without it.

Martin.

On Mon, 2024-07-15 at 19:19 +0200, Martin Kalcok wrote:
> Test macro ADD_VET takes an optional argument to specify
> MAC address for the interface. However this address is
> set only after the interface is brought UP, causing it
> to keep IPv6 Link Local Address based on its old MAC.
> 
> Toggling the interface down/up after a new MAC address
> is set fixes this issue.
> 
> Signed-off-by: Martin Kalcok <martin.kalcok@canonical.com>
> ---
>  tests/system-common-macros.at | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tests/system-common-macros.at b/tests/system-common-
> macros.at
> index 691c271a3..e7dee9d28 100644
> --- a/tests/system-common-macros.at
> +++ b/tests/system-common-macros.at
> @@ -69,6 +69,9 @@ m4_define([ADD_VETH],
>        NS_CHECK_EXEC([$2], [ip link set dev $1 up])
>        if test -n "$5"; then
>          NS_CHECK_EXEC([$2], [ip link set dev $1 address $5])
> +        # Toggle the interface down/up to get an IPv6 LLA that
> matches its MAC addr.
> +        NS_CHECK_EXEC([$2], [ip link set down $1])
> +        NS_CHECK_EXEC([$2], [ip link set up $1])
>        fi
>        if test -n "$6"; then
>          NS_CHECK_EXEC([$2], [ip route add $6 dev $1])
diff mbox series

Patch

diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at
index 691c271a3..e7dee9d28 100644
--- a/tests/system-common-macros.at
+++ b/tests/system-common-macros.at
@@ -69,6 +69,9 @@  m4_define([ADD_VETH],
       NS_CHECK_EXEC([$2], [ip link set dev $1 up])
       if test -n "$5"; then
         NS_CHECK_EXEC([$2], [ip link set dev $1 address $5])
+        # Toggle the interface down/up to get an IPv6 LLA that matches its MAC addr.
+        NS_CHECK_EXEC([$2], [ip link set down $1])
+        NS_CHECK_EXEC([$2], [ip link set up $1])
       fi
       if test -n "$6"; then
         NS_CHECK_EXEC([$2], [ip route add $6 dev $1])