Commit 2b50102e authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Implement fragmentation of xroute updates.

This allows sending more than 70 or so xroutes for a single gateway.
Let's hope nobody actually uses this feature.
parent c9911909
...@@ -439,11 +439,16 @@ flushupdates(void) ...@@ -439,11 +439,16 @@ flushupdates(void)
for(j = 0; j < nummyxroutes; j++) { for(j = 0; j < nummyxroutes; j++) {
if(!myxroutes[j].installed) if(!myxroutes[j].installed)
continue; continue;
if(net->bufsize - net->buffered < 40) if(net->bufsize - net->buffered < 40) {
/* We cannot just call start_message, as this would /* We cannot just call start_message, as this would
split the xroutes from the update. Bail out split the xroutes from the update. */
for now, and never mind the missing updates. */ start_message(net, 20);
break; accumulate_byte(net, 2);
accumulate_byte(net, seqno);
accumulate_short(net, 0);
accumulate_data(net, myid, 16);
flushbuf(net);
}
start_message(net, 20); start_message(net, 20);
accumulate_byte(net, 4); accumulate_byte(net, 4);
accumulate_byte(net, myxroutes[j].plen); accumulate_byte(net, myxroutes[j].plen);
...@@ -487,8 +492,15 @@ flushupdates(void) ...@@ -487,8 +492,15 @@ flushupdates(void)
if(xroutes[j].gateway != buffered_updates[i]) if(xroutes[j].gateway != buffered_updates[i])
continue; continue;
/* See comment above */ /* See comment above */
if(net->bufsize - net->buffered < 40) if(net->bufsize - net->buffered < 40) {
break; start_message(net, 20);
accumulate_byte(net, 2);
accumulate_byte(net, seqno);
accumulate_short(net, metric);
accumulate_data(net,
buffered_updates[i]->address, 16);
flushbuf(net);
}
start_message(net, 20); start_message(net, 20);
accumulate_byte(net, 4); accumulate_byte(net, 4);
accumulate_byte(net, xroutes[j].plen); accumulate_byte(net, xroutes[j].plen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment