Skip to content

Commit

Permalink
fix: find iface by full match first then regex match
Browse files Browse the repository at this point in the history
  • Loading branch information
oilbeater committed Dec 21, 2020
1 parent 8430dca commit efdd391
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/daemon/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ func (config *Configuration) initNicConfig() error {
}

func findInterface(ifaceStr string) (*net.Interface, error) {
iface, err := net.InterfaceByName(ifaceStr)
if err != nil && iface != nil {
return iface, nil
}
ifaceRegex, err := regexp.Compile("(" + strings.Join(strings.Split(ifaceStr, ","), ")|(") + ")")
if err != nil {
klog.Errorf("Invalid interface regex %s", ifaceStr)
Expand Down

0 comments on commit efdd391

Please sign in to comment.