netjsonconfig icon indicating copy to clipboard operation
netjsonconfig copied to clipboard

[change] When adding a Wireless config, should it add an interface?

Open thiagohflima opened this issue 2 years ago • 2 comments

Scenario

Consider the following network configuration:

  • Two VLANs: 10 and 20
  • Bridges named vlan10 using eth0.10 and vlan20 using eth0.20

The goal is to create two SSIDs for each VLAN:

  • Wifi_VLAN10
  • Wifi_VLAN20

NetJSON Configuration

[
  {
    "wireless": {
      "network": ["vlan10"],
      "mode": "access_point",
      "radio": "radio0",
      "ssid": "WifiVLAN10"
    },
    "type": "wireless",
    "name": "wlan0"
  },
  {
    "wireless": {
      "network": ["vlan20"],
      "mode": "access_point",
      "radio": "radio0",
      "ssid": "WifiVLAN20"
    },
    "type": "wireless",
    "name": "wlan1"
  }
]

This configuration generates the following (showing only wireless-related settings):

Package Network

config device 'device_wlan0'
	option name 'wlan0'

config interface 'wlan0'
	option device 'wlan0'
	option proto 'none'

config device 'device_wlan1'
	option name 'wlan1'

config interface 'wlan1'
	option device 'wlan1'
	option proto 'none'

Package Wireless

config wifi-iface 'wifi_wlan0'
	option device 'radio0'
	option ifname 'wlan0'
	option mode 'ap'
	option network 'vlan10'
	option ssid 'WifiVLAN10'

config wifi-iface 'wifi_wlan1'
	option device 'radio0'
	option ifname 'wlan1'
	option mode 'ap'
	option network 'vlan20'
	option ssid 'WifiVLAN20'

When manually configuring in OpenWRT, it is simplified as follows:

Package Network

There's no config added in network

Package Wireless

config wifi-iface 'wifi_wlan0'
	option device 'radio0'
	option mode 'ap'
	option network 'vlan10'
	option ssid 'WifiVLAN10'

config wifi-iface 'wifi_wlan1'
	option device 'radio0'
	option mode 'ap'
	option network 'vlan20'
	option ssid 'WifiVLAN20'

As observed, the manual configuration lacks the ifname attribute in the wireless package, and no interfaces are created in the network package. While the current configuration works, there's a consideration about simplifying the OpenWisp-generated config. Does this simplification make sense?

thiagohflima avatar Nov 30 '23 15:11 thiagohflima

I ran into a situation in which the additional configuration in /etc/config/network caused issues. I am investigating the possibility of removing that.

nemesifier avatar May 17 '24 16:05 nemesifier

I don't think we can remove ifname from the wireless configuration for different reasons, it doens't hurt having it defined explicitly. So I am focusing on removing the unnecessary definitions in the /etc/config/network.

nemesifier avatar Jun 07 '24 18:06 nemesifier

https://github.com/openwisp/netjsonconfig/pull/298 should fix this. I am testing it.

nemesifier avatar Jul 03 '24 23:07 nemesifier