+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* PIM for Quagga
* Copyright (C) 2015 Cumulus Networks, Inc.
* Donald Sharp
- *
- * 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 "pim_rp.h"
#include "pim_register.h"
#include "pim_upstream.h"
-#include "pim_br.h"
#include "pim_rpf.h"
#include "pim_oil.h"
#include "pim_zebra.h"
struct pim_instance *pim = pim_ifp->pim;
struct pim_upstream *up = NULL;
struct pim_rpf *rp;
- pim_addr rpf_addr;
pim_sgaddr sg;
struct listnode *up_node;
struct pim_upstream *child;
rp = RP(pim_ifp->pim, sg.grp);
if (rp) {
- rpf_addr = pim_addr_from_prefix(&rp->rpf_addr);
/* As per RFC 7761, Section 4.9.4:
* A special wildcard value consisting of an address field of
* all zeros can be used to indicate any source.
*/
- if ((pim_addr_cmp(sg.src, rpf_addr) == 0) ||
+ if ((pim_addr_cmp(sg.src, rp->rpf_addr) == 0) ||
pim_addr_is_any(sg.src)) {
handling_star = true;
sg.src = PIMADDR_ANY;
unsigned char *b1;
struct pim_interface *pinfo;
struct interface *ifp;
- pim_addr dst = pim_addr_from_prefix(&rpg->rpf_addr);
if (PIM_DEBUG_PIM_REG) {
zlog_debug("Sending %s %sRegister Packet to %pPA", up->sg_str,
- null_register ? "NULL " : "", &dst);
+ null_register ? "NULL " : "", &rpg->rpf_addr);
}
ifp = rpg->source_nexthop.interface;
if (PIM_DEBUG_PIM_REG) {
zlog_debug("%s: Sending %s %sRegister Packet to %pPA on %s",
__func__, up->sg_str, null_register ? "NULL " : "",
- &dst, ifp->name);
+ &rpg->rpf_addr, ifp->name);
}
memset(buffer, 0, 10000);
*/
src = pim_register_get_unicast_v6_addr(pinfo);
#endif
- pim_msg_build_header(src, dst, buffer, buf_size + PIM_MSG_REGISTER_LEN,
+ pim_msg_build_header(src, rpg->rpf_addr, buffer,
+ buf_size + PIM_MSG_REGISTER_LEN,
PIM_MSG_TYPE_REGISTER, false);
if (!pinfo->pim_passive_enable)
++pinfo->pim_ifstat_reg_send;
- if (pim_msg_send(pinfo->pim_sock_fd, src, dst, buffer,
+ if (pim_msg_send(pinfo->pim->reg_sock, src, rpg->rpf_addr, buffer,
buf_size + PIM_MSG_REGISTER_LEN, ifp)) {
if (PIM_DEBUG_PIM_TRACE) {
zlog_debug(
}
}
- rp_addr = pim_addr_from_prefix(&(RP(pim, sg.grp))->rpf_addr);
+ rp_addr = (RP(pim, sg.grp))->rpf_addr;
if (i_am_rp && (!pim_addr_cmp(dest_addr, rp_addr))) {
sentRegisterStop = 0;
pim_addr_to_prefix(&src, sg.src);
- if (prefix_list_apply(plist, &src) == PREFIX_DENY) {
+ if (prefix_list_apply_ext(plist, NULL, &src, true) ==
+ PREFIX_DENY) {
pim_register_stop_send(ifp, &sg, dest_addr,
src_addr);
if (PIM_DEBUG_PIM_PACKETS)
}
if (*bits & PIM_REGISTER_BORDER_BIT) {
- pim_addr pimbr = pim_br_get_pmbr(&sg);
if (PIM_DEBUG_PIM_PACKETS)
zlog_debug(
- "%s: Received Register message with Border bit set",
+ "%s: Received Register message with Border bit set, ignoring",
__func__);
- if (pim_addr_is_any(pimbr))
- pim_br_set_pmbr(&sg, src_addr);
- else if (pim_addr_cmp(src_addr, pimbr)) {
- pim_register_stop_send(ifp, &sg, dest_addr,
- src_addr);
- if (PIM_DEBUG_PIM_PACKETS)
- zlog_debug(
- "%s: Sending register-Stop to %s and dropping mr. packet",
- __func__, "Sender");
/* Drop Packet Silently */
- return 0;
- }
+ return 0;
}
struct pim_upstream *upstream = pim_upstream_find(pim, &sg);