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

[VPP-1089] VCL-LDPRELOAD: setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, ...) does nothing, therefore, getsockopt(...) does not confirm an expected change #135

Closed
vvalderrv opened this issue Jan 6, 2025 · 0 comments

Comments

@vvalderrv
Copy link
Contributor

  • VPP version: v18.01-rc0~442-ga3611a7
  • Stack backtraces:

For setsockopt:

#0  vppcom_session_attr (session_index=1, op=6, buffer=0x0, buflen=0x0) at /home/palmar/dev/vpp/build-data/../src/vcl/vppcom.c:3860
#1  0x00007ffff7985e75 in vcom_session_setsockopt (__sid=1, __level=1, __optname=2, __optval=0x7fffffffd244, __optlen=4) at /home/palmar/dev/vpp/build-data/../src/vcl/vcom_socket.c:2154
#2  0x00007ffff7986183 in vcom_socket_setsockopt (__fd=8, __level=1, __optname=2, __optval=0x7fffffffd244, __optlen=4) at /home/palmar/dev/vpp/build-data/../src/vcl/vcom_socket.c:2244
#3  0x00007ffff797d403 in vcom_setsockopt (__fd=8, __level=1, __optname=2, __optval=0x7fffffffd244, __optlen=4) at /home/palmar/dev/vpp/build-data/../src/vcl/vcom.c:2483
#4  0x00007ffff797d475 in setsockopt (__fd=8, __level=1, __optname=2, __optval=0x7fffffffd244, __optlen=4) at /home/palmar/dev/vpp/build-data/../src/vcl/vcom.c:2496
(...)

For getsockopt:

#0  vcom_socket_getsockopt (__fd=8, __level=1, __optname=2, __optval=0x7fffffffd248, __optlen=0x7fffffffd24c) at /home/palmar/dev/vpp/build-data/../src/vcl/vcom_socket.c:2080
#1  0x00007ffff797d2eb in vcom_getsockopt (__fd=8, __level=1, __optname=2, __optval=0x7fffffffd248, __optlen=0x7fffffffd24c) at /home/palmar/dev/vpp/build-data/../src/vcl/vcom.c:2439
#2  0x00007ffff797d35a in getsockopt (__fd=8, __level=1, __optname=2, __optval=0x7fffffffd248, __optlen=0x7fffffffd24c) at /home/palmar/dev/vpp/build-data/../src/vcl/vcom.c:2452
(...)

  • For completeness' sake: Our test case call the setsockopt and getsockopt from the following C++ gRPC code:

grpc/src/core/lib/iomgr/socket_utils_common_posix.cc:

grpc_error* grpc_set_socket_reuse_addr(int fd, int reuse) {
  int val = (reuse != 0);
  int newval;
  socklen_t intlen = sizeof(newval);
  if (0 != setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val))) {
    return GRPC_OS_ERROR(errno, "setsockopt(SO_REUSEADDR)");
  }
  if (0 != getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &newval, &intlen)) {
    return GRPC_OS_ERROR(errno, "getsockopt(SO_REUSEADDR)");
  }
  if ((newval != 0) != val) {
    return GRPC_ERROR_CREATE_FROM_STATIC_STRING("Failed to set SO_REUSEADDR");
  }

  return GRPC_ERROR_NONE;
}

 

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

1 participant