On Mon, Mar 31, 2008 at 04:01:49PM +0200, Christian wrote:
> Hi Claudio & Co.,
>
> I am running 4.3-current. I am using a very basic bgpd config file that
> worked for 4.2 very well. Unfortunatelly, with -current my router does not
> want to announce our prefix anymore.
>
> Any ideas?
>
> Thanks,
> - Christian
>
> Details: (my as: 303, transit: 304)
>
> I am able to receive prefixes from my transit provider.
> bgpctl shows the following (77.X.Y.0/21 being our prefix):
>
> # bgpctl show rib 77.X.Y.0
> flags: * = Valid, > = Selected, I = via IBGP, A = Announced
> origin: i = IGP, e = EGP, ? = Incomplete
>
> flags destination gateway lpref med aspath origin
> 77.X.Y.0/21 A.B.C.D 105 0 304 [SOMEAS] 303 i
> I* 77.X.Y.0/21 77.X.Y.2 100 0 i
> AI 77.X.Y.0/21 0.0.0.0 100 0 i
>
> So there are two funny things:
>
> - I get my own prefix (announced by our other router, 77.X.Y.2) via the
> transit provider.
> - The line with my announced prefix ("AI") is missing the "*".
>
The missing * in tha AI output is an error when composing the control
message to bgpctl. The problem with the looped AS path is a bit more evil.
In the decision process the wrong flags field was inspected and because of
that loops remained undetected.
Having the loop in the table with a higher lpref will result in missing
anouncements. That's why your own route is not selected (missing ">").
I hope the attached diff fixes all your issues. At least it seems to work
for me.
--
:wq Claudio
Index: rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.230
diff -u -p -r1.230 rde.c
--- rde.c 26 Feb 2008 19:58:51 -0000 1.230
+++ rde.c 16 Apr 2008 14:04:10 -0000
@@ -1717,7 +1717,7 @@ rde_dump_rib_as(struct prefix *p, struct
rib.flags |= F_RIB_INTERNAL;
if (asp->flags & F_PREFIX_ANNOUNCED)
rib.flags |= F_RIB_ANNOUNCE;
- if (asp->nexthop != NULL && asp->nexthop->state == NEXTHOP_REACH)
+ if (asp->nexthop == NULL || asp->nexthop->state == NEXTHOP_REACH)
rib.flags |= F_RIB_ELIGIBLE;
if (asp->flags & F_ATTR_LOOP)
rib.flags &= ~F_RIB_ELIGIBLE;
@@ -2846,4 +2846,3 @@ sa_cmp(struct bgpd_addr *a, struct socka
return (0);
}
-
Index: rde_decide.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde_decide.c,v
retrieving revision 1.49
diff -u -p -r1.49 rde_decide.c
--- rde_decide.c 27 Nov 2007 01:13:54 -0000 1.49
+++ rde_decide.c 16 Apr 2008 14:43:48 -0000
@@ -121,14 +121,14 @@ prefix_cmp(struct prefix *p1, struct pre
if (!(p2->flags & F_LOCAL))
return (1);
+ asp1 = p1->aspath;
+ asp2 = p2->aspath;
+
/* only loop free pathes are eligible */
- if (p1->flags & F_ATTR_LOOP)
+ if (asp1->flags & F_ATTR_LOOP)
return (-1);
- if (p2->flags & F_ATTR_LOOP)
+ if (asp2->flags & F_ATTR_LOOP)
return (1);
-
- asp1 = p1->aspath;
- asp2 = p2->aspath;
/* 1. check if prefix is eligible a.k.a reachable */
if (asp2->nexthop != NULL && asp2->nexthop->state != NEXTHOP_REACH)