Currently the netlink link_linux.go sets all sorts of nlmsghdr
values like RTM_NETLINK/RTM_SETLINK, NLM_F_REQUEST and IFLA_*
values ifinfomsg.if_type, ifinfomsg.if_flags and ifinfomsg.if_change.
This is totally incorrect since they are meant to send through to
the kernel interface specific information and not generic netlink
data. Because of this the kernel is treating them for their
expected meaning and more than likely causing a lot of unintentional
consequences.
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
It looks little awkward, but should be enough for people who care about
defaults from kernel.
Fix#26
Also fixed bug with setting TxQLen for main device. It was never set
before.
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
IFA_LOCAL and IFA_ADDRESS are the same for bcast interfaces,
however for point-to-point links, IFA_ADDRESS is the remote
address while IFA_LOCAL is the interface address.
Creating a link in one namespace and then moving can
be problematic since there could be a iface name conflict.
However, it is not always possible to switch into the target
namespace either -- e.g. creating a macvlan interface must
be done in the namespace of the parent interface.
RouteAdd expects at least Dst.IP, Src, or Gw to be set, but accesses the
destination IP without testing for Dst being nil in the first place.
Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
Now interface is supposing that you setting protinfo attrs for link one
by one. But you can get all protinfo attrs with one call.
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
Added new `Protinfo` datastructure, which contains fields from
`IFLA_PROTINFO | NLA_F_NESTED`. It is not embedded to `LinkAttrs`
because we need to use `NLM_F_DUMP` requests to get that info.
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
As the documentation in this library is in pretty good shape, it's
worthwhile adding a link here to GoDoc.
Signed-off-by: Dave Tucker <dave@socketplane.io>
This provides the basic functionality of the iproute2 `route get`
command. It allows you to query netlink for the route to a destination
IP.Net
While implementing I noticed that the `s.Receive()` function was hanging
after the netlink response was recieved, so I added an additional clause
to break from the loop and return the decoded message if the NLM_F_MULTI
flag is not set.
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>