@@ -2513,6 +2513,57 @@ backup_tests()
fi
}
+LISTENER_CREATED=15 #MPTCP_EVENT_LISTENER_CREATED
+LISTENER_CLOSED=16 #MPTCP_EVENT_LISTENER_CLOSED
+
+AF_INET=2
+AF_INET6=10
+
+verify_listener_events()
+{
+ local evt=$1
+ local e_type=$2
+ local e_family=$3
+ local e_saddr=$4
+ local e_sport=$5
+ local type
+ local family
+ local saddr
+ local sport
+
+ if [ $e_type = $LISTENER_CREATED ]; then
+ stdbuf -o0 -e0 printf "\t\t\t\t\t CREATE_LISTENER %s:%s"\
+ $e_saddr $e_sport
+ elif [ $e_type = $LISTENER_CLOSED ]; then
+ stdbuf -o0 -e0 printf "\t\t\t\t\t CLOSE_LISTENER %s:%s "\
+ $e_saddr $e_sport
+ fi
+
+ type=$(grep "type:$e_type," $evt |
+ sed --unbuffered -n 's/.*\(type:\)\([[:digit:]]*\).*$/\2/p;q')
+ family=$(grep "type:$e_type," $evt |
+ sed --unbuffered -n 's/.*\(family:\)\([[:digit:]]*\).*$/\2/p;q')
+ sport=$(grep "type:$e_type," $evt |
+ sed --unbuffered -n 's/.*\(sport:\)\([[:digit:]]*\).*$/\2/p;q')
+ if [ $family ] && [ $family = $AF_INET6 ]; then
+ saddr=$(grep "type:$e_type," $evt |
+ sed --unbuffered -n 's/.*\(saddr6:\)\([0-9a-f:.]*\).*$/\2/p;q')
+ else
+ saddr=$(grep "type:$e_type," $evt |
+ sed --unbuffered -n 's/.*\(saddr4:\)\([0-9.]*\).*$/\2/p;q')
+ fi
+
+ if [ $type ] && [ $type = $e_type ] &&
+ [ $family ] && [ $family = $e_family ] &&
+ [ $saddr ] && [ $saddr = $e_saddr ] &&
+ [ $sport ] && [ $sport = $e_sport ]; then
+ stdbuf -o0 -e0 printf "[ ok ]\n"
+ return 0
+ fi
+ fail_test
+ stdbuf -o0 -e0 printf "[fail]\n"
+}
+
add_addr_ports_tests()
{
# signal address with port
@@ -2537,7 +2588,8 @@ add_addr_ports_tests()
fi
# single address with port, remove
- if reset "remove single address with port"; then
+ # pm listener events
+ if reset_with_events "remove single address with port"; then
pm_nl_set_limits $ns1 0 1
pm_nl_add_endpoint $ns1 10.0.2.1 flags signal port 10100
pm_nl_set_limits $ns2 1 1
@@ -2545,6 +2597,10 @@ add_addr_ports_tests()
chk_join_nr 1 1 1
chk_add_nr 1 1 1
chk_rm_nr 1 1 invert
+
+ verify_listener_events $evts_ns1 $LISTENER_CREATED $AF_INET 10.0.2.1 10100
+ verify_listener_events $evts_ns1 $LISTENER_CLOSED $AF_INET 10.0.2.1 10100
+ kill_events_pids
fi
# subflow and signal with port, remove