Commit 13530463 authored by Matthieu Boutier's avatar Matthieu Boutier Committed by Juliusz Chroboczek

Implement source-specific updates.

parent 938e166f
......@@ -96,6 +96,7 @@ struct interface {
time_t bucket_time;
unsigned int bucket;
time_t last_update_time;
time_t last_specific_update_time;
unsigned short hello_seqno;
unsigned hello_interval;
unsigned update_interval;
......
......@@ -1488,6 +1488,9 @@ buffer_update(struct interface *ifp,
ifp->num_buffered_updates++;
}
/* Full wildcard update with prefix == src_prefix == NULL,
Standard wildcard update with prefix == NULL && src_prefix != NULL,
Specific wildcard update with prefix != NULL && src_prefix == NULL. */
void
send_update(struct interface *ifp, int urgent,
const unsigned char *prefix, unsigned char plen,
......@@ -1512,12 +1515,12 @@ send_update(struct interface *ifp, int urgent,
if(!if_up(ifp))
return;
if(prefix) {
if(prefix && src_prefix) {
debugf("Sending update to %s for %s from %s.\n",
ifp->name, format_prefix(prefix, plen),
format_prefix(src_prefix, src_plen));
buffer_update(ifp, prefix, plen, src_prefix, src_plen);
} else {
} else if(prefix || src_prefix) {
struct route_stream *routes;
send_self_update(ifp);
debugf("Sending update to %s for any.\n", ifp->name);
......@@ -1527,6 +1530,9 @@ send_update(struct interface *ifp, int urgent,
struct babel_route *route = route_stream_next(routes);
if(route == NULL)
break;
if((src_prefix && route->src->src_plen != 0) ||
(prefix && route->src->src_plen == 0))
continue;
buffer_update(ifp, route->src->prefix, route->src->plen,
route->src->src_prefix, route->src->src_plen);
}
......@@ -1536,6 +1542,10 @@ send_update(struct interface *ifp, int urgent,
}
set_timeout(&ifp->update_timeout, ifp->update_interval);
ifp->last_update_time = now.tv_sec;
ifp->last_specific_update_time = now.tv_sec;
} else {
send_update(ifp, urgent, NULL, 0, zeroes, 0);
send_update(ifp, urgent, zeroes, 0, NULL, 0);
}
schedule_update_flush(ifp, urgent);
}
......
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