]> Cypherpunks repositories - gostls13.git/commit
syscall: use SOCK_CLOEXEC when creating sockets
authorLorenz Bauer <lmb@cloudflare.com>
Tue, 10 Dec 2019 15:58:24 +0000 (15:58 +0000)
committerIan Lance Taylor <iant@golang.org>
Wed, 11 Dec 2019 00:01:17 +0000 (00:01 +0000)
commit9c8c27a318459e76970a8ac0f171a8fc1a6ef5b9
tree17795c1b6977d2c38877268c02eb675d3b4f8071
parent84540f0b0acb4bb4c488b138345197c3e537d837
syscall: use SOCK_CLOEXEC when creating sockets

LsfSocket, SetLsfPromisc and NetlinkRIB currently don't force the CLOEXEC
flag on the sockets they create. While the former two functions are
deprecated, NetlinkRIB is called by various functions related to
net.Interface.

Add a helper to create CLOEXEC sockets, and use it from SetLsfPromisc and
NetlinkRIB. LsfSocket is unchanged since we don't want to break callers.

Fixes #36053

Change-Id: I72fe2b167996797698d8a44b0d28165045c42d3c
Reviewed-on: https://go-review.googlesource.com/c/go/+/210517
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/syscall/lsf_linux.go
src/syscall/netlink_linux.go
src/syscall/sock_cloexec_linux.go [new file with mode: 0644]