mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
wgengine, net/packet, cmd/tailscale: add ICMP echo
Updates tailscale/corp#754 Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:

committed by
James Tucker

parent
66f9292835
commit
ae483d3446
@@ -151,6 +151,11 @@ type Wrapper struct {
|
||||
// OnTSMPPongReceived, if non-nil, is called whenever a TSMP pong arrives.
|
||||
OnTSMPPongReceived func(packet.TSMPPongReply)
|
||||
|
||||
// OnICMPEchoResponseReceived, if non-nil, is called whenever a ICMP echo response
|
||||
// arrives. If the packet is to be handled internally this returns true,
|
||||
// false otherwise.
|
||||
OnICMPEchoResponseReceived func(*packet.Parsed) bool
|
||||
|
||||
// PeerAPIPort, if non-nil, returns the peerapi port that's
|
||||
// running for the given IP address.
|
||||
PeerAPIPort func(netaddr.IP) (port uint16, ok bool)
|
||||
@@ -575,6 +580,14 @@ func (t *Wrapper) filterIn(buf []byte) filter.Response {
|
||||
}
|
||||
}
|
||||
|
||||
if p.IsEchoResponse() {
|
||||
if f := t.OnICMPEchoResponseReceived; f != nil && f(p) {
|
||||
// Note: this looks dropped in metrics, even though it was
|
||||
// handled internally.
|
||||
return filter.DropSilently
|
||||
}
|
||||
}
|
||||
|
||||
// Issue 1526 workaround: if we see disco packets over
|
||||
// Tailscale from ourselves, then drop them, as that shouldn't
|
||||
// happen unless a networking stack is confused, as it seems
|
||||
|
Reference in New Issue
Block a user