kernel: missing 'prefsrc' when installing route to KRT (original BIRD, no patches)

Sergey Popovich popovich_sergei at mail.ru
Fri Aug 23 08:45:07 CEST 2013


В письме от 23 августа 2013 02:01:00 Вы написали:
> On Thu, Aug 22, 2013 at 01:25:23PM +0300, Sergey Popovich wrote:
> > Hello community!
> > 
> > While ago I write to list about importance of 'prefsrc' (BIRD's name
> > krt_prefsrc) in Linux network stack (see thread "kernel: does not learn
> > routes with RTPROT_KERNEL (proto kernel in ip-route(8) output)").
> > 
> > However there is another problem with kernel protocol, I spot when
> > 
> > *restarting* bird:
> >   bird wont install krt_prefsrc attribute when installing route to KRT for
> >   routes learned via kernel syncer from another KRT and distributed
> >   between BIRD's routing tables via pipe protocol, after daemon restart.
> 
> ...
> 
> > Why BIRD does not install/update route with correct 'prefsrc' it it is
> > known even after pipe to another table?
> 
> Hello
> 
> This is a bug in some eattr magic code. Use attached patch.

Thanks again, Ondrej!

Patch tested and found working as expected, problem solved.
> 
> BTW, thanks for very elaborate bug reports.

I also try to find solution, before you did, and have following patch with 
tries but NOT solves problem (and I do not known why).

I'm trying to address issue by "adding" eattrs  learned in nl_parse_route()
in sysdep/linux/netlink.c, in krt_make_tmp_attrs() function at 
sysdep/unix/krt.c, called from krt_export_rte(), but this does not work.

Provide my version anyway (this patch does not work) for convenience:
------------------------------------------------------------------------------------------

@@ -59,6 +59,7 @@
 #include "lib/timer.h"
 #include "conf/conf.h"
 #include "lib/string.h"
+#include "lib/alloca.h"
.
 #include "unix.h"
 #include "krt.h"
@@ -906,21 +907,28 @@ krt_scan_timer_stop(struct krt_proto *p)
 static struct ea_list *
 krt_make_tmp_attrs(rte *rt, struct linpool *pool)
 {
-  struct ea_list *l = lp_alloc(pool, sizeof(struct ea_list) + 2 * 
sizeof(eattr));
+  struct ea_list *t, *l;

-  l->next = NULL;
-  l->flags = EALF_SORTED;
-  l->count = 2;
-
-  l->attrs[0].id = EA_KRT_SOURCE;
-  l->attrs[0].flags = 0;
-  l->attrs[0].type = EAF_TYPE_INT | EAF_TEMP;
-  l->attrs[0].u.data = rt->u.krt.proto;
-
-  l->attrs[1].id = EA_KRT_METRIC;
-  l->attrs[1].flags = 0;
-  l->attrs[1].type = EAF_TYPE_INT | EAF_TEMP;
-  l->attrs[1].u.data = rt->u.krt.metric;
+  t = alloca(sizeof(struct ea_list) + 2 * sizeof(eattr));
+
+  t->next = NULL;
+  t->flags = EALF_SORTED;
+  t->count = 2;
+
+  t->attrs[0].id = EA_KRT_SOURCE;
+  t->attrs[0].flags = 0;
+  t->attrs[0].type = EAF_TYPE_INT | EAF_TEMP;
+  t->attrs[0].u.data = rt->u.krt.proto;
+
+  t->attrs[1].id = EA_KRT_METRIC;
+  t->attrs[1].flags = 0;
+  t->attrs[1].type = EAF_TYPE_INT | EAF_TEMP;
+  t->attrs[1].u.data = rt->u.krt.metric;
+
+  t = ea_append(t, rt->attrs->eattrs);
+  l = lp_alloc(pool, ea_scan(t));
+  ea_merge(t, l);
+  ea_sort(l);

   return l;
 }

-- 
SP5474-RIPE
Sergey Popovich




More information about the Bird-users mailing list