Commit a28c9e3a authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Replace the field enable_timestamps with an interface flag.

Makes it consistent with the other interface flags.
parent 210445b1
......@@ -294,7 +294,7 @@ interface_up(struct interface *ifp, int up)
ifp->flags |= IF_FARAWAY;
if(IF_CONF(ifp, enable_timestamps) == CONFIG_YES)
ifp->enable_timestamps = 1;
ifp->flags |= IF_TIMESTAMPS;
if(IF_CONF(ifp, hello_interval) > 0)
ifp->hello_interval = IF_CONF(ifp, hello_interval);
......
......@@ -54,6 +54,7 @@ struct interface_conf {
#define IF_SPLIT_HORIZON (1 << 2)
#define IF_LQ (1 << 3)
#define IF_FARAWAY (1 << 4)
#define IF_TIMESTAMPS (1 << 5)
/* Only INTERFERING can appear on the wire. */
#define IF_CHANNEL_UNKNOWN 0
......@@ -96,7 +97,6 @@ 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;
......
......@@ -284,7 +284,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
/* Content of the RTT sub-TLV on IHU messages. */
unsigned int hello_send_us = 0, hello_rtt_receive_time = 0;
if(ifp->enable_timestamps) {
if(ifp->flags & IF_TIMESTAMPS) {
/* We want to track exactly when we received this packet. */
gettime(&now);
}
......@@ -664,7 +664,7 @@ check_bucket(struct interface *ifp)
static int
fill_rtt_message(struct interface *ifp)
{
if(ifp->enable_timestamps && (ifp->buffered_hello >= 0)) {
if((ifp->flags & IF_TIMESTAMPS) && (ifp->buffered_hello >= 0)) {
if(ifp->sendbuf[ifp->buffered_hello + 8] == SUBTLV_PADN &&
ifp->sendbuf[ifp->buffered_hello + 9] == 4) {
unsigned int time;
......@@ -903,19 +903,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, ifp->enable_timestamps ? 12 : 6);
start_message(ifp, MESSAGE_HELLO, (ifp->flags & IF_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);
if(ifp->enable_timestamps) {
if(ifp->flags & IF_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);
end_message(ifp, MESSAGE_HELLO, (ifp->flags & IF_TIMESTAMPS) ? 12 : 6);
}
void
......@@ -1439,7 +1439,7 @@ send_ihu(struct neighbour *neigh, struct interface *ifp)
ll = linklocal(neigh->address);
if(ifp->enable_timestamps && neigh->hello_send_us
if((ifp->flags & IF_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;
......
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