]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Add BFD multihop and lag decoding 757/head
authorBill Fenner <[email protected]>
Fri, 26 Apr 2019 18:03:34 +0000 (11:03 -0700)
committerBill Fenner <[email protected]>
Fri, 26 Apr 2019 18:03:34 +0000 (11:03 -0700)
Put back the bfd_port_values, and use it to distinguish
between destination ports for RFC5883 multihop and
RFC7310 lag sessions.  (The destination port is the only
difference between these messages.)

print-bfd.c
print-udp.c
tests/TESTLIST
tests/bfd-lag-v.out [new file with mode: 0644]
tests/bfd-lag.out [new file with mode: 0644]
tests/bfd-lag.pcap [new file with mode: 0644]
tests/bfd-multihop-v.out [new file with mode: 0644]
tests/bfd-multihop.out [new file with mode: 0644]
tests/bfd-multihop.pcap [new file with mode: 0644]
udp.h

index 941586d7ffc1b4b221563eefae15756f57dbbb24..cb0dcb26be387d245d7d39d787ee69a4bc733bc3 100644 (file)
@@ -142,6 +142,13 @@ static const struct tok bfd_diag_values[] = {
     { 0, NULL }
 };
 
+static const struct tok bfd_port_values[] = {
+    { BFD_CONTROL_PORT,  "Control" },
+    { BFD_MULTIHOP_PORT, "Multihop" },
+    { BFD_LAG_PORT,      "Lag" },
+    { 0, NULL }
+};
+
 #define BFD_FLAG_AUTH 0x04
 
 static const struct tok bfd_v0_flag_values[] = {
@@ -292,7 +299,9 @@ bfd_print(netdissect_options *ndo, const u_char *pptr,
           u_int len, u_int port)
 {
        ndo->ndo_protocol = "bfd";
-        if (port == BFD_CONTROL_PORT) {
+        if (port == BFD_CONTROL_PORT ||
+            port == BFD_MULTIHOP_PORT ||
+            port == BFD_LAG_PORT) {
             /*
              * Control packet.
              */
@@ -352,15 +361,17 @@ bfd_print(netdissect_options *ndo, const u_char *pptr,
             case 1:
                 if (ndo->ndo_vflag < 1)
                 {
-                    ND_PRINT("BFDv1, Control, State %s, Flags: [%s], length: %u",
+                    ND_PRINT("BFDv1, %s, State %s, Flags: [%s], length: %u",
+                           tok2str(bfd_port_values, "unknown (%u)", port),
                            tok2str(bfd_v1_state_values, "unknown (%u)", (flags & 0xc0) >> 6),
                            bittok2str(bfd_v1_flag_values, "none", flags & 0x3f),
                            len);
                     return;
                 }
 
-                ND_PRINT("BFDv1, length: %u\n\tControl, State %s, Flags: [%s], Diagnostic: %s (0x%02x)",
+                ND_PRINT("BFDv1, length: %u\n\t%s, State %s, Flags: [%s], Diagnostic: %s (0x%02x)",
                        len,
+                       tok2str(bfd_port_values, "unknown (%u)", port),
                        tok2str(bfd_v1_state_values, "unknown (%u)", (flags & 0xc0) >> 6),
                        bittok2str(bfd_v1_flag_values, "none", flags & 0x3f),
                        tok2str(bfd_diag_values,"unknown",BFD_EXTRACT_DIAG(version_diag)),
index 7ad5cd9165de7077e741bbd359fe7d712eb49adb..231d8b4fdc92e7ac694447b14ab43a1a6a0d74b7 100644 (file)
@@ -672,6 +672,8 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
                else if (IS_SRC_OR_DST_PORT(MPLS_LSP_PING_PORT))
                        lspping_print(ndo, (const u_char *)(up + 1), length);
                else if (dport == BFD_CONTROL_PORT ||
+                        dport == BFD_MULTIHOP_PORT ||
+                        dport == BFD_LAG_PORT ||
                         dport == BFD_ECHO_PORT )
                        bfd_print(ndo, (const u_char *)(up+1), length, dport);
                 else if (IS_SRC_OR_DST_PORT(LMP_PORT))
index f60eac8051c14fd8fc018d2ab61d18d6c6ccad7d..0813f6db47608a00d7dbf8e59e2fa87b412e2331 100644 (file)
@@ -684,3 +684,9 @@ vsock-1-vv  vsock-1.pcapng  vsock-1-vv.out -vv
 #IP over infinband (ipoib)
 ipoib  ipoib.pcap      ipoib.out
 ipoib-e        ipoib.pcap      ipoib-e.out -e
+
+# BFD multihop and lag (RFC5883 & 7130)
+bfd-multihop   bfd-multihop.pcap       bfd-multihop.out
+bfd-multihop-v bfd-multihop.pcap       bfd-multihop-v.out      -v
+bfd-lag                bfd-lag.pcap            bfd-lag.out
+bfd-lag-v      bfd-lag.pcap            bfd-lag-v.out           -v
diff --git a/tests/bfd-lag-v.out b/tests/bfd-lag-v.out
new file mode 100644 (file)
index 0000000..38246fe
--- /dev/null
@@ -0,0 +1,40 @@
+    1  17:19:29.162992 IP (tos 0xc0, ttl 255, id 0, offset 0, flags [none], proto UDP (17), length 52)
+    10.0.0.2.51255 > 10.0.0.1.6784: BFDv1, length: 24
+       Lag, State Down, Flags: [Poll], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (3000 ms Detection time), BFD Length: 24
+       My Discriminator: 0x0de60837, Your Discriminator: 0x00000000
+         Desired min Tx Interval:    1000 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+    2  17:19:30.154937 IP (tos 0xc0, ttl 255, id 0, offset 0, flags [none], proto UDP (17), length 52)
+    10.0.0.2.51255 > 10.0.0.1.6784: BFDv1, length: 24
+       Lag, State Down, Flags: [Poll], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (3000 ms Detection time), BFD Length: 24
+       My Discriminator: 0x0de60837, Your Discriminator: 0x00000000
+         Desired min Tx Interval:    1000 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+    3  17:19:31.146839 IP (tos 0xc0, ttl 255, id 0, offset 0, flags [none], proto UDP (17), length 52)
+    10.0.0.2.51255 > 10.0.0.1.6784: BFDv1, length: 24
+       Lag, State Down, Flags: [Poll], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (3000 ms Detection time), BFD Length: 24
+       My Discriminator: 0x0de60837, Your Discriminator: 0x00000000
+         Desired min Tx Interval:    1000 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+    4  17:19:32.074819 IP (tos 0xc0, ttl 255, id 0, offset 0, flags [none], proto UDP (17), length 52)
+    10.0.0.2.51255 > 10.0.0.1.6784: BFDv1, length: 24
+       Lag, State Down, Flags: [Poll], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (3000 ms Detection time), BFD Length: 24
+       My Discriminator: 0x0de60837, Your Discriminator: 0x00000000
+         Desired min Tx Interval:    1000 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+    5  17:19:32.842739 IP (tos 0xc0, ttl 255, id 0, offset 0, flags [none], proto UDP (17), length 52)
+    10.0.0.2.51255 > 10.0.0.1.6784: BFDv1, length: 24
+       Lag, State Down, Flags: [Poll], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (3000 ms Detection time), BFD Length: 24
+       My Discriminator: 0x0de60837, Your Discriminator: 0x00000000
+         Desired min Tx Interval:    1000 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
diff --git a/tests/bfd-lag.out b/tests/bfd-lag.out
new file mode 100644 (file)
index 0000000..a6e2fb0
--- /dev/null
@@ -0,0 +1,5 @@
+    1  17:19:29.162992 IP 10.0.0.2.51255 > 10.0.0.1.6784: BFDv1, Lag, State Down, Flags: [Poll], length: 24
+    2  17:19:30.154937 IP 10.0.0.2.51255 > 10.0.0.1.6784: BFDv1, Lag, State Down, Flags: [Poll], length: 24
+    3  17:19:31.146839 IP 10.0.0.2.51255 > 10.0.0.1.6784: BFDv1, Lag, State Down, Flags: [Poll], length: 24
+    4  17:19:32.074819 IP 10.0.0.2.51255 > 10.0.0.1.6784: BFDv1, Lag, State Down, Flags: [Poll], length: 24
+    5  17:19:32.842739 IP 10.0.0.2.51255 > 10.0.0.1.6784: BFDv1, Lag, State Down, Flags: [Poll], length: 24
diff --git a/tests/bfd-lag.pcap b/tests/bfd-lag.pcap
new file mode 100644 (file)
index 0000000..4d5cd30
Binary files /dev/null and b/tests/bfd-lag.pcap differ
diff --git a/tests/bfd-multihop-v.out b/tests/bfd-multihop-v.out
new file mode 100644 (file)
index 0000000..957b603
--- /dev/null
@@ -0,0 +1,320 @@
+    1  15:32:49.715242 IP (tos 0xc0, ttl 255, id 53796, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+    2  15:32:49.725449 IP (tos 0xc0, ttl 255, id 24067, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+    3  15:32:49.771212 IP (tos 0xc0, ttl 255, id 42520, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+    4  15:32:49.963242 IP (tos 0xc0, ttl 255, id 53821, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+    5  15:32:50.077458 IP (tos 0xc0, ttl 255, id 24116, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+    6  15:32:50.123245 IP (tos 0xc0, ttl 255, id 42545, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+    7  15:32:50.251236 IP (tos 0xc0, ttl 255, id 53849, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+    8  15:32:50.429453 IP (tos 0xc0, ttl 255, id 24181, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+    9  15:32:50.443240 IP (tos 0xc0, ttl 255, id 42625, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   10  15:32:50.495231 IP (tos 0xc0, ttl 255, id 53880, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   11  15:32:50.763252 IP (tos 0xc0, ttl 255, id 53916, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   12  15:32:50.781440 IP (tos 0xc0, ttl 255, id 24228, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+   13  15:32:50.795209 IP (tos 0xc0, ttl 255, id 42645, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   14  15:32:51.055254 IP (tos 0xc0, ttl 255, id 53938, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   15  15:32:51.169437 IP (tos 0xc0, ttl 255, id 24241, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+   16  15:32:51.179235 IP (tos 0xc0, ttl 255, id 42685, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   17  15:32:51.263249 IP (tos 0xc0, ttl 255, id 53987, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   18  15:32:51.517455 IP (tos 0xc0, ttl 255, id 24294, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+   19  15:32:51.531253 IP (tos 0xc0, ttl 255, id 42759, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   20  15:32:51.563242 IP (tos 0xc0, ttl 255, id 54018, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   21  15:32:51.815238 IP (tos 0xc0, ttl 255, id 54063, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   22  15:32:51.851228 IP (tos 0xc0, ttl 255, id 42801, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   23  15:32:51.901437 IP (tos 0xc0, ttl 255, id 24357, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+   24  15:32:52.055249 IP (tos 0xc0, ttl 255, id 54069, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   25  15:32:52.171267 IP (tos 0xc0, ttl 255, id 42809, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   26  15:32:52.221449 IP (tos 0xc0, ttl 255, id 24379, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+   27  15:32:52.363241 IP (tos 0xc0, ttl 255, id 54140, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   28  15:32:52.523246 IP (tos 0xc0, ttl 255, id 42894, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   29  15:32:52.541447 IP (tos 0xc0, ttl 255, id 24387, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+   30  15:32:52.623226 IP (tos 0xc0, ttl 255, id 54156, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   31  15:32:52.893448 IP (tos 0xc0, ttl 255, id 24420, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+   32  15:32:52.907208 IP (tos 0xc0, ttl 255, id 42968, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   33  15:32:52.939217 IP (tos 0xc0, ttl 255, id 54161, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   34  15:32:53.175261 IP (tos 0xc0, ttl 255, id 54189, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   35  15:32:53.245445 IP (tos 0xc0, ttl 255, id 24444, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+   36  15:32:53.259218 IP (tos 0xc0, ttl 255, id 43041, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   37  15:32:53.455241 IP (tos 0xc0, ttl 255, id 54223, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   38  15:32:53.565443 IP (tos 0xc0, ttl 255, id 24471, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (1200 ms Detection time), BFD Length: 24
+       My Discriminator: 0x89860b19, Your Discriminator: 0x457f7451
+         Desired min Tx Interval:     400 ms
+         Required min Rx Interval:    400 ms
+         Required min Echo Interval:  400 ms
+   39  15:32:53.611260 IP (tos 0xc0, ttl 255, id 43060, offset 0, flags [none], proto UDP (17), length 52)
+    101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, length: 24
+       Multihop, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x457f7451, Your Discriminator: 0x89860b19
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
+   40  15:32:53.739250 IP (tos 0xc0, ttl 255, id 54269, offset 0, flags [none], proto UDP (17), length 52)
+    161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, length: 24
+       Control, State Up, Flags: [none], Diagnostic: No Diagnostic (0x00)
+       Detection Timer Multiplier: 3 (900 ms Detection time), BFD Length: 24
+       My Discriminator: 0x7429abf9, Your Discriminator: 0xd43a40c1
+         Desired min Tx Interval:     300 ms
+         Required min Rx Interval:    300 ms
+         Required min Echo Interval:  300 ms
diff --git a/tests/bfd-multihop.out b/tests/bfd-multihop.out
new file mode 100644 (file)
index 0000000..8b21051
--- /dev/null
@@ -0,0 +1,40 @@
+    1  15:32:49.715242 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+    2  15:32:49.725449 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+    3  15:32:49.771212 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+    4  15:32:49.963242 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+    5  15:32:50.077458 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+    6  15:32:50.123245 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+    7  15:32:50.251236 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+    8  15:32:50.429453 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+    9  15:32:50.443240 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   10  15:32:50.495231 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   11  15:32:50.763252 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   12  15:32:50.781440 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   13  15:32:50.795209 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   14  15:32:51.055254 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   15  15:32:51.169437 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   16  15:32:51.179235 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   17  15:32:51.263249 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   18  15:32:51.517455 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   19  15:32:51.531253 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   20  15:32:51.563242 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   21  15:32:51.815238 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   22  15:32:51.851228 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   23  15:32:51.901437 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   24  15:32:52.055249 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   25  15:32:52.171267 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   26  15:32:52.221449 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   27  15:32:52.363241 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   28  15:32:52.523246 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   29  15:32:52.541447 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   30  15:32:52.623226 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   31  15:32:52.893448 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   32  15:32:52.907208 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   33  15:32:52.939217 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   34  15:32:53.175261 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   35  15:32:53.245445 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   36  15:32:53.259218 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   37  15:32:53.455241 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
+   38  15:32:53.565443 IP 101.0.0.12.51993 > 101.0.0.1.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   39  15:32:53.611260 IP 101.0.0.1.62545 > 101.0.0.12.4784: BFDv1, Multihop, State Up, Flags: [none], length: 24
+   40  15:32:53.739250 IP 161.1.12.1.60409 > 161.1.12.12.3784: BFDv1, Control, State Up, Flags: [none], length: 24
diff --git a/tests/bfd-multihop.pcap b/tests/bfd-multihop.pcap
new file mode 100644 (file)
index 0000000..36607fb
Binary files /dev/null and b/tests/bfd-multihop.pcap differ
diff --git a/udp.h b/udp.h
index 65ffe2a95b6ff70d08f9d5af7558414410fc9ebd..e3ce443b7a919953c1673eb8be08c8d0a4f60201 100644 (file)
--- a/udp.h
+++ b/udp.h
@@ -179,6 +179,9 @@ struct udphdr {
 #ifndef WB_PORT
 #define WB_PORT                                4567
 #endif
+#ifndef BFD_MULTIHOP_PORT
+#define BFD_MULTIHOP_PORT              4784    /* RFC 5883 */
+#endif
 #ifndef VXLAN_PORT
 #define VXLAN_PORT                     4789    /* RFC 7348 */
 #endif
@@ -206,6 +209,9 @@ struct udphdr {
 #ifndef BABEL_PORT_OLD
 #define BABEL_PORT_OLD                 6697    /* RFC 6126 */
 #endif
+#ifndef BFD_LAG_PORT
+#define BFD_LAG_PORT                   6784    /* RFC 7310 */
+#endif
 #ifndef RX_PORT_LOW
 #define RX_PORT_LOW                    7000    /*XXX*/
 #endif