aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-knxip.c
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2022-06-29 21:39:13 -0400
committerJohn Thacker <johnthacker@gmail.com>2022-06-29 21:41:25 -0400
commit7f5089ba404e80458bf99e7e7476767d78aaa5c0 (patch)
tree42cf3277c8f57210aa955dd0a574fb56ce9b937c /epan/dissectors/packet-knxip.c
parent6c16cd7cbbe335ccf6e3ac6f63cc754f3bbdb189 (diff)
knxip: Add a port range preference
KNX/IP has an IANA registered port, 3671, and some other ports commonly used but unregistered (or registered to other services). It also has no heuristics. Add a port range preference defaulting to the registered port.
Diffstat (limited to 'epan/dissectors/packet-knxip.c')
-rw-r--r--epan/dissectors/packet-knxip.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/epan/dissectors/packet-knxip.c b/epan/dissectors/packet-knxip.c
index 7ced80e166..cb7d5ec614 100644
--- a/epan/dissectors/packet-knxip.c
+++ b/epan/dissectors/packet-knxip.c
@@ -37,6 +37,11 @@
#include "packet-knxip.h"
#include "packet-knxip_decrypt.h"
+#define KIP_DEFAULT_PORT_RANGE "3671" /* IANA-assigned (EIBnet aka KNXnet) */
+/* Other ports are commonly used, especially 3672 by KNX IP Gateways, but
+ * not registered.
+ */
+
#define ECDH_PUBLIC_VALUE_SIZE 32
#define KIP_HDR_LEN 6
@@ -4087,14 +4092,10 @@ void proto_reg_handoff_knxip( void )
const gchar* text;
knxip_handle = find_dissector( "udp.knxip" );
- dissector_add_uint( "udp.port", 3671, knxip_handle );
- dissector_add_uint( "udp.port", 3672, knxip_handle );
- dissector_add_uint( "udp.port", 40000, knxip_handle );
+ dissector_add_uint_range_with_preference("udp.port", KIP_DEFAULT_PORT_RANGE, knxip_handle);
knxip_handle = find_dissector( "tcp.knxip" );
- dissector_add_uint( "tcp.port", 3671, knxip_handle );
- dissector_add_uint( "tcp.port", 3672, knxip_handle );
- dissector_add_uint( "tcp.port", 40000, knxip_handle );
+ dissector_add_uint_range_with_preference("tcp.port", KIP_DEFAULT_PORT_RANGE, knxip_handle);
/* Evaluate preferences
*/