]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_flowspec.c
Merge pull request #3444 from donaldsharp/adj_stuff
[mirror_frr.git] / bgpd / bgp_flowspec.c
index 6695596c6f6b372906f7ffecceb7b0a7ae5fad89..ab8bfcb770c708268db3dcb21a91e1dbd85a433f 100644 (file)
@@ -18,9 +18,9 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "math.h"
-
 #include <zebra.h>
+#include <math.h>
+
 #include "prefix.h"
 #include "lib_errors.h"
 
@@ -104,15 +104,14 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
        safi = packet->safi;
 
        if (afi == AFI_IP6) {
-               flog_err(LIB_ERR_DEVELOPMENT,
-                         "BGP flowspec IPv6 not supported");
+               flog_err(EC_LIB_DEVELOPMENT, "BGP flowspec IPv6 not supported");
                return -1;
        }
 
        if (packet->length >= FLOWSPEC_NLRI_SIZELIMIT) {
-               flog_err(BGP_ERR_FLOWSPEC_PACKET,
-                         "BGP flowspec nlri length maximum reached (%u)",
-                         packet->length);
+               flog_err(EC_BGP_FLOWSPEC_PACKET,
+                        "BGP flowspec nlri length maximum reached (%u)",
+                        packet->length);
                return -1;
        }
 
@@ -128,14 +127,16 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
 
                /* When packet overflow occur return immediately. */
                if (pnt + psize > lim) {
-                       flog_err(BGP_ERR_FLOWSPEC_PACKET,
-                                 "Flowspec NLRI length inconsistent ( size %u seen)",
-                                 psize);
+                       flog_err(
+                               EC_BGP_FLOWSPEC_PACKET,
+                               "Flowspec NLRI length inconsistent ( size %u seen)",
+                               psize);
                        return -1;
                }
                if (bgp_fs_nlri_validate(pnt, psize) < 0) {
-                       flog_err(BGP_ERR_FLOWSPEC_PACKET,
-                                 "Bad flowspec format or NLRI options not supported");
+                       flog_err(
+                               EC_BGP_FLOWSPEC_PACKET,
+                               "Bad flowspec format or NLRI options not supported");
                        return -1;
                }
                p.family = AF_FLOWSPEC;
@@ -148,7 +149,7 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
 
                if (BGP_DEBUG(flowspec, FLOWSPEC)) {
                        char return_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
-                       char local_string[BGP_FLOWSPEC_NLRI_STRING_MAX * 2];
+                       char local_string[BGP_FLOWSPEC_NLRI_STRING_MAX*2+16];
                        char ec_string[BGP_FLOWSPEC_NLRI_STRING_MAX];
                        char *s = NULL;
 
@@ -188,9 +189,9 @@ int bgp_nlri_parse_flowspec(struct peer *peer, struct attr *attr,
                                           ZEBRA_ROUTE_BGP, BGP_ROUTE_NORMAL,
                                           NULL, NULL, 0, NULL);
                if (ret) {
-                       flog_err(BGP_ERR_FLOWSPEC_INSTALLATION,
-                                 "Flowspec NLRI failed to be %s.",
-                                 attr ? "added" : "withdrawn");
+                       flog_err(EC_BGP_FLOWSPEC_INSTALLATION,
+                                "Flowspec NLRI failed to be %s.",
+                                attr ? "added" : "withdrawn");
                        return -1;
                }
        }