luci-app-xinetd: introduce bind setting

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
This commit is contained in:
Paul Donald 2024-05-12 23:14:47 +02:00
parent ede57a8a18
commit aa942bdfce
1 changed files with 27 additions and 1 deletions

View File

@ -4,6 +4,7 @@
'require form';
'require view';
'require fs';
'require network';
'require tools.widgets as widgets';
function validateEmpty(section, value) {
@ -16,8 +17,15 @@ function validateEmpty(section, value) {
}
return view.extend({
render: function() {
load: function() {
return Promise.all([
network.getNetworks()
]);
},
render: function(promises) {
var m, s, o;
var networks = promises[0];
m = new form.Map('xinetd', _('Xinetd Settings'), _('Here you can configure Xinetd services'));
@ -97,6 +105,24 @@ return view.extend({
o.rmempty = false;
o.modalonly = true;
o = s.taboption('basic', form.Value, 'bind', _('Bind address'), _('To which address to bind'));
o.datatype = 'ipaddr';
[4, 6].forEach(family => {
networks.forEach(network => {
if (network.getName() !== 'loopback') {
const addrs = (family === 6) ? network.getIP6Addrs() : network.getIPAddrs();
addrs.forEach(addr => {
o.value(addr.split('/')[0], E([], [
addr.split('/')[0], ' (',
widgets.NetworkSelect.prototype.renderIfaceBadge(network),
')'
]));
});
}
});
});
o.rmempty = true;
o = s.taboption('basic', form.Value, 'id', _('Identification'), _('Required if a services can use tcp and udp.'));
o.datatype = 'string';
o.value('time-stream');