-
Notifications
You must be signed in to change notification settings - Fork 2.1k
gnrc_netif: add capability to join or leave link layer multicast groups #15287
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
gnrc_netif: add capability to join or leave link layer multicast groups #15287
Conversation
There was a problem hiding this 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.
The problem with pushing stuff right before finishing up for the weekend ^^" |
Fixed compile-time errors pointed out by @JannesVolkens. |
Addressed @benpicco's comments. |
Testing output from the nucleo-f207zg:
|
please squash. |
Added tests and fixed revealed bugs, no longer WIP. |
2ef6175
to
439df12
Compare
Now that the PR is no longer WIP, I am willing to squash. The PR is officially now ready for review and testing ;-). |
I've updated OP to reflect the testing with the provided tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some comments inline
Addressed @maribu's comments and then some ;-). |
There was a problem hiding this 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) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please squash.
Squashed. |
fea01d8
to
e6ae572
Compare
|
e6ae572
to
50f832c
Compare
Murdock was not happy. Fixed and squashed the issue. |
50f832c
to
6a28f96
Compare
The errors in the run test targets seem unrelated: For the rest, I will provide a fix ASAP. |
The request is forwarded to the device.
6a28f96
to
ad3c8ba
Compare
Finally, Murdock is happy. @benpicco do you want to give this a final look? |
Still looks good. |
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
andNETOPT_L2_GROUP_LEAVE
, this should fix #13493.