]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-udp.c
NDOize more small decoders
[tcpdump] / print-udp.c
index 3c5ed8bcc47bc9f1381de6cd404b036706578d25..f52de0356cd394041444f63fca449fca68a54763 100644 (file)
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-udp.c,v 1.142 2007-08-08 17:20:58 hannes Exp $ (LBL)";
-#endif
-
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
@@ -286,16 +281,16 @@ static int udp_cksum(register const struct ip *ip,
                     register const struct udphdr *up,
                     register u_int len)
 {
-       return (nextproto4_cksum(ip, (const u_int8_t *)(void *)up, len,
-           IPPROTO_UDP));
+       return nextproto4_cksum(ip, (const u_int8_t *)(void *)up, len, len,
+                               IPPROTO_UDP);
 }
 
 #ifdef INET6
 static int udp6_cksum(const struct ip6_hdr *ip6, const struct udphdr *up,
        u_int len)
 {
-       return (nextproto6_cksum(ip6, (const u_int8_t *)(void *)up, len,
-           IPPROTO_UDP));
+       return nextproto6_cksum(ip6, (const u_int8_t *)(void *)up, len, len,
+           IPPROTO_UDP);
 }
 #endif
 
@@ -477,12 +472,23 @@ udp_print(register const u_char *bp, u_int length,
 
                case PT_VXLAN:
                        udpipaddr_print(ip, sport, dport);
-                       vxlan_print((const u_char *)(up + 1), length);
+                       vxlan_print(gndo, (const u_char *)(up + 1), length);
+                       break;
+
+               case PT_PGM:
+               case PT_PGM_ZMTP1:
+                       udpipaddr_print(ip, sport, dport);
+                       pgm_print(cp, length, bp2);
+                       break;
+               case PT_LMP:
+                       udpipaddr_print(ip, sport, dport);
+                       lmp_print(cp, length);
                        break;
                }
                return;
        }
 
+       udpipaddr_print(ip, sport, dport);
        if (!qflag) {
                register struct sunrpc_msg *rp;
                enum sunrpc_msg_type direction;
@@ -491,12 +497,14 @@ udp_print(register const u_char *bp, u_int length,
                if (TTEST(rp->rm_direction)) {
                        direction = (enum sunrpc_msg_type)EXTRACT_32BITS(&rp->rm_direction);
                        if (dport == NFS_PORT && direction == SUNRPC_CALL) {
-                               nfsreq_print((u_char *)rp, length,
+                               (void)printf("NFS request xid %u ", EXTRACT_32BITS(&rp->rm_xid));
+                               nfsreq_print_noaddr((u_char *)rp, length,
                                    (u_char *)ip);
                                return;
                        }
                        if (sport == NFS_PORT && direction == SUNRPC_REPLY) {
-                               nfsreply_print((u_char *)rp, length,
+                               (void)printf("NFS reply xid %u ", EXTRACT_32BITS(&rp->rm_xid));
+                               nfsreply_print_noaddr((u_char *)rp, length,
                                    (u_char *)ip);
                                return;
                        }
@@ -516,7 +524,6 @@ udp_print(register const u_char *bp, u_int length,
                        return;
                }
        }
-       udpipaddr_print(ip, sport, dport);
 
        if (vflag && !Kflag && !fragmented) {
                 /* Check the checksum, if possible. */
@@ -602,7 +609,7 @@ udp_print(register const u_char *bp, u_int length,
                else if (ISPORT(NETBIOS_DGRAM_PORT))
                        nbt_udp138_print((const u_char *)(up + 1), length);
 #endif
-               else if (dport == 3456)
+               else if (dport == VAT_PORT)
                        vat_print((const void *)(up + 1), up);
                else if (ISPORT(ZEPHYR_SRV_PORT) || ISPORT(ZEPHYR_CLT_PORT))
                        zephyr_print((const void *)(up + 1), length);
@@ -619,13 +626,15 @@ udp_print(register const u_char *bp, u_int length,
                        ripng_print((const u_char *)(up + 1), length);
                else if (ISPORT(DHCP6_SERV_PORT) || ISPORT(DHCP6_CLI_PORT))
                        dhcp6_print((const u_char *)(up + 1), length);
+               else if (ISPORT(AHCP_PORT))
+                       ahcp_print(gndo, (const u_char *)(up + 1), length);
                else if (ISPORT(BABEL_PORT) || ISPORT(BABEL_PORT_OLD))
                        babel_print((const u_char *)(up + 1), length);
 #endif /*INET6*/
                /*
                 * Kludge in test for whiteboard packets.
                 */
-               else if (dport == 4567)
+               else if (dport == WB_PORT)
                        wb_print((const void *)(up + 1), length);
                else if (ISPORT(CISCO_AUTORP_PORT))
                        cisco_autorp_print((const void *)(up + 1), length);
@@ -635,7 +644,7 @@ udp_print(register const u_char *bp, u_int length,
                         ISPORT(RADIUS_NEW_ACCOUNTING_PORT) )
                        radius_print((const u_char *)(up+1), length);
                else if (dport == HSRP_PORT)
-                       hsrp_print((const u_char *)(up + 1), length);
+                       hsrp_print(gndo, (const u_char *)(up + 1), length);
                else if (ISPORT(LWRES_PORT))
                        lwres_print((const u_char *)(up + 1), length);
                else if (ISPORT(LDP_PORT))
@@ -651,7 +660,7 @@ udp_print(register const u_char *bp, u_int length,
                        lspping_print((const u_char *)(up + 1), length);
                else if (dport == BFD_CONTROL_PORT ||
                         dport == BFD_ECHO_PORT )
-                       bfd_print((const u_char *)(up+1), length, dport);
+                       bfd_print(gndo, (const u_char *)(up+1), length, dport);
                 else if (ISPORT(LMP_PORT))
                        lmp_print((const u_char *)(up + 1), length);
                else if (ISPORT(VQP_PORT))
@@ -669,7 +678,9 @@ udp_print(register const u_char *bp, u_int length,
                 else if (ISPORT(SYSLOG_PORT))
                        syslog_print((const u_char *)(up + 1), length);
                 else if (ISPORT(OTV_PORT))
-                       otv_print((const u_char *)(up + 1), length);
+                       otv_print(gndo, (const u_char *)(up + 1), length);
+                else if (ISPORT(VXLAN_PORT))
+                       vxlan_print(gndo, (const u_char *)(up + 1), length);
                else
                        (void)printf("UDP, length %u",
                            (u_int32_t)(ulen - sizeof(*up)));