13 Commits

Author SHA1 Message Date
Tom Denham
726c6b4578 pkg/ip: Ensure that SetupVeth returns correct hostVeth
The veth is moved from the container NS to the host NS.
This is handled by the code that sets the link to UP but the wrong
hostVeth is returned to the calling code.
2016-08-31 14:17:25 -07:00
Prateek Gogia
ad8a052dd3 pkg/ip: Return correct error if container name provided exists, and test cases
If interface name for a container provided by a user is already present,
Veth creation fails with incorrect error.
If os.IsExist error is returned by makeVethPair:
* Check for peer name, if exists generate another random peer name,
* else, IsExist error is due to container interface present, return error.

Fixes #155
2016-08-11 18:51:03 +00:00
Stefan Junker
7d19c01818 pkg/ip: use iface name in SetHWAddrByIP 2016-07-22 15:34:53 -07:00
Stefan Junker
924b30b57d plugins: set MAC addresses based on IP
This will give deterministic MAC addresses for all interfaces CNI
creates and manages the IP for:
* bridge: container veth and host bridge
* macvlan: container veth
* ptp: container veth and host veth
2016-07-22 15:34:53 -07:00
Dan Williams
c0d34c692f ns: add interface, use it, and fix thread-related namespace switch issues
Add a namespace object interface for somewhat cleaner code when
creating and switching between network namespaces.  All created
namespaces are now mounted in /var/run/netns to ensure they
have persistent inodes and paths that can be passed around
between plugin components without relying on the current namespace
being correct.

Also remove the thread-locking arguments from the ns package
per https://github.com/appc/cni/issues/183 by doing all the namespace
changes in a separate goroutine that locks/unlocks itself, instead of
the caller having to track OS thread locking.
2016-05-20 17:10:25 -05:00
Stefan Junker
ed5f8dfeb2 *: appc/cni -> containernetworking/cni
The project has been moved so internally we simply rename everything.
Consumers are recommended to update their vendored version of cni.
2016-05-06 16:40:27 +02:00
Eugene Yakubovich
0becca2e96 Change copyright from CoreOS to CNI authors
CNI is developed by more than just CoreOS, Inc
and the copyright is retained by all CNI
contributors (for their respective contributed code).
2015-09-29 11:51:33 -07:00
Stefan Junker
5b7aa09e52 link: switch to host netns to set up host veth end 2015-09-24 18:49:27 +02:00
Stefan Junker
f1c9c632e1 Revert "plugins/ptp: allow host veth to be UP"
This reverts commit 231d2d5a27f3ba54219c3f0b1c8ef2c5dab4faaf.
2015-09-24 18:32:18 +02:00
Stefan Junker
231d2d5a27 plugins/ptp: allow host veth to be UP 2015-09-24 10:57:36 +02:00
Eugene Yakubovich
16680be42d No more path rewriting
Path rewriting causes too many problems when vendoring
vendored code. When CNI code is vendored into rkt,
godep has problems code already vendored by CNI.
2015-06-12 16:29:18 -07:00
Eugene Yakubovich
b2d9801b25 Do not use netns as ID or for entropy
ContainerID is now required so use that
or generate random bytes.

Fixes #5
2015-05-08 15:02:23 -07:00
Eugene Yakubovich
88377fa346 Add plugin code
This adds basic plugins.
"main" types: veth, bridge, macvlan
"ipam" type: host-local

The code has been ported over from github.com/coreos/rkt project
and adapted to fit the CNI spec.
2015-04-27 14:14:29 -07:00