Commit 5c19c4e5 authored by Christopher Wedgwood's avatar Christopher Wedgwood Committed by Russ Cox

net: udp, implement BindToDevice

R=rsc
CC=golang-dev, r
https://golang.org/cl/1271041
parent 751fc425
......@@ -259,3 +259,13 @@ func ListenUDP(net string, laddr *UDPAddr) (c *UDPConn, err os.Error) {
}
return newUDPConn(fd), nil
}
// BindToDevice binds a UDPConn to a network interface.
func (c *UDPConn) BindToDevice(device string) os.Error {
if !c.ok() {
return os.EINVAL
}
c.fd.incref()
defer c.fd.decref()
return os.NewSyscallError("setsockopt", syscall.BindToDevice(c.fd.sysfd, device))
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment