]> The Tcpdump Group git mirrors - tcpdump/commitdiff
make bgp dump a bit more readable (when with -v).
authoritojun <itojun>
Sun, 31 Oct 1999 00:39:59 +0000 (00:39 +0000)
committeritojun <itojun>
Sun, 31 Oct 1999 00:39:59 +0000 (00:39 +0000)
sync from KAME tcpdump.

print-bgp.c

index 3525a12e175ec05a7e1f6e04f1be480d014afa40..0ddd7bfb2321340d4acef75b41e62a70085650c1 100644 (file)
 #include <errno.h>
 #include <stdio.h>
 
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif
-
 #include "interface.h"
 #include "addrtoname.h"
 
@@ -461,6 +457,7 @@ bgp_update_print(const u_char *dat, int length)
        const u_char *p;
        int len;
        int i, j;
+       int newline;
 
        memcpy(&bgp, dat, sizeof(bgp));
        hlen = ntohs(bgp.bgp_len);
@@ -479,6 +476,7 @@ bgp_update_print(const u_char *dat, int length)
                /* do something more useful!*/
                i = 2;
                printf(" (Path attributes:");   /* ) */
+               newline = 0;
                while (i < 2 + len) {
                        int alen, aoff;
 
@@ -486,7 +484,11 @@ bgp_update_print(const u_char *dat, int length)
                        alen = bgp_attr_len(&bgpa);
                        aoff = bgp_attr_off(&bgpa);
 
-                       printf(" (");           /* ) */
+                       if (vflag && newline)
+                               printf("\n\t\t");
+                       else
+                               printf(" ");
+                       printf("(");            /* ) */
                        printf("%s", bgp_attr_type(bgpa.bgpa_type));
                        if (bgpa.bgpa_flags) {
                                printf("[%s%s%s%s]",
@@ -497,6 +499,7 @@ bgp_update_print(const u_char *dat, int length)
                        }
 
                        bgp_attr_print(&bgpa, &p[i + aoff], alen);
+                       newline = 1;
 
 #if 0
            default: