Commit a7bf670e authored by Fabian Frederick's avatar Fabian Frederick Committed by Pablo Neira Ayuso

selftests: netfilter: exit on invalid parameters

exit script with comments when parameters are wrong during address
addition. No need for a message when trying to change MTU with lower
values: output is self-explanatory.
Use short testing sequence to avoid shellcheck warnings
(suggested by Stefano Brivio).
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent da2f849e
...@@ -96,10 +96,16 @@ do ...@@ -96,10 +96,16 @@ do
esac esac
done done
ip -net nsr1 link set veth0 mtu $omtu if ! ip -net nsr1 link set veth0 mtu $omtu; then
exit 1
fi
ip -net ns1 link set eth0 mtu $omtu ip -net ns1 link set eth0 mtu $omtu
ip -net nsr2 link set veth1 mtu $rmtu if ! ip -net nsr2 link set veth1 mtu $rmtu; then
exit 1
fi
ip -net ns2 link set eth0 mtu $rmtu ip -net ns2 link set eth0 mtu $rmtu
# transfer-net between nsr1 and nsr2. # transfer-net between nsr1 and nsr2.
...@@ -120,7 +126,10 @@ for i in 1 2; do ...@@ -120,7 +126,10 @@ for i in 1 2; do
ip -net ns$i route add default via 10.0.$i.1 ip -net ns$i route add default via 10.0.$i.1
ip -net ns$i addr add dead:$i::99/64 dev eth0 ip -net ns$i addr add dead:$i::99/64 dev eth0
ip -net ns$i route add default via dead:$i::1 ip -net ns$i route add default via dead:$i::1
ip netns exec ns$i sysctl net.ipv4.tcp_no_metrics_save=1 > /dev/null if ! ip netns exec ns$i sysctl net.ipv4.tcp_no_metrics_save=1 > /dev/null; then
echo "ERROR: Check Originator/Responder values (problem during address addition)"
exit 1
fi
# don't set ip DF bit for first two tests # don't set ip DF bit for first two tests
ip netns exec ns$i sysctl net.ipv4.ip_no_pmtu_disc=1 > /dev/null ip netns exec ns$i sysctl net.ipv4.ip_no_pmtu_disc=1 > /dev/null
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment