[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zebra
Subject:    [zebra 2408] static routes
From:       "Vladimir B. Grebenschikov" <vova () express ! ru>
Date:       1999-11-26 19:36:01
[Download RAW message or body]

In zebra there are problem with static routes:

When interface goes down static routes disappear from 
router FIB and never returnes to it

in attachment simple patch to solve this problem

this patch installs all static routes with RTM_STATIC flag
so, when interface goes down kernel don't remove routes from FIB

such behavior like cisco's "ip route ... permanent" command
so I've made define ZEBRA_FLAG_PERMANENT for it

attention! patch work only for routing-socket method

it's seems to be good ideas:

 - to add command "ip route ... permanent" to zebra daemon 
   (for install routes with RTM_STATIC)

 - when "ip route ..." was executed without permanent, lookup 
   static routes table when interface goes UP and reinstall static 
   routes without RTM_STATIC

besides this problem I think that static routes table need some rearrangement:

I think it must be possible to install more then one static route for same
prefix, but with different distances, look:

I have route to some net x.x.x.x/m via fast interface ct0, and via ct1
(ct1 preferable), so I need install:

 ip route x.x.x.x/m ct1 20
 ip route x.x.x.x/m ct0 25

when interface ct1 goes down all traffic go through ct0 

and at all I can add 
 ip route x.x.x.x/m ds0 254
as last resort discard if no available routes for prefix
(ds0 - discard interface on freebsd)

May be, when distances have equal value, need to install two
routes with different next-hop/ifindex, I saw patch to freebsd
that allows more then one route in kernel FIB to same destanation, 
and allow simple (round-robin) load-balancing functionality


--
TSB Russian Express, Moscow
Vladimir B. Grebenschikov, vova@express.ru

["route.permanent.patch" (TEXT/PLAIN)]

--- lib/zebra.h.orig	Fri Nov 26 18:07:16 1999
+++ lib/zebra.h	Fri Nov 26 21:53:03 1999
@@ -221,6 +221,7 @@
 #define ZEBRA_FLAG_INTERNAL           0x01
 #define ZEBRA_FLAG_SELFROUTE          0x02
 #define ZEBRA_FLAG_BLACKHOLE          0x04
+#define ZEBRA_FLAG_PERMANENT	      0x08
 
 #ifndef INADDR_LOOPBACK
 #define	INADDR_LOOPBACK	0x7f000001	/* Internet address 127.0.0.1.  */
--- zebra/kernel_socket.c.orig	Fri Nov 26 08:53:06 1999
+++ zebra/kernel_socket.c	Fri Nov 26 21:52:44 1999
@@ -378,6 +378,9 @@
   if (zebra_flags & ZEBRA_FLAG_BLACKHOLE)
     msg.rtm.rtm_flags |= RTF_BLACKHOLE;
   
+  if (zebra_flags & ZEBRA_FLAG_PERMANENT)
+    msg.rtm.rtm_flags |= RTF_STATIC;
+  
   /* Route to the interface test.  This should be rewritten later on
      -- Kunihiro*/
   if (!gate)
--- zebra/rib.c.orig	Fri Nov 26 21:11:11 1999
+++ zebra/rib.c	Fri Nov 26 21:52:16 1999
@@ -373,12 +373,15 @@
     }
 
   /* Same static route existance check. */
-  if (type == ZEBRA_ROUTE_STATIC && same)
+  if (type == ZEBRA_ROUTE_STATIC) {
+    flags |= ZEBRA_FLAG_PERMANENT;
+    if (same)
     {
       rib_free (rib);
       route_unlock_node (np);
       return ZEBRA_ERR_RTEXIST;
     }
+  }
 
   /* Now logging it. */
   rib_log ("add", (struct prefix *)p, rib);


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic