diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2016-07-19 11:57:20 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2016-07-19 11:57:20 +0200 |
commit | 321ff8c4049ec6c2fa198858b4a7f1814ce05e39 (patch) | |
tree | c8d4a9ef7bdc005139ab39ec2b072b201a03ad7d /proto/babel/babel.h | |
parent | 6887f409f0766c60dd8c3d3fdf01a1d989c090a5 (diff) |
Babel: Make sure intervals do not overflow
Intervals are carried as 16-bit centisecond values, but kept internally
in 16-bit second values, which causes a potential for overflow. This adds
some checks to make sure this does not happen.
Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
Diffstat (limited to 'proto/babel/babel.h')
-rw-r--r-- | proto/babel/babel.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/proto/babel/babel.h b/proto/babel/babel.h index aea0dd88..7b5037ab 100644 --- a/proto/babel/babel.h +++ b/proto/babel/babel.h @@ -50,10 +50,12 @@ #define BABEL_INITIAL_HOP_COUNT 255 #define BABEL_MAX_SEND_INTERVAL 5 #define BABEL_TIME_UNITS 100 /* On-wire times are counted in centiseconds */ - #define BABEL_SEQNO_REQUEST_EXPIRY 60 #define BABEL_GARBAGE_INTERVAL 300 +/* Max interval that will not overflow when carried as 16-bit centiseconds */ +#define BABEL_MAX_INTERVAL (0xFFFF/BABEL_TIME_UNITS) + #define BABEL_OVERHEAD (SIZE_OF_IP_HEADER+UDP_HEADER_LENGTH) #define BABEL_MIN_MTU (512 + BABEL_OVERHEAD) |