Skip to content
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

examples/gnrc_border_router: add option to re-use existing TAP interface #18836

Merged
merged 3 commits into from
Dec 7, 2022

Conversation

benpicco
Copy link
Contributor

@benpicco benpicco commented Nov 2, 2022

Contribution description

When using gnrc_border_router on native the build system will take care of creating a TAP interface and running UHCP/DHCPv6 on it.

This is not always the desired behavior.
e.g. when a TAP bridge was created with a real interface to provide an uplink to native or ethos, we actually want to use that instead of creating a new one.

We then also want to use the real DHCPv6 server instead of starting our own one.

This adds the REUSE_TAP=1 option to skip network setup and just use the provided TAP interface as the uplink.

Testing procedure

  • create a bridge with your Ethernet adapter (interface name may vary)

    sudo dist/tools/tapsetup/tapsetup -u eno1
    
  • start the border router with the tap uplink

    make REUSE_TAP=1 -C examples/gnrc_border_router all term
    
  • the border router should receive a global address and can reach internet hosts

Iface  6  HWaddr: 7A:37:FC:7D:1A:AF 
          L2-PDU:1500  MTU:1492  HL:255  RTR  
          Source address length: 6
          Link type: wired
          inet6 addr: fe80::7837:fcff:fe7d:1aaf  scope: link  VAL
          inet6 addr: 2001:9e8:140f:fc00:7837:fcff:fe7d:1aaf  scope: global  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff7d:1aaf
          
Iface  7  HWaddr: 44:28  Channel: 26  NID: 0x23  PHY: O-QPSK 
          Long HWaddr: AA:78:BF:FD:E1:06:C4:28 
           State: IDLE 
          ACK_REQ  L2-PDU:102  MTU:1280  HL:64  RTR  
          RTR_ADV  6LO  IPHC  
          Source address length: 8
          Link type: wireless
          inet6 addr: fe80::a878:bffd:e106:c428  scope: link  VAL
          inet6 addr: 2001:9e8:140f:fcf4:a878:bffd:e106:c428  scope: global  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff06:c428
          
> ping riot-os.org
12 bytes from 2001:67c:254:b0b0::1: icmp_seq=0 ttl=60 time=25.104 ms
12 bytes from 2001:67c:254:b0b0::1: icmp_seq=1 ttl=60 time=147.904 ms
12 bytes from 2001:67c:254:b0b0::1: icmp_seq=2 ttl=60 time=50.646 ms

--- riot-os.org PING statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 25.104/74.551/147.904 ms
  • Bonus: virtual 802.15.4 nodes can also reach the internet

    make USE_ZEP=1 -C examples/gnrc_networking all term
    
Iface  7  HWaddr: 61:B3  Channel: 26  NID: 0x23  PHY: O-QPSK 
          Long HWaddr: 5E:AF:98:F2:44:49:E1:B3 
           State: IDLE 
          ACK_REQ  L2-PDU:102  MTU:1280  HL:64  RTR  
          RTR_ADV  6LO  IPHC  
          Source address length: 8
          Link type: wireless
          inet6 addr: fe80::5caf:98f2:4449:e1b3  scope: link  VAL
          inet6 addr: 2001:9e8:140f:fcf4:5caf:98f2:4449:e1b3  scope: global  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff49:e1b3
          inet6 group: ff02::1a
          
          Statistics for Layer 2
            RX packets 3  bytes 246
            TX packets 3 (Multicast: 2)  bytes 0
            TX succeeded 3 errors 0
          Statistics for IPv6
            RX packets 2  bytes 248
            TX packets 3 (Multicast: 2)  bytes 210
            TX succeeded 3 errors 0

> ping riot-os.org
12 bytes from 2001:67c:254:b0b0::1: icmp_seq=0 ttl=59 rssi=0 dBm time=24.319 ms
12 bytes from 2001:67c:254:b0b0::1: icmp_seq=1 ttl=59 rssi=0 dBm time=23.516 ms
12 bytes from 2001:67c:254:b0b0::1: icmp_seq=2 ttl=59 rssi=0 dBm time=147.707 ms

--- riot-os.org PING statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 23.516/65.180/147.707 ms

Issues/PRs references

@benpicco benpicco requested a review from jia200x as a code owner November 2, 2022 20:20
@benpicco benpicco requested a review from maribu November 2, 2022 20:20
@github-actions github-actions bot added Area: doc Area: Documentation Area: examples Area: Example Applications Area: tools Area: Supplementary tools labels Nov 2, 2022
@benpicco benpicco requested a review from miri64 November 2, 2022 20:21
@benpicco benpicco force-pushed the gnrc_border_router-native branch from 610290a to cc2acd9 Compare November 2, 2022 20:32
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Nov 8, 2022
@riot-ci
Copy link

riot-ci commented Nov 8, 2022

Murdock results

✔️ PASSED

299b5ac examples/gnrc_border_router: honor $TAP setting

Success Failures Total Runtime
2000 0 2000 06m:58s

Artifacts

This only reflects a subset of all builds from https://ci-prod.riot-os.org. Please refer to https://ci.riot-os.org for a complete build for now.

@benpicco benpicco force-pushed the gnrc_border_router-native branch from cc2acd9 to a61a026 Compare November 8, 2022 14:06
@benpicco benpicco force-pushed the gnrc_border_router-native branch from 98013f5 to 299b5ac Compare November 8, 2022 14:33
@benpicco benpicco requested a review from OlegHahm November 27, 2022 15:51
@OlegHahm
Copy link
Member

The proposed works as expected, but I cannot oversee all potential unwanted side effects. And I realized that the tapsetup script has an unwanted side effect when tearing down a bridge with a connected uplink.

@benpicco
Copy link
Contributor Author

benpicco commented Dec 7, 2022

This just adds another option to the existing scripts. It should not have any side effects if not used.

@benpicco benpicco merged commit 154b1d6 into RIOT-OS:master Dec 7, 2022
@benpicco
Copy link
Contributor Author

benpicco commented Dec 7, 2022

Thank you!

@benpicco benpicco deleted the gnrc_border_router-native branch December 7, 2022 21:34
@kaspar030 kaspar030 added this to the Release 2023.01 milestone Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: doc Area: Documentation Area: examples Area: Example Applications Area: tools Area: Supplementary tools CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants