Commit Graph

30 Commits

Author SHA1 Message Date
Maxime Soulé 7f562ed576 RouteUpdate gains NlFlags field
It allows to distinguish between a new created route or a replaced one.

Signed-off-by: Maxime Soulé <btik-git@scoubidou.com>
2024-03-01 13:06:15 -08:00
open-cmi 6bb6f8abbc fix: build failed on macos when use RT_FILTER_TABLE 2022-03-29 11:19:33 -05:00
Tobias Urdin 65349edba8 Add support for RTA_FLOW
This adds support for the RTA_FLOW routing msg
attribute and adds the Realm field to the Route
object.
2021-09-20 10:45:34 -07:00
Oliver Geiselhardt-Herms d1fad16de5 Expose AFI on routes 2021-07-03 11:44:51 +02:00
Joe Stringer c21bda41e9 Fix non-linux build
Commit ec93726159 ("Adds strings translation methods") broke non-Linux
builds by relying on unix constants that are only declared on the linux
platform in the upstream x/sys/unix package.

Other platforms report undefined variables, such as the following:

  $ GOOS=darwin go build .
  # github.com/vishvananda/netlink
  ./route.go:17:7: undefined: SCOPE_UNIVERSE
  ./route.go:19:7: undefined: SCOPE_SITE
  ./route.go:21:7: undefined: SCOPE_LINK
  ./route.go:23:7: undefined: SCOPE_HOST
  ./route.go:25:7: undefined: SCOPE_NOWHERE
  ./route.go:55:7: undefined: unix.RTPROT_BABEL
  ./route.go:57:7: undefined: unix.RTPROT_BGP
  ./route.go:59:7: undefined: unix.RTPROT_BIRD
  ./route.go:61:7: undefined: unix.RTPROT_BOOT
  ./route.go:63:7: undefined: unix.RTPROT_DHCP
  ./route.go:63:7: too many errors

Move the platform-specific implementations to platform-specific files
and add stubs to satisfy other platforms.

Fixes: ec93726159 ("Adds strings translation methods")
Signed-off-by: Joe Stringer <joe@cilium.io>
2021-03-16 07:45:50 -07:00
Riccardo Manfrin ec93726159 Adds strings translation methods
RTPROT_KEEPALIVED is commented to interop with earlier go versions (1.13, 1.14)
2021-03-04 14:52:04 -08:00
Steve Shaw fbe60771a0 Adding support for RTA_VIA
Signed-off-by: Steve Shaw <shaw38@gmail.com>
2020-12-03 10:12:37 -08:00
bianze fb953eb4ce Add whole route metrics for netlink
There are lots of route metrics to be added, such as rto_min,
quick_ack and so on, and these metrics are useful for users to
tune network performance, so we add all these metrics.

Signed-off-by: bianze <bianze1993@gmail.com>
2020-10-19 15:37:56 -04:00
Magesh GV 1404979ff6 Add support for hoplimit metric in routes 2018-10-16 12:33:37 -07:00
Vishvananda Ishaya Abrams 63ca7e48f5 Support setting and retrieving route MTU/AdvMSS 2017-11-09 14:04:31 -08:00
Vincent Bernat cda96d38a7 route: add `Equal()` method to compare routes
All fields are compared for strict equality.
2017-09-24 11:00:50 -07:00
Vincent Bernat bda7895ec3 route: introduce `ipNetEqual()` helper function
This tests equality between two IPNet pointers.
2017-09-24 11:00:50 -07:00
Vincent Bernat 067fdf3bb1 route: fix display of nexthop gateway for multipath routes
This is a `net.IP` and therefore, we should use `%s`. Using `%d` gives
something like this:

    Gw: [0 0 0 0 0 0 0 0 0 0 255 255 192 168 24 2]

After this fix, we get:

    Gw: 192.168.24.2
2017-09-24 11:00:10 -07:00
ISHIDA Wataru fe3b5664d2 support MPLS
$ ip -M route add 100 dev eth0
$ ip -M route add 100 as to 200/300 dev eth0
$ ip -M route add 100 nexthop dev eth0 as to 200 \
                      nexthop dev eth1 as to 300
$ ip route add 10.10.0.0/24 encap mpls 200/300 dev eth0
$ ip route add 10.0.0.0/24 nexthop encap mpls 200 dev eth0 \
                           nexthop encap mpls 300 dev eth1

Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2017-02-20 12:07:19 -08:00
Wataru Ishida 87909c6dad Add Flags in NexthopInfo
Signed-off-by: Wataru Ishida <ishida.wataru@lab.ntt.co.jp>
2017-02-13 13:53:26 -08:00
Vish Ishaya 0bc457d244 fix darwin build by moving code (#138)
Fixes issue #135
2016-06-15 08:44:14 -07:00
Wataru Ishida 01c64f1d8a Support multipath (#134)
Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
2016-06-14 22:02:24 -07:00
GennadySpb 3236dc177e Add route table number as significant info about route object (#103) 2016-04-28 13:16:53 -07:00
Everton Marques afa33d45e9 AddrSubscribe(): receive updates for changes in link addresses. 2016-01-28 17:27:24 -02:00
marek-polewski 889a43b83d remove routeFilter struct and use route and mask instead
rename iif to iLinkIndex
2015-12-08 23:35:55 +01:00
marek-polewski dfdad47336 add protocol, priority, table, type, tos to route 2015-11-26 16:09:33 +01:00
Anton Aksola a2c125fb6c Add support for setting nexthop flags for routes
There are few nexthop flags that are usable in some scenarios: onlink
and pervasive. This patch allows to set, clear and list them.
2015-10-09 11:17:13 +03:00
Bryan Boreham 69942a0c81 Subscribe for async updates on links and routes 2015-08-19 15:42:33 +01:00
Vishvananda Ishaya 7663a3b4b6 Dst may be nil, so don't force it to String()
Fixes #14
2015-01-14 07:59:00 -08:00
Eugene Yakubovich e7911d879f Use LinkIndex instead of Link obj in Route, Neigh
Having object composition causes both client and library to
do potentially unecessary work to retrieve Link attributes
when only index is often sufficient.
2014-10-13 16:09:09 -07:00
Vishvananda Ishaya f87c54f846 Make links have different types 2014-09-24 16:32:16 -07:00
Vishvananda Ishaya 349cca1850 Formatting cleanup 2014-09-15 17:06:08 -07:00
Vishvananda Ishaya 950b852cad Add scope parameter to route 2014-09-14 17:44:56 -07:00
Vishvananda Ishaya 9f98335fb3 Change route to hold pointers to structs 2014-09-07 11:27:46 -07:00
Vishvananda Ishaya 8dab8b7462 Initial commit of netlink package 2014-08-31 20:34:46 -07:00