pkg/lwip/netdev: fix return types in send()#21833
Conversation
|
According to the documentation, I added some error messages to /** Define LWIP_ERR_T in cc.h if you want to use
* a different type for your platform (must be signed). */
#ifdef LWIP_ERR_T
typedef LWIP_ERR_T err_t;
+#error Custom Type
#else /* LWIP_ERR_T */
typedef s8_t err_t;
+#error Default s8_t
#endif /* LWIP_ERR_T*/And this is the result: Therefore at some point, |
|
This is very odd: This is where And the header is actually used: |
Sure it's the right return type for the lwip callbacks, but not the right return type for the netdev callbacks. |
Not sure I follow, the return type of the function is literally RIOT/pkg/lwip/contrib/netdev/lwip_netdev.c Lines 273 to 283 in 1438aac Same for the old API: RIOT/pkg/lwip/contrib/netdev/lwip_netdev.c Lines 328 to 335 in 1438aac |
|
Oh... The only reason an issue might occur is if the return value of |
Yes, |
Yes, that's the same conclusion I had after writing the first reply:
Nevertheless the It's still odd that the return value of the function is implicitly cast to The function for the old API has to be changed too. |
I'll give you that :)
Good point, done now. |
|
Never wait for me with regard to squashing 😉 |
e53a6d6 to
a045acb
Compare
|
Thanks everyone for your reviews! 🤗 |
Contribution description
The netdev API returns
int, with negative meaning error conditions.err_t, which is currently used as the type for the return values, is unsigned. This would lead to spurious issues with error conditions.Testing procedure
sudo ip tuntap add tap0 mode tap user ${USER}; sudo ip link set tap0 up;LWIP_IPV6=1 make -C examples/networking/coap/gcoap_dtls flash termcoap-client-gnutls "coaps://[fe80::xxxx:xxxx:xxxx:xxxx%tap0]/.well-known/core" -k "secretPSK" -u "Client_identity"(libcoap cli client)On
masterthis fails withERR cannot send CoAP pduand Wireshark shows a DTLS abort package sent by RIOT right after the successfully sentServerHello. Enabling debug insock_dtls.c,lwip_sock.candlwip_netdev.cshows a problem.With the changes from this PR, everything works as expected.