summaryrefslogtreecommitdiffstats
path: root/bgpd
diff options
context:
space:
mode:
authorDonald Sharp <donaldsharp72@gmail.com>2023-01-31 15:01:32 +0100
committerGitHub <noreply@github.com>2023-01-31 15:01:32 +0100
commitea768492f1499830292eec0a31b968e045d598f1 (patch)
tree7c1319f14ca28f5fd7b5ef79bd259b0ec9a1db9e /bgpd
parentMerge pull request #12710 from opensourcerouting/fix/reset_fqdn_capability_on... (diff)
parentbuild: enable format string warnings (diff)
downloadfrr-ea768492f1499830292eec0a31b968e045d598f1.tar.xz
frr-ea768492f1499830292eec0a31b968e045d598f1.zip
Merge pull request #12695 from opensourcerouting/format-warnings
build: `-Wformat-nonliteral -Wformat-security`
Diffstat (limited to 'bgpd')
-rw-r--r--bgpd/bgp_aspath.c10
-rw-r--r--bgpd/bgp_aspath.h3
-rw-r--r--bgpd/bgp_dump.c4
-rw-r--r--bgpd/bgp_route.c10
-rw-r--r--bgpd/bgp_vty.c4
-rw-r--r--bgpd/rfapi/rfapi_vty.c1
6 files changed, 16 insertions, 16 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 85f09ccf0..2ae693cd3 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -2122,16 +2122,12 @@ const char *aspath_print(struct aspath *as)
}
/* Printing functions */
-/* Feed the AS_PATH to the vty; the suffix string follows it only in case
+/* Feed the AS_PATH to the vty; the space suffix follows it only in case
* AS_PATH wasn't empty.
*/
-void aspath_print_vty(struct vty *vty, const char *format, struct aspath *as,
- const char *suffix)
+void aspath_print_vty(struct vty *vty, struct aspath *as)
{
- assert(format);
- vty_out(vty, format, as->str);
- if (as->str_len && strlen(suffix))
- vty_out(vty, "%s", suffix);
+ vty_out(vty, "%s%s", as->str, as->str_len ? " " : "");
}
static void aspath_show_all_iterator(struct hash_bucket *bucket,
diff --git a/bgpd/bgp_aspath.h b/bgpd/bgp_aspath.h
index 97bc7c0ac..a814d73dd 100644
--- a/bgpd/bgp_aspath.h
+++ b/bgpd/bgp_aspath.h
@@ -104,8 +104,7 @@ extern void aspath_free(struct aspath *aspath);
extern struct aspath *aspath_intern(struct aspath *aspath);
extern void aspath_unintern(struct aspath **aspath);
extern const char *aspath_print(struct aspath *aspath);
-extern void aspath_print_vty(struct vty *vty, const char *format,
- struct aspath *aspath, const char *suffix);
+extern void aspath_print_vty(struct vty *vty, struct aspath *aspath);
extern void aspath_print_all_vty(struct vty *vty);
extern unsigned int aspath_key_make(const void *p);
extern unsigned int aspath_get_first_as(struct aspath *aspath);
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c
index 254996eda..98a2f95ea 100644
--- a/bgpd/bgp_dump.c
+++ b/bgpd/bgp_dump.c
@@ -117,9 +117,13 @@ static FILE *bgp_dump_open_file(struct bgp_dump *bgp_dump)
if (bgp_dump->filename[0] != DIRECTORY_SEP) {
snprintf(fullpath, sizeof(fullpath), "%s/%s", vty_get_cwd(),
bgp_dump->filename);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
+ /* user supplied date/time format string */
ret = strftime(realpath, MAXPATHLEN, fullpath, &tm);
} else
ret = strftime(realpath, MAXPATHLEN, bgp_dump->filename, &tm);
+#pragma GCC diagnostic pop
if (ret == 0) {
flog_warn(EC_BGP_DUMP, "%s: strftime error", __func__);
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index 3efc92aaa..c9cfc44da 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -9453,7 +9453,7 @@ void route_vty_out(struct vty *vty, const struct prefix *p,
json_object_string_add(json_path, "path",
attr->aspath->str);
else
- aspath_print_vty(vty, "%s", attr->aspath, " ");
+ aspath_print_vty(vty, attr->aspath);
}
/* Print origin */
@@ -9671,7 +9671,7 @@ CPP_NOTICE("Drop `bgpOriginCodes` from JSON outputs")
/* Print aspath */
if (attr->aspath)
- aspath_print_vty(vty, "%s", attr->aspath, " ");
+ aspath_print_vty(vty, attr->aspath);
/* Print origin */
vty_out(vty, "%s", bgp_origin_str[attr->origin]);
@@ -9938,7 +9938,7 @@ static void damp_route_vty_out(struct vty *vty, const struct prefix *p,
use_json, NULL));
if (attr->aspath)
- aspath_print_vty(vty, "%s", attr->aspath, " ");
+ aspath_print_vty(vty, attr->aspath);
vty_out(vty, "%s", bgp_origin_str[attr->origin]);
@@ -10015,7 +10015,7 @@ static void flap_route_vty_out(struct vty *vty, const struct prefix *p,
vty_out(vty, "%*s ", 8, " ");
if (attr->aspath)
- aspath_print_vty(vty, "%s", attr->aspath, " ");
+ aspath_print_vty(vty, attr->aspath);
vty_out(vty, "%s", bgp_origin_str[attr->origin]);
@@ -10299,7 +10299,7 @@ void route_vty_out_detail(struct vty *vty, struct bgp *bgp, struct bgp_dest *bn,
attr->aspath->json);
} else {
if (attr->aspath->segments)
- aspath_print_vty(vty, " %s", attr->aspath, "");
+ vty_out(vty, " %s", attr->aspath->str);
else
vty_out(vty, " Local");
}
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 5738d9ef6..d837601f3 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -12002,7 +12002,7 @@ static void bgp_show_neighbor_graceful_restart_remote_mode(struct vty *vty,
if (json)
json_object_string_add(json, "remoteGrMode", mode);
else
- vty_out(vty, mode, "\n");
+ vty_out(vty, "%s\n", mode);
}
static void bgp_show_neighbor_graceful_restart_local_mode(struct vty *vty,
@@ -12034,7 +12034,7 @@ static void bgp_show_neighbor_graceful_restart_local_mode(struct vty *vty,
if (json)
json_object_string_add(json, "localGrMode", mode);
else
- vty_out(vty, mode, "\n");
+ vty_out(vty, "%s\n", mode);
}
static void bgp_show_neighbor_graceful_restart_capability_per_afi_safi(
diff --git a/bgpd/rfapi/rfapi_vty.c b/bgpd/rfapi/rfapi_vty.c
index 719d898e3..d04d1ee75 100644
--- a/bgpd/rfapi/rfapi_vty.c
+++ b/bgpd/rfapi/rfapi_vty.c
@@ -322,6 +322,7 @@ int rfapiDebugPrintf(void *dummy, const char *format, ...)
return 0;
}
+PRINTFRR(2, 3)
static int rfapiStdioPrintf(void *stream, const char *format, ...)
{
FILE *file = NULL;