mirror of
https://github.com/weaveworks/scope.git
synced 2026-07-24 07:46:41 +00:00
ignore local IPv6 addresses/networks
There is no point in paying attention to them since scope connection tracking only deals in IPv4.
This commit is contained in:
@@ -93,9 +93,8 @@ var GetLocalNetworks = func() ([]*net.IPNet, error) {
|
||||
}
|
||||
localNets := report.Networks{}
|
||||
for _, addr := range addrs {
|
||||
// Not all addrs are IPNets.
|
||||
if ipNet, ok := addr.(*net.IPNet); ok {
|
||||
localNets = append(localNets, ipNet)
|
||||
if ipnet, ok := addr.(*net.IPNet); ok && ipnet.IP.To4() != nil {
|
||||
localNets = append(localNets, ipnet)
|
||||
}
|
||||
}
|
||||
return localNets, nil
|
||||
|
||||
@@ -52,12 +52,9 @@ func LocalAddresses() ([]net.IP, error) {
|
||||
}
|
||||
|
||||
for _, addr := range addrs {
|
||||
ipnet, ok := addr.(*net.IPNet)
|
||||
if !ok {
|
||||
continue
|
||||
if ipnet, ok := addr.(*net.IPNet); ok && ipnet.IP.To4() != nil {
|
||||
result = append(result, ipnet.IP)
|
||||
}
|
||||
|
||||
result = append(result, ipnet.IP)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,16 +75,9 @@ func AddLocalBridge(name string) error {
|
||||
return err
|
||||
}
|
||||
for _, addr := range addrs {
|
||||
_, network, err := net.ParseCIDR(addr.String())
|
||||
if err != nil {
|
||||
return err
|
||||
if ipnet, ok := addr.(*net.IPNet); ok && ipnet.IP.To4() != nil {
|
||||
LocalNetworks = append(LocalNetworks, ipnet)
|
||||
}
|
||||
|
||||
if network == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
LocalNetworks = append(LocalNetworks, network)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user