mirror of
https://github.com/soypat/lneto.git
synced 2026-08-12 02:43:44 +00:00
notify if icmp cannot be used due to bad StackConfig
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user