Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit 6cc767c

Browse files
committed
more ifnames
1 parent f906b0a commit 6cc767c

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

net/veth.go

+7-4
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ func contains(addrs []netlink.Addr, addr *net.IPNet) bool {
9999
}
100100

101101
const (
102-
VethName = "ethwe" // name inside container namespace
103-
vethPrefix = "v" + VethName // starts with "veth" to suppress UI notifications
102+
VethName = "ethwe" // name inside container namespace
103+
//vethPrefix = "v" + VethName // starts with "veth" to suppress UI notifications
104+
vethPrefix = "v"
104105
)
105106

106107
func interfaceExistsInNamespace(netNSPath string, ifName string) bool {
@@ -119,11 +120,13 @@ func AttachContainer(netNSPath, id, ifName, bridgeName string, mtu int, withMult
119120
defer ns.Close()
120121

121122
if !interfaceExistsInNamespace(netNSPath, ifName) {
122-
maxIDLen := IFNAMSIZ - 1 - len(vethPrefix+"pl")
123+
//maxIDLen := IFNAMSIZ - 1 - len(vethPrefix+"pl")
124+
maxIDLen := IFNAMSIZ - 1 - len(vethPrefix+"l")
123125
if len(id) > maxIDLen {
124126
id = id[:maxIDLen] // trim passed ID if too long
125127
}
126-
name, peerName := vethPrefix+"pl"+id, vethPrefix+"pg"+id
128+
//name, peerName := vethPrefix+"pl"+id, vethPrefix+"pg"+id
129+
name, peerName := vethPrefix+"l"+id, vethPrefix+"g"+id
127130
veth, err := CreateAndAttachVeth(name, peerName, bridgeName, mtu, keepTXOn, true, func(veth netlink.Link) error {
128131
if err := netlink.LinkSetNsFd(veth, int(ns)); err != nil {
129132
return fmt.Errorf("failed to move veth to container netns: %s", err)

0 commit comments

Comments
 (0)