diff options
Diffstat (limited to 'src/net/mptcpsock_linux_test.go')
-rw-r--r-- | src/net/mptcpsock_linux_test.go | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/src/net/mptcpsock_linux_test.go b/src/net/mptcpsock_linux_test.go index 11543b0c8c..bf8fc951c5 100644 --- a/src/net/mptcpsock_linux_test.go +++ b/src/net/mptcpsock_linux_test.go @@ -40,11 +40,28 @@ func postAcceptMPTCP(ls *localServer, ch chan<- error) { c := ls.cl[0] - _, ok := c.(*TCPConn) + tcp, ok := c.(*TCPConn) if !ok { ch <- errors.New("struct is not a TCPConn") return } + + mptcp, err := tcp.MultipathTCP() + if err != nil { + ch <- err + return + } + + if !mptcp { + ch <- errors.New("incoming connection is not with MPTCP") + return + } + + // Also check the method for the older kernels if not tested before + if hasSOLMPTCP && !isUsingMPTCPProto(tcp.fd) { + ch <- errors.New("incoming connection is not an MPTCP proto") + return + } } func dialerMPTCP(t *testing.T, addr string) { @@ -64,7 +81,7 @@ func dialerMPTCP(t *testing.T, addr string) { } defer c.Close() - _, ok := c.(*TCPConn) + tcp, ok := c.(*TCPConn) if !ok { t.Fatal("struct is not a TCPConn") } @@ -82,7 +99,21 @@ func dialerMPTCP(t *testing.T, addr string) { t.Errorf("sent bytes (%s) are different from received ones (%s)", snt, b) } - t.Logf("outgoing connection from %s with mptcp", addr) + mptcp, err := tcp.MultipathTCP() + if err != nil { + t.Fatal(err) + } + + t.Logf("outgoing connection from %s with mptcp: %t", addr, mptcp) + + if !mptcp { + t.Error("outgoing connection is not with MPTCP") + } + + // Also check the method for the older kernels if not tested before + if hasSOLMPTCP && !isUsingMPTCPProto(tcp.fd) { + t.Error("outgoing connection is not an MPTCP proto") + } } func canCreateMPTCPSocket() bool { |