function get_interface_addr($ifdescr) { global $config; // Find out interface name. $if = $config['interfaces'][$ifdescr]['if']; return get_ipaddr($if); }
function write_ifcfg($filename, $interface, $uuid) { //Write to file with a standard template $ipaddr = get_ipaddr(); if ($ipaddr != '') { $ipsettings = 'BOOTPROTO=static IPADDR=' . $ipaddr . ' NETMASK=' . get_subnet() . ' GATEWAY=' . get_ipgateway(); } else { $ipsettings = 'BOOTPROTO=dhcp'; } file_put_contents($filename, "TYPE=Ethernet\n{$ipsettings}\nDEFROUTE=yes\nPEERDNS=yes\nPEERROUTES=yes\nIPV4_FAILURE_FATAL=no\nIPV6INIT=yes\nIPV6_AUTOCONF=yes\nIPV6_DEFROUTE=yes\nIPV6_PEERDNS=yes\nIPV6_PEERROUTES=yes\nIPV6_FAILURE_FATAL=no\nNAME={$interface}\nUUID={$uuid}\nDEVICE={$interface}\nONBOOT=yes\n"); }
if (isset($_GET['index']) && $_GET['index']) { $index = $_GET['index']; } else { if (isset($_POST['index']) && $_POST['index']) { $index = $_POST['index']; } } if (!$index) { exit; } $optcfg =& $config['interfaces']['opt' . $index]; // Get interface informations. $ifinfo = get_interface_info(get_ifname($optcfg['if'])); if ($config['interfaces']['opt' . $index]['ipaddr'] == "dhcp") { $pconfig['type'] = "DHCP"; $pconfig['ipaddr'] = get_ipaddr($optcfg['if']); $pconfig['subnet'] = get_subnet_bits($optcfg['if']); } else { $pconfig['type'] = "Static"; $pconfig['ipaddr'] = $optcfg['ipaddr']; $pconfig['subnet'] = $optcfg['subnet']; } $pconfig['ipv6_enable'] = isset($optcfg['ipv6_enable']); if ($config['interfaces']['opt' . $index]['ipv6addr'] == "auto") { $pconfig['ipv6type'] = "Auto"; $pconfig['ipv6addr'] = get_ipv6addr($optcfg['if']); } else { $pconfig['ipv6type'] = "Static"; $pconfig['ipv6addr'] = $optcfg['ipv6addr']; $pconfig['ipv6subnet'] = $optcfg['ipv6subnet']; }
?> <?php html_combobox("scantype", gettext("Scan type"), $pconfig['scantype'], array("0" => gettext("Normal"), "1" => gettext("Aggressive"), "2" => gettext("Painfully aggressive")), "", false); ?> <?php html_separator(); ?> <?php html_titleline(gettext("Administrative WebGUI")); ?> <?php html_passwordbox("admin_pw", gettext("Password"), $pconfig['admin_pw'], sprintf("%s %s", gettext("Password for the administrative pages."), gettext("Default user name is 'admin'.")), true, 20); ?> <?php $if = get_ifname($config['interfaces']['lan']['if']); $ipaddr = get_ipaddr($if); $url = htmlspecialchars("http://{$ipaddr}:{$pconfig['port']}"); $text = "<a href='{$url}' target='_blank'>{$url}</a>"; ?> <?php html_text("url", gettext("URL"), $text); ?> </table> <div id="submit"> <input name="Submit" type="submit" class="formbtn" value="<?php echo gettext("Save and Restart"); ?> " onclick="onsubmit_content(); enable_change(true)" /> </div> <div id="remarks"> <?php
unset($disp_status); unset($ups); unset($cmd); ?> <?php } ?> </table></td> </tr> <?php unset($vmlist); mwexec2("/usr/bin/find /dev/vmm -type c", $vmlist); unset($vmlist2); $vbox_user = "******"; $vbox_if = get_ifname($config['interfaces']['lan']['if']); $vbox_ipaddr = get_ipaddr($vbox_if); if (isset($config['vbox']['enable'])) { mwexec2("/usr/local/bin/sudo -u {$vbox_user} /usr/local/bin/VBoxManage list runningvms", $vmlist2); } if (!empty($vmlist) || !empty($vmlist2)) { ?> <tr> <td width="25%" class="vncellt"><?php echo gettext("Virtual Machine"); ?> </td> <td width="75%" class="listr"> <table width="100%" border="0" cellspacing="0" cellpadding="1"> <?php $vmtype = "BHyVe"; $index = 0;
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require "auth.inc"; require "guiconfig.inc"; $pgtitle = array(gettext("Network"), gettext("LAN Management")); $lancfg =& $config['interfaces']['lan']; $optcfg =& $config['interfaces']['lan']; // Required for WLAN. // Get interface informations. $ifinfo = get_interface_info(get_ifname($lancfg['if'])); if (strcmp($lancfg['ipaddr'], "dhcp") == 0) { $pconfig['type'] = "DHCP"; $pconfig['ipaddr'] = get_ipaddr($lancfg['if']); $pconfig['subnet'] = get_subnet_bits($lancfg['if']); } else { $pconfig['type'] = "Static"; $pconfig['ipaddr'] = $lancfg['ipaddr']; $pconfig['subnet'] = $lancfg['subnet']; } $pconfig['ipv6_enable'] = isset($lancfg['ipv6_enable']); if (strcmp($lancfg['ipv6addr'], "auto") == 0) { $pconfig['ipv6type'] = "Auto"; $pconfig['ipv6addr'] = get_ipv6addr($lancfg['if']); } else { $pconfig['ipv6type'] = "Static"; $pconfig['ipv6addr'] = $lancfg['ipv6addr']; $pconfig['ipv6subnet'] = $lancfg['ipv6subnet']; }
?> <div class="row"> <div class="large-10 columns"> <div class="panel"> <h3>Thank you for choosing Smart-Message! </h3> <form name="mmg_numbers" method="post" action="#"> <p>To access this appliance from your network, please configure the network options below. Remember to connect your network to the correct physical port on this appliance.</p> <div class="row"> <div class="large-6 medium-6 columns"> <label>Network IPv4 Address (Leave blank for DHCP)</label> <input type="text" name="staticIP" placeholder="Leave blank for dynamic IP Address" value="<?php echo get_ipaddr(); ?> "/> <label>Network IPv4 Subnet </label> <input type="text" name="staticSN" placeholder="Leave blank for DHCP assigned value" value="<?php echo get_subnet(); ?> "/> <label>Network IPv4 Gateway</label> <input type="text" name="staticGW" placeholder="Leave blank for DHCP assigned value" value="<?php echo get_ipgateway(); ?> "/> <label>Network IPv4 DNS</label> <input type="text" name="staticDNS" placeholder="Leave blank for DHCP assigned value" value="<?php echo get_ipdns();