]>
git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_rp.c
3 * Copyright (C) 2015 Cumulus Networks, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
32 static int i_am_rp
= 0;
35 * Checks to see if we should elect ourself the actual RP
38 pim_rp_check_rp (struct in_addr old
, struct in_addr
new)
40 if (PIM_DEBUG_ZEBRA
) {
44 pim_inet4_dump("<rp?>", qpim_rp
.rpf_addr
, rp
, sizeof(rp
));
45 pim_inet4_dump("<old?>", old
, sold
, sizeof(sold
));
46 pim_inet4_dump("<new?>", new, snew
, sizeof(snew
));
47 zlog_debug("%s: %s for old %s new %s", __func__
, rp
, sold
, snew
);
50 if (qpim_rp
.rpf_addr
.s_addr
== INADDR_NONE
)
53 if (new.s_addr
== qpim_rp
.rpf_addr
.s_addr
)
59 if (old
.s_addr
== qpim_rp
.rpf_addr
.s_addr
)
67 * I_am_RP(G) is true if the group-to-RP mapping indicates that
68 * this router is the RP for the group.
70 * Since we only have static RP, all groups are part of this RP
73 pim_rp_i_am_rp (struct in_addr group
)
81 * Return the RP that the Group belongs too.
84 pim_rp_g (struct in_addr group
)
87 * For staticly configured RP, it is always the qpim_rp
89 pim_nexthop_lookup(&qpim_rp
.source_nexthop
, qpim_rp
.rpf_addr
);
94 * Set the upstream IP address we want to talk to based upon
95 * the rp configured and the source address
97 * If we have don't have a RP configured and the source address is *
98 * then return failure.
102 pim_rp_set_upstream_addr (struct in_addr
*up
, struct in_addr source
)
104 if ((qpim_rp
.rpf_addr
.s_addr
== INADDR_NONE
) && (source
.s_addr
== INADDR_ANY
))
106 if (PIM_DEBUG_PIM_TRACE
)
107 zlog_debug("%s: Received a (*,G) with no RP configured", __PRETTY_FUNCTION__
);
111 *up
= (source
.s_addr
== INADDR_ANY
) ? qpim_rp
.rpf_addr
: source
;