From a9709d2a574ab2083b95226f3df26329312c8752 Mon Sep 17 00:00:00 2001 From: mzz2017 <2017@duck.com> Date: Mon, 27 Feb 2023 14:57:00 +0800 Subject: [PATCH] optimize: allow to bind nothing --- cmd/run.go | 2 +- control/bpf_utils.go | 2 -- control/control_plane.go | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/cmd/run.go b/cmd/run.go index 45de19a..fab2f8b 100644 --- a/cmd/run.go +++ b/cmd/run.go @@ -150,7 +150,7 @@ func newControlPlane(log *logrus.Logger, bpf interface{}, conf *config.Config) ( } if len(conf.Global.LanInterface) == 0 && len(conf.Global.WanInterface) == 0 { - return nil, fmt.Errorf("LanInterface and WanInterface cannot both be empty") + log.Warnln("No binding interface.") } // Deep copy a conf to avoid modification. diff --git a/control/bpf_utils.go b/control/bpf_utils.go index f7c9f3e..1ba0a44 100644 --- a/control/bpf_utils.go +++ b/control/bpf_utils.go @@ -178,8 +178,6 @@ func (p bpfIfParams) CheckVersionRequirement(version *internal.Version) (err err type loadBpfOptions struct { PinPath string CollectionOptions *ebpf.CollectionOptions - BindLan bool - BindWan bool } func fullLoadBpfObjects( diff --git a/control/control_plane.go b/control/control_plane.go index 72e3ff4..782d984 100644 --- a/control/control_plane.go +++ b/control/control_plane.go @@ -131,8 +131,6 @@ func NewControlPlane( if err = fullLoadBpfObjects(log, bpf, &loadBpfOptions{ PinPath: pinPath, CollectionOptions: collectionOpts, - BindLan: len(global.LanInterface) > 0, - BindWan: len(global.WanInterface) > 0, }); err != nil { if log.Level == logrus.PanicLevel { log.Panicln(err)