Commit Graph

301 Commits

Author SHA1 Message Date
Kojima Takanori
e1813385ef Fix bug in ruleHandle: allocate different buffers for each rtattr 2016-11-03 19:48:18 -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
Alexander Morozov
63381f39fc filter: fix recursive string call (#162)
Signed-off-by: Alexander Morozov <lk4d4math@gmail.com>
2016-08-25 11:08:35 -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
CtrlZvi
d710fbade4 Add proxy support to the neighbor functions (#149)
- Don't require a MAC address for a neighbor proxy
- Include proxies in the list of neighbors

Signed-off-by: Zvi "CtrlZvi" Effron <viz+GitHub@flippedperspective.com>
2016-08-23 16:01:24 -07:00
Kunihiro Ishiguro
d631d40de2 Multipath route is not installed due to gwData is newly allocated in block. (#159) 2016-08-23 15:58:51 -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
Alessandro Boch
9dee363ad4 Fix bug in xfrmStateGetOrDelete (#155)
- It fails if source address attribute
  is passed in 4 byte notation

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-07-29 08:59:42 -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
Alessandro Boch
2b8dd8b419 Add support for Authenticated Encryption with Associated Data (AEAD) (#147)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-06-29 11:10:41 -05:00
Vishvananda Ishaya
77483a0e69 export encode actions 2016-06-25 10:58:55 -07: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
Guy Menanteau
293adec041 key len is arch dependant (ppc64 big endian build problem)
Key length used in DeserializeSerialise XfrmAlgo tests is
endianess dependant. Correction needed to have
TestXfrmAlgoDeserializeSerialize and
TestXfrmAlgoAuthDeserializeSerialize
pass ok on ppc64 arch (big endian).
2016-06-15 10:08:51 -07: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
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
Joe Farrell
5fbc8a02d1 Fixed typos in README and docstrings (#132) 2016-06-14 22:00:46 -07:00
Vish Ishaya
7995ff5647 add generic actions and simplify action type (#129) 2016-05-31 13:03:47 -07:00
Vish Ishaya
e299ab1a58 return unknown filters in FilterList (#128) 2016-05-25 16:35:51 -07:00
Alessandro Boch
9b552a7a61 Allow SPI to be passed in policy template (#127)
- It is part of the ID and it is needed when you
  program policies for different SAs which share
  same src and dst

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-25 11:10:56 -07:00
Alessandro Boch
388bbd0e99 Xfrm selector must discard 0 value src/dst ports (#126)
- by not setting their full bitmask

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-25 11:10:01 -07:00
Brenden Blanco
2ce23437df Invalidate NetlinkSocket fd after close (#125)
An issue happens when netlink.LinkSubscribe is called back to back, even
when there is a Close() of the netlink socket (via the done chan
parameter). The issue seems to stem from the fact that after the
close/open happen together, the same fd is allocated. This lets the
s.Receive() calls succeed in more than one goroutine, which causes the
updates to issue randomly since the same fd has multiple readers and the
original Subscribe never finishes.

After a Close(), mark the Socket as invalid (-1) so that calls to
Send()/Receive() will fail going forward.

Signed-off-by: Brenden Blanco <bblanco@plumgrid.com>
2016-05-23 15:44:24 -07:00
Alessandro Boch
b824519a9a Serialize Handle's sockets access (#124)
- So that the same handle can be used
  by multiple threads

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-18 10:21:46 -07:00
Alessandro Boch
6dd9989b51 Allow user to set xfrm state limits (#123)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-18 10:20:27 -07:00
Alessandro Boch
f9bc7a684e Support xfrm state/policy flush (#122)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-13 16:42:24 -07:00
Alessandro Boch
d975f28755 XFRM Get/Delete state/policy should share same code (#119)
- Currently they are not and GET methods are passing
  the wrong structure. Also they are setting the incorrect
  XFRM_F_DUMP flag. Because of this, current get methods
  do not return expected error when query target is not found.

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-12 13:16:26 -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
ef0e63f64d Fix a bug in selFromPolicy() (#120)
- It assumes Src and Dst *ipNet are always specified

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-12 10:52:20 -07:00
Alessandro Boch
259a962435 Properly pass IP address flags (#121)
- during ip address configuration

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-12 10:51:33 -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
e361359783 Add String() method to user structures (#116)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-09 16:53:16 -07:00
Alessandro Boch
cb0b035c41 Provide method to query for specific policy (#115)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-09 16:52:35 -07:00
Alessandro Boch
a123807666 Allow to program L4 fields in policy selector (#113)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-09 09:19:18 -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
Alessandro Boch
096107b4d7 Implement ip xfrm state get (#114)
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-08 11:32:17 -07:00
Alessandro Boch
7ec3682687 Support xfrm state/policy update
Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-05-03 22:52:55 -07:00
Alessandro Boch
18e9389da5 Add Mark field to xrfm state and policy (#110)
* Add Mark to xrfm state

Signed-off-by: Alessandro Boch <aboch@docker.com>

* Add Mark to xfrm policies

Signed-off-by: Alessandro Boch <aboch@docker.com>
2016-04-30 20:31:59 -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
GennadySpb
3236dc177e Add route table number as significant info about route object (#103) 2016-04-28 13:16:53 -07:00
Vish Ishaya
a632d6dc28 Merge pull request #101 from udhos/master
Fix return of address family in parseAddr helper.
2016-04-05 13:35:17 -07:00
Everton Marques
7f8533eaaf Filter address family correctly in AddrList() based on message family. 2016-03-22 21:46:16 -03:00
Everton Marques
148ac55d0a Fix return of address family in parseAddr helper.
I broke return of family in commit 9462941794
2016-03-21 14:14:59 -03:00
Vishvananda Ishaya
adb0f53af6 Cleanup from golint and go vet 2016-03-19 17:12:26 -07:00
Vish Ishaya
d4955d161c Merge pull request #100 from drzaeus77/master
Fix 32bit warnings in bpf_linux.go
2016-03-18 18:11:41 -07:00
Vish Ishaya
bd7a2d8c10 Merge pull request #90 from udhos/master
AddrSubscribe(): receive updates for changes in link addresses.
2016-03-18 18:11:19 -07:00
Everton Marques
988716e658 Return correct underlying error. 2016-03-18 18:08:51 -03:00
Everton Marques
9462941794 Move common code from AddrList,AddrSubscribe into new helper func parseAddr. 2016-03-18 17:44:53 -03:00