mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 04:47:05 +00:00
zebra: Move multicast mode to being a property of the router
The multicast mode enum was a global static in zebra_rib.c it does not belong there, it belongs in zebra_router, moving. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
ca6af440b9
commit
526052fb6d
13
zebra/rib.h
13
zebra/rib.h
@ -340,19 +340,6 @@ extern void route_entry_copy_nexthops(struct route_entry *re,
|
|||||||
extern void _route_entry_dump(const char *func, union prefixconstptr pp,
|
extern void _route_entry_dump(const char *func, union prefixconstptr pp,
|
||||||
union prefixconstptr src_pp,
|
union prefixconstptr src_pp,
|
||||||
const struct route_entry *re);
|
const struct route_entry *re);
|
||||||
/* RPF lookup behaviour */
|
|
||||||
enum multicast_mode {
|
|
||||||
MCAST_NO_CONFIG = 0, /* MIX_MRIB_FIRST, but no show in config write */
|
|
||||||
MCAST_MRIB_ONLY, /* MRIB only */
|
|
||||||
MCAST_URIB_ONLY, /* URIB only */
|
|
||||||
MCAST_MIX_MRIB_FIRST, /* MRIB, if nothing at all then URIB */
|
|
||||||
MCAST_MIX_DISTANCE, /* MRIB & URIB, lower distance wins */
|
|
||||||
MCAST_MIX_PFXLEN, /* MRIB & URIB, longer prefix wins */
|
|
||||||
/* on equal value, MRIB wins for last 2 */
|
|
||||||
};
|
|
||||||
|
|
||||||
extern void multicast_mode_ipv4_set(enum multicast_mode mode);
|
|
||||||
extern enum multicast_mode multicast_mode_ipv4_get(void);
|
|
||||||
|
|
||||||
extern void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id);
|
extern void rib_lookup_and_dump(struct prefix_ipv4 *p, vrf_id_t vrf_id);
|
||||||
extern void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id);
|
extern void rib_lookup_and_pushup(struct prefix_ipv4 *p, vrf_id_t vrf_id);
|
||||||
|
@ -108,10 +108,6 @@ static const struct {
|
|||||||
/* no entry/default: 150 */
|
/* no entry/default: 150 */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* RPF lookup behaviour */
|
|
||||||
static enum multicast_mode ipv4_multicast_mode = MCAST_NO_CONFIG;
|
|
||||||
|
|
||||||
|
|
||||||
static void __attribute__((format(printf, 5, 6)))
|
static void __attribute__((format(printf, 5, 6)))
|
||||||
_rnode_zlog(const char *_func, vrf_id_t vrf_id, struct route_node *rn,
|
_rnode_zlog(const char *_func, vrf_id_t vrf_id, struct route_node *rn,
|
||||||
int priority, const char *msgfmt, ...)
|
int priority, const char *msgfmt, ...)
|
||||||
@ -404,7 +400,7 @@ struct route_entry *rib_match_ipv4_multicast(vrf_id_t vrf_id,
|
|||||||
struct route_node *m_rn = NULL, *u_rn = NULL;
|
struct route_node *m_rn = NULL, *u_rn = NULL;
|
||||||
union g_addr gaddr = {.ipv4 = addr};
|
union g_addr gaddr = {.ipv4 = addr};
|
||||||
|
|
||||||
switch (ipv4_multicast_mode) {
|
switch (zrouter.ipv4_multicast_mode) {
|
||||||
case MCAST_MRIB_ONLY:
|
case MCAST_MRIB_ONLY:
|
||||||
return rib_match(AFI_IP, SAFI_MULTICAST, vrf_id, &gaddr,
|
return rib_match(AFI_IP, SAFI_MULTICAST, vrf_id, &gaddr,
|
||||||
rn_out);
|
rn_out);
|
||||||
@ -456,19 +452,6 @@ struct route_entry *rib_match_ipv4_multicast(vrf_id_t vrf_id,
|
|||||||
return re;
|
return re;
|
||||||
}
|
}
|
||||||
|
|
||||||
void multicast_mode_ipv4_set(enum multicast_mode mode)
|
|
||||||
{
|
|
||||||
if (IS_ZEBRA_DEBUG_RIB)
|
|
||||||
zlog_debug("%s: multicast lookup mode set (%d)", __func__,
|
|
||||||
mode);
|
|
||||||
ipv4_multicast_mode = mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum multicast_mode multicast_mode_ipv4_get(void)
|
|
||||||
{
|
|
||||||
return ipv4_multicast_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p, vrf_id_t vrf_id)
|
struct route_entry *rib_lookup_ipv4(struct prefix_ipv4 *p, vrf_id_t vrf_id)
|
||||||
{
|
{
|
||||||
struct route_table *table;
|
struct route_table *table;
|
||||||
|
@ -29,9 +29,12 @@
|
|||||||
#include "zebra_pbr.h"
|
#include "zebra_pbr.h"
|
||||||
#include "zebra_vxlan.h"
|
#include "zebra_vxlan.h"
|
||||||
#include "zebra_mlag.h"
|
#include "zebra_mlag.h"
|
||||||
|
#include "zebra_nhg.h"
|
||||||
|
#include "debug.h"
|
||||||
|
|
||||||
struct zebra_router zrouter = {
|
struct zebra_router zrouter = {
|
||||||
.multipath_num = MULTIPATH_NUM,
|
.multipath_num = MULTIPATH_NUM,
|
||||||
|
.ipv4_multicast_mode = MCAST_NO_CONFIG,
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
@ -187,6 +190,19 @@ uint32_t zebra_router_get_next_sequence(void)
|
|||||||
memory_order_relaxed);
|
memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void multicast_mode_ipv4_set(enum multicast_mode mode)
|
||||||
|
{
|
||||||
|
if (IS_ZEBRA_DEBUG_RIB)
|
||||||
|
zlog_debug("%s: multicast lookup mode set (%d)", __func__,
|
||||||
|
mode);
|
||||||
|
zrouter.ipv4_multicast_mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum multicast_mode multicast_mode_ipv4_get(void)
|
||||||
|
{
|
||||||
|
return zrouter.ipv4_multicast_mode;
|
||||||
|
}
|
||||||
|
|
||||||
void zebra_router_terminate(void)
|
void zebra_router_terminate(void)
|
||||||
{
|
{
|
||||||
struct zebra_router_table *zrt, *tmp;
|
struct zebra_router_table *zrt, *tmp;
|
||||||
|
@ -50,6 +50,17 @@ RB_HEAD(zebra_router_table_head, zebra_router_table);
|
|||||||
RB_PROTOTYPE(zebra_router_table_head, zebra_router_table,
|
RB_PROTOTYPE(zebra_router_table_head, zebra_router_table,
|
||||||
zebra_router_table_entry, zebra_router_table_entry_compare)
|
zebra_router_table_entry, zebra_router_table_entry_compare)
|
||||||
|
|
||||||
|
/* RPF lookup behaviour */
|
||||||
|
enum multicast_mode {
|
||||||
|
MCAST_NO_CONFIG = 0, /* MIX_MRIB_FIRST, but no show in config write */
|
||||||
|
MCAST_MRIB_ONLY, /* MRIB only */
|
||||||
|
MCAST_URIB_ONLY, /* URIB only */
|
||||||
|
MCAST_MIX_MRIB_FIRST, /* MRIB, if nothing at all then URIB */
|
||||||
|
MCAST_MIX_DISTANCE, /* MRIB & URIB, lower distance wins */
|
||||||
|
MCAST_MIX_PFXLEN, /* MRIB & URIB, longer prefix wins */
|
||||||
|
/* on equal value, MRIB wins for last 2 */
|
||||||
|
};
|
||||||
|
|
||||||
struct zebra_mlag_info {
|
struct zebra_mlag_info {
|
||||||
/* Role this zebra router is playing */
|
/* Role this zebra router is playing */
|
||||||
enum mlag_role role;
|
enum mlag_role role;
|
||||||
@ -113,6 +124,9 @@ struct zebra_router {
|
|||||||
|
|
||||||
uint32_t multipath_num;
|
uint32_t multipath_num;
|
||||||
|
|
||||||
|
/* RPF Lookup behavior */
|
||||||
|
enum multicast_mode ipv4_multicast_mode;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Time for when we sweep the rib from old routes
|
* Time for when we sweep the rib from old routes
|
||||||
*/
|
*/
|
||||||
@ -153,6 +167,10 @@ static inline struct zebra_vrf *zebra_vrf_get_evpn(void)
|
|||||||
: zebra_vrf_lookup_by_id(VRF_DEFAULT);
|
: zebra_vrf_lookup_by_id(VRF_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void multicast_mode_ipv4_set(enum multicast_mode mode);
|
||||||
|
|
||||||
|
extern enum multicast_mode multicast_mode_ipv4_get(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user