]> The Tcpdump Group git mirrors - tcpdump/commitdiff
refine use of nameser.h
authorDenis Ovsienko <[email protected]>
Mon, 13 Jul 2015 09:12:03 +0000 (10:12 +0100)
committerDenis Ovsienko <[email protected]>
Mon, 13 Jul 2015 09:15:32 +0000 (10:15 +0100)
Move the port number #define's to the TCP and UDP files such that they
don't require nameser.h anymore. Update the TCP printer to disregard the
multicast DNS port as it is UDP-only.

nameser.h
print-tcp.c
print-udp.c
tcp.h
udp.h

index 11e71ef87d6a1d19d8998fd1e105097d3c3f699f..e075f09228aa6533744ee779088caa05e3fdb84a 100644 (file)
--- a/nameser.h
+++ b/nameser.h
        /* number of bytes of fixed size data in resource record */
 #define RRFIXEDSZ      10
 
-/*
- * Internet nameserver port number
- */
-#define NAMESERVER_PORT        53
-
-/*
- * Port for multicast DNS; see
- *
- *     http://files.multicastdns.org/draft-cheshire-dnsext-multicastdns.txt
- *
- * for the current mDNS spec.
- */
-#define MULTICASTDNS_PORT      5353
-
 /*
  * Currently defined opcodes
  */
index 34678a1708e78d7c874b0100882df4cfd70e7b19..0cc338d6d1862e67861edf7c7c193d80826e38bc 100644 (file)
@@ -51,8 +51,6 @@ __RCSID("$NetBSD: print-tcp.c,v 1.8 2007/07/24 11:53:48 drochner Exp $");
 #include "rpc_auth.h"
 #include "rpc_msg.h"
 
-#include "nameser.h"
-
 #ifdef HAVE_LIBCRYPTO
 #include <openssl/md5.h>
 #include "signature.h"
@@ -700,8 +698,7 @@ tcp_print(netdissect_options *ndo,
                 ND_PRINT((ndo, ": "));
                 rtsp_print(ndo, bp, length);
         } else if (length > 2 &&
-                 (sport == NAMESERVER_PORT || dport == NAMESERVER_PORT ||
-                  sport == MULTICASTDNS_PORT || dport == MULTICASTDNS_PORT)) {
+                 (sport == NAMESERVER_PORT || dport == NAMESERVER_PORT)) {
                 /*
                  * TCP DNS query has 2byte length at the head.
                  * XXX packet could be unaligned, it can go strange
index dc161abf88db0169307b7671e0dc6cd261d5ce80..1e02f2ea6104dc509017e443cca8bec262888867 100644 (file)
@@ -40,7 +40,6 @@
 #include "rpc_auth.h"
 #include "rpc_msg.h"
 
-#include "nameser.h"
 #include "nfs.h"
 
 struct rtcphdr {
diff --git a/tcp.h b/tcp.h
index e8c8d2ca9b89eae112888256c5cd3f9fdd024a55..2e58801625960ebb8154d3b78a40d74001fd741b 100644 (file)
--- a/tcp.h
+++ b/tcp.h
@@ -97,6 +97,9 @@ struct tcphdr {
 #ifndef SMTP_PORT
 #define SMTP_PORT              25
 #endif
+#ifndef NAMESERVER_PORT
+#define NAMESERVER_PORT         53
+#endif
 #ifndef BGP_PORT
 #define BGP_PORT                179
 #endif
diff --git a/udp.h b/udp.h
index 743ddfaf85906f219f09ebe5b7aaa9fcb2b2ad92..1bdc923bfc468ded293fdf90aca37679f2a0c181 100644 (file)
--- a/udp.h
+++ b/udp.h
@@ -44,6 +44,7 @@ struct udphdr {
        uint16_t        uh_sum;                 /* udp checksum */
 };
 
+#define NAMESERVER_PORT 53
 #define BOOTPS_PORT 67         /* RFC951 */
 #define BOOTPC_PORT 68         /* RFC951 */
 #define TFTP_PORT 69           /*XXX*/
@@ -86,6 +87,7 @@ struct udphdr {
 #define BFD_CONTROL_PORT        3784 /* draft-katz-ward-bfd-v4v6-1hop-00.txt */
 #define BFD_ECHO_PORT           3785 /* draft-katz-ward-bfd-v4v6-1hop-00.txt */
 #define WB_PORT                        4567
+#define MULTICASTDNS_PORT       5353 /* RFC 6762 */
 #define SFLOW_PORT              6343 /* http://www.sflow.org/developers/specifications.php */
 #define LWAPP_DATA_PORT         12222 /* RFC 5412 */
 #define LWAPP_CONTROL_PORT      12223 /* RFC 5412 */