2023-02-08 13:17:09 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2017-05-19 00:51:31 +02:00
|
|
|
/*
|
|
|
|
* PIM for FRR - PIM Instance
|
|
|
|
* Copyright (C) 2017 Cumulus Networks, Inc.
|
|
|
|
* Donald Sharp
|
|
|
|
*/
|
|
|
|
#ifndef __PIM_INSTANCE_H__
|
|
|
|
#define __PIM_INSTANCE_H__
|
|
|
|
|
2018-12-21 15:30:54 +01:00
|
|
|
#include <mlag.h>
|
|
|
|
|
2017-05-22 15:12:08 +02:00
|
|
|
#include "pim_str.h"
|
|
|
|
#include "pim_msdp.h"
|
2018-12-20 17:18:14 +01:00
|
|
|
#include "pim_assert.h"
|
2019-05-02 04:24:14 +02:00
|
|
|
#include "pim_bsm.h"
|
2019-03-19 23:54:02 +01:00
|
|
|
#include "pim_vxlan_instance.h"
|
2019-12-21 04:12:19 +01:00
|
|
|
#include "pim_oil.h"
|
2019-12-21 05:00:31 +01:00
|
|
|
#include "pim_upstream.h"
|
2022-03-03 17:25:50 +01:00
|
|
|
#include "pim_mroute.h"
|
2024-09-17 04:32:59 +02:00
|
|
|
#include "pim_autorp.h"
|
2018-12-20 17:18:14 +01:00
|
|
|
|
2017-05-19 00:51:31 +02:00
|
|
|
enum pim_spt_switchover {
|
|
|
|
PIM_SPT_IMMEDIATE,
|
|
|
|
PIM_SPT_INFINITY,
|
|
|
|
};
|
|
|
|
|
2020-02-06 18:30:36 +01:00
|
|
|
/* stats for updates rxed from the MLAG component during the life of a
|
|
|
|
* session
|
|
|
|
*/
|
|
|
|
struct pim_mlag_msg_stats {
|
|
|
|
uint32_t mroute_add_rx;
|
|
|
|
uint32_t mroute_add_tx;
|
|
|
|
uint32_t mroute_del_rx;
|
|
|
|
uint32_t mroute_del_tx;
|
|
|
|
uint32_t mlag_status_updates;
|
|
|
|
uint32_t pim_status_updates;
|
|
|
|
uint32_t vxlan_updates;
|
|
|
|
uint32_t peer_zebra_status_updates;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pim_mlag_stats {
|
|
|
|
/* message stats are reset when the connection to mlagd flaps */
|
|
|
|
struct pim_mlag_msg_stats msg;
|
|
|
|
uint32_t mlagd_session_downs;
|
|
|
|
uint32_t peer_session_downs;
|
|
|
|
uint32_t peer_zebra_downs;
|
|
|
|
};
|
|
|
|
|
|
|
|
enum pim_mlag_flags {
|
|
|
|
PIM_MLAGF_NONE = 0,
|
|
|
|
/* connection to the local MLAG daemon is up */
|
|
|
|
PIM_MLAGF_LOCAL_CONN_UP = (1 << 0),
|
|
|
|
/* connection to the MLAG daemon on the peer switch is up. note
|
|
|
|
* that there is no direct connection between FRR and the peer MLAG
|
|
|
|
* daemon. this is just a peer-session status provided by the local
|
|
|
|
* MLAG daemon.
|
|
|
|
*/
|
|
|
|
PIM_MLAGF_PEER_CONN_UP = (1 << 1),
|
|
|
|
/* status update rxed from the local daemon */
|
|
|
|
PIM_MLAGF_STATUS_RXED = (1 << 2),
|
|
|
|
/* initial dump of data done post peerlink flap */
|
|
|
|
PIM_MLAGF_PEER_REPLAY_DONE = (1 << 3),
|
|
|
|
/* zebra is up on the peer */
|
|
|
|
PIM_MLAGF_PEER_ZEBRA_UP = (1 << 4)
|
|
|
|
};
|
|
|
|
|
2018-12-20 16:34:04 +01:00
|
|
|
struct pim_router {
|
2023-03-07 20:14:41 +01:00
|
|
|
struct event_loop *master;
|
2018-12-20 16:39:59 +01:00
|
|
|
|
|
|
|
uint32_t debugs;
|
2018-12-20 16:45:33 +01:00
|
|
|
|
|
|
|
int t_periodic;
|
2018-12-20 17:18:14 +01:00
|
|
|
struct pim_assert_metric infinite_assert_metric;
|
2018-12-21 14:50:34 +01:00
|
|
|
long rpf_cache_refresh_delay_msec;
|
2021-08-19 03:48:28 +02:00
|
|
|
uint32_t register_suppress_time;
|
2018-12-21 14:57:22 +01:00
|
|
|
int packet_process;
|
2021-08-19 03:48:28 +02:00
|
|
|
uint32_t register_probe_time;
|
2022-06-22 14:12:04 +02:00
|
|
|
uint16_t multipath;
|
2018-12-21 15:23:36 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* What is the default vrf that we work in
|
|
|
|
*/
|
|
|
|
vrf_id_t vrf_id;
|
2018-12-21 15:30:54 +01:00
|
|
|
|
2020-02-06 18:30:36 +01:00
|
|
|
enum mlag_role mlag_role;
|
2019-11-12 07:36:17 +01:00
|
|
|
uint32_t pim_mlag_intf_cnt;
|
|
|
|
/* if true we have registered with MLAG */
|
|
|
|
bool mlag_process_register;
|
|
|
|
/* if true local MLAG process reported that it is connected
|
|
|
|
* with the peer MLAG process
|
|
|
|
*/
|
|
|
|
bool connected_to_mlag;
|
|
|
|
/* Holds the client data(unencoded) that need to be pushed to MCLAGD*/
|
|
|
|
struct stream_fifo *mlag_fifo;
|
|
|
|
struct stream *mlag_stream;
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *zpthread_mlag_write;
|
2020-02-06 18:30:36 +01:00
|
|
|
struct in_addr anycast_vtep_ip;
|
|
|
|
struct in_addr local_vtep_ip;
|
|
|
|
struct pim_mlag_stats mlag_stats;
|
|
|
|
enum pim_mlag_flags mlag_flags;
|
2023-11-21 14:08:29 +01:00
|
|
|
char peerlink_rif[IFNAMSIZ];
|
2020-02-06 18:30:36 +01:00
|
|
|
struct interface *peerlink_rif_p;
|
2018-12-20 16:34:04 +01:00
|
|
|
};
|
|
|
|
|
2017-05-19 00:51:31 +02:00
|
|
|
/* Per VRF PIM DB */
|
|
|
|
struct pim_instance {
|
2021-05-12 20:31:45 +02:00
|
|
|
// vrf_id_t vrf_id;
|
2017-05-19 00:51:31 +02:00
|
|
|
struct vrf *vrf;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
enum pim_spt_switchover switchover;
|
|
|
|
char *plist;
|
|
|
|
} spt;
|
|
|
|
|
2020-02-20 18:14:03 +01:00
|
|
|
/* The name of the register-accept prefix-list */
|
|
|
|
char *register_plist;
|
|
|
|
|
2017-05-19 00:51:31 +02:00
|
|
|
struct hash *rpf_hash;
|
|
|
|
|
|
|
|
void *ssm_info; /* per-vrf SSM configuration */
|
|
|
|
|
|
|
|
int send_v6_secondary;
|
|
|
|
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *thread;
|
2017-05-19 00:51:31 +02:00
|
|
|
int mroute_socket;
|
2022-08-02 08:12:53 +02:00
|
|
|
int reg_sock; /* Socket to send register msg */
|
2017-05-19 00:51:31 +02:00
|
|
|
int64_t mroute_socket_creation;
|
|
|
|
int64_t mroute_add_events;
|
|
|
|
int64_t mroute_add_last;
|
|
|
|
int64_t mroute_del_events;
|
|
|
|
int64_t mroute_del_last;
|
|
|
|
|
|
|
|
struct interface *regiface;
|
2017-05-19 01:56:10 +02:00
|
|
|
|
|
|
|
// List of static routes;
|
|
|
|
struct list *static_routes;
|
2017-05-20 01:36:53 +02:00
|
|
|
|
|
|
|
// Upstream vrf specific information
|
2019-12-21 05:00:31 +01:00
|
|
|
struct rb_pim_upstream_head upstream_head;
|
2017-05-20 01:36:53 +02:00
|
|
|
struct timer_wheel *upstream_sg_wheel;
|
2017-05-20 19:43:58 +02:00
|
|
|
|
2017-08-31 15:08:12 +02:00
|
|
|
/*
|
|
|
|
* RP information
|
|
|
|
*/
|
2017-05-20 19:43:58 +02:00
|
|
|
struct list *rp_list;
|
2017-08-31 15:08:12 +02:00
|
|
|
struct route_table *rp_table;
|
2017-05-20 20:17:48 +02:00
|
|
|
|
|
|
|
int iface_vif_index[MAXVIFS];
|
2020-03-16 06:42:56 +01:00
|
|
|
int mcast_if_count;
|
2017-05-21 14:45:46 +02:00
|
|
|
|
2019-12-21 04:12:19 +01:00
|
|
|
struct rb_pim_oil_head channel_oil_head;
|
2017-05-22 15:12:08 +02:00
|
|
|
|
|
|
|
struct pim_msdp msdp;
|
2019-03-19 23:54:02 +01:00
|
|
|
struct pim_vxlan_instance vxlan;
|
2017-05-22 17:09:13 +02:00
|
|
|
|
2024-09-17 04:32:59 +02:00
|
|
|
struct pim_autorp *autorp;
|
|
|
|
|
2017-05-22 17:09:13 +02:00
|
|
|
struct list *ssmpingd_list;
|
2022-02-25 11:29:03 +01:00
|
|
|
pim_addr ssmpingd_group_addr;
|
2017-07-13 03:16:00 +02:00
|
|
|
|
2022-04-26 12:22:42 +02:00
|
|
|
unsigned int gm_socket_if_count;
|
|
|
|
int gm_socket;
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *t_gm_recv;
|
2022-04-26 12:22:42 +02:00
|
|
|
|
2022-08-02 12:55:09 +02:00
|
|
|
unsigned int gm_group_count;
|
2022-06-30 10:17:26 +02:00
|
|
|
unsigned int gm_watermark_limit;
|
2017-07-13 03:16:00 +02:00
|
|
|
unsigned int keep_alive_time;
|
|
|
|
unsigned int rp_keep_alive_time;
|
2018-03-18 02:13:09 +01:00
|
|
|
|
2018-06-07 16:23:32 +02:00
|
|
|
bool ecmp_enable;
|
|
|
|
bool ecmp_rebalance_enable;
|
2019-11-12 07:36:17 +01:00
|
|
|
/* No. of Dual active I/fs in pim_instance */
|
|
|
|
uint32_t inst_mlag_intf_cnt;
|
|
|
|
|
2019-05-02 04:24:14 +02:00
|
|
|
/* Bsm related */
|
|
|
|
struct bsm_scope global_scope;
|
|
|
|
uint64_t bsm_rcvd;
|
|
|
|
uint64_t bsm_sent;
|
|
|
|
uint64_t bsm_dropped;
|
2018-06-07 16:23:32 +02:00
|
|
|
|
2018-03-18 02:13:09 +01:00
|
|
|
/* If we need to rescan all our upstreams */
|
2022-03-01 22:18:12 +01:00
|
|
|
struct event *rpf_cache_refresher;
|
2018-03-18 02:34:55 +01:00
|
|
|
int64_t rpf_cache_refresh_requests;
|
|
|
|
int64_t rpf_cache_refresh_events;
|
|
|
|
int64_t rpf_cache_refresh_last;
|
|
|
|
int64_t scan_oil_events;
|
|
|
|
int64_t scan_oil_last;
|
|
|
|
|
|
|
|
int64_t nexthop_lookups;
|
|
|
|
int64_t nexthop_lookups_avoided;
|
|
|
|
int64_t last_route_change_time;
|
2022-04-26 12:22:42 +02:00
|
|
|
|
|
|
|
uint64_t gm_rx_drop_sys;
|
2017-05-19 00:51:31 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
void pim_vrf_init(void);
|
|
|
|
void pim_vrf_terminate(void);
|
|
|
|
|
2021-08-19 11:36:16 +02:00
|
|
|
extern struct pim_router *router;
|
|
|
|
|
2017-05-19 00:51:31 +02:00
|
|
|
struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id);
|
|
|
|
|
|
|
|
#endif
|