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

Commit

Permalink
Revert "more ifnames"
Browse files Browse the repository at this point in the history
This reverts commit 6cc767c.
  • Loading branch information
nonsense committed Feb 11, 2020
1 parent 426da97 commit b12d4fd
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions net/veth.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ func contains(addrs []netlink.Addr, addr *net.IPNet) bool {
}

const (
VethName = "ethwe" // name inside container namespace
//vethPrefix = "v" + VethName // starts with "veth" to suppress UI notifications
vethPrefix = "v"
VethName = "ethwe" // name inside container namespace
vethPrefix = "v" + VethName // starts with "veth" to suppress UI notifications
)

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

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

0 comments on commit b12d4fd

Please sign in to comment.