mirror of
https://github.com/tailscale/tailscale.git
synced 2025-05-22 07:18:46 +00:00
net/netmon: add extra panic guard around ParseRIB
We once again have a report of a panic from ParseRIB. This panic guard should probably remain permanent. Updates #14201 This reverts commit de9d4b2f886b6bf5cf0fe9be6c17d080267acef1. Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
parent
97c4c0ecf0
commit
80a100b3cb
@ -56,7 +56,19 @@ func (m *darwinRouteMon) Receive() (message, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
msgs, err := route.ParseRIB(route.RIBTypeRoute, m.buf[:n])
|
msgs, err := func() (msgs []route.Message, err error) {
|
||||||
|
defer func() {
|
||||||
|
// #14201: permanent panic protection, as we have been burned by
|
||||||
|
// ParseRIB panics too many times.
|
||||||
|
msg := recover()
|
||||||
|
if msg != nil {
|
||||||
|
msgs = nil
|
||||||
|
m.logf("[unexpected] netmon: panic in route.ParseRIB from % 02x", m.buf[:n])
|
||||||
|
err = fmt.Errorf("panic in route.ParseRIB: %s", msg)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
return route.ParseRIB(route.RIBTypeRoute, m.buf[:n])
|
||||||
|
}()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if debugRouteMessages {
|
if debugRouteMessages {
|
||||||
m.logf("read %d bytes (% 02x), failed to parse RIB: %v", n, m.buf[:n], err)
|
m.logf("read %d bytes (% 02x), failed to parse RIB: %v", n, m.buf[:n], err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user