]> git.ipfire.org Git - thirdparty/bird.git/blob - nest/rt-attr.c
Implements IGP metric comparison for BGP routes.
[thirdparty/bird.git] / nest / rt-attr.c
1 /*
2 * BIRD -- Route Attribute Cache
3 *
4 * (c) 1998--2000 Martin Mares <mj@ucw.cz>
5 *
6 * Can be freely distributed and used under the terms of the GNU GPL.
7 */
8
9 /**
10 * DOC: Route attribute cache
11 *
12 * Each route entry carries a set of route attributes. Several of them
13 * vary from route to route, but most attributes are usually common
14 * for a large number of routes. To conserve memory, we've decided to
15 * store only the varying ones directly in the &rte and hold the rest
16 * in a special structure called &rta which is shared among all the
17 * &rte's with these attributes.
18 *
19 * Each &rta contains all the static attributes of the route (i.e.,
20 * those which are always present) as structure members and a list of
21 * dynamic attributes represented by a linked list of &ea_list
22 * structures, each of them consisting of an array of &eattr's containing
23 * the individual attributes. An attribute can be specified more than once
24 * in the &ea_list chain and in such case the first occurrence overrides
25 * the others. This semantics is used especially when someone (for example
26 * a filter) wishes to alter values of several dynamic attributes, but
27 * it wants to preserve the original attribute lists maintained by
28 * another module.
29 *
30 * Each &eattr contains an attribute identifier (split to protocol ID and
31 * per-protocol attribute ID), protocol dependent flags, a type code (consisting
32 * of several bit fields describing attribute characteristics) and either an
33 * embedded 32-bit value or a pointer to a &adata structure holding attribute
34 * contents.
35 *
36 * There exist two variants of &rta's -- cached and un-cached ones. Un-cached
37 * &rta's can have arbitrarily complex structure of &ea_list's and they
38 * can be modified by any module in the route processing chain. Cached
39 * &rta's have their attribute lists normalized (that means at most one
40 * &ea_list is present and its values are sorted in order to speed up
41 * searching), they are stored in a hash table to make fast lookup possible
42 * and they are provided with a use count to allow sharing.
43 *
44 * Routing tables always contain only cached &rta's.
45 */
46
47 #include "nest/bird.h"
48 #include "nest/route.h"
49 #include "nest/protocol.h"
50 #include "nest/iface.h"
51 #include "nest/cli.h"
52 #include "nest/attrs.h"
53 #include "lib/alloca.h"
54 #include "lib/resource.h"
55 #include "lib/string.h"
56
57 pool *rta_pool;
58
59 static slab *rta_slab;
60
61 struct protocol *attr_class_to_protocol[EAP_MAX];
62
63 /*
64 * Extended Attributes
65 */
66
67 static inline eattr *
68 ea__find(ea_list *e, unsigned id)
69 {
70 eattr *a;
71 int l, r, m;
72
73 while (e)
74 {
75 if (e->flags & EALF_BISECT)
76 {
77 l = 0;
78 r = e->count - 1;
79 while (l <= r)
80 {
81 m = (l+r) / 2;
82 a = &e->attrs[m];
83 if (a->id == id)
84 return a;
85 else if (a->id < id)
86 l = m+1;
87 else
88 r = m-1;
89 }
90 }
91 else
92 for(m=0; m<e->count; m++)
93 if (e->attrs[m].id == id)
94 return &e->attrs[m];
95 e = e->next;
96 }
97 return NULL;
98 }
99
100 /**
101 * ea_find - find an extended attribute
102 * @e: attribute list to search in
103 * @id: attribute ID to search for
104 *
105 * Given an extended attribute list, ea_find() searches for a first
106 * occurrence of an attribute with specified ID, returning either a pointer
107 * to its &eattr structure or %NULL if no such attribute exists.
108 */
109 eattr *
110 ea_find(ea_list *e, unsigned id)
111 {
112 eattr *a = ea__find(e, id & EA_CODE_MASK);
113
114 if (a && (a->type & EAF_TYPE_MASK) == EAF_TYPE_UNDEF &&
115 !(id & EA_ALLOW_UNDEF))
116 return NULL;
117 return a;
118 }
119
120 /**
121 * ea_get_int - fetch an integer attribute
122 * @e: attribute list
123 * @id: attribute ID
124 * @def: default value
125 *
126 * This function is a shortcut for retrieving a value of an integer attribute
127 * by calling ea_find() to find the attribute, extracting its value or returning
128 * a provided default if no such attribute is present.
129 */
130 int
131 ea_get_int(ea_list *e, unsigned id, int def)
132 {
133 eattr *a = ea_find(e, id);
134 if (!a)
135 return def;
136 return a->u.data;
137 }
138
139 static inline void
140 ea_do_sort(ea_list *e)
141 {
142 unsigned n = e->count;
143 eattr *a = e->attrs;
144 eattr *b = alloca(n * sizeof(eattr));
145 unsigned s, ss;
146
147 /* We need to use a stable sorting algorithm, hence mergesort */
148 do
149 {
150 s = ss = 0;
151 while (s < n)
152 {
153 eattr *p, *q, *lo, *hi;
154 p = b;
155 ss = s;
156 *p++ = a[s++];
157 while (s < n && p[-1].id <= a[s].id)
158 *p++ = a[s++];
159 if (s < n)
160 {
161 q = p;
162 *p++ = a[s++];
163 while (s < n && p[-1].id <= a[s].id)
164 *p++ = a[s++];
165 lo = b;
166 hi = q;
167 s = ss;
168 while (lo < q && hi < p)
169 if (lo->id <= hi->id)
170 a[s++] = *lo++;
171 else
172 a[s++] = *hi++;
173 while (lo < q)
174 a[s++] = *lo++;
175 while (hi < p)
176 a[s++] = *hi++;
177 }
178 }
179 }
180 while (ss);
181 }
182
183 static inline void
184 ea_do_prune(ea_list *e)
185 {
186 eattr *s, *d, *l, *s0;
187 int i = 0;
188
189 /* Discard duplicates and undefs. Do you remember sorting was stable? */
190 s = d = e->attrs;
191 l = e->attrs + e->count;
192 while (s < l)
193 {
194 s0 = s++;
195 while (s < l && s->id == s[-1].id)
196 s++;
197 /* s0 is the most recent version, s[-1] the oldest one */
198 if ((s0->type & EAF_TYPE_MASK) != EAF_TYPE_UNDEF)
199 {
200 *d = *s0;
201 d->type = (d->type & ~EAF_ORIGINATED) | (s[-1].type & EAF_ORIGINATED);
202 d++;
203 i++;
204 }
205 }
206 e->count = i;
207 }
208
209 /**
210 * ea_sort - sort an attribute list
211 * @e: list to be sorted
212 *
213 * This function takes a &ea_list chain and sorts the attributes
214 * within each of its entries.
215 *
216 * If an attribute occurs multiple times in a single &ea_list,
217 * ea_sort() leaves only the first (the only significant) occurrence.
218 */
219 void
220 ea_sort(ea_list *e)
221 {
222 while (e)
223 {
224 if (!(e->flags & EALF_SORTED))
225 {
226 ea_do_sort(e);
227 ea_do_prune(e);
228 e->flags |= EALF_SORTED;
229 }
230 if (e->count > 5)
231 e->flags |= EALF_BISECT;
232 e = e->next;
233 }
234 }
235
236 /**
237 * ea_scan - estimate attribute list size
238 * @e: attribute list
239 *
240 * This function calculates an upper bound of the size of
241 * a given &ea_list after merging with ea_merge().
242 */
243 unsigned
244 ea_scan(ea_list *e)
245 {
246 unsigned cnt = 0;
247
248 while (e)
249 {
250 cnt += e->count;
251 e = e->next;
252 }
253 return sizeof(ea_list) + sizeof(eattr)*cnt;
254 }
255
256 /**
257 * ea_merge - merge segments of an attribute list
258 * @e: attribute list
259 * @t: buffer to store the result to
260 *
261 * This function takes a possibly multi-segment attribute list
262 * and merges all of its segments to one.
263 *
264 * The primary use of this function is for &ea_list normalization:
265 * first call ea_scan() to determine how much memory will the result
266 * take, then allocate a buffer (usually using alloca()), merge the
267 * segments with ea_merge() and finally sort and prune the result
268 * by calling ea_sort().
269 */
270 void
271 ea_merge(ea_list *e, ea_list *t)
272 {
273 eattr *d = t->attrs;
274
275 t->flags = 0;
276 t->count = 0;
277 t->next = NULL;
278 while (e)
279 {
280 memcpy(d, e->attrs, sizeof(eattr)*e->count);
281 t->count += e->count;
282 d += e->count;
283 e = e->next;
284 }
285 }
286
287 /**
288 * ea_same - compare two &ea_list's
289 * @x: attribute list
290 * @y: attribute list
291 *
292 * ea_same() compares two normalized attribute lists @x and @y and returns
293 * 1 if they contain the same attributes, 0 otherwise.
294 */
295 int
296 ea_same(ea_list *x, ea_list *y)
297 {
298 int c;
299
300 if (!x || !y)
301 return x == y;
302 ASSERT(!x->next && !y->next);
303 if (x->count != y->count)
304 return 0;
305 for(c=0; c<x->count; c++)
306 {
307 eattr *a = &x->attrs[c];
308 eattr *b = &y->attrs[c];
309
310 if (a->id != b->id ||
311 a->flags != b->flags ||
312 a->type != b->type ||
313 ((a->type & EAF_EMBEDDED) ? a->u.data != b->u.data :
314 (a->u.ptr->length != b->u.ptr->length || memcmp(a->u.ptr->data, b->u.ptr->data, a->u.ptr->length))))
315 return 0;
316 }
317 return 1;
318 }
319
320 static inline ea_list *
321 ea_list_copy(ea_list *o)
322 {
323 ea_list *n;
324 unsigned i, len;
325
326 if (!o)
327 return NULL;
328 ASSERT(!o->next);
329 len = sizeof(ea_list) + sizeof(eattr) * o->count;
330 n = mb_alloc(rta_pool, len);
331 memcpy(n, o, len);
332 n->flags |= EALF_CACHED;
333 for(i=0; i<o->count; i++)
334 {
335 eattr *a = &n->attrs[i];
336 if (!(a->type & EAF_EMBEDDED))
337 {
338 unsigned size = sizeof(struct adata) + a->u.ptr->length;
339 struct adata *d = mb_alloc(rta_pool, size);
340 memcpy(d, a->u.ptr, size);
341 a->u.ptr = d;
342 }
343 }
344 return n;
345 }
346
347 static inline void
348 ea_free(ea_list *o)
349 {
350 int i;
351
352 if (o)
353 {
354 ASSERT(!o->next);
355 for(i=0; i<o->count; i++)
356 {
357 eattr *a = &o->attrs[i];
358 if (!(a->type & EAF_EMBEDDED))
359 mb_free(a->u.ptr);
360 }
361 mb_free(o);
362 }
363 }
364
365 /**
366 * ea_format - format an &eattr for printing
367 * @e: attribute to be formatted
368 * @buf: destination buffer of size %EA_FORMAT_BUF_SIZE
369 *
370 * This function takes an extended attribute represented by its
371 * &eattr structure and formats it nicely for printing according
372 * to the type information.
373 *
374 * If the protocol defining the attribute provides its own
375 * get_attr() hook, it's consulted first.
376 */
377 void
378 ea_format(eattr *e, byte *buf)
379 {
380 struct protocol *p;
381 int status = GA_UNKNOWN;
382 unsigned int i;
383 struct adata *ad = (e->type & EAF_EMBEDDED) ? NULL : e->u.ptr;
384 byte *end = buf + EA_FORMAT_BUF_SIZE - 1;
385
386 if (p = attr_class_to_protocol[EA_PROTO(e->id)])
387 {
388 buf += bsprintf(buf, "%s.", p->name);
389 if (p->get_attr)
390 status = p->get_attr(e, buf, end - buf);
391 buf += strlen(buf);
392 }
393 else if (EA_PROTO(e->id))
394 buf += bsprintf(buf, "%02x.", EA_PROTO(e->id));
395 if (status < GA_NAME)
396 buf += bsprintf(buf, "%02x", EA_ID(e->id));
397 if (status < GA_FULL)
398 {
399 *buf++ = ':';
400 *buf++ = ' ';
401 switch (e->type & EAF_TYPE_MASK)
402 {
403 case EAF_TYPE_INT:
404 bsprintf(buf, "%u", e->u.data);
405 break;
406 case EAF_TYPE_OPAQUE:
407 *buf = 0;
408 for(i=0; i<ad->length; i++)
409 {
410 if (buf > end - 8)
411 {
412 strcpy(buf, " ...");
413 break;
414 }
415 if (i)
416 *buf++ = ' ';
417 buf += bsprintf(buf, "%02x", ad->data[i]);
418 }
419 break;
420 case EAF_TYPE_IP_ADDRESS:
421 bsprintf(buf, "%I", *(ip_addr *) ad->data);
422 break;
423 case EAF_TYPE_ROUTER_ID:
424 bsprintf(buf, "%R", e->u.data);
425 break;
426 case EAF_TYPE_AS_PATH:
427 as_path_format(ad, buf, end - buf);
428 break;
429 case EAF_TYPE_INT_SET:
430 int_set_format(ad, 1, buf, end - buf);
431 break;
432 case EAF_TYPE_UNDEF:
433 default:
434 bsprintf(buf, "<type %02x>", e->type);
435 }
436 }
437 }
438
439 /**
440 * ea_dump - dump an extended attribute
441 * @e: attribute to be dumped
442 *
443 * ea_dump() dumps contents of the extended attribute given to
444 * the debug output.
445 */
446 void
447 ea_dump(ea_list *e)
448 {
449 int i;
450
451 if (!e)
452 {
453 debug("NONE");
454 return;
455 }
456 while (e)
457 {
458 debug("[%c%c%c]",
459 (e->flags & EALF_SORTED) ? 'S' : 's',
460 (e->flags & EALF_BISECT) ? 'B' : 'b',
461 (e->flags & EALF_CACHED) ? 'C' : 'c');
462 for(i=0; i<e->count; i++)
463 {
464 eattr *a = &e->attrs[i];
465 debug(" %02x:%02x.%02x", EA_PROTO(a->id), EA_ID(a->id), a->flags);
466 if (a->type & EAF_TEMP)
467 debug("T");
468 debug("=%c", "?iO?I?P???S?????" [a->type & EAF_TYPE_MASK]);
469 if (a->type & EAF_ORIGINATED)
470 debug("o");
471 if (a->type & EAF_EMBEDDED)
472 debug(":%08x", a->u.data);
473 else
474 {
475 int j, len = a->u.ptr->length;
476 debug("[%d]:", len);
477 for(j=0; j<len; j++)
478 debug("%02x", a->u.ptr->data[j]);
479 }
480 }
481 if (e = e->next)
482 debug(" | ");
483 }
484 }
485
486 /**
487 * ea_hash - calculate an &ea_list hash key
488 * @e: attribute list
489 *
490 * ea_hash() takes an extended attribute list and calculated a hopefully
491 * uniformly distributed hash value from its contents.
492 */
493 inline unsigned int
494 ea_hash(ea_list *e)
495 {
496 u32 h = 0;
497 int i;
498
499 if (e) /* Assuming chain of length 1 */
500 {
501 for(i=0; i<e->count; i++)
502 {
503 struct eattr *a = &e->attrs[i];
504 h ^= a->id;
505 if (a->type & EAF_EMBEDDED)
506 h ^= a->u.data;
507 else
508 {
509 struct adata *d = a->u.ptr;
510 int size = d->length;
511 byte *z = d->data;
512 while (size >= 4)
513 {
514 h ^= *(u32 *)z;
515 z += 4;
516 size -= 4;
517 }
518 while (size--)
519 h = (h >> 24) ^ (h << 8) ^ *z++;
520 }
521 }
522 h ^= h >> 16;
523 h ^= h >> 6;
524 h &= 0xffff;
525 }
526 return h;
527 }
528
529 /**
530 * ea_append - concatenate &ea_list's
531 * @to: destination list (can be %NULL)
532 * @what: list to be appended (can be %NULL)
533 *
534 * This function appends the &ea_list @what at the end of
535 * &ea_list @to and returns a pointer to the resulting list.
536 */
537 ea_list *
538 ea_append(ea_list *to, ea_list *what)
539 {
540 ea_list *res;
541
542 if (!to)
543 return what;
544 res = to;
545 while (to->next)
546 to = to->next;
547 to->next = what;
548 return res;
549 }
550
551 /*
552 * rta's
553 */
554
555 static unsigned int rta_cache_count;
556 static unsigned int rta_cache_size = 32;
557 static unsigned int rta_cache_limit;
558 static unsigned int rta_cache_mask;
559 static rta **rta_hash_table;
560
561 static void
562 rta_alloc_hash(void)
563 {
564 rta_hash_table = mb_allocz(rta_pool, sizeof(rta *) * rta_cache_size);
565 if (rta_cache_size < 32768)
566 rta_cache_limit = rta_cache_size * 2;
567 else
568 rta_cache_limit = ~0;
569 rta_cache_mask = rta_cache_size - 1;
570 }
571
572 static inline unsigned int
573 rta_hash(rta *a)
574 {
575 return (a->proto->hash_key ^ ipa_hash(a->gw) ^ ea_hash(a->eattrs)) & 0xffff;
576 }
577
578 static inline int
579 rta_same(rta *x, rta *y)
580 {
581 return (x->proto == y->proto &&
582 x->source == y->source &&
583 x->scope == y->scope &&
584 x->cast == y->cast &&
585 x->dest == y->dest &&
586 x->flags == y->flags &&
587 x->igp_metric == y->igp_metric &&
588 ipa_equal(x->gw, y->gw) &&
589 ipa_equal(x->from, y->from) &&
590 x->iface == y->iface &&
591 x->hostentry == y->hostentry &&
592 ea_same(x->eattrs, y->eattrs));
593 }
594
595 static rta *
596 rta_copy(rta *o)
597 {
598 rta *r = sl_alloc(rta_slab);
599
600 memcpy(r, o, sizeof(rta));
601 r->uc = 1;
602 r->eattrs = ea_list_copy(o->eattrs);
603 return r;
604 }
605
606 static inline void
607 rta_insert(rta *r)
608 {
609 unsigned int h = r->hash_key & rta_cache_mask;
610 r->next = rta_hash_table[h];
611 if (r->next)
612 r->next->pprev = &r->next;
613 r->pprev = &rta_hash_table[h];
614 rta_hash_table[h] = r;
615 }
616
617 static void
618 rta_rehash(void)
619 {
620 unsigned int ohs = rta_cache_size;
621 unsigned int h;
622 rta *r, *n;
623 rta **oht = rta_hash_table;
624
625 rta_cache_size = 2*rta_cache_size;
626 DBG("Rehashing rta cache from %d to %d entries.\n", ohs, rta_cache_size);
627 rta_alloc_hash();
628 for(h=0; h<ohs; h++)
629 for(r=oht[h]; r; r=n)
630 {
631 n = r->next;
632 rta_insert(r);
633 }
634 mb_free(oht);
635 }
636
637 /**
638 * rta_lookup - look up a &rta in attribute cache
639 * @o: a un-cached &rta
640 *
641 * rta_lookup() gets an un-cached &rta structure and returns its cached
642 * counterpart. It starts with examining the attribute cache to see whether
643 * there exists a matching entry. If such an entry exists, it's returned and
644 * its use count is incremented, else a new entry is created with use count
645 * set to 1.
646 *
647 * The extended attribute lists attached to the &rta are automatically
648 * converted to the normalized form.
649 */
650 rta *
651 rta_lookup(rta *o)
652 {
653 rta *r;
654 unsigned int h;
655
656 ASSERT(!(o->aflags & RTAF_CACHED));
657 if (o->eattrs)
658 {
659 if (o->eattrs->next) /* Multiple ea_list's, need to merge them */
660 {
661 ea_list *ml = alloca(ea_scan(o->eattrs));
662 ea_merge(o->eattrs, ml);
663 o->eattrs = ml;
664 }
665 ea_sort(o->eattrs);
666 }
667
668 h = rta_hash(o);
669 for(r=rta_hash_table[h & rta_cache_mask]; r; r=r->next)
670 if (r->hash_key == h && rta_same(r, o))
671 return rta_clone(r);
672
673 r = rta_copy(o);
674 r->hash_key = h;
675 r->aflags = RTAF_CACHED;
676 rt_lock_hostentry(r->hostentry);
677 rta_insert(r);
678
679 if (++rta_cache_count > rta_cache_limit)
680 rta_rehash();
681
682 return r;
683 }
684
685 void
686 rta__free(rta *a)
687 {
688 ASSERT(rta_cache_count && (a->aflags & RTAF_CACHED));
689 rta_cache_count--;
690 *a->pprev = a->next;
691 if (a->next)
692 a->next->pprev = a->pprev;
693 a->aflags = 0; /* Poison the entry */
694 rt_unlock_hostentry(a->hostentry);
695 ea_free(a->eattrs);
696 sl_free(rta_slab, a);
697 }
698
699 /**
700 * rta_dump - dump route attributes
701 * @a: attribute structure to dump
702 *
703 * This function takes a &rta and dumps its contents to the debug output.
704 */
705 void
706 rta_dump(rta *a)
707 {
708 static char *rts[] = { "RTS_DUMMY", "RTS_STATIC", "RTS_INHERIT", "RTS_DEVICE",
709 "RTS_STAT_DEV", "RTS_REDIR", "RTS_RIP",
710 "RTS_OSPF", "RTS_OSPF_IA", "RTS_OSPF_EXT1",
711 "RTS_OSPF_EXT2", "RTS_BGP" };
712 static char *rtc[] = { "", " BC", " MC", " AC" };
713 static char *rtd[] = { "", " DEV", " HOLE", " UNREACH", " PROHIBIT" };
714
715 debug("p=%s uc=%d %s %s%s%s h=%04x",
716 a->proto->name, a->uc, rts[a->source], ip_scope_text(a->scope), rtc[a->cast],
717 rtd[a->dest], a->hash_key);
718 if (!(a->aflags & RTAF_CACHED))
719 debug(" !CACHED");
720 debug(" <-%I", a->from);
721 if (a->dest == RTD_ROUTER)
722 debug(" ->%I", a->gw);
723 if (a->dest == RTD_DEVICE || a->dest == RTD_ROUTER)
724 debug(" [%s]", a->iface ? a->iface->name : "???" );
725 if (a->eattrs)
726 {
727 debug(" EA: ");
728 ea_dump(a->eattrs);
729 }
730 }
731
732 /**
733 * rta_dump_all - dump attribute cache
734 *
735 * This function dumps the whole contents of route attribute cache
736 * to the debug output.
737 */
738 void
739 rta_dump_all(void)
740 {
741 rta *a;
742 unsigned int h;
743
744 debug("Route attribute cache (%d entries, rehash at %d):\n", rta_cache_count, rta_cache_limit);
745 for(h=0; h<rta_cache_size; h++)
746 for(a=rta_hash_table[h]; a; a=a->next)
747 {
748 debug("%p ", a);
749 rta_dump(a);
750 debug("\n");
751 }
752 debug("\n");
753 }
754
755 void
756 rta_show(struct cli *c, rta *a, ea_list *eal)
757 {
758 static char *src_names[] = { "dummy", "static", "inherit", "device", "static-device", "redirect",
759 "RIP", "OSPF", "OSPF-ext", "OSPF-IA", "OSPF-boundary", "BGP" };
760 static char *cast_names[] = { "unicast", "broadcast", "multicast", "anycast" };
761 int i;
762 byte buf[EA_FORMAT_BUF_SIZE];
763
764 cli_printf(c, -1008, "\tType: %s %s %s", src_names[a->source], cast_names[a->cast], ip_scope_text(a->scope));
765 if (!eal)
766 eal = a->eattrs;
767 for(; eal; eal=eal->next)
768 for(i=0; i<eal->count; i++)
769 {
770 ea_format(&eal->attrs[i], buf);
771 cli_printf(c, -1012, "\t%s", buf);
772 }
773 }
774
775 /**
776 * rta_init - initialize route attribute cache
777 *
778 * This function is called during initialization of the routing
779 * table module to set up the internals of the attribute cache.
780 */
781 void
782 rta_init(void)
783 {
784 rta_pool = rp_new(&root_pool, "Attributes");
785 rta_slab = sl_new(rta_pool, sizeof(rta));
786 rta_alloc_hash();
787 }
788
789 /*
790 * Documentation for functions declared inline in route.h
791 */
792 #if 0
793
794 /**
795 * rta_clone - clone route attributes
796 * @r: a &rta to be cloned
797 *
798 * rta_clone() takes a cached &rta and returns its identical cached
799 * copy. Currently it works by just returning the original &rta with
800 * its use count incremented.
801 */
802 static inline rta *rta_clone(rta *r)
803 { DUMMY; }
804
805 /**
806 * rta_free - free route attributes
807 * @r: a &rta to be freed
808 *
809 * If you stop using a &rta (for example when deleting a route which uses
810 * it), you need to call rta_free() to notify the attribute cache the
811 * attribute is no longer in use and can be freed if you were the last
812 * user (which rta_free() tests by inspecting the use count).
813 */
814 static inline void rta_free(rta *r)
815 { DUMMY; }
816
817 #endif