Commit Graph

219 Commits

Author SHA1 Message Date
JC Martin
9438c6ff27 Add support for VTI and IPIP 2016-11-22 17:06:50 -08:00
Sylvain Baubeau
18675e4393 Expose LinkDeserialize function (#173) 2016-11-22 12:39:47 -08:00
Vishvananda Ishaya
ffec63e1f1 add support for LinkSetVfTxRate 2016-11-07 08:35:30 -08:00
Nicolas PLANEL
8b4e34d697 [link] add Link Encapsulation Type in LinkAttr
Retreive the link type from Netlink GetLink information.
Aim to return the same value as nl-link-list for example :

gre0 gre <noarp,up,running,lowerup> slave-of NONE group 0 ipgre : gre0
gretap0 ether <broadcast,multicast> slave-of NONE group 0 ipgre : gretap0
dummy0 ether 36:d5:87:cf:eb:35 <broadcast,noarp> group 0
tun0 none <pointopoint,multicast,noarp> group 0
tap0 ether 4e:ce:43:4a:82:c2 <broadcast,multicast> group 0

Signed-off-by: Nicolas PLANEL <nplanel@redhat.com>
2016-11-03 19:52:05 -07:00
Alessandro Boch
da7420cab5 Expose link's raw flags (#165)
- This is needed so that caller can check link's
  operational states.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-09-20 16:53:49 -07:00
Brenden Blanco
fadc1088f6 Add support for xdp set/get of a bpf program (#156)
* Add netlink definitions for extra IFLAs
  The relevant IFLA_* are defined in the kernel but not in the syscall
  package.
* Parameterize the return value of loadSimpleBpf
  Allow the return value of the bpf program created by loadSimpleBpf to
  be specified by the caller. Before this, the value was hardcoded to 1.
* Add support for a new IFLA that enables using a bpf program as a
  filter early in the driver path of some NICs.
* Add a test for set/get of an xdp program. Since currently, the XDP
  IFLA is optional, check that the hardware supports it before trying to
  set the field.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
2016-08-25 11:08:23 -07:00
Dmitry Shulyak
49a7353739 Add functions to turn on/off promiscuous mode for interface (#157)
Analogs for:
  ip l set dev eth0 promisc off
  ip l set dev eth0 promisc on
2016-08-13 01:45:45 -07:00
Lukas Redynk
4e67e44a40 Tuntap: support for non-default flags (#154)
* Tuntap: support for non-default flags

* Tuntap: tap device with default flags if no flags are provided
2016-07-29 08:59:01 -07:00
Evan Farrar
e73bad418f Changes GBP field to set a value of NULL when set. (#145)
Signed-off-by: Jay Dunkelberger <ldunkelberger@pivotal.io>
2016-06-29 12:57:46 -05:00
Alessandro Boch
fea1da6ef5 Allow to subscribe to events on a specfic netns (#142)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-06-29 11:11:35 -05:00
Vish Ishaya
0bc457d244 fix darwin build by moving code (#138)
Fixes issue #135
2016-06-15 08:44:14 -07:00
Manohar Castelino
fb4e4d39b4 fix macvtap interface mode setup (#137)
The mode on macvtap interfaces was not being set correctly.
Due to this the mode on macvtap is always set to default.

Set the mode correctly and add unit tests to check the same

This fixes issue https://github.com/vishvananda/netlink/issues/136

Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
2016-06-14 22:01:11 -07:00
Alessandro Boch
339261d114 Parse link statistics (#118)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-12 10:53:32 -07:00
Alessandro Boch
f116a3048a Use package empty handle for pkg APIs (#117)
- Package methods only need an empty handle.
  Not a regular Handle with a couple of
  sockets creation/delete.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-09 16:55:00 -07:00
Alessandro Boch
14f41c27fa Provide netlink handle (#104)
- Ties to a netlink socket. All client requests
  will re-use same socket. Socket released at
  handle deletion.
- Also network namespace can be specified during
  handle creation. Socket will be opened on the
  specified network namespace.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-08 11:35:49 -07:00
Vish Ishaya
d09ee68ad5 Make sure port is big endian (#111)
Fixes #107
2016-04-30 20:30:03 -07:00
Lei Jitang
5693665855 Typo: fix a typo in comment of LinkAdd method (#109)
Signed-off-by: Lei Jitang <leijitang@huawei.com>
2016-04-29 22:45:47 -07:00
Vishvananda Ishaya
377a621360 add SetVfHardwareAddr and SetVfVlan to link 2016-02-15 14:31:32 -08:00
Vish Ishaya
1281ba6af5 Merge pull request #82 from drzaeus77/nlmsghdr
Add syscall.NlMsghdr to LinkUpdate
2016-01-11 15:58:21 -08:00
Takashi Okamoto
06ac83f14a Support VXLAN udpcsum to enable UDP checksum in outer UDP header. 2016-01-09 11:11:08 +09:00
Brenden Blanco
5b0e1a0383 Add syscall.NlMsghdr to LinkUpdate
Some header fields are needed in order to use LinkSubscribe, for
instance it is useful to distinguish RTM_ADDLINK from RTM_DELLINK.
2015-12-22 21:19:51 -05:00
Manohar Castelino
3e9cd37dc3 Added support for setting all gretap parameters 2015-12-10 10:57:59 -08:00
Manohar Castelino
4dbdaec42d Merge remote-tracking branch 'krhubert_netlink/fixBond' 2015-12-10 09:44:36 -08:00
Manohar Castelino
40ccc37ce5 Resolved upstream merge conflicts 2015-12-10 09:36:26 -08:00
Hubert Krauze
0d84fd3936 Use NewLinkAttrs 2015-12-10 10:36:47 +01:00
Hubert Krauze
0fade0d7ec Fix build error 2015-12-10 10:34:34 +01:00
Vish Ishaya
8c46a90072 Merge pull request #78 from marek-polewski/bond
add bond interface support
2015-12-09 21:21:57 -08:00
Vish Ishaya
3b59128e69 Merge pull request #77 from krhubert/fixLinkAdd
Add link.Attrs().Flags during creating link
2015-12-09 21:19:43 -08:00
marek-polewski
656c395788 add bond interface support 2015-12-09 13:33:45 +01:00
Hubert Krauze
9f8d5e7e60 Add link.Attrs().Flags during creating link 2015-12-09 12:47:37 +01:00
Hubert Krauze
a88e39d806 Check if master Bridge exists when LinkSetMaster 2015-12-09 12:25:52 +01:00
Hubert Krauze
2f58676854 Create LinkSetNoMaster function 2015-12-09 12:25:42 +01:00
Manohar Castelino
f8776950ce Added support for creating gretap.
Equivalent to ip link add <name> type gretap local <localIP> remote <remoteIP> key <key>
2015-12-08 16:37:03 -08:00
Manohar Castelino
4c5782b0e9 Add support for alias set and retrieve interface by alias 2015-11-30 11:57:00 -08:00
Dimitri John Ledkov
11eac9d2ec gofmt fixes
Signed-off-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com>
2015-10-01 10:09:22 +01:00
Dimitri John Ledkov
de4cc349a5 Add basic support for TUN/TAP link type and creation. 2015-09-25 10:28:19 +01:00
Vish Ishaya
ecf47fd573 Merge pull request #46 from bboreham/subscribe
Async updates on links and routes
2015-09-15 10:05:05 -07:00
Bryan Boreham
69942a0c81 Subscribe for async updates on links and routes 2015-08-19 15:42:33 +01:00
Vishvananda Ishaya
687e6f0b07 add link ifb and fix macvtap 2015-08-18 14:06:35 -07:00
Vishvananda Ishaya
6d78150380 rename Generic to GenericLink and add missing macvtap 2015-08-18 03:16:06 -07:00
Vishvananda Ishaya
01bbbda86c set macvtap properly on parse 2015-08-15 10:16:04 -07:00
Vish Ishaya
4b5dce31de Merge pull request #43 from tgraf/master
Support for IFLA_VXLAN_GBP flag
2015-08-14 17:19:24 -07:00
Jana Radhakrishnan
5dd6b277e6 Do not set nlmsghdr data values in ifinfomsg fields
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>
2015-08-14 16:07:03 -07:00
Thomas Graf
c24b290c8f Support for IFLA_VXLAN_GBP flag
Signed-off-by: Thomas Graf <tgraf@suug.ch>
2015-07-31 13:48:03 +02:00
Alexander Morozov
607cdbafd6 Fix LinkSetDown comment
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-06-19 13:53:18 -07:00
Vish Ishaya
b1aa0245ac Merge pull request #37 from LK4D4/fix_golint
Fix some style issues as suggested by golint
2015-06-18 18:04:35 -07:00
Alexander Morozov
12f4097df1 Fix some style issues as suggested by golint
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-06-18 17:41:46 -07:00
Alexander Morozov
72a1f403a3 Add LinkAttrs constructor NewLinkAttrs
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>
2015-06-13 20:49:51 -07:00
Vish Ishaya
991a7a2fa7 Merge pull request #30 from marek-polewski/master
Stop discarding flags in RTM_SETLINK
2015-05-13 13:52:36 -07:00
Jonathan Boulle
231f3aa8aa Fix typo in docstring, LinkSetNsPid -> LinkSetNsFd 2015-05-01 15:26:43 -07:00
Marek Polewski
0207b6b633 Using Change = nl.DEFAULT_CHANGE = 0xffffff in RTM_SETLINK will discard some flags from the interface ( NOARP DYNAMIC etc) 2015-03-09 12:31:23 +01:00
Eugene Yakubovich
ae3e7dba57 added support for MACVLAN mode 2015-02-26 13:21:26 -08:00
Eugene Yakubovich
1fd3169564 Added ability to specify net ns at link creation
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.
2015-02-24 15:06:07 -08:00
Alexander Morozov
2e9d285a71 Change logic of setting protinfo attrs
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>
2015-02-17 14:16:48 -08:00
Alexander Morozov
bf7b359ebd Fix comments mistakes
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-02-12 11:12:05 -08:00
Alexander Morozov
d710fe886a IPVlan support
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2015-02-11 14:18:57 -08:00
Eugene Yakubovich
a59b20a402 honor MTU in LinkAdd 2015-02-06 18:30:52 -08:00
Dave Tucker
f9a4246807 Add LinkSetHardwareAddr
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2015-01-31 22:44:21 +00:00
Dave Tucker
085dc47dcc Add LinkSetName
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2015-01-31 22:44:01 +00:00
Alexander Morozov
f7f54f4512 Add TxQLen support
Signed-off-by: Alexander Morozov <lk4d4@docker.com>
2014-12-04 18:25:10 -08:00
Eugene Yakubovich
ffab401087 gofmt: style violations have crept up 2014-10-28 17:22:52 -07:00
Eugene Yakubovich
0e908ca36d Fallback to LinkList on LinkByName when needed
Older kernels (e.g. one shipped with RHEL 6.5) don't
support RTM_GETLINK with IFLA_IFNAME. In these cases
fallback to dumping all interfaces and filtering
in userspace.
2014-10-28 14:15:07 -07:00
Eugene Yakubovich
dd2d5f17ae vxlan bug fix: check VtepDevIndex when setting IFLA_VXLAN_LINK 2014-10-19 12:23:14 -07:00
Vishvananda Ishaya
50bae0e9af Update docstrings and make linkDeserialize private 2014-10-13 19:01:36 -07:00
Eugene Yakubovich
cc912bac14 avoid dumping all interfaces to look up one 2014-10-13 18:07:39 -07:00
Eugene Yakubovich
33e8718673 arp and vxlan support added 2014-10-13 11:04:09 -07:00
Vishvananda Ishaya
f87c54f846 Make links have different types 2014-09-24 16:32:16 -07:00
Vishvananda Ishaya
1a26b9f251 Move all low level calls into nl subpackage 2014-09-18 19:04:48 -07:00
Vishvananda Ishaya
8dab8b7462 Initial commit of netlink package 2014-08-31 20:34:46 -07:00