fix: preprocess wan_interface 'auto' before ebpf program loading to avoid to fail to insert filter

This commit is contained in:
mzz2017
2023-03-26 12:54:12 +08:00
parent 1bbb93fcfa
commit ae618e6c6e
2 changed files with 21 additions and 14 deletions

View File

@ -203,20 +203,6 @@ func NewControlPlane(
}
}
// Bind to WAN
// preprocess "auto".
ifs := make([]string, 0, len(global.WanInterface)+2)
for _, ifname := range global.WanInterface {
if ifname == "auto" {
defaultIfs, err := common.GetDefaultIfnames()
if err != nil {
return nil, fmt.Errorf("failed to convert 'auto': %w", err)
}
ifs = append(ifs, defaultIfs...)
} else {
ifs = append(ifs, ifname)
}
}
global.WanInterface = common.Deduplicate(ifs)
if len(global.WanInterface) > 0 {
if err = core.setupSkPidMonitor(); err != nil {
return nil, err