]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Separate multiple nexthops.
authorBill Fenner <[email protected]>
Thu, 1 Mar 2012 13:38:25 +0000 (05:38 -0800)
committerBill Fenner <[email protected]>
Thu, 1 Mar 2012 13:38:25 +0000 (05:38 -0800)
Multiple nexthops in MP-BGP were not getting separated, so you are
left wondering "what kind of address is dead:beef::1fe80::1ff:fe01:0"?
Separate them with ", " so that it is more clear that they are
multiple nexthops.

print-bgp.c
tests/TESTLIST
tests/mpbgp-linklocal-nexthop.out [new file with mode: 0644]
tests/mpbgp-linklocal-nexthop.pcap [new file with mode: 0644]

index 6460a59e0c471881f87d84af66ff8ffc6fb8fea2..41cab22014675619df0b81e6ab506712031076df 100644 (file)
@@ -1510,8 +1510,12 @@ bgp_attr_print(const struct bgp_attr *attr, const u_char *pptr, int len)
                 tptr++;
 
                if (tlen) {
+                    int nnh = 0;
                     printf("\n\t    nexthop: ");
                     while (tlen > 0) {
+                        if ( nnh++ > 0 ) {
+                            printf( ", " );
+                        }
                         switch(af<<8 | safi) {
                         case (AFNUM_INET<<8 | SAFNUM_UNICAST):
                         case (AFNUM_INET<<8 | SAFNUM_MULTICAST):
index 58d72532ef4b3d894d9d123e0eb5369d56668e94..c978f4a671aaa0c63ef96924e198caf9a325bacc 100644 (file)
@@ -1,5 +1,6 @@
-# BGP test
+# BGP tests
 bgp_vpn_attrset bgp_vpn_attrset.pcap bgp_vpn_attrset.out -t -v 
+mpbgp-linklocal-nexthop mpbgp-linklocal-nexthop.pcap mpbgp-linklocal-nexthop.out -t -v
 
 # EAP tests
 eapon1 eapon1.pcap eapon1.out -t 
diff --git a/tests/mpbgp-linklocal-nexthop.out b/tests/mpbgp-linklocal-nexthop.out
new file mode 100644 (file)
index 0000000..337f0d8
--- /dev/null
@@ -0,0 +1,10 @@
+IP (tos 0xc0, ttl 64, id 22725, offset 0, flags [DF], proto TCP (6), length 142)
+    30.0.0.1.49038 > 30.0.0.2.179: Flags [P.], cksum 0xd6dc (correct), seq 1284816775:1284816865, ack 1288709908, win 29, options [nop,nop,TS val 184150022 ecr 184150021], length 90: BGP, length: 90
+       Update Message (2), length: 90
+         Origin (1), length: 1, Flags [T]: Incomplete
+         AS Path (2), length: 4, Flags [T]: 1 
+         Next Hop (3), length: 4, Flags [T]: 0.0.0.0
+         Multi-Protocol Reach NLRI (14), length: 46, Flags [O]: 
+           AFI: IPv6 (2), SAFI: Unicast (1)
+           nexthop: dead:beef::1, fe80::1ff:fe01:0, nh-length: 32, no SNPA
+             4:5::/64
diff --git a/tests/mpbgp-linklocal-nexthop.pcap b/tests/mpbgp-linklocal-nexthop.pcap
new file mode 100644 (file)
index 0000000..1ac823d
Binary files /dev/null and b/tests/mpbgp-linklocal-nexthop.pcap differ