]>
git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_br.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 along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
36 struct in_addr pim_br_unknown
= {.s_addr
= 0};
38 static struct list
*pim_br_list
= NULL
;
40 struct in_addr
pim_br_get_pmbr(pim_sgaddr
*sg
)
42 struct listnode
*node
;
43 struct pim_br
*pim_br
;
45 for (ALL_LIST_ELEMENTS_RO(pim_br_list
, node
, pim_br
)) {
46 if (sg
->src
.s_addr
== pim_br
->sg
.src
.s_addr
47 && sg
->grp
.s_addr
== pim_br
->sg
.grp
.s_addr
)
51 return pim_br_unknown
;
54 void pim_br_set_pmbr(pim_sgaddr
*sg
, struct in_addr br
)
56 struct listnode
*node
, *next
;
57 struct pim_br
*pim_br
;
59 for (ALL_LIST_ELEMENTS(pim_br_list
, node
, next
, pim_br
)) {
60 if (sg
->src
.s_addr
== pim_br
->sg
.src
.s_addr
61 && sg
->grp
.s_addr
== pim_br
->sg
.grp
.s_addr
)
66 pim_br
= XCALLOC(MTYPE_PIM_BR
, sizeof(*pim_br
));
69 listnode_add(pim_br_list
, pim_br
);
76 * Remove the (S,G) from the stored values
78 void pim_br_clear_pmbr(pim_sgaddr
*sg
)
80 struct listnode
*node
, *next
;
81 struct pim_br
*pim_br
;
83 for (ALL_LIST_ELEMENTS(pim_br_list
, node
, next
, pim_br
)) {
84 if (sg
->src
.s_addr
== pim_br
->sg
.src
.s_addr
85 && sg
->grp
.s_addr
== pim_br
->sg
.grp
.s_addr
)
92 listnode_delete(pim_br_list
, pim_br
);
95 void pim_br_init(void)
97 pim_br_list
= list_new();