Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux: devices: increase priority of user choice #31200

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions pkg/datapath/linux/devices_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -525,16 +525,25 @@ func (dc *devicesController) isSelectedDevice(d *tables.Device, txn statedb.Writ
return false, "device has no addresses"
}

// Skip devices that have an excluded interface flag set.
if d.RawFlags&excludedIfFlagsMask != 0 {
return false, fmt.Sprintf("excluded flag set (mask=0x%x, flags=0x%x)", excludedIfFlagsMask, d.RawFlags)
}

// Skip devices that don't have the required flags set.
if d.RawFlags&requiredIfFlagsMask == 0 {
return false, fmt.Sprintf("missing required flag (mask=0x%x, flags=0x%x)", requiredIfFlagsMask, d.RawFlags)
}

// If user specified devices or wildcards, then skip the device if it doesn't match.
// If the device does match, then skip further checks.
if dc.filter.nonEmpty() {
if dc.filter.match(d.Name) {
return true, ""
}
return false, fmt.Sprintf("not matching user filter %v", dc.filter)
}

// Skip devices that have an excluded interface flag set.
if d.RawFlags&excludedIfFlagsMask != 0 {
return false, fmt.Sprintf("excluded flag set (mask=0x%x, flags=0x%x)", excludedIfFlagsMask, d.RawFlags)
}

// Ignore bridge and bonding slave devices
if d.MasterIndex != 0 {
return false, fmt.Sprintf("bridged or bonded to ifindex %d", d.MasterIndex)
Expand All @@ -546,15 +555,6 @@ func (dc *devicesController) isSelectedDevice(d *tables.Device, txn statedb.Writ
return false, "L3 device, kernel too old, >= 5.8 required"
}

// If user specified devices or wildcards, then skip the device if it doesn't match.
// If the device does match, then skip further checks.
if dc.filter.nonEmpty() {
if dc.filter.match(d.Name) {
return true, ""
}
return false, fmt.Sprintf("not matching user filter %v", dc.filter)
}

// Never consider devices with any of the excluded devices.
for _, p := range defaults.ExcludedDevicePrefixes {
if strings.HasPrefix(d.Name, p) {
Expand Down
Loading