summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_clist.c192
-rw-r--r--bgpd/bgp_community.c261
-rw-r--r--bgpd/bgp_community.h22
-rw-r--r--bgpd/bgp_debug.c16
-rw-r--r--bgpd/bgp_evpn_vty.c24
-rw-r--r--bgpd/bgp_flowspec_vty.c2
-rw-r--r--bgpd/bgp_route.c11
-rw-r--r--bgpd/bgp_routemap.c4
-rw-r--r--bgpd/bgp_table.c6
-rw-r--r--bgpd/bgp_updgrp_adv.c4
-rw-r--r--lib/routemap.c9
-rw-r--r--lib/routemap.h6
-rw-r--r--lib/stream.c12
-rw-r--r--lib/vrf.h1
-rw-r--r--ospf6d/ospf6_asbr.c3
-rw-r--r--ospfd/ospf_lsa.c2
-rw-r--r--ospfd/ospfd.c3
-rw-r--r--pimd/pim_bfd.c8
-rw-r--r--pimd/pim_bfd.h2
-rw-r--r--pimd/pim_iface.c16
-rw-r--r--pimd/pim_igmp_join.h2
-rw-r--r--pimd/pim_instance.c4
-rw-r--r--pimd/pim_msdp.c21
-rw-r--r--pimd/pim_neighbor.c3
-rw-r--r--pimd/pim_routemap.c3
-rw-r--r--pimd/pim_rp.c10
-rw-r--r--pimd/pim_sock.c21
-rw-r--r--pimd/pim_sock.h2
-rw-r--r--pimd/pim_ssm.c7
-rw-r--r--pimd/pim_upstream.c7
-rw-r--r--pimd/pim_vty.c18
-rw-r--r--pimd/pimd.c2
-rw-r--r--vtysh/vtysh_config.c3
-rw-r--r--zebra/kernel_netlink.c1
34 files changed, 522 insertions, 186 deletions
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index b2f34dd968..fec4397b73 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -346,6 +346,36 @@ static char *community_str_get(struct community *com, int i)
case COMMUNITY_INTERNET:
len = strlen(" internet");
break;
+ case COMMUNITY_GSHUT:
+ len = strlen(" graceful-shutdown");
+ break;
+ case COMMUNITY_ACCEPT_OWN:
+ len = strlen(" accept-own");
+ break;
+ case COMMUNITY_ROUTE_FILTER_TRANSLATED_v4:
+ len = strlen(" route-filter-translated-v4");
+ break;
+ case COMMUNITY_ROUTE_FILTER_v4:
+ len = strlen(" route-filter-v4");
+ break;
+ case COMMUNITY_ROUTE_FILTER_TRANSLATED_v6:
+ len = strlen(" route-filter-translated-v6");
+ break;
+ case COMMUNITY_ROUTE_FILTER_v6:
+ len = strlen(" route-filter-v6");
+ break;
+ case COMMUNITY_LLGR_STALE:
+ len = strlen(" llgr-stale");
+ break;
+ case COMMUNITY_NO_LLGR:
+ len = strlen(" no-llgr");
+ break;
+ case COMMUNITY_ACCEPT_OWN_NEXTHOP:
+ len = strlen(" accept-own-nexthop");
+ break;
+ case COMMUNITY_BLACKHOLE:
+ len = strlen(" blackhole");
+ break;
case COMMUNITY_NO_EXPORT:
len = strlen(" no-export");
break;
@@ -355,8 +385,8 @@ static char *community_str_get(struct community *com, int i)
case COMMUNITY_LOCAL_AS:
len = strlen(" local-AS");
break;
- case COMMUNITY_GSHUT:
- len = strlen(" graceful-shutdown");
+ case COMMUNITY_NO_PEER:
+ len = strlen(" no-peer");
break;
default:
len = strlen(" 65536:65535");
@@ -371,6 +401,46 @@ static char *community_str_get(struct community *com, int i)
strcpy(pnt, "internet");
pnt += strlen("internet");
break;
+ case COMMUNITY_GSHUT:
+ strcpy(pnt, "graceful-shutdown");
+ pnt += strlen("graceful-shutdown");
+ break;
+ case COMMUNITY_ACCEPT_OWN:
+ strcpy(pnt, "accept-own");
+ pnt += strlen("accept-own");
+ break;
+ case COMMUNITY_ROUTE_FILTER_TRANSLATED_v4:
+ strcpy(pnt, "route-filter-translated-v4");
+ pnt += strlen("route-filter-translated-v4");
+ break;
+ case COMMUNITY_ROUTE_FILTER_v4:
+ strcpy(pnt, "route-filter-v4");
+ pnt += strlen("route-filter-v4");
+ break;
+ case COMMUNITY_ROUTE_FILTER_TRANSLATED_v6:
+ strcpy(pnt, "route-filter-translated-v6");
+ pnt += strlen("route-filter-translated-v6");
+ break;
+ case COMMUNITY_ROUTE_FILTER_v6:
+ strcpy(pnt, "route-filter-v6");
+ pnt += strlen("route-filter-v6");
+ break;
+ case COMMUNITY_LLGR_STALE:
+ strcpy(pnt, "llgr-stale");
+ pnt += strlen("llgr-stale");
+ break;
+ case COMMUNITY_NO_LLGR:
+ strcpy(pnt, "no-llgr");
+ pnt += strlen("no-llgr");
+ break;
+ case COMMUNITY_ACCEPT_OWN_NEXTHOP:
+ strcpy(pnt, "accept-own-nexthop");
+ pnt += strlen("accept-own-nexthop");
+ break;
+ case COMMUNITY_BLACKHOLE:
+ strcpy(pnt, "blackhole");
+ pnt += strlen("blackhole");
+ break;
case COMMUNITY_NO_EXPORT:
strcpy(pnt, "no-export");
pnt += strlen("no-export");
@@ -383,9 +453,9 @@ static char *community_str_get(struct community *com, int i)
strcpy(pnt, "local-AS");
pnt += strlen("local-AS");
break;
- case COMMUNITY_GSHUT:
- strcpy(pnt, "graceful-shutdown");
- pnt += strlen("graceful-shutdown");
+ case COMMUNITY_NO_PEER:
+ strcpy(pnt, "no-peer");
+ pnt += strlen("no-peer");
break;
default:
as = (comval >> 16) & 0xFFFF;
@@ -547,47 +617,77 @@ static int ecommunity_regexp_match(struct ecommunity *ecom, regex_t *reg)
static struct community *
community_regexp_delete (struct community *com, regex_t * reg)
{
- int i;
- uint32_t comval;
- /* Maximum is "65535:65535" + '\0'. */
- char c[12];
- const char *str;
-
- if (!com)
- return NULL;
-
- i = 0;
- while (i < com->size)
- {
- memcpy (&comval, com_nthval (com, i), sizeof (uint32_t));
- comval = ntohl (comval);
-
- switch (comval)
- {
- case COMMUNITY_INTERNET:
- str = "internet";
- break;
- case COMMUNITY_NO_EXPORT:
- str = "no-export";
- break;
- case COMMUNITY_NO_ADVERTISE:
- str = "no-advertise";
- break;
- case COMMUNITY_LOCAL_AS:
- str = "local-AS";
- break;
- default:
- sprintf (c, "%d:%d", (comval >> 16) & 0xFFFF, comval & 0xFFFF);
- str = c;
- break;
- }
-
- if (regexec (reg, str, 0, NULL, 0) == 0)
- community_del_val (com, com_nthval (com, i));
- else
- i++;
- }
- return com;
+ int i;
+ uint32_t comval;
+ /* Maximum is "65535:65535" + '\0'. */
+ char c[12];
+ const char *str;
+
+ if (!com)
+ return NULL;
+
+ i = 0;
+ while (i < com->size)
+ {
+ memcpy (&comval, com_nthval (com, i), sizeof (uint32_t));
+ comval = ntohl (comval);
+
+ switch (comval) {
+ case COMMUNITY_INTERNET:
+ str = "internet";
+ break;
+ case COMMUNITY_ACCEPT_OWN:
+ str = "accept-own";
+ break;
+ case COMMUNITY_ROUTE_FILTER_TRANSLATED_v4:
+ str = "route-filter-translated-v4";
+ break;
+ case COMMUNITY_ROUTE_FILTER_v4:
+ str = "route-filter-v4";
+ break;
+ case COMMUNITY_ROUTE_FILTER_TRANSLATED_v6:
+ str = "route-filter-translated-v6";
+ break;
+ case COMMUNITY_ROUTE_FILTER_v6:
+ str = "route-filter-v6";
+ break;
+ case COMMUNITY_LLGR_STALE:
+ str = "llgr-stale";
+ break;
+ case COMMUNITY_NO_LLGR:
+ str = "no-llgr";
+ break;
+ case COMMUNITY_ACCEPT_OWN_NEXTHOP:
+ str = "accept-own-nexthop";
+ break;
+ case COMMUNITY_BLACKHOLE:
+ str = "blackhole";
+ break;
+ case COMMUNITY_NO_EXPORT:
+ str = "no-export";
+ break;
+ case COMMUNITY_NO_ADVERTISE:
+ str = "no-advertise";
+ break;
+ case COMMUNITY_LOCAL_AS:
+ str = "local-AS";
+ break;
+ case COMMUNITY_NO_PEER:
+ str = "no-peer";
+ break;
+ default:
+ sprintf (c, "%d:%d", (comval >> 16) & 0xFFFF,
+ comval & 0xFFFF);
+ str = c;
+ break;
+ }
+
+ if (regexec (reg, str, 0, NULL, 0) == 0)
+ community_del_val (com, com_nthval (com, i));
+ else
+ i++;
+ }
+ return com;
}
#endif
diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c
index 9170481769..e40674d635 100644
--- a/bgpd/bgp_community.c
+++ b/bgpd/bgp_community.c
@@ -188,10 +188,20 @@ struct community *community_uniq_sort(struct community *com)
For Well-known communities value, below keyword is used.
0x0 "internet"
+ 0xFFFF0000 "graceful-shutdown"
+ 0xFFFF0001 "accept-own"
+ 0xFFFF0002 "route-filter-translated-v4"
+ 0xFFFF0003 "route-filter-v4"
+ 0xFFFF0004 "route-filter-translated-v6"
+ 0xFFFF0005 "route-filter-v6"
+ 0xFFFF0006 "llgr-stale"
+ 0xFFFF0007 "no-llgr"
+ 0xFFFF0008 "accept-own-nexthop"
+ 0xFFFF029A "blackhole"
0xFFFFFF01 "no-export"
0xFFFFFF02 "no-advertise"
0xFFFFFF03 "local-AS"
- 0xFFFF0000 "graceful-shutdown"
+ 0xFFFFFF04 "no-peer"
For other values, "AS:VAL" format is used. */
static void set_community_string(struct community *com, bool make_json)
@@ -241,6 +251,36 @@ static void set_community_string(struct community *com, bool make_json)
case COMMUNITY_INTERNET:
len += strlen(" internet");
break;
+ case COMMUNITY_GSHUT:
+ len += strlen(" graceful-shutdown");
+ break;
+ case COMMUNITY_ACCEPT_OWN:
+ len += strlen(" accept-own");
+ break;
+ case COMMUNITY_ROUTE_FILTER_TRANSLATED_v4:
+ len += strlen(" route-filter-translated-v4");
+ break;
+ case COMMUNITY_ROUTE_FILTER_v4:
+ len += strlen(" route-filter-v4");
+ break;
+ case COMMUNITY_ROUTE_FILTER_TRANSLATED_v6:
+ len += strlen(" route-filter-translated-v6");
+ break;
+ case COMMUNITY_ROUTE_FILTER_v6:
+ len += strlen(" route-filter-v6");
+ break;
+ case COMMUNITY_LLGR_STALE:
+ len += strlen(" llgr-stale");
+ break;
+ case COMMUNITY_NO_LLGR:
+ len += strlen(" no-llgr");
+ break;
+ case COMMUNITY_ACCEPT_OWN_NEXTHOP:
+ len += strlen(" accept-own-nexthop");
+ break;
+ case COMMUNITY_BLACKHOLE:
+ len += strlen(" blackhole");
+ break;
case COMMUNITY_NO_EXPORT:
len += strlen(" no-export");
break;
@@ -250,8 +290,8 @@ static void set_community_string(struct community *com, bool make_json)
case COMMUNITY_LOCAL_AS:
len += strlen(" local-AS");
break;
- case COMMUNITY_GSHUT:
- len += strlen(" graceful-shutdown");
+ case COMMUNITY_NO_PEER:
+ len += strlen(" no-peer");
break;
default:
len += strlen(" 65536:65535");
@@ -284,6 +324,106 @@ static void set_community_string(struct community *com, bool make_json)
json_string);
}
break;
+ case COMMUNITY_GSHUT:
+ strcpy(pnt, "graceful-shutdown");
+ pnt += strlen("graceful-shutdown");
+ if (make_json) {
+ json_string = json_object_new_string(
+ "gracefulShutdown");
+ json_object_array_add(json_community_list,
+ json_string);
+ }
+ break;
+ case COMMUNITY_ACCEPT_OWN:
+ strcpy(pnt, "accept-own");
+ pnt += strlen("accept-own");
+ if (make_json) {
+ json_string = json_object_new_string(
+ "acceptown");
+ json_object_array_add(json_community_list,
+ json_string);
+ }
+ break;
+ case COMMUNITY_ROUTE_FILTER_TRANSLATED_v4:
+ strcpy(pnt, "route-filter-translated-v4");
+ pnt += strlen("route-filter-translated-v4");
+ if (make_json) {
+ json_string = json_object_new_string(
+ "routeFilterTranslatedV4");
+ json_object_array_add(json_community_list,
+ json_string);
+ }
+ break;
+ case COMMUNITY_ROUTE_FILTER_v4:
+ strcpy(pnt, "route-filter-v4");
+ pnt += strlen("route-filter-v4");
+ if (make_json) {
+ json_string = json_object_new_string(
+ "routeFilterV4");
+ json_object_array_add(json_community_list,
+ json_string);
+ }
+ break;
+ case COMMUNITY_ROUTE_FILTER_TRANSLATED_v6:
+ strcpy(pnt, "route-filter-translated-v6");
+ pnt += strlen("route-filter-translated-v6");
+ if (make_json) {
+ json_string = json_object_new_string(
+ "routeFilterTranslatedV6");
+ json_object_array_add(json_community_list,
+ json_string);
+ }
+ break;
+ case COMMUNITY_ROUTE_FILTER_v6:
+ strcpy(pnt, "route-filter-v6");
+ pnt += strlen("route-filter-v6");
+ if (make_json) {
+ json_string = json_object_new_string(
+ "routeFilterV6");
+ json_object_array_add(json_community_list,
+ json_string);
+ }
+ break;
+ case COMMUNITY_LLGR_STALE:
+ strcpy(pnt, "llgr-stale");
+ pnt += strlen("llgr-stale");
+ if (make_json) {
+ json_string = json_object_new_string(
+ "llgrStale");
+ json_object_array_add(json_community_list,
+ json_string);
+ }
+ break;
+ case COMMUNITY_NO_LLGR:
+ strcpy(pnt, "no-llgr");
+ pnt += strlen("no-llgr");
+ if (make_json) {
+ json_string = json_object_new_string(
+ "noLlgr");
+ json_object_array_add(json_community_list,
+ json_string);
+ }
+ break;
+ case COMMUNITY_ACCEPT_OWN_NEXTHOP:
+ strcpy(pnt, "accept-own-nexthop");
+ pnt += strlen("accept-own-nexthop");
+ if (make_json) {
+ json_string = json_object_new_string(
+ "acceptownnexthop");
+ json_object_array_add(json_community_list,
+ json_string);
+ }
+ break;
+ case COMMUNITY_BLACKHOLE:
+ strcpy(pnt, "blackhole");
+ pnt += strlen("blackhole");
+ if (make_json) {
+ json_string = json_object_new_string(
+ "blackhole");
+ json_object_array_add(json_community_list,
+ json_string);
+ }
+ break;
case COMMUNITY_NO_EXPORT:
strcpy(pnt, "no-export");
pnt += strlen("no-export");
@@ -313,12 +453,11 @@ static void set_community_string(struct community *com, bool make_json)
json_string);
}
break;
- case COMMUNITY_GSHUT:
- strcpy(pnt, "graceful-shutdown");
- pnt += strlen("graceful-shutdown");
+ case COMMUNITY_NO_PEER:
+ strcpy(pnt, "no-peer");
+ pnt += strlen("no-peer");
if (make_json) {
- json_string = json_object_new_string(
- "gracefulShutdown");
+ json_string = json_object_new_string("noPeer");
json_object_array_add(json_community_list,
json_string);
}
@@ -508,10 +647,20 @@ struct community *community_merge(struct community *com1,
/* Community token enum. */
enum community_token {
community_token_val,
+ community_token_gshut,
+ community_token_accept_own,
+ community_token_route_filter_translated_v4,
+ community_token_route_filter_v4,
+ community_token_route_filter_translated_v6,
+ community_token_route_filter_v6,
+ community_token_llgr_stale,
+ community_token_no_llgr,
+ community_token_accept_own_nexthop,
+ community_token_blackhole,
community_token_no_export,
community_token_no_advertise,
community_token_local_as,
- community_token_gshut,
+ community_token_no_peer,
community_token_unknown
};
@@ -537,6 +686,79 @@ community_gettoken(const char *buf, enum community_token *token, uint32_t *val)
p += strlen("internet");
return p;
}
+ if (strncmp(p, "graceful-shutdown", strlen("graceful-shutdown"))
+ == 0) {
+ *val = COMMUNITY_GSHUT;
+ *token = community_token_gshut;
+ p += strlen("graceful-shutdown");
+ return p;
+ }
+ if (strncmp(p, "accept-own", strlen("accept-own"))
+ == 0) {
+ *val = COMMUNITY_ACCEPT_OWN;
+ *token = community_token_accept_own;
+ p += strlen("accept-own");
+ return p;
+ }
+ if (strncmp(p, "route-filter-translated-v4",
+ strlen("route-filter-translated-v4"))
+ == 0) {
+ *val = COMMUNITY_ROUTE_FILTER_TRANSLATED_v4;
+ *token = community_token_route_filter_translated_v4;
+ p += strlen("route-filter-translated-v4");
+ return p;
+ }
+ if (strncmp(p, "route-filter-v4", strlen("route-filter-v4"))
+ == 0) {
+ *val = COMMUNITY_ROUTE_FILTER_v4;
+ *token = community_token_route_filter_v4;
+ p += strlen("route-filter-v4");
+ return p;
+ }
+ if (strncmp(p, "route-filter-translated-v6",
+ strlen("route-filter-translated-v6"))
+ == 0) {
+ *val = COMMUNITY_ROUTE_FILTER_TRANSLATED_v6;
+ *token = community_token_route_filter_translated_v6;
+ p += strlen("route-filter-translated-v6");
+ return p;
+ }
+ if (strncmp(p, "route-filter-v6", strlen("route-filter-v6"))
+ == 0) {
+ *val = COMMUNITY_ROUTE_FILTER_v6;
+ *token = community_token_route_filter_v6;
+ p += strlen("route-filter-v6");
+ return p;
+ }
+ if (strncmp(p, "llgr-stale", strlen("llgr-stale"))
+ == 0) {
+ *val = COMMUNITY_LLGR_STALE;
+ *token = community_token_llgr_stale;
+ p += strlen("llgr-stale");
+ return p;
+ }
+ if (strncmp(p, "no-llgr", strlen("no-llgr"))
+ == 0) {
+ *val = COMMUNITY_NO_LLGR;
+ *token = community_token_no_llgr;
+ p += strlen("no-llgr");
+ return p;
+ }
+ if (strncmp(p, "accept-own-nexthop",
+ strlen("accept-own-nexthop"))
+ == 0) {
+ *val = COMMUNITY_ACCEPT_OWN_NEXTHOP;
+ *token = community_token_accept_own_nexthop;
+ p += strlen("accept-own-nexthop");
+ return p;
+ }
+ if (strncmp(p, "blackhole", strlen("blackhole"))
+ == 0) {
+ *val = COMMUNITY_BLACKHOLE;
+ *token = community_token_blackhole;
+ p += strlen("blackhole");
+ return p;
+ }
if (strncmp(p, "no-export", strlen("no-export")) == 0) {
*val = COMMUNITY_NO_EXPORT;
*token = community_token_no_export;
@@ -555,11 +777,10 @@ community_gettoken(const char *buf, enum community_token *token, uint32_t *val)
p += strlen("local-AS");
return p;
}
- if (strncmp(p, "graceful-shutdown", strlen("graceful-shutdown"))
- == 0) {
- *val = COMMUNITY_GSHUT;
- *token = community_token_gshut;
- p += strlen("graceful-shutdown");
+ if (strncmp(p, "no-peer", strlen("no-peer")) == 0) {
+ *val = COMMUNITY_NO_PEER;
+ *token = community_token_no_peer;
+ p += strlen("no-peer");
return p;
}
@@ -631,10 +852,20 @@ struct community *community_str2com(const char *str)
switch (token) {
case community_token_val:
+ case community_token_gshut:
+ case community_token_accept_own:
+ case community_token_route_filter_translated_v4:
+ case community_token_route_filter_v4:
+ case community_token_route_filter_translated_v6:
+ case community_token_route_filter_v6:
+ case community_token_llgr_stale:
+ case community_token_no_llgr:
+ case community_token_accept_own_nexthop:
+ case community_token_blackhole:
case community_token_no_export:
case community_token_no_advertise:
case community_token_local_as:
- case community_token_gshut:
+ case community_token_no_peer:
if (com == NULL) {
com = community_new();
com->json = NULL;
diff --git a/bgpd/bgp_community.h b/bgpd/bgp_community.h
index c180bea465..61af9f038c 100644
--- a/bgpd/bgp_community.h
+++ b/bgpd/bgp_community.h
@@ -43,12 +43,22 @@ struct community {
};
/* Well-known communities value. */
-#define COMMUNITY_INTERNET 0x0
-#define COMMUNITY_NO_EXPORT 0xFFFFFF01
-#define COMMUNITY_NO_ADVERTISE 0xFFFFFF02
-#define COMMUNITY_NO_EXPORT_SUBCONFED 0xFFFFFF03
-#define COMMUNITY_LOCAL_AS 0xFFFFFF03
-#define COMMUNITY_GSHUT 0xFFFF0000
+#define COMMUNITY_INTERNET 0x0
+#define COMMUNITY_GSHUT 0xFFFF0000
+#define COMMUNITY_ACCEPT_OWN 0xFFFF0001
+#define COMMUNITY_ROUTE_FILTER_TRANSLATED_v4 0xFFFF0002
+#define COMMUNITY_ROUTE_FILTER_v4 0xFFFF0003
+#define COMMUNITY_ROUTE_FILTER_TRANSLATED_v6 0xFFFF0004
+#define COMMUNITY_ROUTE_FILTER_v6 0xFFFF0005
+#define COMMUNITY_LLGR_STALE 0xFFFF0006
+#define COMMUNITY_NO_LLGR 0xFFFF0007
+#define COMMUNITY_ACCEPT_OWN_NEXTHOP 0xFFFF0008
+#define COMMUNITY_BLACKHOLE 0xFFFF029A
+#define COMMUNITY_NO_EXPORT 0xFFFFFF01
+#define COMMUNITY_NO_ADVERTISE 0xFFFFFF02
+#define COMMUNITY_NO_EXPORT_SUBCONFED 0xFFFFFF03
+#define COMMUNITY_LOCAL_AS 0xFFFFFF03
+#define COMMUNITY_NO_PEER 0xFFFFFF04
/* Macros of community attribute. */
#define com_length(X) ((X)->size * 4)
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index 1e95a887bc..268356c7c3 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -1433,7 +1433,7 @@ DEFPY (debug_bgp_update_prefix_afi_safi,
if (afiz == AFI_L2VPN && safiz == SAFI_EVPN) {
ret = bgp_debug_parse_evpn_prefix(vty, argv, argc, &argv_p);
if (ret != CMD_SUCCESS)
- return ret;
+ goto cleanup;
} else {
(void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
apply_mask(argv_p);
@@ -1446,7 +1446,7 @@ DEFPY (debug_bgp_update_prefix_afi_safi,
vty_out(vty,
"BGP updates debugging is already enabled for %s\n",
argv[idx_ipv4_ipv6_prefixlen]->arg);
- return CMD_SUCCESS;
+ goto cleanup;
}
bgp_debug_list_add_entry(bgp_debug_update_prefixes, NULL, argv_p);
@@ -1459,7 +1459,10 @@ DEFPY (debug_bgp_update_prefix_afi_safi,
argv[idx_ipv4_ipv6_prefixlen]->arg);
}
- return CMD_SUCCESS;
+cleanup:
+ prefix_free(argv_p);
+
+ return ret;
}
DEFPY (no_debug_bgp_update_prefix_afi_safi,
@@ -1501,7 +1504,7 @@ DEFPY (no_debug_bgp_update_prefix_afi_safi,
if (afiz == AFI_L2VPN && safiz == SAFI_EVPN) {
ret = bgp_debug_parse_evpn_prefix(vty, argv, argc, &argv_p);
if (ret != CMD_SUCCESS)
- return ret;
+ goto cleanup;
} else {
(void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
apply_mask(argv_p);
@@ -1530,7 +1533,10 @@ DEFPY (no_debug_bgp_update_prefix_afi_safi,
vty_out(vty, "BGP updates debugging was not enabled for %s\n",
argv[idx_ipv4_ipv6_prefixlen]->arg);
- return CMD_SUCCESS;
+cleanup:
+ prefix_free(argv_p);
+
+ return ret;
}
diff --git a/bgpd/bgp_evpn_vty.c b/bgpd/bgp_evpn_vty.c
index 5a4ebc9b17..b45c1a99db 100644
--- a/bgpd/bgp_evpn_vty.c
+++ b/bgpd/bgp_evpn_vty.c
@@ -2807,9 +2807,6 @@ DEFUN (bgp_evpn_advertise_default_gw_vni,
if (!bgp)
return CMD_WARNING;
- if (!vpn)
- return CMD_WARNING;
-
evpn_set_advertise_default_gw(bgp, vpn);
return CMD_SUCCESS;
@@ -2827,9 +2824,6 @@ DEFUN (no_bgp_evpn_advertise_default_vni_gw,
if (!bgp)
return CMD_WARNING;
- if (!vpn)
- return CMD_WARNING;
-
evpn_unset_advertise_default_gw(bgp, vpn);
return CMD_SUCCESS;
@@ -2972,9 +2966,6 @@ DEFUN_HIDDEN (bgp_evpn_advertise_vni_subnet,
if (!bgp)
return CMD_WARNING;
- if (!vpn)
- return CMD_WARNING;
-
bgp_vrf = bgp_lookup_by_vrf_id(vpn->tenant_vrf_id);
if (!bgp_vrf)
return CMD_WARNING;
@@ -2995,9 +2986,6 @@ DEFUN_HIDDEN (no_bgp_evpn_advertise_vni_subnet,
if (!bgp)
return CMD_WARNING;
- if (!vpn)
- return CMD_WARNING;
-
evpn_unset_advertise_subnet(bgp, vpn);
return CMD_SUCCESS;
}
@@ -4225,7 +4213,7 @@ DEFUN (bgp_evpn_vni_rd,
VTY_DECLVAR_CONTEXT_SUB(bgpevpn, vpn);
int ret;
- if (!bgp || !vpn)
+ if (!bgp)
return CMD_WARNING;
if (bgp->vrf_id != VRF_DEFAULT) {
@@ -4261,7 +4249,7 @@ DEFUN (no_bgp_evpn_vni_rd,
VTY_DECLVAR_CONTEXT_SUB(bgpevpn, vpn);
int ret;
- if (!bgp || !vpn)
+ if (!bgp)
return CMD_WARNING;
if (bgp->vrf_id != VRF_DEFAULT) {
@@ -4301,7 +4289,7 @@ DEFUN (no_bgp_evpn_vni_rd_without_val,
struct bgp *bgp = VTY_GET_CONTEXT(bgp);
VTY_DECLVAR_CONTEXT_SUB(bgpevpn, vpn);
- if (!bgp || !vpn)
+ if (!bgp)
return CMD_WARNING;
if (bgp->vrf_id != VRF_DEFAULT) {
@@ -4630,7 +4618,7 @@ DEFUN (bgp_evpn_vni_rt,
int rt_type;
struct ecommunity *ecomadd = NULL;
- if (!bgp || !vpn)
+ if (!bgp)
return CMD_WARNING;
if (bgp->vrf_id != VRF_DEFAULT) {
@@ -4698,7 +4686,7 @@ DEFUN (no_bgp_evpn_vni_rt,
int rt_type, found_ecomdel;
struct ecommunity *ecomdel = NULL;
- if (!bgp || !vpn)
+ if (!bgp)
return CMD_WARNING;
if (bgp->vrf_id != VRF_DEFAULT) {
@@ -4797,7 +4785,7 @@ DEFUN (no_bgp_evpn_vni_rt_without_val,
VTY_DECLVAR_CONTEXT_SUB(bgpevpn, vpn);
int rt_type;
- if (!bgp || !vpn)
+ if (!bgp)
return CMD_WARNING;
if (bgp->vrf_id != VRF_DEFAULT) {
diff --git a/bgpd/bgp_flowspec_vty.c b/bgpd/bgp_flowspec_vty.c
index ace888c78d..f8c0613208 100644
--- a/bgpd/bgp_flowspec_vty.c
+++ b/bgpd/bgp_flowspec_vty.c
@@ -357,7 +357,7 @@ void route_vty_out_flowspec(struct vty *vty, struct prefix *p,
if (unit)
vty_out(vty, ")");
vty_out(vty, "\n");
- list_delete_all_node(list_bpm);
+ list_delete_and_null(&list_bpm);
} else
vty_out(vty, "\tnot installed in PBR\n");
}
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 4bbc535cdc..c1bc204df2 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -5201,8 +5201,8 @@ int bgp_static_set_safi(afi_t afi, safi_t safi, struct vty *vty,
if (routermac) {
bgp_static->router_mac =
XCALLOC(MTYPE_ATTR, ETH_ALEN + 1);
- prefix_str2mac(routermac,
- bgp_static->router_mac);
+ (void)prefix_str2mac(routermac,
+ bgp_static->router_mac);
}
if (gwip)
prefix_copy(&bgp_static->gatewayIp, &gw_ip);
@@ -7737,13 +7737,6 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct prefix *p,
else
vty_out(vty, ", localpref %u",
attr->local_pref);
- } else {
- if (json_paths)
- json_object_int_add(json_path, "localpref",
- bgp->default_local_pref);
- else
- vty_out(vty, ", localpref %u",
- bgp->default_local_pref);
}
if (attr->weight != 0) {
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 903018b2a2..bee4fca705 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -4810,9 +4810,5 @@ void bgp_route_map_init(void)
void bgp_route_map_terminate(void)
{
/* ToDo: Cleanup all the used memory */
-
- route_map_add_hook(NULL);
- route_map_delete_hook(NULL);
- route_map_event_hook(NULL);
route_map_finish();
}
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c
index 94e2d83cfe..234553b6ea 100644
--- a/bgpd/bgp_table.c
+++ b/bgpd/bgp_table.c
@@ -144,9 +144,6 @@ void bgp_table_range_lookup(const struct bgp_table *table, struct prefix *p,
struct bgp_node *node = bgp_node_from_rnode(table->route_table->top);
struct bgp_node *matched = NULL;
- if (node == NULL)
- return;
-
while (node && node->p.prefixlen <= p->prefixlen
&& prefix_match(&node->p, p)) {
if (node->info && node->p.prefixlen == p->prefixlen) {
@@ -157,6 +154,9 @@ void bgp_table_range_lookup(const struct bgp_table *table, struct prefix *p,
&p->u.prefix, node->p.prefixlen)]);
}
+ if (node == NULL)
+ return;
+
if ((matched == NULL && node->p.prefixlen > maxlen) || !node->parent)
return;
else if (matched == NULL)
diff --git a/bgpd/bgp_updgrp_adv.c b/bgpd/bgp_updgrp_adv.c
index f44e95a50a..6ffb1d448b 100644
--- a/bgpd/bgp_updgrp_adv.c
+++ b/bgpd/bgp_updgrp_adv.c
@@ -663,7 +663,7 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
{
struct bgp *bgp;
struct attr attr;
- struct bgp_info *info, init_info;
+ struct bgp_info *info, init_info, tmp_info;
struct prefix p;
struct peer *from;
struct bgp_node *rn;
@@ -713,8 +713,6 @@ void subgroup_default_originate(struct update_subgroup *subgrp, int withdraw)
for (rn = bgp_table_top(bgp->rib[afi][safi]); rn;
rn = bgp_route_next(rn)) {
for (ri = rn->info; ri; ri = ri->next) {
- struct bgp_info tmp_info;
-
tmp_info.peer = ri->peer;
tmp_info.attr = ri->attr;
diff --git a/lib/routemap.c b/lib/routemap.c
index 6c4585365a..4e8682f312 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -2741,6 +2741,15 @@ void route_map_finish(void)
vector_free(route_set_vec);
route_set_vec = NULL;
+ /*
+ * All protocols are setting these to NULL
+ * by default on shutdown( route_map_finish )
+ * Why are we making them do this work?
+ */
+ route_map_master.add_hook = NULL;
+ route_map_master.delete_hook = NULL;
+ route_map_master.event_hook = NULL;
+
/* cleanup route_map */
while (route_map_master.head) {
struct route_map *map = route_map_master.head;
diff --git a/lib/routemap.h b/lib/routemap.h
index 0f7c391f84..a193e32536 100644
--- a/lib/routemap.h
+++ b/lib/routemap.h
@@ -169,6 +169,12 @@ DECLARE_QOBJ_TYPE(route_map)
/* Prototypes. */
extern void route_map_init(void);
+
+/*
+ * This should only be called on shutdown
+ * Additionally this function sets the hooks to NULL
+ * before any processing is done.
+ */
extern void route_map_finish(void);
/* Add match statement to route map. */
diff --git a/lib/stream.c b/lib/stream.c
index a172eedc99..cf9af4d3bb 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -100,16 +100,12 @@ struct stream *stream_new(size_t size)
assert(size > 0);
- s = XCALLOC(MTYPE_STREAM, sizeof(struct stream));
+ s = XMALLOC(MTYPE_STREAM, sizeof(struct stream));
- if (s == NULL)
- return s;
-
- if ((s->data = XMALLOC(MTYPE_STREAM_DATA, size)) == NULL) {
- XFREE(MTYPE_STREAM, s);
- return NULL;
- }
+ s->data = XMALLOC(MTYPE_STREAM_DATA, size);
+ s->getp = s->endp = 0;
+ s->next = NULL;
s->size = size;
return s;
}
diff --git a/lib/vrf.h b/lib/vrf.h
index 88536eada8..0f4f36be50 100644
--- a/lib/vrf.h
+++ b/lib/vrf.h
@@ -120,7 +120,6 @@ extern vrf_id_t vrf_name_to_id(const char *);
} else { \
vty_out(vty, "%% VRF %s not found\n", NAME); \
} \
- vty_out(vty, "%% VRF %s not found\n", NAME); \
return CMD_WARNING; \
} \
if (vrf->vrf_id == VRF_UNKNOWN) { \
diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c
index e6bd3faf40..5af88defeb 100644
--- a/ospf6d/ospf6_asbr.c
+++ b/ospf6d/ospf6_asbr.c
@@ -1861,9 +1861,6 @@ void ospf6_asbr_redistribute_reset(void)
void ospf6_asbr_terminate(void)
{
/* Cleanup route maps */
- route_map_add_hook(NULL);
- route_map_delete_hook(NULL);
- route_map_event_hook(NULL);
route_map_finish();
}
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index 502f233036..4165338834 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -1921,7 +1921,7 @@ struct ospf_lsa *ospf_translated_nssa_refresh(struct ospf *ospf,
zlog_debug(
"ospf_translated_nssa_refresh(): Could not install "
"translated LSA, Id %s",
- type7 ? inet_ntoa(type7->data->id) : "(null)");
+ inet_ntoa(type7->data->id));
return NULL;
}
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index f315421843..2298c2261a 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -561,9 +561,6 @@ void ospf_terminate(void)
ospf_finish(ospf);
/* Cleanup route maps */
- route_map_add_hook(NULL);
- route_map_delete_hook(NULL);
- route_map_event_hook(NULL);
route_map_finish();
/* reverse prefix_list_init */
diff --git a/pimd/pim_bfd.c b/pimd/pim_bfd.c
index f5772174ba..4a3cf715da 100644
--- a/pimd/pim_bfd.c
+++ b/pimd/pim_bfd.c
@@ -99,9 +99,9 @@ void pim_bfd_info_nbr_create(struct pim_interface *pim_ifp,
/*
* pim_bfd_info_free - Free BFD info structure
*/
-void pim_bfd_info_free(void **bfd_info)
+void pim_bfd_info_free(struct bfd_info **bfd_info)
{
- bfd_info_free((struct bfd_info **)bfd_info);
+ bfd_info_free(bfd_info);
}
static void pim_bfd_reg_dereg_nbr(struct pim_neighbor *nbr, int command)
@@ -151,7 +151,7 @@ int pim_bfd_reg_dereg_all_nbr(struct interface *ifp, int command)
if (command != ZEBRA_BFD_DEST_DEREGISTER)
pim_bfd_info_nbr_create(pim_ifp, neigh);
else
- bfd_info_free((struct bfd_info **)&neigh->bfd_info);
+ pim_bfd_info_free((struct bfd_info **)&neigh->bfd_info);
pim_bfd_reg_dereg_nbr(neigh, command);
}
@@ -170,7 +170,7 @@ void pim_bfd_trigger_event(struct pim_interface *pim_ifp,
pim_bfd_info_nbr_create(pim_ifp, nbr);
pim_bfd_reg_dereg_nbr(nbr, ZEBRA_BFD_DEST_REGISTER);
} else {
- pim_bfd_info_free((void *)&nbr->bfd_info);
+ pim_bfd_info_free(&nbr->bfd_info);
pim_bfd_reg_dereg_nbr(nbr, ZEBRA_BFD_DEST_DEREGISTER);
}
}
diff --git a/pimd/pim_bfd.h b/pimd/pim_bfd.h
index 0dfd80839f..83def93b66 100644
--- a/pimd/pim_bfd.h
+++ b/pimd/pim_bfd.h
@@ -36,5 +36,5 @@ void pim_bfd_trigger_event(struct pim_interface *pim_ifp,
struct pim_neighbor *nbr, uint8_t nbr_up);
void pim_bfd_info_nbr_create(struct pim_interface *pim_ifp,
struct pim_neighbor *neigh);
-void pim_bfd_info_free(void **bfd_info);
+void pim_bfd_info_free(struct bfd_info **bfd_info);
#endif /* _PIM_BFD_H */
diff --git a/pimd/pim_iface.c b/pimd/pim_iface.c
index e075ff5ac2..e79e91d7df 100644
--- a/pimd/pim_iface.c
+++ b/pimd/pim_iface.c
@@ -46,6 +46,7 @@
#include "pim_rp.h"
#include "pim_nht.h"
#include "pim_jp_agg.h"
+#include "pim_igmp_join.h"
static void pim_if_igmp_join_del_all(struct interface *ifp);
static int igmp_join_sock(const char *ifname, ifindex_t ifindex,
@@ -1194,8 +1195,18 @@ static int igmp_join_sock(const char *ifname, ifindex_t ifindex,
return -1;
}
- if (pim_socket_join_source(join_fd, ifindex, group_addr, source_addr,
- ifname)) {
+ if (pim_igmp_join_source(join_fd, ifindex, group_addr, source_addr)) {
+ char group_str[INET_ADDRSTRLEN];
+ char source_str[INET_ADDRSTRLEN];
+ pim_inet4_dump("<grp?>", group_addr, group_str,
+ sizeof(group_str));
+ pim_inet4_dump("<src?>", source_addr, source_str,
+ sizeof(source_str));
+ zlog_warn(
+ "%s: setsockopt(fd=%d) failure for IGMP group %s source %s ifindex %d on interface %s: errno=%d: %s",
+ __PRETTY_FUNCTION__, join_fd, group_str, source_str,
+ ifindex, ifname, errno, safe_strerror(errno));
+
close(join_fd);
return -2;
}
@@ -1219,6 +1230,7 @@ static struct igmp_join *igmp_join_new(struct interface *ifp,
if (join_fd < 0) {
char group_str[INET_ADDRSTRLEN];
char source_str[INET_ADDRSTRLEN];
+
pim_inet4_dump("<grp?>", group_addr, group_str,
sizeof(group_str));
pim_inet4_dump("<src?>", source_addr, source_str,
diff --git a/pimd/pim_igmp_join.h b/pimd/pim_igmp_join.h
index abee080064..88385bffba 100644
--- a/pimd/pim_igmp_join.h
+++ b/pimd/pim_igmp_join.h
@@ -60,8 +60,6 @@ static int pim_igmp_join_source(int fd, ifindex_t ifindex,
return setsockopt(fd, SOL_IP, MCAST_JOIN_SOURCE_GROUP, &req,
sizeof(req));
-
- return 0;
}
#endif /* PIM_IGMP_JOIN_H */
diff --git a/pimd/pim_instance.c b/pimd/pim_instance.c
index 5121dc94ca..e664bf3062 100644
--- a/pimd/pim_instance.c
+++ b/pimd/pim_instance.c
@@ -54,10 +54,10 @@ static void pim_instance_terminate(struct pim_instance *pim)
pim->rpf_hash = NULL;
}
- pim_oil_terminate(pim);
-
pim_if_terminate(pim);
+ pim_oil_terminate(pim);
+
pim_msdp_exit(pim);
XFREE(MTYPE_PIM_PIM_INSTANCE, pim);
diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c
index 951e743494..4910cb8b38 100644
--- a/pimd/pim_msdp.c
+++ b/pimd/pim_msdp.c
@@ -1242,8 +1242,10 @@ static int pim_msdp_peer_comp(const void *p1, const void *p2)
}
/************************** Mesh group management **************************/
-static void pim_msdp_mg_free(struct pim_instance *pim, struct pim_msdp_mg *mg)
+static void pim_msdp_mg_free(struct pim_instance *pim)
{
+ struct pim_msdp_mg *mg = pim->msdp.mg;
+
/* If the mesh-group has valid member or src_ip don't delete it */
if (!mg || mg->mbr_cnt || (mg->src_ip.s_addr != INADDR_ANY)) {
return;
@@ -1258,8 +1260,7 @@ static void pim_msdp_mg_free(struct pim_instance *pim, struct pim_msdp_mg *mg)
if (mg->mbr_list)
list_delete_and_null(&mg->mbr_list);
- XFREE(MTYPE_PIM_MSDP_MG, mg);
- pim->msdp.mg = NULL;
+ XFREE(MTYPE_PIM_MSDP_MG, pim->msdp.mg);
}
static struct pim_msdp_mg *pim_msdp_mg_new(const char *mesh_group_name)
@@ -1299,7 +1300,7 @@ enum pim_msdp_err pim_msdp_mg_del(struct pim_instance *pim,
mg->src_ip.s_addr = INADDR_ANY;
/* free up the mesh-group */
- pim_msdp_mg_free(pim, mg);
+ pim_msdp_mg_free(pim);
return PIM_MSDP_ERR_NONE;
}
@@ -1438,7 +1439,7 @@ enum pim_msdp_err pim_msdp_mg_mbr_del(struct pim_instance *pim,
pim_msdp_mg_mbr_do_del(mg, mbr);
/* if there are no references to the mg free it */
- pim_msdp_mg_free(pim, mg);
+ pim_msdp_mg_free(pim);
return PIM_MSDP_ERR_NONE;
}
@@ -1475,7 +1476,7 @@ enum pim_msdp_err pim_msdp_mg_src_del(struct pim_instance *pim,
mg->src_ip.s_addr = INADDR_ANY;
pim_msdp_mg_src_do_del(pim);
/* if there are no references to the mg free it */
- pim_msdp_mg_free(pim, mg);
+ pim_msdp_mg_free(pim);
}
return PIM_MSDP_ERR_NONE;
}
@@ -1598,7 +1599,10 @@ void pim_msdp_exit(struct pim_instance *pim)
/* XXX: stop listener and delete all peer sessions */
+ pim_msdp_mg_free(pim);
+
if (pim->msdp.peer_hash) {
+ hash_clean(pim->msdp.peer_hash, NULL);
hash_free(pim->msdp.peer_hash);
pim->msdp.peer_hash = NULL;
}
@@ -1608,6 +1612,7 @@ void pim_msdp_exit(struct pim_instance *pim)
}
if (pim->msdp.sa_hash) {
+ hash_clean(pim->msdp.sa_hash, NULL);
hash_free(pim->msdp.sa_hash);
pim->msdp.sa_hash = NULL;
}
@@ -1615,4 +1620,8 @@ void pim_msdp_exit(struct pim_instance *pim)
if (pim->msdp.sa_list) {
list_delete_and_null(&pim->msdp.sa_list);
}
+
+ if (pim->msdp.work_obuf)
+ stream_free(pim->msdp.work_obuf);
+ pim->msdp.work_obuf = NULL;
}
diff --git a/pimd/pim_neighbor.c b/pimd/pim_neighbor.c
index 2730f5e7aa..e73422331f 100644
--- a/pimd/pim_neighbor.c
+++ b/pimd/pim_neighbor.c
@@ -409,6 +409,9 @@ void pim_neighbor_free(struct pim_neighbor *neigh)
list_delete_and_null(&neigh->upstream_jp_agg);
THREAD_OFF(neigh->jp_timer);
+ if (neigh->bfd_info)
+ pim_bfd_info_free(&neigh->bfd_info);
+
XFREE(MTYPE_PIM_NEIGHBOR, neigh);
}
diff --git a/pimd/pim_routemap.c b/pimd/pim_routemap.c
index b41124376f..4230c127ad 100644
--- a/pimd/pim_routemap.c
+++ b/pimd/pim_routemap.c
@@ -52,8 +52,5 @@ void pim_route_map_init(void)
void pim_route_map_terminate(void)
{
- route_map_add_hook(NULL);
- route_map_delete_hook(NULL);
- route_map_event_hook(NULL);
route_map_finish();
}
diff --git a/pimd/pim_rp.c b/pimd/pim_rp.c
index c1623ec15e..783f931752 100644
--- a/pimd/pim_rp.c
+++ b/pimd/pim_rp.c
@@ -62,6 +62,9 @@ void pim_rp_list_hash_clean(void *data)
static void pim_rp_info_free(struct rp_info *rp_info)
{
+ if (rp_info->plist)
+ XFREE(MTYPE_PIM_FILTER_NAME, rp_info->plist);
+
XFREE(MTYPE_PIM_RP, rp_info);
}
@@ -600,7 +603,6 @@ int pim_rp_del(struct pim_instance *pim, const char *rp,
if (rp_info->plist) {
XFREE(MTYPE_PIM_FILTER_NAME, rp_info->plist);
- rp_info->plist = NULL;
was_plist = true;
}
@@ -852,9 +854,9 @@ struct pim_rpf *pim_rp_g(struct pim_instance *pim, struct in_addr group)
__PRETTY_FUNCTION__, buf, buf1);
}
pim_rpf_set_refresh_time(pim);
- pim_ecmp_nexthop_lookup(pim,
- &rp_info->rp.source_nexthop,
- &nht_p, &rp_info->group, 1);
+ (void)pim_ecmp_nexthop_lookup(
+ pim, &rp_info->rp.source_nexthop, &nht_p,
+ &rp_info->group, 1);
}
return (&rp_info->rp);
}
diff --git a/pimd/pim_sock.c b/pimd/pim_sock.c
index 8f311391e1..fb0d6b5064 100644
--- a/pimd/pim_sock.c
+++ b/pimd/pim_sock.c
@@ -38,7 +38,6 @@
#include "pim_mroute.h"
#include "pim_sock.h"
#include "pim_str.h"
-#include "pim_igmp_join.h"
/* GLOBAL VARS */
@@ -322,26 +321,6 @@ int pim_socket_join(int fd, struct in_addr group, struct in_addr ifaddr,
return ret;
}
-int pim_socket_join_source(int fd, ifindex_t ifindex, struct in_addr group_addr,
- struct in_addr source_addr, const char *ifname)
-{
- if (pim_igmp_join_source(fd, ifindex, group_addr, source_addr)) {
- char group_str[INET_ADDRSTRLEN];
- char source_str[INET_ADDRSTRLEN];
- pim_inet4_dump("<grp?>", group_addr, group_str,
- sizeof(group_str));
- pim_inet4_dump("<src?>", source_addr, source_str,
- sizeof(source_str));
- zlog_warn(
- "%s: setsockopt(fd=%d) failure for IGMP group %s source %s ifindex %d on interface %s: errno=%d: %s",
- __PRETTY_FUNCTION__, fd, group_str, source_str, ifindex,
- ifname, errno, safe_strerror(errno));
- return -1;
- }
-
- return 0;
-}
-
int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
struct sockaddr_in *from, socklen_t *fromlen,
struct sockaddr_in *to, socklen_t *tolen,
diff --git a/pimd/pim_sock.h b/pimd/pim_sock.h
index 98db6fecd7..08b0099321 100644
--- a/pimd/pim_sock.h
+++ b/pimd/pim_sock.h
@@ -42,8 +42,6 @@ int pim_socket_mcast(int protocol, struct in_addr ifaddr, struct interface *ifp,
uint8_t loop);
int pim_socket_join(int fd, struct in_addr group, struct in_addr ifaddr,
ifindex_t ifindex);
-int pim_socket_join_source(int fd, ifindex_t ifindex, struct in_addr group_addr,
- struct in_addr source_addr, const char *ifname);
int pim_socket_recvfromto(int fd, uint8_t *buf, size_t len,
struct sockaddr_in *from, socklen_t *fromlen,
struct sockaddr_in *to, socklen_t *tolen,
diff --git a/pimd/pim_ssm.c b/pimd/pim_ssm.c
index d35f5cff7e..1f7cfcaa91 100644
--- a/pimd/pim_ssm.c
+++ b/pimd/pim_ssm.c
@@ -146,6 +146,11 @@ void *pim_ssm_init(void)
void pim_ssm_terminate(struct pim_ssm *ssm)
{
- if (ssm && ssm->plist_name)
+ if (!ssm)
+ return;
+
+ if (ssm->plist_name)
XFREE(MTYPE_PIM_FILTER_NAME, ssm->plist_name);
+
+ XFREE(MTYPE_PIM_SSM_INFO, ssm);
}
diff --git a/pimd/pim_upstream.c b/pimd/pim_upstream.c
index e3488b6a66..db89125a98 100644
--- a/pimd/pim_upstream.c
+++ b/pimd/pim_upstream.c
@@ -192,7 +192,8 @@ struct pim_upstream *pim_upstream_del(struct pim_instance *pim,
up->rpf.source_nexthop.interface = NULL;
if (up->sg.src.s_addr != INADDR_ANY) {
- wheel_remove_item(pim->upstream_sg_wheel, up);
+ if (pim->upstream_sg_wheel)
+ wheel_remove_item(pim->upstream_sg_wheel, up);
notify_msdp = true;
}
@@ -1546,6 +1547,10 @@ void pim_upstream_terminate(struct pim_instance *pim)
if (pim->upstream_hash)
hash_free(pim->upstream_hash);
pim->upstream_hash = NULL;
+
+ if (pim->upstream_sg_wheel)
+ wheel_delete(pim->upstream_sg_wheel);
+ pim->upstream_sg_wheel = NULL;
}
int pim_upstream_equal(const void *arg1, const void *arg2)
diff --git a/pimd/pim_vty.c b/pimd/pim_vty.c
index 862b2cc148..f4d833c26f 100644
--- a/pimd/pim_vty.c
+++ b/pimd/pim_vty.c
@@ -313,15 +313,6 @@ int pim_interface_config_write(struct vty *vty)
++writes;
}
- /* IF ip igmp query-interval */
- if (pim_ifp->igmp_default_query_interval
- != IGMP_GENERAL_QUERY_INTERVAL) {
- vty_out(vty,
- " ip igmp query-interval %d\n",
- pim_ifp->igmp_default_query_interval);
- ++writes;
- }
-
/* IF ip igmp query-max-response-time */
if (pim_ifp->igmp_query_max_response_time_dsec
!= IGMP_QUERY_MAX_RESPONSE_TIME_DSEC) {
@@ -331,6 +322,15 @@ int pim_interface_config_write(struct vty *vty)
++writes;
}
+ /* IF ip igmp query-interval */
+ if (pim_ifp->igmp_default_query_interval
+ != IGMP_GENERAL_QUERY_INTERVAL) {
+ vty_out(vty,
+ " ip igmp query-interval %d\n",
+ pim_ifp->igmp_default_query_interval);
+ ++writes;
+ }
+
/* IF ip igmp join */
if (pim_ifp->igmp_join_list) {
struct listnode *node;
diff --git a/pimd/pimd.c b/pimd/pimd.c
index 5f87102626..cb7b8b589a 100644
--- a/pimd/pimd.c
+++ b/pimd/pimd.c
@@ -79,8 +79,6 @@ static void pim_free()
pim_route_map_terminate();
zclient_lookup_free();
-
- zprivs_terminate(&pimd_privs);
}
void pim_init()
diff --git a/vtysh/vtysh_config.c b/vtysh/vtysh_config.c
index 5516d73f4e..52ab28dfda 100644
--- a/vtysh/vtysh_config.c
+++ b/vtysh/vtysh_config.c
@@ -179,6 +179,9 @@ void vtysh_config_parse_line(void *arg, const char *line)
strlen(" ip multicast boundary"))
== 0) {
config_add_line_end(config->line, line);
+ } else if (strncmp(line, " ip igmp query-interval",
+ strlen(" ip igmp query-interval")) == 0) {
+ config_add_line_end(config->line, line);
} else if (config->index == LINK_PARAMS_NODE
&& strncmp(line, " exit-link-params",
strlen(" exit"))
diff --git a/zebra/kernel_netlink.c b/zebra/kernel_netlink.c
index c627bda4f7..a5c2cd69f3 100644
--- a/zebra/kernel_netlink.c
+++ b/zebra/kernel_netlink.c
@@ -1085,6 +1085,7 @@ void kernel_init(struct zebra_ns *zns)
if (nl_rcvbufsize)
netlink_recvbuf(&zns->netlink, nl_rcvbufsize);
+ assert(zns->netlink.sock >= 0);
netlink_install_filter(zns->netlink.sock,
zns->netlink_cmd.snl.nl_pid);
zns->t_netlink = NULL;