[PATCH 1/7] Babel: Make sure intervals don't overflow.
Ondrej Zajicek
santiago at crfreenet.org
Tue Jul 19 15:34:32 CEST 2016
On Mon, May 02, 2016 at 07:07:49PM +0200, Toke Høiland-Jørgensen wrote:
> 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 doesn't happen.
>
> + /* make sure we don't overflow the 16-bit centisec fields */
> if (!BABEL_IFACE->update_interval)
> - BABEL_IFACE->update_interval = BABEL_IFACE->hello_interval*BABEL_UPDATE_INTERVAL_FACTOR;
> - BABEL_IFACE->ihu_interval = BABEL_IFACE->hello_interval*BABEL_IHU_INTERVAL_FACTOR;
> + BABEL_IFACE->update_interval = MIN_(BABEL_IFACE->hello_interval*BABEL_UPDATE_INTERVAL_FACTOR, BABEL_MAX_INTERVAL);
> + BABEL_IFACE->ihu_interval = MIN_(BABEL_IFACE->hello_interval*BABEL_IHU_INTERVAL_FACTOR, BABEL_MAX_INTERVAL);
This is not completely correct, because IHU interval is not independent
of hello_interval in this implementation - IHUs are sent for each
BABEL_IHU_INTERVAL_FACTOR hellos even if ihu_interval is limited by this.
--
Elen sila lumenn' omentielvo
Ondrej 'Santiago' Zajicek (email: santiago at crfreenet.org)
OpenPGP encrypted e-mails preferred (KeyID 0x11DEADC3, wwwkeys.pgp.net)
"To err is human -- to blame it on a computer is even more so."
More information about the Bird-users
mailing list