}
function forward_proto_txt(s) {
- return fmt('%s-%s', _('IPv4'),
+ return fmt('%s-%s',
+ fwtool.fmt_family(uci.get('firewall', s, 'family')),
fwtool.fmt_proto(uci.get('firewall', s, 'proto'),
uci.get('firewall', s, 'icmp_type')) || 'TCP+UDP');
}
return L.view.extend({
callHostHints: rpc.declare({
object: 'luci',
- method: 'host_hints'
+ method: 'getHostHints',
+ expect: { '': {} }
}),
load: function() {
return uci.get('firewall', section_id, 'name') || _('Unnamed rule');
};
+ s.handleAdd = function(ev) {
+ var config_name = this.uciconfig || this.map.config,
+ section_id = uci.add(config_name, this.sectiontype),
+ opt1, opt2;
+
+ for (var i = 0; i < this.children.length; i++)
+ if (this.children[i].option == 'src')
+ opt1 = this.children[i];
+ else if (this.children[i].option == 'dest')
+ opt2 = this.children[i];
+
+ opt1.default = 'wan';
+ opt2.default = 'lan';
+
+ this.addedSection = section_id;
+ this.renderMoreOptionsModal(section_id);
+
+ delete opt1.default;
+ delete opt2.default;
+ };
+
o = s.taboption('general', form.Value, 'name', _('Name'));
o.placeholder = _('Unnamed rule');
o.modalonly = true;
o.cast = 'table';
o.placeholder = _('any');
o.value('', 'any');
- o.value('echo-reply');
+ o.value('address-mask-reply');
+ o.value('address-mask-request');
+ o.value('communication-prohibited');
o.value('destination-unreachable');
- o.value('network-unreachable');
- o.value('host-unreachable');
- o.value('protocol-unreachable');
- o.value('port-unreachable');
+ o.value('echo-reply');
+ o.value('echo-request');
o.value('fragmentation-needed');
- o.value('source-route-failed');
- o.value('network-unknown');
+ o.value('host-precedence-violation');
+ o.value('host-prohibited');
+ o.value('host-redirect');
o.value('host-unknown');
+ o.value('host-unreachable');
+ o.value('ip-header-bad');
+ o.value('neighbour-advertisement');
+ o.value('neighbour-solicitation');
o.value('network-prohibited');
- o.value('host-prohibited');
- o.value('TOS-network-unreachable');
- o.value('TOS-host-unreachable');
- o.value('communication-prohibited');
- o.value('host-precedence-violation');
+ o.value('network-redirect');
+ o.value('network-unknown');
+ o.value('network-unreachable');
+ o.value('parameter-problem');
+ o.value('port-unreachable');
o.value('precedence-cutoff');
- o.value('source-quench');
+ o.value('protocol-unreachable');
o.value('redirect');
- o.value('network-redirect');
- o.value('host-redirect');
- o.value('TOS-network-redirect');
- o.value('TOS-host-redirect');
- o.value('echo-request');
+ o.value('required-option-missing');
o.value('router-advertisement');
o.value('router-solicitation');
+ o.value('source-quench');
+ o.value('source-route-failed');
o.value('time-exceeded');
- o.value('ttl-zero-during-transit');
- o.value('ttl-zero-during-reassembly');
- o.value('parameter-problem');
- o.value('ip-header-bad');
- o.value('required-option-missing');
- o.value('timestamp-request');
o.value('timestamp-reply');
- o.value('address-mask-request');
- o.value('address-mask-reply');
+ o.value('timestamp-request');
+ o.value('TOS-host-redirect');
+ o.value('TOS-host-unreachable');
+ o.value('TOS-network-redirect');
+ o.value('TOS-network-unreachable');
+ o.value('ttl-zero-during-reassembly');
+ o.value('ttl-zero-during-transit');
o.depends('proto', 'icmp');
o = s.taboption('general', widgets.ZoneSelect, 'src', _('Source zone'));
o.nocreate = true;
o.allowany = true;
o.allowlocal = 'src';
- o.default = 'wan';
o = s.taboption('advanced', form.Value, 'src_mac', _('Source MAC address'));
o.modalonly = true;
o.depends('proto', 'tcp udp');
o.depends('proto', 'tcpudp');
- o = s.taboption('general', widgets.ZoneSelect, 'dest_local', _('Output zone'));
- o.modalonly = true;
- o.nocreate = true;
- o.allowany = true;
- o.alias = 'dest';
- o.default = 'wan';
- o.depends('src', '');
-
- o = s.taboption('general', widgets.ZoneSelect, 'dest_remote', _('Destination zone'));
+ o = s.taboption('general', widgets.ZoneSelect, 'dest', _('Destination zone'));
o.modalonly = true;
o.nocreate = true;
o.allowany = true;
o.allowlocal = true;
- o.alias = 'dest';
- o.default = 'lan';
- o.depends({'src': '', '!reverse': true});
o = s.taboption('general', form.Value, 'dest_ip', _('Destination address'));
o.modalonly = true;
o.modalonly = true;
o.default = o.disabled;
- return m.render().catch(function(e) {
- console.debug('render fail')
- });
-
+ return m.render();
}
});