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

Various bug fixes in the network stack #46

Merged
merged 8 commits into from
Oct 29, 2024
Merged

Various bug fixes in the network stack #46

merged 8 commits into from
Oct 29, 2024

Conversation

hlef
Copy link
Collaborator

@hlef hlef commented Oct 24, 2024

This PR clears some of my bugfix TODO list. This addresses a lot of documentation issues, but also actual bugs such as #43.

@hlef hlef requested a review from davidchisnall October 24, 2024 17:31
@hlef hlef force-pushed the hlefeuvre/bug-fixes branch 3 times, most recently from 05a1ee6 to 229ec5e Compare October 24, 2024 17:46
include/endianness.h Outdated Show resolved Hide resolved
lib/tcpip/network-internal.h Show resolved Hide resolved
hlef added 7 commits October 28, 2024 17:24
This got introduced in 5269a8e as part
of a refactoring and prevents the file to build when debugging is
enabled.

Signed-off-by: Hugo Lefeuvre <[email protected]>
We had copies of `ntohs` and `htons` in the firewall, the netapi, and
the TCP/IP stack, implemented differently. In practice these differences
shouldn't matter, but this is still confusing.

Signed-off-by: Hugo Lefeuvre <[email protected]>
We have a number of APIs in the firewall and the netAPI which do not
specify in which endianness arguments should be provided. Further, we
have many cases where we use `ntohs` and `htons` the incorrect way
around.

Ensure that endianness of APIs is documented everywhere and conversions
are done correctly.

Also, consistently use `htons` and `ntohs`, not `FreeRTOS_htons` and
`FreeRTOS_ntohs`.

Signed-off-by: Hugo Lefeuvre <[email protected]>
This got outdated when we added UDP, it can be called from both NetAPI
and TCP/IP.

Signed-off-by: Hugo Lefeuvre <[email protected]>
The definition of the struct in `struct ConnectionCapability` and in
`DECLARE_AND_DEFINE_CONNECTION_CAPABILITY` differ in the type of `port`.

The struct definition uses `uint16_t` and the macro `short`.

`short` is signed and may be longer that 16 bits. This is not a problem
right now but may lead to portability issues.

Signed-off-by: Hugo Lefeuvre <[email protected]>
The TLS currently uses null as error value for pointer types, which does
not work well when the compartment fails with `-ECOMPARTMENTFAIL` or
`-ENOTENOUGHSTACK`. Document error values for pointer types as untagged
values instead of null.

This does not require changes in the TLS implementation, as null is
itself untagged.

Also clarify blocking behavior for each API.

Signed-off-by: Hugo Lefeuvre <[email protected]>
The `topic` and `payload` capabilities of the publish callback are only
valid within the context of the callback. They should thus passed as a
read-only, non-capturable capabilities.

Currently we pass them as capturable and writable capabilities, which
may allow API users to compromise the MQTT compartment.

This addresses issue #43.

Signed-off-by: Hugo Lefeuvre <[email protected]>
@hlef hlef force-pushed the hlefeuvre/bug-fixes branch from 229ec5e to 9409c18 Compare October 29, 2024 00:24
@hlef
Copy link
Collaborator Author

hlef commented Oct 29, 2024

Sounds like CI is failing because of CHERIoT-Platform/cheriot-rtos@c3c0fb1

@hlef
Copy link
Collaborator Author

hlef commented Oct 29, 2024

Comments addressed!

@hlef hlef requested a review from davidchisnall October 29, 2024 00:37
The RTOS core changed the queue API:
CHERIoT-Platform/cheriot-rtos@c3c0fb1

This requires slight changes to the network stack reset code, which
plugs in at this lower-level API.

Signed-off-by: Hugo Lefeuvre <[email protected]>
@hlef
Copy link
Collaborator Author

hlef commented Oct 29, 2024

Sounds like CI is failing because of CHERIoT-Platform/cheriot-rtos@c3c0fb1

Should be fixed now.

@hlef hlef merged commit a258eca into main Oct 29, 2024
2 checks passed
@hlef hlef deleted the hlefeuvre/bug-fixes branch October 29, 2024 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants