[riot-notifications] [RIOT-OS/RIOT] drivers: net: add ethocan (Ethernet-over-CAN) driver (#10710)

Juergen Fitschen notifications at github.com
Wed Feb 13 12:50:43 CET 2019


jue89 commented on this pull request.



> +
+    /* If we havn't received a valid END octect just drop the incomplete frame. */
+    if (!end) {
+        DEBUG("ethocan _isr(): incomplete frame -> drop\n");
+        clear_recv_buf(ctx);
+        return;
+    }
+
+    /* The set dirty flag prevents recv_buf or recv_buf_ptr from being
+     * touched in ISR context. Thus, it is safe to work with them without
+     * IRQs being disabled or mutexes being locked. */
+
+    /* Check the dst mac addr if the iface is not in promiscous mode */
+    if (!opt_isset(ctx, ETHOCAN_OPT_PROMISCUOUS)) {
+        ethernet_hdr_t *hdr = (ethernet_hdr_t *) ctx->recv_buf;
+        if ((hdr->dst[0] & 0x1) == 0 && memcmp(hdr->dst, ctx->mac_addr, ETHERNET_ADDR_LEN) != 0) {

This bit identifies multicast and broadcast addresses. If I understood the Ethernet spec correctly, this bit is only zero if it is a unicast frame.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/10710#discussion_r256361464
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190213/a95d3db1/attachment.html>


More information about the notifications mailing list