On Wed, Dec 19, 2018 at 8:41 AM David Ahern <d...@cumulusnetworks.com> wrote: > > On 12/19/18 9:27 AM, Roopa Prabhu wrote: > > From: Roopa Prabhu <ro...@cumulusnetworks.com> > > > > Signed-off-by: Roopa Prabhu <ro...@cumulusnetworks.com> > > --- > > tools/testing/selftests/net/rtnetlink.sh | 54 > > ++++++++++++++++++++++++++++++++ > > 1 file changed, 54 insertions(+) > > > > diff --git a/tools/testing/selftests/net/rtnetlink.sh > > b/tools/testing/selftests/net/rtnetlink.sh > > index bb3436f..7f9b4e2 100755 > > --- a/tools/testing/selftests/net/rtnetlink.sh > > +++ b/tools/testing/selftests/net/rtnetlink.sh > > @@ -1007,6 +1007,59 @@ kci_test_fdb_get() > > echo "PASS: bridge fdb get" > > } > > > > +kci_test_neigh_get() > > +{ > > + dstmac=de:ad:be:ef:13:37 > > + dstip=10.0.2.4 > > + dstip6=dead::2 > > + ret=0 > > + > > + ip neigh help 2>&1 |grep -q 'ip neigh get' > > + if [ $? -ne 0 ];then > > + echo "SKIP: fdb get tests: iproute2 too old" > > + return $ksft_skip > > + fi > > + > > + # ipv4 > > + ip neigh add $dstip lladdr $dstmac dev "$devdummy" > /dev/null > > + check_err $? > > + ip neigh get $dstip dev "$devdummy" 2> /dev/null | grep -q "$dstmac" > > + check_err $? > > + ip neigh del $dstip lladdr $dstmac dev "$devdummy" > /dev/null > > + check_err $? > > + > > + # ipv4 proxy > > + ip neigh add proxy $dstip dev "$devdummy" > /dev/null > > + check_err $? > > + ip neigh get proxy $dstip dev "$devdummy" 2>/dev/null | grep -q > > "$dstip" > > + check_err $? > > + ip neigh del proxy $dstip dev "$devdummy" > /dev/null > > + check_err $? > > + > > + # ipv6 > > + ip neigh add $dstip6 lladdr $dstmac dev "$devdummy" > /dev/null > > + check_err $? > > + ip neigh get $dstip6 dev "$devdummy" 2> /dev/null | grep -q "$dstmac" > > + check_err $? > > + ip neigh del $dstip6 lladdr $dstmac dev "$devdummy" > /dev/null > > + check_err $? > > + > > + # ipv6 proxy > > + ip neigh add proxy $dstip6 dev "$devdummy" > /dev/null > > + check_err $? > > + ip neigh get proxy $dstip6 dev "$devdummy" 2>/dev/null | grep -q > > "$dstip6" > > + check_err $? > > + ip neigh del proxy $dstip6 dev "$devdummy" > /dev/null > > + check_err $? > > This is an odd quirk to this test script. The test is for neigh get so > the ret should only be for the 'ip neigh get'; the rest of the commands > can be run with set -e ... set +e.
yes, this is true with all the testcases in this file. In general this test file needs some catching up with the latest test infra. eg check_err is not consistent with the rest of the newer tests. Plus we should move all the tests in this file to use netns. I am thinking of keeping this as is to be consistent with the rest of the testcases in this file and address this in a future upgrade to all tests. > > > + > > + if [ $ret -ne 0 ];then > > + echo "FAIL: neigh get" > > + return 1 > > + fi > > + > > + echo "PASS: neigh get" > > +} > > + > > kci_test_rtnl() > > { > > kci_add_dummy > > @@ -1032,6 +1085,7 @@ kci_test_rtnl() > > kci_test_ipsec > > kci_test_ipsec_offload > > kci_test_fdb_get > > + kci_test_neigh_get > > spaces instead of tab will fix. > > > > > kci_del_dummy > > } > > >