2015-02-04 07:01:14 +01:00
|
|
|
/*
|
2017-05-13 10:25:29 +02:00
|
|
|
* PIM for Quagga
|
|
|
|
* Copyright (C) 2008 Everton da Silva Marques
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; see the file COPYING; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
2017-01-19 16:01:02 +01:00
|
|
|
*/
|
2015-02-04 07:01:14 +01:00
|
|
|
|
|
|
|
#ifndef PIM_IFACE_H
|
|
|
|
#define PIM_IFACE_H
|
|
|
|
|
|
|
|
#include <zebra.h>
|
|
|
|
|
|
|
|
#include "if.h"
|
|
|
|
#include "vty.h"
|
2017-04-11 03:01:53 +02:00
|
|
|
#include "vrf.h"
|
|
|
|
#include "zclient.h"
|
2017-09-14 17:15:52 +02:00
|
|
|
#include "ferr.h"
|
2015-02-04 07:01:14 +01:00
|
|
|
|
|
|
|
#include "pim_igmp.h"
|
|
|
|
#include "pim_upstream.h"
|
2017-04-11 03:01:53 +02:00
|
|
|
#include "bfd.h"
|
2021-12-13 15:01:36 +01:00
|
|
|
#include "pim_str.h"
|
2015-02-04 07:01:14 +01:00
|
|
|
|
|
|
|
#define PIM_IF_IS_DELETED(ifp) ((ifp)->ifindex == IFINDEX_INTERNAL)
|
|
|
|
|
2022-01-13 14:29:09 +01:00
|
|
|
#define PIM_I_am_DR(pim_ifp) \
|
|
|
|
!pim_addr_cmp((pim_ifp)->pim_dr_addr, (pim_ifp)->primary_address)
|
2019-08-19 11:06:00 +02:00
|
|
|
#define PIM_I_am_DualActive(pim_ifp) (pim_ifp)->activeactive == true
|
2015-10-23 16:37:45 +02:00
|
|
|
|
2021-10-01 09:36:10 +02:00
|
|
|
/* Macros for interface flags */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* PIM needs to know if hello is required to send before other PIM messages
|
|
|
|
* like Join, prune, assert would go out
|
|
|
|
*/
|
|
|
|
#define PIM_IF_FLAG_HELLO_SENT (1 << 0)
|
|
|
|
|
|
|
|
#define PIM_IF_FLAG_TEST_HELLO_SENT(flags) ((flags)&PIM_IF_FLAG_HELLO_SENT)
|
|
|
|
|
|
|
|
#define PIM_IF_FLAG_SET_HELLO_SENT(flags) ((flags) |= PIM_IF_FLAG_HELLO_SENT)
|
|
|
|
|
|
|
|
#define PIM_IF_FLAG_UNSET_HELLO_SENT(flags) ((flags) &= ~PIM_IF_FLAG_HELLO_SENT)
|
|
|
|
|
2017-02-15 03:32:16 +01:00
|
|
|
struct pim_iface_upstream_switch {
|
2021-12-13 15:01:36 +01:00
|
|
|
pim_addr address;
|
2017-02-15 03:32:16 +01:00
|
|
|
struct list *us;
|
|
|
|
};
|
|
|
|
|
2016-11-18 18:12:27 +01:00
|
|
|
enum pim_secondary_addr_flags {
|
|
|
|
PIM_SEC_ADDRF_NONE = 0,
|
|
|
|
PIM_SEC_ADDRF_STALE = (1 << 0)
|
|
|
|
};
|
|
|
|
|
|
|
|
struct pim_secondary_addr {
|
2017-03-30 15:10:05 +02:00
|
|
|
struct prefix addr;
|
2016-11-18 18:12:27 +01:00
|
|
|
enum pim_secondary_addr_flags flags;
|
|
|
|
};
|
|
|
|
|
2021-11-11 20:41:23 +01:00
|
|
|
struct gm_if;
|
|
|
|
|
2015-02-04 07:01:14 +01:00
|
|
|
struct pim_interface {
|
2022-04-04 14:00:59 +02:00
|
|
|
bool pim_enable : 1;
|
|
|
|
bool pim_can_disable_join_suppression : 1;
|
2022-04-07 14:34:07 +02:00
|
|
|
bool pim_passive_enable : 1;
|
2022-04-04 14:00:59 +02:00
|
|
|
|
|
|
|
bool igmp_enable : 1;
|
|
|
|
|
2016-01-18 11:12:10 +01:00
|
|
|
ifindex_t mroute_vif_index;
|
2017-05-14 20:20:17 +02:00
|
|
|
struct pim_instance *pim;
|
2022-03-10 11:22:32 +01:00
|
|
|
|
|
|
|
#if PIM_IPV == 6
|
|
|
|
/* link-locals: MLD uses lowest addr, PIM uses highest... */
|
|
|
|
pim_addr ll_lowest;
|
|
|
|
pim_addr ll_highest;
|
|
|
|
#endif
|
|
|
|
|
2021-12-14 07:31:39 +01:00
|
|
|
pim_addr primary_address; /* remember addr to detect change */
|
2016-11-18 18:12:27 +01:00
|
|
|
struct list *sec_addr_list; /* list of struct pim_secondary_addr */
|
2021-12-14 07:31:39 +01:00
|
|
|
pim_addr update_source; /* user can statically set the primary
|
2016-11-19 01:19:26 +01:00
|
|
|
* address of the interface */
|
2022-01-04 15:00:50 +01:00
|
|
|
|
|
|
|
int igmp_version; /* IGMP version */
|
2021-11-11 20:41:23 +01:00
|
|
|
int mld_version;
|
2022-01-04 15:00:50 +01:00
|
|
|
int gm_default_robustness_variable; /* IGMP or MLD QRV */
|
|
|
|
int gm_default_query_interval; /* IGMP or MLD secs between general
|
|
|
|
queries */
|
|
|
|
int gm_query_max_response_time_dsec; /* IGMP or MLD Max Response Time in
|
2015-02-04 07:01:14 +01:00
|
|
|
dsecs for general queries */
|
2022-01-04 15:00:50 +01:00
|
|
|
int gm_specific_query_max_response_time_dsec; /* IGMP or MLD Max
|
|
|
|
Response Time in dsecs
|
|
|
|
called as last member
|
|
|
|
query interval, defines
|
|
|
|
the maximum response
|
|
|
|
time advertised in IGMP
|
|
|
|
group-specific
|
|
|
|
queries */
|
|
|
|
int gm_last_member_query_count; /* IGMP or MLD last member
|
|
|
|
query count
|
|
|
|
*/
|
|
|
|
struct list *gm_socket_list; /* list of struct IGMP or MLD sock */
|
|
|
|
struct list *gm_join_list; /* list of struct IGMP or MLD join */
|
|
|
|
struct list *gm_group_list; /* list of struct IGMP or MLD group */
|
|
|
|
struct hash *gm_group_hash;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2021-11-11 20:41:23 +01:00
|
|
|
struct gm_if *mld;
|
|
|
|
|
2015-02-04 07:01:14 +01:00
|
|
|
int pim_sock_fd; /* PIM socket file descriptor */
|
|
|
|
struct thread *t_pim_sock_read; /* thread for reading PIM socket */
|
|
|
|
int64_t pim_sock_creation; /* timestamp of PIM socket creation */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-02-04 07:01:14 +01:00
|
|
|
struct thread *t_pim_hello_timer;
|
|
|
|
int pim_hello_period;
|
|
|
|
int pim_default_holdtime;
|
|
|
|
int pim_triggered_hello_delay;
|
|
|
|
uint32_t pim_generation_id;
|
|
|
|
uint16_t pim_propagation_delay_msec; /* config */
|
|
|
|
uint16_t pim_override_interval_msec; /* config */
|
|
|
|
struct list *pim_neighbor_list; /* list of struct pim_neighbor */
|
2017-02-15 03:32:16 +01:00
|
|
|
struct list *upstream_switch_list;
|
2017-07-31 18:44:20 +02:00
|
|
|
struct pim_ifchannel_rb ifchannel_rb;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-02-04 07:01:14 +01:00
|
|
|
/* neighbors without lan_delay */
|
|
|
|
int pim_number_of_nonlandelay_neighbors;
|
|
|
|
uint16_t pim_neighbors_highest_propagation_delay_msec;
|
|
|
|
uint16_t pim_neighbors_highest_override_interval_msec;
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2015-02-04 07:01:14 +01:00
|
|
|
/* DR Election */
|
|
|
|
int64_t pim_dr_election_last; /* timestamp */
|
|
|
|
int pim_dr_election_count;
|
|
|
|
int pim_dr_election_changes;
|
2021-12-14 07:31:39 +01:00
|
|
|
pim_addr pim_dr_addr;
|
2015-02-04 07:01:14 +01:00
|
|
|
uint32_t pim_dr_priority; /* config */
|
|
|
|
int pim_dr_num_nondrpri_neighbors; /* neighbors without dr_pri */
|
2017-07-17 14:03:14 +02:00
|
|
|
|
2017-09-01 20:33:00 +02:00
|
|
|
/* boundary prefix-list */
|
|
|
|
char *boundary_oil_plist;
|
|
|
|
|
2019-01-14 16:43:53 +01:00
|
|
|
/* Turn on Active-Active for this interface */
|
|
|
|
bool activeactive;
|
2020-03-20 02:05:11 +01:00
|
|
|
bool am_i_dr;
|
2019-01-14 16:43:53 +01:00
|
|
|
|
2015-02-04 07:01:14 +01:00
|
|
|
int64_t pim_ifstat_start; /* start timestamp for stats */
|
2019-05-02 05:52:59 +02:00
|
|
|
uint64_t pim_ifstat_bsm_rx;
|
|
|
|
uint64_t pim_ifstat_bsm_tx;
|
2015-02-04 07:01:14 +01:00
|
|
|
uint32_t pim_ifstat_hello_sent;
|
|
|
|
uint32_t pim_ifstat_hello_sendfail;
|
|
|
|
uint32_t pim_ifstat_hello_recv;
|
|
|
|
uint32_t pim_ifstat_hello_recvfail;
|
2017-04-03 22:11:58 +02:00
|
|
|
uint32_t pim_ifstat_join_recv;
|
|
|
|
uint32_t pim_ifstat_join_send;
|
|
|
|
uint32_t pim_ifstat_prune_recv;
|
|
|
|
uint32_t pim_ifstat_prune_send;
|
|
|
|
uint32_t pim_ifstat_reg_recv;
|
|
|
|
uint32_t pim_ifstat_reg_send;
|
|
|
|
uint32_t pim_ifstat_reg_stop_recv;
|
|
|
|
uint32_t pim_ifstat_reg_stop_send;
|
|
|
|
uint32_t pim_ifstat_assert_recv;
|
|
|
|
uint32_t pim_ifstat_assert_send;
|
2019-05-02 05:52:59 +02:00
|
|
|
uint32_t pim_ifstat_bsm_cfg_miss;
|
|
|
|
uint32_t pim_ifstat_ucast_bsm_cfg_miss;
|
|
|
|
uint32_t pim_ifstat_bsm_invalid_sz;
|
2021-10-01 09:36:10 +02:00
|
|
|
uint8_t flags;
|
2019-05-02 05:52:59 +02:00
|
|
|
bool bsm_enable; /* bsm processing enable */
|
|
|
|
bool ucast_bsm_accept; /* ucast bsm processing */
|
2021-04-12 18:48:21 +02:00
|
|
|
|
pimd: Add IGMP join sent/failed statistics
```
exit1-debian-11# sh ip igmp statistics
IGMP statistics
Interface : global
V1 query : 0
V2 query : 0
V3 query : 0
V2 leave : 0
V1 report : 0
V2 report : 0
V3 report : 16
mtrace response : 0
mtrace request : 0
unsupported : 0
joins failed : 0
joins sent : 11
total groups : 4
total source groups : 0
exit1-debian-11# sh ip igmp statistics json
{
"global":{
"name":"global",
"queryV1":0,
"queryV2":0,
"queryV3":0,
"leaveV3":0,
"reportV1":0,
"reportV2":0,
"reportV3":16,
"mtraceResponse":0,
"mtraceRequest":0,
"unsupported":0,
"totalGroups":4,
"totalSourceGroups":0,
"joinsFailed":0,
"joinsSent":11
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-10 17:10:43 +01:00
|
|
|
uint32_t igmp_ifstat_joins_sent;
|
|
|
|
uint32_t igmp_ifstat_joins_failed;
|
pimd: Add additional IGMP stats (peak number of groups)
```
exit1-debian-11# sh ip igmp statistics interface eth2
IGMP statistics
Interface : eth2
V1 query : 0
V2 query : 0
V3 query : 25
V2 leave : 0
V1 report : 0
V2 report : 0
V3 report : 34
mtrace response : 0
mtrace request : 0
unsupported : 0
joins failed : 0
joins sent : 13
general queries sent : 2
group queries sent : 24
peak groups : 9
total groups : 4
total source groups : 1
exit1-debian-11# sh ip igmp statistics interface eth2 json
{
"eth2":{
"name":"eth2",
"queryV1":0,
"queryV2":0,
"queryV3":25,
"leaveV2":0,
"reportV1":0,
"reportV2":0,
"reportV3":34,
"mtraceResponse":0,
"mtraceRequest":0,
"unsupported":0,
"peakGroups":9,
"totalGroups":4,
"totalSourceGroups":1,
"joinsFailed":0,
"joinsSent":13,
"generalQueriesSent":2,
"groupQueriesSent":24
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-14 16:33:11 +01:00
|
|
|
uint32_t igmp_peak_group_count;
|
pimd: Add IGMP join sent/failed statistics
```
exit1-debian-11# sh ip igmp statistics
IGMP statistics
Interface : global
V1 query : 0
V2 query : 0
V3 query : 0
V2 leave : 0
V1 report : 0
V2 report : 0
V3 report : 16
mtrace response : 0
mtrace request : 0
unsupported : 0
joins failed : 0
joins sent : 11
total groups : 4
total source groups : 0
exit1-debian-11# sh ip igmp statistics json
{
"global":{
"name":"global",
"queryV1":0,
"queryV2":0,
"queryV3":0,
"leaveV3":0,
"reportV1":0,
"reportV2":0,
"reportV3":16,
"mtraceResponse":0,
"mtraceRequest":0,
"unsupported":0,
"totalGroups":4,
"totalSourceGroups":0,
"joinsFailed":0,
"joinsSent":11
}
}
```
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-10 17:10:43 +01:00
|
|
|
|
2021-04-12 18:48:21 +02:00
|
|
|
struct {
|
|
|
|
bool enabled;
|
|
|
|
uint32_t min_rx;
|
|
|
|
uint32_t min_tx;
|
|
|
|
uint8_t detection_multiplier;
|
2021-04-13 16:07:01 +02:00
|
|
|
char *profile;
|
2021-04-12 18:48:21 +02:00
|
|
|
} bfd_config;
|
2015-02-04 07:01:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
2022-01-04 15:00:50 +01:00
|
|
|
* if default_holdtime is set (>= 0), use it;
|
|
|
|
* otherwise default_holdtime is 3.5 * hello_period
|
2015-02-04 07:01:14 +01:00
|
|
|
*/
|
|
|
|
#define PIM_IF_DEFAULT_HOLDTIME(pim_ifp) \
|
|
|
|
(((pim_ifp)->pim_default_holdtime < 0) \
|
|
|
|
? ((pim_ifp)->pim_hello_period * 7 / 2) \
|
|
|
|
: ((pim_ifp)->pim_default_holdtime))
|
|
|
|
|
2017-05-20 20:17:48 +02:00
|
|
|
void pim_if_init(struct pim_instance *pim);
|
|
|
|
void pim_if_terminate(struct pim_instance *pim);
|
2015-02-04 07:01:14 +01:00
|
|
|
|
2018-09-17 20:09:06 +02:00
|
|
|
struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim,
|
2019-03-22 17:48:17 +01:00
|
|
|
bool ispimreg, bool is_vxlan_term);
|
2015-02-04 07:01:14 +01:00
|
|
|
void pim_if_delete(struct interface *ifp);
|
|
|
|
void pim_if_addr_add(struct connected *ifc);
|
|
|
|
void pim_if_addr_del(struct connected *ifc, int force_prim_as_any);
|
|
|
|
void pim_if_addr_add_all(struct interface *ifp);
|
|
|
|
void pim_if_addr_del_all(struct interface *ifp);
|
|
|
|
void pim_if_addr_del_all_igmp(struct interface *ifp);
|
|
|
|
|
2019-03-22 17:48:17 +01:00
|
|
|
int pim_if_add_vif(struct interface *ifp, bool ispimreg, bool is_vxlan_term);
|
2015-02-04 07:01:14 +01:00
|
|
|
int pim_if_del_vif(struct interface *ifp);
|
2017-05-20 20:17:48 +02:00
|
|
|
void pim_if_add_vif_all(struct pim_instance *pim);
|
|
|
|
void pim_if_del_vif_all(struct pim_instance *pim);
|
2015-02-04 07:01:14 +01:00
|
|
|
|
2017-05-21 14:29:56 +02:00
|
|
|
struct interface *pim_if_find_by_vif_index(struct pim_instance *pim,
|
|
|
|
ifindex_t vif_index);
|
|
|
|
int pim_if_find_vifindex_by_ifindex(struct pim_instance *pim,
|
|
|
|
ifindex_t ifindex);
|
2015-02-04 07:01:14 +01:00
|
|
|
|
|
|
|
int pim_if_lan_delay_enabled(struct interface *ifp);
|
|
|
|
uint16_t pim_if_effective_propagation_delay_msec(struct interface *ifp);
|
|
|
|
uint16_t pim_if_effective_override_interval_msec(struct interface *ifp);
|
|
|
|
uint16_t pim_if_jp_override_interval_msec(struct interface *ifp);
|
2022-01-14 17:47:14 +01:00
|
|
|
struct pim_neighbor *pim_if_find_neighbor(struct interface *ifp, pim_addr addr);
|
2015-02-04 07:01:14 +01:00
|
|
|
|
|
|
|
long pim_if_t_suppressed_msec(struct interface *ifp);
|
|
|
|
int pim_if_t_override_msec(struct interface *ifp);
|
|
|
|
|
2022-01-14 17:52:36 +01:00
|
|
|
pim_addr pim_find_primary_addr(struct interface *ifp);
|
2015-02-04 07:01:14 +01:00
|
|
|
|
2017-09-14 17:15:52 +02:00
|
|
|
ferr_r pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr,
|
|
|
|
struct in_addr source_addr);
|
2015-02-04 07:01:14 +01:00
|
|
|
int pim_if_igmp_join_del(struct interface *ifp, struct in_addr group_addr,
|
|
|
|
struct in_addr source_addr);
|
|
|
|
|
|
|
|
void pim_if_update_could_assert(struct interface *ifp);
|
|
|
|
|
2022-01-14 17:47:14 +01:00
|
|
|
void pim_if_assert_on_neighbor_down(struct interface *ifp, pim_addr neigh_addr);
|
2015-02-04 07:01:14 +01:00
|
|
|
|
|
|
|
void pim_if_rpf_interface_changed(struct interface *old_rpf_ifp,
|
|
|
|
struct pim_upstream *up);
|
|
|
|
|
|
|
|
void pim_if_update_join_desired(struct pim_interface *pim_ifp);
|
|
|
|
|
|
|
|
void pim_if_update_assert_tracking_desired(struct interface *ifp);
|
|
|
|
|
2017-05-17 22:21:33 +02:00
|
|
|
void pim_if_create_pimreg(struct pim_instance *pim);
|
2016-08-23 16:35:16 +02:00
|
|
|
|
2022-01-14 17:52:36 +01:00
|
|
|
struct prefix *pim_if_connected_to_source(struct interface *ifp, pim_addr src);
|
|
|
|
int pim_update_source_set(struct interface *ifp, pim_addr source);
|
2016-11-07 20:33:54 +01:00
|
|
|
|
2018-04-30 13:56:24 +02:00
|
|
|
bool pim_if_is_vrf_device(struct interface *ifp);
|
2017-07-31 18:44:20 +02:00
|
|
|
|
|
|
|
int pim_if_ifchannel_count(struct pim_interface *pim_ifp);
|
2019-09-18 22:20:04 +02:00
|
|
|
|
2022-01-23 22:16:59 +01:00
|
|
|
void pim_iface_init(void);
|
2019-09-18 22:20:04 +02:00
|
|
|
|
2015-02-04 07:01:14 +01:00
|
|
|
#endif /* PIM_IFACE_H */
|