Thanks for the patch. On Tue, Jul 10, 2018 at 12:24 PM, Yifeng Sun <pkusunyif...@gmail.com> wrote: > Currently check-kmod's gre test is broken on certain kernel > versions where ovs's gre module conflits with kernel's gre > module. But at the same time, present gre test depends on > Linux gre module to setup gre port. > > This patch repairs the gre test by completely removing the > dependancy of kernel's gre module and emulating a virtual > Linux gre port that sends out arp and icmp packets. > > Suggested-by: William Tu <u9012...@gmail.com> > Signed-off-by: Yifeng Sun <pkusunyif...@gmail.com> > --- > tests/system-common-macros.at | 13 +++++++++ > tests/system-traffic.at | 67 > +++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 80 insertions(+) > > diff --git a/tests/system-common-macros.at b/tests/system-common-macros.at > index 64bf5ec63ab4..7b841250c383 100644 > --- a/tests/system-common-macros.at > +++ b/tests/system-common-macros.at > @@ -329,3 +329,16 @@ m4_define([OVS_CHECK_IPROUTE_ENCAP], > # OVS_CHECK_CT_CLEAR() > m4_define([OVS_CHECK_CT_CLEAR], > [AT_SKIP_IF([! grep -q "Datapath supports ct_clear action" > ovs-vswitchd.log])]) > + > +# GEN_ICMP_DATA([start], [len]) > +# > +# Generate space-separated ICMP data that is acceptable to tests/sendpkt.py. > +m4_define([GEN_ICMP_DATA], > + [[ > + ICMP_DATA="" > + for (( n=0; n<$2; n++ )); do > + ICMP_DATA="${ICMP_DATA} $(printf %x $((($1+n) % 256)))" > + done > + echo "$ICMP_DATA" > + ]] > +) > diff --git a/tests/system-traffic.at b/tests/system-traffic.at > index 519b234bb16b..37421ed1e78a 100644 > --- a/tests/system-traffic.at > +++ b/tests/system-traffic.at > @@ -339,6 +339,73 @@ NS_CHECK_EXEC([at_ns0], [ping -s 3200 -q -c 3 -i 0.3 -w > 2 10.1.1.100 | FORMAT_PI > OVS_TRAFFIC_VSWITCHD_STOP > AT_CLEANUP > > +AT_SETUP([datapath - ping over gre tunnel by simulated packets]) > +OVS_CHECK_GRE() > + > +OVS_TRAFFIC_VSWITCHD_START() > +AT_CHECK([ovs-vsctl -- set bridge br0 > other-config:hwaddr=\"f2:ff:00:00:00:01\"]) > +ADD_BR([br-underlay], [set bridge br-underlay > other-config:hwaddr=\"f2:ff:00:00:00:02\"]) > + > +AT_CHECK([ovs-ofctl add-flow br0 "actions=normal"]) > +AT_CHECK([ovs-ofctl add-flow br-underlay "actions=normal"]) > + > +ADD_NAMESPACES(at_ns0) > + > +dnl Set up underlay link from host into the namespace using veth pair. > +ADD_VETH(p0, at_ns0, br-underlay, "172.31.1.1/24", f2:ff:00:00:00:03) > +AT_CHECK([ip addr add dev br-underlay "172.31.1.100/24"]) > +AT_CHECK([ip link set dev br-underlay up]) > + > +dnl Set up tunnel endpoints on OVS outside the namespace. > +ADD_OVS_TUNNEL([gre], [br0], [at_gre0], [172.31.1.1], [10.1.1.100/24]) > + > +ip netns exec at_ns0 tcpdump -U -i p0 -w p0.pcap &
maybe you can add a filter here to reduce the packets counts in p0.pcap below you only egrep ip packet, or gre packet, so you can just "tcpdump -w p0.pcap proto GRE" > + > +dnl First, check the underlay. > +NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 172.31.1.100 | > FORMAT_PING], [0], [dnl > +3 packets transmitted, 3 received, 0% packet loss, time 0ms > +]) > + > +dnl Okay, now we don't actually add the port as below, instead, we > +dnl emulate it. Suppose its mac address is f2:ff:00:00:00:04. > +dnl ADD_NATIVE_TUNNEL([gretap], [ns_gre0], [at_ns0], [172.31.1.100], > [10.1.1.1/24]) > + > +dnl Okay, now send out an arp request from 10.1.1.1 for 10.1.1.100 in gre. > +NS_CHECK_EXEC([at_ns0], [$PYTHON $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 > ff 00 00 00 03 08 00 45 00 00 42 ec 2c 40 00 40 2f f3 bc ac 1f 01 01 ac 1f 01 > 64 00 00 65 58 ff ff ff ff ff ff f2 ff 00 00 00 04 08 06 00 01 08 00 06 04 00 > 01 f2 ff 00 00 00 04 0a 01 01 01 00 00 00 00 00 00 0a 01 01 64 > /dev/null]) > + > +sleep 1 Is it possible to use OVS_WAIT_UNTIL macro? > +AT_CHECK([tcpdump -xx -r p0.pcap 2>&1 | egrep "IP 172.31.1.100 > 172.31.1.1: > GREv0, length 46: ARP, Reply 10.1.1.100 is-at f2:ff:00:00:00:01 .* length 28" > 2>&1 1>/dev/null]) > + > +dnl Oaky, now check the overlay by sending out raw icmp packets of > +dnl different sizes in gre protocol. > + > +dnl First, send the packet that emulates > +dnl `ip netns exec at_ns0 ping 10.1.1.100` > +NS_CHECK_EXEC([at_ns0], [$PYTHON $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 > ff 00 00 00 03 08 00 45 00 00 7a ec 8e 40 00 40 2f f3 22 ac 1f 01 01 ac 1f 01 > 64 00 00 65 58 f2 ff 00 00 00 01 f2 ff 00 00 00 04 08 00 45 00 00 54 54 8f 40 > 00 40 01 cf b3 0a 01 01 01 0a 01 01 64 08 00 e6 e8 29 27 00 03 e1 a3 43 5b 00 > 00 00 00 ff 1a 05 00 00 00 00 00 $(GEN_ICMP_DATA(16, 40)) > /dev/null]) > + > +sleep 1 > +AT_CHECK([tcpdump -xx -r p0.pcap 2>&1 | egrep "IP 172.31.1.100 > 172.31.1.1: > GREv0, length 102: IP 10.1.1.100 > 10.1.1.1: ICMP echo reply, .* length 64$" > 2>&1 1>/dev/null]) > + > +dnl Second, send the packet that emulates > +dnl `ip netns exec at_ns0 ping -s 1600 10.1.1.100` > +NS_CHECK_EXEC([at_ns0], [$PYTHON $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 > ff 00 00 00 03 08 00 45 00 05 ca 9a 7b 40 00 40 2f 3f e6 ac 1f 01 01 ac 1f 01 > 64 00 00 65 58 f2 ff 00 00 00 01 f2 ff 00 00 00 04 08 00 45 00 05 a4 6d 4d 20 > 00 40 01 d1 a5 0a 01 01 01 0a 01 01 64 08 00 11 cc 13 ed 00 01 82 c6 43 5b 00 > 00 00 00 d2 e1 0c 00 00 00 00 00 $(GEN_ICMP_DATA(16, 1400)) > /dev/null]) > +NS_CHECK_EXEC([at_ns0], [$PYTHON $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 > ff 00 00 00 03 08 00 45 00 00 f2 9a 7c 40 00 40 2f 44 bd ac 1f 01 01 ac 1f 01 > 64 00 00 65 58 f2 ff 00 00 00 01 f2 ff 00 00 00 04 08 00 45 00 00 cc 6d 4d 00 > b2 40 01 f5 cb 0a 01 01 01 0a 01 01 64 $(GEN_ICMP_DATA(136, 184)) > > /dev/null]) > + > +sleep 1 > +AT_CHECK([tcpdump -xx -r p0.pcap 2>&1 | egrep "IP 172.31.1.100 > 172.31.1.1: > GREv0, length 222: IP 10.1.1.100 > 10.1.1.1: icmp" 2>&1 1>/dev/null]) > + > +dnl Lastly, send the packet that emulates > +dnl `ip netns exec at_ns0 ping -s 3200 10.1.1.100` > +NS_CHECK_EXEC([at_ns0], [$PYTHON $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 > ff 00 00 00 03 08 00 45 00 05 ca 9b 5e 40 00 40 2f 3f 03 ac 1f 01 01 ac 1f 01 > 64 00 00 65 58 f2 ff 00 00 00 01 f2 ff 00 00 00 04 08 00 45 00 05 a4 6d af 20 > 00 40 01 d1 43 0a 01 01 01 0a 01 01 64 08 00 55 ce 13 f4 00 03 84 c6 43 5b 00 > 00 00 00 29 4c 02 00 00 00 00 00 $(GEN_ICMP_DATA(16, 1400)) > /dev/null]) > +NS_CHECK_EXEC([at_ns0], [$PYTHON $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 > ff 00 00 00 03 08 00 45 00 05 ca 9b 5f 40 00 40 2f 3f 02 ac 1f 01 01 ac 1f 01 > 64 00 00 65 58 f2 ff 00 00 00 01 f2 ff 00 00 00 04 08 00 45 00 05 a4 6d af 20 > b2 40 01 d0 91 0a 01 01 01 0a 01 01 64 $(GEN_ICMP_DATA(136, 1424)) > > /dev/null]) > +NS_CHECK_EXEC([at_ns0], [$PYTHON $srcdir/sendpkt.py p0 f2 ff 00 00 00 02 f2 > ff 00 00 00 03 08 00 45 00 01 a2 9b 60 40 00 40 2f 43 29 ac 1f 01 01 ac 1f 01 > 64 00 00 65 58 f2 ff 00 00 00 01 f2 ff 00 00 00 04 08 00 45 00 01 7c 6d af 01 > 64 40 01 f4 07 0a 01 01 01 0a 01 01 64 $(GEN_ICMP_DATA(24, 360)) > /dev/null]) > + > +sleep 1 > +AT_CHECK([tcpdump -xx -r p0.pcap 2>&1 | egrep "IP 172.31.1.100 > 172.31.1.1: > GREv0, length 398: IP 10.1.1.100 > 10.1.1.1: icmp" 2>&1 1>/dev/null]) My local test fail at the above line. I'm still trying to find out the root cause. Thanks William _______________________________________________ dev mailing list d...@openvswitch.org https://mail.openvswitch.org/mailman/listinfo/ovs-dev