Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-8]: src Pull up following revision(s) (requested by ozaki-r in ti...



details:   https://anonhg.NetBSD.org/src/rev/544daeabaf89
branches:  netbsd-8
changeset: 434871:544daeabaf89
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Apr 10 11:48:28 2018 +0000

description:
Pull up following revision(s) (requested by ozaki-r in ticket #727):

        tests/net/if_bridge/t_rtable.sh: revision 1.2
        sys/net/if_bridge.c: revision 1.149

Fix bridge_rtdelete

It removes a rtable entry that belongs to a specified interface, however,
its original behavior was to delete all belonging entries.
Restore the original behavior.

Add a test case for bridge_rtdelete

diffstat:

 sys/net/if_bridge.c             |   8 +++-
 tests/net/if_bridge/t_rtable.sh |  73 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 78 insertions(+), 3 deletions(-)

diffs (129 lines):

diff -r d69282236bb8 -r 544daeabaf89 sys/net/if_bridge.c
--- a/sys/net/if_bridge.c       Tue Apr 10 08:07:48 2018 +0000
+++ b/sys/net/if_bridge.c       Tue Apr 10 11:48:28 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bridge.c,v 1.134.6.7 2018/02/26 00:41:13 snj Exp $  */
+/*     $NetBSD: if_bridge.c,v 1.134.6.8 2018/04/10 11:48:29 martin Exp $       */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.134.6.7 2018/02/26 00:41:13 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.134.6.8 2018/04/10 11:48:29 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -2299,6 +2299,8 @@
 {
        struct bridge_rtnode *brt;
 
+       /* XXX pserialize_perform for each entry is slow */
+again:
        BRIDGE_RT_LOCK(sc);
        LIST_FOREACH(brt, &sc->sc_rtlist, brt_list) {
                if (brt->brt_ifp == ifp)
@@ -2313,6 +2315,8 @@
        BRIDGE_RT_UNLOCK(sc);
 
        bridge_rtnode_destroy(brt);
+
+       goto again;
 }
 
 /*
diff -r d69282236bb8 -r 544daeabaf89 tests/net/if_bridge/t_rtable.sh
--- a/tests/net/if_bridge/t_rtable.sh   Tue Apr 10 08:07:48 2018 +0000
+++ b/tests/net/if_bridge/t_rtable.sh   Tue Apr 10 11:48:28 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: t_rtable.sh,v 1.1 2017/03/11 04:24:52 ozaki-r Exp $
+#      $NetBSD: t_rtable.sh,v 1.1.8.1 2018/04/10 11:48:28 martin Exp $
 #
 # Copyright (c) 2017 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -342,6 +342,76 @@
 }
 
 
+atf_test_case bridge_rtable_delete_member cleanup
+bridge_rtable_delete_member_head()
+{
+
+       atf_set "descr" "Tests belonging rtable entries are removed on deleting an interface"
+       atf_set "require.progs" "rump_server"
+}
+
+bridge_rtable_delete_member_body()
+{
+       local addr10= addr30= addr11= addr31=
+       local n=
+
+       setup
+       setup_bridge
+
+       # Add extra interfaces and addresses
+       export RUMP_SERVER=$SOCK1
+       rump_server_add_iface $SOCK1 shmif1 bus1
+       atf_check -s exit:0 rump.ifconfig shmif1 10.0.0.11/24
+       atf_check -s exit:0 rump.ifconfig -w 10
+
+       export RUMP_SERVER=$SOCK3
+       rump_server_add_iface $SOCK3 shmif1 bus2
+       atf_check -s exit:0 rump.ifconfig shmif1 10.0.0.12/24
+       atf_check -s exit:0 rump.ifconfig -w 10
+
+       # Get MAC addresses of the endpoints.
+       addr10=$(get_macaddr $SOCK1 shmif0)
+       addr30=$(get_macaddr $SOCK3 shmif0)
+       addr11=$(get_macaddr $SOCK1 shmif1)
+       addr31=$(get_macaddr $SOCK3 shmif1)
+
+       # Make the bridge learn the MAC addresses of the endpoints.
+       export RUMP_SERVER=$SOCK1
+       atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 10.0.0.12
+       export RUMP_SERVER=$SOCK3
+       atf_check -s exit:0 -o ignore rump.ping -n -w $TIMEOUT -c 1 10.0.0.11
+
+       export RUMP_SERVER=$SOCK2
+       export LD_PRELOAD=/usr/lib/librumphijack.so
+       $DEBUG && /sbin/brconfig bridge0
+       atf_check -s exit:0 -o match:"$addr10 shmif0" /sbin/brconfig bridge0
+       atf_check -s exit:0 -o match:"$addr11 shmif0" /sbin/brconfig bridge0
+       atf_check -s exit:0 -o match:"$addr30 shmif1" /sbin/brconfig bridge0
+       atf_check -s exit:0 -o match:"$addr31 shmif1" /sbin/brconfig bridge0
+
+       atf_check -s exit:0 -o ignore /sbin/brconfig bridge0 delete shmif0
+       atf_check -s exit:0 -o not-match:"$addr10 shmif0" /sbin/brconfig bridge0
+       atf_check -s exit:0 -o not-match:"$addr11 shmif0" /sbin/brconfig bridge0
+       atf_check -s exit:0 -o match:"$addr30 shmif1" /sbin/brconfig bridge0
+       atf_check -s exit:0 -o match:"$addr31 shmif1" /sbin/brconfig bridge0
+
+       atf_check -s exit:0 -o ignore /sbin/brconfig bridge0 delete shmif1
+       atf_check -s exit:0 -o not-match:"$addr10 shmif0" /sbin/brconfig bridge0
+       atf_check -s exit:0 -o not-match:"$addr11 shmif0" /sbin/brconfig bridge0
+       atf_check -s exit:0 -o not-match:"$addr30 shmif1" /sbin/brconfig bridge0
+       atf_check -s exit:0 -o not-match:"$addr31 shmif1" /sbin/brconfig bridge0
+
+       rump_server_destroy_ifaces
+}
+
+bridge_rtable_delete_member_cleanup()
+{
+
+       $DEBUG && dump
+       cleanup
+}
+
+
 atf_init_test_cases()
 {
 
@@ -349,5 +419,6 @@
        atf_add_test_case bridge_rtable_flush
        atf_add_test_case bridge_rtable_timeout
        atf_add_test_case bridge_rtable_maxaddr
+       atf_add_test_case bridge_rtable_delete_member
        # TODO: brconfig static/flushall/discover/learn
 }



Home | Main Index | Thread Index | Old Index