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 336 forks source link

Issue with calling getsockopt before bind #335

Closed dxoigmn closed 5 years ago

dxoigmn commented 5 years ago

I am debugging in an issue with gRPC which calls getsockopt before bind (see https://github.com/grpc/grpc/blob/master/src/core/lib/iomgr/tcp_server_utils_posix_common.cc#L165). When I run this program in Graphene, getsockopt fails because a pal_handle isn't assigned until bind is called. It seems like a pal_handle should be assigned earlier when socket is called. Below is a minimal test case.

#include <sys/socket.h>
#include <netinet/tcp.h>
#include <netinet/ip.h>
#include <unistd.h>
#include <assert.h>

int main(int argc, char **argv)
{
    int fd, ret, flags = 1;
    socklen_t len = sizeof(flags);

    fd = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
    ret = getsockopt(fd, SOL_TCP, TCP_NODELAY, (void *)&flags, &len);
    close(fd);

    assert(ret == 0);

    return ret;
}
dxoigmn commented 5 years ago

Wrong project. Too many tabs open :(