我在FreeBSD中诊断出UDP丢包问题。 netstat -s -p udp
具有以下输出:
udp:
116974545 datagrams received
0 with incomplete header
0 with bad data length field
0 with bad checksum
198 with no checksum
6313 dropped due to no socket
119696 broadcast/multicast datagrams undelivered
41534 dropped due to full socket buffers
0 not for hashed pcb
116807002 delivered
955 datagrams output
0 times multicast source filter matched
虽然大部分输出是直截了当的,但我对broadcast/multicast datagrams undelivered
表示的内容感到困惑。这是未传送的组播数据包的总数吗?或者这是指由特定原因引起的数字,例如drooped due to full socket buffers
吗?
答案 0 :(得分:2)
"broadcast/multicast datagrams undelivered"
表示没有套接字愿意接受它们的接收多播/广播UDP数据包的总数。计数器有两种情况:
Case #1 - 在您的情况下占所有/大多数未传递的UDP多播/广播数据包:
531 /*
532 * No matching pcb found; discard datagram. (No need
533 * to send an ICMP Port Unreachable for a broadcast
534 * or multicast datgram.)
535 */
536 UDPSTAT_INC(udps_noportbcast);
Case #2也会因为“没有套接字”计数而崩溃,这可能不是你的情况。
596 UDPSTAT_INC(udps_noport);
597 if (m->m_flags & (M_BCAST | M_MCAST)) {
598 UDPSTAT_INC(udps_noportbcast);
599 goto badunlocked;
600 }