Skip to content

Conversation

miri64
Copy link
Member

@miri64 miri64 commented Oct 23, 2020

Contribution description

This provides the capability on the gnrc_netif side to join or leave multicast groups on the link layer, such as Ethernet multicast addresses. When an interface joins an IPv6 address, it now also tries to join a multicast address on the device, as long as that device also supports that (not provided in this PR).

Testing procedure

examples/gnrc_networking should work as before. I will provide tests for the new functionality ASAP but currently there are none, that's why I marked this PR as still being WIP.

The following tests should pass on a supported platform of your choice:

  • tests/gnrc_netif
  • tests/l2utils

Issues/PRs references

When there is driver support for NETOPT_L2_GROUP and NETOPT_L2_GROUP_LEAVE, this should fix #13493.

@miri64 miri64 added Area: network Area: Networking State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet Type: new feature The issue requests / The PR implemements a new feature for RIOT labels Oct 23, 2020
@benpicco benpicco requested a review from maribu October 23, 2020 19:05
Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I remember this very feature coming up in an stm32_eth PR a couple weeks ago.

@miri64
Copy link
Member Author

miri64 commented Oct 26, 2020

The problem with pushing stuff right before finishing up for the weekend ^^"

@miri64
Copy link
Member Author

miri64 commented Oct 26, 2020

Fixed compile-time errors pointed out by @JannesVolkens.

@miri64
Copy link
Member Author

miri64 commented Oct 26, 2020

Addressed @benpicco's comments.

@JannesVolkens
Copy link
Contributor

Testing output from the nucleo-f207zg:

ifconfig
2020-10-26 12:07:04,201 #  ifconfig
2020-10-26 12:07:04,205 # Iface  5  HWaddr: AA:B8:88:09:B2:6F  Link: up 
2020-10-26 12:07:04,210 #           L2-PDU:1500  MTU:1500  HL:64  RTR  
2020-10-26 12:07:04,212 #           RTR_ADV  
2020-10-26 12:07:04,215 #           Source address length: 6
2020-10-26 12:07:04,217 #           Link type: wired
2020-10-26 12:07:04,223 #           inet6 addr: fe80::a8b8:88ff:fe09:b26f  scope: link  VAL
2020-10-26 12:07:04,225 #           inet6 group: ff02::2
2020-10-26 12:07:04,228 #           inet6 group: ff02::1
2020-10-26 12:07:04,232 #           inet6 group: ff02::1:ff09:b26f
2020-10-26 12:07:04,233 #           
2020-10-26 12:07:04,235 #           Statistics for Layer 2
2020-10-26 12:07:04,239 #             RX packets 4  bytes 648
2020-10-26 12:07:04,243 #             TX packets 4 (Multicast: 4)  bytes 312
2020-10-26 12:07:04,246 #             TX succeeded 4 errors 0
2020-10-26 12:07:04,249 #           Statistics for IPv6
2020-10-26 12:07:04,252 #             RX packets 5  bytes 456
2020-10-26 12:07:04,257 #             TX packets 4 (Multicast: 4)  bytes 256
2020-10-26 12:07:04,260 #             TX succeeded 4 errors 0
2020-10-26 12:07:04,260 # 
ping6 fe80::d941:e3fd:1e26:ad1b
2020-10-26 12:07:08,398 #  ping6 fe80::d941:e3fd:1e26:ad1b
2020-10-26 12:07:08,405 # 12 bytes from fe80::d941:e3fd:1e26:ad1b%5: icmp_seq=0 ttl=64 time=0.596 ms
2020-10-26 12:07:09,406 # 12 bytes from fe80::d941:e3fd:1e26:ad1b%5: icmp_seq=1 ttl=64 time=1.396 ms
2020-10-26 12:07:10,405 # 12 bytes from fe80::d941:e3fd:1e26:ad1b%5: icmp_seq=2 ttl=64 time=0.347 ms
2020-10-26 12:07:10,405 # 
2020-10-26 12:07:10,409 # --- fe80::d941:e3fd:1e26:ad1b PING statistics ---
2020-10-26 12:07:10,414 # 3 packets transmitted, 3 packets received, 0% packet loss
2020-10-26 12:07:10,418 # round-trip min/avg/max = 0.347/0.779/1.396 ms

@benpicco
Copy link
Contributor

please squash.

@miri64
Copy link
Member Author

miri64 commented Oct 26, 2020

Added tests and fixed revealed bugs, no longer WIP.

