[quagga-dev 4276] fix "table" command

Rumen Svobodnikov rumen at telecoms.bg
Thu Jul 20 23:31:43 IST 2006


Hi,
In current quagga the "table" command in zebra does not work. There have
been patches floating around for a long time to fix this problem.
Please check the attached patch.

I am currently using it (in production) and it works OK.
However i have only tested it with bgp routes (i don't use other protocol
daemons). Also it is for IPV4 only. Still i think it is correct, please
consider it for inclusion.

Best Regards,
Rumen Svobodnikov
-------------- next part --------------
diff -ur quagga/zebra/ChangeLog quagga.wrk/zebra/ChangeLog
--- quagga/zebra/ChangeLog	2006-07-02 19:38:54.000000000 +0300
+++ quagga.wrk/zebra/ChangeLog	2006-07-20 22:25:43.000000000 +0300
@@ -1,3 +1,12 @@
+2006-07-20 Rumen Svobodnikov <rumen at telecoms.bg>
+
+	* connected.c: (connected_up_ipv4) interface connected routes always
+	  go to table main (or otherwise they cannot be used by linux as
+          nexthops)
+       * kernel_socket.c: (rtm_read) read kernel routes from the correct
+	  routing table
+	* zserv.c: (zread_ipv4_add) send route to the correct routing table
+
 2006-07-02 Paul Jakma <paul.jakma at sun.com>
 
 	* rt_netlink.c: (netlink_interface_addr) Fix CID #104, can not
diff -ur quagga/zebra/connected.c quagga.wrk/zebra/connected.c
--- quagga/zebra/connected.c	2006-06-15 21:10:47.000000000 +0300
+++ quagga.wrk/zebra/connected.c	2006-07-20 22:07:55.000000000 +0300
@@ -200,7 +200,7 @@
   if (prefix_ipv4_any (&p))
     return;
 
-  rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, 0, 
+  rib_add_ipv4 (ZEBRA_ROUTE_CONNECT, 0, &p, NULL, ifp->ifindex, RT_TABLE_MAIN, 
                 ifp->metric, 0);
 
   rib_update ();
diff -ur quagga/zebra/kernel_socket.c quagga.wrk/zebra/kernel_socket.c
--- quagga/zebra/kernel_socket.c	2006-05-17 18:04:59.000000000 +0300
+++ quagga.wrk/zebra/kernel_socket.c	2006-07-20 22:07:55.000000000 +0300
@@ -764,10 +764,10 @@
           || rtm->rtm_type == RTM_ADD
           || rtm->rtm_type == RTM_CHANGE)
 	rib_add_ipv4 (ZEBRA_ROUTE_KERNEL, zebra_flags, 
-		      &p, &gate.sin.sin_addr, 0, 0, 0, 0);
+		      &p, &gate.sin.sin_addr, 0, rtm->table, 0, 0);
       else
 	rib_delete_ipv4 (ZEBRA_ROUTE_KERNEL, zebra_flags, 
-		      &p, &gate.sin.sin_addr, 0, 0);
+		      &p, &gate.sin.sin_addr, 0, rtm->table);
     }
 #ifdef HAVE_IPV6
   if (dest.sa.sa_family == AF_INET6)
diff -ur quagga/zebra/zserv.c quagga.wrk/zebra/zserv.c
--- quagga/zebra/zserv.c	2006-05-15 20:00:37.000000000 +0300
+++ quagga.wrk/zebra/zserv.c	2006-07-20 22:11:40.000000000 +0300
@@ -801,6 +801,8 @@
   if (CHECK_FLAG (message, ZAPI_MESSAGE_METRIC))
     rib->metric = stream_getl (s);
     
+  /* Table */
+  rib->table=zebrad.rtm_table_default;
   rib_add_ipv4_multipath (&p, rib);
   return 0;
 }


More information about the Quagga-dev mailing list