Hello,

I found that route decision engine in bgpd does not detect label information 
with value 0x800000 for withdrawn route.

RFC3107 Carrying Label Information in BGP-4:

<...>
A BGP speaker can withdraw a previously advertised route (as well as
    the binding between this route and a label) by either (a) advertising
    a new route (and a label) with the same NLRI as the previously
    advertised route, or (b) listing the NLRI of the previously
    advertised route in the Withdrawn Routes field of an Update message.
    The label information carried (as part of NLRI) in the Withdrawn
    Routes field should be set to 0x800000.  (Of course, terminating the
    BGP session also withdraws all the previously advertised routes.)
<...>

May be my patch will useful for someone:

Index: rde.c
===================================================================
RCS file: /cvs/src/usr.sbin/bgpd/rde.c,v
retrieving revision 1.327
diff -u -p -r1.327 rde.c
--- rde.c       22 Jan 2014 04:08:08 -0000      1.327
+++ rde.c       19 Nov 2014 07:39:58 -0000
@@ -1904,6 +1904,9 @@ rde_update_get_vpn4(u_char *p, u_int16_t
         int              rv, done = 0;
         u_int8_t         pfxlen;
         u_int16_t        plen;
+       int              withdrawn;
+
+       withdrawn=0;

         if (len < 1)
                 return (-1);
@@ -1921,11 +1924,17 @@ rde_update_get_vpn4(u_char *p, u_int16_t
                 if (prefix->vpn4.labellen + 3U >
                     sizeof(prefix->vpn4.labelstack))
                         return (-1);
+               if(*p == 0x80)
+                       withdrawn=1;
                 prefix->vpn4.labelstack[prefix->vpn4.labellen++] = *p++;
+               if(withdrawn == 1 && *p != 0x00)
+                       withdrawn=0;
                 prefix->vpn4.labelstack[prefix->vpn4.labellen++] = *p++;
+               if(withdrawn == 1 && *p != 0x00)
+                       withdrawn=0;
                 prefix->vpn4.labelstack[prefix->vpn4.labellen] = *p++;
-               if (prefix->vpn4.labelstack[prefix->vpn4.labellen] &
-                   BGP_MPLS_BOS)
+               if ( (prefix->vpn4.labelstack[prefix->vpn4.labellen] &  
BGP_MPLS_BOS)
+                       || withdrawn == 1)
                         done = 1;
                 prefix->vpn4.labellen++;
                 plen += 3;




-- 
Best regards,
Stanislav G. Ryabukhin.
sryabuk...@tascom.ru

Reply via email to