Page MenuHomeFreeBSD
Authored By
ae
Oct 5 2020, 1:54 PM
Size
1 KB
Referenced Files
None
Subscribers
None

patch-reuseport_lb

--- 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

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2826904
Default Alt Text
patch-reuseport_lb (1 KB)

Event Timeline