function create_sourceaddresslist() { $list = array('any' => 'Any'); foreach (get_possible_traffic_source_addresses(true) as $sipname) { $list[$sipname['value']] = $sipname['name']; } return $list; }
function create_sourceaddresslist() { $sourceips = get_possible_traffic_source_addresses(true); $list = array("" => 'Default'); foreach ($sourceips as $sipvalue => $sipname) { $list[$sipvalue] = $sipname; } return $list; }
function create_sourceaddresslist() { $list = array('any' => gettext('Any')); $sourceips = get_possible_traffic_source_addresses(true); foreach ($sourceips as $sipvalue => $sipname) { $list[$sipvalue] = $sipname; } return $list; }
<tr> <td><?=gettext("Host"); ?></td> <td><input name="host" type="text" class="form-control" id="host" value="<?=htmlspecialchars($host);?>" /></td> </tr> <tr> <td><?=gettext("IP Protocol"); ?></td> <td><select name="ipproto" class="form-control"> <option value="ipv4" <?php if ($ipproto == "ipv4") echo "selected=\"selected\"" ?>>IPv4</option> <option value="ipv6" <?php if ($ipproto == "ipv6") echo "selected=\"selected\"" ?>>IPv6</option> </select></td> </tr> <tr> <td><?=gettext("Source Address"); ?></td> <td><select name="sourceip" class="form-control"> <option value="">Any</option> <?php $sourceips = get_possible_traffic_source_addresses(true); foreach ($sourceips as $sip): $selected = ""; if (!link_interface_to_bridge($sip['value']) && ($sip['value'] == $sourceip)) $selected = "selected=\"selected\""; ?> <option value="<?=$sip['value'];?>" <?=$selected;?>> <?=htmlspecialchars($sip['name']);?> </option> <?php endforeach; ?> </select></td> </tr> <tr> <td><?=gettext("Maximum number of hops");?></td> <td><select name="ttl" class="form-control" id="ttl"> <?php for ($i = 1; $i <= MAX_TTL; $i++): ?>
<i class="fa fa-toggle-off text-danger" style="cursor: pointer;" id="show_all_help_page" type="button"></i></a> </td> </tr> <tr> <td><a id="help_for_sourceip" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?php echo gettext("Source Address"); ?> </td> <td> <select name="sourceip" class="form-control"> <option value=""><?php echo gettext('Default (any)'); ?> </option> <?php foreach (get_possible_traffic_source_addresses(false) as $sip) { ?> <option value="<?php echo $sip['value']; ?> " <?php echo !link_interface_to_bridge($sip['value']) && $sip['value'] == $pconfig['sourceip'] ? "selected=\"selected\"" : ""; ?> > <?php echo htmlspecialchars($sip['name']); ?> </option> <?php } ?>
$section->addInput(new Form_Input('nentries', 'GUI Log Entries', 'text', $pconfig['nentries'], ['placeholder' => '']))->setHelp('This is only the number of log entries displayed in the GUI. It does not affect how many entries are contained in the actual log files.'); $section->addInput(new Form_Input('logfilesize', 'Log file size (Bytes)', 'text', $pconfig['logfilesize'], ['placeholder' => 'Bytes']))->setHelp($logfilesizeHelp); $section->addInput(new Form_Checkbox('logdefaultblock', 'Log firewall default blocks', 'Log packets matched from the default block rules in the ruleset', $pconfig['logdefaultblock']))->setHelp('Packets that are blocked by the implicit default block rule will not be logged if you uncheck this option. Per-rule logging options are still respected.'); $section->addInput(new Form_Checkbox('logdefaultpass', null, 'Log packets matched from the default pass rules put in the ruleset', $pconfig['logdefaultpass']))->setHelp('Packets that are allowed by the implicit default pass rule will be logged if you check this option. Per-rule logging options are still respected. '); $section->addInput(new Form_Checkbox('logbogons', null, 'Log packets blocked by \'Block Bogon Networks\' rules', $pconfig['logbogons'])); $section->addInput(new Form_Checkbox('logprivatenets', null, 'Log packets blocked by \'Block Private Networks\' rules', $pconfig['logprivatenets'])); $section->addInput(new Form_Checkbox('loglighttpd', 'Web Server Log', 'Log errors from the web server process', $pconfig['loglighttpd']))->setHelp('If this is checked, errors from the lighttpd web server process for the GUI or Captive Portal will appear in the main system log'); $section->addInput(new Form_Checkbox('rawfilter', 'Raw Logs', 'Show raw filter logs)', $pconfig['rawfilter']))->setHelp(gettext('If this is checked, filter logs are shown as generated by the packet filter, without any formatting. This will reveal more detailed information, but it is more difficult to read')); $section->addInput(new Form_Select('filterdescriptions', 'Where to show rule descriptions', !isset($pconfig['filterdescriptions']) ? '0' : $pconfig['filterdescriptions'], array('0' => 'Dont load descriptions', '1' => 'Display as column', '2' => 'Display as second row')))->setHelp('Show the applied rule description below or in the firewall log rows' . '<br />' . 'Displaying rule descriptions for all lines in the log might affect performance with large rule sets'); $section->addInput(new Form_Checkbox('disablelocallogging', 'Local Logging', $g['platform'] == $g['product_name'] ? "Disable writing log files to the local disk" : "Disable writing log files to the local RAM disk", $pconfig['disablelocallogging'])); $section->addInput(new Form_Button('resetlogs', 'Reset Log Files'))->addClass('btn-danger btn-xs')->setHelp('Clears all local log files and reinitializes them as empty logs. This also restarts the DHCP daemon. Use the Save button first if you have made any setting changes.'); $form->add($section); $section = new Form_Section('Remote Logging Options'); $section->addClass('toggle-remote'); $section->addInput(new Form_Checkbox('enable', 'Enable Remote Logging', 'Send log messages to remote syslog server', $pconfig['enable'])); $section->addInput(new Form_Select('sourceip', 'Source Address', link_interface_to_bridge($pconfig['sourceip']) ? null : $pconfig['sourceip'], ["" => gettext("Default (any)")] + get_possible_traffic_source_addresses(false)))->setHelp($remoteloghelp); $section->addInput(new Form_Select('ipproto', 'IP Protocol', $ipproto, array('ipv4' => 'IPv4', 'ipv6' => 'IPv6')))->setHelp('This option is only used when a non-default address is chosen as the source above. ' . 'This option only expresses a preference; If an IP address of the selected type is not found on the chosen interface, the other type will be tried.'); // Group collapses/appears based on 'enable' checkbox above $group = new Form_Group('Remote log servers'); $group->addClass('remotelogging'); $group->add(new Form_Input('remoteserver', 'Server 1', 'text', $pconfig['remoteserver'], ['placeholder' => 'IP[:port]'])); $group->add(new Form_Input('remoteserver2', 'Server 2', 'text', $pconfig['remoteserver2'], ['placeholder' => 'IP[:port]'])); $group->add(new Form_Input('remoteserver3', 'Server 3', 'text', $pconfig['remoteserver3'], ['placeholder' => 'IP[:port]'])); $section->add($group); $group = new Form_MultiCheckboxGroup('Remote Syslog Contents'); $group->addClass('remotelogging'); $group->add(new Form_MultiCheckbox('logall', null, 'Everything', $pconfig['logall'])); $group->add(new Form_MultiCheckbox('system', null, 'System Events', $pconfig['system'])); $group->add(new Form_MultiCheckbox('filter', null, 'Firewall Events', $pconfig['filter'])); $group->add(new Form_MultiCheckbox('dhcp', null, 'DHCP service events', $pconfig['dhcp'])); $group->add(new Form_MultiCheckbox('portalauth', null, 'Portal Auth events', $pconfig['portalauth']));
<tr> <td colspan="2" valign="top" class="listtopic"><?php echo gettext("Remote Logging Options"); ?> </td> </tr> <tr> <td width="22%" valign="top" class="vncell"><?php echo gettext("Source Address"); ?> </td> <td width="78%" class="vtable"> <select name="sourceip" class="formselect"> <option value="">Default (any)</option> <?php $sourceips = get_possible_traffic_source_addresses(false); foreach ($sourceips as $sipvalue => $sipname) { $selected = ""; if (!link_interface_to_bridge($sipvalue) && $sipvalue == $pconfig['sourceip']) { $selected = 'selected="selected"'; } ?> <option value="<?php echo $sipvalue; ?> " <?php echo $selected; ?> > <?php echo htmlspecialchars($sipname);
if ($retval != 0 && !empty($result)) { if ($showtext) { print '<div class="alert alert-danger" role="alert">' . gettext('No output received, or connection failed. Try with "Show Remote Text" unchecked first.') . '</div>'; } else { print '<div class="alert alert-danger" role="alert">' . gettext('Connection failed.') . '</div>'; } } } require_once 'classes/Form.class.php'; $form = new Form('Test'); $section = new Form_Section('Test Port'); $section->addInput(new Form_Input('host', 'Hostname', 'text', $host, ['placeholder' => 'Hostname to look up.'])); $section->addInput(new Form_Input('port', 'Port', 'text', $port, ['placeholder' => 'Port to test.'])); $section->addInput(new Form_Input('srcport', 'Source Port', 'text', $srcport, ['placeholder' => 'Typically left blank.'])); $section->addInput(new Form_Checkbox('showtext', 'Remote text', 'Show remote text', $showtext))->setHelp("Shows the text given by the server when connecting to the port. If checked it will take 10+ seconds to display in a panel below this form."); $section->addInput(new Form_Select('sourceip', 'Source Address', $sourceip, array_merge(array('' => 'Any'), get_possible_traffic_source_addresses(true))))->setHelp('Select source address for the trace'); $section->addInput(new Form_Select('ipproto', 'IP Protocol', $ipprotocol, array('ipv4' => 'IPv4', 'ipv6' => 'IPv6')))->setHelp("If you force IPv4 or IPv6 and use a hostname that does not contain a result using that protocol, it will result in an error." . " For example if you force IPv4 and use a hostname that only returns an AAAA IPv6 IP address, it will not work."); $form->add($section); print $form; if ($ncoutput && !empty($result) && $showtext && $retval == 0) { ?> <div class="panel panel-default"> <div class="panel-heading"> <h2 class="panel-title">Received Remote Text</h2> </div> <div class="panel-body"> <pre><?php echo $ncoutput; ?> </pre> </div>
$cmd = "{$command} {$srcip} -c" . escapeshellarg($count) . " " . escapeshellarg($host); //echo "Ping command: {$cmd}\n"; $result = shell_exec($cmd); if (empty($result)) { $input_errors[] = sprintf(gettext('Host "%s" did not respond or could not be resolved.'), $host); } } include 'head.inc'; if ($input_errors) { print_input_errors($input_errors); } $form = new Form(false); $section = new Form_Section('Ping'); $section->addInput(new Form_Input('host', 'Hostname', 'text', $host, ['placeholder' => 'Hostname to ping'])); $section->addInput(new Form_Select('ipproto', 'IP Protocol', $ipproto, ['ipv4' => 'IPv4', 'ipv6' => 'IPv6'])); $section->addInput(new Form_Select('sourceip', 'Source address', $sourceip, array('' => gettext('Automatically selected (default)')) + get_possible_traffic_source_addresses(true)))->setHelp('Select source address for the ping.'); $section->addInput(new Form_Select('count', 'Maximum number of pings', $count, array_combine(range(1, MAX_COUNT), range(1, MAX_COUNT))))->setHelp('Select the maximum number of pings.'); $form->add($section); $form->addGlobal(new Form_Button('Submit', 'Ping', null, 'fa-rss'))->addClass('btn-primary'); print $form; if ($do_ping && !empty($result) && !$input_errors) { ?> <div class="panel panel-default"> <div class="panel-heading"> <h2 class="panel-title"><?php echo gettext('Results'); ?> </h2> </div> <div class="panel-body">
} else { $alert_text = gettext('Connection failed.'); } print_info_box($alert_text, 'danger', false); } } else { // First time, new page print_info_box(gettext('This page performs a simple TCP connection test to determine if a host is up and accepting connections on a given port.') . " " . gettext('This test does not function for UDP since there is no way to reliably determine if a UDP port accepts connections in this manner.'), 'warning', false); } $form = new Form(false); $section = new Form_Section('Test Port'); $section->addInput(new Form_Input('host', 'Hostname', 'text', $host, ['placeholder' => 'Hostname to look up.'])); $section->addInput(new Form_Input('port', 'Port', 'text', $port, ['placeholder' => 'Port to test.'])); $section->addInput(new Form_Input('srcport', 'Source Port', 'text', $srcport, ['placeholder' => 'Typically left blank.'])); $section->addInput(new Form_Checkbox('showtext', 'Remote text', 'Show remote text', $showtext))->setHelp("Shows the text given by the server when connecting to the port. If checked it will take 10+ seconds to display in a panel below this form."); $section->addInput(new Form_Select('sourceip', 'Source Address', $sourceip, ['' => 'Any'] + get_possible_traffic_source_addresses(true)))->setHelp('Select source address for the trace.'); $section->addInput(new Form_Select('ipprotocol', 'IP Protocol', $ipprotocol, array('ipv4' => 'IPv4', 'ipv6' => 'IPv6')))->setHelp("If IPv4 or IPv6 is forced and a hostname is used that does not contain a result using that protocol, it will result in an error." . " For example if IPv4 is forced and a hostname is used that only returns an AAAA IPv6 IP address, it will not work."); $form->add($section); $form->addGlobal(new Form_Button('Submit', 'Test', null, 'fa-wrench'))->addClass('btn-primary'); print $form; // If the command succeeded, the user asked to see the output and there is output, then show it. if ($retval == 0 && $showtext && !empty($ncoutput)) { ?> <div class="panel panel-default"> <div class="panel-heading"> <h2 class="panel-title"><?php echo gettext('Received Remote Text'); ?> </h2> </div> <div class="panel-body">