diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-25 18:10:52 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-05-25 18:10:52 +0200 |
commit | fbcd995ec1d2d3705c7665192341d05e35d21917 (patch) | |
tree | 599237199f84ff563b693aed14dab0a2046fd21a /device | |
parent | e7e286ba6cf7a952279d5007f71c7d38cb510610 (diff) |
device: darwin actually doesn't need bound interfaces
Diffstat (limited to 'device')
-rw-r--r-- | device/boundif_darwin.go | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/device/boundif_darwin.go b/device/boundif_darwin.go deleted file mode 100644 index a93441c..0000000 --- a/device/boundif_darwin.go +++ /dev/null @@ -1,44 +0,0 @@ -/* SPDX-License-Identifier: MIT - * - * Copyright (C) 2017-2019 WireGuard LLC. All Rights Reserved. - */ - -package device - -import ( - "golang.org/x/sys/unix" -) - -func (device *Device) BindSocketToInterface4(interfaceIndex uint32) error { - sysconn, err := device.net.bind.(*nativeBind).ipv4.SyscallConn() - if err != nil { - return nil - } - err2 := sysconn.Control(func(fd uintptr) { - err = unix.SetsockoptInt(int(fd), unix.IPPROTO_IP, unix.IP_BOUND_IF, int(interfaceIndex)) - }) - if err2 != nil { - return err2 - } - if err != nil { - return err - } - return nil -} - -func (device *Device) BindSocketToInterface6(interfaceIndex uint32) error { - sysconn, err := device.net.bind.(*nativeBind).ipv4.SyscallConn() - if err != nil { - return nil - } - err2 := sysconn.Control(func(fd uintptr) { - err = unix.SetsockoptInt(int(fd), unix.IPPROTO_IPV6, unix.IPV6_BOUND_IF, int(interfaceIndex)) - }) - if err2 != nil { - return err2 - } - if err != nil { - return err - } - return nil -} |