multipath-tcp / mptcp

⚠️⚠️⚠️ Deprecated 🚫 Out-of-tree Linux Kernel implementation of MultiPath TCP. 👉 Use https://github.com/multipath-tcp/mptcp_net-next repo instead ⚠️⚠️⚠️
https://github.com/multipath-tcp/mptcp_net-next
Other
888 stars 335 forks source link

Operation not permitted when I set scheduler #388

Closed ken801 closed 4 years ago

ken801 commented 4 years ago

Hi everyone,

My question I could set any MPTCP scheduler with sysctl -w net.mptcp.mptcp_scheduler. Then, I tried to set "redundant" scheduler through the socket-option MPTCP_SCHEDULER. But I got "Operation not permitted (errno=1)".

char scheduler[] = "redundant"; setsockopt(fd, SOL_TCP, MPTCP_SCHEDULER, scheduler, sizeof(scheduler));

Could you please help me to solve this problem?

My MPTCP I have installed mptcpv0.95 on Ubuntu 16.04.6 LTS through AptRepository. https://multipath-tcp.org/pmwiki.php/Users/AptRepository

I configure routing with Automatic Configuration way. https://multipath-tcp.org/pmwiki.php/Users/ConfigureRouting

I visit http://amiusingmptcp.de/ and it seems my mptcp is working.

Test code My test code is here. I compile this and run as root. But "Operation not permitted (errno=1)" error occurs in the line setsockopt.

include

include <sys/types.h>

include <sys/socket.h>

include <netinet/in.h>

include <arpa/inet.h>

include

include <netinet/tcp.h>

include

include

int main() { int sockfd; struct sockaddr_in addr; int ret = 0;

if( (sockfd = socket( AF_INET, SOCK_STREAM, 0) ) < 0 ) {
    perror( "socket" );
}
addr.sin_family = AF_INET;
addr.sin_port = htons( 80 );
//https://multipath-tcp.org
addr.sin_addr.s_addr = inet_addr( "130.104.228.140" );

ret = connect( sockfd, (struct sockaddr *)&addr, sizeof( struct sockaddr_in ) );
printf("%d,%d,%s\n", ret, errno, strerror(errno));

sleep(5);

char scheduler[] = "redundant";
ret = setsockopt(sockfd, SOL_TCP, 43, scheduler, sizeof(scheduler));
printf("%d,%d,%s\n", ret, errno, strerror(errno));

close( sockfd );

return 0;

}

cpaasch commented 4 years ago

Hello,

you need to set the scheduler before the connect() call. Only on closed sockets we allow to change the scheduler.

Christoph