Commit 98f6ed92 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek Committed by Juliusz Chroboczek

Move enable_timestamps into the buffered structure.

parent 46134e60
......@@ -425,14 +425,14 @@ interface_up(struct interface *ifp, int up)
ifp->max_rtt_penalty = 96;
if(IF_CONF(ifp, enable_timestamps) == CONFIG_YES)
ifp->flags |= IF_TIMESTAMPS;
ifp->buf.enable_timestamps = 1;
else if(IF_CONF(ifp, enable_timestamps) == CONFIG_NO)
ifp->flags &= ~IF_TIMESTAMPS;
ifp->buf.enable_timestamps = 0;
else if(type == IF_TYPE_TUNNEL)
ifp->flags |= IF_TIMESTAMPS;
ifp->buf.enable_timestamps = 1;
else
ifp->flags &= ~IF_TIMESTAMPS;
if(ifp->max_rtt_penalty > 0 && !(ifp->flags & IF_TIMESTAMPS))
ifp->buf.enable_timestamps = 0;
if(ifp->max_rtt_penalty > 0 && !ifp->buf.enable_timestamps)
fprintf(stderr,
"Warning: max_rtt_penalty is set "
"but timestamps are disabled on interface %s.\n",
......
......@@ -69,8 +69,6 @@ struct interface_conf {
#define IF_LQ (1 << 3)
/* Nodes on the far end don't interfere with nodes on the near end. */
#define IF_FARAWAY (1 << 4)
/* Send timestamps in Hello and IHU. */
#define IF_TIMESTAMPS (1 << 5)
/* Remain compatible with RFC 6126. */
#define IF_RFC6126 (1 << 6)
......@@ -85,6 +83,7 @@ struct buffered {
int len;
int size;
struct timeval timeout;
char enable_timestamps;
char have_id;
char have_nh;
char have_prefix;
......
......@@ -342,7 +342,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->flags & IF_TIMESTAMPS) {
if(ifp->buf.enable_timestamps) {
/* We want to track exactly when we received this packet. */
gettime(&now);
}
......@@ -894,7 +894,7 @@ parse_packet(const unsigned char *from, struct interface *ifp,
static int
fill_rtt_message(struct interface *ifp)
{
if((ifp->flags & IF_TIMESTAMPS) && (ifp->buf.hello >= 0)) {
if(ifp->buf.enable_timestamps && (ifp->buf.hello >= 0)) {
if(ifp->buf.buf[ifp->buf.hello + 8] == SUBTLV_PADN &&
ifp->buf.buf[ifp->buf.hello + 9] == 4) {
unsigned int time;
......@@ -1123,19 +1123,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->flags & IF_TIMESTAMPS) ? 12 : 6);
start_message(ifp, MESSAGE_HELLO, ifp->buf.enable_timestamps ? 12 : 6);
ifp->buf.hello = ifp->buf.len - 2;
accumulate_short(ifp, 0);
accumulate_short(ifp, ifp->hello_seqno);
accumulate_short(ifp, interval > 0xFFFF ? 0xFFFF : interval);
if(ifp->flags & IF_TIMESTAMPS) {
if(ifp->buf.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->flags & IF_TIMESTAMPS) ? 12 : 6);
end_message(ifp, MESSAGE_HELLO, ifp->buf.enable_timestamps ? 12 : 6);
}
void
......@@ -1734,7 +1734,7 @@ send_ihu(struct neighbour *neigh, struct interface *ifp)
ll = linklocal(neigh->address);
if((ifp->flags & IF_TIMESTAMPS) && neigh->hello_send_us &&
if(ifp->buf.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;
......
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