Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring keepalive for unix domain socket. #3

Open
edineshkumar opened this issue Dec 15, 2020 · 1 comment
Open

Configuring keepalive for unix domain socket. #3

edineshkumar opened this issue Dec 15, 2020 · 1 comment

Comments

@edineshkumar
Copy link

How can I configure keepalive in unix domain socket for 120sec time period ?

I tried below steps in nbd-proxy.c file, under static int open_nbd_socket(struct ctx *ctx) function:

After socket( );

int idle = 120, interval = 5, maxpkt = 5, optval=1;
step 1: setsockopt(sd, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optlval)); // Enabling Keepalive
step 2: setsockopt(sd, SOL_TCP, TCP_KEEPIDLE, &idle, sizeof(idle) ); // Overwrite keepidle from default.
step 3: setsockopt(sd, SOL_TCP, TCP_KEEPINTVL, &interval, sizeof(interval) ); // Overwrite keepintvl from default.
step 4: setsockopt(sd, SOL_TCP, TCP_KEEPCNT, &maxpkt, sizeof(maxpkt) ); // Overwrite keepcnt from default.

Enabling SO_KEEPALIVE has been success, but over write TCP_KEEPIDLE TCP_KEEPINTVL and TCP_KEEPCNT is not getting success, I am getting error like 'Operation not supported' .

Kindly give some inputs to configuring the same .

@jk-ozlabs
Copy link
Member

Yep, this is a unix domain socket - so the TCP sockopts do not apply here.

More generally though: there's no such thing as a keepalive for an AF_UNIX socket anyway. Can you explain a little about what you're trying to achieve here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants