Commit b7825f6b authored by Matthieu Boutier's avatar Matthieu Boutier

Implement source-specific requests.

parent 53c84d91
......@@ -2007,16 +2007,14 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
update_myseqno();
}
}
send_update(neigh->ifp, 1, prefix, plen,
xroute->src_prefix, xroute->src_plen);
send_update(neigh->ifp, 1, prefix, plen, src_prefix, src_plen);
return;
}
if(route &&
(memcmp(id, route->src->id, 8) != 0 ||
seqno_compare(seqno, route->seqno) <= 0)) {
send_update(neigh->ifp, 1, prefix, plen,
route->src->src_prefix, route->src->src_plen);
send_update(neigh->ifp, 1, prefix, plen, src_prefix, src_plen);
return;
}
......@@ -2029,7 +2027,8 @@ handle_request(struct neighbour *neigh, const unsigned char *prefix,
return;
}
if(request_redundant(neigh->ifp, prefix, plen, seqno, id))
if(request_redundant(neigh->ifp, prefix, plen, src_prefix, src_plen,
seqno, id))
return;
/* Let's try to forward this request. */
......
......@@ -82,8 +82,6 @@ find_request(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
struct resend **previous_return)
{
if(src_plen != 0)
return NULL;
return find_resend(RESEND_REQUEST, prefix, plen, src_prefix, src_plen,
previous_return);
}
......@@ -97,11 +95,9 @@ record_resend(int kind, const unsigned char *prefix, unsigned char plen,
struct resend *resend;
unsigned int ifindex = ifp ? ifp->ifindex : 0;
if(src_plen != 0)
return 0;
if((kind == RESEND_REQUEST &&
input_filter(NULL, prefix, plen, NULL, 0, NULL, ifindex, NULL) >=
input_filter(NULL, prefix, plen, src_prefix, src_plen, NULL,
ifindex, NULL) >=
INFINITY) ||
(kind == RESEND_UPDATE &&
output_filter(NULL, prefix, plen, src_prefix, src_plen,
......@@ -174,11 +170,12 @@ resend_expired(struct resend *resend)
int
unsatisfied_request(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, const unsigned char *id)
{
struct resend *request;
request = find_request(prefix, plen, zeroes, 0, NULL);
request = find_request(prefix, plen, src_prefix, src_plen, NULL);
if(request == NULL || resend_expired(request))
return 0;
......@@ -193,11 +190,12 @@ unsatisfied_request(const unsigned char *prefix, unsigned char plen,
int
request_redundant(struct interface *ifp,
const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, const unsigned char *id)
{
struct resend *request;
request = find_request(prefix, plen, zeroes, 0, NULL);
request = find_request(prefix, plen, src_prefix, src_plen, NULL);
if(request == NULL || resend_expired(request))
return 0;
......@@ -228,11 +226,7 @@ satisfy_request(const unsigned char *prefix, unsigned char plen,
{
struct resend *request, *previous;
/* TODO */
if(src_plen != 0)
return 0;
request = find_request(prefix, plen, zeroes, 0, &previous);
request = find_request(prefix, plen, src_prefix, src_plen, &previous);
if(request == NULL)
return 0;
......
......@@ -52,9 +52,11 @@ int record_resend(int kind, const unsigned char *prefix, unsigned char plen,
unsigned short seqno, const unsigned char *id,
struct interface *ifp, int delay);
int unsatisfied_request(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, const unsigned char *id);
int request_redundant(struct interface *ifp,
const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
unsigned short seqno, const unsigned char *id);
int satisfy_request(const unsigned char *prefix, unsigned char plen,
const unsigned char *src_prefix, unsigned char src_plen,
......
......@@ -1085,6 +1085,7 @@ send_triggered_update(struct babel_route *route, struct source *oldsrc,
/* Route getting significantly worse */
urgent = 1;
else if(unsatisfied_request(route->src->prefix, route->src->plen,
route->src->src_prefix, route->src->src_plen,
route->seqno, route->src->id))
/* Make sure that requests are satisfied speedily */
urgent = 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