summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pimd/pim_cmd.c328
-rw-r--r--pimd/pim_instance.c14
-rw-r--r--pimd/pim_instance.h3
-rw-r--r--pimd/pim_static.c32
-rw-r--r--pimd/pim_static.h13
-rw-r--r--pimd/pim_vty.c3
-rw-r--r--pimd/pimd.c12
-rw-r--r--pimd/pimd.h1
8 files changed, 234 insertions, 172 deletions
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index c890db7bf..96cbcd184 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -3766,6 +3766,8 @@ static void show_mroute(struct vty *vty, u_char uj)
int oif_vif_index;
struct interface *ifp_in;
char proto[100];
+ struct vrf *vrf;
+ struct pim_instance *pim;
if (uj) {
json = json_object_new_object();
@@ -3942,123 +3944,145 @@ static void show_mroute(struct vty *vty, u_char uj)
}
/* Print list of static routes */
- for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list, node, s_route)) {
- first = 1;
-
- if (!s_route->c_oil.installed)
+ RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
+ {
+ pim = vrf->info;
+ if (!pim)
continue;
- pim_inet4_dump("<group?>", s_route->group, grp_str,
- sizeof(grp_str));
- pim_inet4_dump("<source?>", s_route->source, src_str,
- sizeof(src_str));
- ifp_in = pim_if_find_by_vif_index(s_route->iif);
- found_oif = 0;
-
- if (ifp_in)
- strcpy(in_ifname, ifp_in->name);
- else
- strcpy(in_ifname, "<iif?>");
+ for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, s_route)) {
+ first = 1;
- if (uj) {
+ if (!s_route->c_oil.installed)
+ continue;
- /* Find the group, create it if it doesn't exist */
- json_object_object_get_ex(json, grp_str, &json_group);
+ pim_inet4_dump("<group?>", s_route->group, grp_str,
+ sizeof(grp_str));
+ pim_inet4_dump("<source?>", s_route->source, src_str,
+ sizeof(src_str));
+ ifp_in = pim_if_find_by_vif_index(s_route->iif);
+ found_oif = 0;
- if (!json_group) {
- json_group = json_object_new_object();
- json_object_object_add(json, grp_str,
- json_group);
- }
+ if (ifp_in)
+ strcpy(in_ifname, ifp_in->name);
+ else
+ strcpy(in_ifname, "<iif?>");
- /* Find the source nested under the group, create it if
- * it doesn't exist */
- json_object_object_get_ex(json_group, src_str,
- &json_source);
+ if (uj) {
- if (!json_source) {
- json_source = json_object_new_object();
- json_object_object_add(json_group, src_str,
- json_source);
- }
+ /* Find the group, create it if it doesn't exist
+ */
+ json_object_object_get_ex(json, grp_str,
+ &json_group);
- json_object_string_add(json_source, "iif", in_ifname);
- json_oil = NULL;
- } else {
- strcpy(proto, "STATIC");
- }
+ if (!json_group) {
+ json_group = json_object_new_object();
+ json_object_object_add(json, grp_str,
+ json_group);
+ }
- for (oif_vif_index = 0; oif_vif_index < MAXVIFS;
- ++oif_vif_index) {
- struct interface *ifp_out;
- char oif_uptime[10];
- int ttl;
+ /* Find the source nested under the group,
+ * create it if it doesn't exist */
+ json_object_object_get_ex(json_group, src_str,
+ &json_source);
- ttl = s_route->oif_ttls[oif_vif_index];
- if (ttl < 1)
- continue;
+ if (!json_source) {
+ json_source = json_object_new_object();
+ json_object_object_add(json_group,
+ src_str,
+ json_source);
+ }
- ifp_out = pim_if_find_by_vif_index(oif_vif_index);
- pim_time_uptime(
- oif_uptime, sizeof(oif_uptime),
- now
- - s_route->c_oil
- .oif_creation[oif_vif_index]);
- found_oif = 1;
+ json_object_string_add(json_source, "iif",
+ in_ifname);
+ json_oil = NULL;
+ } else {
+ strcpy(proto, "STATIC");
+ }
- if (ifp_out)
- strcpy(out_ifname, ifp_out->name);
- else
- strcpy(out_ifname, "<oif?>");
+ for (oif_vif_index = 0; oif_vif_index < MAXVIFS;
+ ++oif_vif_index) {
+ struct interface *ifp_out;
+ char oif_uptime[10];
+ int ttl;
+
+ ttl = s_route->oif_ttls[oif_vif_index];
+ if (ttl < 1)
+ continue;
+
+ ifp_out =
+ pim_if_find_by_vif_index(oif_vif_index);
+ pim_time_uptime(
+ oif_uptime, sizeof(oif_uptime),
+ now
+ - s_route->c_oil.oif_creation
+ [oif_vif_index]);
+ found_oif = 1;
+
+ if (ifp_out)
+ strcpy(out_ifname, ifp_out->name);
+ else
+ strcpy(out_ifname, "<oif?>");
- if (uj) {
- json_ifp_out = json_object_new_object();
- json_object_string_add(json_ifp_out, "source",
- src_str);
- json_object_string_add(json_ifp_out, "group",
- grp_str);
- json_object_boolean_true_add(json_ifp_out,
- "protocolStatic");
- json_object_string_add(json_ifp_out,
- "inboundInterface",
- in_ifname);
- json_object_int_add(
- json_ifp_out, "iVifI",
- s_route->c_oil.oil.mfcc_parent);
- json_object_string_add(json_ifp_out,
- "outboundInterface",
- out_ifname);
- json_object_int_add(json_ifp_out, "oVifI",
- oif_vif_index);
- json_object_int_add(json_ifp_out, "ttl", ttl);
- json_object_string_add(json_ifp_out, "upTime",
- oif_uptime);
- if (!json_oil) {
- json_oil = json_object_new_object();
- json_object_object_add(json_source,
- "oil", json_oil);
+ if (uj) {
+ json_ifp_out = json_object_new_object();
+ json_object_string_add(json_ifp_out,
+ "source",
+ src_str);
+ json_object_string_add(
+ json_ifp_out, "group", grp_str);
+ json_object_boolean_true_add(
+ json_ifp_out, "protocolStatic");
+ json_object_string_add(
+ json_ifp_out,
+ "inboundInterface", in_ifname);
+ json_object_int_add(
+ json_ifp_out, "iVifI",
+ s_route->c_oil.oil.mfcc_parent);
+ json_object_string_add(
+ json_ifp_out,
+ "outboundInterface",
+ out_ifname);
+ json_object_int_add(json_ifp_out,
+ "oVifI",
+ oif_vif_index);
+ json_object_int_add(json_ifp_out, "ttl",
+ ttl);
+ json_object_string_add(json_ifp_out,
+ "upTime",
+ oif_uptime);
+ if (!json_oil) {
+ json_oil =
+ json_object_new_object();
+ json_object_object_add(
+ json_source, "oil",
+ json_oil);
+ }
+ json_object_object_add(json_oil,
+ out_ifname,
+ json_ifp_out);
+ } else {
+ vty_out(vty,
+ "%-15s %-15s %-6s %-10s %-10s %-3d %8s %s\n",
+ src_str, grp_str, proto,
+ in_ifname, out_ifname, ttl,
+ oif_uptime, vrf->name);
+ if (first) {
+ src_str[0] = '\0';
+ grp_str[0] = '\0';
+ in_ifname[0] = '\0';
+ first = 0;
+ }
}
- json_object_object_add(json_oil, out_ifname,
- json_ifp_out);
- } else {
+ }
+
+ if (!uj && !found_oif) {
vty_out(vty,
- "%-15s %-15s %-6s %-10s %-10s %-3d %8s\n",
+ "%-15s %-15s %-6s %-10s %-10s %-3d %8s %s\n",
src_str, grp_str, proto, in_ifname,
- out_ifname, ttl, oif_uptime);
- if (first) {
- src_str[0] = '\0';
- grp_str[0] = '\0';
- in_ifname[0] = '\0';
- first = 0;
- }
+ "none", 0, "--:--:--", vrf->name);
}
}
-
- if (!uj && !found_oif) {
- vty_out(vty, "%-15s %-15s %-6s %-10s %-10s %-3d %8s\n",
- src_str, grp_str, proto, in_ifname, "none", 0,
- "--:--:--");
- }
}
if (uj) {
@@ -4086,6 +4110,8 @@ static void show_mroute_count(struct vty *vty)
struct listnode *node;
struct channel_oil *c_oil;
struct static_route *s_route;
+ struct pim_instance *pim;
+ struct vrf *vrf;
vty_out(vty, "\n");
@@ -4114,24 +4140,36 @@ static void show_mroute_count(struct vty *vty)
}
/* Print static route counts */
- for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list, node, s_route)) {
- char group_str[INET_ADDRSTRLEN];
- char source_str[INET_ADDRSTRLEN];
-
- if (!s_route->c_oil.installed)
+ RB_FOREACH(vrf, vrf_name_head, &vrfs_by_name)
+ {
+ pim = vrf->info;
+ if (!pim)
continue;
- pim_mroute_update_counters(&s_route->c_oil);
+ for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, s_route)) {
+ char group_str[INET_ADDRSTRLEN];
+ char source_str[INET_ADDRSTRLEN];
- pim_inet4_dump("<group?>", s_route->c_oil.oil.mfcc_mcastgrp,
- group_str, sizeof(group_str));
- pim_inet4_dump("<source?>", s_route->c_oil.oil.mfcc_origin,
- source_str, sizeof(source_str));
+ if (!s_route->c_oil.installed)
+ continue;
- vty_out(vty, "%-15s %-15s %-8llu %-7ld %-10ld %-7ld\n",
- source_str, group_str, s_route->c_oil.cc.lastused,
- s_route->c_oil.cc.pktcnt, s_route->c_oil.cc.bytecnt,
- s_route->c_oil.cc.wrong_if);
+ pim_mroute_update_counters(&s_route->c_oil);
+
+ pim_inet4_dump("<group?>",
+ s_route->c_oil.oil.mfcc_mcastgrp,
+ group_str, sizeof(group_str));
+ pim_inet4_dump("<source?>",
+ s_route->c_oil.oil.mfcc_origin,
+ source_str, sizeof(source_str));
+
+ vty_out(vty,
+ "%-15s %-15s %-8llu %-7ld %-10ld %-7ld %s\n",
+ source_str, group_str,
+ s_route->c_oil.cc.lastused,
+ s_route->c_oil.cc.pktcnt,
+ s_route->c_oil.cc.bytecnt,
+ s_route->c_oil.cc.wrong_if, vrf->name);
+ }
}
}
@@ -5602,6 +5640,8 @@ DEFUN (interface_ip_mroute,
"Group address\n")
{
VTY_DECLVAR_CONTEXT(interface, iif);
+ struct pim_interface *pim_ifp;
+ struct pim_instance *pim;
int idx_interface = 2;
int idx_ipv4 = 3;
struct interface *oif;
@@ -5611,11 +5651,14 @@ DEFUN (interface_ip_mroute,
struct in_addr src_addr;
int result;
+ pim_ifp = iif->info;
+ pim = pim_ifp->pim;
+
oifname = argv[idx_interface]->arg;
- oif = if_lookup_by_name(oifname, pimg->vrf_id);
+ oif = if_lookup_by_name(oifname, pim->vrf_id);
if (!oif) {
vty_out(vty, "No such interface name %s\n", oifname);
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
grp_str = argv[idx_ipv4]->arg;
@@ -5623,14 +5666,14 @@ DEFUN (interface_ip_mroute,
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s\n", grp_str,
errno, safe_strerror(errno));
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
src_addr.s_addr = INADDR_ANY;
- if (pim_static_add(iif, oif, grp_addr, src_addr)) {
+ if (pim_static_add(pim, iif, oif, grp_addr, src_addr)) {
vty_out(vty, "Failed to add route\n");
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
return CMD_SUCCESS;
@@ -5646,6 +5689,8 @@ DEFUN (interface_ip_mroute_source,
"Source address\n")
{
VTY_DECLVAR_CONTEXT(interface, iif);
+ struct pim_interface *pim_ifp;
+ struct pim_instance *pim;
int idx_interface = 2;
int idx_ipv4 = 3;
int idx_ipv4_2 = 4;
@@ -5657,11 +5702,14 @@ DEFUN (interface_ip_mroute_source,
struct in_addr src_addr;
int result;
+ pim_ifp = iif->info;
+ pim = pim_ifp->pim;
+
oifname = argv[idx_interface]->arg;
- oif = if_lookup_by_name(oifname, pimg->vrf_id);
+ oif = if_lookup_by_name(oifname, pim->vrf_id);
if (!oif) {
vty_out(vty, "No such interface name %s\n", oifname);
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
grp_str = argv[idx_ipv4]->arg;
@@ -5669,7 +5717,7 @@ DEFUN (interface_ip_mroute_source,
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s\n", grp_str,
errno, safe_strerror(errno));
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
src_str = argv[idx_ipv4_2]->arg;
@@ -5677,12 +5725,12 @@ DEFUN (interface_ip_mroute_source,
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s\n", src_str,
errno, safe_strerror(errno));
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
- if (pim_static_add(iif, oif, grp_addr, src_addr)) {
+ if (pim_static_add(pim, iif, oif, grp_addr, src_addr)) {
vty_out(vty, "Failed to add route\n");
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
return CMD_SUCCESS;
@@ -5698,6 +5746,8 @@ DEFUN (interface_no_ip_mroute,
"Group Address\n")
{
VTY_DECLVAR_CONTEXT(interface, iif);
+ struct pim_interface *pim_ifp;
+ struct pim_instance *pim;
int idx_interface = 3;
int idx_ipv4 = 4;
struct interface *oif;
@@ -5707,11 +5757,14 @@ DEFUN (interface_no_ip_mroute,
struct in_addr src_addr;
int result;
+ pim_ifp = iif->info;
+ pim = pim_ifp->pim;
+
oifname = argv[idx_interface]->arg;
- oif = if_lookup_by_name(oifname, pimg->vrf_id);
+ oif = if_lookup_by_name(oifname, pim->vrf_id);
if (!oif) {
vty_out(vty, "No such interface name %s\n", oifname);
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
grp_str = argv[idx_ipv4]->arg;
@@ -5719,14 +5772,14 @@ DEFUN (interface_no_ip_mroute,
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s\n", grp_str,
errno, safe_strerror(errno));
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
src_addr.s_addr = INADDR_ANY;
- if (pim_static_del(iif, oif, grp_addr, src_addr)) {
+ if (pim_static_del(pim, iif, oif, grp_addr, src_addr)) {
vty_out(vty, "Failed to remove route\n");
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
return CMD_SUCCESS;
@@ -5743,6 +5796,8 @@ DEFUN (interface_no_ip_mroute_source,
"Source Address\n")
{
VTY_DECLVAR_CONTEXT(interface, iif);
+ struct pim_interface *pim_ifp;
+ struct pim_instance *pim;
int idx_interface = 3;
int idx_ipv4 = 4;
int idx_ipv4_2 = 5;
@@ -5754,11 +5809,14 @@ DEFUN (interface_no_ip_mroute_source,
struct in_addr src_addr;
int result;
+ pim_ifp = iif->info;
+ pim = pim_ifp->pim;
+
oifname = argv[idx_interface]->arg;
- oif = if_lookup_by_name(oifname, pimg->vrf_id);
+ oif = if_lookup_by_name(oifname, pim->vrf_id);
if (!oif) {
vty_out(vty, "No such interface name %s\n", oifname);
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
grp_str = argv[idx_ipv4]->arg;
@@ -5766,7 +5824,7 @@ DEFUN (interface_no_ip_mroute_source,
if (result <= 0) {
vty_out(vty, "Bad group address %s: errno=%d: %s\n", grp_str,
errno, safe_strerror(errno));
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
src_str = argv[idx_ipv4_2]->arg;
@@ -5774,12 +5832,12 @@ DEFUN (interface_no_ip_mroute_source,
if (result <= 0) {
vty_out(vty, "Bad source address %s: errno=%d: %s\n", src_str,
errno, safe_strerror(errno));
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
- if (pim_static_del(iif, oif, grp_addr, src_addr)) {
+ if (pim_static_del(pim, iif, oif, grp_addr, src_addr)) {
vty_out(vty, "Failed to remove route\n");
- return CMD_WARNING_CONFIG_FAILED;
+ return CMD_WARNING;
}
return CMD_SUCCESS;
diff --git a/pimd/pim_instance.c b/pimd/pim_instance.c
index b988c12ce..84fc9b925 100644
--- a/pimd/pim_instance.c
+++ b/pimd/pim_instance.c
@@ -28,6 +28,8 @@
#include "pim_rpf.h"
#include "pim_rp.h"
#include "pim_mroute.h"
+#include "pim_oil.h"
+#include "pim_static.h"
static void pim_instance_terminate(struct pim_instance *pim)
{
@@ -43,6 +45,9 @@ static void pim_instance_terminate(struct pim_instance *pim)
pim->ssm_info = NULL;
}
+ if (pim->static_routes)
+ list_free(pim->static_routes);
+
XFREE(MTYPE_PIM_PIM_INSTANCE, pimg);
}
@@ -72,6 +77,15 @@ static struct pim_instance *pim_instance_init(struct vrf *vrf)
return NULL;
}
+ pim->static_routes = list_new();
+ if (!pim->static_routes) {
+ zlog_err("%s %s: failure: static_routes=list_new()", __FILE__,
+ __PRETTY_FUNCTION__);
+ pim_instance_terminate(pim);
+ return NULL;
+ }
+ pim->static_routes->del = (void (*)(void *))pim_static_route_free;
+
pim->send_v6_secondary = 1;
if (vrf->vrf_id == VRF_DEFAULT)
diff --git a/pimd/pim_instance.h b/pimd/pim_instance.h
index 33f81497f..83c8b3be9 100644
--- a/pimd/pim_instance.h
+++ b/pimd/pim_instance.h
@@ -53,6 +53,9 @@ struct pim_instance {
int64_t mroute_del_last;
struct interface *regiface;
+
+ // List of static routes;
+ struct list *static_routes;
};
void pim_vrf_init(void);
diff --git a/pimd/pim_static.c b/pimd/pim_static.c
index 5b3894f1f..981335ea1 100644
--- a/pimd/pim_static.c
+++ b/pimd/pim_static.c
@@ -74,11 +74,10 @@ static struct static_route *static_route_new(unsigned int iif, unsigned int oif,
}
-int pim_static_add(struct interface *iif, struct interface *oif,
- struct in_addr group, struct in_addr source)
+int pim_static_add(struct pim_instance *pim, struct interface *iif,
+ struct interface *oif, struct in_addr group,
+ struct in_addr source)
{
- struct pim_instance *pim;
- struct pim_interface *pim_ifp;
struct listnode *node = NULL;
struct static_route *s_route = NULL;
struct static_route *original_s_route = NULL;
@@ -107,10 +106,7 @@ int pim_static_add(struct interface *iif, struct interface *oif,
return -3;
}
- pim_ifp = iif->info;
- pim = pim_ifp->pim;
-
- for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list, node, s_route)) {
+ for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, s_route)) {
if (s_route->group.s_addr == group.s_addr
&& s_route->source.s_addr == source.s_addr) {
if (s_route->iif == iif_index
@@ -189,7 +185,7 @@ int pim_static_add(struct interface *iif, struct interface *oif,
* match */
if (!node) {
s_route = static_route_new(iif_index, oif_index, group, source);
- listnode_add(qpim_static_route_list, s_route);
+ listnode_add(pim->static_routes, s_route);
}
s_route->c_oil.pim = pim;
@@ -213,7 +209,7 @@ int pim_static_add(struct interface *iif, struct interface *oif,
} else {
/* we never stored off a copy, so it must have been a
* fresh new route */
- listnode_delete(qpim_static_route_list, s_route);
+ listnode_delete(pim->static_routes, s_route);
pim_static_route_free(s_route);
}
@@ -245,8 +241,9 @@ int pim_static_add(struct interface *iif, struct interface *oif,
return 0;
}
-int pim_static_del(struct interface *iif, struct interface *oif,
- struct in_addr group, struct in_addr source)
+int pim_static_del(struct pim_instance *pim, struct interface *iif,
+ struct interface *oif, struct in_addr group,
+ struct in_addr source)
{
struct listnode *node = NULL;
struct listnode *nextnode = NULL;
@@ -263,8 +260,7 @@ int pim_static_del(struct interface *iif, struct interface *oif,
return -2;
}
- for (ALL_LIST_ELEMENTS(qpim_static_route_list, node, nextnode,
- s_route)) {
+ for (ALL_LIST_ELEMENTS(pim->static_routes, node, nextnode, s_route)) {
if (s_route->iif == iif_index
&& s_route->group.s_addr == group.s_addr
&& s_route->source.s_addr == source.s_addr
@@ -303,8 +299,7 @@ int pim_static_del(struct interface *iif, struct interface *oif,
s_route->c_oil.oif_creation[oif_index] = 0;
if (s_route->c_oil.oil_ref_count <= 0) {
- listnode_delete(qpim_static_route_list,
- s_route);
+ listnode_delete(pim->static_routes, s_route);
pim_static_route_free(s_route);
}
@@ -342,7 +337,8 @@ int pim_static_del(struct interface *iif, struct interface *oif,
return 0;
}
-int pim_static_write_mroute(struct vty *vty, struct interface *ifp)
+int pim_static_write_mroute(struct vty *vty, struct pim_instance *pim,
+ struct interface *ifp)
{
struct pim_interface *pim_ifp = ifp->info;
struct listnode *node;
@@ -354,7 +350,7 @@ int pim_static_write_mroute(struct vty *vty, struct interface *ifp)
if (!pim_ifp)
return 0;
- for (ALL_LIST_ELEMENTS_RO(qpim_static_route_list, node, sroute)) {
+ for (ALL_LIST_ELEMENTS_RO(pim->static_routes, node, sroute)) {
pim_inet4_dump("<ifaddr?>", sroute->group, gbuf, sizeof(gbuf));
pim_inet4_dump("<ifaddr?>", sroute->source, sbuf, sizeof(sbuf));
if (sroute->iif == pim_ifp->mroute_vif_index) {
diff --git a/pimd/pim_static.h b/pimd/pim_static.h
index 1114f4b67..acb74a721 100644
--- a/pimd/pim_static.h
+++ b/pimd/pim_static.h
@@ -36,10 +36,13 @@ struct static_route {
void pim_static_route_free(struct static_route *s_route);
-int pim_static_add(struct interface *iif, struct interface *oif,
- struct in_addr group, struct in_addr source);
-int pim_static_del(struct interface *iif, struct interface *oif,
- struct in_addr group, struct in_addr source);
-int pim_static_write_mroute(struct vty *vty, struct interface *ifp);
+int pim_static_add(struct pim_instance *pim, struct interface *iif,
+ struct interface *oif, struct in_addr group,
+ struct in_addr source);
+int pim_static_del(struct pim_instance *pim, struct interface *iif,
+ struct interface *oif, struct in_addr group,
+ struct in_addr source);
+int pim_static_write_mroute(struct vty *vty, struct pim_instance *pim,
+ struct interface *ifp);
#endif /* PIM_STATIC_H_ */
diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c
index e4c91e066..ad9432c0d 100644
--- a/pimd/pim_vty.c
+++ b/pimd/pim_vty.c
@@ -336,7 +336,8 @@ int pim_interface_config_write(struct vty *vty)
}
}
- writes += pim_static_write_mroute(vty, ifp);
+ writes +=
+ pim_static_write_mroute(vty, pim, ifp);
pim_bfd_write_config(vty, ifp);
}
vty_out(vty, "!\n");
diff --git a/pimd/pimd.c b/pimd/pimd.c
index 164dafe5f..64a16b098 100644
--- a/pimd/pimd.c
+++ b/pimd/pimd.c
@@ -60,7 +60,6 @@ struct list *qpim_ssmpingd_list = NULL;
struct in_addr qpim_ssmpingd_group_addr;
int64_t qpim_scan_oil_events = 0;
int64_t qpim_scan_oil_last = 0;
-struct list *qpim_static_route_list = NULL;
unsigned int qpim_keep_alive_time = PIM_KEEPALIVE_PERIOD;
signed int qpim_rp_keep_alive_time = 0;
int64_t qpim_nexthop_lookups = 0;
@@ -87,9 +86,6 @@ static void pim_free()
pim_upstream_terminate();
- if (qpim_static_route_list)
- list_free(qpim_static_route_list);
-
pim_if_terminate();
pim_rp_free();
@@ -119,14 +115,6 @@ void pim_init()
pim_upstream_init();
- qpim_static_route_list = list_new();
- if (!qpim_static_route_list) {
- zlog_err("%s %s: failure: static_route_list=list_new()",
- __FILE__, __PRETTY_FUNCTION__);
- return;
- }
- qpim_static_route_list->del = (void (*)(void *))pim_static_route_free;
-
/*
RFC 4601: 4.6.3. Assert Metrics
diff --git a/pimd/pimd.h b/pimd/pimd.h
index 7cce15f24..8bb04ba65 100644
--- a/pimd/pimd.h
+++ b/pimd/pimd.h
@@ -142,7 +142,6 @@ struct in_addr qpim_ssmpingd_group_addr;
int64_t qpim_scan_oil_events;
int64_t qpim_scan_oil_last;
int64_t qpim_nexthop_lookups;
-struct list *qpim_static_route_list; /* list of routes added statically */
extern unsigned int qpim_keep_alive_time;
extern signed int qpim_rp_keep_alive_time;
extern int qpim_packet_process;