Skip to content

Commit

Permalink
Implement source-specific updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthieu Boutier authored and Juliusz Chroboczek committed Mar 13, 2015
1 parent 938e166 commit 1353046
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
14 changes: 12 additions & 2 deletions message.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down

0 comments on commit 1353046

Please sign in to comment.