diff options
Diffstat (limited to 'pimd/pim_br.c')
-rw-r--r-- | pimd/pim_br.c | 99 |
1 files changed, 48 insertions, 51 deletions
diff --git a/pimd/pim_br.c b/pimd/pim_br.c index 19a0293c4..f297b0591 100644 --- a/pimd/pim_br.c +++ b/pimd/pim_br.c @@ -29,83 +29,80 @@ #include "linklist.h" struct pim_br { - struct prefix_sg sg; - struct in_addr pmbr; + struct prefix_sg sg; + struct in_addr pmbr; }; -struct in_addr pim_br_unknown = { .s_addr = 0 }; +struct in_addr pim_br_unknown = {.s_addr = 0}; static struct list *pim_br_list = NULL; -struct in_addr -pim_br_get_pmbr (struct prefix_sg *sg) +struct in_addr pim_br_get_pmbr(struct prefix_sg *sg) { - struct listnode *node; - struct pim_br *pim_br; + struct listnode *node; + struct pim_br *pim_br; - for (ALL_LIST_ELEMENTS_RO (pim_br_list, node, pim_br)) { - if (sg->src.s_addr == pim_br->sg.src.s_addr && - sg->grp.s_addr == pim_br->sg.grp.s_addr) - return pim_br->pmbr; - } + for (ALL_LIST_ELEMENTS_RO(pim_br_list, node, pim_br)) { + if (sg->src.s_addr == pim_br->sg.src.s_addr + && sg->grp.s_addr == pim_br->sg.grp.s_addr) + return pim_br->pmbr; + } - return pim_br_unknown; + return pim_br_unknown; } -void -pim_br_set_pmbr (struct prefix_sg *sg, struct in_addr br) +void pim_br_set_pmbr(struct prefix_sg *sg, struct in_addr br) { - struct listnode *node, *next; - struct pim_br *pim_br; + struct listnode *node, *next; + struct pim_br *pim_br; - for (ALL_LIST_ELEMENTS (pim_br_list, node, next, pim_br)) { - if (sg->src.s_addr == pim_br->sg.src.s_addr && - sg->grp.s_addr == pim_br->sg.grp.s_addr) - break; - } + for (ALL_LIST_ELEMENTS(pim_br_list, node, next, pim_br)) { + if (sg->src.s_addr == pim_br->sg.src.s_addr + && sg->grp.s_addr == pim_br->sg.grp.s_addr) + break; + } - if (!pim_br) { - pim_br = XCALLOC(MTYPE_PIM_BR, sizeof (*pim_br)); - if (!pim_br) { - zlog_err("PIM XCALLOC(%zu) failure", sizeof(*pim_br)); - return; - } + if (!pim_br) { + pim_br = XCALLOC(MTYPE_PIM_BR, sizeof(*pim_br)); + if (!pim_br) { + zlog_err("PIM XCALLOC(%zu) failure", sizeof(*pim_br)); + return; + } - pim_br->sg = *sg; + pim_br->sg = *sg; - listnode_add(pim_br_list, pim_br); - } + listnode_add(pim_br_list, pim_br); + } - pim_br->pmbr = br; + pim_br->pmbr = br; } /* * Remove the (S,G) from the stored values */ -void -pim_br_clear_pmbr (struct prefix_sg *sg) +void pim_br_clear_pmbr(struct prefix_sg *sg) { - struct listnode *node, *next; - struct pim_br *pim_br; + struct listnode *node, *next; + struct pim_br *pim_br; - for (ALL_LIST_ELEMENTS (pim_br_list, node, next, pim_br)) { - if (sg->src.s_addr == pim_br->sg.src.s_addr && - sg->grp.s_addr == pim_br->sg.grp.s_addr) - break; - } + for (ALL_LIST_ELEMENTS(pim_br_list, node, next, pim_br)) { + if (sg->src.s_addr == pim_br->sg.src.s_addr + && sg->grp.s_addr == pim_br->sg.grp.s_addr) + break; + } - if (!pim_br) - return; + if (!pim_br) + return; - listnode_delete (pim_br_list, pim_br); + listnode_delete(pim_br_list, pim_br); } -void pim_br_init (void) +void pim_br_init(void) { - pim_br_list = list_new(); - if (!pim_br_list) { - zlog_err("%s: Failure to create pim_br_list", - __PRETTY_FUNCTION__); - return; - } + pim_br_list = list_new(); + if (!pim_br_list) { + zlog_err("%s: Failure to create pim_br_list", + __PRETTY_FUNCTION__); + return; + } } |