Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openwrt/luci.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlen Huang <heyhgl@gmail.com>2022-01-19 17:35:33 +0300
committerGlen Huang <heyhgl@gmail.com>2022-01-19 17:35:33 +0300
commit9b02d5b7762bd5b00ed3f43a6dc324f55e4cff80 (patch)
treebaffb495b5d5eee4ad12387566e5e85140063bba /protocols
parent35df2adaf8a2c5b4fa61f58049f409ca087c0547 (diff)
luci-proto-xfrm: add xfrm proto support
Signed-off-by: Glen Huang <heyhgl@gmail.com>
Diffstat (limited to 'protocols')
-rw-r--r--protocols/luci-proto-xfrm/Makefile14
-rw-r--r--protocols/luci-proto-xfrm/htdocs/luci-static/resources/protocol/xfrm.js51
2 files changed, 65 insertions, 0 deletions
diff --git a/protocols/luci-proto-xfrm/Makefile b/protocols/luci-proto-xfrm/Makefile
new file mode 100644
index 0000000000..e59818e417
--- /dev/null
+++ b/protocols/luci-proto-xfrm/Makefile
@@ -0,0 +1,14 @@
+#
+# This is free software, licensed under the Apache License, Version 2.0 .
+#
+
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=Support for XFRM interfaces
+LUCI_DEPENDS:=+xfrm
+
+PKG_MAINTAINER:=Glen Huang <heyhgl@gmail.com>
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
diff --git a/protocols/luci-proto-xfrm/htdocs/luci-static/resources/protocol/xfrm.js b/protocols/luci-proto-xfrm/htdocs/luci-static/resources/protocol/xfrm.js
new file mode 100644
index 0000000000..b630f3818b
--- /dev/null
+++ b/protocols/luci-proto-xfrm/htdocs/luci-static/resources/protocol/xfrm.js
@@ -0,0 +1,51 @@
+'use strict';
+'require uci';
+'require form';
+'require network';
+'require tools.widgets as widgets';
+
+return network.registerProtocol('xfrm', {
+ getI18n: function() {
+ return _('IPsec XFRM');
+ },
+
+ getIfname: function() {
+ return this._ubus('l3_device') || this.sid;
+ },
+
+ getOpkgPackage: function() {
+ return 'xfrm';
+ },
+
+ isFloating: function() {
+ return true;
+ },
+
+ isVirtual: function() {
+ return true;
+ },
+
+ getDevice: function() {
+ return null;
+ },
+
+ containsDevice: function(ifname) {
+ return (network.getIfnameOf(ifname) == this.getIfname());
+ },
+
+ renderFormOptions: function(s) {
+ var o, ss;
+
+ o = s.taboption('general', form.Value, 'ifid', _('Interface ID'), _('Required. XFRM interface ID to be used for SA.'));
+ o.datatype = 'integer';
+
+ o = s.taboption('general', widgets.NetworkSelect, 'tunlink', _('Required. Underlying interface.'));
+ o.exclude = s.section;
+ o.nocreate = true;
+
+ o = s.taboption('general', form.Value, 'mtu', _('MTU'), _('Optional. Maximum Transmission Unit of the XFRM interface.'));
+ o.datatype = 'range(68,65535)';
+ o.placeholder = '1280';
+ o.optional = true;
+ }
+});