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:
Sylvain Afchain 2015-11-05 10:57:17 +01:00
parent 8e810149a2
commit add4a8a814
1 changed files with 4 additions and 0 deletions

View File

@ -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