mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
- Added new version of rpcd with many fixed memory leaks
- Fixed exposed hosts page - added more unit testing - updated libubox version
This commit is contained in:
parent
f6c8b9bfb7
commit
82c03c0136
11 changed files with 184 additions and 53 deletions
96
juci-rpcd/Makefile
Normal file
96
juci-rpcd/Makefile
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
#
|
||||
# Copyright (C) 2013-2014 OpenWrt.org
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=juci-rpcd
|
||||
PKG_VERSION:=2015-05-17
|
||||
PKG_RELEASE=$(PKG_SOURCE_VERSION)
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://github.com/mkschreder/openwrt-rpcd.git
|
||||
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
|
||||
PKG_SOURCE_VERSION:=1f65f0b80e7df999eb8139c0e3efbdbc729124c0
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MAINTAINER:=Martin Schröder <mkschreder.uk@gmail.com>
|
||||
|
||||
PKG_LICENSE:=ISC
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/include/rpcd $(1)/usr/include/
|
||||
endef
|
||||
|
||||
define Package/rpcd/default
|
||||
SECTION:=utils
|
||||
CATEGORY:=Base system
|
||||
TITLE:=OpenWrt ubus RPC backend server
|
||||
DEPENDS:=+libubus +libubox
|
||||
endef
|
||||
|
||||
define Package/rpcd
|
||||
$(Package/rpcd/default)
|
||||
DEPENDS+= +libuci +libblobmsg-json
|
||||
endef
|
||||
|
||||
define Package/rpcd/description
|
||||
This package provides the UBUS RPC backend server to expose various
|
||||
functionality to frontend programs via JSON-RPC.
|
||||
endef
|
||||
|
||||
define Package/rpcd/conffiles
|
||||
/etc/config/rpcd
|
||||
endef
|
||||
|
||||
define Package/rpcd/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
$(INSTALL_BIN) ./files/rpcd.init $(1)/etc/init.d/rpcd
|
||||
$(INSTALL_DIR) $(1)/sbin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rpcd $(1)/sbin/rpcd
|
||||
$(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d
|
||||
$(INSTALL_DATA) $(PKG_BUILD_DIR)/unauthenticated.json $(1)/usr/share/rpcd/acl.d/unauthenticated.json
|
||||
$(INSTALL_DIR) $(1)/etc/config
|
||||
$(INSTALL_CONF) ./files/rpcd.config $(1)/etc/config/rpcd
|
||||
endef
|
||||
|
||||
|
||||
# 1: plugin name
|
||||
# 2: extra dependencies
|
||||
# 3: plugin title/description
|
||||
define BuildPlugin
|
||||
|
||||
PKG_CONFIG_DEPENDS += CONFIG_PACKAGE_luci-rpc-mod-$(1)
|
||||
|
||||
define Package/rpcd-mod-$(1)
|
||||
$(Package/rpcd/default)
|
||||
TITLE+= ($(1) plugin)
|
||||
DEPENDS+=rpcd $(2)
|
||||
endef
|
||||
|
||||
define Package/rpcd-mod-$(1)/description
|
||||
$(3)
|
||||
endef
|
||||
|
||||
define Package/rpcd-mod-$(1)/install
|
||||
$(INSTALL_DIR) $$(1)/usr/lib/rpcd
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(1).so $$(1)/usr/lib/rpcd/
|
||||
endef
|
||||
|
||||
$$(eval $$(call BuildPackage,rpcd-mod-$(1)))
|
||||
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,rpcd))
|
||||
$(eval $(call BuildPlugin,file,,Provides ubus calls for file and directory operations.))
|
||||
#$(eval $(call BuildPlugin,iwinfo,+libiwinfo,Provides ubus calls for accessing iwinfo data.))
|
||||
7
juci-rpcd/files/rpcd.config
Normal file
7
juci-rpcd/files/rpcd.config
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
config login
|
||||
option username 'admin'
|
||||
option password '$p$admin'
|
||||
list read '*'
|
||||
list write '*'
|
||||
|
||||
21
juci-rpcd/files/rpcd.init
Executable file
21
juci-rpcd/files/rpcd.init
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=12
|
||||
|
||||
USE_PROCD=1
|
||||
NAME=rpcd
|
||||
PROG=/sbin/rpcd
|
||||
|
||||
start_service() {
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /sbin/rpcd
|
||||
}
|
||||
|
||||
reload() {
|
||||
service_reload /sbin/rpcd
|
||||
}
|
||||
|
|
@ -126,6 +126,14 @@
|
|||
"dest_ip": { dvalue: "", type: String },
|
||||
"dest_port": { dvalue: 0, type: String, validator: PortValidator }
|
||||
},
|
||||
"include": {
|
||||
"path": { dvalue: "", type: String },
|
||||
"reload": { dvalue: true, type: Boolean }
|
||||
},
|
||||
"dmzhost": {
|
||||
"enabled": { dvalue: false, type: Boolean },
|
||||
"host": { dvalue: "", type: String } // TODO: change to ip address
|
||||
},
|
||||
"rule": {
|
||||
"name": { dvalue: "", type: String },
|
||||
"src": { dvalue: "lan", type: String },
|
||||
|
|
|
|||
|
|
@ -7,17 +7,3 @@ angular.module("luci").config(function($stateProvider) {
|
|||
}
|
||||
});
|
||||
});
|
||||
/*
|
||||
$juci.module("internet")
|
||||
.state("internet", {
|
||||
url: "/internet",
|
||||
views: {
|
||||
"content": {
|
||||
templateUrl: "pages/internet.firewall.html"
|
||||
}
|
||||
},
|
||||
onEnter: function(){
|
||||
$juci.redirect("internet-firewall");
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@
|
|||
<luci-config-info>{{'internet.exposed_host.info'|translate}}</luci-config-info>
|
||||
<luci-config-lines>
|
||||
<luci-config-line title="{{'Exposed Host Function'|translate}}">
|
||||
<switch id="enabled" name="enabled" ng-model="firewall.dmz.enabled.value" class="green"></switch>
|
||||
<switch id="enabled" name="enabled" ng-model="firewall.dmzhost.enabled.value" class="green"></switch>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
</luci-config-section>
|
||||
<luci-config-section ng-show="firewall.dmz.enabled.value">
|
||||
<luci-config-section ng-show="firewall.dmzhost.enabled.value">
|
||||
<div class="alert alert-danger">
|
||||
<p translate><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> Warning: By using the exposed host function you bypass the firewall of your {{config.friendly_name}}. Please make sure that your computer is protected against attacks from Internet. The following ports will not be forwarded: {{ nonforwardedPorts || 'None'}}.</p>
|
||||
</div>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<strong>{{wan.ip}}</strong>
|
||||
</luci-config-line>
|
||||
<luci-config-line title="{{'Local IP Address'|translate}}">
|
||||
<input type="text" class="form-control" placeholder="{{ip.address.label}}" ng-model="firewall.dmz.host.value"/>
|
||||
<input type="text" class="form-control" placeholder="{{'ip.address.label'|translate}}" ng-model="firewall.dmzhost.host.value"/>
|
||||
</luci-config-line>
|
||||
</luci-config-lines>
|
||||
<luci-config-apply></luci-config-apply>
|
||||
|
|
|
|||
|
|
@ -1,17 +1,24 @@
|
|||
$juci.module("internet")
|
||||
.controller("InternetExHostPageCtrl", function($scope, $rpc, $config, $uci, $tr){
|
||||
$scope.exposedHostEnabled = 0;
|
||||
$scope.wan = {};
|
||||
$scope.lan = {};
|
||||
$scope.config = $config;
|
||||
|
||||
async.parallel([
|
||||
function(next){
|
||||
$uci.sync("firewall").done(function(){
|
||||
$scope.firewall = $uci.firewall;
|
||||
$scope.available = "dmz" in $uci.firewall;
|
||||
|
||||
}).always(function(){ next(); });
|
||||
},
|
||||
function(next){
|
||||
if($uci.firewall.dmzhost == undefined){
|
||||
$uci.firewall.create({".type": "dmzhost", ".name": "dmzhost"}).done(function(){
|
||||
next();
|
||||
}).fail(function(){
|
||||
throw new Error("Could not create required dmzhost section in config firewall!");
|
||||
});
|
||||
} else {
|
||||
next();
|
||||
}
|
||||
},
|
||||
function(next){
|
||||
$rpc.network.interface.status({
|
||||
"interface": "wan"
|
||||
|
|
@ -20,31 +27,9 @@ $juci.module("internet")
|
|||
$scope.wan.ip = wan["ipv4-address"][0].address;
|
||||
}).always(function(){ next(); });
|
||||
}
|
||||
]);
|
||||
|
||||
$scope.onEnable = function(en){
|
||||
$scope.dmz.enabled = $scope.exposedHostEnabled;
|
||||
$uci.set("firewall.dmz", $scope.dmz).done(function(){
|
||||
|
||||
});
|
||||
};
|
||||
$scope.onSave = function(){
|
||||
$uci.set("firewall.dmz", $scope.dmz).done(function(){
|
||||
$uci.commit("firewall.dmz").done(function(){
|
||||
$scope.info_message = $tr("STR_SETTINGSSAVED");
|
||||
$scope.$apply();
|
||||
});
|
||||
}).fail(function(){
|
||||
$scope.error_message = $tr("STR_SETTINGSSAVEFAILED");
|
||||
});
|
||||
setTimeout(function(){
|
||||
$scope.error_message = null;
|
||||
$scope.info_message = null;
|
||||
$scope.$apply();
|
||||
}, 4000);
|
||||
}
|
||||
|
||||
$scope.onReset = function(){
|
||||
load();
|
||||
}
|
||||
], function(){
|
||||
$scope.firewall = $uci.firewall;
|
||||
$scope.available = "dmz" in $uci.firewall;
|
||||
$scope.$apply();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ require("../../../../tests/lib-juci");
|
|||
|
||||
var completed = {
|
||||
"dns": 0,
|
||||
"exposed_host": 0,
|
||||
"exposed_host": 1,
|
||||
"firewall": 1,
|
||||
"port_mapping": 1
|
||||
}
|
||||
|
|
@ -12,3 +12,19 @@ describe("Internet plugin", function(){
|
|||
expect(Object.keys(completed).filter(function(x){ return completed[x] == 0; })).to.be.empty();
|
||||
});
|
||||
});
|
||||
|
||||
describe("UCI.firewall", function(){
|
||||
before(function(done){
|
||||
$uci.sync("firewall").done(function(){
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("should have dmz section of type include", function(){
|
||||
expect($uci.firewall.dmz).to.be.ok();
|
||||
expect($uci.firewall.dmz[".type"]).to.be("include");
|
||||
});
|
||||
it("should have dmzhost section of type dmzhost", function(){
|
||||
expect($uci.firewall).to.have.property("dmzhost");
|
||||
expect($uci.firewall.dmzhost[".type"]).to.be("dmzhost");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
$juci.module("phone")
|
||||
.controller("PhoneRingingScheduleCtrl", function($scope, $uci){
|
||||
$uci.sync(["phone"]).done(function(){
|
||||
$uci.sync(["voice_client"]).done(function(){
|
||||
// TODO add config for phone
|
||||
if($uci.phone) $scope.settings = $uci.phone.settings;
|
||||
//if($uci.voice_client && $uci.voice_client.settings) $scope.settings = $uci.voice_client.settings;
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,7 +2,18 @@
|
|||
global.JUCI = require("../../../../tests/lib-juci");
|
||||
require("../wifi");
|
||||
|
||||
describe("WIFI", function(){
|
||||
var completed = {
|
||||
"general": 1,
|
||||
"mac_filter": 1,
|
||||
"schedule": 1,
|
||||
"settings": 1,
|
||||
"wps": 0
|
||||
}
|
||||
|
||||
describe("Wireless plugin", function(){
|
||||
it("should be completed", function(){
|
||||
expect(Object.keys(completed).filter(function(x){ return completed[x] == 0; })).to.be.empty();
|
||||
});
|
||||
it("should have wireless config", function(done){
|
||||
$uci.sync("wireless").done(function(){
|
||||
expect($uci.wireless).to.be.an(Object);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ require("./lib-juci");
|
|||
describe("UCI", function(){
|
||||
beforeEach(function(done){
|
||||
$uci.sync().done(function(){
|
||||
expect($uci).to.have.property("juci");
|
||||
var to_delete = $uci.juci["@test"].map(function(x){
|
||||
return x;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue