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 ++++++++++++++++++++++++++++ src/etc/rc.bootup | 12 +++++++----- 2 files changed, 35 insertions(+), 5 deletions(-) (limited to 'src') 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 diff --git a/src/etc/rc.bootup b/src/etc/rc.bootup index aba6862..cc0f500 100755 --- a/src/etc/rc.bootup +++ b/src/etc/rc.bootup @@ -121,6 +121,13 @@ if (file_exists("/conf/trigger_initial_wizard") && !file_exists("/conf/assign_co check_for_alternate_interfaces(); } +/* Convert configuration + * This must happen before the interface mismatch test, see + * https://redmine.pfsense.org/issues/7809 */ +echo "Updating configuration..."; +convert_config(); +echo "done.\n"; + /* * Determine if we need to throw a interface exception * and ask the user to reassign interfaces. This will @@ -146,11 +153,6 @@ while (is_interface_mismatch() == true) { led_kitt(); } -/* convert config and clean backups */ -echo "Updating configuration..."; -convert_config(); -echo "done.\n"; - echo "Checking config backups consistency..."; cleanup_backupcache(true); echo "done.\n"; -- cgit v1.1