diff mbox series

[bpf-next] seltests: bpf: test_tunnel: use ip neigh

Message ID 40f24b9d3f0f53b5c44471b452f9a11f4d13b7af.1632236133.git.jbenc@redhat.com (mailing list archive)
State Accepted
Delegated to: BPF
Headers show
Series [bpf-next] seltests: bpf: test_tunnel: use ip neigh | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for bpf-next
netdev/subject_prefix success Link
netdev/cc_maintainers warning 7 maintainers not CCed: kpsingh@kernel.org john.fastabend@gmail.com yhs@fb.com linux-kselftest@vger.kernel.org shuah@kernel.org songliubraving@fb.com kafai@fb.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
bpf/vmtest-bpf-next-PR success PR summary
bpf/vmtest-bpf-next success VM_Test

Commit Message

Jiri Benc Sept. 21, 2021, 2:59 p.m. UTC
The 'arp' command is deprecated and is another dependency of the selftest.
Just use 'ip neigh', the test depends on iproute2 already.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
 tools/testing/selftests/bpf/test_tunnel.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

David Ahern Sept. 21, 2021, 3:23 p.m. UTC | #1
On 9/21/21 8:59 AM, Jiri Benc wrote:
> The 'arp' command is deprecated and is another dependency of the selftest.
> Just use 'ip neigh', the test depends on iproute2 already.
> 
> Signed-off-by: Jiri Benc <jbenc@redhat.com>
> ---
>  tools/testing/selftests/bpf/test_tunnel.sh | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/bpf/test_tunnel.sh b/tools/testing/selftests/bpf/test_tunnel.sh
> index 1ccbe804e8e1..ca1372924023 100755
> --- a/tools/testing/selftests/bpf/test_tunnel.sh
> +++ b/tools/testing/selftests/bpf/test_tunnel.sh
> @@ -168,14 +168,15 @@ add_vxlan_tunnel()
>  	ip netns exec at_ns0 \
>  		ip link set dev $DEV_NS address 52:54:00:d9:01:00 up
>  	ip netns exec at_ns0 ip addr add dev $DEV_NS 10.1.1.100/24
> -	ip netns exec at_ns0 arp -s 10.1.1.200 52:54:00:d9:02:00
> +	ip netns exec at_ns0 \
> +		ip neigh add 10.1.1.200 lladdr 52:54:00:d9:02:00 dev $DEV_NS

I realize you are just following suit with this change, but ip can
change namespaces internally:

ip -netns at_ns0 neigh add 10.1.1.200 lladdr 52:54:00:d9:02:00 dev $DEV_NS

All of the 'ip netns exec ... ip ...' commands can be simplified.


>  	ip netns exec at_ns0 iptables -A OUTPUT -j MARK --set-mark 0x800FF
>  
>  	# root namespace
>  	ip link add dev $DEV type $TYPE external gbp dstport 4789
>  	ip link set dev $DEV address 52:54:00:d9:02:00 up
>  	ip addr add dev $DEV 10.1.1.200/24
> -	arp -s 10.1.1.100 52:54:00:d9:01:00
> +	ip neigh add 10.1.1.100 lladdr 52:54:00:d9:01:00 dev $DEV
>  }
>  
>  add_ip6vxlan_tunnel()
>
Jiri Benc Sept. 21, 2021, 4:31 p.m. UTC | #2
On Tue, 21 Sep 2021 09:23:06 -0600, David Ahern wrote:
> I realize you are just following suit with this change, but ip can
> change namespaces internally:
> 
> ip -netns at_ns0 neigh add 10.1.1.200 lladdr 52:54:00:d9:02:00 dev $DEV_NS
> 
> All of the 'ip netns exec ... ip ...' commands can be simplified.

I know and I don't like the superfluous exec, either. But that's
something for a different patch. As you said, I'm just following what's
already there. There's ton of different stuff that can be cleaned up in
this and other selftests, unfortunately.

 Jiri
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/test_tunnel.sh b/tools/testing/selftests/bpf/test_tunnel.sh
index 1ccbe804e8e1..ca1372924023 100755
--- a/tools/testing/selftests/bpf/test_tunnel.sh
+++ b/tools/testing/selftests/bpf/test_tunnel.sh
@@ -168,14 +168,15 @@  add_vxlan_tunnel()
 	ip netns exec at_ns0 \
 		ip link set dev $DEV_NS address 52:54:00:d9:01:00 up
 	ip netns exec at_ns0 ip addr add dev $DEV_NS 10.1.1.100/24
-	ip netns exec at_ns0 arp -s 10.1.1.200 52:54:00:d9:02:00
+	ip netns exec at_ns0 \
+		ip neigh add 10.1.1.200 lladdr 52:54:00:d9:02:00 dev $DEV_NS
 	ip netns exec at_ns0 iptables -A OUTPUT -j MARK --set-mark 0x800FF
 
 	# root namespace
 	ip link add dev $DEV type $TYPE external gbp dstport 4789
 	ip link set dev $DEV address 52:54:00:d9:02:00 up
 	ip addr add dev $DEV 10.1.1.200/24
-	arp -s 10.1.1.100 52:54:00:d9:01:00
+	ip neigh add 10.1.1.100 lladdr 52:54:00:d9:01:00 dev $DEV
 }
 
 add_ip6vxlan_tunnel()