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.c228
-rw-r--r--bgpd/bgp_route.c4
-rw-r--r--bgpd/bgp_routemap.c4
-rw-r--r--debianpkg/control6
-rw-r--r--lib/command.h1
-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/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
-rwxr-xr-xtools/checkpatch.sh9
-rw-r--r--vtysh/vtysh_config.c3
-rw-r--r--zebra/if_netlink.c4
-rw-r--r--zebra/rt_netlink.c12
-rw-r--r--zebra/rule_netlink.c2
34 files changed, 609 insertions, 299 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 268356c7c3..c7c36882af 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -43,6 +43,7 @@
#include "bgpd/bgp_label.h"
#include "bgpd/bgp_evpn.h"
#include "bgpd/bgp_evpn_private.h"
+#include "bgpd/bgp_evpn_vty.h"
#include "bgpd/bgp_vty.h"
#include "bgpd/bgp_flowspec.h"
@@ -217,10 +218,12 @@ static void bgp_debug_list_free(struct list *list)
}
}
-/* Print the desc along with a list of peers/prefixes this debug is
- * enabled for */
+/*
+ * Print the desc along with a list of peers/prefixes this debug is
+ * enabled for
+ */
static void bgp_debug_list_print(struct vty *vty, const char *desc,
- struct list *list, uint8_t evpn_dbg)
+ struct list *list)
{
struct bgp_debug_filter *filter;
struct listnode *node, *nnode;
@@ -234,16 +237,11 @@ static void bgp_debug_list_print(struct vty *vty, const char *desc,
if (filter->host)
vty_out(vty, " %s", filter->host);
- if (filter->p) {
- if (!evpn_dbg) {
- vty_out(vty, " %s",
- prefix2str(filter->p, buf,
- sizeof(buf)));
- } else {
- if (filter->p->family == AF_EVPN)
- bgp_debug_print_evpn_prefix(vty,
- "", filter->p);
- }
+ if (filter->p && filter->p->family == AF_EVPN)
+ bgp_debug_print_evpn_prefix(vty, "", filter->p);
+ else if (filter->p) {
+ prefix2str(filter->p, buf, sizeof(buf));
+ vty_out(vty, " %s", buf);
}
}
}
@@ -251,11 +249,12 @@ static void bgp_debug_list_print(struct vty *vty, const char *desc,
vty_out(vty, "\n");
}
-/* Print the command to enable the debug for each peer/prefix this debug is
+/*
+ * Print the command to enable the debug for each peer/prefix this debug is
* enabled for
*/
static int bgp_debug_list_conf_print(struct vty *vty, const char *desc,
- struct list *list, uint8_t evpn_dbg)
+ struct list *list)
{
struct bgp_debug_filter *filter;
struct listnode *node, *nnode;
@@ -269,19 +268,14 @@ static int bgp_debug_list_conf_print(struct vty *vty, const char *desc,
write++;
}
-
- if (filter->p) {
- if (!evpn_dbg) {
- vty_out(vty, "%s %s\n", desc,
- prefix2str(filter->p, buf,
- sizeof(buf)));
- write++;
- } else {
- if (filter->p->family == AF_EVPN)
- bgp_debug_print_evpn_prefix(vty,
- desc, filter->p);
- write++;
- }
+ if (filter->p && filter->p->family == AF_EVPN) {
+ bgp_debug_print_evpn_prefix(vty, desc,
+ filter->p);
+ write++;
+ } else if (filter->p) {
+ prefix2str(filter->p, buf, sizeof(buf));
+ vty_out(vty, "%s %s\n", desc, buf);
+ write++;
}
}
}
@@ -614,44 +608,32 @@ static int bgp_debug_parse_evpn_prefix(struct vty *vty, struct cmd_token **argv,
argv_p = *argv_pp;
- if (argv_find(argv, argc, "type", &type_idx) == 0)
- return CMD_WARNING;
-
- if (strncmp(argv[type_idx + 1]->arg, "ma", 2) == 0)
+ if (argv_find(argv, argc, "macip", &type_idx))
evpn_type = BGP_EVPN_MAC_IP_ROUTE;
- else if (strncmp(argv[type_idx + 1]->arg, "mu", 2) == 0)
+ else if (argv_find(argv, argc, "multicast", &type_idx))
evpn_type = BGP_EVPN_IMET_ROUTE;
- else if (strncmp(argv[type_idx + 1]->arg, "pr", 2) == 0)
+ else if (argv_find(argv, argc, "prefix", &type_idx))
evpn_type = BGP_EVPN_IP_PREFIX_ROUTE;
else
evpn_type = 0;
if (evpn_type == BGP_EVPN_MAC_IP_ROUTE) {
memset(&ip, 0, sizeof(struct ipaddr));
- /* get the ip if specified */
- if (argv_find(argv, argc, "ip", &ip_idx)) {
- if (str2ipaddr(argv[ip_idx + 1]->arg, &ip) != 0) {
- vty_out(vty, "%% Malformed IP address\n");
- return CMD_WARNING;
- }
- }
+
argv_find(argv, argc, "mac", &mac_idx);
- if (!prefix_str2mac(argv[mac_idx + 1]->arg, &mac)) {
- vty_out(vty, "%% Malformed MAC address\n");
- return CMD_WARNING;
- }
+ prefix_str2mac(argv[mac_idx + 1]->arg, &mac);
+
+ argv_find(argv, argc, "ip", &ip_idx);
+ str2ipaddr(argv[ip_idx + 1]->arg, &ip);
build_evpn_type2_prefix((struct prefix_evpn *)argv_p,
&mac, &ip);
} else if (evpn_type == BGP_EVPN_IMET_ROUTE) {
memset(&ip, 0, sizeof(struct ipaddr));
- /* get the ip if specified */
- if (argv_find(argv, argc, "ip", &ip_idx)) {
- if (str2ipaddr(argv[ip_idx + 1]->arg, &ip) != 0) {
- vty_out(vty, "%% Malformed IP address\n");
- return CMD_WARNING;
- }
- }
+
+ argv_find(argv, argc, "ip", &ip_idx);
+ str2ipaddr(argv[ip_idx + 1]->arg, &ip);
+
build_evpn_type3_prefix((struct prefix_evpn *)argv_p,
ip.ipaddr_v4);
} else if (evpn_type == BGP_EVPN_IP_PREFIX_ROUTE) {
@@ -1398,55 +1380,51 @@ DEFUN (no_debug_bgp_update_direct_peer,
DEFPY (debug_bgp_update_prefix_afi_safi,
debug_bgp_update_prefix_afi_safi_cmd,
- "debug bgp updates prefix <l2vpn>$afi <evpn>$safi type <macip mac WORD [ip WORD]|multicast ip WORD |prefix ip WORD>",
+ "debug bgp updates prefix l2vpn$afi evpn$safi type <macip mac <M:A:C|M:A:C/M> [ip <A.B.C.D|X:X::X:X>]|multicast ip <A.B.C.D|X:X::X:X>|prefix ip <A.B.C.D/M|X:X::X:X/M>>",
DEBUG_STR
BGP_STR
"BGP updates\n"
"Specify a prefix to debug\n"
- "l2vpn\n"
- "evpn\n"
+ L2VPN_HELP_STR
+ EVPN_HELP_STR
"Specify EVPN Route type\n"
"MAC-IP (Type-2) route\n"
- "MAC\n"
- "MAC address (e.g., 00:e0:ec:20:12:62)\n"
- "IP\n"
- "IP address (IPv4 or IPv6)\n"
+ MAC_STR MAC_STR MAC_STR
+ IP_STR
+ "IPv4 address\n"
+ "IPv6 address\n"
"Multicast (Type-3) route\n"
- "IP\n"
- "IP address (IPv4 or IPv6)\n"
+ IP_STR
+ "IPv4 address\n"
+ "IPv6 address\n"
"Prefix (Type-5) route\n"
- "IP\n"
- "Prefix route\n")
+ IP_STR
+ "IPv4 prefix\n"
+ "IPv6 prefix\n")
{
- int idx_ipv4_ipv6_prefixlen = 4;
struct prefix *argv_p;
int ret = CMD_SUCCESS;
- afi_t afiz;
- safi_t safiz;
+ char buf[PREFIX2STR_BUFFER];
argv_p = prefix_new();
- afiz = bgp_vty_afi_from_str(afi);
- safiz = safi ? bgp_vty_safi_from_str(safi) : SAFI_UNICAST;
-
- /* check for evpn route type */
- if (afiz == AFI_L2VPN && safiz == SAFI_EVPN) {
- ret = bgp_debug_parse_evpn_prefix(vty, argv, argc, &argv_p);
- if (ret != CMD_SUCCESS)
- goto cleanup;
- } else {
- (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- apply_mask(argv_p);
+ ret = bgp_debug_parse_evpn_prefix(vty, argv, argc, &argv_p);
+ if (ret != CMD_SUCCESS) {
+ prefix_free(argv_p);
+ return ret;
}
if (!bgp_debug_update_prefixes)
bgp_debug_update_prefixes = list_new();
+ prefix2str(argv_p, buf, sizeof(buf));
+
if (bgp_debug_list_has_entry(bgp_debug_update_prefixes, NULL, argv_p)) {
vty_out(vty,
"BGP updates debugging is already enabled for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
- goto cleanup;
+ buf);
+ prefix_free(argv_p);
+ return CMD_SUCCESS;
}
bgp_debug_list_add_entry(bgp_debug_update_prefixes, NULL, argv_p);
@@ -1455,59 +1433,50 @@ DEFPY (debug_bgp_update_prefix_afi_safi,
DEBUG_ON(update, UPDATE_PREFIX);
} else {
TERM_DEBUG_ON(update, UPDATE_PREFIX);
- vty_out(vty, "BGP updates debugging is on for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ vty_out(vty, "BGP updates debugging is on for %s\n", buf);
}
-cleanup:
prefix_free(argv_p);
- return ret;
+ return CMD_SUCCESS;
}
DEFPY (no_debug_bgp_update_prefix_afi_safi,
no_debug_bgp_update_prefix_afi_safi_cmd,
- "no debug bgp updates prefix <l2vpn>$afi <evpn>$safi type <macip mac WORD [ip WORD]|multicast ip WORD |prefix ip WORD>",
+ "no debug bgp updates prefix l2vpn$afi evpn$safi type <macip mac <M:A:C|M:A:C/M> [ip <A.B.C.D|X:X::X:X>]|multicast ip <A.B.C.D|X:X::X:X>|prefix ip <A.B.C.D/M|X:X::X:X/M>>",
NO_STR
DEBUG_STR
BGP_STR
"BGP updates\n"
"Specify a prefix to debug\n"
- "l2vpn\n"
- "evpn\n"
+ L2VPN_HELP_STR
+ EVPN_HELP_STR
"Specify EVPN Route type\n"
"MAC-IP (Type-2) route\n"
- "MAC\n"
- "MAC address (e.g., 00:e0:ec:20:12:62)\n"
- "IP\n"
- "IP address (IPv4 or IPv6)\n"
+ MAC_STR MAC_STR MAC_STR
+ IP_STR
+ "IPv4 address\n"
+ "IPv6 address\n"
"Multicast (Type-3) route\n"
- "IP\n"
- "IP address (IPv4 or IPv6)\n"
+ IP_STR
+ "IPv4 address\n"
+ "IPv6 address\n"
"Prefix (Type-5) route\n"
- "IP\n"
- "Prefix route\n")
+ IP_STR
+ "IPv4 prefix\n"
+ "IPv6 prefix\n")
{
- int idx_ipv4_ipv6_prefixlen = 5;
struct prefix *argv_p;
- int found_prefix = 0;
+ bool found_prefix = false;
int ret = CMD_SUCCESS;
- afi_t afiz;
- safi_t safiz;
+ char buf[PREFIX2STR_BUFFER];
argv_p = prefix_new();
- afiz = bgp_vty_afi_from_str(afi);
- safiz = safi ? bgp_vty_safi_from_str(safi) : SAFI_UNICAST;
-
- /* check for evpn route type */
- if (afiz == AFI_L2VPN && safiz == SAFI_EVPN) {
- ret = bgp_debug_parse_evpn_prefix(vty, argv, argc, &argv_p);
- if (ret != CMD_SUCCESS)
- goto cleanup;
- } else {
- (void)str2prefix(argv[idx_ipv4_ipv6_prefixlen]->arg, argv_p);
- apply_mask(argv_p);
+ ret = bgp_debug_parse_evpn_prefix(vty, argv, argc, &argv_p);
+ if (ret != CMD_SUCCESS) {
+ prefix_free(argv_p);
+ return ret;
}
if (bgp_debug_update_prefixes
@@ -1526,14 +1495,14 @@ DEFPY (no_debug_bgp_update_prefix_afi_safi,
}
}
+ prefix2str(argv_p, buf, sizeof(buf));
+
if (found_prefix)
- vty_out(vty, "BGP updates debugging is off for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ vty_out(vty, "BGP updates debugging is off for %s\n", buf);
else
vty_out(vty, "BGP updates debugging was not enabled for %s\n",
- argv[idx_ipv4_ipv6_prefixlen]->arg);
+ buf);
-cleanup:
prefix_free(argv_p);
return ret;
@@ -2090,16 +2059,16 @@ DEFUN_NOSH (show_debugging_bgp,
if (BGP_DEBUG(bestpath, BESTPATH))
bgp_debug_list_print(vty, " BGP bestpath debugging is on",
- bgp_debug_bestpath_prefixes, 0);
+ bgp_debug_bestpath_prefixes);
if (BGP_DEBUG(keepalive, KEEPALIVE))
bgp_debug_list_print(vty, " BGP keepalives debugging is on",
- bgp_debug_keepalive_peers, 0);
+ bgp_debug_keepalive_peers);
if (BGP_DEBUG(neighbor_events, NEIGHBOR_EVENTS))
bgp_debug_list_print(vty,
" BGP neighbor-events debugging is on",
- bgp_debug_neighbor_events_peers, 0);
+ bgp_debug_neighbor_events_peers);
if (BGP_DEBUG(nht, NHT))
vty_out(vty, " BGP next-hop tracking debugging is on\n");
@@ -2109,21 +2078,21 @@ DEFUN_NOSH (show_debugging_bgp,
if (BGP_DEBUG(update, UPDATE_PREFIX))
bgp_debug_list_print(vty, " BGP updates debugging is on",
- bgp_debug_update_prefixes, 1);
+ bgp_debug_update_prefixes);
if (BGP_DEBUG(update, UPDATE_IN))
bgp_debug_list_print(vty,
" BGP updates debugging is on (inbound)",
- bgp_debug_update_in_peers, 0);
+ bgp_debug_update_in_peers);
if (BGP_DEBUG(update, UPDATE_OUT))
bgp_debug_list_print(vty,
" BGP updates debugging is on (outbound)",
- bgp_debug_update_out_peers, 0);
+ bgp_debug_update_out_peers);
if (BGP_DEBUG(zebra, ZEBRA))
bgp_debug_list_print(vty, " BGP zebra debugging is on",
- bgp_debug_zebra_prefixes, 0);
+ bgp_debug_zebra_prefixes);
if (BGP_DEBUG(allow_martians, ALLOW_MARTIANS))
vty_out(vty, " BGP allow martian next hop debugging is on\n");
@@ -2229,20 +2198,18 @@ static int bgp_config_write_debug(struct vty *vty)
if (CONF_BGP_DEBUG(bestpath, BESTPATH)) {
write += bgp_debug_list_conf_print(vty, "debug bgp bestpath",
- bgp_debug_bestpath_prefixes,
- 0);
+ bgp_debug_bestpath_prefixes);
}
if (CONF_BGP_DEBUG(keepalive, KEEPALIVE)) {
write += bgp_debug_list_conf_print(vty, "debug bgp keepalives",
- bgp_debug_keepalive_peers,
- 0);
+ bgp_debug_keepalive_peers);
}
if (CONF_BGP_DEBUG(neighbor_events, NEIGHBOR_EVENTS)) {
write += bgp_debug_list_conf_print(
vty, "debug bgp neighbor-events",
- bgp_debug_neighbor_events_peers, 0);
+ bgp_debug_neighbor_events_peers);
}
if (CONF_BGP_DEBUG(nht, NHT)) {
@@ -2258,20 +2225,17 @@ static int bgp_config_write_debug(struct vty *vty)
if (CONF_BGP_DEBUG(update, UPDATE_PREFIX)) {
write += bgp_debug_list_conf_print(vty,
"debug bgp updates prefix",
- bgp_debug_update_prefixes,
- 1);
+ bgp_debug_update_prefixes);
}
if (CONF_BGP_DEBUG(update, UPDATE_IN)) {
write += bgp_debug_list_conf_print(vty, "debug bgp updates in",
- bgp_debug_update_in_peers,
- 0);
+ bgp_debug_update_in_peers);
}
if (CONF_BGP_DEBUG(update, UPDATE_OUT)) {
write += bgp_debug_list_conf_print(vty, "debug bgp updates out",
- bgp_debug_update_out_peers,
- 0);
+ bgp_debug_update_out_peers);
}
if (CONF_BGP_DEBUG(zebra, ZEBRA)) {
@@ -2282,7 +2246,7 @@ static int bgp_config_write_debug(struct vty *vty)
} else {
write += bgp_debug_list_conf_print(
vty, "debug bgp zebra prefix",
- bgp_debug_zebra_prefixes, 0);
+ bgp_debug_zebra_prefixes);
}
}
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index bb9abd0bcf..b66a913f54 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);
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/debianpkg/control b/debianpkg/control
index 468581045b..71c412a960 100644
--- a/debianpkg/control
+++ b/debianpkg/control
@@ -4,7 +4,7 @@ Priority: optional
Maintainer: Nobody <nobody@frrouting.org>
Uploaders: Nobody <nobody@frrouting.org>
XSBC-Original-Maintainer: <maintainers@frrouting.org>
-Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), autotools-dev, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson-c-dev, libjson-c2 | libjson-c3, dh-systemd, libsystemd-dev, bison, flex, libc-ares-dev, pkg-config, python (>= 2.7), python-ipaddr, python-sphinx, libpython-dev
+Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), autotools-dev, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson-c-dev, libjson-c2 | libjson-c3, dh-systemd, libsystemd-dev, bison, flex, libc-ares-dev, pkg-config, python (>= 2.7), python-ipaddr, python-sphinx, libpython-dev, install-info
Standards-Version: 3.9.6
Homepage: http://www.frrouting.org/
@@ -29,9 +29,9 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, frr (= ${binary:Version})
Priority: extra
Section: debug
Description: BGP/OSPF/RIP/RIPng/ISIS/PIM/LDP routing daemon (debug symbols)
- This package provides debugging symbols for all binary packages built
+ This package provides debugging symbols for all binary packages built
from frr source package. It's highly recommended to have this package
- installed before reporting any FRR crashes to either FRR developers or
+ installed before reporting any FRR crashes to either FRR developers or
Debian package maintainers.
Package: frr-doc
diff --git a/lib/command.h b/lib/command.h
index 2d333b098a..a001a90e2e 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -338,6 +338,7 @@ struct cmd_node {
#define UNDEBUG_STR "Disable debugging functions (see also 'debug')\n"
#define ROUTER_STR "Enable a routing process\n"
#define AS_STR "AS number\n"
+#define MAC_STR "MAC address\n"
#define MBGP_STR "MBGP information\n"
#define MATCH_STR "Match values from routing table\n"
#define SET_STR "Set values in destination routing protocol\n"
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/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/tools/checkpatch.sh b/tools/checkpatch.sh
index e1fb529d35..6071f4804d 100755
--- a/tools/checkpatch.sh
+++ b/tools/checkpatch.sh
@@ -72,12 +72,13 @@ else
echo "Done."
for file in ${tmp1}/*_cp; do
if [ -a ${tmp2}/$(basename $file) ]; then
- result=$(diff $file ${tmp2}/$(basename $file) | grep -A3 "ERROR\|WARNING" | grep -A2 -B2 "${tmp1}")
+ result=$(diff $file ${tmp2}/$(basename $file) | awk '/< ERROR|< WARNING/,/^< $|^< #|^<[^ ]/ { print $0; ++n }; END { exit n }')
else
- result=$(cat $file | grep -A3 "ERROR\|WARNING" | grep -A2 -B2 "${tmp1}")
+ result=$(cat $file | awk '/ERROR|WARNING/,/^$/ { print $0; ++n }; END { exit n }')
fi
- if [ "$?" -eq "0" ]; then
- echo "Report for $(basename $file _cp)" 1>&2
+ ni="$?"
+ if [ "$ni" -ne "0" ]; then
+ echo "Report for $(basename $file _cp) | $ni issues" 1>&2
echo "===============================================" 1>&2
echo "$result" 1>&2
if echo $result | grep -q "ERROR"; then
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/if_netlink.c b/zebra/if_netlink.c
index 66e98e2e51..56e27e6dc8 100644
--- a/zebra/if_netlink.c
+++ b/zebra/if_netlink.c
@@ -893,7 +893,7 @@ int netlink_interface_addr(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if (ifa->ifa_family != AF_INET && ifa->ifa_family != AF_INET6) {
zlog_warn(
- "Invalid address family: %d received from kernel interface addr change: %d",
+ "Invalid address family: %u received from kernel interface addr change: %u",
ifa->ifa_family, h->nlmsg_type);
return 0;
}
@@ -1133,7 +1133,7 @@ int netlink_link_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
if (!(ifi->ifi_family == AF_UNSPEC || ifi->ifi_family == AF_BRIDGE
|| ifi->ifi_family == AF_INET6)) {
zlog_warn(
- "Invalid address family: %d received from kernel link change: %d",
+ "Invalid address family: %u received from kernel link change: %u",
ifi->ifi_family, h->nlmsg_type);
return 0;
}
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index 5facfa5faa..4a13fbc8e1 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -763,11 +763,9 @@ int netlink_route_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
return 0;
}
- if (!(rtm->rtm_family == AF_INET || rtm->rtm_family == AF_INET6
- || rtm->rtm_family == AF_ETHERNET
- || rtm->rtm_family == AF_MPLS)) {
+ if (!(rtm->rtm_family == AF_INET || rtm->rtm_family == AF_INET6)) {
zlog_warn(
- "Invalid address family: %d received from kernel route change: %d",
+ "Invalid address family: %u received from kernel route change: %u",
rtm->rtm_family, h->nlmsg_type);
return 0;
}
@@ -780,10 +778,6 @@ int netlink_route_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
nl_rttype_to_str(rtm->rtm_type),
nl_rtproto_to_str(rtm->rtm_protocol), ns_id);
- /* We don't care about change notifications for the MPLS table. */
- /* TODO: Revisit this. */
- if (rtm->rtm_family == AF_MPLS)
- return 0;
len = h->nlmsg_len - NLMSG_LENGTH(sizeof(struct rtmsg));
if (len < 0) {
@@ -2422,7 +2416,7 @@ int netlink_neigh_change(struct nlmsghdr *h, ns_id_t ns_id)
return netlink_ipneigh_change(h, len, ns_id);
else {
zlog_warn(
- "Invalid address family: %d received from kernel neighbor change: %d",
+ "Invalid address family: %u received from kernel neighbor change: %u",
ndm->ndm_family, h->nlmsg_type);
return 0;
}
diff --git a/zebra/rule_netlink.c b/zebra/rule_netlink.c
index d683e92bcc..87d3769a5a 100644
--- a/zebra/rule_netlink.c
+++ b/zebra/rule_netlink.c
@@ -206,7 +206,7 @@ int netlink_rule_change(struct nlmsghdr *h, ns_id_t ns_id, int startup)
frh = NLMSG_DATA(h);
if (frh->family != AF_INET && frh->family != AF_INET6) {
zlog_warn(
- "Invalid address family: %d received from kernel rule change: %d",
+ "Invalid address family: %u received from kernel rule change: %u",
frh->family, h->nlmsg_type);
return 0;
}