Fix logging maybe panic

This commit is contained in:
wwqgtxx 2026-02-13 00:28:14 +08:00
parent 3144f43fc2
commit 2a33d64abc

View file

@ -148,7 +148,9 @@ func (t *NativeTun) configure(tunLink netlink.Link) error {
if t.options.GSO { if t.options.GSO {
err = t.enableGSO() err = t.enableGSO()
if err != nil { if err != nil {
t.options.Logger.Warn(err) if t.options.Logger != nil {
t.options.Logger.Warn(err)
}
} }
} }
@ -275,7 +277,9 @@ func (t *NativeTun) Start() error {
if err != nil { if err != nil {
t.gro.disableTCPGRO() t.gro.disableTCPGRO()
t.gro.disableUDPGRO() t.gro.disableUDPGRO()
t.options.Logger.Warn(E.Cause(err, "disabled TUN TCP & UDP GRO due to GRO probe error")) if t.options.Logger != nil {
t.options.Logger.Warn(E.Cause(err, "disabled TUN TCP & UDP GRO due to GRO probe error"))
}
} }
} }