Commit Graph

11 Commits

Author SHA1 Message Date
conjones 8f52b0b093 Add SetStrictCheck() method to NetlinkHandle
Allows the ability to set NETLINK_GET_STRICT_CHK socket option on netlink handles.

This can be used to avoid missing routes due to a kernel bug[1]. The
choice to make this a toggle is because not all operations use the
correctly formatted message and so some will fail. The scope of
determining which calls use the wrong message format is an unknown
amount of work at this time so we give the consumer of the library a
toggle they can use when needed.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=885b8b4dbba5ca6114db0fcd0737fe2512650745
2022-03-29 11:15:07 -05:00
TheDiveO 626202eca8 Provide handle Close() and deprecate Delete() 2021-09-18 09:03:48 -07:00
arthurchiao 9de6d08565 Allow to set/get netlink socket timeout for default handle
Ref: #613

Signed-off-by: arthurchiao <arthurchiao@hotmail.com>
2021-02-17 20:27:53 -08:00
CodeLingo Bot f504738125 Fix function comments based on best practices from Effective Go
Signed-off-by: CodeLingo Bot <bot@codelingo.io>
2019-03-19 09:31:22 -07:00
Ian Bishop 0e3b74dbe2 replace syscall with golang.org/x/sys/unix 2017-10-26 09:45:08 -07:00
Vincent Bernat 808afc82b2 handle: ability for force receive buffer size
This uses `SO_RCVBUFFORCE` instead of `SO_RCVBUF`. This requires to be
root and Linux 2.6.14.
2017-10-20 10:10:50 -07:00
Vincent Bernat ef84ebb87b handle: get/set receive buffer size
When receiving a lot of route changes (10,000 routes are enough), the
default receive buffer size (value of
`/proc/sys/net/core/rmem_default`) is too small and we get a `ENOBUF`
error. A user may want to increase the buffer size up to the value of
`/proc/sys/net/core/rmem_max` (by default, this is the same value). A
`SetSocketReceiveBufferSize()` function is provided to this
destination.

Possible improvements:

 1. automatically increase receive buffer size in higher level
    functions until we hit a maximum (get an error and/or the current
    value is smaller than expected)

 2. accept a "force" argument to use `SO_RCVBUFFORCE` to increase the
    value over `rmem_max` value
2017-10-20 10:10:50 -07:00
Flavio Crisciani 6177f17de7 Add method to set netlink recv timeout
If the socket is closed the recv that are waiting for messages
are not woken up. The result especially for Subscribe socket is
most likely a go routine leak.
This commit introduces a method to set the timeout

Signed-off-by: Flavio Crisciani <flavio.crisciani@docker.com>
2017-10-20 10:09:56 -07:00
Alessandro Boch 17ea11b5a1 Allow setting socket timeout on Handle
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-11-15 11:01:07 -08:00
Alessandro Boch 734d02c3e2 Allow to specify netlink families for Handle (#143)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-06-20 09:25:15 -07:00
Vish Ishaya 0bc457d244 fix darwin build by moving code (#138)
Fixes issue #135
2016-06-15 08:44:14 -07:00