29 Commits
Author SHA1 Message Date
Martynas Pumputis e611f04f41 Move NetDev utils from common/ to net/ 2016-10-19 17:03:30 +01:00
Martynas Pumputis 947ae11fee Refactor NetDev utilities
- Make them safe by using the safe version of WithNetNS.
- Improve naming.
2016-10-19 16:07:53 +01:00
Martynas Pumputis cdd6ed548c Add netdev subcommands to weaveutil
The subcommands are going to be used with WithNetNS wrapper.
2016-10-19 16:07:53 +01:00
Martynas Pumputis 4a49ff3083 Replace usage of WithNetNSUnsafe in plugin/net/watcher.go with safer version
Unsafe version was in ConfigureARPforVeths; replacement is via `weaveutil configure-arp`
2016-10-06 15:25:05 +01:00
Bryan Boreham ca87f8ada3 Improve comments 2016-09-29 14:06:43 +01:00
Martynas Pumputis 9b32bc2ab3 Close opened netns 2016-09-14 16:47:40 +01:00
Martynas Pumputis fd5e1970e1 Return nil netdev if netns of container cannot be found
The change applies to GetNetDevsWithPredicate. The function calls
FindNetDevs which already does the same filtering.

The change prevents from "container-addrs" (weaveutil) returning
"unable to open X process namespace" error which happens when
a container dies while the cmd is being executed.
2016-09-14 16:47:16 +01:00
Martynas Pumputis 0861d05522 Address PR comments
- Do not re-enter the root netns when querying weave bridge.
- Enter the root netns when constructing the predicate.
2016-07-05 15:12:39 +01:00
Martynas Pumputis 89221f117b Denote WithNetNS* functions with unsafe
Please see https://github.com/weaveworks/weave/issues/2388#issuecomment-228365069
for more details.
2016-07-05 15:12:39 +01:00
Martynas Pumputis 7f5c37ef1e Fix "weave ps"
Make sure that any network namespace changes happens at the end of
the cmd invocation. Otherwise, we are risking to end up in a situation
in which OS scheduling threads are in a "wrong" namespace.

See WithNetNS for more details.
2016-07-05 15:12:39 +01:00
Martynas Pumputis 05baa566c6 Refactor common.GetBridgeNetDev
- Optimize. Use LinkByName instead of iterating over list of available
  links. Linux does not support interfaces with the same names.
- Remove unnecessary indirection in utility functions which return
  common.NetDev.
2016-07-05 15:12:39 +01:00
Bryan Boreham 8bb8f70bb6 Perform arp configuration for plugin-connected containers 2016-06-14 17:53:34 +01:00
Bryan Boreham 85023e0a76 Extract AttachContainer() function
Also move netlink and netns code from common to net

Creates interface if not already there
Adds addresses
Move the set link 'up' to after addresses are added
2016-05-25 17:29:45 +01:00
Adam Harrison 260b416cd7 Include interface name in container-addrs output 2016-05-06 14:12:50 +01:00
Adam Harrison 3123418022 Merge pull request #2030 from weaveworks/issues/1992-cni-plugin
Implement CNI plugin
2016-03-21 10:51:19 +00:00
Bryan Boreham b00f0aee65 Check errors on test for root namespace 2016-03-18 19:39:52 +00:00
Adam Harrison f9f6e8ed26 Protect container-addrs against stopped containers 2016-03-18 10:46:30 +00:00
Bryan Boreham a66543f98e Use link ParentIndex where available 2016-03-17 18:20:18 +00:00
Bryan Boreham b153e6a0d2 Simplify, after review feedback 2016-03-17 14:29:34 +00:00
Bryan Boreham 2d6a916b2d Find weave veths by looking at what is connected to the bridge, not by name
and don't even look at containers running in the root namespace
2016-03-17 12:41:37 +00:00
Bryan Boreham 011fb55e5f Refactor FindNetDevs so we can get the link, and re-use parts of the function 2016-03-17 12:41:37 +00:00
Bryan Boreham 35671135bd Return errors that happen inside WithNetNS 2016-03-10 15:18:16 +00:00
Bryan Boreham dd74bb1774 Simplify by using GetFromPid 2016-03-01 12:12:46 -08:00
Adam Harrison adf56d316d Remove obsolete alternative procfs support 2016-03-01 20:10:47 +00:00
Adam Harrison 65c48707f6 Use netlink instead of shelling out to weave ps 2016-02-04 12:51:18 +00:00
Adam Harrison fc9a1c8664 new weave status, weave status ..., and weave report 2015-08-11 12:15:13 +01:00
David Wragg 7d6f85424c Move OnOff into router.go 2015-08-03 14:06:23 +01:00
Matthias Radestock 97498d26f7 remove dead code 2015-07-15 05:32:35 +01:00
Matthias Radestock c10f1dacad introduce OnOff helper, for consistency in status output 2015-06-05 15:00:02 +01:00