For developer, required some explanation on code with timer and BGP

Mattia Milani mattia.milani at studenti.unitn.it
Thu Jul 5 17:19:33 CEST 2018


Hello all, this is a message for developer and who know how bird use timer,
and buffer.
Sorry for the length of this mail.

For first, the protocol i want to modify and upgrade is BGP, i see that
there isn't the timer MRAI implemented and it will be useful for some
studies on information propagation, so i decided to develop a first version
of it.

The actual process to send any kind of pkt is to call the function

bgp_fire_tx() and it's called by two other function respectively
bgp_kick_tx() and bgp_tx()

and the function bgp_fire_tx() take care to read from the buffer the
message that has to be sent and send it.

bgp_kick_tx() and bgp_tx() call bgp_fire_tx() while it don't return 0, so
the clear all the buffer of the message that has to be sent.

So my idea to introduce MRAI was that:

Create a timer (for now I created it for connection, after like say RFC
4271 this timer has to be set for every route) and put it on the connection.

Initialize it with the other timer of the conn

when the state of the conn goes up i set it to some value and start the
timer.

when the timer finish i call the function MRAI_finish() that call the
function bgp_fire_tx() while there is something to send more ore less like
the while loop in bgp_kick_tx() and bgp_tx()

when it's called bgp_fire_tx() on the update message part i written a
check, if the timer isn't at 0 i can't send the update, because the
function can be called from bgp_kick_tx() or bgp_tx(), but if it 0 it is
finished so i can send the message

When all the message had been send i reset the timer and start it again.


But unfortunately i see something that doesn't make my code work. when
something call bgp_kick_tx() or bgp_tx() the call bgp_fire_tx() and they
clear all the buffer, including update message that wasn't sended so when
the timer finish it didn't found anything on the buffer.

Now how can i change that?

My idea is to use a secondary buffer, when in bgp_fire_tx() i see that i
can't send the update I will insert the pkt in this secondary buffer and
consume the pkt on the main buffer.
when bgp_kick_tx() or bgp_tx() have send all the messages I will transfer
all the pkt in the secondary buffer into the main buffer.

So I ask you it's possible that? there is something in the code already
written that could help me? do you see another way to implement the MRAI
timer?

Thanks a lot to everyone,
Mattia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20180705/0ac46f7b/attachment.html>


More information about the Bird-users mailing list