gcoap_forward_proxy: copy Max-Age from forwarded Valid if it exists#18471
gcoap_forward_proxy: copy Max-Age from forwarded Valid if it exists#18471miri64 merged 2 commits intoRIOT-OS:masterfrom
Conversation
|
Changes look good, and I convinced myself that indeed COAP_ETAG_LENGTH_MAX is a CoAP limit and thus we don't expect that someone would change that. As I'm having trouble following the riotctrl test, I was trying to do some testing on my own ... is there really neither a test nor an example of the gcoap_forward_proxy module around? |
No, but that's probably something we should change long-term... |
If that's something up for discussion, it probably should have already been discussed in #17888... Maybe the bug that is fixed here would have been spotted earlier then too 😅 |
What trouble are you facing? |
|
Ping? |
|
I was trying to see what is all being started where in riotctrl -- but for reviewing this it's actually not critical: The changes look good, the tests look plausible and I trust you've run them. |
chrysn
left a comment
There was a problem hiding this comment.
Looks good, sorry for the delay in reviewing.
|
Let's give Murdock a final spin on this... the last build was from mid-August. |
|
Let's get the jammy fixes in first. Looks like CI runs will fail anyway until those are sorted out. |
Contribution description
At the moment, the Max-Age option is not set in a forwarded Valid message by a forward proxy. This is a bug, as the downstream clients then assume that the Max-Age is the default 60s, possibly breaking Cache validation, if Max-Age actually was smaller. This PR fixes that.
During testing this fix, I found another bug in the client-side cache validation: when the ETag is shorter than 8 bytes (e.g. with the fileserver), it is shortened after the fact. For that the wrong bitmask was used to protect the Option Delta.
Testing procedure
I applied the following patch to add a Max-Age option to
gcoap_fileserverDetails
The following script should succeed:
On master (with 1135cc0 cherry-picked, otherwise the proxy will mangle the ETag), this does not succeed, as for the fourth get_test_txt() the client does not validate, but gets it from a wrongly configured cache.
Issues/PRs references