summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--zebra/zebra_rib.c4
-rw-r--r--zebra/zebra_rnh.c40
-rw-r--r--zebra/zebra_rnh.h3
-rw-r--r--zebra/zebra_rnh_null.c2
-rw-r--r--zebra/zebra_routemap.c4
-rw-r--r--zebra/zserv.c4
6 files changed, 30 insertions, 27 deletions
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 2ad4d2ea..03ebb15d 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -1579,9 +1579,9 @@ process_subq (struct list * subq, u_char qindex)
static void
meta_queue_process_complete (struct work_queue *dummy)
{
- zebra_evaluate_rnh_table(0, AF_INET);
+ zebra_evaluate_rnh_table(0, AF_INET, 0);
#ifdef HAVE_IPV6
- zebra_evaluate_rnh_table(0, AF_INET6);
+ zebra_evaluate_rnh_table(0, AF_INET6, 0);
#endif /* HAVE_IPV6 */
}
diff --git a/zebra/zebra_rnh.c b/zebra/zebra_rnh.c
index 538ec481..6d71e990 100644
--- a/zebra/zebra_rnh.c
+++ b/zebra/zebra_rnh.c
@@ -210,16 +210,18 @@ zebra_rnh_resolve_via_default(int family)
}
int
-zebra_evaluate_rnh_table (int vrfid, int family)
+zebra_evaluate_rnh_table (int vrfid, int family, int force)
{
struct route_table *ptable;
struct route_table *ntable;
- struct route_node *prn;
+ struct route_node *prn = NULL;
struct route_node *nrn;
struct rnh *rnh;
struct zserv *client;
struct listnode *node;
struct rib *rib;
+ int state_changed = 0;
+ char buf[2][PREFIX_STRLEN];
ntable = lookup_rnh_table(vrfid, family);
if (!ntable)
@@ -260,37 +262,34 @@ zebra_evaluate_rnh_table (int vrfid, int family)
}
rnh = nrn->info;
+ state_changed = 0;
/* Ensure prefixes we're resolving over have stayed the same */
if (!prefix_same(&rnh->resolved_route, &prn->p))
{
- if (rib)
- UNSET_FLAG(rib->status, RIB_ENTRY_NEXTHOPS_CHANGED);
-
if (prn)
prefix_copy(&rnh->resolved_route, &prn->p);
else
memset(&rnh->resolved_route, 0, sizeof(struct prefix));
- copy_state(rnh, rib, nrn);
+ copy_state(rnh, rib);
state_changed = 1;
}
else if (compare_state(rib, rnh->state))
{
- if (IS_ZEBRA_DEBUG_NHT)
- {
- char bufn[INET6_ADDRSTRLEN];
- char bufp[INET6_ADDRSTRLEN];
- prefix2str(&nrn->p, bufn, INET6_ADDRSTRLEN);
- if (prn)
- prefix2str(&prn->p, bufp, INET6_ADDRSTRLEN);
- else
- strcpy(bufp, "null");
- zlog_debug("rnh %s resolved through route %s - sending "
- "nexthop %s event to clients", bufn, bufp,
- rib ? "reachable" : "unreachable");
- }
copy_state(rnh, rib);
+ state_changed = 1;
+ }
+
+ if (state_changed || force)
+ {
+ if (IS_ZEBRA_DEBUG_NHT )
+ zlog_debug("rnh %s resolved through route %s - sending "
+ "nexthop %s event to clients",
+ prefix2str(&nrn->p, buf[0], sizeof buf[0]),
+ prn ? prefix2str(&prn->p, buf[1], sizeof buf[1]) : "(null)",
+ rib ? "reachable" : "unreachable");
+
for (ALL_LIST_ELEMENTS_RO(rnh->client_list, node, client))
send_client(rnh, client);
}
@@ -541,7 +540,8 @@ send_client (struct rnh *rnh, struct zserv *client)
nump = stream_get_endp(s);
stream_putc (s, 0);
for (nexthop = rib->nexthop; nexthop; nexthop = nexthop->next)
- if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB))
+ if (CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_FIB) &&
+ CHECK_FLAG (nexthop->flags, NEXTHOP_FLAG_ACTIVE))
{
stream_putc (s, nexthop->type);
switch (nexthop->type)
diff --git a/zebra/zebra_rnh.h b/zebra/zebra_rnh.h
index 5749945c..94cbb263 100644
--- a/zebra/zebra_rnh.h
+++ b/zebra/zebra_rnh.h
@@ -24,6 +24,7 @@
#define _ZEBRA_RNH_H
#include "prefix.h"
+#include "zserv.h"
#include "vty.h"
/* Nexthop structure. */
@@ -44,7 +45,7 @@ extern struct rnh *zebra_lookup_rnh(struct prefix *p, u_int32_t vrfid);
extern void zebra_delete_rnh(struct rnh *rnh);
extern void zebra_add_rnh_client(struct rnh *rnh, struct zserv *client);
extern void zebra_remove_rnh_client(struct rnh *rnh, struct zserv *client);
-extern int zebra_evaluate_rnh_table(int vrfid, int family);
+extern int zebra_evaluate_rnh_table(int vrfid, int family, int force);
extern int zebra_dispatch_rnh_table(int vrfid, int family, struct zserv *cl);
extern void zebra_print_rnh_table(int vrfid, int family, struct vty *vty);
extern char *rnh_str(struct rnh *rnh, char *buf, int size);
diff --git a/zebra/zebra_rnh_null.c b/zebra/zebra_rnh_null.c
index 0a729d5f..b4c5d06b 100644
--- a/zebra/zebra_rnh_null.c
+++ b/zebra/zebra_rnh_null.c
@@ -6,7 +6,7 @@
int zebra_rnh_ip_default_route = 0;
int zebra_rnh_ipv6_default_route = 0;
-int zebra_evaluate_rnh_table (int vrfid, int family)
+int zebra_evaluate_rnh_table (int vrfid, int family, int force)
{ return 0; }
void zebra_print_rnh_table (int vrfid, int family, struct vty *vty)
diff --git a/zebra/zebra_routemap.c b/zebra/zebra_routemap.c
index 10aa64dc..2364ff33 100644
--- a/zebra/zebra_routemap.c
+++ b/zebra/zebra_routemap.c
@@ -29,6 +29,7 @@
#include "filter.h"
#include "plist.h"
#include "nexthop.h"
+#include "zebra_rnh.h"
#include "zebra/zserv.h"
@@ -669,12 +670,13 @@ static struct route_map_rule_cmd route_set_src_cmd =
/* ip protocol configuration write function */
static int config_write_protocol(struct vty *vty)
{
-
if (zebra_rnh_ip_default_route)
vty_out (vty, "ip nht resolve-via-default%s", VTY_NEWLINE);
if (zebra_rnh_ipv6_default_route)
vty_out (vty, "ipv6 nht resolve-via-default%s", VTY_NEWLINE);
+
+ return zebra_rnh_ip_default_route || zebra_rnh_ipv6_default_route;
}
/* table node for protocol filtering */
diff --git a/zebra/zserv.c b/zebra/zserv.c
index 9f16c5ef..6ae22d48 100644
--- a/zebra/zserv.c
+++ b/zebra/zserv.c
@@ -697,8 +697,8 @@ zserv_nexthop_register (struct zserv *client, int sock, u_short length)
rnh = zebra_add_rnh(&p, 0);
zebra_add_rnh_client(rnh, client);
}
- zebra_evaluate_rnh_table(0, AF_INET);
- zebra_evaluate_rnh_table(0, AF_INET6);
+ zebra_evaluate_rnh_table(0, AF_INET, 0);
+ zebra_evaluate_rnh_table(0, AF_INET6, 0);
return 0;
}