Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F9577678
patch-reuseport_lb
ae (Andrey V. Elsukov)
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
ae
Oct 5 2020, 1:54 PM
2020-10-05 13:54:10 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
patch-reuseport_lb
View Options
--- src/openvpn/options.c 2019-05-16 14:22:26.171060000 +0300
+++ src/openvpn/options.c 2019-05-16 15:24:34.439341000 +0300
@@ -5820,6 +5820,10 @@
{
options->sockflags |= SF_TCP_NODELAY;
}
+ else if (streq(p[j], "SO_REUSEPORT_LB"))
+ {
+ options->sockflags |= SF_USE_REUSEPORT_LB;
+ }
else
{
msg(msglevel, "unknown socket flag: %s", p[j]);
--- src/openvpn/socket.c 2019-05-16 14:22:26.150629000 +0300
+++ src/openvpn/socket.c 2019-05-16 15:41:38.422233000 +0300
@@ -1070,7 +1070,16 @@
}
}
#endif /* if ENABLE_IP_PKTINFO */
-
+#ifdef SO_REUSEPORT_LB
+ if (flags & SF_USE_REUSEPORT_LB){
+ int on = 1;
+ if (setsockopt(sd, SOL_SOCKET, SO_REUSEPORT_LB,
+ (void *) &on, sizeof(on)) < 0)
+ {
+ msg(M_ERR, "UDP: Cannot setsockopt SO_REUSEPORT_LB on UDP socket");
+ }
+ }
+#endif /* if SO_REUSEPORT_LB */
/* set socket file descriptor to not pass across execs, so that
* scripts don't have access to it */
set_cloexec(sd);
--- src/openvpn/socket.h 2019-05-16 14:22:26.185056000 +0300
+++ src/openvpn/socket.h 2019-05-16 15:22:00.221319000 +0300
@@ -210,6 +210,7 @@
#define SF_PORT_SHARE (1<<2)
#define SF_HOST_RANDOMIZE (1<<3)
#define SF_GETADDRINFO_DGRAM (1<<4)
+#define SF_USE_REUSEPORT_LB (1<<5)
unsigned int sockflags;
int mark;
File Metadata
Details
Attached
Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2826904
Default Alt Text
patch-reuseport_lb (1 KB)
Attached To
Mode
D26672: [RFC] Implement sticky SO_REUSEPORT_LB socket option
Attached
Detach File
Event Timeline
Log In to Comment