engine, io: more caching + optimizations
This commit is contained in:
@@ -343,17 +343,13 @@ func lookupNeighborMACNetlink(target net.IP) (net.HardwareAddr, bool) {
|
||||
func readIPv6NeighCommand() map[string]net.HardwareAddr {
|
||||
commands := [][]string{
|
||||
{"ip", "-6", "neigh", "show"},
|
||||
{"/sbin/ip", "-6", "neigh", "show"},
|
||||
{"/usr/sbin/ip", "-6", "neigh", "show"},
|
||||
{"busybox", "ip", "-6", "neigh", "show"},
|
||||
{"/bin/busybox", "ip", "-6", "neigh", "show"},
|
||||
}
|
||||
m := make(map[string]net.HardwareAddr)
|
||||
for _, cmd := range commands {
|
||||
out, err := exec.Command(cmd[0], cmd[1:]...).Output()
|
||||
if err != nil || len(out) == 0 {
|
||||
continue
|
||||
}
|
||||
m := make(map[string]net.HardwareAddr)
|
||||
for _, line := range strings.Split(string(out), "\n") {
|
||||
ip, mac, ok := parseNeighborLine(line)
|
||||
if !ok {
|
||||
@@ -365,7 +361,7 @@ func readIPv6NeighCommand() map[string]net.HardwareAddr {
|
||||
return m
|
||||
}
|
||||
}
|
||||
return map[string]net.HardwareAddr{}
|
||||
return m
|
||||
}
|
||||
|
||||
func parseNeighborLine(line string) (string, net.HardwareAddr, bool) {
|
||||
|
||||
Reference in New Issue
Block a user