@miri64 miri64 force-pushed the ethernet/enh/join-leave-mcast-group branch from 2ef6175 to 439df12 Compare October 26, 2020 13:53
@miri64 miri64 removed the State: WIP State: The PR is still work-in-progress and its code is not in its final presentable form yet label Oct 26, 2020
@miri64
Copy link
Member Author

miri64 commented Oct 26, 2020

please squash.

Now that the PR is no longer WIP, I am willing to squash. The PR is officially now ready for review and testing ;-).

@miri64
Copy link
Member Author

miri64 commented Oct 26, 2020

I've updated OP to reflect the testing with the provided tests.

Copy link
Member

@maribu maribu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some comments inline

@miri64
Copy link
Member Author

miri64 commented Oct 26, 2020

Addressed @maribu's comments and then some ;-).

Copy link
Contributor

@JannesVolkens JannesVolkens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New testing output from the nucleo-f207zg:

  • examples/gnrc_networking
ifconfig
2020-10-27 22:10:20,072 # ifconfig
2020-10-27 22:10:20,077 # Iface  5  HWaddr: AA:B8:88:09:B2:6F  Link: up 
2020-10-27 22:10:20,081 #           L2-PDU:1500  MTU:1500  HL:64  RTR  
2020-10-27 22:10:20,082 #           RTR_ADV  
2020-10-27 22:10:20,085 #           Source address length: 6
2020-10-27 22:10:20,088 #           Link type: wired
2020-10-27 22:10:20,094 #           inet6 addr: fe80::a8b8:88ff:fe09:b26f  scope: link  VAL
2020-10-27 22:10:20,096 #           inet6 group: ff02::2
2020-10-27 22:10:20,099 #           inet6 group: ff02::1
2020-10-27 22:10:20,103 #           inet6 group: ff02::1:ff09:b26f
2020-10-27 22:10:20,103 #           
2020-10-27 22:10:20,106 #           Statistics for Layer 2
2020-10-27 22:10:20,109 #             RX packets 3  bytes 559
2020-10-27 22:10:20,114 #             TX packets 1 (Multicast: 1)  bytes 78
2020-10-27 22:10:20,118 #             TX succeeded 1 errors 0
2020-10-27 22:10:20,120 #           Statistics for IPv6
2020-10-27 22:10:20,123 #             RX packets 2  bytes 189
2020-10-27 22:10:20,127 #             TX packets 1 (Multicast: 1)  bytes 64
2020-10-27 22:10:20,130 #             TX succeeded 1 errors 0
2020-10-27 22:10:20,131 # 
ping6 fe80::d941:e3fd:1e26:ad1b
2020-10-27 22:11:11,775 #  ping6 fe80::d941:e3fd:1e26:ad1b
2020-10-27 22:11:11,782 # 12 bytes from fe80::d941:e3fd:1e26:ad1b%5: icmp_seq=0 ttl=64 time=1.147 ms
2020-10-27 22:11:12,781 # 12 bytes from fe80::d941:e3fd:1e26:ad1b%5: icmp_seq=1 ttl=64 time=0.756 ms
2020-10-27 22:11:13,782 # 12 bytes from fe80::d941:e3fd:1e26:ad1b%5: icmp_seq=2 ttl=64 time=1.221 ms
2020-10-27 22:11:13,783 # 
2020-10-27 22:11:13,786 # --- fe80::d941:e3fd:1e26:ad1b PING statistics ---
2020-10-27 22:11:13,792 # 3 packets transmitted, 3 packets received, 0% packet loss
2020-10-27 22:11:13,796 # round-trip min/avg/max = 0.756/1.041/1.221 ms
  • tests/gnrc_netif
