[riot-notifications] [RIOT-OS/RIOT] drivers/slipdev: report NETOPT_ADDRESS to simulate l2 address (#16531)

benpicco notifications at github.com
Mon Jun 7 00:20:00 CEST 2021



<!--
The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.
-->

### Contribution description

A lot of things break if `GNRC_NETIF_FLAGS_HAS_L2ADDR` is not set (failed asserts, no IPv6 IID)
In order to handle router advertisements and auto-configuration, generate a faux l2 address based on the netdev ID.


### Testing procedure

In combination with #16530 SLIP can now be used as a downstream interface for board to board communication:

I ran this on `same54-xpro` with examples/gnrc_networking with the following modules added:


```Make
USEMODULE += slipdev
USEMODULE += gnrc_dhcpv6_client_6lbr
CFLAGS += -DSLIPDEV_PARAM_UART=UART_DEV\(1\)
CFLAGS += -DCONFIG_GNRC_DHCPV6_CLIENT_6LBR_UPSTREAM=5
```

The SLIP interface now has a hardware address, which gives it a link-local address and the possibility to get a prefix via DHCPv6:

```
2021-06-07 00:13:08,232 # ifconfig
2021-06-07 00:13:08,233 # Iface  6 
2021-06-07 00:13:08,237 #           Long HWaddr: E6:EA:AF:F8:AF:5D:EB:E5 
2021-06-07 00:13:08,240 #           MTU:65535  HL:64  RTR  
2021-06-07 00:13:08,242 #           RTR_ADV  
2021-06-07 00:13:08,244 #           Link type: wired
2021-06-07 00:13:08,250 #           inet6 addr: fe80::e4ea:aff8:af5d:ebe5  scope: link  VAL
2021-06-07 00:13:08,257 #           inet6 addr: 2001:16b8:45fb:1dfc:e4ea:aff8:af5d:ebe5  scope: global  VAL
2021-06-07 00:13:08,260 #           inet6 group: ff02::2
2021-06-07 00:13:08,262 #           inet6 group: ff02::1
2021-06-07 00:13:08,266 #           inet6 group: ff02::1:ff5d:ebe5
2021-06-07 00:13:08,269 #           inet6 group: ff02::1a
2021-06-07 00:13:08,270 #           
2021-06-07 00:13:08,273 #           Statistics for Layer 2
2021-06-07 00:13:08,276 #             RX packets 1  bytes 64
2021-06-07 00:13:08,280 #             TX packets 11 (Multicast: 0)  bytes 1038
2021-06-07 00:13:08,284 #             TX succeeded 0 errors 0
2021-06-07 00:13:08,286 #           Statistics for IPv6
2021-06-07 00:13:08,289 #             RX packets 1  bytes 64
2021-06-07 00:13:08,294 #             TX packets 11 (Multicast: 11)  bytes 1038
2021-06-07 00:13:08,297 #             TX succeeded 11 errors 0
2021-06-07 00:13:08,297 # 
2021-06-07 00:13:08,301 # Iface  5  HWaddr: FC:C2:3D:0D:2D:1F 
2021-06-07 00:13:08,305 #           L2-PDU:1500  MTU:1492  HL:255  RTR  
2021-06-07 00:13:08,308 #           Source address length: 6
2021-06-07 00:13:08,310 #           Link type: wired
2021-06-07 00:13:08,316 #           inet6 addr: fe80::fec2:3dff:fe0d:2d1f  scope: link  VAL
2021-06-07 00:13:08,323 #           inet6 addr: 2001:16b8:45fb:1d00:fec2:3dff:fe0d:2d1f  scope: global  VAL
2021-06-07 00:13:08,326 #           inet6 group: ff02::2
2021-06-07 00:13:08,329 #           inet6 group: ff02::1
2021-06-07 00:13:08,332 #           inet6 group: ff02::1:ff0d:2d1f
2021-06-07 00:13:08,333 #           
2021-06-07 00:13:08,336 #           Statistics for Layer 2
2021-06-07 00:13:08,339 #             RX packets 43  bytes 9676
2021-06-07 00:13:08,344 #             TX packets 10 (Multicast: 8)  bytes 898
2021-06-07 00:13:08,347 #             TX succeeded 10 errors 0
2021-06-07 00:13:08,350 #           Statistics for IPv6
2021-06-07 00:13:08,353 #             RX packets 19  bytes 4459
2021-06-07 00:13:08,358 #             TX packets 10 (Multicast: 8)  bytes 758
2021-06-07 00:13:08,361 #             TX succeeded 10 errors 0
```

The node on the other side also gets a link-local and a global address:

```
2021-06-07 00:14:43,284 # Iface  5  HWaddr: 00:04:25:19:18:01:C9:05 
2021-06-07 00:14:43,288 #           MTU:65535  HL:64  RTR  
2021-06-07 00:14:43,289 #           
2021-06-07 00:14:43,291 #           Link type: wired
2021-06-07 00:14:43,297 #           inet6 addr: fe80::204:2519:1801:c905  scope: link  VAL
2021-06-07 00:14:43,304 #           inet6 addr: 2001:16b8:45fb:1dfc:204:2519:1801:c905  scope: global  VAL
2021-06-07 00:14:43,307 #           inet6 group: ff02::2
2021-06-07 00:14:43,310 #           inet6 group: ff02::1
2021-06-07 00:14:43,314 #           inet6 group: ff02::1:ff01:c905
2021-06-07 00:14:43,315 #           
2021-06-07 00:14:43,318 #           Statistics for Layer 2
2021-06-07 00:14:43,321 #             RX packets 1  bytes 104
2021-06-07 00:14:43,325 #             TX packets 6 (Multicast: 0)  bytes 392
2021-06-07 00:14:43,328 #             TX succeeded 0 errors 0
2021-06-07 00:14:43,331 #           Statistics for IPv6
2021-06-07 00:14:43,334 #             RX packets 1  bytes 104
2021-06-07 00:14:43,339 #             TX packets 6 (Multicast: 6)  bytes 392
2021-06-07 00:14:43,342 #             TX succeeded 6 errors 0
2021-06-07 00:14:43,342 # 
> ping 2600::
2021-06-07 00:14:48,175 # ping 2600::
2021-06-07 00:14:48,310 # 12 bytes from 2600::: icmp_seq=0 ttl=52 time=130.329 ms
2021-06-07 00:14:49,311 # 12 bytes from 2600::: icmp_seq=1 ttl=52 time=129.894 ms
2021-06-07 00:14:50,312 # 12 bytes from 2600::: icmp_seq=2 ttl=52 time=129.805 ms
2021-06-07 00:14:50,312 # 
2021-06-07 00:14:50,315 # --- 2600:: PING statistics ---
2021-06-07 00:14:50,320 # 3 packets transmitted, 3 packets received, 0% packet loss
2021-06-07 00:14:50,325 # round-trip min/avg/max = 129.805/130.009/130.329 ms
```

### Issues/PRs references

<!--
Examples: Fixes #1234. See also #5678. Depends on PR #9876.

Please use keywords (e.g., fixes, resolve) with the links to the issues you
resolved, this way they will be automatically closed when your pull request
is merged. See https://help.github.com/articles/closing-issues-using-keywords/.
-->

You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/16531

-- Commit Summary --

  * drivers/slipdev: report NETOPT_ADDRESS to simulate l2 address

-- File Changes --

    M drivers/slipdev/Makefile.dep (1)
    M drivers/slipdev/slipdev.c (5)
    M sys/include/net/gnrc/netif/conf.h (2)
    M sys/net/gnrc/netif/gnrc_netif.c (5)
    M sys/net/gnrc/netif/gnrc_netif_device_type.c (5)
    M sys/net/link_layer/l2util/l2util.c (9)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/16531.patch
https://github.com/RIOT-OS/RIOT/pull/16531.diff

-- 
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/16531
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210606/20c57f2a/attachment.htm>


More information about the notifications mailing list