Commit graph

13 commits

Author SHA1 Message Date
bunnie
043dfd84ae update formatting to latest nightly rules 2024-09-24 01:49:45 +08:00
bunnie
8d30c5bfc5 format services/net 2024-01-14 22:31:48 +08:00
bunnie
5e411f3562 clean up warnings, fix icmp init 2023-09-29 06:36:27 +08:00
bunnie
64e9248815 move smoltcp to latest; no hard errors, but also panics 2023-09-29 05:30:55 +08:00
Sean Cross
5dfad296ae xous: mark MemoryRange::as_slice and friends as unsafe
Mark `MemoryRange::as_slice()` and `MemoryRange::as_slice_mut()` as
unsafe.

This is due to the fact that not all representable types can be cast to
an arbitrary value. For example, if Process A sends random values to
Process B, then Process B casts the memory to a slice of `bool`, then
any values that are not 0 or 1 are undefined.

Because these functions can leak UB into the program, they are marked as
unsafe.

This patch adds `unsafe {}` blocks to all instances where this function
is called. Additionally, all instances have been checked to verify that
they do not cast to any invalid types -- most use `u8` or `u32`.

Additionally, the long-deprecated `MemoryRange::from_parts()` call was
removed, since that causes UB without being marked as unsafe.

Signed-off-by: Sean Cross <sean@xobs.io>
2023-09-12 10:07:38 +08:00
bunnie
17e9a210ef add maintenanence notes referring to relevant smoltcp issues 2022-05-13 01:21:41 +08:00
bunnie
bac650808d force all UDP packets to respond on the local IP address
smoltcp is written to allow multiple adapters, so 0.0.0.0 as
the binding for UDP is illegal. However, in Rust, it seems that
0.0.0.0 is "totally fine" and most OSes will resolve this to
a "default" adapter.

this patch introduces the behavior of taking 0.0.0.0 and mapping
it to a default adapter. In fact, we only allow binding to the
default adapter. The reasoning behind this is that if our IP
address changes, we would expect that 0.0.0.0 resolves to that.

Where this scheme fails is if someone binds to 127.0.0.1 expecting
it to not respond to packets coming in from the outside, e.g.
they are using UDP as a loopback interface. I think this isn't
a common use case for Xous, but if it does become one I suppose
we could add a code path to also check for the 127.0.0.1 case
and try to handle it...
2022-05-12 22:26:38 +08:00
bunnie
cc7e7f97c7 update smoltcp to 0.8.0
the refactor changes the way sockets are handled, so now, when
the interface is rebound we are certain to get panics.

working on resolving this detail now, but at least the interface
is working now and it seems more stable than before.
2022-05-12 09:27:51 +08:00
bunnie
a555f0380e initial tcplistener draft 2022-04-16 06:26:08 +08:00
bunnie
532c4a4f1f add NTP to time setting via SNTP library 2022-04-05 04:19:53 +08:00
bunnie
cbb1e3f944 fix various bugs related to UDP; prep for transition to libstd-only UDP 2022-04-05 00:39:56 +08:00
bunnie
57339dfe2f udp libstd passing inital tests 2022-04-04 22:37:01 +08:00
bunnie
b5a6c436c2 first draft at some basic libstd UDP mechanics 2022-04-04 04:49:17 +08:00