1
0
mirror of https://gitlab.labs.nic.cz/labs/bird.git synced 2024-05-11 16:54:54 +00:00

Babel: Send wildcard retractions on shutdown and startup

This makes BIRD send a wildcard retraction on all interfaces before
shutting down and right after starting up. This helps ensure that
neighbours will discard the announced routes as soon as possible,
rather than only after the normal timeout procedures.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
This commit is contained in:
Ondrej Zajicek (work)
2016-07-19 14:23:41 +02:00
parent ecae2f43f3
commit 5d6ca22085
3 changed files with 65 additions and 12 deletions

View File

@@ -462,7 +462,6 @@ babel_read_update(struct babel_tlv *hdr, union babel_msg *m,
struct babel_msg_update *msg = &m->update;
msg->type = BABEL_TLV_UPDATE;
msg->ae = tlv->ae;
msg->interval = get_time16(&tlv->interval);
msg->seqno = get_u16(&tlv->seqno);
msg->metric = get_u16(&tlv->metric);
@@ -480,8 +479,7 @@ babel_read_update(struct babel_tlv *hdr, union babel_msg *m,
if (tlv->plen > 0)
return PARSE_ERROR;
msg->plen = 0;
msg->prefix = IPA_NONE;
msg->wildcard = 1;
break;
case BABEL_AE_IP4:
@@ -550,8 +548,11 @@ babel_write_update(struct babel_tlv *hdr, union babel_msg *m,
* When needed, we write Router-ID TLV before Update TLV and return size of
* both of them. There is enough space for the Router-ID TLV, because
* sizeof(struct babel_tlv_router_id) == sizeof(struct babel_tlv_update).
*
* Router ID is not used for retractions, so do not us it in such case.
*/
if (!state->router_id_seen || (msg->router_id != state->router_id))
if ((msg->metric < BABEL_INFINITY) &&
(!state->router_id_seen || (msg->router_id != state->router_id)))
{
len0 = babel_write_router_id(hdr, msg->router_id, state, max_len);
tlv = (struct babel_tlv_update *) NEXT_TLV(tlv);
@@ -564,12 +565,22 @@ babel_write_update(struct babel_tlv *hdr, union babel_msg *m,
memset(tlv, 0, sizeof(struct babel_tlv_update));
TLV_HDR(tlv, BABEL_TLV_UPDATE, len);
tlv->ae = BABEL_AE_IP6;
tlv->plen = msg->plen;
if (msg->wildcard)
{
tlv->ae = BABEL_AE_WILDCARD;
tlv->plen = 0;
}
else
{
tlv->ae = BABEL_AE_IP6;
tlv->plen = msg->plen;
put_ip6_px(tlv->addr, msg->prefix, msg->plen);
}
put_time16(&tlv->interval, msg->interval);
put_u16(&tlv->seqno, msg->seqno);
put_u16(&tlv->metric, msg->metric);
put_ip6_px(tlv->addr, msg->prefix, msg->plen);
return len0 + len;
}