From 7734aea648d609bbdf308d97f85d7d089c831d6f Mon Sep 17 00:00:00 2001 From: Andrew Thompson Date: Wed, 17 Aug 2011 14:15:18 +1200 Subject: Make initial changes to allow pfSense to work in a jail. This mostly avoids starting things that will not work and gets the initial config. Most of the pfSense functionality will not work (pf rules, routing, etc) but it can be used for testing. --- etc/rc.bootup | 55 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 14 deletions(-) (limited to 'etc/rc.bootup') diff --git a/etc/rc.bootup b/etc/rc.bootup index c1749cf..e224519 100755 --- a/etc/rc.bootup +++ b/etc/rc.bootup @@ -157,21 +157,48 @@ echo "Loading configuration..."; parse_config_bootup(); echo "done.\n"; -/* - * Determine if we need to throw a interface exception - * and ask the user to reassign interfaces. This will - * avoid a reboot and thats a good thing. - */ -while(is_interface_mismatch() == true) { - led_assigninterfaces(); - echo "\nNetwork interface mismatch -- Running interface assignment option.\n"; - $ifaces = get_interface_list(); - if (is_array($ifaces)) { - foreach($ifaces as $iface => $ifdata) - interfaces_bring_up($iface); +if($g['platform'] == "jail") { + /* We must determine what network settings have been configured for us */ + $wanif = "lo0"; /* defaults, if the jail admin hasn't set us up */ + $ipaddr = "127.0.0.1"; + $iflist = get_interface_list(); + foreach ($iflist as $iface => $ifa) { + if (isset($ifa['ipaddr'])) { + $wanif = $iface; + $ipaddr = $ifa['ipaddr']; + break; + } + } + $config['interfaces'] = array(); + $config['interfaces']['lan'] = array(); + $config['interfaces']['lan']['enable'] = false; + $config['interfaces']['wan'] = array(); + /* XXX, todo */ + $config['interfaces']['wan']['if'] = $wanif; + $config['interfaces']['wan']['ipaddr'] = $ipaddr; + $config['interfaces']['wan']['subnet'] = "32"; /* XXX right? */ + $config['interfaces']['wan']['enable'] = true; + if($config['dhcpd']['lan']) + unset($config['dhcpd']['lan']['enable']); + unlink_if_exists('/conf/trigger_initial_wizard'); + write_config(); +} else { + /* + * Determine if we need to throw a interface exception + * and ask the user to reassign interfaces. This will + * avoid a reboot and thats a good thing. + */ + while(is_interface_mismatch() == true) { + led_assigninterfaces(); + echo "\nNetwork interface mismatch -- Running interface assignment option.\n"; + $ifaces = get_interface_list(); + if (is_array($ifaces)) { + foreach($ifaces as $iface => $ifdata) + interfaces_bring_up($iface); + } + set_networking_interfaces_ports(); + led_kitt(); } - set_networking_interfaces_ports(); - led_kitt(); } /* convert config and clean backups */ -- cgit v1.1