|
|
@@ -30,6 +30,19 @@ func NewManager(mm *MetadataManager) *Manager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// IsKernelDummyInterface returns true if link is an internal kernel fallback/dummy device (e.g. gre0, gretap0, erspan0)
|
|
|
+func IsKernelDummyInterface(name string) bool {
|
|
|
+ if strings.HasPrefix(name, "ep_") {
|
|
|
+ return true
|
|
|
+ }
|
|
|
+ switch name {
|
|
|
+ case "gre0", "gretap0", "erspan0", "sit0", "tunl0", "ip6tnl0", "ip6gre0", "ip6erspan0":
|
|
|
+ return true
|
|
|
+ default:
|
|
|
+ return false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
// ListInterfaces returns all network links on the system.
|
|
|
func (m *Manager) ListInterfaces() ([]InterfaceInfo, error) {
|
|
|
links, err := netlink.LinkList()
|
|
|
@@ -50,7 +63,7 @@ func (m *Manager) ListInterfaces() ([]InterfaceInfo, error) {
|
|
|
|
|
|
for _, link := range links {
|
|
|
attrs := link.Attrs()
|
|
|
- if strings.HasPrefix(attrs.Name, "ep_") {
|
|
|
+ if IsKernelDummyInterface(attrs.Name) {
|
|
|
continue
|
|
|
}
|
|
|
info := InterfaceInfo{
|