obgm / libcoap

A CoAP (RFC 7252) implementation in C
Other
805 stars 424 forks source link

Invalid option option Number 292 #1353

Closed hacperme closed 7 months ago

hacperme commented 8 months ago

Environment

libcoap Configuration Summary

If get_config,sh exists, please copy the output from (do in the top level libcoap directory) :-

./get_config.sh

Else if using ./configure, please copy the output from (do in the top level libcoap directory) :-

cat config.log | grep -E "result:   |      libcoap|      host s" | cut -d\  -f3-

Else if using cmake, please copy the output from (do in the cmake build directory) :-

❯ cmake .. -DENABLE_DOCS=OFF -DWARNING_TO_ERROR=ON -DENABLE_DTLS=OFF -DENABLE_TCP=OFF -DENABLE_IPV6=OFF -DWITH_EPOLL=OFF  -DENABLE_AF_UNIX=OFF
CMake Deprecation Warning at CMakeLists.txt:85 (cmake_policy):
  The OLD behavior for policy CMP0115 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

-- compiling with client support
-- compiling with server support
-- compiling with OSCORE support
-- WebSockets disabled as TCP not enabled
-- compiling without WebSockets support
-- compiling with async separate response support
-- compiling with IPv4 support
-- compiling without IPv6 support
-- compiling without Unix socket support
-- compiling with Q-Block (RFC9177) support
-- compiling with observe persistence support
-- compiling without epoll support
-- compiling with thread safe support
-- compiling with max logging level set to 8
--
-- libcoap Configuration Summary:
--
-- PACKAGE VERSION..................4.3.4
-- PACKAGE SOURCE...................v4.3.4-82-g0a39b6c0
-- LIBRARY API VERSION..............3
-- LIBRARY ABI VERSION..............3.1.2
-- ENABLE_DTLS:.....................OFF
-- ENABLE_TCP:......................OFF
-- ENABLE_IPV4:.....................ON
-- ENABLE_IPV6:.....................OFF
-- ENABLE_AF_UNIX:..................OFF
-- ENABLE_WEBSOCKETS:...............OFF
-- ENABLE_Q_BLOCK:..................ON
-- ENABLE_CLIENT_MODE:..............ON
-- ENABLE_SERVER_MODE:..............ON
-- ENABLE_OSCORE:...................ON
-- ENABLE_ASYNC:....................ON
-- ENABLE_THREAD_SAFE:..............ON
-- ENABLE_THREAD_RECURSIVE_CHECK....OFF
-- ENABLE_DOCS:.....................OFF
-- ENABLE_EXAMPLES:.................ON
-- DTLS_BACKEND:....................default
-- WITH_GNUTLS:.....................OFF
-- WITH_TINYDTLS:...................OFF
-- WITH_OPENSSL:....................OFF
-- WITH_MBEDTLS:....................OFF
-- HAVE_LIBTINYDTLS:................
-- HAVE_LIBGNUTLS:..................
-- HAVE_LIBOPENSSL:.................
-- HAVE_LIBMBEDTLS:.................
-- WITH_EPOLL:......................OFF
-- WITH_OBSERVE_PERSIST:............ON
-- BUILD_SHARED_LIBS:...............OFF
-- MAX_LOGGING_LEVEL:...............8
-- WARNING_TO_ERROR:................ON
-- CMAKE_C_COMPILER:................/usr/bin/cc
-- CMAKE_CXX_COMPILER_ID:...........GNU
-- CMAKE_BUILD_TYPE:................Debug
-- CMAKE_SYSTEM_PROCESSOR:..........x86_64
-- CMAKE_HOST_SYSTEM_NAME:..........Linux
-- CMAKE_GENERATOR:.................Unix Makefiles
--
-- Configuring done (0.5s)
-- Generating done (0.4s)
-- Build files have been written to: /mnt/e/workspace/libcoap/build

