summaryrefslogtreecommitdiff
path: root/zebra/zebra_rib.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2015-05-19 17:40:43 -0700
committerDonald Sharp <sharpd@cumulusnetworks.com>2015-05-19 17:40:43 -0700
commit2037f143d8a2fa9475aa90d2e2ae74a7a935924c (patch)
treeba45e90c32e478b0e84f644e0752292c76d275a9 /zebra/zebra_rib.c
parentabc920f85ea2e2e42c6cf1df7c14373ec1226d20 (diff)
Do not allow a program outside Quagga to delete a Quagga route from the kernel.
To delete a Quagga route, do it inside Quagga.
Diffstat (limited to 'zebra/zebra_rib.c')
-rw-r--r--zebra/zebra_rib.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 5cd81e3de4..dac1166cbc 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -2236,14 +2236,19 @@ rib_delete_ipv4 (int type, int flags, struct prefix_ipv4 *p,
kernel. */
if (! same)
{
- if (fib && type == ZEBRA_ROUTE_KERNEL)
- {
- /* Unset flags. */
- for (nexthop = fib->nexthop; nexthop; nexthop = nexthop->next)
- UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
-
- UNSET_FLAG (fib->flags, ZEBRA_FLAG_SELECTED);
- }
+ if (fib && type == ZEBRA_ROUTE_KERNEL &&
+ CHECK_FLAG(flags, ZEBRA_FLAG_SELFROUTE))
+ {
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ {
+ zlog_debug ("Zebra route %s/%d was deleted by others from kernel",
+ inet_ntop (AF_INET, &p->prefix, buf1, INET_ADDRSTRLEN),
+ p->prefixlen);
+ }
+ /* This means someone else, other than Zebra, has deleted
+ * a Zebra router from the kernel. We will add it back */
+ rib_install_kernel(rn, fib);
+ }
else
{
if (IS_ZEBRA_DEBUG_KERNEL)
@@ -2900,14 +2905,19 @@ rib_delete_ipv6 (int type, int flags, struct prefix_ipv6 *p,
kernel. */
if (! same)
{
- if (fib && type == ZEBRA_ROUTE_KERNEL)
- {
- /* Unset flags. */
- for (nexthop = fib->nexthop; nexthop; nexthop = nexthop->next)
- UNSET_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB);
-
- UNSET_FLAG (fib->flags, ZEBRA_FLAG_SELECTED);
- }
+ if (fib && type == ZEBRA_ROUTE_KERNEL &&
+ CHECK_FLAG(flags, ZEBRA_FLAG_SELFROUTE))
+ {
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ {
+ zlog_debug ("Zebra route %s/%d was deleted by others from kernel",
+ inet_ntop (AF_INET, &p->prefix, buf1, INET_ADDRSTRLEN),
+ p->prefixlen);
+ }
+ /* This means someone else, other than Zebra, has deleted a Zebra
+ * route from the kernel. We will add it back */
+ rib_install_kernel(rn, fib);
+ }
else
{
if (IS_ZEBRA_DEBUG_KERNEL)