summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Yurchenko <ey@tm-k.com>2011-05-21 15:35:35 +0000
committerEvgeny Yurchenko <ey@tm-k.com>2011-05-21 15:35:35 +0000
commit509ca889c999f36127d64e2bfb763a453c267e15 (patch)
tree2682c709c1e039670a046e917809cb20c5ffe4cc
parentabcdca835cbce83d72d70bb957bbbf2118ae3d01 (diff)
downloadpfsense-509ca889c999f36127d64e2bfb763a453c267e15.zip
pfsense-509ca889c999f36127d64e2bfb763a453c267e15.tar.gz
Adding gui to choose media options for interfaces.
-rwxr-xr-xusr/local/www/interfaces.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/usr/local/www/interfaces.php b/usr/local/www/interfaces.php
index ead78cc..f7c80f8 100755
--- a/usr/local/www/interfaces.php
+++ b/usr/local/www/interfaces.php
@@ -711,6 +711,15 @@ if ($_POST['apply']) {
} else {
$wancfg['mss'] = $_POST['mss'];
}
+ if (empty($_POST['mediaopt'])) {
+ unset($wancfg['media']);
+ unset($wancfg['mediaopt']);
+ } else {
+ $mediaopts = explode(' ', $_POST['mediaopt']);
+ if ($mediaopts[0] != ''){ $wancfg['media'] = $mediaopts[0]; }
+ if ($mediaopts[1] != ''){ $wancfg['mediaopt'] = $mediaopts[1]; }
+ else { unset($wancfg['mediaopt']); }
+ }
if (isset($wancfg['wireless'])) {
handle_wireless_post();
}
@@ -897,6 +906,21 @@ function check_wireless_mode() {
}
}
+// Find all possible media options for the interface
+$mediaopts_list = array();
+$intrealname = $config['interfaces'][$if]['if'];
+exec("/sbin/ifconfig -m $intrealname | grep \"media \"", $mediaopts);
+foreach ($mediaopts as $mediaopt){
+ preg_match("/media (.*)/", $mediaopt, $matches);
+ if (preg_match("/(.*) mediaopt (.*)/", $matches[1], $matches1)){
+ // there is media + mediaopt like "media 1000baseT mediaopt full-duplex"
+ array_push($mediaopts_list, $matches1[1] . " " . $matches1[2]);
+ }else{
+ // there is only media like "media 1000baseT"
+ array_push($mediaopts_list, $matches[1]);
+ }
+}
+
$pgtitle = array(gettext("Interfaces"), $pconfig['descr']);
$statusurl = "status_interfaces.php";
@@ -1153,6 +1177,26 @@ $types = array("none" => gettext("None"), "static" => gettext("Static"), "dhcp"
"header size) will be in effect."); ?>
</td>
</tr>
+ <?php
+ if (count($mediaopts_list) > 0){
+ $mediaopt_from_config = $config['interfaces'][$if]['media'] . ' ' . $config['interfaces'][$if]['mediaopt'];
+ echo "<tr>";
+ echo '<td valign="top" class="vncell">' . gettext("Speed and duplex") . '</td>';
+ echo '<td class="vtable">';
+ echo '<select name="mediaopt" class="formselect" id="mediaopt">';
+ foreach($mediaopts_list as $mediaopt){
+ if ($mediaopt != rtrim($mediaopt_from_config)){
+ print "<option value=\"$mediaopt\">" . gettext("$mediaopt") . "</option>";
+ } else {
+ print "<option value=\"$mediaopt\" selected>" . gettext("$mediaopt") . "</option>";
+ }
+ }
+ echo '</select><br>';
+ echo gettext("Here you can explicitely set up speed and duplex mode for the interface.");
+ echo '</td>';
+ echo '</tr>';
+ }
+ ?>
<tr>
<td colspan="2" valign="top" height="16"></td>
</tr>
OpenPOWER on IntegriCloud