Skip to content

Conversation

benpicco
Copy link
Contributor

@benpicco benpicco commented Aug 8, 2019

Contribution description

When wanting to use multiple tap interfaces on the native board, both NETDEV_TAP_MAX and GNRC_NETIF_NUMOF have to be changed.

This makes creating a native instance with more than one tap interface more convenient.

Testing procedure

In examples/gnrc_networking:

before

$ make GNRC_NETIF_NUMOF=2
$ bin/native/gnrc_networking.elf tap0 tap1
> ifconfig
Iface  6  HWaddr: 5E:66:78:C9:FA:43 
          L2-PDU:1500 MTU:1500  HL:64  RTR  
          RTR_ADV  
          Source address length: 6
          Link type: wired
          inet6 addr: fe80::5c66:78ff:fec9:fa43  scope: local  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ffc9:fa43
          
          Statistics for Layer 2
            RX packets 4  bytes 440
            TX packets 1 (Multicast: 1)  bytes 78
            TX succeeded 1 errors 0
          Statistics for IPv6
            RX packets 4  bytes 384
            TX packets 1 (Multicast: 1)  bytes 64
            TX succeeded 1 errors 0
>

after

$ make GNRC_NETIF_NUMOF=2
$ bin/native/gnrc_networking.elf tap0 tap1
> ifconfig
Iface  6  HWaddr: 5E:66:78:C9:FA:43 
          L2-PDU:1500 MTU:1500  HL:64  RTR  
          RTR_ADV  
          Source address length: 6
          Link type: wired
          inet6 addr: fe80::5c66:78ff:fec9:fa43  scope: local  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ffc9:fa43
          
          Statistics for Layer 2
            RX packets 4  bytes 440
            TX packets 1 (Multicast: 1)  bytes 78
            TX succeeded 1 errors 0
          Statistics for IPv6
            RX packets 4  bytes 384
            TX packets 1 (Multicast: 1)  bytes 64
            TX succeeded 1 errors 0

Iface  7  HWaddr: 76:61:7C:C4:DE:1A 
          L2-PDU:1500 MTU:1500  HL:64  RTR  
          RTR_ADV  
          Source address length: 6
          Link type: wired
          inet6 addr: fe80::7461:7cff:fec4:de1a  scope: local  VAL
          inet6 group: ff02::2
          inet6 group: ff02::1
          inet6 group: ff02::1:ffc4:de1a
          
          Statistics for Layer 2
            RX packets 4  bytes 440
            TX packets 1 (Multicast: 1)  bytes 78
            TX succeeded 1 errors 0
          Statistics for IPv6
            RX packets 4  bytes 384
            TX packets 1 (Multicast: 1)  bytes 64
            TX succeeded 1 errors 0
>

Issues/PRs references

Makes reproducing #11980 easier.

This makes it easier to use native with multiple tap interfaces as only
one define (GNRC_NETIF_NUMOF) has to be changed.
@benpicco benpicco added Type: enhancement The issue suggests enhanceable parts / The PR enhances parts of the codebase / documentation Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer labels Aug 8, 2019
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.

There is a reason those to are distinct. native can have other network devices than GNRC_NETIF_NUMOF (e.g. socket_zep). So adding those still would require the same hassle with no clear reasoning why in that case but not the case outlined here.

@miri64
Copy link
Member

miri64 commented Aug 8, 2019

Also I believe applications like gnrc_border_router would suffer from this under native.

@miri64 miri64 added Area: network Area: Networking Platform: native Platform: This PR/issue effects the native platform Discussion: contested The item of discussion was contested labels Aug 8, 2019
@benpicco benpicco removed the Impact: minor The PR is small in size and might only require a quick look of a knowledgeable reviewer label Aug 8, 2019
@benpicco
Copy link
Contributor Author

benpicco commented Aug 8, 2019

Alright, so the proper solution would be to set GNRC_NETIF_NUMOF to the sum of all the _NUM defines in sys/auto_init/netif?

And then add a more convenient way to change NETDEV_TAP_MAX.

@miri64
Copy link
Member

miri64 commented Aug 8, 2019

Yeah.. see #9903 for more discussions on that topic ;-).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: network Area: Networking Discussion: contested The item of discussion was contested 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.

2 participants