ping: Fix not handling reject
This commit is contained in:
parent
055fe13ec0
commit
4c43f4af12
3 changed files with 21 additions and 5 deletions
|
|
@ -668,7 +668,11 @@ func (s *System) processIPv4ICMP(ipHdr header.IPv4, icmpHdr header.ICMPv4) (bool
|
|||
)
|
||||
})
|
||||
if err != nil {
|
||||
return false, nil
|
||||
if errors.Is(err, ErrReset) {
|
||||
return false, s.rejectIPv4WithICMP(ipHdr, header.ICMPv4PortUnreachable)
|
||||
} else if errors.Is(err, ErrDrop) {
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
if action != nil {
|
||||
return false, action.WritePacket(buf.As(ipHdr).ToOwned())
|
||||
|
|
@ -739,7 +743,9 @@ func (s *System) processIPv6ICMP(ipHdr header.IPv6, icmpHdr header.ICMPv6) (bool
|
|||
timeout,
|
||||
)
|
||||
})
|
||||
if err != nil {
|
||||
if errors.Is(err, ErrReset) {
|
||||
return false, s.rejectIPv6WithICMP(ipHdr, header.ICMPv6PortUnreachable)
|
||||
} else if errors.Is(err, ErrDrop) {
|
||||
return false, nil
|
||||
}
|
||||
if action != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue