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

Smoke ping6 #144

Merged
merged 2 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/ip6/datapath/icmp6_local_send.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ int icmp6_local_send(
if ((local = ip6_addr_get_preferred(gw->iface_id, &gw->ipv6)) == NULL)
return -errno;

if ((msg = calloc(1, sizeof(struct ctl_to_stack))))
if ((msg = calloc(1, sizeof(struct ctl_to_stack))) == NULL)
return errno_set(ENOMEM);
msg->iface_id = gw->iface_id;
msg->seq_num = seq_num;
Expand Down
36 changes: 36 additions & 0 deletions smoke/ip6_builtin_icmp_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
# SPDX-License-Identifier: BSD-3-Clause
# Copyright (c) 2025 Olivier Gournet

. $(dirname $0)/_init.sh

p0=${run_id}0
p1=${run_id}1

grcli add interface port $p0 devargs net_tap0,iface=$p0 mac f0:0d:ac:dc:13:00
grcli add interface port $p1 devargs net_tap1,iface=$p1 mac f0:0d:ac:dc:13:01
grcli add ip6 address fd00:ba4:0::1/64 iface $p0
grcli add ip6 address fd00:ba4:1::1/64 iface $p1

for n in 0 1; do
p=$run_id$n
ip netns add $p
echo ip netns del $p >> $tmp/cleanup
ip link set $p netns $p
ip -n $p link set $p address ba:d0:ca:cd:00:0$n
ip -n $p link set $p up
ip -n $p addr add fd00:ba4:$n::2/64 dev $p
ip -n $p route add fd00:ba4::/62 via fd00:ba4:$n::1 dev $p
ip -n $p addr show
done

sleep 3 # wait for DAD

grcli ping fd00:ba4:0::2 count 10 delay 100
grcli ping fd00:ba4:1::2 count 3 delay 10

# Expect this test to fail
grcli ping fd00:baa::1 count 1 && fail "ping to unknown route succeeded"
grcli ping fd00:ba4:1::3 count 1 && fail "ping to non-existent host succeeded"

grcli traceroute fd00:ba4:1::2