]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-udp.c
Add support for IPv6 agent in sFlow.
[tcpdump] / print-udp.c
index b315f1e77fea6fb8faf57a9dba45d10579415556..4fb0a59170e95e3b8040163d29c46a1619b82732 100644 (file)
@@ -369,10 +369,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
        if (ndo->ndo_packettype != PT_RPC)
                udpipaddr_print(ndo, ip, sport, dport);
 
-       if (length < sizeof(struct udphdr)) {
-               ND_PRINT("undersized-udp %u", length);
-               goto invalid;
-       }
+       ND_LCHECKMSG_ZU(length, sizeof(struct udphdr), "undersized-udp");
        ulen = GET_BE_U_2(up->uh_ulen);
        udp_sum = GET_BE_U_2(up->uh_sum);
        /*
@@ -382,10 +379,7 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
         */
        if (ulen == 0 && length > 65535)
                ulen = length;
-       if (ulen < sizeof(struct udphdr)) {
-               ND_PRINT("undersized-udplength %u", ulen);
-               goto invalid;
-       }
+       ND_LCHECKMSG_ZU(ulen, sizeof(struct udphdr), "undersized-udplength");
        ulen -= sizeof(struct udphdr);
        length -= sizeof(struct udphdr);
        if (ulen < length)
@@ -630,8 +624,11 @@ udp_print(netdissect_options *ndo, const u_char *bp, u_int length,
                else if (dport == BFD_CONTROL_PORT ||
                         dport == BFD_MULTIHOP_PORT ||
                         dport == BFD_LAG_PORT ||
+                        dport == SBFD_PORT ||
                         dport == BFD_ECHO_PORT )
                        bfd_print(ndo, cp, length, dport);
+               else if (sport == SBFD_PORT)
+                       bfd_print(ndo, cp, length, sport);
                else if (IS_SRC_OR_DST_PORT(LMP_PORT))
                        lmp_print(ndo, cp, length);
                else if (IS_SRC_OR_DST_PORT(VQP_PORT))