summaryrefslogtreecommitdiff
path: root/bgpd
diff options
context:
space:
mode:
authorG.Balaji <balajig81@gmail.com>2011-11-26 21:58:42 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2012-01-23 14:30:33 +0400
commit5a616c08ce089e25dc0e8da920727af4d11279bf (patch)
tree4b5650d6602d06d0188102469e3b402abe81f16a /bgpd
parent6ae93c058725991df5a9ae35cefec368919b5fea (diff)
bgpd: IPv4 MP-BGP Routes addition and deletion
This patch contains the following: 1. Addition of IPv4 SAFI_MULTICAST BGP routes into the BGP Multicast RIB. 2. Deletion of IPv4 SAFI_MULTICAST BGP routes from the BGP Multicast RIB.
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_route.c16
-rw-r--r--bgpd/bgp_zebra.c6
-rw-r--r--bgpd/bgp_zebra.h4
3 files changed, 14 insertions, 12 deletions
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 68d05484..3e5e9c2f 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -1491,7 +1491,7 @@ bgp_process_main (struct work_queue *wq, void *data)
if (! CHECK_FLAG (old_select->flags, BGP_INFO_ATTR_CHANGED))
{
if (CHECK_FLAG (old_select->flags, BGP_INFO_IGP_CHANGED))
- bgp_zebra_announce (p, old_select, bgp);
+ bgp_zebra_announce (p, old_select, bgp, safi);
UNSET_FLAG (rn->flags, BGP_NODE_PROCESS_SCHEDULED);
return WQ_SUCCESS;
@@ -1514,20 +1514,20 @@ bgp_process_main (struct work_queue *wq, void *data)
}
/* FIB update. */
- if (safi == SAFI_UNICAST && ! bgp->name &&
- ! bgp_option_check (BGP_OPT_NO_FIB))
+ if ((safi == SAFI_UNICAST || safi == SAFI_MULTICAST) && (! bgp->name &&
+ ! bgp_option_check (BGP_OPT_NO_FIB)))
{
if (new_select
&& new_select->type == ZEBRA_ROUTE_BGP
&& new_select->sub_type == BGP_ROUTE_NORMAL)
- bgp_zebra_announce (p, new_select, bgp);
+ bgp_zebra_announce (p, new_select, bgp, safi);
else
{
/* Withdraw the route from the kernel. */
if (old_select
&& old_select->type == ZEBRA_ROUTE_BGP
&& old_select->sub_type == BGP_ROUTE_NORMAL)
- bgp_zebra_withdraw (p, old_select);
+ bgp_zebra_withdraw (p, old_select, safi);
}
}
@@ -1810,7 +1810,7 @@ bgp_update_rsclient (struct peer *rsclient, afi_t afi, safi_t safi,
bgp_attr_unintern (&attr_new2);
/* IPv4 unicast next hop check. */
- if (afi == AFI_IP && safi == SAFI_UNICAST)
+ if ((afi == AFI_IP) && ((safi == SAFI_UNICAST) || safi == SAFI_MULTICAST))
{
/* Next hop must not be 0.0.0.0 nor Class D/E address. */
if (new_attr.nexthop.s_addr == 0
@@ -2934,7 +2934,7 @@ bgp_cleanup_routes (void)
if (CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)
&& ri->type == ZEBRA_ROUTE_BGP
&& ri->sub_type == BGP_ROUTE_NORMAL)
- bgp_zebra_withdraw (&rn->p, ri);
+ bgp_zebra_withdraw (&rn->p, ri,SAFI_UNICAST);
table = bgp->rib[AFI_IP6][SAFI_UNICAST];
@@ -2943,7 +2943,7 @@ bgp_cleanup_routes (void)
if (CHECK_FLAG (ri->flags, BGP_INFO_SELECTED)
&& ri->type == ZEBRA_ROUTE_BGP
&& ri->sub_type == BGP_ROUTE_NORMAL)
- bgp_zebra_withdraw (&rn->p, ri);
+ bgp_zebra_withdraw (&rn->p, ri,SAFI_UNICAST);
}
}
diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c
index 76c519cb..baf76fb0 100644
--- a/bgpd/bgp_zebra.c
+++ b/bgpd/bgp_zebra.c
@@ -643,7 +643,7 @@ bgp_nexthop_set (union sockunion *local, union sockunion *remote,
}
void
-bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp)
+bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp, safi_t safi)
{
int flags;
u_char distance;
@@ -678,6 +678,7 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp)
api.type = ZEBRA_ROUTE_BGP;
api.message = 0;
+ api.safi = safi;
SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP);
api.nexthop_num = 1;
api.nexthop = &nexthop;
@@ -778,7 +779,7 @@ bgp_zebra_announce (struct prefix *p, struct bgp_info *info, struct bgp *bgp)
}
void
-bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info)
+bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info, safi_t safi)
{
int flags;
struct peer *peer;
@@ -812,6 +813,7 @@ bgp_zebra_withdraw (struct prefix *p, struct bgp_info *info)
api.type = ZEBRA_ROUTE_BGP;
api.message = 0;
+ api.safi = safi;
SET_FLAG (api.message, ZAPI_MESSAGE_NEXTHOP);
api.nexthop_num = 1;
api.nexthop = &nexthop;
diff --git a/bgpd/bgp_zebra.h b/bgpd/bgp_zebra.h
index bd953864..1351333f 100644
--- a/bgpd/bgp_zebra.h
+++ b/bgpd/bgp_zebra.h
@@ -25,8 +25,8 @@ extern void bgp_zebra_init (void);
extern int bgp_if_update_all (void);
extern int bgp_config_write_redistribute (struct vty *, struct bgp *, afi_t, safi_t,
int *);
-extern void bgp_zebra_announce (struct prefix *, struct bgp_info *, struct bgp *);
-extern void bgp_zebra_withdraw (struct prefix *, struct bgp_info *);
+extern void bgp_zebra_announce (struct prefix *, struct bgp_info *, struct bgp *, safi_t);
+extern void bgp_zebra_withdraw (struct prefix *, struct bgp_info *, safi_t);
extern int bgp_redistribute_set (struct bgp *, afi_t, int);
extern int bgp_redistribute_rmap_set (struct bgp *, afi_t, int, const char *);