]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_dump.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / bgpd / bgp_dump.c
index e57f449f781c7891be35d99afcec8b2413d8b316..794dd7b8b65c5a2a8f453844e2aef093a3e5d8fe 100644 (file)
@@ -1,21 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* BGP-4 dump routine
  * Copyright (C) 1999 Kunihiro Ishiguro
- *
- * This file is part of GNU Zebra.
- *
- * GNU Zebra is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2, or (at your option) any
- * later version.
- *
- * GNU Zebra is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; see the file COPYING; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include <zebra.h>
@@ -117,12 +102,16 @@ 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, "bgp_dump_open_file: strftime error");
+               flog_warn(EC_BGP_DUMP, "%s: strftime error", __func__);
                return NULL;
        }
 
@@ -134,7 +123,7 @@ static FILE *bgp_dump_open_file(struct bgp_dump *bgp_dump)
        bgp_dump->fp = fopen(realpath, "w");
 
        if (bgp_dump->fp == NULL) {
-               flog_warn(EC_BGP_DUMP, "bgp_dump_open_file: %s: %s", realpath,
+               flog_warn(EC_BGP_DUMP, "%s: %s: %s", __func__, realpath,
                          strerror(errno));
                umask(oldumask);
                return NULL;
@@ -367,7 +356,7 @@ bgp_dump_route_node_record(int afi, struct bgp_dest *dest,
                stream_putw(obuf, path->peer->table_dump_index);
 
                /* Originated */
-               stream_putl(obuf, time(NULL) - (bgp_clock() - path->uptime));
+               stream_putl(obuf, time(NULL) - (monotime(NULL) - path->uptime));
 
                /*Path Identifier*/
                if (addpath_capable) {
@@ -376,7 +365,7 @@ bgp_dump_route_node_record(int afi, struct bgp_dest *dest,
 
                /* Dump attribute. */
                /* Skip prefix & AFI/SAFI for MP_NLRI */
-               bgp_dump_routes_attr(obuf, path->attr, p);
+               bgp_dump_routes_attr(obuf, path, p);
 
                cur_endp = stream_get_endp(obuf);
                if (cur_endp > BGP_STANDARD_MESSAGE_MAX_PACKET_SIZE
@@ -702,7 +691,7 @@ static int bgp_dump_unset(struct bgp_dump *bgp_dump)
        }
 
        /* Removing interval event. */
-       thread_cancel(&bgp_dump->t_interval);
+       THREAD_OFF(bgp_dump->t_interval);
 
        bgp_dump->interval = 0;