net/netmon: catch ParseRIB panic to gather buffer data
Updates #14201 Updates golang/go#70528 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
parent
36b7449fea
commit
f6431185b0
|
@ -56,7 +56,15 @@ func (m *darwinRouteMon) Receive() (message, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
msgs, err := route.ParseRIB(route.RIBTypeRoute, m.buf[:n])
|
||||
msgs, err := func() (msgs []route.Message, err error) {
|
||||
defer func() {
|
||||
if recover() != nil {
|
||||
msgs = nil
|
||||
err = fmt.Errorf("panic parsing route message")
|
||||
}
|
||||
}()
|
||||
return route.ParseRIB(route.RIBTypeRoute, m.buf[:n])
|
||||
}()
|
||||
if err != nil {
|
||||
if debugRouteMessages {
|
||||
m.logf("read %d bytes (% 02x), failed to parse RIB: %v", n, m.buf[:n], err)
|
||||
|
|
Loading…
Reference in New Issue