13 Commits

Author SHA1 Message Date
Pengfei Ni
bd341ab5d1 pkg/ns: fix misspelling in comment 2016-06-14 09:52:58 -07:00
Stefan Junker
3a4124d257 pkg/ns: introduce error types indicate NS verification 2016-05-27 13:50:16 +02:00
Stefan Junker
2d47b0396d pkg/ns: consider PROCFS during NS verification
This is an attempt to bring compatibility with Kernel <3.19, where NSFS
where PROCFS was used for network namespaces.
2016-05-26 12:42:50 +02:00
Stefan Junker
39eace3c38 pkg/ns: verify netns when initialized with GetNS 2016-05-24 22:30:49 +02:00
Stefan Junker
40440ec887 pkg/ns: don't allow operations after Close() 2016-05-24 20:52:00 +02:00
Dan Williams
f2922c5c1f 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
Angus Lees
734bf1ba5b pkg/ns: evaluate syscall number at compile-time
Previously this code used a run-time map lookup keyed by
runtime.GOOS/GOARCH.  This version uses conditional compilation to make
this choice at compile time, giving immediate feedback for unsupported
platforms.
2016-05-19 12:06:37 +02:00
Angus Lees
5978cf8b88 pkg/ns: use correct syscall number on arm 2016-05-19 12:06:37 +02:00
Gabe Rosenhouse
ca978caee7 Update docstring on WithNetNS 2016-03-15 08:37:00 -07:00
Gabe Rosenhouse
b99854d124 WithNetNS restores original namespace when callback errors
- adds test coverage of WithNetNS in BDD-style
2016-03-15 01:51:58 -07:00
Eugene Yakubovich
4bee884fae 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
Eugene Yakubovich
a6a822268c add DHCP IPAM plugin
The plugin binary actually functions in two modes. The first mode
is a regular CNI plugin. The second mode (when stared with "daemon" arg)
runs a DHCP client daemon. When executed as a CNI plugin, it issues
an RPC request to the daemon for actual processing. The daemon is
required since a DHCP lease needs to be maintained by periodically
renewing it. One instance of the daemon can server arbitrary number
of containers/leases.
2015-05-21 13:36:51 -07:00
Eugene Yakubovich
c24708ff62 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