Merge pull request #10400 from opensourcerouting/pim6-compilefix

pim6d: get running with ipv6 types throughout
This commit is contained in:
Donald Sharp 2022-02-26 08:03:06 -05:00 committed by GitHub
commit 3bf65aa1ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
36 changed files with 696 additions and 439 deletions

View File

@ -1526,6 +1526,13 @@ AC_CHECK_HEADERS([linux/mroute.h], [], [],[
#include <linux/types.h> #include <linux/types.h>
]) ])
AC_CHECK_HEADERS([linux/mroute6.h], [], [],[
#include <sys/socket.h>
#include <netinet/in.h>
#define _LINUX_IN_H /* For Linux <= 2.6.25 */
#include <linux/types.h>
])
m4_define([FRR_INCLUDES], m4_define([FRR_INCLUDES],
FRR_INCLUDES FRR_INCLUDES
[#ifdef HAVE_LINUX_MROUTE_H [#ifdef HAVE_LINUX_MROUTE_H

View File

@ -183,8 +183,8 @@ int main(int argc, char **argv, char **envp)
/* TODO PIM6: next line is temporary since pim_cmd_init is disabled */ /* TODO PIM6: next line is temporary since pim_cmd_init is disabled */
if_cmd_init(NULL); if_cmd_init(NULL);
#if 0
pim_zebra_init(); pim_zebra_init();
#if 0
pim_bfd_init(); pim_bfd_init();
pim_mlag_init(); pim_mlag_init();

141
pimd/pim6_stubs.c Normal file
View File

@ -0,0 +1,141 @@
/*
* PIMv6 temporary stubs
* Copyright (C) 2022 David Lamparter for NetDEF, Inc.
*
* 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
*/
#include <zebra.h>
#include "pimd.h"
#include "pim_nht.h"
#include "pim_zlookup.h"
#include "pim_pim.h"
#include "pim_register.h"
#include "pim_cmd.h"
/*
* NH lookup / NHT
*/
void pim_sendmsg_zebra_rnh(struct pim_instance *pim, struct zclient *zclient,
struct pim_nexthop_cache *pnc, int command)
{
}
int pim_ecmp_nexthop_lookup(struct pim_instance *pim,
struct pim_nexthop *nexthop, struct prefix *src,
struct prefix *grp, int neighbor_needed)
{
return 0;
}
int pim_find_or_track_nexthop(struct pim_instance *pim, struct prefix *addr,
struct pim_upstream *up, struct rp_info *rp,
struct pim_nexthop_cache *out_pnc)
{
return 0;
}
void pim_delete_tracked_nexthop(struct pim_instance *pim, struct prefix *addr,
struct pim_upstream *up, struct rp_info *rp)
{
}
struct pim_nexthop_cache *pim_nexthop_cache_find(struct pim_instance *pim,
struct pim_rpf *rpf)
{
return NULL;
}
void pim_rp_nexthop_del(struct rp_info *rp_info)
{
}
void pim_nht_bsr_add(struct pim_instance *pim, struct in_addr addr)
{
}
void pim_nht_bsr_del(struct pim_instance *pim, struct in_addr addr)
{
}
int zclient_lookup_nexthop(struct pim_instance *pim,
struct pim_zlookup_nexthop nexthop_tab[],
const int tab_size, pim_addr addr,
int max_lookup)
{
return -1;
}
void zclient_lookup_new(void)
{
}
void zclient_lookup_free(void)
{
}
/*
* packet handling
*/
int pim_msg_send(int fd, pim_addr src, pim_addr dst, uint8_t *pim_msg,
int pim_msg_size, const char *ifname)
{
return 0;
}
int pim_hello_send(struct interface *ifp, uint16_t holdtime)
{
return -1;
}
void pim_hello_restart_now(struct interface *ifp)
{
}
void pim_hello_restart_triggered(struct interface *ifp)
{
}
int pim_sock_add(struct interface *ifp)
{
return -1;
}
void pim_sock_delete(struct interface *ifp, const char *delete_message)
{
}
/*
* PIM register
*/
void pim_register_join(struct pim_upstream *up)
{
}
void pim_null_register_send(struct pim_upstream *up)
{
}
void pim_reg_del_on_couldreg_fail(struct interface *ifp)
{
}
/*
* CLI
*/
void pim_cmd_init(void)
{
}

View File

@ -44,9 +44,6 @@ static ssize_t printfrr_pimaddr(struct fbuf *buf, struct printfrr_eargs *ea,
#if PIM_IPV == 4 #if PIM_IPV == 4
return bprintfrr(buf, "%pI4", addr); return bprintfrr(buf, "%pI4", addr);
#elif !defined(PIM_V6_TEMP_BREAK)
CPP_NOTICE("note IPv6 typing for pim_addr is temporarily disabled.");
return bprintfrr(buf, "%pI4", addr);
#else #else
return bprintfrr(buf, "%pI6", addr); return bprintfrr(buf, "%pI6", addr);
#endif #endif

View File

@ -25,11 +25,7 @@
/* clang-format off */ /* clang-format off */
/* temporarily disable IPv6 types to keep code compiling. #if PIM_IPV == 4
* Defining PIM_V6_TEMP_BREAK will show a lot of compile errors - they are
* very useful to see TODOs.
*/
#if PIM_IPV == 4 || !defined(PIM_V6_TEMP_BREAK)
typedef struct in_addr pim_addr; typedef struct in_addr pim_addr;
#define PIM_ADDRSTRLEN INET_ADDRSTRLEN #define PIM_ADDRSTRLEN INET_ADDRSTRLEN

View File

@ -94,7 +94,7 @@ void pim_bfd_info_nbr_create(struct pim_interface *pim_ifp,
bfd_sess_set_timers( bfd_sess_set_timers(
neigh->bfd_session, pim_ifp->bfd_config.detection_multiplier, neigh->bfd_session, pim_ifp->bfd_config.detection_multiplier,
pim_ifp->bfd_config.min_rx, pim_ifp->bfd_config.min_tx); pim_ifp->bfd_config.min_rx, pim_ifp->bfd_config.min_tx);
#if PIM_IPV == 4 || !defined(PIM_V6_TEMP_BREAK) #if PIM_IPV == 4
bfd_sess_set_ipv4_addrs(neigh->bfd_session, NULL, &neigh->source_addr); bfd_sess_set_ipv4_addrs(neigh->bfd_session, NULL, &neigh->source_addr);
#else #else
bfd_sess_set_ipv6_addrs(neigh->bfd_session, NULL, &neigh->source_addr); bfd_sess_set_ipv6_addrs(neigh->bfd_session, NULL, &neigh->source_addr);

View File

@ -1371,7 +1371,12 @@ int pim_bsm_process(struct interface *ifp, struct ip *ip_hdr, uint8_t *buf,
} }
} }
if (ip_hdr->ip_dst.s_addr == qpim_all_pim_routers_addr.s_addr) { #if PIM_IPV == 4
if (ip_hdr->ip_dst.s_addr == qpim_all_pim_routers_addr.s_addr)
#else
if (0)
#endif
{
/* Multicast BSMs are only accepted if source interface & IP /* Multicast BSMs are only accepted if source interface & IP
* match RPF towards the BSR's IP address, or they have * match RPF towards the BSR's IP address, or they have
* no-forward set * no-forward set

View File

@ -3901,7 +3901,6 @@ static void clear_mroute(struct pim_instance *pim)
/* scan interfaces */ /* scan interfaces */
FOR_ALL_INTERFACES (pim->vrf, ifp) { FOR_ALL_INTERFACES (pim->vrf, ifp) {
struct pim_interface *pim_ifp = ifp->info; struct pim_interface *pim_ifp = ifp->info;
struct gm_group *grp;
struct pim_ifchannel *ch; struct pim_ifchannel *ch;
if (!pim_ifp) if (!pim_ifp)
@ -3914,7 +3913,9 @@ static void clear_mroute(struct pim_instance *pim)
pim_ifchannel_delete(ch); pim_ifchannel_delete(ch);
} }
#if PIM_IPV == 4
/* clean up all igmp groups */ /* clean up all igmp groups */
struct gm_group *grp;
if (pim_ifp->gm_group_list) { if (pim_ifp->gm_group_list) {
while (pim_ifp->gm_group_list->count) { while (pim_ifp->gm_group_list->count) {
@ -3922,6 +3923,7 @@ static void clear_mroute(struct pim_instance *pim)
igmp_group_delete(grp); igmp_group_delete(grp);
} }
} }
#endif
} }
/* clean up all upstreams*/ /* clean up all upstreams*/
@ -8236,6 +8238,7 @@ DEFPY_HIDDEN (interface_ip_igmp_query_generate,
"IGMP version\n" "IGMP version\n"
"IGMP version number\n") "IGMP version number\n")
{ {
#if PIM_IPV == 4
VTY_DECLVAR_CONTEXT(interface, ifp); VTY_DECLVAR_CONTEXT(interface, ifp);
int igmp_version; int igmp_version;
struct pim_interface *pim_ifp = ifp->info; struct pim_interface *pim_ifp = ifp->info;
@ -8253,7 +8256,7 @@ DEFPY_HIDDEN (interface_ip_igmp_query_generate,
igmp_version = atoi(argv[4]->arg); igmp_version = atoi(argv[4]->arg);
igmp_send_query_on_intf(ifp, igmp_version); igmp_send_query_on_intf(ifp, igmp_version);
#endif
return CMD_SUCCESS; return CMD_SUCCESS;
} }

View File

@ -50,10 +50,12 @@
#include "pim_igmp_join.h" #include "pim_igmp_join.h"
#include "pim_vxlan.h" #include "pim_vxlan.h"
#if PIM_IPV == 4
static void pim_if_igmp_join_del_all(struct interface *ifp); static void pim_if_igmp_join_del_all(struct interface *ifp);
static int igmp_join_sock(const char *ifname, ifindex_t ifindex, static int igmp_join_sock(const char *ifname, ifindex_t ifindex,
struct in_addr group_addr, struct in_addr group_addr,
struct in_addr source_addr); struct in_addr source_addr);
#endif
void pim_if_init(struct pim_instance *pim) void pim_if_init(struct pim_instance *pim)
{ {
@ -83,6 +85,7 @@ static void pim_sec_addr_free(struct pim_secondary_addr *sec_addr)
XFREE(MTYPE_PIM_SEC_ADDR, sec_addr); XFREE(MTYPE_PIM_SEC_ADDR, sec_addr);
} }
__attribute__((unused))
static int pim_sec_addr_comp(const void *p1, const void *p2) static int pim_sec_addr_comp(const void *p1, const void *p2)
{ {
const struct pim_secondary_addr *sec1 = p1; const struct pim_secondary_addr *sec1 = p1;
@ -124,6 +127,7 @@ struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim,
pim_ifp->pim = ifp->vrf->info; pim_ifp->pim = ifp->vrf->info;
pim_ifp->mroute_vif_index = -1; pim_ifp->mroute_vif_index = -1;
#if PIM_IPV == 4
pim_ifp->igmp_version = IGMP_DEFAULT_VERSION; pim_ifp->igmp_version = IGMP_DEFAULT_VERSION;
pim_ifp->gm_default_robustness_variable = pim_ifp->gm_default_robustness_variable =
IGMP_DEFAULT_ROBUSTNESS_VARIABLE; IGMP_DEFAULT_ROBUSTNESS_VARIABLE;
@ -185,6 +189,7 @@ struct pim_interface *pim_if_new(struct interface *ifp, bool igmp, bool pim,
pim_sock_reset(ifp); pim_sock_reset(ifp);
pim_if_add_vif(ifp, ispimreg, is_vxlan_term); pim_if_add_vif(ifp, ispimreg, is_vxlan_term);
#endif
pim_ifp->pim->mcast_if_count++; pim_ifp->pim->mcast_if_count++;
return pim_ifp; return pim_ifp;
@ -198,6 +203,10 @@ void pim_if_delete(struct interface *ifp)
pim_ifp = ifp->info; pim_ifp = ifp->info;
assert(pim_ifp); assert(pim_ifp);
pim_ifp->pim->mcast_if_count--;
#if PIM_IPV == 4
struct pim_ifchannel *ch;
if (pim_ifp->gm_join_list) { if (pim_ifp->gm_join_list) {
pim_if_igmp_join_del_all(ifp); pim_if_igmp_join_del_all(ifp);
} }
@ -208,7 +217,6 @@ void pim_if_delete(struct interface *ifp)
pim_neighbor_delete_all(ifp, "Interface removed from configuration"); pim_neighbor_delete_all(ifp, "Interface removed from configuration");
pim_if_del_vif(ifp); pim_if_del_vif(ifp);
pim_ifp->pim->mcast_if_count--;
pim_igmp_if_fini(pim_ifp); pim_igmp_if_fini(pim_ifp);
@ -218,6 +226,7 @@ void pim_if_delete(struct interface *ifp)
XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist); XFREE(MTYPE_PIM_INTERFACE, pim_ifp->boundary_oil_plist);
XFREE(MTYPE_PIM_INTERFACE, pim_ifp); XFREE(MTYPE_PIM_INTERFACE, pim_ifp);
#endif
ifp->info = NULL; ifp->info = NULL;
} }
@ -486,7 +495,6 @@ void pim_if_addr_add(struct connected *ifc)
{ {
struct pim_interface *pim_ifp; struct pim_interface *pim_ifp;
struct interface *ifp; struct interface *ifp;
struct in_addr ifaddr;
bool vxlan_term; bool vxlan_term;
assert(ifc); assert(ifc);
@ -507,13 +515,14 @@ void pim_if_addr_add(struct connected *ifc)
? "secondary" ? "secondary"
: "primary"); : "primary");
ifaddr = ifc->address->u.prefix4;
detect_address_change(ifp, 0, __func__); detect_address_change(ifp, 0, __func__);
// if (ifc->address->family != AF_INET) // if (ifc->address->family != AF_INET)
// return; // return;
#if PIM_IPV == 4
struct in_addr ifaddr = ifc->address->u.prefix4;
if (PIM_IF_TEST_IGMP(pim_ifp->options)) { if (PIM_IF_TEST_IGMP(pim_ifp->options)) {
struct gm_sock *igmp; struct gm_sock *igmp;
@ -579,6 +588,7 @@ void pim_if_addr_add(struct connected *ifc)
true); true);
} }
} /* igmp mtrace only */ } /* igmp mtrace only */
#endif
if (PIM_IF_TEST_PIM(pim_ifp->options)) { if (PIM_IF_TEST_PIM(pim_ifp->options)) {
@ -630,6 +640,7 @@ void pim_if_addr_add(struct connected *ifc)
static void pim_if_addr_del_igmp(struct connected *ifc) static void pim_if_addr_del_igmp(struct connected *ifc)
{ {
#if PIM_IPV == 4
struct pim_interface *pim_ifp = ifc->ifp->info; struct pim_interface *pim_ifp = ifc->ifp->info;
struct gm_sock *igmp; struct gm_sock *igmp;
struct in_addr ifaddr; struct in_addr ifaddr;
@ -652,6 +663,7 @@ static void pim_if_addr_del_igmp(struct connected *ifc)
/* if addr found, del IGMP socket */ /* if addr found, del IGMP socket */
igmp_sock_delete(igmp); igmp_sock_delete(igmp);
} }
#endif
} }
static void pim_if_addr_del_pim(struct connected *ifc) static void pim_if_addr_del_pim(struct connected *ifc)
@ -1140,6 +1152,7 @@ long pim_if_t_suppressed_msec(struct interface *ifp)
return t_suppressed_msec; return t_suppressed_msec;
} }
#if PIM_IPV == 4
static void igmp_join_free(struct gm_join *ij) static void igmp_join_free(struct gm_join *ij)
{ {
XFREE(MTYPE_PIM_IGMP_JOIN, ij); XFREE(MTYPE_PIM_IGMP_JOIN, ij);
@ -1330,6 +1343,7 @@ int pim_if_igmp_join_del(struct interface *ifp, struct in_addr group_addr,
return 0; return 0;
} }
__attribute__((unused))
static void pim_if_igmp_join_del_all(struct interface *ifp) static void pim_if_igmp_join_del_all(struct interface *ifp)
{ {
struct pim_interface *pim_ifp; struct pim_interface *pim_ifp;
@ -1350,6 +1364,19 @@ static void pim_if_igmp_join_del_all(struct interface *ifp)
for (ALL_LIST_ELEMENTS(pim_ifp->gm_join_list, node, nextnode, ij)) for (ALL_LIST_ELEMENTS(pim_ifp->gm_join_list, node, nextnode, ij))
pim_if_igmp_join_del(ifp, ij->group_addr, ij->source_addr); pim_if_igmp_join_del(ifp, ij->group_addr, ij->source_addr);
} }
#else /* PIM_IPV != 4 */
ferr_r pim_if_igmp_join_add(struct interface *ifp, struct in_addr group_addr,
struct in_addr source_addr)
{
return ferr_ok();
}
int pim_if_igmp_join_del(struct interface *ifp, struct in_addr group_addr,
struct in_addr source_addr)
{
return 0;
}
#endif /* PIM_IPV != 4 */
/* /*
RFC 4601 RFC 4601
@ -1524,6 +1551,7 @@ static int pim_ifp_create(struct interface *ifp)
*/ */
if (pim_ifp) if (pim_ifp)
pim_ifp->pim = pim; pim_ifp->pim = pim;
#if PIM_IPV == 4
pim_if_addr_add_all(ifp); pim_if_addr_add_all(ifp);
/* /*
@ -1535,8 +1563,10 @@ static int pim_ifp_create(struct interface *ifp)
* this is a no-op if it's already been done. * this is a no-op if it's already been done.
*/ */
pim_if_create_pimreg(pim); pim_if_create_pimreg(pim);
#endif
} }
#if PIM_IPV == 4
/* /*
* If we are a vrf device that is up, open up the pim_socket for * If we are a vrf device that is up, open up the pim_socket for
* listening * listening
@ -1564,6 +1594,7 @@ static int pim_ifp_create(struct interface *ifp)
"%s: Cannot enable pim on %s. MAXVIFS(%d) reached. Deleting and readding the vxlan termimation device after unconfiguring pim from other interfaces may succeed.", "%s: Cannot enable pim on %s. MAXVIFS(%d) reached. Deleting and readding the vxlan termimation device after unconfiguring pim from other interfaces may succeed.",
__func__, ifp->name, MAXVIFS); __func__, ifp->name, MAXVIFS);
} }
#endif
return 0; return 0;
} }
@ -1572,7 +1603,6 @@ static int pim_ifp_up(struct interface *ifp)
{ {
struct pim_interface *pim_ifp; struct pim_interface *pim_ifp;
struct pim_instance *pim; struct pim_instance *pim;
uint32_t table_id;
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA) {
zlog_debug( zlog_debug(
@ -1593,6 +1623,9 @@ static int pim_ifp_up(struct interface *ifp)
if (pim_ifp) if (pim_ifp)
pim_ifp->pim = pim; pim_ifp->pim = pim;
#if PIM_IPV == 4
uint32_t table_id;
/* /*
pim_if_addr_add_all() suffices for bringing up both IGMP and pim_if_addr_add_all() suffices for bringing up both IGMP and
PIM PIM
@ -1621,6 +1654,7 @@ static int pim_ifp_up(struct interface *ifp)
} }
} }
} }
#endif
return 0; return 0;
} }
@ -1634,6 +1668,7 @@ static int pim_ifp_down(struct interface *ifp)
ifp->mtu, if_is_operative(ifp)); ifp->mtu, if_is_operative(ifp));
} }
#if PIM_IPV == 4
if (!if_is_operative(ifp)) { if (!if_is_operative(ifp)) {
pim_ifchannel_delete_all(ifp); pim_ifchannel_delete_all(ifp);
/* /*
@ -1656,14 +1691,13 @@ static int pim_ifp_down(struct interface *ifp)
pim_if_del_vif(ifp); pim_if_del_vif(ifp);
pim_ifstat_reset(ifp); pim_ifstat_reset(ifp);
} }
#endif
return 0; return 0;
} }
static int pim_ifp_destroy(struct interface *ifp) static int pim_ifp_destroy(struct interface *ifp)
{ {
struct pim_instance *pim;
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA) {
zlog_debug( zlog_debug(
"%s: %s index %d vrf %s(%u) flags %ld metric %d mtu %d operative %d", "%s: %s index %d vrf %s(%u) flags %ld metric %d mtu %d operative %d",
@ -1672,12 +1706,16 @@ static int pim_ifp_destroy(struct interface *ifp)
ifp->mtu, if_is_operative(ifp)); ifp->mtu, if_is_operative(ifp));
} }
#if PIM_IPV == 4
struct pim_instance *pim;
if (!if_is_operative(ifp)) if (!if_is_operative(ifp))
pim_if_addr_del_all(ifp); pim_if_addr_del_all(ifp);
pim = ifp->vrf->info; pim = ifp->vrf->info;
if (pim && pim->vxlan.term_if == ifp) if (pim && pim->vxlan.term_if == ifp)
pim_vxlan_del_term_dev(pim); pim_vxlan_del_term_dev(pim);
#endif
return 0; return 0;
} }

View File

@ -306,8 +306,8 @@ void pim_ifchannel_ifjoin_switch(const char *caller, struct pim_ifchannel *ch,
* supplying the implied * supplying the implied
* if channel. So remove it. * if channel. So remove it.
*/ */
if (c_oil->oil.mfcc_ttls if (oil_if_has(c_oil,
[pim_ifp->mroute_vif_index]) pim_ifp->mroute_vif_index))
pim_channel_del_inherited_oif( pim_channel_del_inherited_oif(
c_oil, ch->interface, c_oil, ch->interface,
__func__); __func__);
@ -1287,7 +1287,7 @@ void pim_ifchannel_local_membership_del(struct interface *ifp, pim_sgaddr *sg)
if (!pim_upstream_evaluate_join_desired_interface( if (!pim_upstream_evaluate_join_desired_interface(
child, ch, starch) || child, ch, starch) ||
(!chchannel && (!chchannel &&
c_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index])) { oil_if_has(c_oil, pim_ifp->mroute_vif_index))) {
pim_channel_del_inherited_oif(c_oil, ifp, pim_channel_del_inherited_oif(c_oil, ifp,
__func__); __func__);
} }

