diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-08-27 14:10:52 +0200 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2024-08-30 13:49:20 +0200 |
| commit | db1aaea4fa60eec483225235a63fe0b368596efd (patch) | |
| tree | f6276a39654d16f77dabd07a3eedf18b17999c08 /internal | |
| parent | 93790cbe5a915b957ec2451f132eb603e19b5abf (diff) | |
Failover monitor: Check if mtuSize is at least 28 bytes
Otherwise the pinger creates a body with negative length
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/failover/monitor.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/internal/failover/monitor.go b/internal/failover/monitor.go index 5d81f22..5b44ee6 100644 --- a/internal/failover/monitor.go +++ b/internal/failover/monitor.go @@ -2,7 +2,6 @@ package failover import ( "context" - "errors" "fmt" "time" @@ -43,8 +42,8 @@ func (m *DroppedConMon) dropped(startBytes int64) (bool, error) { // This does not check Rx bytes every tick, but rather when pAlive or pDropped is reached // It returns an error if there was an invalid input or a ping was failed to be sent func (m *DroppedConMon) Start(ctx context.Context, gateway string, mtuSize int) (bool, error) { - if mtuSize <= 0 { - return false, errors.New("invalid mtu size given") + if mtuSize < mtuOverhead { + return false, fmt.Errorf("invalid MTU size given, MTU has to be at least: %v bytes", mtuOverhead) } // Create a ping struct with our mtu size |
