]> git.proxmox.com Git - mirror_frr.git/blobdiff - bgpd/bgp_btoa.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / bgpd / bgp_btoa.c
index cc37e352ef9a96e536194fc224fbbefbacbb7dcd..fc3363b098e705402a2060134b8413d6dcd1a7ca 100644 (file)
@@ -1,21 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
 /* BGP dump to ascii converter
  * 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>
@@ -68,7 +53,7 @@ enum MRT_MSG_TYPES {
        MSG_TABLE_DUMP            /* routing table dump */
 };
 
-static int attr_parse(struct stream *s, uint16_t len)
+static void attr_parse(struct stream *s, uint16_t len)
 {
        unsigned int flag;
        unsigned int type;
@@ -77,7 +62,7 @@ static int attr_parse(struct stream *s, uint16_t len)
 
        lim = s->getp + len;
 
-       printf("attr_parse s->getp %zd, len %d, lim %d\n", s->getp, len, lim);
+       printf("%s s->getp %zd, len %d, lim %d\n", __func__, s->getp, len, lim);
 
        while (s->getp < lim) {
                flag = stream_getc(s);
@@ -101,22 +86,21 @@ static int attr_parse(struct stream *s, uint16_t len)
                case BGP_ATTR_AS_PATH: {
                        struct aspath *aspath;
 
-                       aspath = aspath_parse(s, length, 1);
+                       aspath = aspath_parse(s, length, 1,
+                                             bgp_get_asnotation(NULL));
                        printf("ASPATH: %s\n", aspath->str);
                        aspath_free(aspath);
                } break;
                case BGP_ATTR_NEXT_HOP: {
                        struct in_addr nexthop;
                        nexthop.s_addr = stream_get_ipv4(s);
-                       printf("NEXTHOP: %s\n", inet_ntoa(nexthop));
+                       printf("NEXTHOP: %pI4\n", &nexthop);
                } break;
                default:
                        stream_getw_from(s, length);
                        break;
                }
        }
-
-       return 0;
 }
 
 int main(int argc, char **argv)
@@ -246,7 +230,7 @@ int main(int argc, char **argv)
                        while (s->getp < len - 16) {
                                p.prefix.s_addr = stream_get_ipv4(s);
                                p.prefixlen = stream_getc(s);
-                               printf("PREFIX: %s/%d\n", inet_ntoa(p.prefix),
+                               printf("PREFIX: %pI4/%d\n", &p.prefix,
                                       p.prefixlen);
 
                                status = stream_getc(s);
@@ -254,8 +238,7 @@ int main(int argc, char **argv)
                                peer.s_addr = stream_get_ipv4(s);
                                source_as = stream_getw(s);
 
-                               printf("FROM: %s AS%d\n", inet_ntoa(peer),
-                                      source_as);
+                               printf("FROM: %pI4 AS%d\n", &peer, source_as);
                                printf("ORIGINATED: %s", ctime(&originated));
 
                                attrlen = stream_getw(s);
@@ -280,8 +263,8 @@ int main(int argc, char **argv)
                        sip.s_addr = stream_get_ipv4(s);
                        dip.s_addr = stream_get_ipv4(s);
 
-                       printf("saddr: %s\n", inet_ntoa(sip));
-                       printf("daddr: %s\n", inet_ntoa(dip));
+                       printf("saddr: %pI4\n", &sip);
+                       printf("daddr: %pI4\n", &dip);
 
                        printf("\n");
                }