Skip to contentSkip to conversation

selftests/mptcp: Capture pcap on both sender and receiver

PATCH In review Christoph Paasch 3 participants 5 messages Jun 16, 2020 – Jun 19, 2020

Subsystems (3)
lore
Share & tools
lore

Christoph Paasch

author
#0 lore raw

PATCH 1/1 selftests/mptcp: Capture pcap on both sender and receiver

When investigating performance issues that involve latency/loss/reordering it is useful to have the pcap from the sender-side as it allows to easier infer the state of the sender's congestion-control, loss-recovery,...

Allow the selftests to capture a pcap on both sides so that this information is not lost when reproducing.

Signed-off-by Christoph Paasch <cpaasch(a)apple.com>
---
 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +6 -3
index acf02e156d20..faf636d1639f 100755
@@ -386,9 +386,11 @@ do_transfer()
 		fi
 
 		local capfile="${listener_ns}-${connector_ns}-${cl_proto}-${srv_proto}-${connect_addr}.pcap"
-
 		ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 &
-		local cappid=$!
+		local cappid_listener=$!
+		local capfile="${connector_ns}-${listener_ns}-${cl_proto}-${srv_proto}-${connect_addr}.pcap"
+		ip netns exec ${connector_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 &
+		local cappid_connector=$!
 
 		sleep 1
 	fi
@@ -413,7 +415,8 @@ do_transfer()
 
 	if $capture; then
 		sleep 1
-		kill $cappid
+		kill $cappid_listener
+		kill $cappid_connector
 	fi
 
 	local duration
Signature · 1 line
2.23.0
#1 lore raw

Hi Christoph,

Quoted 7 lines · Christoph Paasch

When investigating performance issues that involve latency/loss/reordering it is useful to have the pcap from the sender-side as it allows to easier infer the state of the sender's congestion-control, loss-recovery,...

Allow the selftests to capture a pcap on both sides so that this information is not lost when reproducing.

Thank you for the patch!

I was going to send the same! (because you requested to have this capture :) )
Below you can find the difference with what I did:

Quoted 11 lines
Signed-off-by Christoph Paasch <cpaasch(a)apple.com>
---
  tools/testing/selftests/net/mptcp/mptcp_connect.sh | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +0 -0
index acf02e156d20..faf636d1639f 100755

tools/testing/selftests/net/mptcp/mptcp_connect.sh do_transfer() · line 391

Quoted 8 lines
tools/testing/selftests/net/mptcp/mptcp_connect.sh +2 -2
@@ -386,9 +386,11 @@ do_transfer()
  		fi
 
  		local capfile="${listener_ns}-${connector_ns}-${cl_proto}-${srv_proto}-${connect_addr}.pcap"
-
  		ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 &
-		local cappid=$!
+		local cappid_listener=$!
+		local capfile="${connector_ns}-${listener_ns}-${cl_proto}-${srv_proto}-${connect_addr}.pcap"

detail: Here you don't need "local", capfile is already declared as local.

Would it not be better to have the same name but ending with -listener or -connector?

In my patch, I did that:

====================== < ======================
@@ -395,10 +395,13 @@ do_transfer()

                         capuser="-Z $SUDO_USER"
                 fi

- local
capfile="${listener_ns}-${connector_ns}-${cl_proto}-${srv_proto}-${connect_addr}.pcap"
+ local
capfile="${rndh}-${listener_ns:0:3}-${connector_ns:0:3}-${cl_proto}-${srv_proto}-${connect_addr}"

- ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B
32768 $capuser -w $capfile > "$capout" 2>&1 &
- local cappid=$!
+ ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B
32768 ${capuser} -w "${capfile}_listener.pcap" >> "${capout}" 2>&1 &
+ local cappid_listener=$!
+
+ ip netns exec ${connector_ns} tcpdump -i any -s 65535 -B
32768 ${capuser} -w "${capfile}_connector.pcap" >> "${capout}" 2>&1 &
+ local cappid_connector=$!

sleep 1
fi
====================== < ======================

I shorted listener_ns and connector_ns to only 3 chars: "nsX"

Now that I am thinking about that it would even make more sense with "connector_ns" first as it is what we display in the output (the printf above):

capfile="${rndh}-${connector_ns0:3}-${listener_ns::0:3}-${cl_proto}-${srv_proto}-${connect_addr}"

WDYT?

tools/testing/selftests/net/mptcp/mptcp_connect.sh do_transfer() · line 392