2020-10-27 22:16:23,800 # START
2020-10-27 22:16:23,811 # ............................................................................
2020-10-27 22:16:23,812 # OK (76 tests)
2020-10-27 22:16:23,815 # Sending data from Ethernet device:
2020-10-27 22:16:23,823 # 00000000  3E  E6  B5  0F  19  23  3E  E6  B5  22  FD  0A  FF  FF  41  42
2020-10-27 22:16:23,824 # 00000010  43  44  45  46  47  00
2020-10-27 22:16:23,828 # Sending data from Ethernet device:
2020-10-27 22:16:23,834 # 00000000  FF  FF  FF  FF  FF  FF  3E  E6  B5  22  FD  0A  FF  FF  41  42
2020-10-27 22:16:23,837 # 00000010  43  44  45  46  47  00
2020-10-27 22:16:23,841 # Sending data from IEEE 802.15.4 device:
2020-10-27 22:16:23,847 # 00000000  41  DC  00  00  00  0B  FD  22  19  0F  B5  E6  3E  0A  FD  22
2020-10-27 22:16:23,854 # 00000010  19  0F  B5  E6  3E  31  32  33  41  42  43  44  45  46  47  00
2020-10-27 22:16:23,858 # Sending data from IEEE 802.15.4 device:
2020-10-27 22:16:23,864 # 00000000  41  D8  01  00  00  0B  FD  0A  FD  22  19  0F  B5  E6  3E  31
2020-10-27 22:16:23,869 # 00000010  32  33  41  42  43  44  45  46  47  00
2020-10-27 22:16:23,872 # Sending data from IEEE 802.15.4 device:
2020-10-27 22:16:23,879 # 00000000  41  9C  02  00  00  0B  FD  22  19  0F  B5  E6  3E  0A  FD  31
2020-10-27 22:16:23,883 # 00000010  32  33  41  42  43  44  45  46  47  00
2020-10-27 22:16:23,887 # Sending data from IEEE 802.15.4 device:
2020-10-27 22:16:23,893 # 00000000  41  9C  03  00  00  0B  FD  22  19  0F  B5  E6  3E  0A  FD  31
2020-10-27 22:16:23,897 # 00000010  32  33  41  42  43  44  45  46  47  00
2020-10-27 22:16:23,901 # Sending data from IEEE 802.15.4 device:
2020-10-27 22:16:23,908 # 00000000  41  98  04  00  00  0B  FD  0A  FD  31  32  33  41  42  43  44
2020-10-27 22:16:23,910 # 00000010  45  46  47  00
2020-10-27 22:16:23,914 # Sending data from IEEE 802.15.4 device:
2020-10-27 22:16:23,920 # 00000000  41  D8  05  00  00  FF  FF  0A  FD  22  19  0F  B5  E6  3E  31
2020-10-27 22:16:23,925 # 00000010  32  33  41  42  43  44  45  46  47  00
2020-10-27 22:16:23,928 # Sending data from IEEE 802.15.4 device:
2020-10-27 22:16:23,935 # 00000000  41  98  06  00  00  FF  FF  0A  FD  31  32  33  41  42  43  44
2020-10-27 22:16:23,937 # 00000010  45  46  47  00
2020-10-27 22:16:23,940 # Sending data from Ethernet device:
2020-10-27 22:16:23,947 # 00000000  3E  E6  B5  0F  19  23  3E  E6  B5  22  FD  0A  86  DD  60  00
2020-10-27 22:16:23,953 # 00000010  00  00  00  08  3B  40  FE  80  00  00  00  00  00  00  3C  E6
2020-10-27 22:16:23,960 # 00000020  B5  FF  FE  22  FD  0A  FE  80  00  00  00  00  00  00  3C  E6
2020-10-27 22:16:23,966 # 00000030  B5  FF  FE  0F  19  23  41  42  43  44  45  46  47  00
2020-10-27 22:16:23,969 # Sending data from Ethernet device:
2020-10-27 22:16:23,976 # 00000000  33  33  00  00  00  01  3E  E6  B5  22  FD  0A  86  DD  60  00
2020-10-27 22:16:23,983 # 00000010  00  00  00  08  3B  40  FE  80  00  00  00  00  00  00  3C  E6
2020-10-27 22:16:23,989 # 00000020  B5  FF  FE  22  FD  0A  FF  02  00  00  00  00  00  00  00  00
2020-10-27 22:16:23,995 # 00000030  00  00  00  00  00  01  41  42  43  44  45  46  47  00
2020-10-27 22:16:23,998 # Sending data from IEEE 802.15.4 device:
2020-10-27 22:16:24,005 # 00000000  41  DC  07  00  00  0B  FD  22  19  0F  B5  E6  3E  0A  FD  22
2020-10-27 22:16:24,011 # 00000010  19  0F  B5  E6  3E  60  00  00  00  00  08  3B  40  FE  80  00
2020-10-27 22:16:24,018 # 00000020  00  00  00  00  00  3C  E6  B5  0F  19  22  FD  0A  FE  80  00
2020-10-27 22:16:24,025 # 00000030  00  00  00  00  00  3C  E6  B5  FF  FE  0F  19  23  41  42  43
2020-10-27 22:16:24,028 # 00000040  44  45  46  47  00
2020-10-27 22:16:24,031 # Sending data from IEEE 802.15.4 device:
2020-10-27 22:16:24,038 # 00000000  41  D8  08  00  00  FF  FF  0A  FD  22  19  0F  B5  E6  3E  60
2020-10-27 22:16:24,044 # 00000010  00  00  00  00  08  3B  40  FE  80  00  00  00  00  00  00  3C
2020-10-27 22:16:24,051 # 00000020  E6  B5  0F  19  22  FD  0A  FF  02  00  00  00  00  00  00  00
2020-10-27 22:16:24,057 # 00000030  00  00  00  00  00  00  01  41  42  43  44  45  46  47  00
2020-10-27 22:16:24,061 # pktdump dumping Ethernet packet with empty payload
2020-10-27 22:16:24,064 # PKTDUMP: data received:
2020-10-27 22:16:24,068 # ~~ SNIP  0 - size:   0 byte, type: NETTYPE_UNDEF (0)
2020-10-27 22:16:24,073 # ~~ SNIP  1 - size:  20 byte, type: NETTYPE_NETIF (-1)
2020-10-27 22:16:24,076 # if_pid: 5  rssi: 0  lqi: 0
2020-10-27 22:16:24,076 # flags: 0x0
2020-10-27 22:16:24,079 # src_l2addr: 3E:E6:B5:22:FD:0B
2020-10-27 22:16:24,082 # dst_l2addr: 3E:E6:B5:22:FD:0A
2020-10-27 22:16:24,085 # ~~ PKT    -  2 snips, total size:  20 byte
2020-10-27 22:16:24,090 # pktdump dumping IEEE 802.15.4 packet with empty payload
2020-10-27 22:16:24,093 # PKTDUMP: data received:
2020-10-27 22:16:24,098 # ~~ SNIP  0 - size:   0 byte, type: NETTYPE_UNDEF (0)
2020-10-27 22:16:24,102 # ~~ SNIP  1 - size:  24 byte, type: NETTYPE_NETIF (-1)
2020-10-27 22:16:24,104 # if_pid: 6  rssi: 8  lqi: 0
2020-10-27 22:16:24,105 # flags: 0x0
2020-10-27 22:16:24,108 # src_l2addr: 3E:E6:B5:0F:19:22:FD:0B
2020-10-27 22:16:24,112 # dst_l2addr: 3E:E6:B5:0F:19:22:FD:0A
2020-10-27 22:16:24,115 # ~~ PKT    -  2 snips, total size:  24 byte
2020-10-27 22:16:24,120 # pktdump dumping Ethernet packet with payload 12 34 45 56
2020-10-27 22:16:24,122 # PKTDUMP: data received:
2020-10-27 22:16:24,127 # ~~ SNIP  0 - size:   4 byte, type: NETTYPE_UNDEF (0)
2020-10-27 22:16:24,129 # 00000000  12  34  45  56
2020-10-27 22:16:24,134 # ~~ SNIP  1 - size:  20 byte, type: NETTYPE_NETIF (-1)
2020-10-27 22:16:24,136 # if_pid: 5  rssi: 0  lqi: 0
2020-10-27 22:16:24,137 # flags: 0x0
2020-10-27 22:16:24,140 # src_l2addr: 3E:E6:B5:22:FD:0B
2020-10-27 22:16:24,143 # dst_l2addr: 3E:E6:B5:22:FD:0A
2020-10-27 22:16:24,146 # ~~ PKT    -  2 snips, total size:  24 byte
2020-10-27 22:16:24,152 # pktdump dumping IEEE 802.15.4 packet with payload 12 34 45 56
2020-10-27 22:16:24,154 # PKTDUMP: data received:
2020-10-27 22:16:24,159 # ~~ SNIP  0 - size:   4 byte, type: NETTYPE_UNDEF (0)
2020-10-27 22:16:24,161 # 00000000  12  34  45  56
2020-10-27 22:16:24,166 # ~~ SNIP  1 - size:  24 byte, type: NETTYPE_NETIF (-1)
2020-10-27 22:16:24,168 # if_pid: 6  rssi: 8  lqi: 0
2020-10-27 22:16:24,169 # flags: 0x0
2020-10-27 22:16:24,172 # src_l2addr: 3E:E6:B5:0F:19:22:FD:0B
2020-10-27 22:16:24,175 # dst_l2addr: 3E:E6:B5:0F:19:22:FD:0A
2020-10-27 22:16:24,179 # ~~ PKT    -  2 snips, total size:  28 byte
2020-10-27 22:16:24,184 # pktdump dumping IPv6 over Ethernet packet with payload 01
2020-10-27 22:16:24,186 # PKTDUMP: data received:
2020-10-27 22:16:24,191 # ~~ SNIP  0 - size:  41 byte, type: NETTYPE_IPV6 (2)
2020-10-27 22:16:24,195 # traffic class: 0x00 (ECN: 0x0, DSCP: 0x00)
2020-10-27 22:16:24,196 # flow label: 0x00000
2020-10-27 22:16:24,200 # length: 1  next header: 59  hop limit: 64
2020-10-27 22:16:24,204 # source address: fe80::3fe6:b5ff:fe22:fd0a
2020-10-27 22:16:24,208 # destination address: fe80::3fe6:b5ff:fe22:fd0b
2020-10-27 22:16:24,209 # 00000000  01
2020-10-27 22:16:24,214 # ~~ SNIP  1 - size:  20 byte, type: NETTYPE_NETIF (-1)
2020-10-27 22:16:24,216 # if_pid: 5  rssi: 0  lqi: 0
2020-10-27 22:16:24,217 # flags: 0x0
2020-10-27 22:16:24,219 # src_l2addr: 3E:E6:B5:22:FD:0B
2020-10-27 22:16:24,222 # dst_l2addr: 3E:E6:B5:22:FD:0A
2020-10-27 22:16:24,226 # ~~ PKT    -  2 snips, total size:  61 byte
  • tests/l2util
