From 79ccd1f2796059a7a60b865a383dc288662f86b7 Mon Sep 17 00:00:00 2001 From: jim-p Date: Thu, 24 Aug 2017 11:10:36 -0400 Subject: Setup upgrade code for wireless interfaces to the new format needed for 2.4, and switch rc.bootup so the config upgrade happens before a mismatch test, otherwise we can't fix this type of situation. Fixes #7809 --- src/etc/inc/upgrade_config.inc | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/etc/inc') diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc index 7a38554..023292f 100644 --- a/src/etc/inc/upgrade_config.inc +++ b/src/etc/inc/upgrade_config.inc @@ -5392,6 +5392,34 @@ function upgrade_168_to_169() { ); } +/* Upgrade wireless interfaces to the format required for 2.4 + * Each wireless interface now needs to be a cloned instance, the card itself + * Can no longer be assigned. https://redmine.pfsense.org/issues/6770 */ +function upgrade_169_to_170() { + global $config; + foreach ($config['interfaces'] as $friendly => & $iface) { + if (is_array($iface['wireless']) && !empty($iface['wireless']['mode'])) { + /* This test can only be true for one instance per card, so it is safe. */ + if (stristr($iface['if'], '_wlan') === false) { + $wlan = array(); + $wlan['if'] = $iface['if']; + $wlan['mode'] = $iface['wireless']['mode']; + $wlan['descr'] = "Wireless interface {$friendly}"; + /* It was not possible to create clones of _wlan0 before, so this is safe. */ + $wlan['cloneif'] = "{$iface['if']}_wlan0"; + /* Make sure this entry is first in the list of wireless interface clones. */ + if (!is_array($config['wireless'])) { + $config['wireless'] = array(); + $config['wireless']['clone'] = array(); + } + $config['wireless']['clone'][] = $wlan; + /* The interface assignment must now be the cloned interface name. */ + $iface['if'] = $wlan['cloneif']; + } + } + } +} + /* * Special function that is called independent of current config version. It's * a workaround to have config_upgrade running on older versions after next -- cgit v1.1