-
Notifications
You must be signed in to change notification settings - Fork 678
Conversation
PTAL. |
6b3a67f
to
4b44bce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^
return err == nil | ||
} | ||
|
||
func AttachContainer(ns netns.NsHandle, id, ifName, bridgeName string, mtu int, withMulticastRoute bool, cidrs []*net.IPNet, keepTXOn bool) error { | ||
func AttachContainer(ns netns.NsHandle, nsPath, id, ifName, bridgeName string, mtu int, withMulticastRoute bool, cidrs []*net.IPNet, keepTXOn bool) error { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
I squashed the commits in this PR, in branch issues/2419-withnetns |
4b44bce
to
1755ec7
Compare
The subcommands are going to be used with WithNetNS wrapper.
- Make them safe by using the safe version of WithNetNS. - Improve naming.
1755ec7
to
3492cd9
Compare
PTAL. A few things:
|
cebd490
to
e611f04
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of getting rid of all occurrences of WithNetNS*Unsafe as unaware users might trip over it.
Are you talking about the three remaining usages of WithNetNSLinkUnsafe
in cni.go
and netns.go
? File a separate issue.
ParseNetDev
is ugly. Open to suggestions.
As mentioned in the comments, list-netdev
should print out JSON encoded Dev
structs (actually, I think there is a general principle here that all the utility executables should communicate by receiving and emitting JSON encoded structs the definitions of which are shared with the caller, but that's a separate conversation)
|
||
// listNetDevs outputs network ifaces identified by the given indexes | ||
// in the format of weavenet.Dev. | ||
func listNetDevs(args []string) error { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
return fmt.Sprintf("%s %s %s", d.Name, d.MAC, d.CIDRs) | ||
} | ||
|
||
func ParseNetDev(netdev string) (Dev, error) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
if err != nil { | ||
return nil, fmt.Errorf("list-netdevs failed: %s", err) | ||
} | ||
for _, netdevStr := range strings.Split(netdevsStr, "\n") { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
We don't really need to change |
As mentioned above, I'm in favor of getting rid of |
9751455
to
9754da1
Compare
PTAL. I've create #2556 to track removal of |
This PR introduces a safe version of
WithNetNS*
. The new function executeswork()
by shelling outweaveutil
which before executing it enters a given network namespace viansenter
.Also, the PR replaces the usage of
WithNetNS*Unsafe
with the newly introduced function where needed.Fixes #2419