Datagrams should either be fully sent or not sent at all if networking buffers or network interface MTU does not allow that. Verify that by trying to send MTU+1 bytes in case of IPv4 (as IP level fragmentation is not implemented) and IPv6 (should fail when IPv6 fragmentation support is not enabled and succeed otherwise). In case of IPv6 try to send "total number of network buffers + 1", so that even with IPv6 fragmentation enabled requested datagram will not be sent. In all tested cases when datagram is too big, check that ENOMEM error code is set. NOTE: Tested behavior is not 100% compliant with Linux, as on Linux EMSGSIZE error code is set when trying to send datagram bigger than MTU, when manually disabling IP fragmentation (by setting IP_MTU_DISCOVER to IP_PMTUDISC_DO). However, it is not trivial to implement such behavior (EMSGSIZE error due to MTU) now and there is always a risk of running out of buffers (and getting ENOMEM), so for now implemented tests just assume the latter case to always happen. Add 3rd testcase, which enables IPv6 fragmentation support, so that UDP socket behavior can be tested in that context. Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev> |
||
|---|---|---|
| .. | ||
| src | ||
| CMakeLists.txt | ||
| generate-c-string.py | ||
| prj.conf | ||
| testcase.yaml | ||