Commit Graph

238 Commits

Author SHA1 Message Date
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
Brenden Blanco
809f74071b Fix 32bit warnings in bpf_linux.go
The underlying struct type is still u64 regardless of architecture, but
the local cast should be to uintptr_t to squelch the warning.
2016-03-18 11:13:40 -07:00
Everton Marques
0499fc4776 Merge remote-tracking branch 'upstream/master' 2016-03-18 14:45:31 -03:00
Vish Ishaya
4fdf23c882 Merge pull request #94 from drzaeus77/master
Add support for BPF filters and actions
2016-03-05 16:02:02 -08:00
Brenden Blanco
719d8ca65a Skip test if bpf syscall is unavailable 2016-02-28 23:52:26 -08:00
Brenden Blanco
17b1e35dbc Add clsact and bpf filter support
New in kernel 4.5 is a type of qdisc for lightweight (no qdisc lock)
ingress/egress parsing, called clsact. Add support for such a qdisc
type.

One primary consumer of clsact is the bpf filter, add support for that
as well.
2016-02-28 23:20:29 -08:00
Brenden Blanco
6f0327edfd Add BPF TcAction support to U32 filter
Current U32 filter only supports redirect action, but the U32 can
support a lot more. Refactor a bit the action generating/parsing logic
to be more generic and add BPF action support.

When creating a U32 filter, one can supply an array of Actions, which
will be executed by the U32 filter in order:
* The new MirredAction implements the same functionality as RedirIndex
  field in the U32 filter, with that static field kept in the struct for
  backwards compatibility.
* A new BpfAction type is added which allows a program with an open bpf
  file descriptor (implementation is out of scope of this patch) to be
  added as well.

Add a test for the above use case which includes one of each type of
action.
2016-02-28 23:12:34 -08:00
Brenden Blanco
1f71a4c2a6 Add some missing tc act flags and structs
Add structs and constants for tca_act_bpf.

Generalize the tc_gen macro as a go struct.
2016-02-26 15:08:04 -08:00
Vish Ishaya
814b43a0c7 Merge pull request #92 from aakso/master
Add support for setting route flags back
2016-02-26 09:06:57 -08:00
Anton Aksola
7ff102806b Add support for setting route flags back
Removed in dfdad47 probably unintentionally.

resolves #93
2016-02-23 13:13:02 +02:00
Vish Ishaya
631962935b Merge pull request #91 from liusdu/git-rid-of
RFC: force AddList to get rid of unexpected information
2016-02-23 01:12:47 -08:00
Vishvananda Ishaya
377a621360 add SetVfHardwareAddr and SetVfVlan to link 2016-02-15 14:31:32 -08:00
Liu Hua
8580636726 add test for addList with wrong family number
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
2016-02-14 15:01:37 +00:00
Liu Hua
89b71e9bbf force AddList to get rid of unexpected information
Signed-off-by: Liu Hua <sdu.liu@huawei.com>
2016-02-14 14:04:38 +00:00