s
2020-10-27 22:20:29,459 # START
2020-10-27 22:20:29,465 # main(): This is RIOT! (Version: 2020.07-devel-4093-gfc36d-HEAD)
2020-10-27 22:20:29,466 # .............
2020-10-27 22:20:29,468 # OK (13 tests)

#else /* IS_USED(MODULE_GNRC_NETIF_IPV6) || defined(DOXYGEN) */
#define gnrc_netif_ipv6_init_mtu(netif) (void)netif
#define gnrc_netif_ipv6_iid_from_addr(netif, addr, addr_len, iid) (-ENOTSUP)
#define gnrc_netif_ipv6_iid_to_addr(netif, iid, addr) (-ENOTSUP)
#define gnrc_netif_ndp_addr_len_from_l2ao(netif, opt) (-ENOTSUP)
#define gnrc_netif_ipv6_get_iid(netif, iid) (-ENOTSUP)
#define gnrc_netif_ipv6_group_to_l2_group(netif, ipv6_group l2_group) (-ENOTSUP)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like the indentation is off here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally, but can adopt, if required.

Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please squash.

@miri64
Copy link
Member Author

miri64 commented Oct 29, 2020

Squashed.

@miri64 miri64 force-pushed the ethernet/enh/join-leave-mcast-group branch from fea01d8 to e6ae572 Compare October 29, 2020 12:29
@miri64
Copy link
Member Author

