zebra: configure static routes in any VRF

Introduce new commands to configure static routes in any VRF, by
appending the old static route commands with a new parameter
"vrf N".

A new parameter "const char *vrf_id_str" is added to the functions
zebra_static_ipv4() and static_ipv6_func() to get the configured
VRF ID.

A new member "vrf_id" is added to the "struct static_ipv4" and
"struct static_ipv6", indicating which VRF this static route is
configured in.

But till now, no interface can exist in any non-default VRF. So
these static routes in non-default VRFs are kept inactive.

Signed-off-by: Feng Lu <lu.feng@6wind.com>
Reviewed-by: Alain Ritoux <alain.ritoux@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Vincent JARDIN <vincent.jardin@6wind.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 8bd4ecc..68ae397 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2290,7 +2290,7 @@
   struct route_table *table;
 
   /* Lookup table.  */
-  table = zebra_vrf_table (AFI_IP, safi, VRF_DEFAULT);
+  table = zebra_vrf_table (AFI_IP, safi, si->vrf_id);
   if (! table)
     return;
 
@@ -2332,7 +2332,7 @@
       rib->type = ZEBRA_ROUTE_STATIC;
       rib->distance = si->distance;
       rib->metric = 0;
-      rib->vrf_id = VRF_DEFAULT;
+      rib->vrf_id = si->vrf_id;
       rib->table = zebrad.rtm_table_default;
       rib->nexthop_num = 0;
 
@@ -2384,7 +2384,7 @@
   struct route_table *table;
 
   /* Lookup table.  */
-  table = zebra_vrf_table (AFI_IP, safi, VRF_DEFAULT);
+  table = zebra_vrf_table (AFI_IP, safi, si->vrf_id);
   if (! table)
     return;
   
@@ -2490,6 +2490,7 @@
   si->type = type;
   si->distance = distance;
   si->flags = flags;
+  si->vrf_id = vrf_id;
 
   if (gate)
     si->gate.ipv4 = *gate;
@@ -2836,7 +2837,7 @@
   struct route_node *rn;
 
   /* Lookup table.  */
-  table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
+  table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, si->vrf_id);
   if (! table)
     return;
 
@@ -2879,7 +2880,7 @@
       rib->type = ZEBRA_ROUTE_STATIC;
       rib->distance = si->distance;
       rib->metric = 0;
-      rib->vrf_id = VRF_DEFAULT;
+      rib->vrf_id = si->vrf_id;
       rib->table = zebrad.rtm_table_default;
       rib->nexthop_num = 0;
 
@@ -2932,7 +2933,7 @@
   struct nexthop *nexthop;
 
   /* Lookup table.  */
-  table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, VRF_DEFAULT);
+  table = zebra_vrf_table (AFI_IP6, SAFI_UNICAST, si->vrf_id);
   if (! table)
     return;
 
@@ -3031,6 +3032,7 @@
   si->type = type;
   si->distance = distance;
   si->flags = flags;
+  si->vrf_id = vrf_id;
 
   switch (type)
     {