Skip to content

Commit

Permalink
luci-mod-network: add ipproto property to routes
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Donald <[email protected]>
  • Loading branch information
systemcrash committed Dec 12, 2024
1 parent af2175a commit a6e3ea4
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,64 @@ var cbiTagValue = form.Value.extend({
});

return baseclass.extend({

protocols: [ // name, proto number, description
{ n: 'hopopt', i: 0, d: 'HOPOPT' },
{ n: 'icmp', i: 1, d: 'ICMP' },
{ n: 'igmp', i: 2, d: 'IGMP' },
{ n: 'ggp', i: 3, d: 'GGP' },
{ n: 'ipencap', i: 4, d: 'IP-ENCAP' },
{ n: 'st', i: 5, d: 'ST' },
{ n: 'tcp', i: 6, d: 'TCP' },
{ n: 'egp', i: 8, d: 'EGP' },
{ n: 'igp', i: 9, d: 'IGP' },
{ n: 'pup', i: 12, d: 'PUP' },
{ n: 'udp', i: 17, d: 'UDP' },
{ n: 'hmp', i: 20, d: 'HMP' },
{ n: 'xns-idp', i: 22, d: 'XNS-IDP' },
{ n: 'rdp', i: 27, d: 'RDP' },
{ n: 'iso-tp4', i: 29, d: 'ISO-TP4' },
{ n: 'dccp', i: 33, d: 'DCCP' },
{ n: 'xtp', i: 36, d: 'XTP' },
{ n: 'ddp', i: 37, d: 'DDP' },
{ n: 'idpr-cmtp', i: 38, d: 'IDPR-CMTP' },
{ n: 'ipv6', i: 41, d: 'IPv6' },
{ n: 'ipv6-route', i: 43, d: 'IPv6-Route' },
{ n: 'ipv6-frag', i: 44, d: 'IPv6-Frag' },
{ n: 'idrp', i: 45, d: 'IDRP' },
{ n: 'rsvp', i: 46, d: 'RSVP' },
{ n: 'gre', i: 47, d: 'GRE' },
{ n: 'esp', i: 50, d: 'IPSEC-ESP' },
{ n: 'ah', i: 51, d: 'IPSEC-AH' },
{ n: 'skip', i: 57, d: 'SKIP' },
{ n: 'icmpv6', i: 58, d: 'IPv6-ICMP' },
{ n: 'ipv6-nonxt', i: 59, d: 'IPv6-NoNxt' },
{ n: 'ipv6-opts', i: 60, d: 'IPv6-Opts' },
{ n: 'rspf', i: 73, d: 'CPHB' },
{ n: 'vmtp', i: 81, d: 'VMTP' },
{ n: 'eigrp', i: 88, d: 'EIGRP' },
{ n: 'ospf', i: 89, d: 'OSPFIGP' },
{ n: 'ax.25', i: 93, d: 'AX.25' },
{ n: 'ipip', i: 94, d: 'IPIP' },
{ n: 'etherip', i: 97, d: 'ETHERIP' },
{ n: 'encap', i: 98, d: 'ENCAP' },
{ n: 'pim', i: 103, d: 'PIM' },
{ n: 'ipcomp', i: 108, d: 'IPCOMP' },
{ n: 'vrrp', i: 112, d: 'VRRP' },
{ n: 'l2tp', i: 115, d: 'L2TP' },
{ n: 'isis', i: 124, d: 'ISIS' },
{ n: 'sctp', i: 132, d: 'SCTP' },
{ n: 'fc', i: 133, d: 'FC' },
{ n: 'mobility-header', i: 135, d: 'Mobility-Header' },
{ n: 'udplite', i: 136, d: 'UDPLite' },
{ n: 'mpls-in-ip', i: 137, d: 'MPLS-in-IP' },
{ n: 'manet', i: 138, d: 'MANET' },
{ n: 'hip', i: 139, d: 'HIP' },
{ n: 'shim6', i: 140, d: 'Shim6' },
{ n: 'wesp', i: 141, d: 'WESP' },
{ n: 'rohc', i: 142, d: 'ROHC' },
],

replaceOption: function(s, tabName, optionClass, optionName, optionTitle, optionDescription) {
var o = s.getOption(optionName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
'require form';
'require network';
'require tools.widgets as widgets';
'require tools.network as tn';

return view.extend({
load: function() {
Expand Down Expand Up @@ -160,6 +161,12 @@ return view.extend({
return this.cfgvalue(section_id) || E('em', _('any'));
};

o = s.taboption('general', form.Value, 'ipproto', _('IP Protocol'), _('Match traffic IP protocol type'));
o.datatype = 'range(0,255)';
tn.protocols.forEach(function(p) {
o.value(p.i, p.d);
});

o = s.taboption('general', widgets.NetworkSelect, 'out', _('Outgoing interface'), _('Match traffic destined to this interface'));
o.loopback = true;
o.nocreate = true;
Expand Down

0 comments on commit a6e3ea4

Please sign in to comment.