119 Commits

Author SHA1 Message Date
Jeroen Simonetti
31febcbb33
Change address message to ignore empty ip's (#74)
This will not marshal the following attributes when empty:
- Local (was already ignored)
- Broadcast
- Anycast
- Multicast

Fixes: #73

Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
2020-03-19 15:28:06 +01:00
Jeroen Simonetti
7a753270ee
Update go-test.yml (#72)
Add tests for go 1.14
2020-02-29 12:48:18 +01:00
Jeroen Simonetti
c1e6480802
Update go-test.yml
Run on PR also
2020-02-07 20:42:09 +01:00
Jeroen Simonetti
f846d4f6c1
Use github actions (#70)
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
2020-01-17 13:37:17 +01:00
Jeroen Simonetti
3b195764a9
Fix rtnl for macos (#71)
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
2020-01-17 13:13:10 +01:00
Matt Layher
1282c153f2 rtnetlink: expose Conn.SetReadDeadline (#69)
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2020-01-12 18:05:16 +01:00
Matt Layher
3521ae9f92 go.mod: github.com/mdlayher/netlink v1.0.0 (#68)
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2020-01-12 17:49:44 +01:00
Brad Beam
1b9462860a fix: Adjust route scope decision (#67)
Change route scope decision to be based on gateway. This should
make more sense because a link without a gateway should reside
on the same subnet.

Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
2019-12-23 09:40:07 +01:00
Brad Beam
87f74a6e05 fix: Use correct message type for Set (#64)
In looking through the documentation and iproute2 code, `RTM_SETLINK`
seems to only be used in a handful of special cases, whereas `RTM_NEWLINK`
is used across the board for both new link creation as well as modification.

Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
2019-12-11 18:11:48 +01:00
Timo Beckers
228b24473a rtnl - set 'host' scope when adding loopback addresses (#66)
Signed-off-by: Timo Beckers <timo@incline.eu>
2019-12-03 19:33:23 +01:00
Timo Beckers
5d027701a5 rtnl.(Must)ParseAddr and documentation fixes (#65)
* rtnl: add ParseAddr and MustParseAddr helpers, add usage examples

Signed-off-by: Timo Beckers <timo@incline.eu>

* addr_*_test - test ParseAddr and MustParseAddr

Signed-off-by: Timo Beckers <timo@incline.eu>

* Examples: use first ParseCIDR return value as IP address

Signed-off-by: Timo Beckers <timo@incline.eu>
2019-12-03 01:13:55 +01:00
Florian Lehner
d21b2cb70d resolve GOOS dependency (#63)
* resolve GOOS dependency

Signed-off-by: Lehner Florian <dev@der-flo.net>

* exclude internal constants from linter

Signed-off-by: Lehner Florian <dev@der-flo.net>
2019-10-19 19:25:34 +02:00
Jeroen Simonetti
51db9f1201
Skip tests on big-endian systems (#62)
To prevent having to maintain byte slices for both endian types
in our tests, we skip tests when running on big-endian systems.

Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
2019-10-09 19:23:56 +02:00
Jeroen Simonetti
5df73f7be7
Use netlink attribute en-/decoder infrastructure (#61)
Use netlink attribute en-/decoder infrastructure

This should pave the way for endian aware code.
Ref #56 

Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
2019-10-09 17:41:08 +02:00
Jeroen Simonetti
9eab139ca7 Add go-fuzz modules 2019-10-08 14:58:36 +02:00
Jeroen Simonetti
c0ab399d06 Add more corpus and use modules
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
2019-10-08 14:58:04 +02:00
Jeroen Simonetti
749bc8117f
Merge pull request #60 from Natolumin/rt_expire_uint
route: Implement support for RTA_EXPIRES
2019-10-04 11:51:26 +02:00
Anatole Denis
0b6465fc1b route: Implement support for RTA_EXPIRES
The RTA_EXPIRES attribute allows creating self-deleting routes; it is
useful for example when installing routes obtained from a DHCP lease.

The natural zero-value of the attribute needs special care, since it
means the route will be immediately deleted, a very different behaviour
from when the attribute is omitted (where the rule does never expire).
This means we need to separate these cases, which we do by using a
*uint32, where the nil value means the attribute is omitted and any
other values are passed as-is

Signed-off-by: Anatole Denis <anatole@unverle.fr>
2019-10-04 11:32:52 +02:00
Brad Beam
3784a6c7c5 feat(rtnl): Add better handling for route scope decisions (#58)
Signed-off-by: Brad Beam <brad.beam@talos-systems.com>
2019-08-30 11:01:07 +01:00
Jeroen Simonetti
9527aa8256
Merge pull request #55 from mdlayher/mdl-doc
rtnetlink: note rtnl package
2019-06-06 19:29:50 +02:00
Jeroen Simonetti
febdb25128
Merge pull request #54 from yarikk/rtnl
rtnl: add Neighbours integration test.
2019-06-06 19:25:55 +02:00
Matt Layher
1afb741c1b rtnetlink: note rtnl package
Signed-off-by: Matt Layher <mdlayher@gmail.com>
2019-06-06 10:32:40 -04:00
Yaroslav Kolomiiets
6e7d6532fc rtnl: extend integration tests to include Neighbours()
Signed-off-by: Yaroslav Kolomiiets <yarikos@gmail.com>
2019-06-06 15:25:42 +01:00
Jeroen Simonetti
8a08cb3e37
Merge pull request #53 from yarikk/rtnl
rtnl: only skip TestLiveAddrAddDel if EPERM, fail otherwise
2019-05-03 10:30:13 +02:00
Yaroslav Kolomiiets
f03390fac9 rtnl: only skip TestLiveAddrAddDel if EPERM, fail otherwise
Signed-off-by: Yaroslav Kolomiiets <yarikos@gmail.com>
2019-05-02 12:26:50 +01:00
Jeroen Simonetti
129aedc891
Merge pull request #52 from yarikk/rtnl
rtnl: add Addr* integration tests
2019-05-01 21:46:27 +02:00
Yaroslav Kolomiiets
f505b733d0 rtnl: AddrAdd: ensure v4 address format is used for AF_INET
Signed-off-by: Yaroslav Kolomiiets <yarikos@gmail.com>
2019-05-01 13:07:41 +01:00
Yaroslav Kolomiiets
cc931d0061 rtnl: fix bad IPMask returned in Addrs()
Signed-off-by: Yaroslav Kolomiiets <yarikos@gmail.com>
2019-05-01 13:07:31 +01:00
Yaroslav Kolomiiets
317cffa967 rtnl: add Addr* integration tests
Signed-off-by: Yaroslav Kolomiiets <yarikos@gmail.com>
2019-04-29 17:22:13 +01:00
Yaroslav Kolomiiets
3f81ed3888 Travis CI: run integration tests as root (required for certain netlink operations).
Signed-off-by: Yaroslav Kolomiiets <yarikos@gmail.com>
2019-04-29 14:56:33 +01:00
Jeroen Simonetti
99ed6b5c17
Merge pull request #51 from jsimonetti/add-stickler-config
Adding .stickler.yml configuration file
2019-04-29 11:06:57 +02:00
Jeroen Simonetti
3385185488 Ignore autogenerated stringers
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
2019-04-29 10:56:58 +02:00
Jeroen Simonetti
2bde3eceb7 Remove linter from travis 2019-04-29 10:55:08 +02:00
stickler-ci
ad2b532ba6 Adding .stickler.yml 2019-04-29 08:48:27 +00:00
insomniac
b8fe779e51
[rtnl] Remove unnecessary parameters from RouteDel (#50)
As discussed on https://github.com/jsimonetti/rtnetlink/pull/47

Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-04-27 15:41:53 +01:00
Jeroen Simonetti
9c67c27788
Merge pull request #47 from insomniacslk/master
[rtnl] Add RouteDel and RouteAddSrc
2019-04-27 10:09:27 +02:00
Andrea Barberio
c1c593ef5f [rtnl] Add RouteDel and RouteAddSrc
Added `RouteDel` to support route deletion.
Also added `RouteAddSrc` to support adding routes with a source parameter.

Signed-off-by: Andrea Barberio <insomniac@slackware.it>
2019-04-26 19:52:23 +01:00
insomniac
dcba605608
Merge pull request #46 from yarikk/rtnl
rtnl: do not drop error on Close() but leave to caller
2019-04-26 17:48:14 +01:00
Yaroslav Kolomiiets
690b790d9c rtnl: do not drop error on Close() but leave to caller
Signed-off-by: Yaroslav Kolomiiets <yarikos@gmail.com>
2019-04-26 17:43:25 +01:00
Jeroen Simonetti
7ae7eea153
Merge pull request #44 from yarikk/rtnl
add rtnl, the new high-level wrapper package
2019-04-26 16:52:46 +02:00
Yaroslav Kolomiiets
ac4930ec47 add rtnl, the new high-level wrapper package
Signed-off-by: Yaroslav Kolomiiets <yarikos@gmail.com>
2019-04-26 15:44:14 +01:00
Jeroen Simonetti
c7eca91d38
Merge pull request #45 from axatrax/Add_Link_Master_Attr
Added Master Attr to Links
2019-04-24 09:31:53 +02:00
Ryan Whelan
5802935ca8 Added Master Attr to Links
Allows enslaving ifaces to bridges.
Required the change to make MTU an optional attr to prevent EINVAL from the kernal. If we need to support setting the MTU to 0, the field will have to be a ptr on the LinkAttribute struct.
2019-04-23 22:26:53 -04:00
Jeroen Simonetti
c9e1f06ad4
Update README.md 2019-04-19 09:35:42 +02:00
Jeroen Simonetti
b8fc3fb8aa More corpus
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
2019-04-18 14:21:24 +02:00
Jeroen Simonetti
4096e6c437
Merge pull request #43 from OrdnanceNetworks/linkstats64
Support 64bit link stats
2019-04-18 13:52:28 +02:00
Yuri Pimenov
b03757ba37 Support 64bit link stats 2019-04-18 11:36:15 +03:00
Jeroen Simonetti
0f786e6013
Merge pull request #41 from axatrax/RouteService_GET
feat: Add Get() to RouteService
2019-04-18 10:19:55 +02:00
Ryan Whelan
cc66aab851 feat: Add Get() to RouteService - Add DumpFiltered flag to request 2019-04-17 10:36:31 -04:00
Ryan Whelan
5855e88896 feat: Add Get() to RouteService 2019-04-17 10:12:37 -04:00