libcoap/build on  develop [$⇣] via C v9.4.0-gcc via △ v3.28.2
❯ cmake --build .
[  2%] Building C object CMakeFiles/coap-3.dir/src/coap_address.c.o
[  4%] Building C object CMakeFiles/coap-3.dir/src/coap_asn1.c.o
[  6%] Building C object CMakeFiles/coap-3.dir/src/coap_async.c.o
[  8%] Building C object CMakeFiles/coap-3.dir/src/coap_block.c.o
[ 10%] Building C object CMakeFiles/coap-3.dir/src/coap_cache.c.o
[ 12%] Building C object CMakeFiles/coap-3.dir/src/coap_debug.c.o
[ 14%] Building C object CMakeFiles/coap-3.dir/src/coap_dtls.c.o
[ 16%] Building C object CMakeFiles/coap-3.dir/src/coap_encode.c.o
[ 18%] Building C object CMakeFiles/coap-3.dir/src/coap_event.c.o
[ 20%] Building C object CMakeFiles/coap-3.dir/src/coap_hashkey.c.o
[ 22%] Building C object CMakeFiles/coap-3.dir/src/coap_io.c.o
[ 25%] Building C object CMakeFiles/coap-3.dir/src/coap_layers.c.o
[ 27%] Building C object CMakeFiles/coap-3.dir/src/coap_mem.c.o
[ 29%] Building C object CMakeFiles/coap-3.dir/src/coap_net.c.o
[ 31%] Building C object CMakeFiles/coap-3.dir/src/coap_netif.c.o
[ 33%] Building C object CMakeFiles/coap-3.dir/src/coap_notls.c.o
[ 35%] Building C object CMakeFiles/coap-3.dir/src/coap_option.c.o
[ 37%] Building C object CMakeFiles/coap-3.dir/src/coap_oscore.c.o
[ 39%] Building C object CMakeFiles/coap-3.dir/src/coap_pdu.c.o
[ 41%] Building C object CMakeFiles/coap-3.dir/src/coap_prng.c.o
[ 43%] Building C object CMakeFiles/coap-3.dir/src/coap_resource.c.o
[ 45%] Building C object CMakeFiles/coap-3.dir/src/coap_session.c.o
[ 47%] Building C object CMakeFiles/coap-3.dir/src/coap_sha1.c.o
[ 50%] Building C object CMakeFiles/coap-3.dir/src/coap_str.c.o
[ 52%] Building C object CMakeFiles/coap-3.dir/src/coap_subscribe.c.o
[ 54%] Building C object CMakeFiles/coap-3.dir/src/coap_tcp.c.o
[ 56%] Building C object CMakeFiles/coap-3.dir/src/coap_threadsafe.c.o
[ 58%] Building C object CMakeFiles/coap-3.dir/src/coap_time.c.o
[ 60%] Building C object CMakeFiles/coap-3.dir/src/coap_uri.c.o
[ 62%] Building C object CMakeFiles/coap-3.dir/src/coap_ws.c.o
[ 64%] Building C object CMakeFiles/coap-3.dir/src/oscore/oscore.c.o
[ 66%] Building C object CMakeFiles/coap-3.dir/src/oscore/oscore_cbor.c.o
[ 68%] Building C object CMakeFiles/coap-3.dir/src/oscore/oscore_context.c.o
[ 70%] Building C object CMakeFiles/coap-3.dir/src/oscore/oscore_cose.c.o
[ 72%] Building C object CMakeFiles/coap-3.dir/src/oscore/oscore_crypto.c.o
[ 75%] Linking C static library libcoap-3.a
[ 75%] Built target coap-3
[ 77%] Building C object CMakeFiles/coap-client.dir/examples/coap-client.c.o
[ 79%] Linking C executable coap-client
[ 79%] Built target coap-client
[ 81%] Building C object CMakeFiles/coap-rd.dir/examples/coap-rd.c.o
[ 83%] Linking C executable coap-rd
[ 83%] Built target coap-rd
[ 85%] Building C object CMakeFiles/coap-server.dir/examples/coap-server.c.o
[ 87%] Linking C executable coap-server
[ 87%] Built target coap-server
[ 89%] Building C object CMakeFiles/etsi_iot_01.dir/examples/etsi_iot_01.c.o
[ 91%] Linking C executable etsi_iot_01
[ 91%] Built target etsi_iot_01
[ 93%] Building C object CMakeFiles/tiny.dir/examples/tiny.c.o
[ 95%] Linking C executable tiny
[ 95%] Built target tiny
[ 97%] Building C object CMakeFiles/oscore-interop-server.dir/examples/oscore-interop-server.c.o
[100%] Linking C executable oscore-interop-server
[100%] Built target oscore-interop-server

libcoap/build on  develop [$⇣] via C v9.4.0-gcc via △ v3.28.2 took 24s

Else please copy the output from (do from within the libcoap directory) :-

v4.3.4-82-g0a39b6c0

Problem Description

Run coap-client.c exmaple, send get request to coap://coap.me/hello, then capture network packets with Wireshark. We find that there is an invalid option 292 in the packets.

Expected Behavior

Invalid option 292 should not appear in the packets.

Actual Behavior

// Describe what you are seeing.

Steps to reproduce

  1. step1
  2. ...

Code to reproduce this issue

We using examples/coap-client.c.

// If your code is longer than 30 lines, upload it as an attachment. Do not include code that is proprietary or sensitive for your project. Try to reduce your code as much as possible so that it only demonstrates the issue.

Debug Logs

❯ ./coap-client -m get  -B 1 coap://coap.me/hello
world

libcoap/build on  develop [$⇣] via C v9.4.0-gcc via △ v3.28.2 took 2s

Capture network packets with Wireshark, and find that there is an invalid option 292 in the packets.

coaptestlog.zip

image

Other items if possible

mrdeep1 commented 8 months ago

Thank you for looking into this. This however is not a libcoap issue, but a Wireshark issue where the Wireshark CoAP dissector does not support decoding RFC9175 information. See RFC9175 3.2. The Request-Tag Option for further information about the CoAP Request-Tag option.

You may find it useful to add the-v7 option when running the coap-client to see what is happening.

hacperme commented 7 months ago

Thank you for looking into this. This however is not a libcoap issue, but a Wireshark issue where the Wireshark CoAP dissector does not support decoding RFC9175 information. See RFC9175 3.2. The Request-Tag Option for further information about the CoAP Request-Tag option.

You may find it useful to add the-v7 option when running the coap-client to see what is happening.

Thank you for your help, it is indeed a wireshark issue.