Network enhancements

- Create separate entry for DNS server settings, which can be changed at all times (user is not required to stop the array)
- Added "info" button which shows a popup window with interface related assignments (error is shown if something is missing)
- Added "show" button to show or hide VLAN settings
- Make network settings a tabbed view
- Fixed a bug when sometimes DNS settings are not properly set
- Fixed a minor bug in routing table content
- Some other code optimizations
This commit is contained in:
bergware
2025-01-13 22:19:45 +01:00
parent 095492254d
commit 3c6f8262ee
13 changed files with 553 additions and 520 deletions
+291 -267
View File
@@ -3,8 +3,8 @@ Title="_(Interface)_ eth0"
Tag="icon-ethernet"
---
<?PHP
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, Bergware International.
/* Copyright 2005-2025, Lime Technology
* Copyright 2012-2025, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -23,7 +23,6 @@ $ini = '/var/local/emhttp/network.ini';
$validIP4 = "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}";
$validIP6 = "(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(:|([0-9a-fA-F]{1,4}:)+):(([0-9a-fA-F]{1,4}:)*[0-9a-fA-F]{1,4})?)";
$width = [166,300];
// get available ethernet ports (excluding eth0)
exec("ls --indicator-style=none /sys/class/net|grep -P '^eth[1-9][0-9]*$'",$ports);
@@ -71,13 +70,49 @@ $vlan_eth0 = $sort_eth0 = [];
if (isset($eth0)) foreach (vlanID($eth0) as $key => $val) {$vlan_eth0[] = index($key); $sort_eth0[] = (int)$val;}
array_multisort($sort_eth0,$vlan_eth0);
?>
<script>
<?if ($build):?>
refresh(); // automatically include new ethernet ports
<?endif;?>
Array.prototype.same = function(){return this.sort().filter(function(v,i,o){return i&&v===o[i-1]?v:0;}).length;}
const arg1 = {};
const run = {};
const eth0 = document.eth0_settings;
arg1.eth0 = 'none';
function presetRun(form) {
var port = form.name.replace('_settings','');
$(form).find('input[name^="DESCRIPTION:"]').each(function(){
var name = $(this).prop('name').replace(':','');
run[port+name] = $(this).val();
});
}
function signalRun(form,id) {
switch (id) {
case 1:
if (arg1.eth0=='none') arg1.eth0 = 'renew';
break;
case 2:
var port = form.name.replace('_settings','');
$(form).find('input[name^="DESCRIPTION:"]').each(function(){
var name = $(this).prop('name').replace(':','');
var data = $(this).val();
if (run[port+name] != data) {
run[port+name] = data;
port = 'none';
}
});
if (port!='none') arg1[port] = port;
break;
}
}
function prepareSettings(form) {
var dns = document.dns_settings;
var port = form.name.replace('_settings','');
var bondnics = [], brnics = [];
for (var i=0,nic; nic=form.BONDNICS.options[i]; i++) {
if (nic.selected) {
@@ -139,7 +174,6 @@ function prepareSettings(form) {
$(form).find('select[name="NETMASK:'+i+'"]').prop('disabled',false).val('');
$(form).find('input[name="GATEWAY:'+i+'"]').prop('disabled',false).val('');
$(form).find('input[name="METRIC:'+i+'"]').prop('disabled',false).val('');
if (i==0) $(form).find('input[name^="DNS_SERVER"]').prop('disabled',false).val('');
}
if (protocol == 'ipv4') {
$(form).find('input[name="IPADDR6:'+i+'"]').prop('disabled',false).val('');
@@ -147,19 +181,13 @@ function prepareSettings(form) {
$(form).find('input[name="GATEWAY6:'+i+'"]').prop('disabled',false).val('');
$(form).find('input[name="METRIC6:'+i+'"]').prop('disabled',false).val('');
$(form).find('select[name="PRIVACY6:'+i+'"]').prop('disabled',false).val('');
if (i==0) $(form).find('input[name^="DNS6_SERVER"]').prop('disabled',false).val('');
}
});
$(form).find('select[name^="USE_DHCP:"]').each(function() {
var i = $(this).attr('name').split(':')[1];
var protocol = $(form).find('select[name="PROTOCOL:'+i+'"]').val() || 'ipv4';
var metric = $(form).find('input[name="METRIC:'+i+'"]').val();
if ($(this).prop('disabled')==false && $(this).val()=='yes') {
if (protocol != 'ipv6') {
$(form).find('input[name="IPADDR:'+i+'"]').val('_(Obtaining IPv4 address)_...');
$(form).find('input[name="GATEWAY:'+i+'"]').val(metric!='0'?'_(Obtaining IPv4 gateway)_...':'');
}
} else if (protocol != 'ipv6' && $(this).val()=='yes') {
if (protocol != 'ipv6' && $(this).val()=='yes') {
$(form).find('input[name="IPADDR:'+i+'"]').prop('disabled',false).val('');
$(form).find('input[name="GATEWAY:'+i+'"]').prop('disabled',false).val('');
}
@@ -168,35 +196,30 @@ function prepareSettings(form) {
var i = $(this).attr('name').split(':')[1];
var protocol = $(form).find('select[name="PROTOCOL:'+i+'"]').val() || 'ipv4';
var metric = $(form).find('input[name="METRIC6:'+i+'"]').val();
if ($(this).prop('disabled')==false && $(this).val()=='yes') {
if (protocol != 'ipv4') {
$(form).find('input[name="IPADDR6:'+i+'"]').val('_(Obtaining IPv6 address)_...');
$(form).find('input[name="GATEWAY6:'+i+'"]').val(metric!='0'?'_(Obtaining IPv6 gateway)_...':'');
}
} else if (protocol != 'ipv4' && $(this).val()=='yes') {
if (protocol != 'ipv4' && $(this).val()=='yes') {
$(form).find('input[name="IPADDR6:'+i+'"]').prop('disabled',false).val('');
$(form).find('input[name="GATEWAY6:'+i+'"]').prop('disabled',false).val('');
}
if ($(this).val()!='yes') $(form).find('input[name="PRIVACY6:'+i+'"]').prop('disabled',false).val('');
});
if (form.DHCP_KEEPRESOLV !== undefined && form.DHCP_KEEPRESOLV.value=='no') {
form.DHCP_KEEPRESOLV.disabled = false;
var protocol = $(form).find('select[name="PROTOCOL:0"]').val() || 'ipv4';
if (protocol != 'ipv6') $(form).find('input[name^="DNS_SERVER"]').val('_(Obtaining DNSv4 server)_...');
}
if (form.DHCP6_KEEPRESOLV !== undefined && form.DHCP6_KEEPRESOLV.value=='no') {
form.DHCP6_KEEPRESOLV.disabled = false;
var protocol = $(form).find('select[name="PROTOCOL:0"]').val() || 'ipv4';
if (protocol != 'ipv4') $(form).find('input[name^="DNS6_SERVER"]').val('_(Obtaining DNSv6 server)_...');
if (port=='eth0') {
$(dns).find('select,input').each(function(){
var name = $(this).prop('name');
var data = $(this).val();
$(form).find('input[name="'+name+'"]').val(data);
});
}
$(form).find('input[name="#arg[1]"]').val(arg1[port]);
setTimeout(refresh,25000);
return true;
}
function selectProtocol(form,port,index) {
function selectProtocol(form,index,step) {
var port = form.name.replace('_settings','');
if (index == null) {
$(form).find('select[name^="PROTOCOL:"]').each(function() {
var protocol = $(this).val() || 'ipv4';
var i = $(this).attr('name').split(':')[1];
var i = $(this).prop('name').split(':')[1];
var net4 = $('.'+'ipv4-'+port+'-'+i);
var net6 = $('.'+'ipv6-'+port+'-'+i);
var more4 = $('.'+'more-ipv4-'+port+'-'+i);
@@ -206,8 +229,8 @@ function selectProtocol(form,port,index) {
case 'ipv6': net4.hide(); net6.show(); break;
case 'ipv4+ipv6': net4.show(); net6.show(); break;
}
if ($(form).find('select[name="USE_DHCP:'+i+'"]').val()) more4.show(); else more4.hide();
if ($(form).find('select[name="USE_DHCP6:'+i+'"]').val()) more6.show(); else more6.hide();
if ($(form).find('select[name="USE_DHCP:'+i+'"]').val()=='no') more4.show(); else more4.hide();
if ($(form).find('select[name="USE_DHCP6:'+i+'"]').val()=='no') more6.show(); else more6.hide();
checkNetworkSettings(form,i);
});
} else {
@@ -217,15 +240,16 @@ function selectProtocol(form,port,index) {
var more4 = $('.'+'more-ipv4-'+port+'-'+index);
var more6 = $('.'+'more-ipv6-'+port+'-'+index);
switch (protocol) {
case 'ipv4': net4.show(); net6.hide(); break;
case 'ipv6': net4.hide(); net6.show(); break;
case 'ipv4+ipv6': net4.show(); net6.show(); break;
case 'ipv4': net4.show(step); net6.hide(step); $('#dns4').show(step); $('#dns6').hide(step); break;
case 'ipv6': net4.hide(step); net6.show(step); $('#dns4').hide(step); $('#dns6').show(step); break;
case 'ipv4+ipv6': net4.show(step); net6.show(step); $('#dns4').show(step); $('#dns6').show(step); break;
}
if ($(form).find('select[name="USE_DHCP:'+index+'"]').val()) more4.show(); else more4.hide();
if ($(form).find('select[name="USE_DHCP6:'+index+'"]').val()) more6.show(); else more6.hide();
if ($(form).find('select[name="USE_DHCP:'+index+'"]').val()=='no') more4.show(step); else more4.hide(step);
if ($(form).find('select[name="USE_DHCP6:'+index+'"]').val()=='no') more6.show(step); else more6.hide(step);
checkNetworkSettings(form,index);
}
}
function checkNetworkSettings(form,index) {
var disabled4 = $(form).find('select[name="USE_DHCP:'+index+'"]').val()!='no';
var disabled6 = $(form).find('select[name="USE_DHCP6:'+index+'"]').val()!='no';
@@ -242,81 +266,89 @@ function checkNetworkSettings(form,index) {
var privacy = $(form).find('select[name="PRIVACY6:'+index+'"]');
privacy.prop('disabled',!disabled6);
}
if (index==0) {
if (form.DHCP_KEEPRESOLV !== undefined) checkDNSSettings(form);
if (form.DHCP6_KEEPRESOLV !== undefined) checkDNSSettings6(form);
if (form.name=='eth0_settings' && index==0) {
checkDNSsettings(form);
checkDNS6settings(form);
}
}
function checkDNSSettings(form) {
function checkDNSsettings(form,step) {
var dns = document.dns_settings;
if ($(form).find('select[name="USE_DHCP:0"]').val()=='no') {
form.DHCP_KEEPRESOLV.value = 'yes';
form.DHCP_KEEPRESOLV.disabled = true;
dns.DHCP_KEEPRESOLV.value = 'yes';
dns.DHCP_KEEPRESOLV.disabled = true;
} else {
form.DHCP_KEEPRESOLV.disabled = false;
dns.DHCP_KEEPRESOLV.disabled = false;
}
var disabled = form.DHCP_KEEPRESOLV.value=='no';
var disabled = dns.DHCP_KEEPRESOLV.value=='no';
var protocol = $(form).find('select[name="PROTOCOL:0"]').val() || 'ipv4';
if (disabled) $('#dns4server').hide(step); else $('#dns4server').show(step);
if (protocol != 'ipv6') {
form.DNS_SERVER1.disabled = disabled;
form.DNS_SERVER1.required = !disabled;
form.DNS_SERVER2.disabled = disabled;
form.DNS_SERVER3.disabled = disabled;
if (!form.DNS_SERVER2.value && disabled) $('#dnsserver2').hide(); else $('#dnsserver2').show();
if (!form.DNS_SERVER3.value && disabled) $('#dnsserver3').hide(); else $('#dnsserver3').show();
dns.DNS_SERVER1.required = !disabled;
$('#dns4').show();
}
}
function checkDNSSettings6(form) {
function checkDNS6settings(form,step) {
var dns = document.dns_settings;
if ($(form).find('select[name="USE_DHCP6:0"]').val()=='no') {
form.DHCP6_KEEPRESOLV.value = 'yes';
form.DHCP6_KEEPRESOLV.disabled = true;
dns.DHCP6_KEEPRESOLV.value = 'yes';
dns.DHCP6_KEEPRESOLV.disabled = true;
} else {
form.DHCP6_KEEPRESOLV.disabled = false;
dns.DHCP6_KEEPRESOLV.disabled = false;
}
var disabled = form.DHCP6_KEEPRESOLV.value=='no';
var disabled = dns.DHCP6_KEEPRESOLV.value=='no';
var protocol = $(form).find('select[name="PROTOCOL:0"]').val() || 'ipv4';
if (disabled) $('#dns6server').hide(step); else $('#dns6server').show(step);
if (protocol != 'ipv4') {
form.DNS6_SERVER1.disabled = disabled;
form.DNS6_SERVER2.disabled = disabled;
form.DNS6_SERVER3.disabled = disabled;
$('#dns6server1').show();
if (!form.DNS6_SERVER2.value && disabled) $('#dns6server2').hide(); else $('#dns6server2').show();
if (!form.DNS6_SERVER3.value && disabled) $('#dns6server3').hide(); else $('#dns6server3').show();
dns.DNS6_SERVER1.required = !disabled;
$('#dns6').show();
}
}
function checkBondingSettings(form,ctrl,port) {
function checkBondingSettings(form,ctrl) {
var disabled = form.BONDING.value=='no';
var mode = form.BONDING_MODE.value;
var port = form.name.replace('_settings','');
if (ctrl>=0) {
var me = ctrl==0 ? null : 'slow';
var step = ctrl==0 ? null : 'slow';
if (disabled) {
$('#bond-members-'+port).hide(me);
$('#bond-members-'+port).hide(step);
} else {
$('#bond-members-'+port).show(me);
$('#bond-'+port).dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
$('#bond-members-'+port).show(step);
$('#bond-'+port).dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:166});
}
if (ctrl==1) checkBridgingSettings(form,1,port);
if (ctrl==1) checkBridgingSettings(form,1);
}
if (mode==1 || mode>4 || disabled) {$('#attention0').hide();} else {$('#attention0').show();}
}
function checkBridgingSettings(form,ctrl,port) {
var me = ctrl==0 ? null : 'slow';
function checkBridgingSettings(form,ctrl) {
var port = form.name.replace('_settings','');
var step = ctrl==0 ? null : 'slow';
var i = 0;
if (form.BRIDGING.value=='yes' && form.BONDING.value=='no') {
$('#bridge-members-'+port).show(me);
$('#bridge-'+port).dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:<?=$width[0]?>});
$('#bridge-members-'+port).show(step);
$('#bridge-'+port).dropdownchecklist('destroy').dropdownchecklist({emptyText:'None', width:166});
} else {
$('#bridge-members-'+port).hide(me);
$('#bridge-members-'+port).hide(step);
}
}
function checkNetworkAccess(form,port) {
function checkNetworkAccess(form) {
var port = form.name.replace('_settings','');
if (form.TYPE.value=='access') {
$('.access-'+port).hide();
$('#button-vlan-'+port).hide();
$('#button-add-'+port).hide();
$(form).find('input[name^="VLANID:"]').prop('required',false);
} else {
$('.access-'+port).show();
if ($(form).find('input[name^="VLANID:"]').length>0) {$('#button-vlan-'+port).show();$('#button-add-'+port).hide();} else $('#button-add-'+port).show();
$(form).find('input[name^="VLANID:"]').prop('required',true);
}
}
function addVLAN(port) {
var index = 1;
while ($('#index-'+port+'-'+index).length) index++;
@@ -325,104 +357,148 @@ function addVLAN(port) {
$(element).after(template);
$('form[name="'+$(element).parent().attr('name')+'"]').find('select').first().trigger('change');
}
function removeVLAN(element) {
var id = $(element).attr('id').split('-');
$(element).remove();
$('#view-'+id[1]).find('select').first().trigger('change');
}
function showVLAN(port) {
var button1 = $('#button-vlan-'+port);
var button2 = $('#button-add-'+port).hide();
var list = $('#vlan-list-'+port);
var show = "_(Show)_";
var hide = "_(Hide)_";
if (list.is(':hidden')) {
button1.val(hide);
button2.show();
list.show('slow');
} else {
button1.val(show);
button2.hide();
list.hide('slow');
}
}
function disableForm(form) {
$(form).find('input,select').not('input[value="_(Done)_"]').prop('disabled',true);
$(form).find('input,select').not('input[value="_(Done)_"],input.form').prop('disabled',true);
$(form).find('input[name^="DESCRIPTION"],input[name^="#"]').prop('disabled',false);
}
var stopEvent = false;
function noRun(form) {
var arg1 = $(form).find('input[name="#arg[1]"]');
if (arg1.val()=='') arg1.val('none');
stopEvent = true;
}
function doRun(form) {
if (stopEvent) {stopEvent = false; return;}
var arg1 = $(form).find('input[name="#arg[1]"]');
arg1.val($(form).find('input[name="#section"]').val());
}
function portcheck_eth0() {
$.post('/webGui/include/CheckPort.php',{port:'eth0'},function(text) {
function portcheck(port) {
$.post('/webGui/include/CheckPort.php',{port:port},function(text) {
var html = $('#user-notice').html();
if (!html || html.indexOf('eth0')>0) showNotice(text);
setTimeout(portcheck_eth0,10000);
if (!html || html.indexOf(port)>0) showNotice(text);
setTimeout(function(){portcheck(port);},10000);
});
}
function portToggle(port,cmd) {
$.post('/webGui/include/PortToggle.php',{port:port,cmd:cmd},function(){refresh();});
}
function viewToggle(eth,vlan) {
var tag = vlan ? '#tag-'+eth+'-'+vlan : '#tag-'+eth;
var view = vlan ? '#view-'+eth+'-'+vlan : '#view-'+eth;
if ($(view).is(':visible')) {
$(tag).removeClass('fa-chevron-up').addClass('fa-chevron-down');
$.cookie(view,'hide',{expires:3650});
} else {
$(tag).removeClass('fa-chevron-down').addClass('fa-chevron-up');
$.removeCookie(view);
}
$(view).toggle('slow');
}
var watchDHCP = new NchanSubscriber('/sub/dhcp',{subscriber:'websocket'});
watchDHCP.on('message', function(data) {
data = data.split(' ');
for (var i=0,row; row=data[i]; i++) {
var id = row.split('_');
var form = $('form[name="'+id[0]+'_settings"]');
var key = id[2].split('=');
switch (id[1]) {
case 'I': form.find('input[name="'+key[0].replace('-','_')+'"]').val(key[1]); break;
case 'S': form.find('select[name="'+key[0].replace('-','_')+'"]').val(key[1]); break;
}
}
});
$(function() {
var ctrl = "<span id='wait_eth0' class='status vshift red-text' style='display:none;font-size:1.2rem;font-style:italic'><i class='fa fa-spinner fa-spin'></i> _(Please wait)_... _(configuring interface)_</span>";
var form = document.eth0_settings;
<?if ($tabbed && !$service):?>
const ctrl = "<span id='wait_eth0' class='status red-text hide' style='font-size:1.2rem;font-style:italic'><i class='fa fa-spinner fa-spin'></i> _(Please wait)_... _(configuring interface)_</span>";
const form = document.eth0_settings;
const dns = document.dns_settings;
<?if (!$service):?>
$('#tab1').bind({click:function(){
$('#bond-eth0').dropdownchecklist('destroy').dropdownchecklist({emptyText:"_(None)_", width:<?=$width[0]?>});
$('#bridge-eth0').dropdownchecklist('destroy').dropdownchecklist({emptyText:"_(None)_", width:<?=$width[0]?>});
$('#bond-eth0').dropdownchecklist('destroy').dropdownchecklist({emptyText:"_(None)_", width:166});
$('#bridge-eth0').dropdownchecklist('destroy').dropdownchecklist({emptyText:"_(None)_", width:166});
}});
<?endif;?>
if (!$.cookie('#view-eth0')) {$('#view-eth0').show(); $('#tag-eth0').removeClass('fa-chevron-down').addClass('fa-chevron-up');}
<?foreach ($vlan_eth0 as $i):?>
if (!$.cookie('#view-eth0-<?=$i?>')) {$('#view-eth0-<?=$i?>').show(); $('#tag-eth0-<?=$i?>').removeClass('fa-chevron-down').addClass('fa-chevron-up');}
<?endforeach;?>
$('#bond-eth0').dropdownchecklist({emptyText:"_(None)_", width:<?=$width[0]?>});
$('#bridge-eth0').dropdownchecklist({emptyText:"_(None)_", width:<?=$width[0]?>});
checkBondingSettings(form,0,'eth0');
checkBridgingSettings(form,0,'eth0');
checkNetworkAccess(form,'eth0');
selectProtocol(form,'eth0');
$('#bond-eth0').dropdownchecklist({emptyText:"_(None)_", width:166});
$('#bridge-eth0').dropdownchecklist({emptyText:"_(None)_", width:166});
checkBondingSettings(form,0);
checkBridgingSettings(form,0);
checkNetworkAccess(form);
selectProtocol(form);
<?if ($service):?>
disableForm(form);
$('#bond-eth0').dropdownchecklist('disable');
$('#bridge-eth0').dropdownchecklist('disable');
var protocol = $(form).find('select[name="PROTOCOL:0"]').val() || 'ipv4';
if (form.DNS_SERVER2.value) $('#dnsserver2').show(); else $('#dnsserver2').hide();
if (form.DNS_SERVER3.value) $('#dnsserver3').show(); else $('#dnsserver3').hide();
if (form.DNS6_SERVER1.value) $('#dns6server1').show(); else $('#dns6server1').hide();
if (form.DNS6_SERVER2.value) $('#dns6server2').show(); else $('#dns6server2').hide();
if (form.DNS6_SERVER3.value) $('#dns6server3').show(); else $('#dns6server3').hide();
<?else:?>
checkDNSSettings(form);
checkDNSSettings6(form);
<?endif;?>
<?if ($tabbed):?>
$('.tabs').append(ctrl.replace('vshift',''));
<?else:?>
$('div.title').eq(0).find('span.left').append(ctrl);
<?endif;?>
portcheck_eth0();
watchDHCP.start();
checkDNSsettings(form);
checkDNS6settings(form);
$('.tabs').append(ctrl);
portcheck('eth0');
presetRun(form);
$(dns).find('select,input').each(function(){$(this).on('input change',function() {
$(form).find('input[value="<?=_("Apply")?>"],input[value="Apply"]').prop('disabled',false);
$(form).find('input[value="<?=_("Done")?>"],input[value="Done"]').val("<?=_('Reset')?>").prop('onclick',null).off('click').click(function(){refresh($(form).offset().top);});
});});
});
function networkInfo(port) {
$.post('/webGui/include/NetworkInfo.php',{port:port},function(text) {
swal({title:"_(Network Info)_", text:text, html:true, confirmButtonText:"_(Ok)_"});
});
}
</script>
<form markdown="1" name="eth0_settings" method="POST" action="/update.php" target="progressFrame" onchange="doRun(this)" onsubmit="return prepareSettings(this)">
<div class="title nocontrol shift"><span class="left"><i class="title icon-ethernet"></i>_(Interface)_ eth0</span></div>
<div class="shade-<?=$display['theme']?> uplift">
<form name="dns_settings" onchange="signalRun(this,1)">
<div markdown="1" id="dns4" class="hide">
_(IPv4 DNS server assignment)_:
: <select name="DHCP_KEEPRESOLV" onchange="checkDNSsettings(eth0,'slow')">
<?=mk_option(_var($eth0,'DHCP_KEEPRESOLV'), "no", _("Automatic"))?>
<?=mk_option(_var($eth0,'DHCP_KEEPRESOLV'), "yes", _("Static"))?>
</select>
:eth_ipv4_dns_server_assignment_help:
<div markdown="1" id="dns4server" class="hide">
_(IPv4 DNS server)_ 1:
: <input type="text" name="DNS_SERVER1" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($eth0,'DNS_SERVER1')?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
:eth_ipv4_dns_server_help:
_(IPv4 DNS server)_ 2:
: <input type="text" name="DNS_SERVER2" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($eth0,'DNS_SERVER2')?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
:eth_ipv4_dns_server2_help:
_(IPv4 DNS server)_ 3:
: <input type="text" name="DNS_SERVER3" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($eth0,'DNS_SERVER3')?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
:eth_ipv4_dns_server3_help:
</div>
</div>
<div markdown="1" id="dns6" class="hide">
_(IPv6 DNS server assignment)_:
: <select name="DHCP6_KEEPRESOLV" onchange="checkDNS6settings(eth0,'slow')">
<?=mk_option(_var($eth0,'DHCP6_KEEPRESOLV'), "no", _("Automatic"))?>
<?=mk_option(_var($eth0,'DHCP6_KEEPRESOLV'), "yes", _("Static"))?>
</select>
:eth_ipv6_dns_server_assignment_help:
<div markdown="1" id="dns6server" class="hide">
_(IPv6 DNS server)_ 1:
: <input type="text" name="DNS6_SERVER1" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($eth0,'DNS6_SERVER1')?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
:eth_ipv6_dns_server_help:
_(IPv6 DNS server)_ 2:
: <input type="text" name="DNS6_SERVER2" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($eth0,'DNS6_SERVER2')?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
:eth_ipv6_dns_server2_help:
_(IPv6 DNS server)_ 3:
: <input type="text" name="DNS6_SERVER3" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($eth0,'DNS6_SERVER3')?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
:eth_ipv6_dns_server3_help:
</div>
</div>
</form>
</div>
<form markdown="1" name="eth0_settings" method="POST" action="/update.php" target="progressFrame" onchange="signalRun(this,2)" onsubmit="return prepareSettings(this)">
<input type="hidden" name="#file" value="<?=$ini?>">
<input type="hidden" name="#include" value="/webGui/include/update.ethernet.php">
<input type="hidden" name="#section" value="eth0">
@@ -433,29 +509,37 @@ $(function() {
<input type="hidden" name="BRNAME" value="br0">
<input type="hidden" name="BRSTP" value="no">
<input type="hidden" name="BRFD" value="0">
<input type="hidden" name="DHCP_KEEPRESOLV" value="<?=_var($eth0,'DHCP_KEEPRESOLV')?>">
<input type="hidden" name="DNS_SERVER1" value="<?=_var($eth0,'DNS_SERVER1')?>">
<input type="hidden" name="DNS_SERVER2" value="<?=_var($eth0,'DNS_SERVER2')?>">
<input type="hidden" name="DNS_SERVER3" value="<?=_var($eth0,'DNS_SERVER3')?>">
<input type="hidden" name="DHCP6_KEEPRESOLV" value="<?=_var($eth0,'DHCP6_KEEPRESOLV')?>">
<input type="hidden" name="DNS6_SERVER1" value="<?=_var($eth0,'DNS6_SERVER1')?>">
<input type="hidden" name="DNS6_SERVER2" value="<?=_var($eth0,'DNS6_SERVER2')?>">
<input type="hidden" name="DNS6_SERVER3" value="<?=_var($eth0,'DNS6_SERVER3')?>">
_(Interface description)_:
: <span class="status vshift"><i id="tag-eth0" class="fa fa-fw fa-chevron-down" style="cursor:pointer" onclick="viewToggle('eth0')"></i></span>
<input type="text" name="DESCRIPTION:0" maxlength="80" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:0"))?>" oninput="noRun(this.form)">
: <input type="text" name="DESCRIPTION:0" maxlength="80" autocomplete="off" spellcheck="false" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:0"))?>">
<input type="button" class="form" value="_(Info)_" onclick="networkInfo('eth0')">
:eth_interface_description_help:
<div markdown="1" id="view-eth0" style="display:none">
_(MAC address)_:
: <?=strtoupper(exec("ip link show eth0|grep -Pom1 'ether \K\S+'"))?>
:eth_mac_address_help:
_(Enable bonding)_:
: <select name="BONDING" onchange="checkBondingSettings(this.form,1,'eth0')">
: <select name="BONDING" onchange="checkBondingSettings(this.form,1)">
<?=mk_option(_var($eth0,'BONDING'), "no", _("No"))?>
<?=mk_option(_var($eth0,'BONDING'), "yes", _("Yes"))?>
</select>
:eth_enable_bonding_help:
<div markdown="1" id="bond-members-eth0" style="display:none">
<div markdown="1" id="bond-members-eth0" class="'hide">
_(Bonding mode)_:
: <select name="BONDING_MODE" onchange="checkBondingSettings(this.form,-1,'eth0')">
: <select name="BONDING_MODE" onchange="checkBondingSettings(this.form,-1)">
<?=mk_option(_var($eth0,'BONDING_MODE'), "0", _("balance-rr")." (0)")?>
<?=mk_option(_var($eth0,'BONDING_MODE'), "1", _("active-backup")." (1)",isset($eth0['BONDING_MODE'])?'':'selected')?>
<?=mk_option(_var($eth0,'BONDING_MODE'), "2", _("balance-xor")." (2)")?>
@@ -464,12 +548,12 @@ _(Bonding mode)_:
<?=mk_option(_var($eth0,'BONDING_MODE'), "5", _("balance-tlb")." (5)")?>
<?=mk_option(_var($eth0,'BONDING_MODE'), "6", _("balance-alb")." (6)")?>
</select>
<span id="attention0" style="display:none">**_(Attention)_:** _(this mode requires a network switch with proper setup and support)_...</span>
<span id="attention0" class="hide">**_(Attention)_:** _(this mode requires a network switch with proper setup and support)_...</span>
:eth_bonding_mode_help:
_(Bonding members of)_ bond0:
: <select id="bond-eth0" name="BONDNICS" multiple="multiple" style="display:none">
: <select id="bond-eth0" name="BONDNICS" multiple="multiple" class="'hide">
<?=mk_option(_var($eth0,'BONDNICS'),'eth0','eth0','selected disabled')?>
<?foreach ($ports as $port):?>
<?if (!locked('eth0',$port)) echo mk_option_check(_var($eth0,'BONDNICS'),$port,$port)?>
@@ -480,16 +564,16 @@ _(Bonding members of)_ bond0:
</div>
_(Enable bridging)_:
: <select name="BRIDGING" onchange="checkBridgingSettings(this.form,1,'eth0')">
: <select name="BRIDGING" onchange="checkBridgingSettings(this.form,1)">
<?=mk_option(_var($eth0,'BRIDGING'), "no", _("No"))?>
<?=mk_option(_var($eth0,'BRIDGING'), "yes", _("Yes"))?>
</select>
:eth_enable_bridging_help:
<div markdown="1" id="bridge-members-eth0" style="display:none">
<div markdown="1" id="bridge-members-eth0" class="'hide">
_(Bridging members of)_ br0:
: <select id="bridge-eth0" name="BRNICS" multiple="multiple" style="display:none">
: <select id="bridge-eth0" name="BRNICS" multiple="multiple" class="'hide">
<?=mk_option(_var($eth0,'BRNICS'),'eth0','eth0','selected disabled')?>
<?foreach ($ports as $port):?>
<?if (!locked('eth0',$port)) echo mk_option_check(_var($eth0,'BRNICS'),$port,$port)?>
@@ -500,7 +584,7 @@ _(Bridging members of)_ br0:
</div>
_(Network protocol)_:
: <select name="PROTOCOL:0" onchange="selectProtocol(this.form,'eth0',0)">
: <select name="PROTOCOL:0" onchange="selectProtocol(this.form,0,'slow')">
<?=mk_option(_var($eth0,"PROTOCOL:0"), 'ipv4', _('IPv4 only'))?>
<?=mk_option(_var($eth0,"PROTOCOL:0"), 'ipv6', _('IPv6 only'))?>
<?=mk_option(_var($eth0,"PROTOCOL:0"), 'ipv4+ipv6', _('IPv4 + IPv6'))?>
@@ -508,18 +592,18 @@ _(Network protocol)_:
:eth_network_protocol_help:
<div markdown="1" class="ipv4-eth0-0" style="display:none">
<div markdown="1" class="ipv4-eth0-0 hide">
_(IPv4 address assignment)_:
: <select name="USE_DHCP:0" onchange="selectProtocol(this.form,'eth0',0)">
: <select name="USE_DHCP:0" onchange="selectProtocol(this.form,0,'slow')">
<?=mk_option(_var($eth0,"USE_DHCP:0"), 'yes', _('Automatic'))?>
<?=mk_option(_var($eth0,"USE_DHCP:0"), 'no', _('Static'))?>
</select>
:eth_ipv4_address_assignment_help:
<div markdown="1" class="more-ipv4-eth0-0" style="display:none">
<div markdown="1" class="more-ipv4-eth0-0 hide">
_(IPv4 address)_:
: <input type="text" name="IPADDR:0" maxlength="15" value="<?=_var($eth0,"IPADDR:0")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">/<select name="NETMASK:0" class="slim">
: <input type="text" name="IPADDR:0" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"IPADDR:0")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">/<select name="NETMASK:0" class="slim">
<?=mk_option(_var($eth0,"NETMASK:0"), "255.0.0.0", "8")?>
<?=mk_option(_var($eth0,"NETMASK:0"), "255.255.0.0", "16")?>
<?=mk_option(_var($eth0,"NETMASK:0"), "255.255.128.0", "17")?>
@@ -541,58 +625,31 @@ _(IPv4 address)_:
:eth_ipv4_address_help:
_(IPv4 default gateway)_:
: <input type="text" name="GATEWAY:0" maxlength="15" value="<?=_var($eth0,"GATEWAY:0")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:0" min="0" max="9999" value="<?=_var($eth0,"METRIC:0")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY:0" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"GATEWAY:0")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:0" min="0" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"METRIC:0")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
:eth_ipv4_default_gateway_help:
</div>
_(IPv4 DNS server assignment)_:
: <select name="DHCP_KEEPRESOLV" onchange="checkDNSSettings(this.form)">
<?=mk_option(_var($eth0,'DHCP_KEEPRESOLV'), "no", _("Automatic"))?>
<?=mk_option(_var($eth0,'DHCP_KEEPRESOLV'), "yes", _("Static"))?>
</select>
:eth_ipv4_dns_server_assignment_help:
_(IPv4 DNS server)_:
: <input type="text" name="DNS_SERVER1" maxlength="15" value="<?=_var($eth0,'DNS_SERVER1')?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
:eth_ipv4_dns_server_help:
<div markdown="1" id="dnsserver2" style="display:none">
_(IPv4 DNS server)_ 2:
: <input type="text" name="DNS_SERVER2" maxlength="15" value="<?=_var($eth0,'DNS_SERVER2')?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
:eth_ipv4_dns_server2_help:
</div>
<div markdown="1" id="dnsserver3" style="display:none">
_(IPv4 DNS server)_ 3:
: <input type="text" name="DNS_SERVER3" maxlength="15" value="<?=_var($eth0,'DNS_SERVER3')?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
:eth_ipv4_dns_server3_help:
</div>
</div>
<div markdown="1" class="ipv6-eth0-0" style="display:none">
<div markdown="1" class="ipv6-eth0-0 hide">
_(IPv6 address assignment)_:
: <select name="USE_DHCP6:0" onchange="selectProtocol(this.form,'eth0',0)">
: <select name="USE_DHCP6:0" onchange="selectProtocol(this.form,0,'slow')">
<?=mk_option(_var($eth0,"USE_DHCP6:0"), 'yes', _('Automatic'))?>
<?=mk_option(_var($eth0,"USE_DHCP6:0"), 'no', _('Static'))?>
</select>
:eth_ipv6_address_assignment_help:
<div markdown="1" class="more-ipv6-eth0-0" style="display:none">
<div markdown="1" class="more-ipv6-eth0-0 hide">
_(IPv6 address)_:
: <input type="text" name="IPADDR6:0" maxlength="39" value="<?=_var($eth0,"IPADDR6:0")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:0" min="1" max="128" value="<?=_var($eth0,"NETMASK6:0")?>" class="slim">
: <input type="text" name="IPADDR6:0" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"IPADDR6:0")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:0" min="1" max="128" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"NETMASK6:0")?>" class="slim">
:eth_ipv6_address_help:
_(IPv6 default gateway)_:
: <input type="text" name="GATEWAY6:0" maxlength="39" value="<?=_var($eth0,"GATEWAY6:0")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:0" min="0" max="9999" value="<?=_var($eth0,"METRIC6:0")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY6:0" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"GATEWAY6:0")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:0" min="0" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"METRIC6:0")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
:eth_ipv6_default_gateway_help:
@@ -604,69 +661,39 @@ _(IPv6 privacy extensions)_:
:eth_ipv6_privacy_extensions_help:
</div>
<div markdown="1" id="dns6server1" style="display:none">
_(IPv6 DNS server assignment)_:
: <select name="DHCP6_KEEPRESOLV" onchange="checkDNSSettings6(this.form)">
<?=mk_option(_var($eth0,'DHCP6_KEEPRESOLV'), "no", _("Automatic"))?>
<?=mk_option(_var($eth0,'DHCP6_KEEPRESOLV'), "yes", _("Static"))?>
</select>
:eth_ipv6_dns_server_assignment_help:
_(IPv6 DNS server)_:
: <input type="text" name="DNS6_SERVER1" maxlength="39" value="<?=_var($eth0,'DNS6_SERVER1')?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
:eth_ipv6_dns_server_help:
</div>
<div markdown="1" id="dns6server2" style="display:none">
_(IPv6 DNS server)_ 2:
: <input type="text" name="DNS6_SERVER2" maxlength="39" value="<?=_var($eth0,'DNS6_SERVER2')?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
:eth_ipv6_dns_server2_help:
</div>
<div markdown="1" id="dns6server3" style="display:none">
_(IPv6 DNS server)_ 3:
: <input type="text" name="DNS6_SERVER3" maxlength="39" value="<?=_var($eth0,'DNS6_SERVER3')?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
:eth_ipv6_dns_server3_help:
</div>
</div>
_(Desired MTU)_:
: <input type="number" name="MTU" min="68" max="9198" value="<?=_var($eth0,'MTU')?>" class="narrow" placeholder="1500">
: <input type="number" name="MTU" min="68" max="9198" autocomplete="off" spellcheck="false" value="<?=_var($eth0,'MTU')?>" class="narrow" placeholder="1500">
:eth_desired_mtu_help:
_(Enable VLANs)_:
: <select name="TYPE" onchange="checkNetworkAccess(this.form,'eth0')">
: <select name="TYPE" onchange="checkNetworkAccess(this.form)">
<?=mk_option(_var($eth0,'TYPE'), 'access', _('No'))?>
<?=mk_option(_var($eth0,'TYPE'), 'trunk', _('Yes'))?>
</select>
<input type="button" id="button-vlan-eth0" class="form hide" value="_(Show)_" onclick="showVLAN('eth0')">
:eth_enable_vlans_help:
</div>
<div id='index-eth0-0'></div>
<div id="index-eth0-0"></div>
<div markdown="1" id="vlan-list-eth0" class="hide">
<?foreach ($vlan_eth0 as $i):?>
<div markdown="1" id="index-eth0-<?=$i?>" class="access-eth0 shade-<?=$display['theme']?>" style="display:none">
<div markdown="1" id="index-eth0-<?=$i?>" class="access-eth0 shade-<?=$display['theme']?> hide">
_(Interface description)_:
: <span class="status vshift"><i id="tag-eth0-<?=$i?>" class="fa fa-fw fa-chevron-down" style="cursor:pointer" onclick="viewToggle('eth0','<?=$i?>')"></i></span>
<input type="text" name="DESCRIPTION:<?=$i?>" maxlength="80" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:$i"))?>" oninput="noRun(this.form)">
: <input type="text" name="DESCRIPTION:<?=$i?>" maxlength="80" autocomplete="off" spellcheck="false" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:$i"))?>">
:eth_interface_description_help:
<div markdown="1" id="view-eth0-<?=$i?>" style="display:none">
_(VLAN number)_:
: <input type="number" name="VLANID:<?=$i?>" min="1" max="4095" value="<?=_var($eth0,"VLANID:$i")?>" class="narrow gap" required>
: <input type="number" name="VLANID:<?=$i?>" min="1" max="4095" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"VLANID:$i")?>" class="narrow gap" required>
<?if (!$service):?><input type="button" class="form" value="_(Delete VLAN)_" onclick="removeVLAN($('#index-eth0-<?=$i?>'))"><?endif;?>
:eth_vlan_number_help:
_(Network protocol)_:
: <select name="PROTOCOL:<?=$i?>" onchange="selectProtocol(this.form,'eth0',<?=$i?>)">
: <select name="PROTOCOL:<?=$i?>" onchange="selectProtocol(this.form,<?=$i?>,'slow')">
<?=mk_option(_var($eth0,"PROTOCOL:$i"), 'ipv4', _('IPv4 only'))?>
<?=mk_option(_var($eth0,"PROTOCOL:$i"), 'ipv6', _('IPv6 only'))?>
<?=mk_option(_var($eth0,"PROTOCOL:$i"), 'ipv4+ipv6', _('IPv4 + IPv6'))?>
@@ -674,9 +701,9 @@ _(Network protocol)_:
:eth_network_protocol_help:
<div markdown="1" class="ipv4-eth0-<?=$i?>" style="display:none">
<div markdown="1" class="ipv4-eth0-<?=$i?> hide">
_(IPv4 address assignment)_:
: <select name="USE_DHCP:<?=$i?>" onchange="selectProtocol(this.form,'eth0',<?=$i?>)">
: <select name="USE_DHCP:<?=$i?>" onchange="selectProtocol(this.form,<?=$i?>,'slow')">
<?=mk_option(_var($eth0,"USE_DHCP:$i"), 'yes', _('Automatic'))?>
<?=mk_option(_var($eth0,"USE_DHCP:$i"), 'no', _('Static'))?>
<?if ($i>0):?>
@@ -686,9 +713,9 @@ _(IPv4 address assignment)_:
:eth_ipv4_address_assignment_help:
<div markdown="1" class="more-ipv4-eth0-<?=$i?>" style="display:none">
<div markdown="1" class="more-ipv4-eth0-<?=$i?> hide">
_(IPv4 address)_:
: <input type="text" name="IPADDR:<?=$i?>" maxlength="15" value="<?=_var($eth0,"IPADDR:$i")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">/<select name="NETMASK:<?=$i?>" class="slim">
: <input type="text" name="IPADDR:<?=$i?>" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"IPADDR:$i")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">/<select name="NETMASK:<?=$i?>" class="slim">
<?=mk_option(_var($eth0,"NETMASK:$i"), "255.0.0.0", "8")?>
<?=mk_option(_var($eth0,"NETMASK:$i"), "255.255.0.0", "16")?>
<?=mk_option(_var($eth0,"NETMASK:$i"), "255.255.128.0", "17")?>
@@ -710,16 +737,16 @@ _(IPv4 address)_:
:eth_ipv4_address_help:
_(IPv4 default gateway)_:
: <input type="text" name="GATEWAY:<?=$i?>" maxlength="15" value="<?=_var($eth0,"GATEWAY:$i")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:<?=$i?>" min="0" max="9999" value="<?=_var($eth0,"METRIC:$i")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY:<?=$i?>" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"GATEWAY:$i")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:<?=$i?>" min="0" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"METRIC:$i")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
:eth_ipv4_default_gateway_help:
</div>
</div>
<div markdown="1" class="ipv6-eth0-<?=$i?>" style="display:none">
<div markdown="1" class="ipv6-eth0-<?=$i?> hide">
_(IPv6 address assignment)_:
: <select name="USE_DHCP6:<?=$i?>" onchange="selectProtocol(this.form,'eth0',<?=$i?>)">
: <select name="USE_DHCP6:<?=$i?>" onchange="selectProtocol(this.form,<?=$i?>,'slow')">
<?=mk_option(_var($eth0,"USE_DHCP6:$i"), 'yes', _('Automatic'))?>
<?=mk_option(_var($eth0,"USE_DHCP6:$i"), 'no', _('Static'))?>
<?if ($i>0):?>
@@ -729,15 +756,15 @@ _(IPv6 address assignment)_:
:eth_ipv6_address_assignment_help:
<div markdown="1" class="more-ipv6-eth0-<?=$i?>" style="display:none">
<div markdown="1" class="more-ipv6-eth0-<?=$i?> hide">
_(IPv6 address)_:
: <input type="text" name="IPADDR6:<?=$i?>" maxlength="39" value="<?=_var($eth0,"IPADDR6:$i")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:<?=$i?>" min="1" max="128" value="<?=_var($eth0,"NETMASK6:$i")?>" class="slim">
: <input type="text" name="IPADDR6:<?=$i?>" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"IPADDR6:$i")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:<?=$i?>" min="1" max="128" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"NETMASK6:$i")?>" class="slim">
:eth_ipv6_address_help:
_(IPv6 default gateway)_:
: <input type="text" name="GATEWAY6:<?=$i?>" maxlength="39" value="<?=_var($eth0,"GATEWAY6:$i")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:<?=$i?>" min="0" max="9999" value="<?=_var($eth0,"METRIC6:$i")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY6:<?=$i?>" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"GATEWAY6:$i")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:<?=$i?>" min="0" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"METRIC6:$i")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
:eth_ipv6_default_gateway_help:
@@ -752,45 +779,43 @@ _(IPv6 privacy extensions)_:
</div>
</div>
</div>
</div>
<?endforeach;?>
</div>
&nbsp;
: <input type="submit" value="_(Apply)_" onclick="$('#wait_eth0').show()" disabled><input type="button" value="_(Done)_" onclick="done()">
<?if (!$service):?>
<input type="button" class="access-eth0" value="_(Add VLAN)_" onclick="addVLAN('eth0')" style="display:none">
<input type="button" id="button-add-eth0" class="hide" value="_(Add VLAN)_" onclick="addVLAN('eth0')">
<?else:?><?=sprintf(_('Stop **%s** to make changes, see'),$service).' (<a href="/Settings">'._('Settings').'</a>)'?><?endif;?>
</form>
<script markdown="1" type="text/html" id="network-template-eth0">
<div markdown="1" id="index-eth0-INDEX" class="access-eth0 shade-<?=$display['theme']?>">
_(Interface description)_:
: <span class="status vshift"><i id="tag-eth0-INDEX" class="fa fa-fw fa-chevron-up" style="cursor:pointer" onclick="viewToggle('eth0','INDEX')"></i></span>
<input type="text" name="DESCRIPTION:INDEX" maxlength="80" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:INDEX"))?>" oninput="noRun(this.form)">
: <input type="text" name="DESCRIPTION:INDEX" maxlength="80" autocomplete="off" spellcheck="false" value="<?=htmlspecialchars(_var($eth0,"DESCRIPTION:INDEX"))?>">
<div markdown="1" id="view-eth0-INDEX">
_(VLAN number)_:
: <input type="number" name="VLANID:INDEX" min="1" max="4095" value="<?=_var($eth0,"VLANID:INDEX")?>" class="narrow gap" required>
: <input type="number" name="VLANID:INDEX" min="1" max="4095" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"VLANID:INDEX")?>" class="narrow gap" required>
<input type="button" class="form" value="_(Delete VLAN)_" onclick="removeVLAN($('#index-eth0-INDEX'))">
_(Network protocol)_:
: <select name="PROTOCOL:INDEX" onchange="selectProtocol(this.form,'eth0',INDEX)">
: <select name="PROTOCOL:INDEX" onchange="selectProtocol(this.form,INDEX,'slow')">
<?=mk_option(_var($eth0,"PROTOCOL:INDEX"), 'ipv4', _('IPv4 only'))?>
<?=mk_option(_var($eth0,"PROTOCOL:INDEX"), 'ipv6', _('IPv6 only'))?>
<?=mk_option(_var($eth0,"PROTOCOL:INDEX"), 'ipv4+ipv6', _('IPv4 + IPv6'))?>
</select>
<div markdown="1" class="ipv4-eth0-INDEX" style="display:none">
<div markdown="1" class="ipv4-eth0-INDEX hide">
_(IPv4 address assignment)_:
: <select name="USE_DHCP:INDEX" onchange="selectProtocol(this.form,'eth0',INDEX)">
: <select name="USE_DHCP:INDEX" onchange="selectProtocol(this.form,INDEX,'slow')">
<?=mk_option(_var($eth0,"USE_DHCP:INDEX"), 'yes', _('Automatic'))?>
<?=mk_option(_var($eth0,"USE_DHCP:INDEX"), 'no', _('Static'))?>
<?=mk_option(_var($eth0,"USE_DHCP:INDEX"), '', _('None'))?>
</select>
<div markdown="1" class="more-ipv4-eth0-INDEX" style="display:none">
<div markdown="1" class="more-ipv4-eth0-INDEX hide">
_(IPv4 address)_:
: <input type="text" name="IPADDR:INDEX" maxlength="15" value="<?=_var($eth0,"IPADDR:INDEX")?>" class="narrow" pattern="<?=$validIP4?>" title="=_(IPv4 address A.B.C.D)_">/<select name="NETMASK:INDEX" class="slim">
: <input type="text" name="IPADDR:INDEX" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"IPADDR:INDEX")?>" class="narrow" pattern="<?=$validIP4?>" title="=_(IPv4 address A.B.C.D)_">/<select name="NETMASK:INDEX" class="slim">
<?=mk_option(_var($eth0,"NETMASK:INDEX"), "255.0.0.0", "8")?>
<?=mk_option(_var($eth0,"NETMASK:INDEX"), "255.255.0.0", "16")?>
<?=mk_option(_var($eth0,"NETMASK:INDEX"), "255.255.128.0", "17")?>
@@ -810,26 +835,26 @@ _(IPv4 address)_:
</select>
_(IPv4 default gateway)_:
: <input type="text" name="GATEWAY:INDEX" maxlength="15" value="<?=_var($eth0,"GATEWAY:INDEX")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:INDEX" min="1" max="9999" value="<?=_var($eth0,"METRIC:INDEX")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY:INDEX" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"GATEWAY:INDEX")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:INDEX" min="1" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"METRIC:INDEX")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
</div>
</div>
<div markdown="1" class="ipv6-eth0-INDEX" style="display:none">
<div markdown="1" class="ipv6-eth0-INDEX hide">
_(IPv6 address assignment)_:
: <select name="USE_DHCP6:INDEX" onchange="selectProtocol(this.form,'eth0',INDEX)">
: <select name="USE_DHCP6:INDEX" onchange="selectProtocol(this.form,INDEX,'slow')">
<?=mk_option(_var($eth0,"USE_DHCP6:INDEX"), 'yes', _('Automatic'))?>
<?=mk_option(_var($eth0,"USE_DHCP6:INDEX"), 'no', _('Static'))?>
<?=mk_option(_var($eth0,"USE_DHCP6:INDEX"), '', _('None'))?>
</select>
<div markdown="1" class="more-ipv6-eth0-INDEX" style="display:none">
<div markdown="1" class="more-ipv6-eth0-INDEX hide">
_(IPv6 address)_:
: <input type="text" name="IPADDR6:INDEX" maxlength="39" value="<?=_var($eth0,"IPADDR6:INDEX")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:INDEX" min="1" max="128" value="<?=_var($eth0,"NETMASK6:INDEX")?>" class="slim">
: <input type="text" name="IPADDR6:INDEX" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"IPADDR6:INDEX")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:INDEX" min="1" max="128" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"NETMASK6:INDEX")?>" class="slim">
_(IPv6 default gateway)_:
: <input type="text" name="GATEWAY6:INDEX" maxlength="39" value="<?=_var($eth0,"GATEWAY6:INDEX")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:INDEX" min="1" max="9999" value="<?=_var($eth0,"METRIC6:INDEX")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY6:INDEX" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"GATEWAY6:INDEX")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:INDEX" min="1" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($eth0,"METRIC6:INDEX")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
_(IPv6 privacy extensions)_:
: <select name="PRIVACY6:INDEX">
@@ -840,5 +865,4 @@ _(IPv6 privacy extensions)_:
</div>
</div>
</div>
</div>
</script>
+79 -96
View File
@@ -3,8 +3,8 @@ Title="_(Interface)_ ethX"
Tag="icon-ethernet"
---
<?PHP
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, Bergware International.
/* Copyright 2005-2025, Lime Technology
* Copyright 2012-2025, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -41,37 +41,22 @@ if (strpos($locked,'bond')===0 || strpos($locked,'br')===0) {
}
?>
<script>
function portcheck_ethX() {
$.post('/webGui/include/CheckPort.php',{port:'ethX'},function(text) {
var html = $('#user-notice').html();
if (!html || html.indexOf('ethX')>0) showNotice(text);
setTimeout(portcheck_ethX,10000);
});
}
arg1.ethX = 'none';
$(function() {
var ctrl = "<span id='wait_ethX' class='status vshift red-text' style='display:none;font-size:1.2rem;font-style:italic'><i class='fa fa-spinner fa-spin'></i> _(Please wait)_... _(configuring interface)_</span>";
var form = document.ethX_settings;
<?if ($tabbed && !$service):?>
<?if (!$service):?>
$('#tabX').bind({click:function(){
$('#bond-ethX').dropdownchecklist('destroy').dropdownchecklist({emptyText:"_(None)_", width:<?=$width[0]?>});
$('#bridge-ethX').dropdownchecklist('destroy').dropdownchecklist({emptyText:"_(None)_", width:<?=$width[0]?>});
$('#bond-ethX').dropdownchecklist('destroy').dropdownchecklist({emptyText:"_(None)_", width:166});
$('#bridge-ethX').dropdownchecklist('destroy').dropdownchecklist({emptyText:"_(None)_", width:166});
}});
<?endif;?>
if (!$.cookie('#view-ethX')) {$('#view-ethX').show(); $('#tag-ethX').removeClass('fa-chevron-down').addClass('fa-chevron-up');}
<?foreach ($vlan_ethX as $i):?>
if (!$.cookie('#view-ethX-<?=$i?>')) {$('#view-ethX-<?=$i?>').show(); $('#tag-ethX-<?=$i?>').removeClass('fa-chevron-down').addClass('fa-chevron-up');}
<?endforeach;?>
$('#bond-ethX').dropdownchecklist({emptyText:"_(None)_", width:<?=$width[0]?>});
$('#bridge-ethX').dropdownchecklist({emptyText:"_(None)_", width:<?=$width[0]?>});
checkBondingSettings(form,0,'ethX');
checkBridgingSettings(form,0,'ethX');
checkNetworkAccess(form,'ethX');
selectProtocol(form,'ethX');
<?if (!$tabbed):?>
$('div.title').each(function(){
if ($(this).text().indexOf('Interface ethX')==0) $(this).find('span.left').append(ctrl);
});
<?endif;?>
$('#bond-ethX').dropdownchecklist({emptyText:"_(None)_", width:166});
$('#bridge-ethX').dropdownchecklist({emptyText:"_(None)_", width:166});
checkBondingSettings(form,0);
checkBridgingSettings(form,0);
checkNetworkAccess(form);
selectProtocol(form);
<?if (isset($master_ethX)):?>
$('div.slave-ethX').hide();
disableForm(form);
@@ -81,10 +66,13 @@ $(function() {
<?if ($no_eth0):?>
$('input[name="#shut_ethX"]').prop('disabled',true);
<?endif;?>
setTimeout(portcheck_ethX,Number('ethX'.substr(3))*1000);
portcheck('ethX');
presetRun(form);
});
</script>
<form markdown="1" name="ethX_settings" method="POST" action="/update.php" target="progressFrame" onchange="doRun(this)" onsubmit="return prepareSettings(this)">
<div class="title nocontrol shift"><span class="left"><i class="title icon-ethernet"></i>_(Interface)_ ethX</span></div>
<form markdown="1" name="ethX_settings" method="POST" action="/update.php" target="progressFrame" onchange="signalRun(this,2)" onsubmit="return prepareSettings(this)">
<input type="hidden" name="#file" value="<?=$ini?>">
<input type="hidden" name="#include" value="/webGui/include/update.ethernet.php">
<input type="hidden" name="#section" value="ethX">
@@ -96,16 +84,15 @@ $(function() {
<input type="hidden" name="BRSTP" value="no">
<input type="hidden" name="BRFD" value="0">
_(Interface description)_:
: <span class="status vshift"><i id="tag-ethX" class="fa fa-fw fa-chevron-down" style="cursor:pointer" onclick="viewToggle('ethX')"></i></span>
<?if (!$more):?>
<input type="text" name="DESCRIPTION:0" maxlength="80" value="<?=htmlspecialchars(_var($ethX,"DESCRIPTION:0"))?>" oninput="noRun(this.form)">
: <input type="text" name="DESCRIPTION:0" maxlength="80" autocomplete="off" spellcheck="false" value="<?=htmlspecialchars(_var($ethX,"DESCRIPTION:0"))?>">
<input type="button" class="form" value="_(Info)_" onclick="networkInfo('ethX')">
<?else:?>
<span class="<?=$class?>"><?=$reason?></span>
: <span class="<?=$class?>"><?=$reason?></span>
<?endif;?>
:eth_interface_description_help:
<div markdown="1" id="view-ethX" style="display:none">
_(MAC address)_:
: <?=strtoupper(exec("ip link show ethX|grep -Pom1 'ether \K\S+'"))?>
@@ -113,16 +100,16 @@ _(MAC address)_:
<div markdown="1" class="slave-ethX">
_(Enable bonding)_:
: <select name="BONDING" onchange="checkBondingSettings(this.form,1,'ethX')">
: <select name="BONDING" onchange="checkBondingSettings(this.form,1)">
<?=mk_option(_var($ethX,'BONDING'), "no", _("No"))?>
<?=mk_option(_var($ethX,'BONDING'), "yes", _("Yes"))?>
</select>
:eth_enable_bonding_help:
<div markdown="1" id="bond-members-ethX" style="display:none">
<div markdown="1" id="bond-members-ethX" class="'hide">
_(Bonding mode)_:
: <select name="BONDING_MODE" onchange="checkBondingSettings(this.form,-1,'ethX')">
: <select name="BONDING_MODE" onchange="checkBondingSettings(this.form,-1)">
<?=mk_option(_var($ethX,'BONDING_MODE'), "0", _("balance-rr")." (0)")?>
<?=mk_option(_var($ethX,'BONDING_MODE'), "1", _("active-backup")." (1)",isset($ethX['BONDING_MODE'])?'':'selected')?>
<?=mk_option(_var($ethX,'BONDING_MODE'), "2", _("balance-xor")." (2)")?>
@@ -131,12 +118,12 @@ _(Bonding mode)_:
<?=mk_option(_var($ethX,'BONDING_MODE'), "5", _("balance-tlb")." (5)")?>
<?=mk_option(_var($ethX,'BONDING_MODE'), "6", _("balance-alb")." (6)")?>
</select>
<span id="attention0" style="display:none">**_(Attention)_:** _(this mode requires a network switch with proper setup and support)_...</span>
<span id="attention0" class="hide">**_(Attention)_:** _(this mode requires a network switch with proper setup and support)_...</span>
:eth_bonding_mode_help:
_(Bonding members of)_ bondX:
: <select id="bond-ethX" name="BONDNICS" multiple="multiple" style="display:none">
: <select id="bond-ethX" name="BONDNICS" multiple="multiple" class="'hide">
<?=mk_option(_var($ethX,'BONDNICS'),'ethX','ethX','selected disabled')?>
<?foreach ($ports as $port):?>
<?if ($port!='ethX' && !locked('ethX',$port)) echo mk_option_check(_var($ethX,'BONDNICS'),$port,$port)?>
@@ -147,16 +134,16 @@ _(Bonding members of)_ bondX:
</div>
_(Enable bridging)_:
: <select name="BRIDGING" onchange="checkBridgingSettings(this.form,1,'ethX')">
: <select name="BRIDGING" onchange="checkBridgingSettings(this.form,1)">
<?=mk_option(_var($ethX,'BRIDGING'), "no", _("No"))?>
<?=mk_option(_var($ethX,'BRIDGING'), "yes", _("Yes"))?>
</select>
:eth_enable_bridging_help:
<div markdown="1" id="bridge-members-ethX" style="display:none">
<div markdown="1" id="bridge-members-ethX" class="'hide">
_(Bridging members of)_ brX:
: <select id="bridge-ethX" name="BRNICS" multiple="multiple" style="display:none">
: <select id="bridge-ethX" name="BRNICS" multiple="multiple" class="'hide">
<?=mk_option(_var($ethX,'BRNICS'),'ethX','ethX','selected disabled')?>
<?foreach ($ports as $port):?>
<?if ($port!='ethX' && !locked('ethX',$port)) echo mk_option_check(_var($ethX,'BRNICS'),$port,$port)?>
@@ -167,7 +154,7 @@ _(Bridging members of)_ brX:
</div>
_(Network protocol)_:
: <select name="PROTOCOL:0" onchange="selectProtocol(this.form,'ethX',0)">
: <select name="PROTOCOL:0" onchange="selectProtocol(this.form,0,'slow')">
<?=mk_option(_var($ethX,"PROTOCOL:0"), 'ipv4', _('IPv4 only'))?>
<?=mk_option(_var($ethX,"PROTOCOL:0"), 'ipv6', _('IPv6 only'))?>
<?=mk_option(_var($ethX,"PROTOCOL:0"), 'ipv4+ipv6', _('IPv4 + IPv6'))?>
@@ -175,9 +162,9 @@ _(Network protocol)_:
:eth_network_protocol_help:
<div markdown="1" class="ipv4-ethX-0" style="display:none">
<div markdown="1" class="ipv4-ethX-0 hide">
_(IPv4 address assignment)_:
: <select name="USE_DHCP:0" onchange="selectProtocol(this.form,'ethX',0)">
: <select name="USE_DHCP:0" onchange="selectProtocol(this.form,0,'slow')">
<?=mk_option(_var($ethX,"USE_DHCP:0"), 'yes', _('Automatic'))?>
<?=mk_option(_var($ethX,"USE_DHCP:0"), 'no', _('Static'))?>
<?=mk_option(_var($ethX,"USE_DHCP:0"), '', _('None'))?>
@@ -185,9 +172,9 @@ _(IPv4 address assignment)_:
:eth_ipv4_address_assignment_help:
<div markdown="1" class="more-ipv4-ethX-0" style="display:none">
<div markdown="1" class="more-ipv4-ethX-0 hide">
_(IPv4 address)_:
: <input type="text" name="IPADDR:0" maxlength="15" value="<?=_var($ethX,"IPADDR:0")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">/<select name="NETMASK:0" class="slim">
: <input type="text" name="IPADDR:0" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"IPADDR:0")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">/<select name="NETMASK:0" class="slim">
<?=mk_option(_var($ethX,"NETMASK:0"), "255.0.0.0", "8")?>
<?=mk_option(_var($ethX,"NETMASK:0"), "255.255.0.0", "16")?>
<?=mk_option(_var($ethX,"NETMASK:0"), "255.255.128.0", "17")?>
@@ -209,16 +196,16 @@ _(IPv4 address)_:
:eth_ipv4_address_help:
_(IPv4 default gateway)_:
: <input type="text" name="GATEWAY:0" maxlength="15" value="<?=_var($ethX,"GATEWAY:0")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:0" min="0" max="9999" value="<?=_var($ethX,"METRIC:0")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY:0" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"GATEWAY:0")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:0" min="0" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"METRIC:0")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
:eth_ipv4_default_gateway_help:
</div>
</div>
<div markdown="1" class="ipv6-ethX-0" style="display:none">
<div markdown="1" class="ipv6-ethX-0 hide">
_(IPv6 address assignment)_:
: <select name="USE_DHCP6:0" onchange="selectProtocol(this.form,'ethX',0)">
: <select name="USE_DHCP6:0" onchange="selectProtocol(this.form,0,'slow')">
<?=mk_option(_var($ethX,"USE_DHCP6:0"), 'yes', _('Automatic'))?>
<?=mk_option(_var($ethX,"USE_DHCP6:0"), 'no', _('Static'))?>
<?=mk_option(_var($ethX,"USE_DHCP6:0"), '', _('None'))?>
@@ -226,15 +213,15 @@ _(IPv6 address assignment)_:
:eth_ipv6_address_assignment_help:
<div markdown="1" class="more-ipv6-ethX-0" style="display:none">
<div markdown="1" class="more-ipv6-ethX-0 hide">
_(IPv6 address)_:
: <input type="text" name="IPADDR6:0" maxlength="39" value="<?=_var($ethX,"IPADDR6:0")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:0" min="1" max="128" value="<?=_var($ethX,"NETMASK6:0")?>" class="slim">
: <input type="text" name="IPADDR6:0" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"IPADDR6:0")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:0" min="1" max="128" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"NETMASK6:0")?>" class="slim">
:eth_ipv6_address_help:
_(IPv6 default gateway)_:
: <input type="text" name="GATEWAY6:0" maxlength="39" value="<?=_var($ethX,"GATEWAY6:0")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:0" min="0" max="9999" value="<?=_var($ethX,"METRIC6:0")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY6:0" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"GATEWAY6:0")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:0" min="0" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"METRIC6:0")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
:eth_ipv6_default_gateway_help:
@@ -249,38 +236,37 @@ _(IPv6 privacy extensions)_:
</div>
</div>
_(Desired MTU)_:
: <input type="number" name="MTU" min="68" max="9198" value="<?=_var($ethX,'MTU')?>" class="narrow" placeholder="1500">
: <input type="number" name="MTU" min="68" max="9198" autocomplete="off" spellcheck="false" value="<?=_var($ethX,'MTU')?>" class="narrow" placeholder="1500">
:eth_desired_mtu_help:
_(Enable VLANs)_:
: <select name="TYPE" onchange="checkNetworkAccess(this.form,'ethX')">
: <select name="TYPE" onchange="checkNetworkAccess(this.form)">
<?=mk_option(_var($ethX,'TYPE'), 'access', _('No'))?>
<?=mk_option(_var($ethX,'TYPE'), 'trunk', _('Yes'))?>
</select>
<input type="button" id="button-vlan-ethX" class="form hide" value="_(Show)_" onclick="showVLAN('ethX')">
:eth_enable_vlans_help:
</div>
</div>
<div id='index-ethX-0'></div>
<div markdown="1" id="vlan-list-ethX" class="hide">
<?foreach ($vlan_ethX as $i):?>
<div markdown="1" id="index-ethX-<?=$i?>" class="access-ethX shade-<?=$display['theme']?>" style="display:none">
<div markdown="1" id="index-ethX-<?=$i?>" class="access-ethX shade-<?=$display['theme']?> hide">
_(Interface description)_:
: <span class="status vshift"><i id="tag-ethX-<?=$i?>" class="fa fa-fw fa-chevron-down" style="cursor:pointer" onclick="viewToggle('ethX','<?=$i?>')"></i></span>
<input type="text" name="DESCRIPTION:<?=$i?>" maxlength="80" value="<?=htmlspecialchars(_var($ethX,"DESCRIPTION:$i"))?>" oninput="noRun(this.form)">
: <input type="text" name="DESCRIPTION:<?=$i?>" maxlength="80" autocomplete="off" spellcheck="false" value="<?=htmlspecialchars(_var($ethX,"DESCRIPTION:$i"))?>">
:eth_interface_description_help:
<div markdown="1" id="view-ethX-<?=$i?>" style="display:none">
_(VLAN number)_:
: <input type="number" name="VLANID:<?=$i?>" min="1" max="4095" value="<?=_var($ethX,"VLANID:$i")?>" class="narrow gap" required>
: <input type="number" name="VLANID:<?=$i?>" min="1" max="4095" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"VLANID:$i")?>" class="narrow gap" required>
<?if (!$service):?><input type="button" class="form" value="_(Delete VLAN)_" onclick="removeVLAN($('#index-ethX-<?=$i?>'))"><?endif;?>
:eth_vlan_number_help:
_(Network protocol)_:
: <select name="PROTOCOL:<?=$i?>" onchange="selectProtocol(this.form,'ethX',<?=$i?>)">
: <select name="PROTOCOL:<?=$i?>" onchange="selectProtocol(this.form,<?=$i?>,'slow')">
<?=mk_option(_var($ethX,"PROTOCOL:$i"), 'ipv4', _('IPv4 only'))?>
<?=mk_option(_var($ethX,"PROTOCOL:$i"), 'ipv6', _('IPv6 only'))?>
<?=mk_option(_var($ethX,"PROTOCOL:$i"), 'ipv4+ipv6', _('IPv4 + IPv6'))?>
@@ -288,9 +274,9 @@ _(Network protocol)_:
:eth_network_protocol_help:
<div markdown="1" class="ipv4-ethX-<?=$i?>" style="display:none">
<div markdown="1" class="ipv4-ethX-<?=$i?> hide">
_(IPv4 address assignment)_:
: <select name="USE_DHCP:<?=$i?>" onchange="selectProtocol(this.form,'ethX',<?=$i?>)">
: <select name="USE_DHCP:<?=$i?>" onchange="selectProtocol(this.form,<?=$i?>,'slow')">
<?=mk_option(_var($ethX,"USE_DHCP:$i"), 'yes', _('Automatic'))?>
<?=mk_option(_var($ethX,"USE_DHCP:$i"), 'no', _('Static'))?>
<?=mk_option(_var($ethX,"USE_DHCP:$i"), '', _('None'))?>
@@ -298,9 +284,9 @@ _(IPv4 address assignment)_:
:eth_ipv4_address_assignment_help:
<div markdown="1" class="more-ipv4-ethX-<?=$i?>" style="display:none">
<div markdown="1" class="more-ipv4-ethX-<?=$i?> hide">
_(IPv4 address)_:
: <input type="text" name="IPADDR:<?=$i?>" maxlength="15" value="<?=_var($ethX,"IPADDR:$i")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">/<select name="NETMASK:<?=$i?>" class="slim">
: <input type="text" name="IPADDR:<?=$i?>" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"IPADDR:$i")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">/<select name="NETMASK:<?=$i?>" class="slim">
<?=mk_option(_var($ethX,"NETMASK:$i"), "255.0.0.0", "8")?>
<?=mk_option(_var($ethX,"NETMASK:$i"), "255.255.0.0", "16")?>
<?=mk_option(_var($ethX,"NETMASK:$i"), "255.255.128.0", "17")?>
@@ -322,16 +308,16 @@ _(IPv4 address)_:
:eth_ipv4_address_help:
_(IPv4 default gateway)_:
: <input type="text" name="GATEWAY:<?=$i?>" maxlength="15" value="<?=_var($ethX,"GATEWAY:$i")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:<?=$i?>" min="0" max="9999" value="<?=_var($ethX,"METRIC:$i")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY:<?=$i?>" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"GATEWAY:$i")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:<?=$i?>" min="0" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"METRIC:$i")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
:eth_ipv4_default_gateway_help:
</div>
</div>
<div markdown="1" class="ipv6-ethX-<?=$i?>" style="display:none">
<div markdown="1" class="ipv6-ethX-<?=$i?> hide">
_(IPv6 address assignment)_:
: <select name="USE_DHCP6:<?=$i?>" onchange="selectProtocol(this.form,'ethX',<?=$i?>)">
: <select name="USE_DHCP6:<?=$i?>" onchange="selectProtocol(this.form,<?=$i?>,'slow')">
<?=mk_option(_var($ethX,"USE_DHCP6:$i"), 'yes', _('Automatic'))?>
<?=mk_option(_var($ethX,"USE_DHCP6:$i"), 'no', _('Static'))?>
<?=mk_option(_var($ethX,"USE_DHCP6:$i"), '', _('None'))?>
@@ -339,15 +325,15 @@ _(IPv6 address assignment)_:
:eth_ipv6_address_assignment_help:
<div markdown="1" class="more-ipv6-ethX-<?=$i?>" style="display:none">
<div markdown="1" class="more-ipv6-ethX-<?=$i?> hide">
_(IPv6 address)_:
: <input type="text" name="IPADDR6:<?=$i?>" maxlength="39" value="<?=_var($ethX,"IPADDR6:$i")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:<?=$i?>" min="1" max="128" value="<?=_var($ethX,"NETMASK6:$i")?>" class="slim">
: <input type="text" name="IPADDR6:<?=$i?>" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"IPADDR6:$i")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:<?=$i?>" min="1" max="128" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"NETMASK6:$i")?>" class="slim">
:eth_ipv6_address_help:
_(IPv6 default gateway)_:
: <input type="text" name="GATEWAY6:<?=$i?>" maxlength="39" value="<?=_var($ethX,"GATEWAY6:$i")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:<?=$i?>" min="0" max="9999" value="<?=_var($ethX,"METRIC6:$i")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY6:<?=$i?>" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"GATEWAY6:$i")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:<?=$i?>" min="0" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"METRIC6:$i")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
:eth_ipv6_default_gateway_help:
@@ -362,46 +348,44 @@ _(IPv6 privacy extensions)_:
</div>
</div>
</div>
</div>
<?endforeach;?>
</div>
&nbsp;
: <input type="submit" value="_(Apply)_" onclick="$('#wait_<?=$tabbed?'eth0':'ethX'?>').show()" disabled><input type="button" value="_(Done)_" onclick="done()">
<input type="button" name="#shut_ethX" value="<?=_('Port '.$cmd)?>" onclick="portToggle('ethX','<?=$cmd?>')">
<?if (!$service):?>
<input type="button" class="access-ethX" value="_(Add VLAN)_" onclick="addVLAN('ethX')" style="display:none">
<input type="button" id="button-add-ethX" class="hide" value="_(Add VLAN)_" onclick="addVLAN('ethX')">
<?else:?><?=sprintf(_('Stop **%s** to make changes, see'),$service).' (<a href="/Settings">'._('Settings').'</a>)'?><?endif;?>
</form>
<script markdown="1" type="text/html" id="network-template-ethX">
<div markdown="1" id="index-ethX-INDEX" class="access-ethX shade-<?=$display['theme']?>">
_(Interface description)_:
: <span class="status vshift"><i id="tag-ethX-INDEX" class="fa fa-fw fa-chevron-up" style="cursor:pointer" onclick="viewToggle('ethX','INDEX')"></i></span>
<input type="text" name="DESCRIPTION:INDEX" maxlength="80" value="<?=htmlspecialchars(_var($ethX,"DESCRIPTION:INDEX"))?>" oninput="noRun(this.form)">
: <input type="text" name="DESCRIPTION:INDEX" maxlength="80" autocomplete="off" spellcheck="false" value="<?=htmlspecialchars(_var($ethX,"DESCRIPTION:INDEX"))?>">
<div markdown="1" id="view-ethX-INDEX">
_(VLAN number)_:
: <input type="number" name="VLANID:INDEX" min="1" max="4095" value="<?=_var($ethX,"VLANID:INDEX")?>" class="narrow gap" required>
: <input type="number" name="VLANID:INDEX" min="1" max="4095" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"VLANID:INDEX")?>" class="narrow gap" required>
<input type="button" class="form" value="_(Delete VLAN)_" onclick="removeVLAN($('#index-ethX-INDEX'))">
_(Network protocol)_:
: <select name="PROTOCOL:INDEX" onchange="selectProtocol(this.form,'ethX',INDEX)">
: <select name="PROTOCOL:INDEX" onchange="selectProtocol(this.form,INDEX,'slow')">
<?=mk_option(_var($ethX,"PROTOCOL:INDEX"), 'ipv4', _('IPv4 only'))?>
<?=mk_option(_var($ethX,"PROTOCOL:INDEX"), 'ipv6', _('IPv6 only'))?>
<?=mk_option(_var($ethX,"PROTOCOL:INDEX"), 'ipv4+ipv6', _('IPv4 + IPv6'))?>
</select>
<div markdown="1" class="ipv4-ethX-INDEX" style="display:none">
<div markdown="1" class="ipv4-ethX-INDEX hide">
_(IPv4 address assignment)_:
: <select name="USE_DHCP:INDEX" onchange="selectProtocol(this.form,'ethX',INDEX)">
: <select name="USE_DHCP:INDEX" onchange="selectProtocol(this.form,INDEX,'slow')">
<?=mk_option(_var($ethX,"USE_DHCP:INDEX"), 'yes', _('Automatic'))?>
<?=mk_option(_var($ethX,"USE_DHCP:INDEX"), 'no', _('Static'))?>
<?=mk_option(_var($ethX,"USE_DHCP:INDEX"), '', _('None'))?>
</select>
<div markdown="1" class="more-ipv4-ethX-INDEX" style="display:none">
<div markdown="1" class="more-ipv4-ethX-INDEX hide">
_(IPv4 address)_:
: <input type="text" name="IPADDR:INDEX" maxlength="15" value="<?=_var($ethX,"IPADDR:INDEX")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">/<select name="NETMASK:INDEX" class="slim">
: <input type="text" name="IPADDR:INDEX" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"IPADDR:INDEX")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">/<select name="NETMASK:INDEX" class="slim">
<?=mk_option(_var($ethX,"NETMASK:INDEX"), "255.0.0.0", "8")?>
<?=mk_option(_var($ethX,"NETMASK:INDEX"), "255.255.0.0", "16")?>
<?=mk_option(_var($ethX,"NETMASK:INDEX"), "255.255.128.0", "17")?>
@@ -421,26 +405,26 @@ _(IPv4 address)_:
</select>
_(IPv4 default gateway)_:
: <input type="text" name="GATEWAY:INDEX" maxlength="15" value="<?=_var($ethX,"GATEWAY:INDEX")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:INDEX" min="1" max="9999" value="<?=_var($ethX,"METRIC:INDEX")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY:INDEX" maxlength="15" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"GATEWAY:INDEX")?>" class="narrow" pattern="<?=$validIP4?>" title="_(IPv4 address A.B.C.D)_">
<input type="text" name="METRIC:INDEX" min="1" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"METRIC:INDEX")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
</div>
</div>
<div markdown="1" class="ipv6-ethX-INDEX" style="display:none">
<div markdown="1" class="ipv6-ethX-INDEX hide">
_(IPv6 address assignment)_:
: <select name="USE_DHCP6:INDEX" onchange="selectProtocol(this.form,'ethX',INDEX)">
: <select name="USE_DHCP6:INDEX" onchange="selectProtocol(this.form,INDEX,'slow')">
<?=mk_option(_var($ethX,"USE_DHCP6:INDEX"), 'yes', _('Automatic'))?>
<?=mk_option(_var($ethX,"USE_DHCP6:INDEX"), 'no', _('Static'))?>
<?=mk_option(_var($ethX,"USE_DHCP6:INDEX"), '', _('None'))?>
</select>
<div markdown="1" class="more-ipv6-ethX-INDEX" style="display:none">
<div markdown="1" class="more-ipv6-ethX-INDEX hide">
_(IPv6 address)_:
: <input type="text" name="IPADDR6:INDEX" maxlength="39" value="<?=_var($ethX,"IPADDR6:INDEX")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:INDEX" min="1" max="128" value="<?=_var($ethX,"NETMASK6:INDEX")?>" class="slim">
: <input type="text" name="IPADDR6:INDEX" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"IPADDR6:INDEX")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">/<input type="number" name="NETMASK6:INDEX" min="1" max="128" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"NETMASK6:INDEX")?>" class="slim">
_(IPv6 default gateway)_:
: <input type="text" name="GATEWAY6:INDEX" maxlength="39" value="<?=_var($ethX,"GATEWAY6:INDEX")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:INDEX" min="1" max="9999" value="<?=_var($ethX,"METRIC6:INDEX")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
: <input type="text" name="GATEWAY6:INDEX" maxlength="39" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"GATEWAY6:INDEX")?>" pattern="<?=$validIP6?>" title="_(IPv6 address nnnn:xxxx::yyyy)_">
<input type="text" name="METRIC6:INDEX" min="1" max="9999" autocomplete="off" spellcheck="false" value="<?=_var($ethX,"METRIC6:INDEX")?>" class="slim"><i class="fa fa-sort-numeric-asc"></i> *_(optional metric (lowest is preferred, 0 is no default gateway))_*
_(IPv6 privacy extensions)_:
: <select name="PRIVACY6:INDEX">
@@ -451,5 +435,4 @@ _(IPv6 privacy extensions)_:
</div>
</div>
</div>
</div>
</script>
+4 -28
View File
@@ -1,10 +1,10 @@
Menu="NetworkSettings"
Title="Interface Extra"
Tag="icon-ethernet"
Tag="icon-custom"
---
<?PHP
/* Copyright 2023, Lime Technology
* Copyright 2023, Bergware International.
/* Copyright 2005-2025, Lime Technology
* Copyright 2012-2025, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -52,28 +52,6 @@ function prepareText(form) {
return true;
}
<?if (!$tabbed):?>
function toggleExtra() {
var tag = '#tag_extra';
var view = '#extra_table';
if ($(view).is(':visible')) {
$(tag).removeClass('fa-chevron-up').addClass('fa-chevron-down');
$.cookie(view,'hide',{expires:3650});
} else {
$(tag).removeClass('fa-chevron-down').addClass('fa-chevron-up');
$.removeCookie(view);
}
$(view).toggle('slow');
}
$(function(){
$('div.title').eq(-3).find('span.left').append("<span class='status vhshift'><i id='tag_extra' class='fa fa-fw fa-chevron-up' style='cursor:pointer' onclick='toggleExtra()'></i></span>");
if (!$.cookie('#extra_table')) $('#extra_table').show(); else {$('#extra_table').hide(); $('#tag_extra').removeClass('fa-chevron-up').addClass('fa-chevron-down');}
});
<?else:?>
$(function(){
$('#extra_table').show();
});
<?endif;?>
$(function(){
$('form textarea').on('input',function(){
$(this).prop('rows',($(this).val().match(/\n/g)||[]).length+1);
@@ -81,7 +59,7 @@ $(function(){
});
</script>
<div markdown="1" id="extra_table" style="display:none">
<div class="title nocontrol shift"><span class="left"><i class="title icon-custom"></i>_(Interface Extra)_</span></div>
<form markdown="1" name="network_extra" method="POST" action="/update.php" target="progressFrame" onsubmit="return prepareText(this)">
<input type="hidden" name="#file" value="<?=$cfg?>">
<input type="hidden" name="#command" value="/webGui/scripts/reload_services">
@@ -105,5 +83,3 @@ _(Exclude listening interfaces)_:
&nbsp;
: <input type="submit" value="_(Apply)_" disabled><input type="button" value="_(Done)_" onclick="done()">
</form>
</div>
+3 -26
View File
@@ -4,8 +4,8 @@ Tag="icon-network"
Cond="file_exists('/boot/config/network-rules.cfg')"
---
<?PHP
/* Copyright 2023, Lime Technology
* Copyright 2023, Bergware International.
/* Copyright 2005-2025, Lime Technology
* Copyright 2012-2025, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -53,30 +53,8 @@ function check_rules(form) {
function update_info(id,mac) {
$('#info-'+id).html(info['_'+mac.replace(/:/g,'')]);
}
<?if (!$tabbed):?>
function toggleRules() {
var tag = '#tag_rules';
var view = '#rules_table';
if ($(view).is(':visible')) {
$(tag).removeClass('fa-chevron-up').addClass('fa-chevron-down');
$.cookie(view,'hide',{expires:3650});
} else {
$(tag).removeClass('fa-chevron-down').addClass('fa-chevron-up');
$.removeCookie(view);
}
$(view).toggle('slow');
}
$(function(){
$('div.title').eq(-2).find('span.left').append("<span class='status vhshift'><i id='tag_rules' class='fa fa-fw fa-chevron-up' style='cursor:pointer' onclick='toggleRules()'></i></span>");
if (!$.cookie('#rules_table')) $('#rules_table').show(); else {$('#rules_table').hide(); $('#tag_rules').removeClass('fa-chevron-up').addClass('fa-chevron-down');}
});
<?else:?>
$(function(){
$('#rules_table').show();
});
<?endif;?>
</script>
<div markdown="1" id="rules_table" style="display:none">
<div class="title nocontrol shift"><span class="left"><i class="title icon-network"></i>_(Interface Rules)_</span></div>
<form markdown="1" name="network_rules" method="POST" action="/update.php" target="progressFrame" onsubmit="return check_rules(this)">
<input type="hidden" name="#file" value="not-used">
<input type="hidden" name="#include" value="/webGui/include/update.rules.php">
@@ -101,4 +79,3 @@ _(Interface)_ <?=$eth?>:
<?if (file_exists('/tmp/network-rules.tmp')):?>
<br><span class="error" style="text-align:center;padding:12px 0">_(Please **Reboot** system to make new rules active)_</span>
<?endif;?>
</div>
@@ -2,3 +2,4 @@ Menu="OtherSettings"
Type="xmenu"
Title="Network Settings"
Icon="icon-network"
Tabs="true"
+3 -25
View File
@@ -3,8 +3,8 @@ Title="Routing Table"
Tag="icon-share"
---
<?PHP
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, Bergware International.
/* Copyright 2005-2025, Lime Technology
* Copyright 2012-2025, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -48,32 +48,11 @@ function resetTable() {
clearTimeout(timers.routeTable);
routeTable();
}
<?if (!$tabbed):?>
function toggleTable() {
var tag = '#tag_table';
var view = '#route_table';
if ($(view).is(':visible')) {
$(tag).removeClass('fa-chevron-up').addClass('fa-chevron-down');
$.cookie(view,'hide',{expires:3650});
} else {
$(tag).removeClass('fa-chevron-down').addClass('fa-chevron-up');
$.removeCookie(view);
}
$(view).toggle('slow');
}
$(function(){
$('div.title').last().find('span.left').append("<span class='status vhshift'><i id='tag_table' class='fa fa-fw fa-chevron-up' style='cursor:pointer' onclick='toggleTable()'></i></span>");
if (!$.cookie('#route_table')) $('#route_table').show(); else $('#tag_table').removeClass('fa-chevron-up').addClass('fa-chevron-down');
routeTable();
});
<?else:?>
$(function(){
$('#route_table').show();
routeTable();
});
<?endif;?>
</script>
<div markdown="1" id="route_table" style="display:none">
<div class="title nocontrol shift"><span class="left"><i class="title fa fa-cog"></i>_(Routing Table)_</span></div>
<table class="unraid">
<thead><tr><td>_(Protocol)_</td><td>_(Route)_</td><td>_(Gateway)_</td><td>_(Metric)_</td><td style="width:8%;text-align:center">_(Delete)_</td></tr></thead>
<tbody id="route_list"></tbody>
@@ -93,4 +72,3 @@ _(Enter route + gateway + metric)_:
: <input type="submit" value="_(Add Route)_"><input type="button" value="_(Done)_" class="lock" onclick="done()">
</form>
</div>
</div>
@@ -0,0 +1,53 @@
<?PHP
/* Copyright 2005-2025, Lime Technology
* Copyright 2012-2025, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp');
// add translations
$_SERVER['REQUEST_URI'] = 'settings';
require_once "$docroot/webGui/include/Translations.php";
function port($eth) {
$sys = "/sys/class/net";
$x = preg_replace('/[^0-9]/','',$eth);
return file_exists("$sys/br{$x}") ? "br${x}" : (file_exists("$sys/bond{$x}") ? "bond{$x}" : "eth{$x}");
}
exec("grep -Po 'nameserver \K.*' /etc/resolv.conf",$dns);
$port = port($_POST['port']);
$v6on = @file_get_contents("/proc/sys/net/ipv6/conf/$port/disable_ipv6")!=1;
$error = "<span class='red-text'>"._('missing')."</span>";
$speed = preg_replace('/^(\d+)/','$1 ',exec("ethtool $port | awk '$1==\"Speed:\" {print $2;exit}'")) ?: $error;
$ipv4 = exec("ip -4 -br addr show scope global $port | awk '{\$1=\$2=\"\";print;exit}' | sed -r 's/ metric [0-9]+//g; s/\/[0-9]+//g' | xargs") ?: $error;
$gw4 = exec("ip -4 route show default | awk '{print \$3;exit}'") ?: $error;
$dns4 = implode(' ',array_filter($dns,function($ns){return strpos($ns,':')===false;})) ?: $error;
$domain = exec("grep -Pom1 'domain \K.*' /etc/resolv.conf") ?: '---';
if ($v6on) {
$ipv6 = exec("ip -6 -br addr show scope global $port | awk '{\$1=\$2=\"\";print;exit}' | sed -r 's/ metric [0-9]+//g; s/\/[0-9]+//g' | xargs") ?: $error;
$gw6 = exec("ip -6 route show default | awk '{print \$3;exit}'") ?: $error;
$dns6 = implode(' ',array_filter($dns,function($ns){return strpos($ns,':')!==false;})) ?: $error;
}
echo "<table style='text-align:left;font-size:1.2rem'>";
echo "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";
echo "<tr><td>"._('Interface speed').":</td><td>$speed</td></tr>";
echo "<tr><td>"._('IPv4 address').":</td><td>$ipv4</td></tr>";
echo "<tr><td>"._('IPv4 default gateway').":</td><td>$gw4</td></tr>";
echo "<tr><td>"._('IPv4 DNS servers').":</td><td>$dns4</td></tr>";
if ($v6on) {
echo "<tr><td>"._('IPv6 address').":</td><td>$ipv6</td></tr>";
echo "<tr><td>"._('IPv6 default gateway').":</td><td>$gw6</td></tr>";
echo "<tr><td>"._('IPv6 DNS servers').":</td><td>$dns6</td></tr>";
}
echo "<tr><td>"._('Domain name').":</td><td>$domain</td></tr>";
echo "</table>";
?>
@@ -1,6 +1,6 @@
<?PHP
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, Bergware International.
/* Copyright 2005-2025, Lime Technology
* Copyright 2012-2025, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -26,8 +26,8 @@ case 'Add Route':
if ($gateway && $route) exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$gateway}_{$route}_{$metric}_add"));
break;
default:
exec("ip -4 route show table all|grep -Pv '^(127\\.0\\.0\\.0)|table local'",$ipv4);
exec("ip -6 route show table all|grep -Pv '^([am:]|(f[ef][0-9][0-9])::)|expires|table local'",$ipv6);
exec("ip -4 route show table all|grep -Pv '^(127\\.0\\.0\\.0)|table local|unreachable'",$ipv4);
exec("ip -6 route show table all|grep -Pv '^([am:]|(f[ef][0-9][0-9])::)|expires|table local|unreachable'",$ipv6);
foreach ($ipv4 as $info) {
$cell = explode(' ',$info);
$route = $cell[0];
+46 -30
View File
@@ -1,7 +1,7 @@
#!/usr/bin/php -q
<?PHP
/* Copyright 2005-2023, Lime Technology
* Copyright 2012-2023, Bergware International.
/* Copyright 2005-2025, Lime Technology
* Copyright 2012-2025, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
@@ -19,13 +19,19 @@ require_once "$docroot/webGui/include/Wrappers.php";
if ($argc == 1) exit;
$set = $ifname = $argv[1];
$run = $set != 'none';
$run = $set !== 'none';
$dns = $set === 'renew';
$ini = parse_ini_file('/var/local/emhttp/network.ini',true); ksort($ini,SORT_NATURAL);
$cfg = '/boot/config/network.cfg';
function port($x) {
$sys = "/sys/class/net";
return file_exists("$sys/br{$x}") ? "br${x}" : (file_exists("$sys/bond{$x}") ? "bond{$x}" : "eth{$x}");
}
function update_wireguard($ifname) {
if (!in_array($ifname,['br0','bond0','eth0'])) return;
$nic = file_exists('/sys/class/net/br0') ? 'br0' : (file_exists('/sys/class/net/bond0') ? 'bond0' : 'eth0');
$nic = port(0);
exec("wg show interfaces|tr ' ' '\n'",$active);
foreach (glob("/etc/wireguard/*.conf",GLOB_NOSORT) as $wg) {
$vtun = basename($wg,'.conf');
@@ -38,6 +44,7 @@ function update_wireguard($ifname) {
if (in_array($vtun,$active)) exec("wg-quick down $vtun; sleep 1; wg-quick up $vtun");
}
}
function ifname($name) {
global $old;
if (!$name) return;
@@ -47,10 +54,12 @@ function ifname($name) {
}
return $name;
}
function bond_nics(&$bond,$nic) {
$bond['BONDNICS'] = str_replace(',',' ',$bond['BONDNICS']);
return explode(' ',preg_replace("/$nic ?/","",$bond['BONDNICS']));
}
function bridge_nics(&$bridge,$nic) {
$bridge['BRNICS'] = str_replace(',',' ',$bridge['BRNICS']);
return explode(' ',preg_replace("/$nic ?/","",$bridge['BRNICS']));
@@ -59,29 +68,36 @@ function bridge_nics(&$bridge,$nic) {
// stop interface with existing (old) configuration
// don't execute when only interface description has changed
if ($run) {
$old = [];
if (file_exists($cfg)) {
$old = parse_ini_string(preg_replace(['/^#/m',"/\r/m"],[';',''],file_get_contents($cfg)));
if (isset($old['SYSNICS'])) {
// new syntax
$ifname = ifname($set);
} else {
// legacy syntax
if ($set=='eth0') $ifname = $old['BRIDGING']=='yes' ? ($old['BRNAME'] ?? 'br0') : ($old['BONDING']=='yes' ? ($old['BONDNAME'] ?? 'bond0') : $set);
if ($dns) {
$cmd = 'start_renew';
$ifname = port(0);
exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$ifname}_stop_renew")." >/dev/null");
} else {
$cmd = 'start';
$old = [];
if (file_exists($cfg)) {
$old = parse_ini_string(preg_replace(['/^#/m',"/\r/m"],[';',''],file_get_contents($cfg)));
if (isset($old['SYSNICS'])) {
// new syntax
$ifname = ifname($set);
} else {
// legacy syntax
if ($set=='eth0') $ifname = $old['BRIDGING']=='yes' ? ($old['BRNAME'] ?? 'br0') : ($old['BONDING']=='yes' ? ($old['BONDNAME'] ?? 'bond0') : $set);
}
}
}
exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$ifname}_stop")." >/dev/null");
if ($ini[$set]['BONDING']=='yes') {
// release additional NICs in bond
foreach (bond_nics($ini[$set],$set) as $nic) {
if (isset($old['SYSNICS'])) $nic = ifname($nic);
if ($nic && $nic!=$ifname) exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$nic}_stop")." >/dev/null");
}
} elseif ($ini[$set]['BRIDGING']=='yes') {
// release additional NICs in bridge
foreach (bridge_nics($ini[$set],$set) as $nic) {
if (isset($old['SYSNICS'])) $nic = ifname($nic);
if ($nic && $nic!=$ifname) exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$nic}_stop")." >/dev/null");
exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$ifname}_stop")." >/dev/null");
if ($ini[$set]['BONDING']=='yes') {
// release additional NICs in bond
foreach (bond_nics($ini[$set],$set) as $nic) {
if (isset($old['SYSNICS'])) $nic = ifname($nic);
if ($nic && $nic!=$ifname) exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$nic}_stop")." >/dev/null");
}
} elseif ($ini[$set]['BRIDGING']=='yes') {
// release additional NICs in bridge
foreach (bridge_nics($ini[$set],$set) as $nic) {
if (isset($old['SYSNICS'])) $nic = ifname($nic);
if ($nic && $nic!=$ifname) exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$nic}_stop")." >/dev/null");
}
}
}
}
@@ -127,14 +143,14 @@ foreach ($ini as $name => $port) {
$i++;
}
$new[] = "SYSNICS=\"$i\"";
file_put_contents($cfg,implode("\r\n",$new)."\r\n");
// start interface with updated (new) configuration
// don't execute when only interface description has changed
if ($run) {
exec("/etc/rc.d/rc.inet1 {$ifname}_start &>/dev/null");
exec("/usr/local/sbin/create_network_ini $ifname &>/dev/null &");
update_wireguard($ifname);
exec("/etc/rc.d/rc.inet1 ".escapeshellarg("{$ifname}_{$cmd}")." >/dev/null");
exec("/usr/local/sbin/create_network_ini ".escapeshellarg($ifname)." &>/dev/null &");
if (!$dns) update_wireguard($ifname);
}
exit(0);
?>
@@ -0,0 +1 @@
.uplift{margin-top:-30px!important}
@@ -0,0 +1 @@
.uplift{margin-top:-30px!important}
+2 -1
View File
@@ -3,10 +3,11 @@ span.blue{color:#00529B}
span.green{color:#4F8A10}
span.vshift{margin-top:0!important}
input.gap{margin-right:6px}
input.form{font-size:1rem;padding:5px 10px;margin-left:10px}
input.form{font-size:1rem;padding:5px 10px;margin:0 0 0 10px}
div.shade-white{background-color:#ededed;margin-top:10px;padding:8px 0 3px 0}
div.shade-black{background-color:#212121;margin-top:10px;padding:8px 0 3px 0}
div.shade-azure{background-color:#edeaef;margin-top:10px;padding:8px 0 3px 0}
div.shade-gray{background-color:#121510;margin-top:10px;padding:8px 0 3px 0}
select.slim{min-width:47px;margin-left:4px}
input.slim{width:32px;margin-left:8px}
.hide{display:none}
+65 -43
View File
@@ -7,6 +7,7 @@
# @(#)/etc/rc.d/rc.inet1 10.2 Sun Jul 24 12:45:56 PDT 2005 (pjv)
# LimeTech - modified for Unraid OS
# Bergware - modified for Unraid OS, January 2025
# Adapted by Bergware for use in Unraid OS - April 2016
# - improved interface configuration
@@ -72,7 +73,9 @@
# Adapted by Bergware for use in Unraid OS - February 2024
# - revised bond interface creation for linux kernel 6.6.14 and later point releases
# Bergware - modified for Unraid OS, February 2024
# Adapted by Bergware for use in Unraid OS - January 2025
# - added 'renew' command to restart interface without reconfiguring
# - fixed dns assigment may be missing in some cases
###########
# LOGGING #
@@ -337,21 +340,23 @@ ipv6_addr(){
# function to assign IP address
ipaddr_up(){
# disable IPv6 per interface when IPv4 only
[[ $IP == ipv4 ]] && DISABLE6=1 || DISABLE6=0
[[ -d $CONF6/$IFACE ]] && echo $DISABLE6 >$CONF6/$IFACE/disable_ipv6
[[ -d $CONF6/$VHOST ]] && echo $DISABLE6 >$CONF6/$VHOST/disable_ipv6
# repeat action on related interfaces
if [[ ${IFACE:0:4} == bond ]]; then
ipv6_up bond br eth $DISABLE6
elif [[ ${IFACE:0:2} == br ]]; then
ipv6_up br bond eth $DISABLE6
else
ipv6_up eth bond br $DISABLE6
if [[ -z $RENEW ]]; then
# disable IPv6 per interface when IPv4 only
[[ $IP == ipv4 ]] && DISABLE6=1 || DISABLE6=0
[[ -d $CONF6/$IFACE ]] && echo $DISABLE6 >$CONF6/$IFACE/disable_ipv6
[[ -d $CONF6/$VHOST ]] && echo $DISABLE6 >$CONF6/$VHOST/disable_ipv6
# repeat action on related interfaces
if [[ ${IFACE:0:4} == bond ]]; then
ipv6_up bond br eth $DISABLE6
elif [[ ${IFACE:0:2} == br ]]; then
ipv6_up br bond eth $DISABLE6
else
ipv6_up eth bond br $DISABLE6
fi
fi
if [[ $DHCP == yes ]]; then
# bring up interface using DHCP/SLAAC
ipv6_addr 1 1
[[ -z $RENEW ]] && ipv6_addr 1 1
DHCP_OPTIONS="-q -n -p -t ${DHCP_TIMEOUT[$i]:-10}"
[[ -n $DHCP_HOSTNAME ]] && DHCP_OPTIONS="$DHCP_OPTIONS -h $DHCP_HOSTNAME"
[[ $DHCP_KEEP_RESOLV == yes ]] && DHCP_OPTIONS="$DHCP_OPTIONS -C resolv.conf"
@@ -436,11 +441,12 @@ ipaddr_down(){
[[ $IP == ipv6 ]] && DHCP_OPTIONS="$DHCP_OPTIONS -6"
# release DHCP assigned addresses
run dhcpcd $DHCP_OPTIONS $IFACE
sleep 1
fi
# release assigned addresses and routes
[[ $IP != ipv6 ]] && ipaddr_flush 4
[[ $IP != ipv4 ]] && ipaddr_flush 6
if [[ -z $RENEW ]]; then
# release assigned addresses and routes
[[ $IP != ipv6 ]] && ipaddr_flush 4
[[ $IP != ipv4 ]] && ipaddr_flush 6
fi
}
# function to bring up network interface
@@ -452,18 +458,21 @@ if_up(){
done
# exit when interface is not found
[[ $i -eq $MAXNICS ]] && break
[[ -n ${BONDNICS[$i]} ]] && bond_up # create interface as bond
[[ -n ${VLANS[$i]} ]] && vlan_up # create interface VLANs
[[ -n ${BRNICS[$i]} ]] && br_up # create interface as bridge
[[ -z ${BRNICS[$i]} ]] && macvtap_up # create macvtap interfaces
# if the interface isn't in the kernel yet
# but there's an alias for it in modules.conf
# then it should be loaded first
if [[ ! -e $SYSTEM/$1 ]]; then
if modprobe -c | grep -v "^#" | grep -w "alias $1" | grep -qvw "alias $1 off"; then
run modprobe $1
else
[[ $DEBUG_ETH_UP == yes ]] && log "interface $1 not present nor aliased, can't create"
# skip interface creation when renew only
if [[ -z $RENEW ]]; then
[[ -n ${BONDNICS[$i]} ]] && bond_up # create interface as bond
[[ -n ${VLANS[$i]} ]] && vlan_up # create interface VLANs
[[ -n ${BRNICS[$i]} ]] && br_up # create interface as bridge
[[ -z ${BRNICS[$i]} ]] && macvtap_up # create macvtap interfaces
# if the interface isn't in the kernel yet
# but there's an alias for it in modules.conf
# then it should be loaded first
if [[ ! -e $SYSTEM/$1 ]]; then
if modprobe -c | grep -v "^#" | grep -w "alias $1" | grep -qvw "alias $1 off"; then
run modprobe $1
else
[[ $DEBUG_ETH_UP == yes ]] && log "interface $1 not present nor aliased, can't create"
fi
fi
fi
# loop thru main and VLAN interfaces
@@ -477,13 +486,15 @@ if_up(){
fi
# macvtap interface name
VHOST=vhost${IFACE//[^0-9.]}
# set main interface
if [[ $j -eq 0 ]]; then
# set hardware address before interface goes up
[[ -n ${HWADDR[$i]} ]] && run ip link set $1 addr ${HWADDR[$i]}
set_mtu $1
if [[ -z $RENEW ]]; then
# set main interface
if [[ $j -eq 0 ]]; then
# set hardware address before interface goes up
[[ -n ${HWADDR[$i]} ]] && run ip link set $1 addr ${HWADDR[$i]}
set_mtu $1
fi
run ip link set $IFACE up
fi
run ip link set $IFACE up
# set interface address
[[ $i -eq 0 && $j -eq 0 ]] && MAIN=1 || MAIN=
if [[ $IP == ipv4 ]]; then
@@ -545,23 +556,27 @@ if_down(){
else
[[ $j -eq 0 ]] && DHCP=${USE_DHCP[$i]} || DHCP=${USE_DHCP[$i,$j]}
[[ $j -eq 0 ]] && DHCP6=${USE_DHCP6[$i]} || DHCP6=${USE_DHCP6[$i,$j]}
[[ $j -eq 0 ]] && DHCP_KEEP_RESOLV=$DHCP_KEEPRESOLV || DHCP_KEEP_RESOLV=yes
[[ -n $MAIN ]] && DHCP_KEEP_RESOLV=$DHCP_KEEPRESOLV || DHCP_KEEP_RESOLV=yes
[[ -n $MAIN ]] && DHCP6_KEEP_RESOLV=$DHCP6_KEEPRESOLV || DHCP6_KEEP_RESOLV=yes
IP=ipv4
ipaddr_down
IP=ipv6
DHCP=$DHCP6
[[ $j -eq 0 ]] && DHCP_KEEP_RESOLV=$DHCP6_KEEPRESOLV || DHCP_KEEP_RESOLV=yes
DHCP_KEEP_RESOLV=$DHCP6_KEEP_RESOLV
ipaddr_down
fi
run ip link set $IFACE down
[[ -z $RENEW ]] && run ip link set $IFACE down
else
[[ $DEBUG_ETH_UP == yes ]] && log "interface $IFACE not present, can't take down"
fi
done
[[ -z ${BRNICS[$i]} ]] && macvtap_down # delete macvtap interfaces
[[ -n ${BRNICS[$i]} ]] && br_down # delete interface as bridge
[[ -n ${VLANS[$i]} ]] && vlan_down # delete interface VLANs
[[ -n ${BONDNICS[$i]} ]] && bond_down # delete interface as bond
# skip interface deletion when renew only
if [[ -z $RENEW ]]; then
[[ -z ${BRNICS[$i]} ]] && macvtap_down # delete macvtap interfaces
[[ -n ${BRNICS[$i]} ]] && br_down # delete interface as bridge
[[ -n ${VLANS[$i]} ]] && vlan_down # delete interface VLANs
[[ -n ${BONDNICS[$i]} ]] && bond_down # delete interface as bond
fi
}
#####################
@@ -717,6 +732,13 @@ restart)
if_up $INTERFACE
gateway_up
;;
*_renew)
RENEW=1
INTERFACE=$(echo $1 | cut -d_ -f1)
CMD=$(echo $1 | cut -d_ -f2)
[[ $CMD == start ]] && if_up $INTERFACE
[[ $CMD == stop ]] && if_down $INTERFACE
;;
*_add)
INTERFACE=$(echo $1 | cut -d_ -f1)
ROUTE=$(echo $1 | cut -d_ -f2)
@@ -731,11 +753,11 @@ restart)
[[ $METRIC == del ]] && METRIC=
route_down $INTERFACE $ROUTE $METRIC
;;
# default is to bring up the entire network
status)
status $2
;;
*)
# default is to bring up the entire network
start
esac
exit 0