notify if icmp cannot be used due to bad StackConfig

This commit is contained in:
Patricio Whittingslow
2026-04-09 12:44:50 -03:00
parent 8813ccef82
commit 548d96da95
2 changed files with 8 additions and 0 deletions
+4
View File
@@ -78,6 +78,10 @@ func (client *Client) Reset() {
client.responseRing.Reset()
}
func (client *Client) IncomingEchoCapacity() int {
return cap(client.incomingEcho)
}
func (client *Client) Demux(carrierData []byte, frameOffset int) error {
rawdata := carrierData[frameOffset:]
ifrm, err := NewFrame(rawdata)
+4
View File
@@ -334,6 +334,10 @@ func (s *StackAsync) Gateway6() [6]byte {
// EnableICMP registers an ICMP handler to the stack when enabled is true.
// If enabled=false the currently registered ICMP handler is unregistered and state reset.
func (s *StackAsync) EnableICMP(enabled bool) (err error) {
if s.icmp.IncomingEchoCapacity() == 0 {
err = lneto.ErrInvalidConfig
enabled = false // ensure aborted.
}
if enabled {
if s.ip.IsRegistered(lneto.IPProtoICMP) {
return nil