libwebsockets icon indicating copy to clipboard operation
libwebsockets copied to clipboard

bind to interface using SO_BINDTODEVICE socket option on Linux platforms

Open siliconja opened this issue 9 months ago • 0 comments

Use the SO_BINDTODEVICE socket option on Linux platforms when binding lws sockets. Current behavior binds to an address on the interface when the interface is specified in lws_socket_bind(). This forces traffic over a certain interface, which can be useful for multi-homed systems.

This provides similar behavior to libcurl and c-ares libs. On Linux this requires elevated privileges, and failure to bind is non-fatal.

siliconja avatar Apr 29 '24 15:04 siliconja