-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Description
What version of Go are you using (go version)?
go version go1.7 linux/amd64
What operating system and processor architecture are you using (go env)?
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/vagrant/vicsmb"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build018341538=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
What did you do?
package main
import (
"fmt"
"net"
"os"
"os/exec"
)
func main() {
alias := "testalias"
ipalias := exec.Command("/sbin/ip", "link", "set", "dev", "lo", "alias", alias)
_, err := ipalias.CombinedOutput()
if err != nil {
fmt.Printf("failed to invoke /sbin/ip to set alias on loopback interface: %s", err)
os.Exit(1)
}
intf, err := net.InterfaceByName(alias)
if intf == nil {
fmt.Printf("failed to locate interface by alias %s: %s\n", alias, err)
os.Exit(1)
}
fmt.Println("success!!")
}
What did you expect to see?
Aliasing link lo
success!!
What did you see instead?
Aliasing link lo
failed to locate interface by alias testalias: route ip+net: no such network interface
# ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
alias testalias
If InterfaceByName doens't check aliases on systems that support them then interface aliases become problematic. If you have to know that the name is an aliases it defeats the point.
vodolaz095
Metadata
Metadata
Assignees
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.Feedback is required from experts, contributors, and/or the community before a change can be made.