miri64 commented Oct 29, 2020

Squashed.

--force-with-lease prevented pushing though and saved my but once more (made a change on another machine ;-))

@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR CI: run tests If set, CI server will run tests on hardware for the labeled PR labels Oct 29, 2020
@miri64 miri64 force-pushed the ethernet/enh/join-leave-mcast-group branch from e6ae572 to 50f832c Compare October 29, 2020 12:39
@miri64
Copy link
Member Author

miri64 commented Oct 29, 2020

Murdock was not happy. Fixed and squashed the issue.

@miri64 miri64 force-pushed the ethernet/enh/join-leave-mcast-group branch from 50f832c to 6a28f96 Compare October 29, 2020 12:56
@miri64
Copy link
Member Author

miri64 commented Oct 29, 2020

The errors in the run test targets seem unrelated:

For the rest, I will provide a fix ASAP.

@miri64 miri64 removed the CI: run tests If set, CI server will run tests on hardware for the labeled PR label Oct 29, 2020
@miri64 miri64 force-pushed the ethernet/enh/join-leave-mcast-group branch from 6a28f96 to ad3c8ba Compare October 29, 2020 13:39
@miri64
Copy link
Member Author

miri64 commented Oct 29, 2020

Finally, Murdock is happy. @benpicco do you want to give this a final look?

@benpicco benpicco merged commit 9e4dd8e into RIOT-OS:master Oct 29, 2020
@benpicco
Copy link
Contributor

Still looks good.

@miri64 miri64 deleted the ethernet/enh/join-leave-mcast-group branch October 29, 2020 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ethernet: Missing multicast addr assignment
4 participants