mirror of
https://github.com/daeuniverse/dae.git
synced 2025-02-03 12:55:13 +07:00
chore: core should be created after right bpf loaded
This commit is contained in:
parent
9a840a05a6
commit
b34af9c6a4
@ -29,7 +29,7 @@ func (c *ControlPlaneCore) OutboundAliveChangeCallback(outbound uint8) func(aliv
|
||||
"alive": alive,
|
||||
"network": fmt.Sprintf("%v+%v", FormatL4Proto(l4proto), ipversion),
|
||||
"outbound_id": outbound,
|
||||
}).Tracef("Outbound alive state changed, notify the kernel program.")
|
||||
}).Warnf("Outbound alive state changed, notify the kernel program.")
|
||||
|
||||
value := uint32(0)
|
||||
if alive {
|
||||
|
@ -122,6 +122,18 @@ func NewControlPlane(
|
||||
return nil, fmt.Errorf("load eBPF objects: %w", err)
|
||||
}
|
||||
|
||||
core := &ControlPlaneCore{
|
||||
log: log,
|
||||
deferFuncs: []func() error{bpf.Close},
|
||||
bpf: &bpf,
|
||||
kernelVersion: &kernelVersion,
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
_ = core.Close()
|
||||
}
|
||||
}()
|
||||
|
||||
// Write params.
|
||||
if err = bpf.ParamMap.Update(consts.DisableL4TxChecksumKey, consts.DisableL4ChecksumPolicy_SetZero, ebpf.UpdateAny); err != nil {
|
||||
return nil, err
|
||||
@ -150,17 +162,6 @@ func NewControlPlane(
|
||||
return nil, err
|
||||
}
|
||||
|
||||
core := &ControlPlaneCore{
|
||||
log: log,
|
||||
deferFuncs: []func() error{bpf.Close},
|
||||
bpf: &bpf,
|
||||
kernelVersion: &kernelVersion,
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
_ = core.Close()
|
||||
}
|
||||
}()
|
||||
/// Bind to links. Binding should be advance of dialerGroups to avoid un-routable old connection.
|
||||
// Add clsact qdisc
|
||||
for _, ifname := range common.Deduplicate(append(append([]string{}, global.LanInterface...), global.WanInterface...)) {
|
||||
|
Loading…
Reference in New Issue
Block a user