Quoted 1 line
tools/testing/selftests/net/mptcp/mptcp_connect.sh +1 -0
+		ip netns exec ${connector_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 &

The output should append ${capout} I guess, not to override the previous one:

Quoted 1 line
Quoted 1 line

"${capout}"

(but the output is somehow annoying in fact but that's another issue :) )

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
#2 lore raw

PATCH 1/1 selftests/mptcp: Capture pcap on both sender and receiver

In reply to Christoph Paasch

When investigating performance issues that involve latency/loss/reordering it is useful to have the pcap from the sender-side as it allows to easier infer the state of the sender's congestion-control, loss-recovery,...

Allow the selftests to capture a pcap on both sides so that this information is not lost when reproducing.

This patch also improves the file names. Instead of:

ns4-5ee79a56-X4O6gS-ns3-5ee79a56-X4O6gS-MPTCP-MPTCP-10.0.3.1.pcap

We now have something like:

5ee79a56-X4O6gS-ns3-ns4-MPTCP-MPTCP-10.0.3.1-10030-connector.pcap 5ee79a56-X4O6gS-ns3-ns4-MPTCP-MPTCP-10.0.3.1-10030-listener.pcap

It was a connection from ns3 to ns4, better to start with ns3 then. The port is also added, easier to find the trace we want.

Co-developed-by Christoph Paasch <cpaasch(a)apple.com>
Signed-off-by Christoph Paasch <cpaasch(a)apple.com>
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>

---

Notes:
As discussed on IRC, here is the patch I made this morning.

 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +9 -4
index 8f7145c413b9..c0589e071f20 100755
@@ -395,10 +395,14 @@ do_transfer()
 			capuser="-Z $SUDO_USER"
 		fi
 
-		local capfile="${listener_ns}-${connector_ns}-${cl_proto}-${srv_proto}-${connect_addr}.pcap"
+		local capfile="${rndh}-${connector_ns:0:3}-${listener_ns:0:3}-${cl_proto}-${srv_proto}-${connect_addr}-${port}"
+		local capopt="-i any -s 65535 -B 32768 ${capuser}"
 
-		ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 &
-		local cappid=$!
+		ip netns exec ${listener_ns}  tcpdump ${capopt} -w "${capfile}-listener.pcap"  >> "${capout}" 2>&1 &
+		local cappid_listener=$!
+
+		ip netns exec ${connector_ns} tcpdump ${capopt} -w "${capfile}-connector.pcap" >> "${capout}" 2>&1 &
+		local cappid_connector=$!
 
 		sleep 1
 	fi
@@ -423,7 +427,8 @@ do_transfer()
 
 	if $capture; then
 		sleep 1
-		kill $cappid
+		kill ${cappid_listener}
+		kill ${cappid_connector}
 	fi
 
 	local duration
Signature · 1 line
2.27.0.rc0
#3 lore raw
Quoted 65 lines · Matthieu Baerts

When investigating performance issues that involve latency/loss/reordering it is useful to have the pcap from the sender-side as it allows to easier infer the state of the sender's congestion-control, loss-recovery,...

Allow the selftests to capture a pcap on both sides so that this information is not lost when reproducing.

This patch also improves the file names. Instead of:

ns4-5ee79a56-X4O6gS-ns3-5ee79a56-X4O6gS-MPTCP-MPTCP-10.0.3.1.pcap

We now have something like:

5ee79a56-X4O6gS-ns3-ns4-MPTCP-MPTCP-10.0.3.1-10030-connector.pcap 5ee79a56-X4O6gS-ns3-ns4-MPTCP-MPTCP-10.0.3.1-10030-listener.pcap

It was a connection from ns3 to ns4, better to start with ns3 then. The port is also added, easier to find the trace we want.

Co-developed-by Christoph Paasch <cpaasch(a)apple.com>
Signed-off-by Christoph Paasch <cpaasch(a)apple.com>
Signed-off-by Matthieu Baerts <matthieu.baerts(a)tessares.net>

---

Notes:
As discussed on IRC, here is the patch I made this morning.

tools/testing/selftests/net/mptcp/mptcp_connect.sh | 13 +++++++++----

1 file changed, 9 insertions(+), 4 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.sh +9 -4
index 8f7145c413b9..c0589e071f20 100755
@@ -395,10 +395,14 @@ do_transfer()
 			capuser="-Z $SUDO_USER"
 		fi
 
-		local capfile="${listener_ns}-${connector_ns}-${cl_proto}-${srv_proto}-${connect_addr}.pcap"
+		local capfile="${rndh}-${connector_ns:0:3}-${listener_ns:0:3}-${cl_proto}-${srv_proto}-${connect_addr}-${port}"
+		local capopt="-i any -s 65535 -B 32768 ${capuser}"
 
-		ip netns exec ${listener_ns} tcpdump -i any -s 65535 -B 32768 $capuser -w $capfile > "$capout" 2>&1 &
-		local cappid=$!
+		ip netns exec ${listener_ns}  tcpdump ${capopt} -w "${capfile}-listener.pcap"  >> "${capout}" 2>&1 &
+		local cappid_listener=$!
+
+		ip netns exec ${connector_ns} tcpdump ${capopt} -w "${capfile}-connector.pcap" >> "${capout}" 2>&1 &
+		local cappid_connector=$!
 
 		sleep 1
 	fi
@@ -423,7 +427,8 @@ do_transfer()
 
 	if $capture; then
 		sleep 1
-		kill $cappid
+		kill ${cappid_listener}
+		kill ${cappid_connector}
 	fi
 
 	local duration
Signature · 1 line
2.27.0.rc0

Nice improvement for the capture feature - looks ready to merge!

Thanks,

--
Mat Martineau
Intel

#4 lore raw

Hi Mat, Christoph,

Quoted 22 lines · Mat Martineau
Quoted 19 lines · Matthieu Baerts

When investigating performance issues that involve latency/loss/reordering it is useful to have the pcap from the sender-side as it allows to easier infer the state of the sender's congestion-control, loss-recovery,...

Allow the selftests to capture a pcap on both sides so that this information is not lost when reproducing.

This patch also improves the file names. Instead of:

 ns4-5ee79a56-X4O6gS-ns3-5ee79a56-X4O6gS-MPTCP-MPTCP-10.0.3.1.pcap

We now have something like:

 5ee79a56-X4O6gS-ns3-ns4-MPTCP-MPTCP-10.0.3.1-10030-connector.pcap 5ee79a56-X4O6gS-ns3-ns4-MPTCP-MPTCP-10.0.3.1-10030-listener.pcap

It was a connection from ns3 to ns4, better to start with ns3 then. The port is also added, easier to find the trace we want.

(...)

Quoted 2 lines

Nice improvement for the capture feature - looks ready to merge!

Thank you for the review and the patch!

Just added at the end of the series (before the two DO-NOT-MERGE patches)

- a4c3a82f66d9: selftests/mptcp: Capture pcap on both sender and receiver

Tests will be launched soon.

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net