• Lorenz Bauer's avatar
    syscall: use SOCK_CLOEXEC when creating sockets · 9c8c27a3
    Lorenz Bauer authored
    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: default avatarIan Lance Taylor <iant@golang.org>
    9c8c27a3
lsf_linux.go 2.12 KB