-
Notifications
You must be signed in to change notification settings - Fork 230
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
feat(config): wildcard interface name support & refactor lazybind #758
base: main
Are you sure you want to change the base?
Conversation
#724是个issue,不是pr |
control/interface_manager.go
Outdated
@@ -0,0 +1,117 @@ | |||
package control |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
把这个 interface manager 组件放到 components 里?
control/interface_manager.go
Outdated
callbacks []callbackSet | ||
} | ||
|
||
func newInterfaceManager(log *logrus.Logger, closed context.Context) *InterfaceManager { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
按照约定,ctx 应该放到第一个参数,就叫 ctx 就好,代表生命周期。不过我建议不是传入 ctx(因为有歧义,也可能代表这个函数的生命周期),而是可以在 newXXX 函数里 context.WithCancel 并对该 struct 实现 Close() error 接口。
control/interface_manager.go
Outdated
} | ||
|
||
switch update.Header.Type { | ||
case unix.RTM_NEWLINK: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
根据 #729,NEWLINK 事件可能会由多种事件触发,是否要判断 UpFlag == 0?或者在 cb 函数里自己判断
这里需要测试一下用户说的 pppoe 断开重连场景
control/control_plane_core.go
Outdated
return err | ||
} | ||
newlinkCallback := func(link netlink.Link) { | ||
if link.Attrs().Name == "dae0" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dae0 是否有对应的 const?能否对所有出现的 dae0 string 统一抽象出 const?
control/control_plane_core.go
Outdated
if link.Attrs().Name == "dae0" { | ||
return | ||
} | ||
c.log.Warnf("New link creation of '%v' is detected. Bind LAN program to it.", link.Attrs().Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
日志应该打 Bind WAN ,包括下面也有一行日志错误。
Background
#724
该PR抽象了lazybind的能力以便后续其他功能使用(主要是后续在routing中过滤interface需要)
该PR实现的功能与 #729 类似
此外,为wan也加入了lazybind
Checklist
Full Changelogs
Issue Reference
Closes #724
Closes #729
Test Result