View File

@ -105,6 +105,7 @@ struct gm_sock {
struct pim_interface; struct pim_interface;
#if PIM_IPV == 4
void pim_igmp_if_init(struct pim_interface *pim_ifp, struct interface *ifp); void pim_igmp_if_init(struct pim_interface *pim_ifp, struct interface *ifp);
void pim_igmp_if_reset(struct pim_interface *pim_ifp); void pim_igmp_if_reset(struct pim_interface *pim_ifp);
void pim_igmp_if_fini(struct pim_interface *pim_ifp); void pim_igmp_if_fini(struct pim_interface *pim_ifp);
@ -126,6 +127,24 @@ void pim_igmp_other_querier_timer_off(struct gm_sock *igmp);
int igmp_validate_checksum(char *igmp_msg, int igmp_msg_len); int igmp_validate_checksum(char *igmp_msg, int igmp_msg_len);
#else /* PIM_IPV != 4 */
static inline void pim_igmp_general_query_on(struct gm_sock *igmp)
{
}
static inline void pim_igmp_general_query_off(struct gm_sock *igmp)
{
}
static inline void pim_igmp_other_querier_timer_on(struct gm_sock *igmp)
{
}
static inline void pim_igmp_other_querier_timer_off(struct gm_sock *igmp)
{
}
#endif /* PIM_IPV == 4 */
#define IGMP_SOURCE_MASK_FORWARDING (1 << 0) #define IGMP_SOURCE_MASK_FORWARDING (1 << 0)
#define IGMP_SOURCE_MASK_DELETE (1 << 1) #define IGMP_SOURCE_MASK_DELETE (1 << 1)
#define IGMP_SOURCE_MASK_SEND (1 << 2) #define IGMP_SOURCE_MASK_SEND (1 << 2)
@ -184,6 +203,7 @@ struct gm_group {
int64_t last_igmp_v2_report_dsec; int64_t last_igmp_v2_report_dsec;
}; };
#if PIM_IPV == 4
struct gm_group *find_group_by_addr(struct gm_sock *igmp, struct gm_group *find_group_by_addr(struct gm_sock *igmp,
struct in_addr group_addr); struct in_addr group_addr);
struct gm_group *igmp_add_group_by_addr(struct gm_sock *igmp, struct gm_group *igmp_add_group_by_addr(struct gm_sock *igmp,
@ -210,4 +230,11 @@ void igmp_send_query(int igmp_version, struct gm_group *group, int fd,
void igmp_group_delete(struct gm_group *group); void igmp_group_delete(struct gm_group *group);
void igmp_send_query_on_intf(struct interface *ifp, int igmp_ver); void igmp_send_query_on_intf(struct interface *ifp, int igmp_ver);
#else /* PIM_IPV != 4 */
static inline void igmp_startup_mode_on(struct gm_sock *igmp)
{
}
#endif /* PIM_IPV != 4 */
#endif /* PIM_IGMP_H */ #endif /* PIM_IGMP_H */

View File

@ -39,9 +39,9 @@ struct group_source_req {
}; };
#endif #endif
static int pim_igmp_join_source(int fd, ifindex_t ifindex, static inline int pim_igmp_join_source(int fd, ifindex_t ifindex,
struct in_addr group_addr, struct in_addr group_addr,
struct in_addr source_addr) struct in_addr source_addr)
{ {
struct group_source_req req; struct group_source_req req;
struct sockaddr_in group; struct sockaddr_in group;

View File

@ -35,7 +35,17 @@ struct igmp_stats {
uint32_t unsupported; uint32_t unsupported;
}; };
#if PIM_IPV == 4
void igmp_stats_init(struct igmp_stats *stats); void igmp_stats_init(struct igmp_stats *stats);
void igmp_stats_add(struct igmp_stats *a, struct igmp_stats *b); void igmp_stats_add(struct igmp_stats *a, struct igmp_stats *b);
#else
static inline void igmp_stats_init(struct igmp_stats *stats)
{
}
static inline void igmp_stats_add(struct igmp_stats *a, struct igmp_stats *b)
{
}
#endif
#endif /* PIM_IGMP_STATS_H */ #endif /* PIM_IGMP_STATS_H */

View File

@ -53,6 +53,7 @@
/* OHPI: Older Host Present Interval */ /* OHPI: Older Host Present Interval */
#define PIM_IGMP_OHPI_DSEC(qrv,qqi,qri_dsec) ((qrv) * (10 * (qqi)) + (qri_dsec)) #define PIM_IGMP_OHPI_DSEC(qrv,qqi,qri_dsec) ((qrv) * (10 * (qqi)) + (qri_dsec))
#if PIM_IPV == 4
void igmp_group_reset_gmi(struct gm_group *group); void igmp_group_reset_gmi(struct gm_group *group);
void igmp_source_reset_gmi(struct gm_group *group, struct gm_source *source); void igmp_source_reset_gmi(struct gm_group *group, struct gm_source *source);
@ -98,4 +99,16 @@ void igmp_v3_recv_query(struct gm_sock *igmp, const char *from_str,
int igmp_v3_recv_report(struct gm_sock *igmp, struct in_addr from, int igmp_v3_recv_report(struct gm_sock *igmp, struct in_addr from,
const char *from_str, char *igmp_msg, int igmp_msg_len); const char *from_str, char *igmp_msg, int igmp_msg_len);
#else /* PIM_IPV != 4 */
static inline void igmp_group_reset_gmi(struct gm_group *group)
{
}
static inline void igmp_source_reset_gmi(struct gm_group *group,
struct gm_source *source)
{
}
#endif
#endif /* PIM_IGMPV3_H */ #endif /* PIM_IGMPV3_H */

View File

@ -109,6 +109,7 @@ pim_jp_agg_get_interface_upstream_switch_list(struct pim_rpf *rpf)
struct pim_interface *pim_ifp; struct pim_interface *pim_ifp;
struct pim_iface_upstream_switch *pius; struct pim_iface_upstream_switch *pius;
struct listnode *node, *nnode; struct listnode *node, *nnode;
pim_addr rpf_addr;
if (!ifp) if (!ifp)
return NULL; return NULL;
@ -119,16 +120,18 @@ pim_jp_agg_get_interface_upstream_switch_list(struct pim_rpf *rpf)
if (!pim_ifp) if (!pim_ifp)
return NULL; return NULL;
rpf_addr = pim_addr_from_prefix(&rpf->rpf_addr);
for (ALL_LIST_ELEMENTS(pim_ifp->upstream_switch_list, node, nnode, for (ALL_LIST_ELEMENTS(pim_ifp->upstream_switch_list, node, nnode,
pius)) { pius)) {
if (pius->address.s_addr == rpf->rpf_addr.u.prefix4.s_addr) if (!pim_addr_cmp(pius->address, rpf_addr))
break; break;
} }
if (!pius) { if (!pius) {
pius = XCALLOC(MTYPE_PIM_JP_AGG_GROUP, pius = XCALLOC(MTYPE_PIM_JP_AGG_GROUP,
sizeof(struct pim_iface_upstream_switch)); sizeof(struct pim_iface_upstream_switch));
pius->address.s_addr = rpf->rpf_addr.u.prefix4.s_addr; pius->address = rpf_addr;
pius->us = list_new(); pius->us = list_new();
listnode_add_sort(pim_ifp->upstream_switch_list, pius); listnode_add_sort(pim_ifp->upstream_switch_list, pius);
} }

View File

@ -28,6 +28,7 @@
#include "mlag.h" #include "mlag.h"
#include "pim_iface.h" #include "pim_iface.h"
#if PIM_IPV == 4
extern void pim_mlag_init(void); extern void pim_mlag_init(void);
extern void pim_mlag_terminate(void); extern void pim_mlag_terminate(void);
extern void pim_instance_mlag_init(struct pim_instance *pim); extern void pim_instance_mlag_init(struct pim_instance *pim);
@ -52,4 +53,49 @@ extern void pim_mlag_up_local_del(struct pim_instance *pim,
extern bool pim_mlag_up_df_role_update(struct pim_instance *pim, extern bool pim_mlag_up_df_role_update(struct pim_instance *pim,
struct pim_upstream *up, bool is_df, struct pim_upstream *up, bool is_df,
const char *reason); const char *reason);
#else /* PIM_IPV == 4 */
static inline void pim_mlag_terminate(void)
{
}
static inline void pim_instance_mlag_init(struct pim_instance *pim)
{
}
static inline void pim_instance_mlag_terminate(struct pim_instance *pim)
{
}
static inline void pim_if_configure_mlag_dualactive(
struct pim_interface *pim_ifp)
{
}
static inline void pim_if_unconfigure_mlag_dualactive(
struct pim_interface *pim_ifp)
{
}
static inline void pim_mlag_register(void)
{
}
static inline void pim_mlag_up_local_add(struct pim_instance *pim,
struct pim_upstream *upstream)
{
}
static inline void pim_mlag_up_local_del(struct pim_instance *pim,
struct pim_upstream *upstream)
{
}
static inline bool pim_mlag_up_df_role_update(struct pim_instance *pim,
struct pim_upstream *up,
bool is_df, const char *reason)
{
return false;
}
#endif
#endif #endif

View File

@ -145,6 +145,7 @@ static int pim_mroute_set(struct pim_instance *pim, int enable)
return 0; return 0;
} }
#if PIM_IPV == 4
static const char *const igmpmsgtype2str[IGMPMSG_WRVIFWHOLE + 1] = { static const char *const igmpmsgtype2str[IGMPMSG_WRVIFWHOLE + 1] = {
"<unknown_upcall?>", "NOCACHE", "WRONGVIF", "WHOLEPKT", "WRVIFWHOLE"}; "<unknown_upcall?>", "NOCACHE", "WRONGVIF", "WHOLEPKT", "WRVIFWHOLE"};
@ -227,7 +228,7 @@ static int pim_mroute_msg_nocache(int fd, struct interface *ifp,
up->channel_oil->cc.pktcnt++; up->channel_oil->cc.pktcnt++;
// resolve mfcc_parent prior to mroute_add in channel_add_oif // resolve mfcc_parent prior to mroute_add in channel_add_oif
if (up->rpf.source_nexthop.interface && if (up->rpf.source_nexthop.interface &&
up->channel_oil->oil.mfcc_parent >= MAXVIFS) { *oil_parent(up->channel_oil) >= MAXVIFS) {
pim_upstream_mroute_iif_update(up->channel_oil, __func__); pim_upstream_mroute_iif_update(up->channel_oil, __func__);
} }
pim_register_join(up); pim_register_join(up);
@ -580,12 +581,8 @@ static int pim_mroute_msg(struct pim_instance *pim, const char *buf,
int buf_size, ifindex_t ifindex) int buf_size, ifindex_t ifindex)
{ {
struct interface *ifp; struct interface *ifp;
struct pim_interface *pim_ifp;
const struct ip *ip_hdr; const struct ip *ip_hdr;
const struct igmpmsg *msg; const struct igmpmsg *msg;
struct in_addr ifaddr;
struct gm_sock *igmp;
const struct prefix *connected_src;
if (buf_size < (int)sizeof(struct ip)) if (buf_size < (int)sizeof(struct ip))
return 0; return 0;
@ -593,6 +590,11 @@ static int pim_mroute_msg(struct pim_instance *pim, const char *buf,
ip_hdr = (const struct ip *)buf; ip_hdr = (const struct ip *)buf;
if (ip_hdr->ip_p == IPPROTO_IGMP) { if (ip_hdr->ip_p == IPPROTO_IGMP) {
#if PIM_IPV == 4
struct pim_interface *pim_ifp;
struct in_addr ifaddr;
struct gm_sock *igmp;
const struct prefix *connected_src;
/* We have the IP packet but we do not know which interface this /* We have the IP packet but we do not know which interface this
* packet was * packet was
@ -632,6 +634,7 @@ static int pim_mroute_msg(struct pim_instance *pim, const char *buf,
zlog_debug("No IGMP socket on interface: %s with connected source: %pFX", zlog_debug("No IGMP socket on interface: %s with connected source: %pFX",
ifp->name, connected_src); ifp->name, connected_src);
} }
#endif
} else if (ip_hdr->ip_p) { } else if (ip_hdr->ip_p) {
if (PIM_DEBUG_MROUTE_DETAIL) { if (PIM_DEBUG_MROUTE_DETAIL) {
zlog_debug( zlog_debug(
@ -676,6 +679,14 @@ static int pim_mroute_msg(struct pim_instance *pim, const char *buf,
return 0; return 0;
} }
#else /* PIM_IPV != 4 */
static int pim_mroute_msg(struct pim_instance *pim, const char *buf,
int buf_size, ifindex_t ifindex)
{
return 0;
}
#endif /* PIM_IPV != 4 */
static void mroute_read(struct thread *t) static void mroute_read(struct thread *t)
{ {
@ -797,7 +808,7 @@ int pim_mroute_socket_disable(struct pim_instance *pim)
would be used for multicast forwarding, a corresponding multicast would be used for multicast forwarding, a corresponding multicast
interface must be added to the kernel. interface must be added to the kernel.
*/ */
int pim_mroute_add_vif(struct interface *ifp, struct in_addr ifaddr, int pim_mroute_add_vif(struct interface *ifp, pim_addr ifaddr,
unsigned char flags) unsigned char flags)
{ {
struct pim_interface *pim_ifp = ifp->info; struct pim_interface *pim_ifp = ifp->info;
@ -836,15 +847,10 @@ int pim_mroute_add_vif(struct interface *ifp, struct in_addr ifaddr,
err = setsockopt(pim_ifp->pim->mroute_socket, IPPROTO_IP, MRT_ADD_VIF, err = setsockopt(pim_ifp->pim->mroute_socket, IPPROTO_IP, MRT_ADD_VIF,
(void *)&vc, sizeof(vc)); (void *)&vc, sizeof(vc));
if (err) { if (err) {
char ifaddr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<ifaddr?>", ifaddr, ifaddr_str,
sizeof(ifaddr_str));
zlog_warn( zlog_warn(
"%s: failure: setsockopt(fd=%d,IPPROTO_IP,MRT_ADD_VIF,vif_index=%d,ifaddr=%s,flag=%d): errno=%d: %s", "%s: failure: setsockopt(fd=%d,IPPROTO_IP,MRT_ADD_VIF,vif_index=%d,ifaddr=%pPAs,flag=%d): errno=%d: %s",
__func__, pim_ifp->pim->mroute_socket, ifp->ifindex, __func__, pim_ifp->pim->mroute_socket, ifp->ifindex,
ifaddr_str, flags, errno, safe_strerror(errno)); &ifaddr, flags, errno, safe_strerror(errno));
return -2; return -2;
} }
@ -918,26 +924,26 @@ bool pim_mroute_allow_iif_in_oil(struct channel_oil *c_oil,
#endif #endif
} }
static inline void pim_mroute_copy(struct mfcctl *oil, static inline void pim_mroute_copy(struct channel_oil *out,
struct channel_oil *c_oil) struct channel_oil *in)
{ {
int i; int i;
oil->mfcc_origin = c_oil->oil.mfcc_origin; *oil_origin(out) = *oil_origin(in);
oil->mfcc_mcastgrp = c_oil->oil.mfcc_mcastgrp; *oil_mcastgrp(out) = *oil_mcastgrp(in);
oil->mfcc_parent = c_oil->oil.mfcc_parent; *oil_parent(out) = *oil_parent(in);
for (i = 0; i < MAXVIFS; ++i) { for (i = 0; i < MAXVIFS; ++i) {
if ((oil->mfcc_parent == i) && if (*oil_parent(out) == i &&
!pim_mroute_allow_iif_in_oil(c_oil, i)) { !pim_mroute_allow_iif_in_oil(in, i)) {
oil->mfcc_ttls[i] = 0; oil_if_set(out, i, 0);
continue; continue;
} }
if (c_oil->oif_flags[i] & PIM_OIF_FLAG_MUTE) if (in->oif_flags[i] & PIM_OIF_FLAG_MUTE)
oil->mfcc_ttls[i] = 0; oil_if_set(out, i, 0);
else else
oil->mfcc_ttls[i] = c_oil->oil.mfcc_ttls[i]; oil_if_set(out, i, oil_if_has(in, i));
} }
} }
@ -947,7 +953,7 @@ static inline void pim_mroute_copy(struct mfcctl *oil,
static int pim_mroute_add(struct channel_oil *c_oil, const char *name) static int pim_mroute_add(struct channel_oil *c_oil, const char *name)
{ {
struct pim_instance *pim = c_oil->pim; struct pim_instance *pim = c_oil->pim;
struct mfcctl tmp_oil = { {0} }; struct channel_oil tmp_oil[1] = { };
int err; int err;
pim->mroute_add_last = pim_time_monotonic_sec(); pim->mroute_add_last = pim_time_monotonic_sec();
@ -956,14 +962,14 @@ static int pim_mroute_add(struct channel_oil *c_oil, const char *name)
/* Copy the oil to a temporary structure to fixup (without need to /* Copy the oil to a temporary structure to fixup (without need to
* later restore) before sending the mroute add to the dataplane * later restore) before sending the mroute add to the dataplane
*/ */
pim_mroute_copy(&tmp_oil, c_oil); pim_mroute_copy(tmp_oil, c_oil);
/* The linux kernel *expects* the incoming /* The linux kernel *expects* the incoming
* vif to be part of the outgoing list * vif to be part of the outgoing list
* in the case of a (*,G). * in the case of a (*,G).
*/ */
if (c_oil->oil.mfcc_origin.s_addr == INADDR_ANY) { if (pim_addr_is_any(*oil_origin(c_oil))) {
tmp_oil.mfcc_ttls[c_oil->oil.mfcc_parent] = 1; oil_if_set(tmp_oil, *oil_parent(c_oil), 1);
} }
/* /*
@ -973,19 +979,19 @@ static int pim_mroute_add(struct channel_oil *c_oil, const char *name)
* the packets to be forwarded. Then set it * the packets to be forwarded. Then set it
* to the correct IIF afterwords. * to the correct IIF afterwords.
*/ */
if (!c_oil->installed && c_oil->oil.mfcc_origin.s_addr != INADDR_ANY if (!c_oil->installed && !pim_addr_is_any(*oil_origin(c_oil))
&& c_oil->oil.mfcc_parent != 0) { && *oil_parent(c_oil) != 0) {
tmp_oil.mfcc_parent = 0; *oil_parent(tmp_oil) = 0;
} }
err = setsockopt(pim->mroute_socket, IPPROTO_IP, MRT_ADD_MFC, err = setsockopt(pim->mroute_socket, IPPROTO_IP, MRT_ADD_MFC,
&tmp_oil, sizeof(tmp_oil)); &tmp_oil->oil, sizeof(tmp_oil->oil));
if (!err && !c_oil->installed if (!err && !c_oil->installed
&& c_oil->oil.mfcc_origin.s_addr != INADDR_ANY && !pim_addr_is_any(*oil_origin(c_oil))
&& c_oil->oil.mfcc_parent != 0) { && *oil_parent(c_oil) != 0) {
tmp_oil.mfcc_parent = c_oil->oil.mfcc_parent; *oil_parent(tmp_oil) = *oil_parent(c_oil);
err = setsockopt(pim->mroute_socket, IPPROTO_IP, MRT_ADD_MFC, err = setsockopt(pim->mroute_socket, IPPROTO_IP, MRT_ADD_MFC,
&tmp_oil, sizeof(tmp_oil)); &tmp_oil->oil, sizeof(tmp_oil->oil));
} }
if (err) { if (err) {
@ -1040,7 +1046,7 @@ static int pim_upstream_mroute_update(struct channel_oil *c_oil,
{ {
char buf[1000]; char buf[1000];
if (c_oil->oil.mfcc_parent >= MAXVIFS) { if (*oil_parent(c_oil) >= MAXVIFS) {
/* the c_oil cannot be installed as a mroute yet */ /* the c_oil cannot be installed as a mroute yet */
if (PIM_DEBUG_MROUTE) if (PIM_DEBUG_MROUTE)
zlog_debug( zlog_debug(
@ -1087,13 +1093,13 @@ int pim_upstream_mroute_add(struct channel_oil *c_oil, const char *name)
iif = pim_upstream_get_mroute_iif(c_oil, name); iif = pim_upstream_get_mroute_iif(c_oil, name);
if (c_oil->oil.mfcc_parent != iif) { if (*oil_parent(c_oil) != iif) {
c_oil->oil.mfcc_parent = iif; *oil_parent(c_oil) = iif;
if (c_oil->oil.mfcc_origin.s_addr == INADDR_ANY && if (pim_addr_is_any(*oil_origin(c_oil)) &&
c_oil->up) c_oil->up)
pim_upstream_all_sources_iif_update(c_oil->up); pim_upstream_all_sources_iif_update(c_oil->up);
} else { } else {
c_oil->oil.mfcc_parent = iif; *oil_parent(c_oil) = iif;
} }
return pim_upstream_mroute_update(c_oil, name); return pim_upstream_mroute_update(c_oil, name);
@ -1108,13 +1114,13 @@ int pim_upstream_mroute_iif_update(struct channel_oil *c_oil, const char *name)
char buf[1000]; char buf[1000];
iif = pim_upstream_get_mroute_iif(c_oil, name); iif = pim_upstream_get_mroute_iif(c_oil, name);
if (c_oil->oil.mfcc_parent == iif) { if (*oil_parent(c_oil) == iif) {
/* no change */ /* no change */
return 0; return 0;
} }
c_oil->oil.mfcc_parent = iif; *oil_parent(c_oil) = iif;
if (c_oil->oil.mfcc_origin.s_addr == INADDR_ANY && if (pim_addr_is_any(*oil_origin(c_oil)) &&
c_oil->up) c_oil->up)
pim_upstream_all_sources_iif_update(c_oil->up); pim_upstream_all_sources_iif_update(c_oil->up);
@ -1137,10 +1143,10 @@ void pim_static_mroute_iif_update(struct channel_oil *c_oil,
int input_vif_index, int input_vif_index,
const char *name) const char *name)
{ {
if (c_oil->oil.mfcc_parent == input_vif_index) if (*oil_parent(c_oil) == input_vif_index)
return; return;
c_oil->oil.mfcc_parent = input_vif_index; *oil_parent(c_oil) = input_vif_index;
if (input_vif_index == MAXVIFS) if (input_vif_index == MAXVIFS)
pim_mroute_del(c_oil, name); pim_mroute_del(c_oil, name);
else else
@ -1160,7 +1166,7 @@ int pim_mroute_del(struct channel_oil *c_oil, const char *name)
char buf[1000]; char buf[1000];
zlog_debug( zlog_debug(
"%s %s: vifi %d for route is %s not installed, do not need to send del req. ", "%s %s: vifi %d for route is %s not installed, do not need to send del req. ",
__FILE__, __func__, c_oil->oil.mfcc_parent, __FILE__, __func__, *oil_parent(c_oil),
pim_channel_oil_dump(c_oil, buf, sizeof(buf))); pim_channel_oil_dump(c_oil, buf, sizeof(buf)));
} }
return -2; return -2;
@ -1193,7 +1199,6 @@ int pim_mroute_del(struct channel_oil *c_oil, const char *name)
void pim_mroute_update_counters(struct channel_oil *c_oil) void pim_mroute_update_counters(struct channel_oil *c_oil)
{ {
struct pim_instance *pim = c_oil->pim; struct pim_instance *pim = c_oil->pim;
struct sioc_sg_req sgreq;
c_oil->cc.oldpktcnt = c_oil->cc.pktcnt; c_oil->cc.oldpktcnt = c_oil->cc.pktcnt;
c_oil->cc.oldbytecnt = c_oil->cc.bytecnt; c_oil->cc.oldbytecnt = c_oil->cc.bytecnt;
@ -1204,24 +1209,27 @@ void pim_mroute_update_counters(struct channel_oil *c_oil)
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
pim_sgaddr sg; pim_sgaddr sg;
sg.src = c_oil->oil.mfcc_origin; sg.src = *oil_origin(c_oil);
sg.grp = c_oil->oil.mfcc_mcastgrp; sg.grp = *oil_mcastgrp(c_oil);
zlog_debug("Channel%pSG is not installed no need to collect data from kernel", zlog_debug("Channel%pSG is not installed no need to collect data from kernel",
&sg); &sg);
} }
return; return;
} }
#if PIM_IPV == 4
struct sioc_sg_req sgreq;
memset(&sgreq, 0, sizeof(sgreq)); memset(&sgreq, 0, sizeof(sgreq));
sgreq.src = c_oil->oil.mfcc_origin; sgreq.src = *oil_origin(c_oil);
sgreq.grp = c_oil->oil.mfcc_mcastgrp; sgreq.grp = *oil_mcastgrp(c_oil);
pim_zlookup_sg_statistics(c_oil); pim_zlookup_sg_statistics(c_oil);
if (ioctl(pim->mroute_socket, SIOCGETSGCNT, &sgreq)) { if (ioctl(pim->mroute_socket, SIOCGETSGCNT, &sgreq)) {
pim_sgaddr sg; pim_sgaddr sg;
sg.src = c_oil->oil.mfcc_origin; sg.src = *oil_origin(c_oil);
sg.grp = c_oil->oil.mfcc_mcastgrp; sg.grp = *oil_mcastgrp(c_oil);
zlog_warn("ioctl(SIOCGETSGCNT=%lu) failure for (S,G)=%pSG: errno=%d: %s", zlog_warn("ioctl(SIOCGETSGCNT=%lu) failure for (S,G)=%pSG: errno=%d: %s",
(unsigned long)SIOCGETSGCNT, &sg, (unsigned long)SIOCGETSGCNT, &sg,
@ -1232,6 +1240,6 @@ void pim_mroute_update_counters(struct channel_oil *c_oil)
c_oil->cc.pktcnt = sgreq.pktcnt; c_oil->cc.pktcnt = sgreq.pktcnt;
c_oil->cc.bytecnt = sgreq.bytecnt; c_oil->cc.bytecnt = sgreq.bytecnt;
c_oil->cc.wrong_if = sgreq.wrong_if; c_oil->cc.wrong_if = sgreq.wrong_if;
#endif
return; return;
} }

View File

@ -37,6 +37,7 @@
#define PIM_MROUTE_MIN_TTL (1) #define PIM_MROUTE_MIN_TTL (1)
#if PIM_IPV == 4
#if defined(HAVE_LINUX_MROUTE_H) #if defined(HAVE_LINUX_MROUTE_H)
#include <linux/mroute.h> #include <linux/mroute.h>
#else #else
@ -157,6 +158,19 @@ struct igmpmsg {
struct in_addr im_src, im_dst; struct in_addr im_src, im_dst;
}; };
#endif #endif
#endif /* HAVE_LINUX_MROUTE_H */
typedef struct mfcctl pim_mfcctl;
#else /* PIM_IPV != 4 */
#if defined(HAVE_LINUX_MROUTE6_H)
#include <linux/mroute6.h>
#endif
typedef struct mf6cctl pim_mfcctl;
#define MAXVIFS IF_SETSIZE
#endif #endif
#ifndef IGMPMSG_WRVIFWHOLE #ifndef IGMPMSG_WRVIFWHOLE
@ -172,7 +186,7 @@ struct channel_oil;
int pim_mroute_socket_enable(struct pim_instance *pim); int pim_mroute_socket_enable(struct pim_instance *pim);
int pim_mroute_socket_disable(struct pim_instance *pim); int pim_mroute_socket_disable(struct pim_instance *pim);
int pim_mroute_add_vif(struct interface *ifp, struct in_addr ifaddr, int pim_mroute_add_vif(struct interface *ifp, pim_addr ifaddr,
unsigned char flags); unsigned char flags);
int pim_mroute_del_vif(struct interface *ifp); int pim_mroute_del_vif(struct interface *ifp);

View File

@ -138,7 +138,7 @@ uint8_t *pim_msg_addr_encode_ipv6_group(uint8_t *buf, struct in6_addr addr)
return buf; return buf;
} }
#if PIM_IPV == 4 || !defined(PIM_V6_TEMP_BREAK) #if PIM_IPV == 4
#define pim_msg_addr_encode(what) pim_msg_addr_encode_ipv4_##what #define pim_msg_addr_encode(what) pim_msg_addr_encode_ipv4_##what
#else #else
#define pim_msg_addr_encode(what) pim_msg_addr_encode_ipv6_##what #define pim_msg_addr_encode(what) pim_msg_addr_encode_ipv6_##what

View File

@ -46,9 +46,13 @@ int funcname(struct argtype *args) \
} \ } \
MACRO_REQUIRE_SEMICOLON() MACRO_REQUIRE_SEMICOLON()
#define yang_dnode_get_pimaddr yang_dnode_get_ipv6
#else /* PIM_IPV != 6 */ #else /* PIM_IPV != 6 */
#define pim6_msdp_err(funcname, argtype) \ #define pim6_msdp_err(funcname, argtype) \
MACRO_REQUIRE_SEMICOLON() MACRO_REQUIRE_SEMICOLON()
#define yang_dnode_get_pimaddr yang_dnode_get_ipv4
#endif /* PIM_IPV != 6 */ #endif /* PIM_IPV != 6 */
static void pim_if_membership_clear(struct interface *ifp) static void pim_if_membership_clear(struct interface *ifp)
@ -173,8 +177,7 @@ static int pim_cmd_interface_delete(struct interface *ifp)
} }
static int interface_pim_use_src_cmd_worker(struct interface *ifp, static int interface_pim_use_src_cmd_worker(struct interface *ifp,
struct in_addr source_addr, pim_addr source_addr, char *errmsg, size_t errmsg_len)
char *errmsg, size_t errmsg_len)
{ {
int result; int result;
int ret = NB_OK; int ret = NB_OK;
@ -397,15 +400,10 @@ static void igmp_sock_query_interval_reconfig(struct gm_sock *igmp)
ifp = igmp->interface; ifp = igmp->interface;
pim_ifp = ifp->info; pim_ifp = ifp->info;
if (PIM_DEBUG_IGMP_TRACE) { if (PIM_DEBUG_IGMP_TRACE)
char ifaddr_str[INET_ADDRSTRLEN]; zlog_debug("%s: Querier %pPAs on %s reconfig query_interval=%d",
__func__, &igmp->ifaddr, ifp->name,
pim_inet4_dump("<ifaddr?>", igmp->ifaddr, ifaddr_str,
sizeof(ifaddr_str));
zlog_debug("%s: Querier %s on %s reconfig query_interval=%d",
__func__, ifaddr_str, ifp->name,
pim_ifp->gm_default_query_interval); pim_ifp->gm_default_query_interval);
}
/* /*
* igmp_startup_mode_on() will reset QQI: * igmp_startup_mode_on() will reset QQI:
@ -2016,7 +2014,7 @@ int lib_interface_pim_address_family_use_source_modify(
struct nb_cb_modify_args *args) struct nb_cb_modify_args *args)
{ {
struct interface *ifp; struct interface *ifp;
struct ipaddr source_addr; pim_addr source_addr;
int result; int result;
const struct lyd_node *if_dnode; const struct lyd_node *if_dnode;
@ -2034,10 +2032,14 @@ int lib_interface_pim_address_family_use_source_modify(
break; break;
case NB_EV_APPLY: case NB_EV_APPLY:
ifp = nb_running_get_entry(args->dnode, NULL, true); ifp = nb_running_get_entry(args->dnode, NULL, true);
yang_dnode_get_ip(&source_addr, args->dnode, NULL); #if PIM_IPV == 4
yang_dnode_get_ipv4(&source_addr, args->dnode, NULL);
#else
yang_dnode_get_ipv6(&source_addr, args->dnode, NULL);
#endif
result = interface_pim_use_src_cmd_worker( result = interface_pim_use_src_cmd_worker(
ifp, source_addr.ip._v4_addr, ifp, source_addr,
args->errmsg, args->errmsg_len); args->errmsg, args->errmsg_len);
if (result != PIM_SUCCESS) if (result != PIM_SUCCESS)
@ -2053,7 +2055,6 @@ int lib_interface_pim_address_family_use_source_destroy(
struct nb_cb_destroy_args *args) struct nb_cb_destroy_args *args)
{ {
struct interface *ifp; struct interface *ifp;
struct in_addr source_addr = {INADDR_ANY};
int result; int result;
const struct lyd_node *if_dnode; const struct lyd_node *if_dnode;
@ -2072,7 +2073,7 @@ int lib_interface_pim_address_family_use_source_destroy(
case NB_EV_APPLY: case NB_EV_APPLY:
ifp = nb_running_get_entry(args->dnode, NULL, true); ifp = nb_running_get_entry(args->dnode, NULL, true);
result = interface_pim_use_src_cmd_worker(ifp, source_addr, result = interface_pim_use_src_cmd_worker(ifp, PIMADDR_ANY,
args->errmsg, args->errmsg,
args->errmsg_len); args->errmsg_len);
@ -2180,8 +2181,8 @@ int lib_interface_pim_address_family_mroute_destroy(
struct interface *iif; struct interface *iif;
struct interface *oif; struct interface *oif;
const char *oifname; const char *oifname;
struct ipaddr source_addr; pim_addr source_addr;
struct ipaddr group_addr; pim_addr group_addr;
const struct lyd_node *if_dnode; const struct lyd_node *if_dnode;
switch (args->event) { switch (args->event) {
@ -2211,11 +2212,10 @@ int lib_interface_pim_address_family_mroute_destroy(
return NB_ERR_INCONSISTENCY; return NB_ERR_INCONSISTENCY;
} }
yang_dnode_get_ip(&source_addr, args->dnode, "./source-addr"); yang_dnode_get_pimaddr(&source_addr, args->dnode, "./source-addr");
yang_dnode_get_ip(&group_addr, args->dnode, "./group-addr"); yang_dnode_get_pimaddr(&group_addr, args->dnode, "./group-addr");
if (pim_static_del(pim, iif, oif, group_addr.ip._v4_addr, if (pim_static_del(pim, iif, oif, group_addr, source_addr)) {
source_addr.ip._v4_addr)) {
snprintf(args->errmsg, args->errmsg_len, snprintf(args->errmsg, args->errmsg_len,
"Failed to remove static mroute"); "Failed to remove static mroute");
return NB_ERR_INCONSISTENCY; return NB_ERR_INCONSISTENCY;
@ -2238,8 +2238,8 @@ int lib_interface_pim_address_family_mroute_oif_modify(
struct interface *iif; struct interface *iif;
struct interface *oif; struct interface *oif;
const char *oifname; const char *oifname;
struct ipaddr source_addr; pim_addr source_addr;
struct ipaddr group_addr; pim_addr group_addr;
const struct lyd_node *if_dnode; const struct lyd_node *if_dnode;
switch (args->event) { switch (args->event) {
@ -2288,11 +2288,10 @@ int lib_interface_pim_address_family_mroute_oif_modify(
return NB_ERR_INCONSISTENCY; return NB_ERR_INCONSISTENCY;
} }
yang_dnode_get_ip(&source_addr, args->dnode, "../source-addr"); yang_dnode_get_pimaddr(&source_addr, args->dnode, "../source-addr");
yang_dnode_get_ip(&group_addr, args->dnode, "../group-addr"); yang_dnode_get_pimaddr(&group_addr, args->dnode, "../group-addr");
if (pim_static_add(pim, iif, oif, group_addr.ip._v4_addr, if (pim_static_add(pim, iif, oif, group_addr, source_addr)) {
source_addr.ip._v4_addr)) {
snprintf(args->errmsg, args->errmsg_len, snprintf(args->errmsg, args->errmsg_len,
"Failed to add static mroute"); "Failed to add static mroute");
return NB_ERR_INCONSISTENCY; return NB_ERR_INCONSISTENCY;

View File

@ -361,7 +361,7 @@ bool pim_nht_bsr_rpf_check(struct pim_instance *pim, struct in_addr bsr_addr,
pim_addr nhaddr; pim_addr nhaddr;
switch (nh->type) { switch (nh->type) {
#if PIM_IPV == 4 || !defined(PIM_V6_TEMP_BREAK) #if PIM_IPV == 4
case NEXTHOP_TYPE_IPV4: case NEXTHOP_TYPE_IPV4:
if (nh->ifindex == IFINDEX_INTERNAL) if (nh->ifindex == IFINDEX_INTERNAL)
continue; continue;
@ -605,7 +605,7 @@ static int pim_ecmp_nexthop_search(struct pim_instance *pim,
ifps[i] = ifps[i] =
if_lookup_by_index(nh_node->ifindex, pim->vrf->vrf_id); if_lookup_by_index(nh_node->ifindex, pim->vrf->vrf_id);
if (ifps[i]) { if (ifps[i]) {
#if PIM_IPV == 4 || !defined(PIM_V6_TEMP_BREAK) #if PIM_IPV == 4
pim_addr nhaddr = nh_node->gate.ipv4; pim_addr nhaddr = nh_node->gate.ipv4;
#else #else
pim_addr nhaddr = nh_node->gate.ipv6; pim_addr nhaddr = nh_node->gate.ipv6;
@ -798,7 +798,7 @@ int pim_parse_nexthop_update(ZAPI_CALLBACK_ARGS)
nbr = pim_neighbor_find_if(ifp1); nbr = pim_neighbor_find_if(ifp1);
/* Overwrite with Nbr address as NH addr */ /* Overwrite with Nbr address as NH addr */
if (nbr) if (nbr)
#if PIM_IPV == 4 || !defined(PIM_V6_TEMP_BREAK) #if PIM_IPV == 4
nexthop->gate.ipv4 = nbr->source_addr; nexthop->gate.ipv4 = nbr->source_addr;
#else #else
nexthop->gate.ipv6 = nbr->source_addr; nexthop->gate.ipv6 = nbr->source_addr;

View File

@ -42,15 +42,15 @@ char *pim_channel_oil_dump(struct channel_oil *c_oil, char *buf, size_t size)
pim_sgaddr sg; pim_sgaddr sg;
int i; int i;
sg.src = c_oil->oil.mfcc_origin; sg.src = *oil_origin(c_oil);
sg.grp = c_oil->oil.mfcc_mcastgrp; sg.grp = *oil_mcastgrp(c_oil);
ifp = pim_if_find_by_vif_index(c_oil->pim, c_oil->oil.mfcc_parent); ifp = pim_if_find_by_vif_index(c_oil->pim, *oil_parent(c_oil));
snprintfrr(buf, size, "%pSG IIF: %s, OIFS: ", &sg, snprintfrr(buf, size, "%pSG IIF: %s, OIFS: ", &sg,
ifp ? ifp->name : "(?)"); ifp ? ifp->name : "(?)");
out = buf + strlen(buf); out = buf + strlen(buf);
for (i = 0; i < MAXVIFS; i++) { for (i = 0; i < MAXVIFS; i++) {
if (c_oil->oil.mfcc_ttls[i] != 0) { if (oil_if_has(c_oil, i) != 0) {
ifp = pim_if_find_by_vif_index(c_oil->pim, i); ifp = pim_if_find_by_vif_index(c_oil->pim, i);
snprintf(out, buf + size - out, "%s ", snprintf(out, buf + size - out, "%s ",
ifp ? ifp->name : "(?)"); ifp ? ifp->name : "(?)");
@ -61,25 +61,19 @@ char *pim_channel_oil_dump(struct channel_oil *c_oil, char *buf, size_t size)
return buf; return buf;
} }
int pim_channel_oil_compare(const struct channel_oil *c1, int pim_channel_oil_compare(const struct channel_oil *cc1,
const struct channel_oil *c2) const struct channel_oil *cc2)
{ {
if (ntohl(c1->oil.mfcc_mcastgrp.s_addr) struct channel_oil *c1 = (struct channel_oil *)cc1;
< ntohl(c2->oil.mfcc_mcastgrp.s_addr)) struct channel_oil *c2 = (struct channel_oil *)cc2;
return -1; int rv;
if (ntohl(c1->oil.mfcc_mcastgrp.s_addr)
> ntohl(c2->oil.mfcc_mcastgrp.s_addr))
return 1;
if (ntohl(c1->oil.mfcc_origin.s_addr)
< ntohl(c2->oil.mfcc_origin.s_addr))
return -1;
if (ntohl(c1->oil.mfcc_origin.s_addr)
> ntohl(c2->oil.mfcc_origin.s_addr))
return 1;
rv = pim_addr_cmp(*oil_mcastgrp(c1), *oil_mcastgrp(c2));
if (rv)
return rv;
rv = pim_addr_cmp(*oil_origin(c1), *oil_origin(c2));
if (rv)
return rv;
return 0; return 0;
} }
@ -109,8 +103,8 @@ struct channel_oil *pim_find_channel_oil(struct pim_instance *pim,
struct channel_oil *c_oil = NULL; struct channel_oil *c_oil = NULL;
struct channel_oil lookup; struct channel_oil lookup;
lookup.oil.mfcc_mcastgrp = sg->grp; *oil_mcastgrp(&lookup) = sg->grp;
lookup.oil.mfcc_origin = sg->src; *oil_origin(&lookup) = sg->src;
c_oil = rb_pim_oil_find(&pim->channel_oil_head, &lookup); c_oil = rb_pim_oil_find(&pim->channel_oil_head, &lookup);
@ -151,10 +145,10 @@ struct channel_oil *pim_channel_oil_add(struct pim_instance *pim,
c_oil = XCALLOC(MTYPE_PIM_CHANNEL_OIL, sizeof(*c_oil)); c_oil = XCALLOC(MTYPE_PIM_CHANNEL_OIL, sizeof(*c_oil));
c_oil->oil.mfcc_mcastgrp = sg->grp; *oil_mcastgrp(c_oil) = sg->grp;
c_oil->oil.mfcc_origin = sg->src; *oil_origin(c_oil) = sg->src;
c_oil->oil.mfcc_parent = MAXVIFS; *oil_parent(c_oil) = MAXVIFS;
c_oil->oil_ref_count = 1; c_oil->oil_ref_count = 1;
c_oil->installed = 0; c_oil->installed = 0;
c_oil->up = pim_upstream_find(pim, sg); c_oil->up = pim_upstream_find(pim, sg);
@ -172,8 +166,8 @@ struct channel_oil *pim_channel_oil_del(struct channel_oil *c_oil,
const char *name) const char *name)
{ {
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
pim_sgaddr sg = {.src = c_oil->oil.mfcc_mcastgrp, pim_sgaddr sg = {.src = *oil_mcastgrp(c_oil),
.grp = c_oil->oil.mfcc_origin}; .grp = *oil_origin(c_oil)};
zlog_debug( zlog_debug(
"%s(%s): Del oil for %pSG, Ref Count: %d (Predecrement)", "%s(%s): Del oil for %pSG, Ref Count: %d (Predecrement)",
@ -228,23 +222,15 @@ int pim_channel_del_oif(struct channel_oil *channel_oil, struct interface *oif,
*/ */
if (!(channel_oil->oif_flags[pim_ifp->mroute_vif_index] & proto_mask)) { if (!(channel_oil->oif_flags[pim_ifp->mroute_vif_index] & proto_mask)) {
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<group?>",
channel_oil->oil.mfcc_mcastgrp,
group_str, sizeof(group_str));
pim_inet4_dump("<source?>",
channel_oil->oil.mfcc_origin, source_str,
sizeof(source_str));
zlog_debug( zlog_debug(
"%s %s: no existing protocol mask %u(%u) for requested OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%s,%s)", "%s %s: no existing protocol mask %u(%u) for requested OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%pPAs,%pPAs)",
__FILE__, __func__, proto_mask, __FILE__, __func__, proto_mask,
channel_oil channel_oil
->oif_flags[pim_ifp->mroute_vif_index], ->oif_flags[pim_ifp->mroute_vif_index],
oif->name, pim_ifp->mroute_vif_index, oif->name, pim_ifp->mroute_vif_index,
channel_oil->oil oil_if_has(channel_oil, pim_ifp->mroute_vif_index),
.mfcc_ttls[pim_ifp->mroute_vif_index], oil_origin(channel_oil),
source_str, group_str); oil_mcastgrp(channel_oil));
} }
return 0; return 0;
} }
@ -254,44 +240,29 @@ int pim_channel_del_oif(struct channel_oil *channel_oil, struct interface *oif,
if (channel_oil->oif_flags[pim_ifp->mroute_vif_index] & if (channel_oil->oif_flags[pim_ifp->mroute_vif_index] &
PIM_OIF_FLAG_PROTO_ANY) { PIM_OIF_FLAG_PROTO_ANY) {
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<group?>",
channel_oil->oil.mfcc_mcastgrp,
group_str, sizeof(group_str));
pim_inet4_dump("<source?>",
channel_oil->oil.mfcc_origin, source_str,
sizeof(source_str));
zlog_debug( zlog_debug(
"%s %s: other protocol masks remain for requested OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%s,%s)", "%s %s: other protocol masks remain for requested OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%pPAs,%pPAs)",
__FILE__, __func__, oif->name, __FILE__, __func__, oif->name,
pim_ifp->mroute_vif_index, pim_ifp->mroute_vif_index,
channel_oil->oil oil_if_has(channel_oil, pim_ifp->mroute_vif_index),
.mfcc_ttls[pim_ifp->mroute_vif_index], oil_origin(channel_oil),
source_str, group_str); oil_mcastgrp(channel_oil));
} }
return 0; return 0;
} }
channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = 0; oil_if_set(channel_oil, pim_ifp->mroute_vif_index, false);
/* clear mute; will be re-evaluated when the OIF becomes valid again */ /* clear mute; will be re-evaluated when the OIF becomes valid again */
channel_oil->oif_flags[pim_ifp->mroute_vif_index] &= ~PIM_OIF_FLAG_MUTE; channel_oil->oif_flags[pim_ifp->mroute_vif_index] &= ~PIM_OIF_FLAG_MUTE;
if (pim_upstream_mroute_add(channel_oil, __func__)) { if (pim_upstream_mroute_add(channel_oil, __func__)) {
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<group?>",
channel_oil->oil.mfcc_mcastgrp,
group_str, sizeof(group_str));
pim_inet4_dump("<source?>",
channel_oil->oil.mfcc_origin, source_str,
sizeof(source_str));
zlog_debug( zlog_debug(
"%s %s: could not remove output interface %s (vif_index=%d) for channel (S,G)=(%s,%s)", "%s %s: could not remove output interface %s (vif_index=%d) for channel (S,G)=(%pPAs,%pPAs)",
__FILE__, __func__, oif->name, __FILE__, __func__, oif->name,
pim_ifp->mroute_vif_index, source_str, pim_ifp->mroute_vif_index,
group_str); oil_origin(channel_oil),
oil_mcastgrp(channel_oil));
} }
return -1; return -1;
} }
@ -299,16 +270,12 @@ int pim_channel_del_oif(struct channel_oil *channel_oil, struct interface *oif,
--channel_oil->oil_size; --channel_oil->oil_size;
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp,
group_str, sizeof(group_str));
pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin,
source_str, sizeof(source_str));
zlog_debug( zlog_debug(
"%s(%s): (S,G)=(%s,%s): proto_mask=%u IIF:%d OIF=%s vif_index=%d", "%s(%s): (S,G)=(%pPAs,%pPAs): proto_mask=%u IIF:%d OIF=%s vif_index=%d",
__func__, caller, source_str, group_str, proto_mask, __func__, caller, oil_origin(channel_oil),
channel_oil->oil.mfcc_parent, oif->name, oil_mcastgrp(channel_oil),
proto_mask,
*oil_parent(channel_oil), oif->name,
pim_ifp->mroute_vif_index); pim_ifp->mroute_vif_index);
} }
@ -397,7 +364,7 @@ void pim_channel_update_oif_mute(struct channel_oil *c_oil,
bool new_mute; bool new_mute;
/* If pim_ifp is not a part of the OIL there is nothing to do */ /* If pim_ifp is not a part of the OIL there is nothing to do */
if (!c_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index]) if (!oil_if_has(c_oil, pim_ifp->mroute_vif_index))
return; return;
old_mute = !!(c_oil->oif_flags[pim_ifp->mroute_vif_index] & old_mute = !!(c_oil->oif_flags[pim_ifp->mroute_vif_index] &
@ -455,21 +422,13 @@ int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif,
channel (S,G) multiple times */ channel (S,G) multiple times */
if (channel_oil->oif_flags[pim_ifp->mroute_vif_index] & proto_mask) { if (channel_oil->oif_flags[pim_ifp->mroute_vif_index] & proto_mask) {
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<group?>",
channel_oil->oil.mfcc_mcastgrp,
group_str, sizeof(group_str));
pim_inet4_dump("<source?>",
channel_oil->oil.mfcc_origin, source_str,
sizeof(source_str));
zlog_debug( zlog_debug(
"%s %s: existing protocol mask %u requested OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%s,%s)", "%s %s: existing protocol mask %u requested OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%pPAs,%pPAs)",
__FILE__, __func__, proto_mask, oif->name, __FILE__, __func__, proto_mask, oif->name,
pim_ifp->mroute_vif_index, pim_ifp->mroute_vif_index,
channel_oil->oil oil_if_has(channel_oil, pim_ifp->mroute_vif_index),
.mfcc_ttls[pim_ifp->mroute_vif_index], oil_origin(channel_oil),
source_str, group_str); oil_mcastgrp(channel_oil));
} }
return -3; return -3;
} }
@ -487,36 +446,21 @@ int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif,
channel_oil->oif_flags[pim_ifp->mroute_vif_index] |= proto_mask; channel_oil->oif_flags[pim_ifp->mroute_vif_index] |= proto_mask;
/* Check the OIF really exists before returning, and only log /* Check the OIF really exists before returning, and only log
warning otherwise */ warning otherwise */
if (channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] < 1) { if (oil_if_has(channel_oil, pim_ifp->mroute_vif_index) < 1) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<group?>",
channel_oil->oil.mfcc_mcastgrp,
group_str, sizeof(group_str));
pim_inet4_dump("<source?>",
channel_oil->oil.mfcc_origin, source_str,
sizeof(source_str));
zlog_warn( zlog_warn(
"%s %s: new protocol mask %u requested nonexistent OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%s,%s)", "%s %s: new protocol mask %u requested nonexistent OIF %s (vif_index=%d, min_ttl=%d) for channel (S,G)=(%pPAs,%pPAs)",
__FILE__, __func__, proto_mask, oif->name, __FILE__, __func__, proto_mask, oif->name,
pim_ifp->mroute_vif_index, pim_ifp->mroute_vif_index,
channel_oil->oil oil_if_has(channel_oil, pim_ifp->mroute_vif_index),
.mfcc_ttls[pim_ifp->mroute_vif_index], oil_origin(channel_oil),
source_str, group_str); oil_mcastgrp(channel_oil));
} }
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<group?>",
channel_oil->oil.mfcc_mcastgrp,
group_str, sizeof(group_str));
pim_inet4_dump("<source?>",
channel_oil->oil.mfcc_origin, source_str,
sizeof(source_str));
zlog_debug( zlog_debug(
"%s(%s): (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d added to 0x%x", "%s(%s): (S,G)=(%pPAs,%pPAs): proto_mask=%u OIF=%s vif_index=%d added to 0x%x",
__func__, caller, source_str, group_str, __func__, caller, oil_origin(channel_oil),
oil_mcastgrp(channel_oil),
proto_mask, oif->name, proto_mask, oif->name,
pim_ifp->mroute_vif_index, pim_ifp->mroute_vif_index,
channel_oil channel_oil
@ -525,29 +469,21 @@ int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif,
return 0; return 0;
} }
old_ttl = channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index]; old_ttl = oil_if_has(channel_oil, pim_ifp->mroute_vif_index);
if (old_ttl > 0) { if (old_ttl > 0) {
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<group?>",
channel_oil->oil.mfcc_mcastgrp,
group_str, sizeof(group_str));
pim_inet4_dump("<source?>",
channel_oil->oil.mfcc_origin, source_str,
sizeof(source_str));
zlog_debug( zlog_debug(
"%s %s: interface %s (vif_index=%d) is existing output for channel (S,G)=(%s,%s)", "%s %s: interface %s (vif_index=%d) is existing output for channel (S,G)=(%pPAs,%pPAs)",
__FILE__, __func__, oif->name, __FILE__, __func__, oif->name,
pim_ifp->mroute_vif_index, source_str, pim_ifp->mroute_vif_index,
group_str); oil_origin(channel_oil),
oil_mcastgrp(channel_oil));
} }
return -4; return -4;
} }
channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] = oil_if_set(channel_oil, pim_ifp->mroute_vif_index, PIM_MROUTE_MIN_TTL);
PIM_MROUTE_MIN_TTL;
/* Some OIFs are held in a muted state i.e. the PIM state machine /* Some OIFs are held in a muted state i.e. the PIM state machine
* decided to include the OIF but additional status check such as * decided to include the OIF but additional status check such as
@ -564,26 +500,19 @@ int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif,
/* channel_oil->oil.mfcc_parent != MAXVIFS indicate this entry is not /* channel_oil->oil.mfcc_parent != MAXVIFS indicate this entry is not
* valid to get installed in kernel. * valid to get installed in kernel.
*/ */
if (channel_oil->oil.mfcc_parent != MAXVIFS) { if (*oil_parent(channel_oil) != MAXVIFS) {
if (pim_upstream_mroute_add(channel_oil, __func__)) { if (pim_upstream_mroute_add(channel_oil, __func__)) {
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<group?>",
channel_oil->oil.mfcc_mcastgrp,
group_str, sizeof(group_str));
pim_inet4_dump("<source?>",
channel_oil->oil.mfcc_origin, source_str,
sizeof(source_str));
zlog_debug( zlog_debug(
"%s %s: could not add output interface %s (vif_index=%d) for channel (S,G)=(%s,%s)", "%s %s: could not add output interface %s (vif_index=%d) for channel (S,G)=(%pPAs,%pPAs)",
__FILE__, __func__, oif->name, __FILE__, __func__, oif->name,
pim_ifp->mroute_vif_index, source_str, pim_ifp->mroute_vif_index,
group_str); oil_origin(channel_oil),
oil_mcastgrp(channel_oil));
} }
channel_oil->oil.mfcc_ttls[pim_ifp->mroute_vif_index] oil_if_set(channel_oil, pim_ifp->mroute_vif_index,
= old_ttl; old_ttl);
return -5; return -5;
} }
} }
@ -594,15 +523,11 @@ int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif,
channel_oil->oif_flags[pim_ifp->mroute_vif_index] |= proto_mask; channel_oil->oif_flags[pim_ifp->mroute_vif_index] |= proto_mask;
if (PIM_DEBUG_MROUTE) { if (PIM_DEBUG_MROUTE) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
pim_inet4_dump("<group?>", channel_oil->oil.mfcc_mcastgrp,
group_str, sizeof(group_str));
pim_inet4_dump("<source?>", channel_oil->oil.mfcc_origin,
source_str, sizeof(source_str));
zlog_debug( zlog_debug(
"%s(%s): (S,G)=(%s,%s): proto_mask=%u OIF=%s vif_index=%d: DONE", "%s(%s): (S,G)=(%pPAs,%pPAs): proto_mask=%u OIF=%s vif_index=%d: DONE",
__func__, caller, source_str, group_str, proto_mask, __func__, caller, oil_origin(channel_oil),
oil_mcastgrp(channel_oil),
proto_mask,
oif->name, pim_ifp->mroute_vif_index); oif->name, pim_ifp->mroute_vif_index);
} }
@ -611,8 +536,6 @@ int pim_channel_add_oif(struct channel_oil *channel_oil, struct interface *oif,
int pim_channel_oil_empty(struct channel_oil *c_oil) int pim_channel_oil_empty(struct channel_oil *c_oil)
{ {
static struct mfcctl null_oil;
if (!c_oil) if (!c_oil)
return 1; return 1;
@ -620,6 +543,13 @@ int pim_channel_oil_empty(struct channel_oil *c_oil)
* non-NULL. * non-NULL.
* pimreg device (in all vrfs) uses a vifi of * pimreg device (in all vrfs) uses a vifi of
* 0 (PIM_OIF_PIM_REGISTER_VIF) so we simply mfcc_ttls[0] */ * 0 (PIM_OIF_PIM_REGISTER_VIF) so we simply mfcc_ttls[0] */
#if PIM_IPV == 4
static pim_mfcctl null_oil;
return !memcmp(&c_oil->oil.mfcc_ttls[1], &null_oil.mfcc_ttls[1], return !memcmp(&c_oil->oil.mfcc_ttls[1], &null_oil.mfcc_ttls[1],
sizeof(null_oil.mfcc_ttls) - sizeof(null_oil.mfcc_ttls[0])); sizeof(null_oil.mfcc_ttls) - sizeof(null_oil.mfcc_ttls[0]));
#else
CPP_NOTICE("FIXME STUB");
return false;
#endif
} }

View File

@ -98,7 +98,7 @@ struct channel_oil {
struct rb_pim_oil_item oil_rb; struct rb_pim_oil_item oil_rb;
struct mfcctl oil; pim_mfcctl oil;
int installed; int installed;
int oil_inherited_rescan; int oil_inherited_rescan;
int oil_size; int oil_size;
@ -110,6 +110,61 @@ struct channel_oil {
time_t mroute_creation; time_t mroute_creation;
}; };
#if PIM_IPV == 4
static inline pim_addr *oil_origin(struct channel_oil *c_oil)
{
return &c_oil->oil.mfcc_origin;
}
static inline pim_addr *oil_mcastgrp(struct channel_oil *c_oil)
{
return &c_oil->oil.mfcc_mcastgrp;
}
static inline vifi_t *oil_parent(struct channel_oil *c_oil)
{
return &c_oil->oil.mfcc_parent;
}
static inline uint8_t oil_if_has(struct channel_oil *c_oil, vifi_t ifi)
{
return c_oil->oil.mfcc_ttls[ifi];
}
static inline void oil_if_set(struct channel_oil *c_oil, vifi_t ifi, uint8_t set)
{
c_oil->oil.mfcc_ttls[ifi] = set;
}
#else
static inline pim_addr *oil_origin(struct channel_oil *c_oil)
{
return &c_oil->oil.mf6cc_origin.sin6_addr;
}
static inline pim_addr *oil_mcastgrp(struct channel_oil *c_oil)
{
return &c_oil->oil.mf6cc_mcastgrp.sin6_addr;
}
static inline mifi_t *oil_parent(struct channel_oil *c_oil)
{
return &c_oil->oil.mf6cc_parent;
}
static inline bool oil_if_has(struct channel_oil *c_oil, mifi_t ifi)
{
return !!IF_ISSET(ifi, &c_oil->oil.mf6cc_ifset);
}
static inline void oil_if_set(struct channel_oil *c_oil, mifi_t ifi, bool set)
{
if (set)
IF_SET(ifi, &c_oil->oil.mf6cc_ifset);
else
IF_CLR(ifi, &c_oil->oil.mf6cc_ifset);
}
#endif
extern int pim_channel_oil_compare(const struct channel_oil *c1, extern int pim_channel_oil_compare(const struct channel_oil *c1,
const struct channel_oil *c2); const struct channel_oil *c2);
DECLARE_RBTREE_UNIQ(rb_pim_oil, struct channel_oil, oil_rb, DECLARE_RBTREE_UNIQ(rb_pim_oil, struct channel_oil, oil_rb,

View File

@ -1366,7 +1366,7 @@ void pim_resolve_rp_nh(struct pim_instance *pim, struct pim_neighbor *nbr)
if (nbr->interface != ifp1) if (nbr->interface != ifp1)
continue; continue;
#if PIM_IPV == 4 || !defined(PIM_V6_TEMP_BREAK) #if PIM_IPV == 4
nh_node->gate.ipv4 = nbr->source_addr; nh_node->gate.ipv4 = nbr->source_addr;
#else #else
nh_node->gate.ipv6 = nbr->source_addr; nh_node->gate.ipv6 = nbr->source_addr;

View File

@ -39,7 +39,7 @@
#include "pim_oil.h" #include "pim_oil.h"
#include "pim_mlag.h" #include "pim_mlag.h"
static struct in_addr pim_rpf_find_rpf_addr(struct pim_upstream *up); static pim_addr pim_rpf_find_rpf_addr(struct pim_upstream *up);
void pim_rpf_set_refresh_time(struct pim_instance *pim) void pim_rpf_set_refresh_time(struct pim_instance *pim)
{ {
@ -51,7 +51,7 @@ void pim_rpf_set_refresh_time(struct pim_instance *pim)
} }
bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop, bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
struct in_addr addr, int neighbor_needed) pim_addr addr, int neighbor_needed)
{ {
struct pim_zlookup_nexthop nexthop_tab[MULTIPATH_NUM]; struct pim_zlookup_nexthop nexthop_tab[MULTIPATH_NUM];
struct pim_neighbor *nbr = NULL; struct pim_neighbor *nbr = NULL;
@ -61,6 +61,7 @@ bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
int found = 0; int found = 0;
int i = 0; int i = 0;
#if PIM_IPV == 4
/* /*
* We should not attempt to lookup a * We should not attempt to lookup a
* 255.255.255.255 address, since * 255.255.255.255 address, since
@ -68,33 +69,27 @@ bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
*/ */
if (addr.s_addr == INADDR_NONE) if (addr.s_addr == INADDR_NONE)
return false; return false;
#endif
if ((nexthop->last_lookup.s_addr == addr.s_addr) if (!pim_addr_cmp(nexthop->last_lookup, addr)
&& (nexthop->last_lookup_time > pim->last_route_change_time)) { && (nexthop->last_lookup_time > pim->last_route_change_time)) {
if (PIM_DEBUG_PIM_NHT) { if (PIM_DEBUG_PIM_NHT) {
char addr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<addr?>", addr, addr_str,
sizeof(addr_str));
char nexthop_str[PREFIX_STRLEN]; char nexthop_str[PREFIX_STRLEN];
pim_addr_dump("<nexthop?>", &nexthop->mrib_nexthop_addr, pim_addr_dump("<nexthop?>", &nexthop->mrib_nexthop_addr,
nexthop_str, sizeof(nexthop_str)); nexthop_str, sizeof(nexthop_str));
zlog_debug( zlog_debug(
"%s: Using last lookup for %s at %lld, %" PRId64" addr %s", "%s: Using last lookup for %pPAs at %lld, %" PRId64" addr %s",
__func__, addr_str, nexthop->last_lookup_time, __func__, &addr, nexthop->last_lookup_time,
pim->last_route_change_time, nexthop_str); pim->last_route_change_time, nexthop_str);
} }
pim->nexthop_lookups_avoided++; pim->nexthop_lookups_avoided++;
return true; return true;
} else { } else {
if (PIM_DEBUG_PIM_NHT) { if (PIM_DEBUG_PIM_NHT)
char addr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<addr?>", addr, addr_str,
sizeof(addr_str));
zlog_debug( zlog_debug(
"%s: Looking up: %s, last lookup time: %lld, %" PRId64, "%s: Looking up: %pPAs, last lookup time: %lld, %" PRId64,
__func__, addr_str, nexthop->last_lookup_time, __func__, &addr, nexthop->last_lookup_time,
pim->last_route_change_time); pim->last_route_change_time);
}
} }
memset(nexthop_tab, 0, memset(nexthop_tab, 0,
@ -102,11 +97,9 @@ bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
num_ifindex = zclient_lookup_nexthop(pim, nexthop_tab, MULTIPATH_NUM, num_ifindex = zclient_lookup_nexthop(pim, nexthop_tab, MULTIPATH_NUM,
addr, PIM_NEXTHOP_LOOKUP_MAX); addr, PIM_NEXTHOP_LOOKUP_MAX);
if (num_ifindex < 1) { if (num_ifindex < 1) {
char addr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<addr?>", addr, addr_str, sizeof(addr_str));
zlog_warn( zlog_warn(
"%s %s: could not find nexthop ifindex for address %s", "%s %s: could not find nexthop ifindex for address %pPAs",
__FILE__, __func__, addr_str); __FILE__, __func__, &addr);
return false; return false;
} }
@ -115,29 +108,21 @@ bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
ifp = if_lookup_by_index(first_ifindex, pim->vrf->vrf_id); ifp = if_lookup_by_index(first_ifindex, pim->vrf->vrf_id);
if (!ifp) { if (!ifp) {
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA)
char addr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<addr?>", addr, addr_str,
sizeof(addr_str));
zlog_debug( zlog_debug(
"%s %s: could not find interface for ifindex %d (address %s)", "%s %s: could not find interface for ifindex %d (address %pPAs)",
__FILE__, __func__, first_ifindex, __FILE__, __func__, first_ifindex,
addr_str); &addr);
}
i++; i++;
continue; continue;
} }
if (!ifp->info) { if (!ifp->info) {
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA)
char addr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<addr?>", addr, addr_str,
sizeof(addr_str));
zlog_debug( zlog_debug(
"%s: multicast not enabled on input interface %s (ifindex=%d, RPF for source %s)", "%s: multicast not enabled on input interface %s (ifindex=%d, RPF for source %pPAs)",
__func__, ifp->name, first_ifindex, __func__, ifp->name, first_ifindex,
addr_str); &addr);
}
i++; i++;
} else if (neighbor_needed } else if (neighbor_needed
&& !pim_if_connected_to_source(ifp, addr)) { && !pim_if_connected_to_source(ifp, addr)) {
@ -157,15 +142,12 @@ bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
if (found) { if (found) {
if (PIM_DEBUG_ZEBRA) { if (PIM_DEBUG_ZEBRA) {
char nexthop_str[PREFIX_STRLEN]; char nexthop_str[PREFIX_STRLEN];
char addr_str[INET_ADDRSTRLEN];
pim_addr_dump("<nexthop?>", pim_addr_dump("<nexthop?>",
&nexthop_tab[i].nexthop_addr, nexthop_str, &nexthop_tab[i].nexthop_addr, nexthop_str,
sizeof(nexthop_str)); sizeof(nexthop_str));
pim_inet4_dump("<addr?>", addr, addr_str,
sizeof(addr_str));
zlog_debug( zlog_debug(
"%s %s: found nexthop %s for address %s: interface %s ifindex=%d metric=%d pref=%d", "%s %s: found nexthop %s for address %pPAs: interface %s ifindex=%d metric=%d pref=%d",
__FILE__, __func__, nexthop_str, addr_str, __FILE__, __func__, nexthop_str, &addr,
ifp->name, first_ifindex, ifp->name, first_ifindex,
nexthop_tab[i].route_metric, nexthop_tab[i].route_metric,
nexthop_tab[i].protocol_distance); nexthop_tab[i].protocol_distance);
@ -230,6 +212,7 @@ enum pim_rpf_result pim_rpf_update(struct pim_instance *pim,
struct prefix src, grp; struct prefix src, grp;
bool neigh_needed = true; bool neigh_needed = true;
uint32_t saved_mrib_route_metric; uint32_t saved_mrib_route_metric;
pim_addr rpf_addr;
if (PIM_UPSTREAM_FLAG_TEST_STATIC_IIF(up->flags)) if (PIM_UPSTREAM_FLAG_TEST_STATIC_IIF(up->flags))
return PIM_RPF_OK; return PIM_RPF_OK;
@ -265,8 +248,9 @@ enum pim_rpf_result pim_rpf_update(struct pim_instance *pim,
return PIM_RPF_FAILURE; return PIM_RPF_FAILURE;
} }
rpf->rpf_addr.family = AF_INET; rpf_addr = pim_rpf_find_rpf_addr(up);
rpf->rpf_addr.u.prefix4 = pim_rpf_find_rpf_addr(up); pim_addr_to_prefix(&rpf->rpf_addr, rpf_addr);
if (pim_rpf_addr_is_inaddr_any(rpf) && PIM_DEBUG_ZEBRA) { if (pim_rpf_addr_is_inaddr_any(rpf) && PIM_DEBUG_ZEBRA) {
/* RPF'(S,G) not found */ /* RPF'(S,G) not found */
zlog_debug("%s(%s): RPF'%s not found: won't send join upstream", zlog_debug("%s(%s): RPF'%s not found: won't send join upstream",
@ -369,18 +353,17 @@ void pim_upstream_rpf_clear(struct pim_instance *pim,
packets should be coming and to which joins should be sent on the RP packets should be coming and to which joins should be sent on the RP
tree and SPT, respectively. tree and SPT, respectively.
*/ */
static struct in_addr pim_rpf_find_rpf_addr(struct pim_upstream *up) static pim_addr pim_rpf_find_rpf_addr(struct pim_upstream *up)
{ {
struct pim_ifchannel *rpf_ch; struct pim_ifchannel *rpf_ch;
struct pim_neighbor *neigh; struct pim_neighbor *neigh;
struct in_addr rpf_addr; pim_addr rpf_addr;
if (!up->rpf.source_nexthop.interface) { if (!up->rpf.source_nexthop.interface) {
zlog_warn("%s: missing RPF interface for upstream (S,G)=%s", zlog_warn("%s: missing RPF interface for upstream (S,G)=%s",
__func__, up->sg_str); __func__, up->sg_str);
rpf_addr.s_addr = PIM_NET_INADDR_ANY; return PIMADDR_ANY;
return rpf_addr;
} }
rpf_ch = pim_ifchannel_find(up->rpf.source_nexthop.interface, &up->sg); rpf_ch = pim_ifchannel_find(up->rpf.source_nexthop.interface, &up->sg);
@ -400,7 +383,7 @@ static struct in_addr pim_rpf_find_rpf_addr(struct pim_upstream *up)
if (neigh) if (neigh)
rpf_addr = neigh->source_addr; rpf_addr = neigh->source_addr;
else else
rpf_addr.s_addr = PIM_NET_INADDR_ANY; rpf_addr = PIMADDR_ANY;
return rpf_addr; return rpf_addr;
} }

View File

@ -58,7 +58,7 @@ unsigned int pim_rpf_hash_key(const void *arg);
bool pim_rpf_equal(const void *arg1, const void *arg2); bool pim_rpf_equal(const void *arg1, const void *arg2);
bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop, bool pim_nexthop_lookup(struct pim_instance *pim, struct pim_nexthop *nexthop,
struct in_addr addr, int neighbor_needed); pim_addr addr, int neighbor_needed);
enum pim_rpf_result pim_rpf_update(struct pim_instance *pim, enum pim_rpf_result pim_rpf_update(struct pim_instance *pim,
struct pim_upstream *up, struct pim_upstream *up,
struct pim_rpf *old, const char *caller); struct pim_rpf *old, const char *caller);

View File

@ -32,6 +32,7 @@
static void pim_ssm_range_reevaluate(struct pim_instance *pim) static void pim_ssm_range_reevaluate(struct pim_instance *pim)
{ {
#if PIM_IPV == 4
/* 1. Setup register state for (S,G) entries if G has changed from SSM /* 1. Setup register state for (S,G) entries if G has changed from SSM
* to * to
* ASM. * ASM.
@ -50,6 +51,7 @@ static void pim_ssm_range_reevaluate(struct pim_instance *pim)
*/ */
pim_upstream_register_reevaluate(pim); pim_upstream_register_reevaluate(pim);
igmp_source_forward_reevaluate_all(pim); igmp_source_forward_reevaluate_all(pim);
#endif
} }
void pim_ssm_prefix_list_update(struct pim_instance *pim, void pim_ssm_prefix_list_update(struct pim_instance *pim,

View File

@ -43,8 +43,8 @@ static struct static_route *static_route_alloc(void)
} }
static struct static_route *static_route_new(ifindex_t iif, ifindex_t oif, static struct static_route *static_route_new(ifindex_t iif, ifindex_t oif,
struct in_addr group, pim_addr group,
struct in_addr source) pim_addr source)
{ {
struct static_route *s_route; struct static_route *s_route;
s_route = static_route_alloc(); s_route = static_route_alloc();
@ -54,10 +54,10 @@ static struct static_route *static_route_new(ifindex_t iif, ifindex_t oif,
s_route->iif = iif; s_route->iif = iif;
s_route->oif_ttls[oif] = 1; s_route->oif_ttls[oif] = 1;
s_route->c_oil.oil_ref_count = 1; s_route->c_oil.oil_ref_count = 1;
s_route->c_oil.oil.mfcc_origin = source; *oil_origin(&s_route->c_oil) = source;
s_route->c_oil.oil.mfcc_mcastgrp = group; *oil_mcastgrp(&s_route->c_oil) = group;
s_route->c_oil.oil.mfcc_parent = iif; *oil_parent(&s_route->c_oil) = iif;
s_route->c_oil.oil.mfcc_ttls[oif] = 1; oil_if_set(&s_route->c_oil, oif, 1);
s_route->c_oil.oif_creation[oif] = pim_time_monotonic_sec(); s_route->c_oil.oif_creation[oif] = pim_time_monotonic_sec();
return s_route; return s_route;
@ -65,8 +65,7 @@ static struct static_route *static_route_new(ifindex_t iif, ifindex_t oif,
int pim_static_add(struct pim_instance *pim, struct interface *iif, int pim_static_add(struct pim_instance *pim, struct interface *iif,
struct interface *oif, struct in_addr group, struct interface *oif, pim_addr group, pim_addr source)
struct in_addr source)
{ {
struct listnode *node = NULL; struct listnode *node = NULL;
struct static_route *s_route = NULL; struct static_route *s_route = NULL;
@ -97,20 +96,14 @@ int pim_static_add(struct pim_instance *pim, struct interface *iif,
} }
for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, s_route)) { for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, s_route)) {
if (s_route->group.s_addr == group.s_addr if (!pim_addr_cmp(s_route->group, group)
&& s_route->source.s_addr == source.s_addr) { && !pim_addr_cmp(s_route->source, source)) {
if (s_route->iif == iif_index if (s_route->iif == iif_index
&& s_route->oif_ttls[oif_index]) { && s_route->oif_ttls[oif_index]) {
char gifaddr_str[INET_ADDRSTRLEN];
char sifaddr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<ifaddr?>", group, gifaddr_str,
sizeof(gifaddr_str));
pim_inet4_dump("<ifaddr?>", source, sifaddr_str,
sizeof(sifaddr_str));
zlog_warn( zlog_warn(
"%s %s: Unable to add static route: Route already exists (iif=%d,oif=%d,group=%s,source=%s)", "%s %s: Unable to add static route: Route already exists (iif=%d,oif=%d,group=%pPAs,source=%pPAs)",
__FILE__, __func__, iif_index, __FILE__, __func__, iif_index,
oif_index, gifaddr_str, sifaddr_str); oif_index, &group, &source);
return -3; return -3;
} }
@ -130,7 +123,7 @@ int pim_static_add(struct pim_instance *pim, struct interface *iif,
* adding a new output interface */ * adding a new output interface */
if (s_route->iif == iif_index) { if (s_route->iif == iif_index) {
s_route->oif_ttls[oif_index] = 1; s_route->oif_ttls[oif_index] = 1;
s_route->c_oil.oil.mfcc_ttls[oif_index] = 1; oil_if_set(&s_route->c_oil, oif_index, 1);
s_route->c_oil.oif_creation[oif_index] = s_route->c_oil.oif_creation[oif_index] =
pim_time_monotonic_sec(); pim_time_monotonic_sec();
++s_route->c_oil.oil_ref_count; ++s_route->c_oil.oil_ref_count;
@ -147,8 +140,8 @@ int pim_static_add(struct pim_instance *pim, struct interface *iif,
s_route->oif_ttls[iif_index] = 0; s_route->oif_ttls[iif_index] = 0;
s_route->c_oil.oif_creation[iif_index] = s_route->c_oil.oif_creation[iif_index] =
0; 0;
s_route->c_oil.oil oil_if_set(&s_route->c_oil, iif_index,
.mfcc_ttls[iif_index] = 0; 0);
--s_route->c_oil.oil_ref_count; --s_route->c_oil.oil_ref_count;
} }
#endif #endif
@ -158,8 +151,8 @@ int pim_static_add(struct pim_instance *pim, struct interface *iif,
s_route->oif_ttls[oif_index] = 1; s_route->oif_ttls[oif_index] = 1;
s_route->c_oil.oif_creation[oif_index] = s_route->c_oil.oif_creation[oif_index] =
pim_time_monotonic_sec(); pim_time_monotonic_sec();
s_route->c_oil.oil oil_if_set(&s_route->c_oil, oif_index,
.mfcc_ttls[oif_index] = 1; 1);
++s_route->c_oil.oil_ref_count; ++s_route->c_oil.oil_ref_count;
} }
} }
@ -178,16 +171,10 @@ int pim_static_add(struct pim_instance *pim, struct interface *iif,
s_route->c_oil.pim = pim; s_route->c_oil.pim = pim;
if (pim_static_mroute_add(&s_route->c_oil, __func__)) { if (pim_static_mroute_add(&s_route->c_oil, __func__)) {
char gifaddr_str[INET_ADDRSTRLEN];
char sifaddr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<ifaddr?>", group, gifaddr_str,
sizeof(gifaddr_str));
pim_inet4_dump("<ifaddr?>", source, sifaddr_str,
sizeof(sifaddr_str));
zlog_warn( zlog_warn(
"%s %s: Unable to add static route(iif=%d,oif=%d,group=%s,source=%s)", "%s %s: Unable to add static route(iif=%d,oif=%d,group=%pPAs,source=%pPAs)",
__FILE__, __func__, iif_index, oif_index, gifaddr_str, __FILE__, __func__, iif_index, oif_index, &group,
sifaddr_str); &source);
/* Need to put s_route back to the way it was */ /* Need to put s_route back to the way it was */
if (original_s_route) { if (original_s_route) {
@ -213,24 +200,17 @@ int pim_static_add(struct pim_instance *pim, struct interface *iif,
} }
if (PIM_DEBUG_STATIC) { if (PIM_DEBUG_STATIC) {
char gifaddr_str[INET_ADDRSTRLEN];
char sifaddr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<ifaddr?>", group, gifaddr_str,
sizeof(gifaddr_str));
pim_inet4_dump("<ifaddr?>", source, sifaddr_str,
sizeof(sifaddr_str));
zlog_debug( zlog_debug(
"%s: Static route added(iif=%d,oif=%d,group=%s,source=%s)", "%s: Static route added(iif=%d,oif=%d,group=%pPAs,source=%pPAs)",
__func__, iif_index, oif_index, gifaddr_str, __func__, iif_index, oif_index, &group,
sifaddr_str); &source);
} }
return 0; return 0;
} }
int pim_static_del(struct pim_instance *pim, struct interface *iif, int pim_static_del(struct pim_instance *pim, struct interface *iif,
struct interface *oif, struct in_addr group, struct interface *oif, pim_addr group, pim_addr source)
struct in_addr source)
{ {
struct listnode *node = NULL; struct listnode *node = NULL;
struct listnode *nextnode = NULL; struct listnode *nextnode = NULL;
@ -249,11 +229,11 @@ int pim_static_del(struct pim_instance *pim, struct interface *iif,
for (ALL_LIST_ELEMENTS(pim->static_routes, node, nextnode, s_route)) { for (ALL_LIST_ELEMENTS(pim->static_routes, node, nextnode, s_route)) {
if (s_route->iif == iif_index if (s_route->iif == iif_index
&& s_route->group.s_addr == group.s_addr && !pim_addr_cmp(s_route->group, group)
&& s_route->source.s_addr == source.s_addr && !pim_addr_cmp(s_route->source, source)
&& s_route->oif_ttls[oif_index]) { && s_route->oif_ttls[oif_index]) {
s_route->oif_ttls[oif_index] = 0; s_route->oif_ttls[oif_index] = 0;
s_route->c_oil.oil.mfcc_ttls[oif_index] = 0; oil_if_set(&s_route->c_oil, oif_index, 0);
--s_route->c_oil.oil_ref_count; --s_route->c_oil.oil_ref_count;
/* If there are no more outputs then delete the whole /* If there are no more outputs then delete the whole
@ -263,19 +243,13 @@ int pim_static_del(struct pim_instance *pim, struct interface *iif,
? pim_mroute_del(&s_route->c_oil, __func__) ? pim_mroute_del(&s_route->c_oil, __func__)
: pim_static_mroute_add(&s_route->c_oil, : pim_static_mroute_add(&s_route->c_oil,
__func__)) { __func__)) {
char gifaddr_str[INET_ADDRSTRLEN];
char sifaddr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<ifaddr?>", group, gifaddr_str,
sizeof(gifaddr_str));
pim_inet4_dump("<ifaddr?>", source, sifaddr_str,
sizeof(sifaddr_str));
zlog_warn( zlog_warn(
"%s %s: Unable to remove static route(iif=%d,oif=%d,group=%s,source=%s)", "%s %s: Unable to remove static route(iif=%d,oif=%d,group=%pPAs,source=%pPAs)",
__FILE__, __func__, iif_index, __FILE__, __func__, iif_index,
oif_index, gifaddr_str, sifaddr_str); oif_index, &group, &source);
s_route->oif_ttls[oif_index] = 1; s_route->oif_ttls[oif_index] = 1;
s_route->c_oil.oil.mfcc_ttls[oif_index] = 1; oil_if_set(&s_route->c_oil, oif_index, 1);
++s_route->c_oil.oil_ref_count; ++s_route->c_oil.oil_ref_count;
return -1; return -1;
@ -289,16 +263,10 @@ int pim_static_del(struct pim_instance *pim, struct interface *iif,
} }
if (PIM_DEBUG_STATIC) { if (PIM_DEBUG_STATIC) {
char gifaddr_str[INET_ADDRSTRLEN];
char sifaddr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<ifaddr?>", group, gifaddr_str,
sizeof(gifaddr_str));
pim_inet4_dump("<ifaddr?>", source, sifaddr_str,
sizeof(sifaddr_str));
zlog_debug( zlog_debug(
"%s: Static route removed(iif=%d,oif=%d,group=%s,source=%s)", "%s: Static route removed(iif=%d,oif=%d,group=%pPAs,source=%pPAs)",
__func__, iif_index, oif_index, __func__, iif_index, oif_index,
gifaddr_str, sifaddr_str); &group, &source);
} }
break; break;
@ -306,16 +274,10 @@ int pim_static_del(struct pim_instance *pim, struct interface *iif,
} }
if (!node) { if (!node) {
char gifaddr_str[INET_ADDRSTRLEN];
char sifaddr_str[INET_ADDRSTRLEN];
pim_inet4_dump("<ifaddr?>", group, gifaddr_str,
sizeof(gifaddr_str));
pim_inet4_dump("<ifaddr?>", source, sifaddr_str,
sizeof(sifaddr_str));
zlog_warn( zlog_warn(
"%s %s: Unable to remove static route: Route does not exist(iif=%d,oif=%d,group=%s,source=%s)", "%s %s: Unable to remove static route: Route does not exist(iif=%d,oif=%d,group=%pPAs,source=%pPAs)",
__FILE__, __func__, iif_index, oif_index, gifaddr_str, __FILE__, __func__, iif_index, oif_index, &group,
sifaddr_str); &source);
return -3; return -3;
} }
@ -329,15 +291,11 @@ int pim_static_write_mroute(struct pim_instance *pim, struct vty *vty,
struct listnode *node; struct listnode *node;
struct static_route *sroute; struct static_route *sroute;
int count = 0; int count = 0;
char sbuf[INET_ADDRSTRLEN];
char gbuf[INET_ADDRSTRLEN];
if (!pim_ifp) if (!pim_ifp)
return 0; return 0;
for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, sroute)) { for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, sroute)) {
pim_inet4_dump("<ifaddr?>", sroute->group, gbuf, sizeof(gbuf));
pim_inet4_dump("<ifaddr?>", sroute->source, sbuf, sizeof(sbuf));
if (sroute->iif == pim_ifp->mroute_vif_index) { if (sroute->iif == pim_ifp->mroute_vif_index) {
int i; int i;
for (i = 0; i < MAXVIFS; i++) for (i = 0; i < MAXVIFS; i++)
@ -345,14 +303,15 @@ int pim_static_write_mroute(struct pim_instance *pim, struct vty *vty,
struct interface *oifp = struct interface *oifp =
pim_if_find_by_vif_index(pim, pim_if_find_by_vif_index(pim,
i); i);
if (sroute->source.s_addr == INADDR_ANY) if (pim_addr_is_any(sroute->source))
vty_out(vty, vty_out(vty,
" ip mroute %s %s\n", " ip mroute %s %pPA\n",
oifp->name, gbuf); oifp->name, &sroute->group);
else else
vty_out(vty, vty_out(vty,
" ip mroute %s %s %s\n", " ip mroute %s %pPA %pPA\n",
oifp->name, gbuf, sbuf); oifp->name, &sroute->group,
&sroute->source);
count++; count++;
} }
} }

View File

@ -26,8 +26,8 @@
struct static_route { struct static_route {
/* Each static route is unique by these pair of addresses */ /* Each static route is unique by these pair of addresses */
struct in_addr group; pim_addr group;
struct in_addr source; pim_addr source;
struct channel_oil c_oil; struct channel_oil c_oil;
ifindex_t iif; ifindex_t iif;
@ -37,11 +37,9 @@ struct static_route {
void pim_static_route_free(struct static_route *s_route); void pim_static_route_free(struct static_route *s_route);
int pim_static_add(struct pim_instance *pim, struct interface *iif, int pim_static_add(struct pim_instance *pim, struct interface *iif,
struct interface *oif, struct in_addr group, struct interface *oif, pim_addr group, pim_addr source);
struct in_addr source);
int pim_static_del(struct pim_instance *pim, struct interface *iif, int pim_static_del(struct pim_instance *pim, struct interface *iif,
struct interface *oif, struct in_addr group, struct interface *oif, pim_addr group, pim_addr source);
struct in_addr source);
int pim_static_write_mroute(struct pim_instance *pim, struct vty *vty, int pim_static_write_mroute(struct pim_instance *pim, struct vty *vty,
struct interface *ifp); struct interface *ifp);

View File

@ -1261,7 +1261,7 @@ void pim_upstream_update_join_desired(struct pim_instance *pim,
it so that it expires after t_override seconds. it so that it expires after t_override seconds.
*/ */
void pim_upstream_rpf_genid_changed(struct pim_instance *pim, void pim_upstream_rpf_genid_changed(struct pim_instance *pim,
struct in_addr neigh_addr) pim_addr neigh_addr)
{ {
struct pim_upstream *up; struct pim_upstream *up;
@ -1269,24 +1269,24 @@ void pim_upstream_rpf_genid_changed(struct pim_instance *pim,
* Scan all (S,G) upstreams searching for RPF'(S,G)=neigh_addr * Scan all (S,G) upstreams searching for RPF'(S,G)=neigh_addr
*/ */
frr_each (rb_pim_upstream, &pim->upstream_head, up) { frr_each (rb_pim_upstream, &pim->upstream_head, up) {
if (PIM_DEBUG_PIM_TRACE) { pim_addr rpf_addr;
char rpf_addr_str[PREFIX_STRLEN];
pim_addr_dump("<rpf?>", &up->rpf.rpf_addr, rpf_addr_str, rpf_addr = pim_addr_from_prefix(&up->rpf.rpf_addr);
sizeof(rpf_addr_str));
if (PIM_DEBUG_PIM_TRACE)
zlog_debug( zlog_debug(
"%s: matching neigh=%pI4 against upstream (S,G)=%s[%s] joined=%d rpf_addr=%s", "%s: matching neigh=%pPA against upstream (S,G)=%s[%s] joined=%d rpf_addr=%pPA",
__func__, &neigh_addr, up->sg_str, __func__, &neigh_addr, up->sg_str,
pim->vrf->name, pim->vrf->name,
up->join_state == PIM_UPSTREAM_JOINED, up->join_state == PIM_UPSTREAM_JOINED,
rpf_addr_str); &rpf_addr);
}
/* consider only (S,G) upstream in Joined state */ /* consider only (S,G) upstream in Joined state */
if (up->join_state != PIM_UPSTREAM_JOINED) if (up->join_state != PIM_UPSTREAM_JOINED)
continue; continue;
/* match RPF'(S,G)=neigh_addr */ /* match RPF'(S,G)=neigh_addr */
if (up->rpf.rpf_addr.u.prefix4.s_addr != neigh_addr.s_addr) if (pim_addr_cmp(rpf_addr, neigh_addr))
continue; continue;
pim_upstream_join_timer_decrease_to_t_override( pim_upstream_join_timer_decrease_to_t_override(
@ -1992,7 +1992,7 @@ static bool pim_upstream_kat_start_ok(struct pim_upstream *up)
return false; return false;
pim_ifp = ifp->info; pim_ifp = ifp->info;
if (pim_ifp->mroute_vif_index != c_oil->oil.mfcc_parent) if (pim_ifp->mroute_vif_index != *oil_parent(c_oil))
return false; return false;
if (pim_if_connected_to_source(up->rpf.source_nexthop.interface, if (pim_if_connected_to_source(up->rpf.source_nexthop.interface,

View File

@ -326,7 +326,7 @@ void pim_upstream_join_timer_decrease_to_t_override(const char *debug_label,
void pim_upstream_join_timer_restart(struct pim_upstream *up, void pim_upstream_join_timer_restart(struct pim_upstream *up,
struct pim_rpf *old); struct pim_rpf *old);
void pim_upstream_rpf_genid_changed(struct pim_instance *pim, void pim_upstream_rpf_genid_changed(struct pim_instance *pim,
struct in_addr neigh_addr); pim_addr neigh_addr);
void pim_upstream_rpf_interface_changed(struct pim_upstream *up, void pim_upstream_rpf_interface_changed(struct pim_upstream *up,
struct interface *old_rpf_ifp); struct interface *old_rpf_ifp);

View File

@ -397,6 +397,7 @@ int pim_interface_config_write(struct vty *vty)
++writes; ++writes;
} }
#if PIM_IPV == 4
/* IF ip igmp join */ /* IF ip igmp join */
if (pim_ifp->gm_join_list) { if (pim_ifp->gm_join_list) {
struct listnode *node; struct listnode *node;
@ -428,6 +429,7 @@ int pim_interface_config_write(struct vty *vty)
++writes; ++writes;
} }
} }
#endif /* PIM_IPV == 4 */
if (pim_ifp->activeactive) if (pim_ifp->activeactive)
vty_out(vty, " ip pim active-active\n"); vty_out(vty, " ip pim active-active\n");

View File

@ -55,6 +55,7 @@ struct zclient *zclient;
/* Router-id update message from zebra. */ /* Router-id update message from zebra. */
__attribute__((unused))
static int pim_router_id_update_zebra(ZAPI_CALLBACK_ARGS) static int pim_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
{ {
struct prefix router_id; struct prefix router_id;
@ -64,6 +65,7 @@ static int pim_router_id_update_zebra(ZAPI_CALLBACK_ARGS)
return 0; return 0;
} }
__attribute__((unused))
static int pim_zebra_interface_vrf_update(ZAPI_CALLBACK_ARGS) static int pim_zebra_interface_vrf_update(ZAPI_CALLBACK_ARGS)
{ {
struct interface *ifp; struct interface *ifp;
@ -112,7 +114,6 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
struct connected *c; struct connected *c;
struct prefix *p; struct prefix *p;
struct pim_interface *pim_ifp; struct pim_interface *pim_ifp;
struct pim_instance *pim;
/* /*
zebra api notifies address adds/dels events by using the same call zebra api notifies address adds/dels events by using the same call
@ -141,6 +142,7 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
#endif #endif
} }
#if PIM_IPV == 4
if (p->family != PIM_AF) if (p->family != PIM_AF)
SET_FLAG(c->flags, ZEBRA_IFA_SECONDARY); SET_FLAG(c->flags, ZEBRA_IFA_SECONDARY);
else if (!CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)) { else if (!CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)) {
@ -159,6 +161,8 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
pim_if_addr_add(c); pim_if_addr_add(c);
if (pim_ifp) { if (pim_ifp) {
struct pim_instance *pim;
pim = pim_get_pim_instance(vrf_id); pim = pim_get_pim_instance(vrf_id);
pim_ifp->pim = pim; pim_ifp->pim = pim;
@ -174,7 +178,10 @@ static int pim_zebra_if_address_add(ZAPI_CALLBACK_ARGS)
pim_if_addr_add_all(ifp); pim_if_addr_add_all(ifp);
} }
} }
#else /* PIM_IPV != 4 */
/* unused - for now */
(void)pim_ifp;
#endif
return 0; return 0;
} }
@ -183,11 +190,9 @@ static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS)
struct connected *c; struct connected *c;
struct prefix *p; struct prefix *p;
struct vrf *vrf = vrf_lookup_by_id(vrf_id); struct vrf *vrf = vrf_lookup_by_id(vrf_id);
struct pim_instance *pim;
if (!vrf) if (!vrf)
return 0; return 0;
pim = vrf->info;
/* /*
zebra api notifies address adds/dels events by using the same call zebra api notifies address adds/dels events by using the same call
@ -202,24 +207,29 @@ static int pim_zebra_if_address_del(ZAPI_CALLBACK_ARGS)
return 0; return 0;
p = c->address; p = c->address;
if (p->family == AF_INET) {
if (PIM_DEBUG_ZEBRA) {
zlog_debug(
"%s: %s(%u) disconnected IP address %pFX flags %u %s",
__func__, c->ifp->name, vrf_id, p, c->flags,
CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
? "secondary"
: "primary");
if (PIM_DEBUG_ZEBRA) {
zlog_debug(
"%s: %s(%u) disconnected IP address %pFX flags %u %s",
__func__, c->ifp->name, vrf_id, p, c->flags,
CHECK_FLAG(c->flags, ZEBRA_IFA_SECONDARY)
? "secondary"
: "primary");
#ifdef PIM_DEBUG_IFADDR_DUMP #ifdef PIM_DEBUG_IFADDR_DUMP
dump_if_address(c->ifp); dump_if_address(c->ifp);
#endif #endif
} }
#if PIM_IPV == 4
if (p->family == AF_INET) {
struct pim_instance *pim;
pim = vrf->info;
pim_if_addr_del(c, 0); pim_if_addr_del(c, 0);
pim_rp_setup(pim); pim_rp_setup(pim);
pim_i_am_rp_re_evaluate(pim); pim_i_am_rp_re_evaluate(pim);
} }
#endif
connected_free(&c); connected_free(&c);
return 0; return 0;
@ -242,7 +252,7 @@ void pim_zebra_update_all_interfaces(struct pim_instance *pim)
struct pim_rpf rpf; struct pim_rpf rpf;
rpf.source_nexthop.interface = ifp; rpf.source_nexthop.interface = ifp;
rpf.rpf_addr.u.prefix4 = us->address; pim_addr_to_prefix(&rpf.rpf_addr, us->address);
pim_joinprune_send(&rpf, us->us); pim_joinprune_send(&rpf, us->us);
pim_jp_agg_clear_group(us->us); pim_jp_agg_clear_group(us->us);
} }
@ -325,6 +335,7 @@ void pim_zebra_upstream_rpf_changed(struct pim_instance *pim,
pim_upstream_update_join_desired(pim, up); pim_upstream_update_join_desired(pim, up);
} }
__attribute__((unused))
static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS) static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS)
{ {
struct stream *s; struct stream *s;
@ -354,6 +365,7 @@ static int pim_zebra_vxlan_sg_proc(ZAPI_CALLBACK_ARGS)
return 0; return 0;
} }
__attribute__((unused))
static void pim_zebra_vxlan_replay(void) static void pim_zebra_vxlan_replay(void)
{ {
struct stream *s = NULL; struct stream *s = NULL;
@ -421,13 +433,17 @@ void sched_rpf_cache_refresh(struct pim_instance *pim)
static void pim_zebra_connected(struct zclient *zclient) static void pim_zebra_connected(struct zclient *zclient)
{ {
#if PIM_IPV == 4
/* Send the client registration */ /* Send the client registration */
bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, router->vrf_id); bfd_client_sendmsg(zclient, ZEBRA_BFD_CLIENT_REGISTER, router->vrf_id);
#endif
zclient_send_reg_requests(zclient, router->vrf_id); zclient_send_reg_requests(zclient, router->vrf_id);
#if PIM_IPV == 4
/* request for VxLAN BUM group addresses */ /* request for VxLAN BUM group addresses */
pim_zebra_vxlan_replay(); pim_zebra_vxlan_replay();
#endif
} }
static void pim_zebra_capabilities(struct zclient_capabilities *cap) static void pim_zebra_capabilities(struct zclient_capabilities *cap)
@ -436,9 +452,10 @@ static void pim_zebra_capabilities(struct zclient_capabilities *cap)
} }
static zclient_handler *const pim_handlers[] = { static zclient_handler *const pim_handlers[] = {
[ZEBRA_ROUTER_ID_UPDATE] = pim_router_id_update_zebra,
[ZEBRA_INTERFACE_ADDRESS_ADD] = pim_zebra_if_address_add, [ZEBRA_INTERFACE_ADDRESS_ADD] = pim_zebra_if_address_add,
[ZEBRA_INTERFACE_ADDRESS_DELETE] = pim_zebra_if_address_del, [ZEBRA_INTERFACE_ADDRESS_DELETE] = pim_zebra_if_address_del,
#if PIM_IPV == 4
[ZEBRA_ROUTER_ID_UPDATE] = pim_router_id_update_zebra,
[ZEBRA_INTERFACE_VRF_UPDATE] = pim_zebra_interface_vrf_update, [ZEBRA_INTERFACE_VRF_UPDATE] = pim_zebra_interface_vrf_update,
[ZEBRA_NEXTHOP_UPDATE] = pim_parse_nexthop_update, [ZEBRA_NEXTHOP_UPDATE] = pim_parse_nexthop_update,
@ -448,6 +465,7 @@ static zclient_handler *const pim_handlers[] = {
[ZEBRA_MLAG_PROCESS_UP] = pim_zebra_mlag_process_up, [ZEBRA_MLAG_PROCESS_UP] = pim_zebra_mlag_process_up,
[ZEBRA_MLAG_PROCESS_DOWN] = pim_zebra_mlag_process_down, [ZEBRA_MLAG_PROCESS_DOWN] = pim_zebra_mlag_process_down,
[ZEBRA_MLAG_FORWARD_MSG] = pim_zebra_mlag_handle_msg, [ZEBRA_MLAG_FORWARD_MSG] = pim_zebra_mlag_handle_msg,
#endif
}; };
void pim_zebra_init(void) void pim_zebra_init(void)
@ -467,6 +485,7 @@ void pim_zebra_init(void)
zclient_lookup_new(); zclient_lookup_new();
} }
#if PIM_IPV == 4
void igmp_anysource_forward_start(struct pim_instance *pim, void igmp_anysource_forward_start(struct pim_instance *pim,
struct gm_group *group) struct gm_group *group)
{ {
@ -793,6 +812,7 @@ void igmp_source_forward_stop(struct gm_source *source)
IGMP_SOURCE_DONT_FORWARDING(source->source_flags); IGMP_SOURCE_DONT_FORWARDING(source->source_flags);
} }
#endif /* PIM_IPV == 4 */
void pim_forward_start(struct pim_ifchannel *ch) void pim_forward_start(struct pim_ifchannel *ch)
{ {

View File

@ -394,7 +394,7 @@ void zclient_lookup_read_pipe(struct thread *thread)
int zclient_lookup_nexthop(struct pim_instance *pim, int zclient_lookup_nexthop(struct pim_instance *pim,
struct pim_zlookup_nexthop nexthop_tab[], struct pim_zlookup_nexthop nexthop_tab[],
const int tab_size, struct in_addr addr, const int tab_size, pim_addr addr,
int max_lookup) int max_lookup)
{ {
int lookup; int lookup;

View File

@ -39,7 +39,7 @@ void zclient_lookup_free(void);
int zclient_lookup_nexthop(struct pim_instance *pim, int zclient_lookup_nexthop(struct pim_instance *pim,
struct pim_zlookup_nexthop nexthop_tab[], struct pim_zlookup_nexthop nexthop_tab[],
const int tab_size, struct in_addr addr, const int tab_size, pim_addr addr,
int max_lookup); int max_lookup);
void pim_zlookup_show_ip_multicast(struct vty *vty); void pim_zlookup_show_ip_multicast(struct vty *vty);

View File

@ -18,32 +18,22 @@ pim_common = \
pimd/pim_bfd.c \ pimd/pim_bfd.c \
pimd/pim_br.c \ pimd/pim_br.c \
pimd/pim_bsm.c \ pimd/pim_bsm.c \
pimd/pim_cmd.c \
pimd/pim_errors.c \ pimd/pim_errors.c \
pimd/pim_hello.c \ pimd/pim_hello.c \
pimd/pim_iface.c \ pimd/pim_iface.c \
pimd/pim_ifchannel.c \ pimd/pim_ifchannel.c \
pimd/pim_igmp.c \
pimd/pim_igmp_mtrace.c \
pimd/pim_igmp_stats.c \
pimd/pim_igmpv2.c \
pimd/pim_igmpv3.c \
pimd/pim_instance.c \ pimd/pim_instance.c \
pimd/pim_int.c \ pimd/pim_int.c \
pimd/pim_join.c \ pimd/pim_join.c \
pimd/pim_jp_agg.c \ pimd/pim_jp_agg.c \
pimd/pim_macro.c \ pimd/pim_macro.c \
pimd/pim_memory.c \ pimd/pim_memory.c \
pimd/pim_mlag.c \
pimd/pim_mroute.c \ pimd/pim_mroute.c \
pimd/pim_msg.c \ pimd/pim_msg.c \
pimd/pim_nb.c \ pimd/pim_nb.c \
pimd/pim_nb_config.c \ pimd/pim_nb_config.c \
pimd/pim_neighbor.c \ pimd/pim_neighbor.c \
pimd/pim_nht.c \
pimd/pim_oil.c \ pimd/pim_oil.c \
pimd/pim_pim.c \
pimd/pim_register.c \
pimd/pim_routemap.c \ pimd/pim_routemap.c \
pimd/pim_rp.c \ pimd/pim_rp.c \
pimd/pim_rpf.c \ pimd/pim_rpf.c \
@ -58,19 +48,29 @@ pim_common = \
pimd/pim_util.c \ pimd/pim_util.c \
pimd/pim_vty.c \ pimd/pim_vty.c \
pimd/pim_zebra.c \ pimd/pim_zebra.c \
pimd/pim_zlookup.c \
pimd/pim_vxlan.c \ pimd/pim_vxlan.c \
pimd/pim_zpthread.c \
pimd/pimd.c \ pimd/pimd.c \
# end # end
pimd_pimd_SOURCES = \ pimd_pimd_SOURCES = \
$(pim_common) \ $(pim_common) \
pimd/pim_cmd.c \
pimd/pim_igmp.c \
pimd/pim_igmp_mtrace.c \
pimd/pim_igmp_stats.c \
pimd/pim_igmpv2.c \
pimd/pim_igmpv3.c \
pimd/pim_main.c \ pimd/pim_main.c \
pimd/pim_mlag.c \
pimd/pim_msdp.c \ pimd/pim_msdp.c \
pimd/pim_msdp_packet.c \ pimd/pim_msdp_packet.c \
pimd/pim_msdp_socket.c \ pimd/pim_msdp_socket.c \
pimd/pim_nht.c \
pimd/pim_pim.c \
pimd/pim_register.c \
pimd/pim_signals.c \ pimd/pim_signals.c \
pimd/pim_zlookup.c \
pimd/pim_zpthread.c \
# end # end
nodist_pimd_pimd_SOURCES = \ nodist_pimd_pimd_SOURCES = \
@ -82,6 +82,7 @@ nodist_pimd_pimd_SOURCES = \
pimd_pim6d_SOURCES = \ pimd_pim6d_SOURCES = \
$(pim_common) \ $(pim_common) \
pimd/pim6_main.c \ pimd/pim6_main.c \
pimd/pim6_stubs.c \
# end # end
nodist_pimd_pim6d_SOURCES = \ nodist_pimd_pim6d_SOURCES = \
@ -158,7 +159,7 @@ if DEV_BUILD
# (change noinst_ to sbin_ below to install it.) # (change noinst_ to sbin_ below to install it.)
# #
noinst_PROGRAMS += pimd/pim6d noinst_PROGRAMS += pimd/pim6d
pimd_pim6d_CFLAGS = $(AM_CFLAGS) -DPIM_IPV=6 $(and $(PIM_V6_TEMP_BREAK),-DPIM_V6_TEMP_BREAK) pimd_pim6d_CFLAGS = $(AM_CFLAGS) -DPIM_IPV=6
pimd_pim6d_LDADD = lib/libfrr.la $(LIBCAP) pimd_pim6d_LDADD = lib/libfrr.la $(LIBCAP)
endif endif
endif endif