{ MTYPE_PIM_UPSTREAM, "PIM upstream (S,G) state" },
{ MTYPE_PIM_SSMPINGD, "PIM sspimgd socket" },
{ MTYPE_PIM_STATIC_ROUTE, "PIM Static Route" },
+ { MTYPE_PIM_BR, "PIM Bridge Router info" },
{ -1, NULL },
};
pim_oil.c pim_zlookup.c pim_pim.c pim_tlv.c pim_neighbor.c \
pim_hello.c pim_ifchannel.c pim_join.c pim_assert.c \
pim_msg.c pim_upstream.c pim_rpf.c pim_macro.c \
- pim_igmp_join.c pim_ssmpingd.c pim_int.c pim_rp.c pim_static.c
+ pim_igmp_join.c pim_ssmpingd.c pim_int.c pim_rp.c \
+ pim_static.c pim_br.c
noinst_HEADERS = \
pimd.h pim_version.h pim_cmd.h pim_signals.h pim_iface.h \
pim_oil.h pim_zlookup.h pim_pim.h pim_tlv.h pim_neighbor.h \
pim_hello.h pim_ifchannel.h pim_join.h pim_assert.h \
pim_msg.h pim_upstream.h pim_rpf.h pim_macro.h \
- pim_igmp_join.h pim_ssmpingd.h pim_int.h pim_rp.h pim_static.h
+ pim_igmp_join.h pim_ssmpingd.h pim_int.h pim_rp.h \
+ pim_static.h pim_br.h
pimd_SOURCES = \
pim_main.c $(libpim_a_SOURCES)
--- /dev/null
+/*
+ * 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 "memory.h"
+#include "log.h"
+
+#include "pimd.h"
+#include "pim_str.h"
+#include "pim_br.h"
+#include "linklist.h"
+
+struct pim_br {
+ struct in_addr source;
+ struct in_addr group;
+ struct in_addr pmbr;
+};
+
+struct in_addr pim_br_unknown = { .s_addr = 0 };
+
+static struct list *pim_br_list = NULL;
+
+struct in_addr
+pim_br_get_pmbr (struct in_addr source, struct in_addr group)
+{
+ struct listnode *node;
+ struct pim_br *pim_br;
+
+ for (ALL_LIST_ELEMENTS_RO (pim_br_list, node, pim_br)) {
+ if (source.s_addr == pim_br->source.s_addr &&
+ group.s_addr == pim_br->group.s_addr)
+ return pim_br->pmbr;
+ }
+
+ return pim_br_unknown;
+}
+
+void
+pim_br_set_pmbr (struct in_addr source, struct in_addr group, struct in_addr br)
+{
+ struct listnode *node, *next;
+ struct pim_br *pim_br;
+
+ for (ALL_LIST_ELEMENTS (pim_br_list, node, next, pim_br)) {
+ if (source.s_addr == pim_br->source.s_addr &&
+ group.s_addr == pim_br->group.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;
+ }
+
+ pim_br->source = source;
+ pim_br->group = group;
+
+ listnode_add(pim_br_list, pim_br);
+ }
+
+ pim_br->pmbr = br;
+}
+
+
+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;
+ }
+}
--- /dev/null
+/*
+ * 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
+ */
+#ifndef PIM_BR_H
+#define PIM_BR_H
+
+struct in_addr pim_br_get_pmbr (struct in_addr source, struct in_addr group);
+
+void pim_br_set_pmbr (struct in_addr source, struct in_addr group, struct in_addr value);
+
+void pim_br_init (void);
+
+extern struct in_addr pim_br_unknown;
+
+#endif