mirror of https://github.com/vishvananda/netlink
Add an accessor to the fd of the netlink socket
Giving a such access could be usefull in order to use the socket in a non-blocking way. This is especially useful when using it in a network namespace since the namespace can be deleted and one can be blocked in a Receive operation.
This commit is contained in:
parent
8e810149a2
commit
add4a8a814
|
@ -323,6 +323,10 @@ func (s *NetlinkSocket) Close() {
|
|||
syscall.Close(s.fd)
|
||||
}
|
||||
|
||||
func (s *NetlinkSocket) GetFd() int {
|
||||
return s.fd
|
||||
}
|
||||
|
||||
func (s *NetlinkSocket) Send(request *NetlinkRequest) error {
|
||||
if err := syscall.Sendto(s.fd, request.Serialize(), 0, &s.lsa); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue