Skip to content

Commit 995d7da

Browse files
committed
Auto merge of #1078 - johalun:so_reuseport_lb, r=alexcrichton
Add new FreeBSD socket option SO_REUSEPORT_LB. FreeBSD 12, which is scheduled to be released soon, has a new socket option SO_REUSEPORT_LB. From setsockopt man page: SO_REUSEPORT_LB allows completely duplicate bindings by multiple processes if they all set SO_REUSEPORT_LB before binding the port. Incoming TCP and UDP connections are distributed among the sharing processes based on a hash function of local port number, foreign IP address and port number. A maximum of 256 processes can share one socket.
2 parents caee856 + f80b024 commit 995d7da

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

libc-test/build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,8 @@ fn main() {
556556
"PD_CLOEXEC" | "PD_ALLOWED_AT_FORK" if freebsd => true,
557557

558558
// These constants were added in FreeBSD 12
559-
"SF_USER_READAHEAD" if freebsd => true,
559+
"SF_USER_READAHEAD" |
560+
"SO_REUSEPORT_LB" if freebsd => true,
560561

561562
// These OSX constants are removed in Sierra.
562563
// https://developer.apple.com/library/content/releasenotes/General/APIDiffsMacOS10_12/Swift/Darwin.html

src/unix/bsd/freebsdlike/freebsd/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,7 @@ pub const JAIL_SYS_INHERIT: ::c_int = 2;
457457
pub const SO_BINTIME: ::c_int = 0x2000;
458458
pub const SO_NO_OFFLOAD: ::c_int = 0x4000;
459459
pub const SO_NO_DDP: ::c_int = 0x8000;
460+
pub const SO_REUSEPORT_LB: ::c_int = 0x10000;
460461
pub const SO_LABEL: ::c_int = 0x1009;
461462
pub const SO_PEERLABEL: ::c_int = 0x1010;
462463
pub const SO_LISTENQLIMIT: ::c_int = 0x1011;

0 commit comments

Comments
 (0)