-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Missing drop implementations in netdev_driver_t::recv #10410
Comments
Wow, that was a fast response time :-) Thanks, I updated the table accordingly |
@maribu thanks for taking this on. I checked the proposed kw41zrf driver in #7107 and it does implement drop and size correctly, dropping the frame when buf == NULL, len != 0 A related API question, should the buffered frame be dropped when recv is called with buf != NULL and len != 0, but len < frame_len? |
Good question. I have a few ideas that could benefit from being able to first read part of the frame before reading the full frame. For example a bit of netdev that first reads the link layer addresses to check whether the device wants the frame or that it should be dropped. No need to spend time pulling in the full frame from the radio then. |
This would allow the most flexibility, but upper layer code must be prepared to explicitly drop if it does not intend to retry with a bigger buffer. But as drivers can often share upper layer code, I would argue to let the upper layer handle this. Moving complexity to more common used code seems to be a better choice regarding maintainability. Also the documentation on this could be improved quite a bit:
|
RIOT/drivers/at86rf2xx/at86rf2xx_netdev.c Lines 152 to 157 in 836fe3d
Update: This is a backport of the fix of this issue. So in current master it is fixed. I will add the PR to the tracking |
The netdev_driver_t::recv implementation of the w5100 does not provide the drop feature. This commit adds it. Fixes: RIOT-OS#10410
@gebart: Thanks for raising the question on how |
@PeterKietzmann, @jfischer-phytec-iot, @gebart: Regarding the |
If the kw2xdrf radio works like the kw41zrf radio, then the buffer may be overwritten whenever the transceiver is switched back into R sequence, which could happen after reading the frame length depending on the driver implementation. So there may be a race condition bug waiting to happen where reading the size removes the frame buffer write protection, and a new frame is received before the actual read out of the frame buffer has been done in the second call to recv. |
@maribu There are some ESP{32,8266} module that also implement netdev (@gschorcht ping :) ), not sure what the status there is though. |
@aabadie: You seem to have worked a lot on the |
The ESP32 is not affected (checked for |
@bergzand ESP8266 and ESP32 netdev drivers drop packets according to interface defitinition. When I started to implement them, I read the API documentation for netdev_driver::recv very carefully 😉 |
Awesome, good to hear that. :) |
I guess this should stay open? @miri64 |
@PeterKietzmann, @jfischer-phytec-iot, @gebart: Could one of you confirm it is unaffected? |
The netdev_driver_t::recv implementation of the w5100 does not provide the drop feature. This commit adds it. Fixes: RIOT-OS#10410
@maribu can this be left close now? |
Ups, this was a too-eager autoclose. I'll just update the list. |
No. I just got confused with some network drivers being in |
Both are not affected |
The distinction is simple: in drivers are devices that can be on a board, the one in the one in |
The netdev_driver_t::recv implementation of the encx24j600 does not provide the drop feature. This commit adds it. Fixes: RIOT-OS#10410
Oh, I totally forgot about this issue :-( Did someone by chance fix the remaining drivers? |
The However, the driver goes back to RX the very moment the frame is completely received, regardless on whether the |
@PeterKietzmann @MrKevinWeiss or @leandrolanzieri can you do that, please. Also, what the state of the other drivers marked as AFFECTED in OP? |
Description
Some implementations of
netdev_driver_t::recv(netdev_t *dev, void *buf, size_t len, void *info)
do not implement the drop case ((buf == NULL) && (len != 0)
). This issue should track the effort to provide the missing implementations.In case the upper layer used for the driver never uses the drop feature of
recv
, an implementation of the drop feature is not required, if instead correspondingassert()
s are added and this is documented properly.Tracking
ata8520e
at86rf2xx
cc110x
cc2420
cc2538_rf
enc28j60
encx24j600
esp32/esp-eth
esp32/esp-now
esp32/esp-wifi
esp8266
ethos
kw2xrf
kw41zrf
(#7107)mrf24j40
netdev_tun
nrfble
nrfmin
rn2xx3
slipdev
sx127x
socket_zep
w5100
xbee
(*) Driver does not use the
netdev_driver_t
API, so it cannot be affected.Update 1: Fixed typo
Update 2: Updated state of
mrf24j40
Update 3: Added
kw41zrf
Update 4: Cleaned up legend
Update 5: Added link to PR for
w5100
fixUpdate 6: Added link to PR for
encx24j600
, updated state ofencx24j600
&w5100
Update 7: Added link to PR for
cc2420
and updated its stateUpdate 8: Added
esp32
netdev_driver_t
implementationsUpdate 9: Added
esp8266
, confirmed thatata8520e
andrn2xx3
are not using thenetdev_driver_t
API (yet) and are, thus, unaffectedUpdate 10: Corrected state for
at86rf2xx
Update 11:
enc28j60
andcc2420
are now fixedUpdate 12:
w5100
is now fixedUpdate 13: encx24j600 fix merged
Update 14: Added
cc2538_rf
andnetdev_tun
Update 15: After looking more closely into
cc2538_rf
, the error handling in the drop case withpkt_len > CC2538_RF_MAX_DATA_LEN
is just fine. Socc2538_rf
is not affectedThe text was updated successfully, but these errors were encountered: