coap: add support for coaps (DTLS-secured CoAP)
authorPeter Wu <peter@lekensteyn.nl>
Mon, 30 Jan 2017 18:41:29 +0000 (19:41 +0100)
committerPeter Wu <peter@lekensteyn.nl>
Tue, 31 Jan 2017 00:12:12 +0000 (00:12 +0000)
coaps port is defined in RFC 7252, section 12.7.

CoAP (RFC 7252) is defined only for UDP, not TCP. For TCP, the frame
format is slightly different (draft-ietf-core-coap-tcp-tls-05) and
needs more dissector changes, so remove registration for now.

Change-Id: I1fc7163086f8fe66986565aa24b579ef24f72550
Ping-Bug: 13370
Reviewed-on: https://code.wireshark.org/review/19870
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
epan/dissectors/packet-coap.c

index 8bc0346f442254b29ece5c0e6c2f9c403d2272d8..0cba22d6f65000ee4b02fe3d74c4e6f34edddacb 100644 (file)
@@ -35,6 +35,7 @@
 #include <epan/packet.h>
 #include <epan/expert.h>
 #include <epan/wmem/wmem.h>
+#include "packet-dtls.h"
 
 void proto_register_coap(void);
 
@@ -93,6 +94,7 @@ static dissector_handle_t coap_handle;
 
 /* CoAP's IANA-assigned port (UDP only) number */
 #define DEFAULT_COAP_PORT      5683
+#define DEFAULT_COAPS_PORT     5684
 
 /* indicators whether those are to be showed or not */
 #define DEFAULT_COAP_CTYPE_VALUE       ~0U
@@ -1258,8 +1260,8 @@ void
 proto_reg_handoff_coap(void)
 {
        media_type_dissector_table = find_dissector_table("media_type");
-       dissector_add_uint_with_preference("tcp.port", DEFAULT_COAP_PORT, coap_handle);
        dissector_add_uint_with_preference("udp.port", DEFAULT_COAP_PORT, coap_handle);
+       dtls_dissector_add(DEFAULT_COAPS_PORT, coap_handle);
 }
 
 /*