summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-28 13:49:52 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-28 13:49:52 -0700
commitc31d029244c8aacae6007e6c272f61cea44136df (patch)
tree133a769f5af292279194163a7c35f9814bff11ae
parentb1be2f77523e05faf10c7449242b46a80a6f7ce2 (diff)
parente5b69327b0894a3338fa9253abeeef144358def6 (diff)
downloadquagga-c31d029244c8aacae6007e6c272f61cea44136df.tar.bz2
quagga-c31d029244c8aacae6007e6c272f61cea44136df.tar.xz
Merge branch 'jenner' of 192.168.100.1:git/vyatta-quagga into jenner
-rw-r--r--zebra/main.c8
-rw-r--r--zebra/rt_netlink.c4
-rw-r--r--zebra/zebra_rib.c29
3 files changed, 23 insertions, 18 deletions
diff --git a/zebra/main.c b/zebra/main.c
index ac0637b6..209b9044 100644
--- a/zebra/main.c
+++ b/zebra/main.c
@@ -63,8 +63,8 @@ int keep_kernel_mode = 0;
u_int32_t nl_rcvbufsize = 0;
#endif /* HAVE_NETLINK */
-/* Manage system routes. */
-extern int rib_system_routes;
+/* Manage connected routes */
+extern int set_interface_mode;
/* Command line options. */
struct option longopts[] =
@@ -72,7 +72,7 @@ struct option longopts[] =
{ "batch", no_argument, NULL, 'b'},
{ "daemon", no_argument, NULL, 'd'},
{ "keep_kernel", no_argument, NULL, 'k'},
- { "rib_system", no_argument, NULL, 'S'},
+ { "set_interface", no_argument, NULL, 'S'},
{ "log_mode", no_argument, NULL, 'l'},
{ "config_file", required_argument, NULL, 'f'},
{ "pid_file", required_argument, NULL, 'i'},
@@ -257,7 +257,7 @@ main (int argc, char **argv)
keep_kernel_mode = 1;
break;
case 'S':
- rib_system_routes = 1;
+ set_interface_mode = 1;
break;
case 'C':
dryrun = 1;
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 33171481..4b5264a3 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -85,7 +85,7 @@ extern struct zebra_privs_t zserv_privs;
extern u_int32_t nl_rcvbufsize;
-extern int rib_system_routes;
+extern int set_interface_mode;
static void
netlink_delroute (int family, void *dest, int length, void *gate,
@@ -621,7 +621,7 @@ netlink_interface_addr (struct sockaddr_nl *snl, struct nlmsghdr *h)
/* If address added, but interface is down,
then remove the FIB entry from kernel.
*/
- if (rib_system_routes && ifc && !if_is_operative (ifp))
+ if (set_interface_mode && ifc && !if_is_operative (ifp))
{
struct prefix_ipv4 p;
PREFIX_COPY_IPV4(&p, CONNECTED_PREFIX(ifc));
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index f8450b70..5db67b77 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -45,7 +45,7 @@
extern struct zebra_t zebrad;
/* Should kernel routes be removed on link down? */
-int rib_system_routes = 0;
+int set_interface_mode;
/* Hold time for RIB process, should be very minimal.
* it is useful to able to set it otherwise for testing, hence exported
@@ -893,9 +893,14 @@ rib_match_ipv6 (struct in6_addr *addr)
#define RIB_SYSTEM_ROUTE(R) \
((R)->type == ZEBRA_ROUTE_KERNEL || (R)->type == ZEBRA_ROUTE_CONNECT)
-#define RIB_SHOULD_UPDATE(R) \
- ( ! (RIB_SYSTEM_ROUTE(R) || \
- ((rib_system_routes && (R)->type == ZEBRA_ROUTE_CONNECT))))
+static inline int rib_is_managed(const struct rib *rib)
+{
+ switch (rib->type) {
+ case ZEBRA_ROUTE_KERNEL: return 0;
+ case ZEBRA_ROUTE_CONNECT: return set_interface_mode;
+ default: return 1;
+ }
+}
/* This function verifies reachability of one given nexthop, which can be
* numbered or unnumbered, IPv4 or IPv6. The result is unconditionally stored
@@ -1096,7 +1101,7 @@ rib_uninstall (struct route_node *rn, struct rib *rib)
if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
{
redistribute_delete (&rn->p, rib);
- if (RIB_SHOULD_UPDATE (rib))
+ if (rib_is_managed (rib))
rib_uninstall_kernel (rn, rib);
UNSET_FLAG (rib->flags, ZEBRA_FLAG_SELECTED);
}
@@ -1222,17 +1227,17 @@ rib_process (struct route_node *rn)
if (CHECK_FLAG (select->flags, ZEBRA_FLAG_CHANGED))
{
redistribute_delete (&rn->p, select);
- if (RIB_SHOULD_UPDATE (select))
+ if (rib_is_managed (select))
rib_uninstall_kernel (rn, select);
/* Set real nexthop. */
nexthop_active_update (rn, select, 1);
- if (RIB_SHOULD_UPDATE (select))
+ if (rib_is_managed (select))
rib_install_kernel (rn, select);
redistribute_add (&rn->p, select);
}
- else if (RIB_SHOULD_UPDATE (select))
+ else if (rib_is_managed (select))
{
/* Housekeeping code to deal with
race conditions in kernel with linux
@@ -1263,7 +1268,7 @@ rib_process (struct route_node *rn)
zlog_debug ("%s: %s/%d: Removing existing route, fib %p", __func__,
buf, rn->p.prefixlen, fib);
redistribute_delete (&rn->p, fib);
- if (RIB_SHOULD_UPDATE (fib))
+ if (rib_is_managed (fib))
rib_uninstall_kernel (rn, fib);
UNSET_FLAG (fib->flags, ZEBRA_FLAG_SELECTED);
@@ -1283,7 +1288,7 @@ rib_process (struct route_node *rn)
/* Set real nexthop. */
nexthop_active_update (rn, select, 1);
- if (RIB_SHOULD_UPDATE (select))
+ if (rib_is_managed (select))
rib_install_kernel (rn, select);
SET_FLAG (select->flags, ZEBRA_FLAG_SELECTED);
redistribute_add (&rn->p, select);
@@ -1890,7 +1895,7 @@ void rib_lookup_and_pushup (struct prefix_ipv4 * p)
*/
for (rib = rn->info; rib; rib = rib->next)
{
- if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED) && RIB_SHOULD_UPDATE (rib))
+ if (CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED) && rib_is_managed (rib))
{
changed = 1;
if (IS_ZEBRA_DEBUG_RIB)
@@ -3074,7 +3079,7 @@ rib_close_table (struct route_table *table)
for (rn = route_top (table); rn; rn = route_next (rn))
for (rib = rn->info; rib; rib = rib->next)
{
- if (RIB_SHOULD_UPDATE (rib)
+ if (rib_is_managed (rib)
&& CHECK_FLAG (rib->flags, ZEBRA_FLAG_SELECTED))
rib_uninstall_kernel (rn, rib);
}