1
1
# Patch by Daniel Gröber <dxld at darkboxed.org>
2
2
# Source: https://bird.network.cz/pipermail/bird-users/2023-February/016705.html
3
3
4
- diff --git a/proto/babel/babel.c b/proto/babel/babel.c
5
- index 04613788..c030784a 100644
6
4
--- a/proto/babel/babel.c
7
5
+++ b/proto/babel/babel.c
8
6
@@ -28,10 +28,12 @@
@@ -22,7 +20,7 @@ index 04613788..c030784a 100644
22
20
*
23
21
* Supported standards:
24
22
* RFC 8966 - The Babel Routing Protocol
25
- @@ -59,8 +61,8 @@ static inline int gt_mod64k(uint a, uint b)
23
+ @@ -59,8 +61,8 @@ static inline int gt_mod64k(uint a, uint
26
24
{ return ge_mod64k(a, b) && a != b; }
27
25
28
26
static void babel_expire_requests(struct babel_proto *p, struct babel_entry *e);
@@ -44,7 +42,7 @@ index 04613788..c030784a 100644
44
42
}
45
43
46
44
static void
47
- @@ -192,9 +192,6 @@ babel_flush_route(struct babel_proto *p UNUSED, struct babel_route *r)
45
+ @@ -192,9 +192,6 @@ babel_flush_route(struct babel_proto *p
48
46
rem_node(NODE r);
49
47
rem_node(&r->neigh_route);
50
48
@@ -54,15 +52,15 @@ index 04613788..c030784a 100644
54
52
sl_free(r);
55
53
}
56
54
57
- @@ -210,6 +207,7 @@ babel_expire_route(struct babel_proto *p, struct babel_route *r)
55
+ @@ -210,6 +207,7 @@ babel_expire_route(struct babel_proto *p
58
56
{
59
57
r->metric = r->advert_metric = BABEL_INFINITY;
60
58
r->expires = current_time() + cf->hold_time;
61
59
+ babel_announce_rte(p, r->e, r);
62
60
}
63
61
else
64
62
{
65
- @@ -239,8 +237,6 @@ babel_expire_routes_(struct babel_proto *p, struct fib *rtable)
63
+ @@ -239,8 +237,6 @@ babel_expire_routes_(struct babel_proto
66
64
loop:
67
65
FIB_ITERATE_START(rtable, &fit, struct babel_entry, e)
68
66
{
@@ -106,7 +104,7 @@ index 04613788..c030784a 100644
106
104
goto loop;
107
105
}
108
106
109
- @@ -457,6 +442,8 @@ babel_get_neighbor(struct babel_iface *ifa, ip_addr addr)
107
+ @@ -457,6 +442,8 @@ babel_get_neighbor(struct babel_iface *i
110
108
111
109
nbr = mb_allocz(ifa->pool, sizeof(struct babel_neighbor));
112
110
nbr->ifa = ifa;
@@ -115,7 +113,7 @@ index 04613788..c030784a 100644
115
113
nbr->addr = addr;
116
114
nbr->rxcost = BABEL_INFINITY;
117
115
nbr->txcost = BABEL_INFINITY;
118
- @@ -484,6 +471,9 @@ babel_flush_neighbor(struct babel_proto *p, struct babel_neighbor *nbr)
116
+ @@ -484,6 +471,9 @@ babel_flush_neighbor(struct babel_proto
119
117
}
120
118
121
119
nbr->ifa = NULL;
@@ -125,7 +123,7 @@ index 04613788..c030784a 100644
125
123
rem_node(NODE nbr);
126
124
mb_free(nbr);
127
125
}
128
- @@ -663,11 +653,47 @@ done:
126
+ @@ -663,12 +653,48 @@ done:
129
127
WALK_LIST2(r, n, nbr->routes, neigh_route)
130
128
{
131
129
r->metric = babel_compute_metric(nbr, r->advert_metric);
@@ -135,7 +133,7 @@ index 04613788..c030784a 100644
135
133
}
136
134
}
137
135
138
- + /**
136
+ /**
139
137
+ * This function handles announcing the special unreachable route we insert for
140
138
+ * a prefix whenever we have no more feasible routes available as per RFC8966
141
139
+ * section 3.5.4 as well as retracting it when such routes are available
@@ -171,9 +169,10 @@ index 04613788..c030784a 100644
171
169
+ rte_update2(c, e->n.addr, rte, p->p.main_source);
172
170
+}
173
171
+
174
- /**
172
+ + /**
175
173
* babel_announce_rte - announce selected route to the core
176
174
* @p: Babel protocol instance
175
+ * @e: Babel route entry to announce
177
176
@@ -678,12 +704,11 @@ done:
178
177
* the entry is valid and ours, the unreachable route is announced instead.
179
178
*/
@@ -189,7 +188,7 @@ index 04613788..c030784a 100644
189
188
{
190
189
rta a0 = {
191
190
.source = RTS_BABEL,
192
- @@ -727,122 +752,24 @@ babel_announce_rte(struct babel_proto *p, struct babel_entry *e)
191
+ @@ -727,122 +752,24 @@ babel_announce_rte(struct babel_proto *p
193
192
a0.nh.flags = RNF_ONLINK;
194
193
195
194
rta *a = rta_lookup(&a0);
@@ -324,7 +323,7 @@ index 04613788..c030784a 100644
324
323
}
325
324
326
325
/*
327
- @@ -1405,7 +1332,12 @@ babel_handle_update(union babel_msg *m, struct babel_iface *ifa)
326
+ @@ -1405,7 +1332,12 @@ babel_handle_update(union babel_msg *m,
328
327
/*
329
328
* RFC 8966 3.8.2.2 - dealing with unfeasible updates. Generate a one-off
330
329
* (not retransmitted) unicast seqno request to the originator of this update.
@@ -338,7 +337,7 @@ index 04613788..c030784a 100644
338
337
*/
339
338
if (!feasible && s && (metric != BABEL_INFINITY) &&
340
339
(!best || (r == best) || (metric < best->metric)))
341
- @@ -1439,7 +1371,7 @@ babel_handle_update(union babel_msg *m, struct babel_iface *ifa)
340
+ @@ -1439,7 +1371,7 @@ babel_handle_update(union babel_msg *m,
342
341
e->updated = current_time();
343
342
}
344
343
@@ -365,7 +364,7 @@ index 04613788..c030784a 100644
365
364
babel_dump_route(r);
366
365
}
367
366
}
368
- @@ -2303,7 +2235,7 @@ babel_show_entries_(struct babel_proto *p, struct fib *rtable)
367
+ @@ -2303,7 +2235,7 @@ babel_show_entries_(struct babel_proto *
369
368
370
369
FIB_WALK(rtable, struct babel_entry, e)
371
370
{
@@ -374,7 +373,7 @@ index 04613788..c030784a 100644
374
373
uint rts = 0, srcs = 0;
375
374
node *n;
376
375
377
- @@ -2316,7 +2248,7 @@ babel_show_entries_(struct babel_proto *p, struct fib *rtable)
376
+ @@ -2316,7 +2248,7 @@ babel_show_entries_(struct babel_proto *
378
377
if (e->valid)
379
378
cli_msg(-1025, "%-*N %-23lR %6u %5u %7u %7u", width,
380
379
e->n.addr, e->router_id, e->metric, e->seqno, rts, srcs);
@@ -383,7 +382,7 @@ index 04613788..c030784a 100644
383
382
cli_msg(-1025, "%-*N %-23lR %6u %5u %7u %7u", width,
384
383
e->n.addr, r->router_id, r->metric, r->seqno, rts, srcs);
385
384
else
386
- @@ -2353,10 +2285,10 @@ babel_show_routes_(struct babel_proto *p, struct fib *rtable)
385
+ @@ -2353,10 +2285,10 @@ babel_show_routes_(struct babel_proto *p
387
386
388
387
FIB_WALK(rtable, struct babel_entry, e)
389
388
{
@@ -396,7 +395,7 @@ index 04613788..c030784a 100644
396
395
btime time = r->expires ? r->expires - current_time() : 0;
397
396
cli_msg(-1025, "%-*N %-25I %-10s %5u %c %5u %7t", width,
398
397
e->n.addr, r->next_hop, r->neigh->ifa->ifname,
399
- @@ -2428,8 +2360,9 @@ babel_preexport(struct channel *C, struct rte *new)
398
+ @@ -2428,8 +2360,9 @@ babel_preexport(struct channel *C, struc
400
399
}
401
400
402
401
/*
@@ -408,7 +407,7 @@ index 04613788..c030784a 100644
408
407
*/
409
408
static void
410
409
babel_rt_notify(struct proto *P, struct channel *c UNUSED, struct network *net,
411
- @@ -2437,15 +2370,19 @@ babel_rt_notify(struct proto *P, struct channel *c UNUSED, struct network *net,
410
+ @@ -2437,15 +2370,19 @@ babel_rt_notify(struct proto *P, struct
412
411
{
413
412
struct babel_proto *p = (void *) P;
414
413
struct babel_entry *e;
@@ -429,7 +428,7 @@ index 04613788..c030784a 100644
429
428
{
430
429
rt_seqno = ea_find(new->attrs->eattrs, EA_BABEL_SEQNO)->u.data;
431
430
eattr *e = ea_find(new->attrs->eattrs, EA_BABEL_ROUTER_ID);
432
- @@ -2454,6 +2391,8 @@ babel_rt_notify(struct proto *P, struct channel *c UNUSED, struct network *net,
431
+ @@ -2454,6 +2391,8 @@ babel_rt_notify(struct proto *P, struct
433
432
}
434
433
else
435
434
{
@@ -438,7 +437,7 @@ index 04613788..c030784a 100644
438
437
rt_seqno = p->update_seqno;
439
438
rt_router_id = p->router_id;
440
439
}
441
- @@ -2467,6 +2406,27 @@ babel_rt_notify(struct proto *P, struct channel *c UNUSED, struct network *net,
440
+ @@ -2467,6 +2406,27 @@ babel_rt_notify(struct proto *P, struct
442
441
443
442
e = babel_get_entry(p, net->n.addr);
444
443
@@ -466,7 +465,7 @@ index 04613788..c030784a 100644
466
465
/* Activate triggered updates */
467
466
if ((e->valid != BABEL_ENTRY_VALID) ||
468
467
(e->router_id != rt_router_id))
469
- @@ -2488,8 +2448,26 @@ babel_rt_notify(struct proto *P, struct channel *c UNUSED, struct network *net,
468
+ @@ -2488,8 +2448,26 @@ babel_rt_notify(struct proto *P, struct
470
469
if (!e || e->valid != BABEL_ENTRY_VALID)
471
470
return;
472
471
@@ -501,8 +500,6 @@ index 04613788..c030784a 100644
501
500
502
501
p->log_pkt_tbf = (struct tbf){ .rate = 1, .burst = 5 };
503
502
504
- diff --git a/proto/babel/babel.h b/proto/babel/babel.h
505
- index edde4cab..3868d7c4 100644
506
503
--- a/proto/babel/babel.h
507
504
+++ b/proto/babel/babel.h
508
505
@@ -25,6 +25,7 @@
@@ -529,4 +526,3 @@ index edde4cab..3868d7c4 100644
529
526
530
527
ip_addr addr;
531
528
u16 rxcost; /* Sent in last IHU */
532
- --
0 commit comments