Commit 2f06e8e4 authored by Baptiste Jonglez's avatar Baptiste Jonglez

Add a condition for sending timestamps on Hello and IHU

Note that this commit is a no-op, since this condition is true by
default, and it cannot be set in the configuration yet.
parent 2242f971
......@@ -305,6 +305,9 @@ interface_up(struct interface *ifp, int up)
IF_CONF(ifp, update_interval) :
ifp->hello_interval * 4;
ifp->enable_timestamps =
(IF_CONF(ifp, enable_timestamps) == CONFIG_NO) ? 0 : 1;
ifp->rtt_exponential_decay =
IF_CONF(ifp, rtt_exponential_decay) > 0 ?
IF_CONF(ifp, rtt_exponential_decay) : 42;
......
......@@ -37,6 +37,7 @@ struct interface_conf {
char lq;
char faraway;
int channel;
int enable_timestamps;
unsigned int rtt_exponential_decay;
unsigned int rtt_min;
unsigned int rtt_max;
......@@ -95,6 +96,7 @@ struct interface {
unsigned short hello_seqno;
unsigned hello_interval;
unsigned update_interval;
int enable_timestamps;
/* A higher value means we forget old RTT samples faster. Must be
between 1 and 256, inclusive. */
unsigned int rtt_exponential_decay;
......
......@@ -654,7 +654,7 @@ check_bucket(struct interface *ifp)
static int
fill_rtt_message(struct interface *ifp)
{
if(ifp->buffered_hello >= 0) {
if(ifp->enable_timestamps && (ifp->buffered_hello >= 0)) {
unsigned int time;
/* Change the type of sub-TLV. */
ifp->sendbuf[ifp->buffered_hello + 8] = SUBTLV_TIMESTAMP;
......@@ -885,17 +885,19 @@ send_hello_noupdate(struct interface *ifp, unsigned interval)
debugf("Sending hello %d (%d) to %s.\n",
ifp->hello_seqno, interval, ifp->name);
start_message(ifp, MESSAGE_HELLO, 12);
start_message(ifp, MESSAGE_HELLO, ifp->enable_timestamps ? 12 : 6);
ifp->buffered_hello = ifp->buffered - 2;
accumulate_short(ifp, 0);
accumulate_short(ifp, ifp->hello_seqno);
accumulate_short(ifp, interval > 0xFFFF ? 0xFFFF : interval);
/* Sub-TLV containing the local time of emission. We use a Pad4
sub-TLV, which we'll fill just before sending. */
accumulate_byte(ifp, SUBTLV_PADN);
accumulate_byte(ifp, 4);
accumulate_int(ifp, 0);
end_message(ifp, MESSAGE_HELLO, 12);
if(ifp->enable_timestamps) {
/* Sub-TLV containing the local time of emission. We use a
Pad4 sub-TLV, which we'll fill just before sending. */
accumulate_byte(ifp, SUBTLV_PADN);
accumulate_byte(ifp, 4);
accumulate_int(ifp, 0);
}
end_message(ifp, MESSAGE_HELLO, ifp->enable_timestamps ? 12 : 6);
}
void
......@@ -1418,8 +1420,8 @@ send_ihu(struct neighbour *neigh, struct interface *ifp)
ll = linklocal(neigh->address);
/* Checks whether the RTT data is not too old to be sent. */
if(neigh->hello_send_us
if(ifp->enable_timestamps && neigh->hello_send_us
/* Checks whether the RTT data is not too old to be sent. */
&& timeval_minus_msec(&now, &neigh->hello_rtt_receive_time) < 1000000) {
send_rtt_data = 1;
} else {
......
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