]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-udp.c
Check for extra networking libraries before checking for IPv6.
[tcpdump] / print-udp.c
index 02a1e6ec5f46bb285a2cc21893a9bd7ba2f3b1f2..3c5ed8bcc47bc9f1381de6cd404b036706578d25 100644 (file)
@@ -286,30 +286,8 @@ static int udp_cksum(register const struct ip *ip,
                     register const struct udphdr *up,
                     register u_int len)
 {
-       struct phdr {
-               u_int32_t src;
-               u_int32_t dst;
-               u_char mbz;
-               u_char proto;
-               u_int16_t len;
-       } ph;
-       struct cksum_vec vec[2];
-
-       /* pseudo-header.. */
-       ph.len = htons((u_int16_t)len);
-       ph.mbz = 0;
-       ph.proto = IPPROTO_UDP;
-       memcpy(&ph.src, &ip->ip_src.s_addr, sizeof(u_int32_t));
-       if (IP_HL(ip) == 5)
-               memcpy(&ph.dst, &ip->ip_dst.s_addr, sizeof(u_int32_t));
-       else
-               ph.dst = ip_finddst(ip);
-
-       vec[0].ptr = (const u_int8_t *)(void *)&ph;
-       vec[0].len = sizeof(ph);
-       vec[1].ptr = (const u_int8_t *)(void *)up;
-       vec[1].len = len;
-       return (in_cksum(vec, 2));
+       return (nextproto4_cksum(ip, (const u_int8_t *)(void *)up, len,
+           IPPROTO_UDP));
 }
 
 #ifdef INET6
@@ -491,6 +469,16 @@ udp_print(register const u_char *bp, u_int length,
                            0);
 #endif
                        break;
+
+               case PT_RADIUS:
+                       udpipaddr_print(ip, sport, dport);
+                       radius_print(cp, length);
+                       break;
+
+               case PT_VXLAN:
+                       udpipaddr_print(ip, sport, dport);
+                       vxlan_print((const u_char *)(up + 1), length);
+                       break;
                }
                return;
        }
@@ -631,7 +619,7 @@ 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(BABEL_PORT))
+               else if (ISPORT(BABEL_PORT) || ISPORT(BABEL_PORT_OLD))
                        babel_print((const u_char *)(up + 1), length);
 #endif /*INET6*/
                /*
@@ -680,6 +668,8 @@ udp_print(register const u_char *bp, u_int length,
                        sip_print((const u_char *)(up + 1), 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);
                else
                        (void)printf("UDP, length %u",
                            (u_int32_t)(ulen - sizeof(*up)));