ping: Fix stale flows kept alive by unrelated ICMP traffic
Unconnected raw ICMP sockets receive every ICMP packet arriving at the host, so any ICMP traffic refreshed the read deadline of every flow and stale flows (with their raw sockets and goroutines) were only reclaimed by LRU eviction while processing all host ICMP traffic in the meantime. Expire flows based on their own activity only, and on Linux attach a classic BPF ident filter to each raw socket so other flows' packets are dropped in the kernel instead of waking every flow.
This commit is contained in:
parent
aae2f0750c
commit
30e535973b
7 changed files with 233 additions and 17 deletions
8
ping/filter_other.go
Normal file
8
ping/filter_other.go
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
//go:build !linux
|
||||
|
||||
package ping
|
||||
|
||||
type identFilterState struct{}
|
||||
|
||||
func (c *Conn) updateIdentFilter(wireIdentifier uint16) {
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue