@@ -1524,9 +1524,8 @@ static void bgp_debug_zebra_nh(struct zapi_route *api)
1524
1524
}
1525
1525
}
1526
1526
1527
- void bgp_zebra_announce (struct bgp_dest * dest , const struct prefix * p ,
1528
- struct bgp_path_info * info , struct bgp * bgp , afi_t afi ,
1529
- safi_t safi )
1527
+ void bgp_zebra_announce (struct bgp_dest * dest , struct bgp_path_info * info ,
1528
+ struct bgp * bgp )
1530
1529
{
1531
1530
struct bgp_path_info * bpi_ultimate ;
1532
1531
struct zapi_route api = { 0 };
@@ -1539,6 +1538,8 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
1539
1538
bool is_add ;
1540
1539
uint32_t nhg_id = 0 ;
1541
1540
uint32_t recursion_flag = 0 ;
1541
+ struct bgp_table * table = bgp_dest_table (dest );
1542
+ const struct prefix * p = bgp_dest_get_prefix (dest );
1542
1543
1543
1544
/*
1544
1545
* BGP is installing this route and bgp has been configured
@@ -1557,16 +1558,16 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
1557
1558
if (bgp -> main_zebra_update_hold )
1558
1559
return ;
1559
1560
1560
- if (safi == SAFI_FLOWSPEC ) {
1561
- bgp_pbr_update_entry (bgp , bgp_dest_get_prefix ( dest ) , info , afi ,
1562
- safi , true);
1561
+ if (table -> safi == SAFI_FLOWSPEC ) {
1562
+ bgp_pbr_update_entry (bgp , p , info , table -> afi , table -> safi ,
1563
+ true);
1563
1564
return ;
1564
1565
}
1565
1566
1566
1567
/* Make Zebra API structure. */
1567
1568
api .vrf_id = bgp -> vrf_id ;
1568
1569
api .type = ZEBRA_ROUTE_BGP ;
1569
- api .safi = safi ;
1570
+ api .safi = table -> safi ;
1570
1571
api .prefix = * p ;
1571
1572
SET_FLAG (api .message , ZAPI_MESSAGE_NEXTHOP );
1572
1573
@@ -1603,8 +1604,8 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
1603
1604
metric = info -> attr -> med ;
1604
1605
1605
1606
bgp_zebra_announce_parse_nexthop (info , p , bgp , & api , & valid_nh_count ,
1606
- afi , safi , & nhg_id , & metric , & tag ,
1607
- & allow_recursion );
1607
+ table -> afi , table -> safi , & nhg_id ,
1608
+ & metric , & tag , & allow_recursion );
1608
1609
1609
1610
is_add = (valid_nh_count || nhg_id ) ? true : false;
1610
1611
@@ -1657,7 +1658,7 @@ void bgp_zebra_announce(struct bgp_dest *dest, const struct prefix *p,
1657
1658
api .tag = tag ;
1658
1659
}
1659
1660
1660
- distance = bgp_distance_apply (p , info , afi , safi , bgp );
1661
+ distance = bgp_distance_apply (p , info , table -> afi , table -> safi , bgp );
1661
1662
if (distance ) {
1662
1663
SET_FLAG (api .message , ZAPI_MESSAGE_DISTANCE );
1663
1664
api .distance = distance ;
@@ -1706,9 +1707,7 @@ void bgp_zebra_announce_table(struct bgp *bgp, afi_t afi, safi_t safi)
1706
1707
&& (pi -> sub_type == BGP_ROUTE_NORMAL
1707
1708
|| pi -> sub_type == BGP_ROUTE_IMPORTED )))
1708
1709
1709
- bgp_zebra_announce (dest ,
1710
- bgp_dest_get_prefix (dest ),
1711
- pi , bgp , afi , safi );
1710
+ bgp_zebra_announce (dest , pi , bgp );
1712
1711
}
1713
1712
1714
1713
/* Announce routes of any bgp subtype of a table to zebra */
@@ -1730,16 +1729,16 @@ void bgp_zebra_announce_table_all_subtypes(struct bgp *bgp, afi_t afi,
1730
1729
for (pi = bgp_dest_get_bgp_path_info (dest ); pi ; pi = pi -> next )
1731
1730
if (CHECK_FLAG (pi -> flags , BGP_PATH_SELECTED ) &&
1732
1731
pi -> type == ZEBRA_ROUTE_BGP )
1733
- bgp_zebra_announce (dest ,
1734
- bgp_dest_get_prefix (dest ),
1735
- pi , bgp , afi , safi );
1732
+ bgp_zebra_announce (dest , pi , bgp );
1736
1733
}
1737
1734
1738
- void bgp_zebra_withdraw (const struct prefix * p , struct bgp_path_info * info ,
1739
- struct bgp * bgp , afi_t afi , safi_t safi )
1735
+ void bgp_zebra_withdraw (struct bgp_dest * dest , struct bgp_path_info * info ,
1736
+ struct bgp * bgp )
1740
1737
{
1741
1738
struct zapi_route api ;
1742
1739
struct peer * peer ;
1740
+ struct bgp_table * table = bgp_dest_table (dest );
1741
+ const struct prefix * p = bgp_dest_get_prefix (dest );
1743
1742
1744
1743
/*
1745
1744
* If we are withdrawing the route, we don't need to have this
@@ -1753,16 +1752,17 @@ void bgp_zebra_withdraw(const struct prefix *p, struct bgp_path_info *info,
1753
1752
if (!bgp_install_info_to_zebra (bgp ))
1754
1753
return ;
1755
1754
1756
- if (safi == SAFI_FLOWSPEC ) {
1755
+ if (table -> safi == SAFI_FLOWSPEC ) {
1757
1756
peer = info -> peer ;
1758
- bgp_pbr_update_entry (peer -> bgp , p , info , afi , safi , false);
1757
+ bgp_pbr_update_entry (peer -> bgp , p , info , table -> afi ,
1758
+ table -> safi , false);
1759
1759
return ;
1760
1760
}
1761
1761
1762
1762
memset (& api , 0 , sizeof (api ));
1763
1763
api .vrf_id = bgp -> vrf_id ;
1764
1764
api .type = ZEBRA_ROUTE_BGP ;
1765
- api .safi = safi ;
1765
+ api .safi = table -> safi ;
1766
1766
api .prefix = * p ;
1767
1767
1768
1768
if (info -> attr -> rmap_table_id ) {
@@ -1795,8 +1795,7 @@ void bgp_zebra_withdraw_table_all_subtypes(struct bgp *bgp, afi_t afi, safi_t sa
1795
1795
for (pi = bgp_dest_get_bgp_path_info (dest ); pi ; pi = pi -> next ) {
1796
1796
if (CHECK_FLAG (pi -> flags , BGP_PATH_SELECTED )
1797
1797
&& (pi -> type == ZEBRA_ROUTE_BGP ))
1798
- bgp_zebra_withdraw (bgp_dest_get_prefix (dest ),
1799
- pi , bgp , afi , safi );
1798
+ bgp_zebra_withdraw (dest , pi , bgp );
1800
1799
}
1801
1800
}
1802
1801
}
0 commit comments