Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionparser fails if there are no options #24

Open
baw-serafin opened this issue Jan 23, 2018 · 1 comment
Open

Optionparser fails if there are no options #24

baw-serafin opened this issue Jan 23, 2018 · 1 comment

Comments

@baw-serafin
Copy link

baw-serafin commented Jan 23, 2018

We are developing a little demo but lobarocoap can't parse a response with no options. it fails of the following code in /src/coap_options.c

if (srcArr[0] == OPTION_PAYLOAD_MARKER) {
		INFO("- Options must not start with payload marker!\r\n");
		return COAP_PARSE_MESSAGE_FORMAT_ERROR;
}

Other clients like libcoap or coapthon or java libraries have no problem with the packets. And i can't see anything in the rfc either.

O the contrary there is stated options (if any):

0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |Ver| T |  TKL  |      Code     |          Message ID           |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   Token (if any, TKL bytes) ...
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   Options (if any) ...
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |1 1 1 1 1 1 1 1|    Payload (if any) ...
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

                         Figure 7: Message Format

Debug Output:

o<<<<<<<<<<<<<<<<<<<<<<
New Datagram received [7 Bytes], Interface #d

--------------->>> Sending Endpoint:
--------------->>> IPv4, 192.168.2.41:57095
--------------->>>

--------------->>> - Options must not start with payload marker!

--------------->>> CoAP-Parse Options Error

--------------->>> - (!) ERROR (!)
--------------->>> ParseResult:
--------------->>> COAP_PARSE_MESSAGE_FORMAT_ERROR

--------------->>> o<<<<<<<<<<<<<<<<<<<<<<

--------------->>>

--------------->>> Interactions: 1

--------------->>> -------------

--------------->>> - Role: CLIENT, State: WAITING_RESPONSE

--------------->>> RetransCnt: 0, SleepUntil 0, AckTimeout: 1516699926

Edit: No options not no headers

@niondir
Copy link
Member

niondir commented Jan 23, 2018

Thanks for reporting. I would agree, this should parse just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants