Ondrej Zajicek <santiago@crfreenet.org> writes:
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.
Yeah, you're right. Hmm, guess it doesn't really make sense to have the IHU interval configurable by itself, then? -Toke