summaryrefslogtreecommitdiff
path: root/bgpd/bgp_zebra.c
diff options
context:
space:
mode:
Diffstat (limited to 'bgpd/bgp_zebra.c')
-rw-r--r--bgpd/bgp_zebra.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index c7b0b4364e..501af234a2 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -438,6 +438,7 @@ zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length)
struct in_addr nexthop;
struct prefix_ipv4 p;
unsigned int ifindex;
+ int i;
s = zclient->ibuf;
nexthop.s_addr = 0;
@@ -497,6 +498,20 @@ zebra_read_ipv4 (int command, struct zclient *zclient, zebra_size_t length)
api.metric,
api.tag);
}
+
+ /*
+ * The ADD message is actually an UPDATE and there is no explicit DEL
+ * for a prior redistributed route, if any. So, perform an implicit
+ * DEL processing for the same redistributed route from any other
+ * source type.
+ */
+ for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
+ {
+ if (i != api.type)
+ bgp_redistribute_delete((struct prefix *)&p, i, api.instance);
+ }
+
+ /* Now perform the add/update. */
bgp_redistribute_add((struct prefix *)&p, &nexthop, NULL, ifindex,
api.metric, api.type, api.instance, api.tag);
}
@@ -530,6 +545,7 @@ zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length)
struct in6_addr nexthop;
struct prefix_ipv6 p;
unsigned int ifindex;
+ int i;
s = zclient->ibuf;
memset (&nexthop, 0, sizeof (struct in6_addr));
@@ -595,6 +611,19 @@ zebra_read_ipv6 (int command, struct zclient *zclient, zebra_size_t length)
api.metric,
api.tag);
}
+
+ /*
+ * The ADD message is actually an UPDATE and there is no explicit DEL
+ * for a prior redistributed route, if any. So, perform an implicit
+ * DEL processing for the same redistributed route from any other
+ * source type.
+ */
+ for (i = 0; i < ZEBRA_ROUTE_MAX; i++)
+ {
+ if (i != api.type)
+ bgp_redistribute_delete((struct prefix *)&p, i, api.instance);
+ }
+
bgp_redistribute_add ((struct prefix *)&p, NULL, &nexthop, ifindex,
api.metric, api.type, api.instance, api.tag);
}
@@ -1709,9 +1738,6 @@ bgp_zebra_init (struct thread_master *master)
zclient->nexthop_update = bgp_read_nexthop_update;
zclient->import_check_update = bgp_read_import_check_update;
- /* Interface related init. */
- if_init ();
-
bgp_nexthop_buf = stream_new(BGP_NEXTHOP_BUF_SIZE);
bgp_ifindices_buf = stream_new(BGP_IFINDICES_BUF_SIZE);
}