git://git.halfball.org
/
plugins.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0d19b79
)
macvlan/ipvlan: use common RenameLink method
author
Dan Williams
<dcbw@redhat.com>
Mon, 28 Nov 2016 15:33:39 +0000
(09:33 -0600)
committer
Dan Williams
<dcbw@redhat.com>
Wed, 25 Jan 2017 17:31:18 +0000
(11:31 -0600)
ip/link.go
patch
|
blob
|
history
diff --git
a/ip/link.go
b/ip/link.go
index
43b3739
..
6431bb4
100644
(file)
--- a/
ip/link.go
+++ b/
ip/link.go
@@
-90,6
+90,14
@@
func RandomVethName() (string, error) {
return fmt.Sprintf("veth%x", entropy), nil
}
+func RenameLink(curName, newName string) error {
+ link, err := netlink.LinkByName(curName)
+ if err == nil {
+ err = netlink.LinkSetName(link, newName)
+ }
+ return err
+}
+
// SetupVeth sets up a virtual ethernet link.
// Should be in container netns, and will switch back to hostNS to set the host
// veth end up.