@@ -103,15 +103,16 @@ func (h *InterfaceVppHandler) dumpInterfaces(ifIdxs ...uint32) (map[uint32]*vppc
103
103
return nil , fmt .Errorf ("failed to dump interface: %v" , err )
104
104
}
105
105
106
- ifaceName := strings .TrimRight (ifDetails .InterfaceName , "\x00 " )
106
+ internalName := strings .TrimRight (ifDetails .InterfaceName , "\x00 " )
107
+ ifaceDevType := strings .TrimRight (ifDetails .InterfaceDevType , "\x00 " )
107
108
physAddr := make (net.HardwareAddr , macLength )
108
109
copy (physAddr , ifDetails .L2Address [:])
109
110
110
111
details := & vppcalls.InterfaceDetails {
111
112
Interface : & ifs.Interface {
112
113
Name : strings .TrimRight (ifDetails .Tag , "\x00 " ),
113
114
// the type may be amended later by further dumps
114
- Type : guessInterfaceType (ifaceName ),
115
+ Type : guessInterfaceType (ifaceDevType , internalName ),
115
116
Enabled : isAdminStateUp (ifDetails .Flags ),
116
117
PhysAddress : net .HardwareAddr (ifDetails .L2Address [:]).String (),
117
118
Mtu : getMtu (ifDetails .LinkMtu ),
@@ -120,7 +121,8 @@ func (h *InterfaceVppHandler) dumpInterfaces(ifIdxs ...uint32) (map[uint32]*vppc
120
121
SwIfIndex : uint32 (ifDetails .SwIfIndex ),
121
122
SupSwIfIndex : ifDetails .SupSwIfIndex ,
122
123
L2Address : physAddr ,
123
- InternalName : ifaceName ,
124
+ InternalName : internalName ,
125
+ DevType : ifaceDevType ,
124
126
IsAdminStateUp : isAdminStateUp (ifDetails .Flags ),
125
127
IsLinkStateUp : isLinkStateUp (ifDetails .Flags ),
126
128
LinkDuplex : uint32 (ifDetails .LinkDuplex ),
@@ -149,18 +151,18 @@ func (h *InterfaceVppHandler) dumpInterfaces(ifIdxs ...uint32) (map[uint32]*vppc
149
151
// Fill name for physical interfaces (they are mostly without tag)
150
152
switch details .Interface .Type {
151
153
case ifs .Interface_DPDK :
152
- details .Interface .Name = ifaceName
154
+ details .Interface .Name = internalName
153
155
case ifs .Interface_AF_PACKET :
154
156
details .Interface .Link = & ifs.Interface_Afpacket {
155
157
Afpacket : & ifs.AfpacketLink {
156
- HostIfName : strings .TrimPrefix (ifaceName , "host-" ),
158
+ HostIfName : strings .TrimPrefix (internalName , "host-" ),
157
159
},
158
160
}
159
161
}
160
162
if details .Interface .Name == "" {
161
163
// untagged interface - generate a logical name for it
162
164
// (apart from local0 it will get removed by resync)
163
- details .Interface .Name = untaggedIfPreffix + ifaceName
165
+ details .Interface .Name = untaggedIfPreffix + internalName
164
166
}
165
167
interfaces [uint32 (ifDetails .SwIfIndex )] = details
166
168
}
@@ -928,7 +930,7 @@ func dhcpAddressToString(address vpp_dhcp.Address, maskWidth uint32, isIPv6 bool
928
930
// guessInterfaceType attempts to guess the correct interface type from its internal name (as given by VPP).
929
931
// This is required mainly for those interface types, that do not provide dump binary API,
930
932
// such as loopback of af_packet.
931
- func guessInterfaceType (ifName string ) ifs.Interface_Type {
933
+ func guessInterfaceType (ifDevType , ifName string ) ifs.Interface_Type {
932
934
switch {
933
935
case strings .HasPrefix (ifName , "loop" ),
934
936
strings .HasPrefix (ifName , "local" ):
0 commit comments