]>
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,
33 static int i_am_rp
= 0;
36 * Checks to see if we should elect ourself the actual RP
39 pim_rp_check_rp (struct in_addr old
, struct in_addr
new)
41 if (PIM_DEBUG_ZEBRA
) {
45 pim_inet4_dump("<rp?>", qpim_rp
.rpf_addr
, rp
, sizeof(rp
));
46 pim_inet4_dump("<old?>", old
, sold
, sizeof(sold
));
47 pim_inet4_dump("<new?>", new, snew
, sizeof(snew
));
48 zlog_debug("%s: %s for old %s new %s", __func__
, rp
, sold
, snew
);
51 if (qpim_rp
.rpf_addr
.s_addr
== INADDR_NONE
)
54 if (new.s_addr
== qpim_rp
.rpf_addr
.s_addr
)
60 if (old
.s_addr
== qpim_rp
.rpf_addr
.s_addr
)
68 * I_am_RP(G) is true if the group-to-RP mapping indicates that
69 * this router is the RP for the group.
71 * Since we only have static RP, all groups are part of this RP
74 pim_rp_i_am_rp (struct in_addr group
)
82 * Return the RP that the Group belongs too.
85 pim_rp_g (struct in_addr group
)
88 * For staticly configured RP, it is always the qpim_rp
90 pim_nexthop_lookup(&qpim_rp
.source_nexthop
, qpim_rp
.rpf_addr
, NULL
);
95 * Set the upstream IP address we want to talk to based upon
96 * the rp configured and the source address
98 * If we have don't have a RP configured and the source address is *
99 * then return failure.
103 pim_rp_set_upstream_addr (struct in_addr
*up
, struct in_addr source
)
105 if ((qpim_rp
.rpf_addr
.s_addr
== INADDR_NONE
) && (source
.s_addr
== INADDR_ANY
))
107 if (PIM_DEBUG_PIM_TRACE
)
108 zlog_debug("%s: Received a (*,G) with no RP configured", __PRETTY_FUNCTION__
);
112 *up
= (source
.s_addr
== INADDR_ANY
) ? qpim_rp
.rpf_addr
: source
;