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

netdev_tap: make 'wired' property configurable #17709

Merged
merged 3 commits into from
Jun 1, 2022

Conversation

benpicco
Copy link
Contributor

@benpicco benpicco commented Feb 25, 2022

Contribution description

netdev_tap is a virtual interface, make it possible to simulate both a wired and a wireless interface.

Testing procedure

$ bin/native/gnrc_networking.elf tap0

Iface  6  HWaddr: 7A:37:FC:7D:1A:AF 
          L2-PDU:1500  MTU:1500  HL:64  RTR  
          RTR_ADV  
          Source address length: 6
--->      Link type: wired
          inet6 addr: fe80::7837:fcff:fe7d:1aaf  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff7d:1aaf
          inet6 group: ff02::1a
          
          Statistics for Layer 2
            RX packets 4  bytes 480
            TX packets 1 (Multicast: 1)  bytes 78
            TX succeeded 1 errors 0
          Statistics for IPv6
            RX packets 4  bytes 424
            TX packets 1 (Multicast: 1)  bytes 64
            TX succeeded 1 errors 0
$ bin/native/gnrc_networking.elf -w tap0

Iface  6  HWaddr: 7A:37:FC:7D:1A:AF 
          L2-PDU:1500  MTU:1500  HL:64  RTR  
          RTR_ADV  
          Source address length: 6
--->      Link type: wireless
          inet6 addr: fe80::7837:fcff:fe7d:1aaf  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff7d:1aaf
          inet6 group: ff02::1a
          
          Statistics for Layer 2
            RX packets 4  bytes 480
            TX packets 1 (Multicast: 1)  bytes 78
            TX succeeded 1 errors 0
          Statistics for IPv6
            RX packets 4  bytes 424
            TX packets 1 (Multicast: 1)  bytes 64
            TX succeeded 1 errors 0

$ bin/native/gnrc_networking.elf -w tap0 tap1

Iface  7  HWaddr: 5A:B0:08:67:AD:82 
          L2-PDU:1500  MTU:1500  HL:64  RTR  
          RTR_ADV  
          Source address length: 6
          Link type: wired
          inet6 addr: fe80::58b0:8ff:fe67:ad82  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff67:ad82
          
          Statistics for Layer 2
            RX packets 5  bytes 526
            TX packets 1 (Multicast: 1)  bytes 78
            TX succeeded 1 errors 0
          Statistics for IPv6
            RX packets 5  bytes 456
            TX packets 1 (Multicast: 1)  bytes 64
            TX succeeded 1 errors 0

Iface  6  HWaddr: 7A:37:FC:7D:1A:AF 
          L2-PDU:1500  MTU:1500  HL:64  RTR  
          RTR_ADV  
          Source address length: 6
          Link type: wireless
          inet6 addr: fe80::7837:fcff:fe7d:1aaf  scope: link  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ff7d:1aaf
          
          Statistics for Layer 2
            RX packets 4  bytes 480
            TX packets 1 (Multicast: 1)  bytes 78
            TX succeeded 1 errors 0
          Statistics for IPv6
            RX packets 4  bytes 424
            TX packets 1 (Multicast: 1)  bytes 64
            TX succeeded 1 errors 0

LWIP

$  bin/native/paho-mqtt-example.elf -w tap0 tap1

Iface ET0 HWaddr: 7a:37:fc:7d:1a:af Link: up State: up
        Link type: wireless
        inet6 addr: fe80:0:0:0:7837:fcff:fe7d:1aaf scope: link
Iface ET1 HWaddr: 5a:b0:08:67:ad:82 Link: up State: up
        Link type: wired
        inet6 addr: fe80:0:0:0:58b0:8ff:fe67:ad82 scope: link

Issues/PRs references

#17350 (comment)

@github-actions github-actions bot added Area: cpu Area: CPU/MCU ports Platform: native Platform: This PR/issue effects the native platform labels Feb 25, 2022
@benpicco benpicco requested a review from miri64 February 25, 2022 16:22
@miri64
Copy link
Member

miri64 commented Feb 25, 2022

Wouldn't it make more sense to make this compile-time configurable? Also: before we do this, can we consider, if this is actually nececessary? See #17350 (comment)

@benpicco
Copy link
Contributor Author

I thought maybe you want to have a wired and a wireless interface 🤷‍♂️
But I can add a netdev_tap_wireless pseudo-module instead

@miri64
Copy link
Member

miri64 commented Feb 25, 2022

I thought maybe you want to have a wired and a wireless interface man_shrugging

Right, that makes sense! But you could also do that in native_tap_params_t, right?

@miri64
Copy link
Member

miri64 commented Feb 25, 2022

But I can add a netdev_tap_wireless pseudo-module instead

I'd rather go with a Kconfig switch, a pseudo-module seems a bit overkill IMHO.

@benpicco benpicco force-pushed the cpu/native-tap_wired branch from 25087a3 to fb379dc Compare February 26, 2022 14:29
@benpicco
Copy link
Contributor Author

benpicco commented Feb 26, 2022

Let's make it a command-line argument, that also sorts out the issue of which interface should be 'wireless'.

@benpicco benpicco force-pushed the cpu/native-tap_wired branch from fb379dc to 23cbd56 Compare February 26, 2022 14:52
@github-actions github-actions bot added Area: network Area: Networking Area: pkg Area: External package ports Area: sys Area: System labels Feb 26, 2022
@benpicco benpicco force-pushed the cpu/native-tap_wired branch from 23cbd56 to 2b367f3 Compare February 26, 2022 15:10
@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 Feb 28, 2022
@benpicco benpicco requested review from fjmolinas and kaspar030 March 3, 2022 16:32
@benpicco benpicco requested a review from aabadie March 22, 2022 20:00
@benpicco benpicco requested a review from kfessel May 16, 2022 22:29
@benpicco benpicco force-pushed the cpu/native-tap_wired branch from 2b367f3 to fad6501 Compare May 23, 2022 13:27
@benpicco benpicco added Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation and removed Type: cleanup The issue proposes a clean-up / The PR cleans-up parts of the codebase / documentation labels May 29, 2022
@benpicco benpicco added the Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation label May 29, 2022
Copy link
Member

@miri64 miri64 left a comment

Choose a reason for hiding this comment

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

ACK. Tested. Might also help with future testing, as now the tap interface becomes basically optional.

@miri64 miri64 added CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR and removed CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR labels May 31, 2022
@miri64 miri64 enabled auto-merge May 31, 2022 17:25
@miri64 miri64 merged commit c4e202a into RIOT-OS:master Jun 1, 2022
@benpicco benpicco deleted the cpu/native-tap_wired branch June 1, 2022 07:14
@chrysn chrysn added this to the Release 2022.07 milestone Aug 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: cpu Area: CPU/MCU ports Area: network Area: Networking Area: pkg Area: External package ports Area: sys Area: System CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: native Platform: This PR/issue effects the native platform Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants