Skip to content

Commit 10f7dff

Browse files
Jonas Chianufxlb
authored andcommitted
Moved source port equal BCM_LI_PORT to bottom of long if else chain
BCM_LI_SHIM (BCM_LI_PORT) value is set to 49152, therefore when the source port is 49152, it does not matter what the true destination is, it defaults to Broadcom. So tcpdump interprets any packet with source UDP port of 49152 as BCM_LI_SHIM (Broadcom). Ports 49152+, by definition are ephemeral ports so it's totally reasonable that, for example, BFD is using that source port for their packets. To prevent, for example, BFD packets from being wrongly identified as BCM_LI_SHIM packets, the "else if" statement has been moved to bottom of long chain. Add a test file.
1 parent ec5cc24 commit 10f7dff

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

print-udp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -622,8 +622,6 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
622622
(IP_V(ip) == 6) ? 1 : 0);
623623
else if (IS_SRC_OR_DST_PORT(MPLS_LSP_PING_PORT))
624624
lspping_print(ndo, cp, length);
625-
else if (sport == BCM_LI_PORT)
626-
bcm_li_print(ndo, cp, length);
627625
else if (dport == BFD_CONTROL_PORT ||
628626
dport == BFD_MULTIHOP_PORT ||
629627
dport == BFD_LAG_PORT ||
@@ -675,6 +673,8 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
675673
else if (IS_SRC_OR_DST_PORT(HTTPS_PORT) &&
676674
quic_detect(ndo, cp, length))
677675
quic_print(ndo, cp, length);
676+
else if (sport == BCM_LI_PORT)
677+
bcm_li_print(ndo, cp, length);
678678
else {
679679
if (ulen > length && !fragmented)
680680
ND_PRINT("UDP, bad length %u > %u",

tests/TESTLIST

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,8 @@ bfd-lag bfd-lag.pcap bfd-lag.out
853853
bfd-lag-v bfd-lag.pcap bfd-lag-v.out -v
854854
bfd-sbfd bfd-sbfd.pcap bfd-sbfd.out
855855
bfd-sbfd-v bfd-sbfd.pcap bfd-sbfd-v.out -v
856+
# BFD with source port 49152
857+
bfd_source_port_49152 bfd_source_port_49152.pcap bfd_source_port_49152.out -v
856858

857859
# Arista Vendor Specific Tests
858860
arista-ether arista_ether.pcap arista_ether.out

tests/bfd_source_port_49152.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
1 09:58:19.559328 IP (tos 0xe0, ttl 255, id 40257, offset 0, flags [DF], proto UDP (17), length 52)
2+
11.11.11.2.49152 > 11.11.11.1.3784: BFDv1, length: 24
3+
Control, State Up, Flags: [Control Plane Independent], Diagnostic: No Diagnostic (0x00)
4+
Detection Timer Multiplier: 3 (300 ms Detection time), BFD Length: 24
5+
My Discriminator: 0x80000001, Your Discriminator: 0x80000001
6+
Desired min Tx Interval: 100 ms
7+
Required min Rx Interval: 100 ms
8+
Required min Echo Interval: 0 ms

tests/bfd_source_port_49152.pcap

110 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)