mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
Added password support to sysupgrade (-p option)
This commit is contained in:
parent
2b17668d29
commit
03a481bfaf
5 changed files with 37 additions and 33 deletions
|
|
@ -2,8 +2,8 @@ CC = gcc
|
|||
CFLAGS = -g -Wall
|
||||
LOCLIBS =
|
||||
LIBS = -luci -lubus -lubox -lpthread
|
||||
OBJS = questd.o dumper.o port.o arping.o usb.o ndisc.o dslstats.o
|
||||
SRCS = questd.c dumper.c port.c arping.c usb.c ndisc.c dslstats.c
|
||||
OBJS = questd.o dumper.o port.o arping.o usb.o ndisc.o dslstats.o
|
||||
SRCS = questd.c dumper.c port.c arping.c usb.c ndisc.c dslstats.c
|
||||
LIBSRCS =
|
||||
ISRCS = questd.h
|
||||
|
||||
|
|
|
|||
|
|
@ -17,13 +17,6 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <libubox/blobmsg.h>
|
||||
#include <libubox/uloop.h>
|
||||
#include <libubox/ustream.h>
|
||||
#include <libubox/utils.h>
|
||||
|
||||
#include <libubus.h>
|
||||
|
||||
#include "questd.h"
|
||||
|
||||
#define DSLDEBUG(...) {} //printf(__VA_ARGS__)
|
||||
|
|
@ -336,3 +329,20 @@ void dslstats_to_blob_buffer(struct dsl_stats *self, struct blob_buf *b){
|
|||
|
||||
blobmsg_close_table(b, t);
|
||||
}
|
||||
|
||||
|
||||
int dslstats_rpc(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg){
|
||||
static struct blob_buf bb;
|
||||
static struct dsl_stats dslstats;
|
||||
|
||||
dslstats_init(&dslstats);
|
||||
blob_buf_init(&bb, 0);
|
||||
|
||||
dslstats_load(&dslstats);
|
||||
dslstats_to_blob_buffer(&dslstats, &bb);
|
||||
|
||||
ubus_send_reply(ctx, req, bb.head);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,3 +73,6 @@ typedef struct dsl_stats {
|
|||
void dslstats_init(struct dsl_stats *self);
|
||||
void dslstats_load(struct dsl_stats *self);
|
||||
void dslstats_to_blob_buffer(struct dsl_stats *self, struct blob_buf *b);
|
||||
int dslstats_rpc(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg);
|
||||
|
|
|
|||
|
|
@ -1154,21 +1154,6 @@ quest_router_networks(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int quest_router_dslstats(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg){
|
||||
struct blob_attr *tb[__QUEST_MAX];
|
||||
|
||||
blobmsg_parse(quest_policy, __QUEST_MAX, tb, blob_data(msg), blob_len(msg));
|
||||
blob_buf_init(&bb, 0);
|
||||
|
||||
dslstats_load(&router.dslstats);
|
||||
dslstats_to_blob_buffer(&router.dslstats, &bb);
|
||||
|
||||
ubus_send_reply(ctx, req, bb.head);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
quest_router_clients(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
|
|
@ -1435,15 +1420,15 @@ quest_reload(struct ubus_context *ctx, struct ubus_object *obj,
|
|||
static struct ubus_method router_object_methods[] = {
|
||||
UBUS_METHOD_NOARG("info", quest_router_info),
|
||||
UBUS_METHOD("quest", quest_router_specific, quest_policy),
|
||||
{ .name = "networks", .handler = quest_router_networks },
|
||||
{ .name = "dslstats", .handler = quest_router_dslstats },
|
||||
UBUS_METHOD_NOARG("networks", quest_router_networks),
|
||||
UBUS_METHOD_NOARG("dslstats", dslstats_rpc),
|
||||
UBUS_METHOD("client", quest_router_network_clients, network_policy),
|
||||
{ .name = "clients", .handler = quest_router_clients },
|
||||
{ .name = "clients6", .handler = quest_router_clients6 },
|
||||
{ .name = "connected", .handler = quest_router_connected_clients },
|
||||
{ .name = "connected6", .handler = quest_router_connected_clients6 },
|
||||
UBUS_METHOD_NOARG("clients", quest_router_clients),
|
||||
UBUS_METHOD_NOARG("clients6", quest_router_clients6),
|
||||
UBUS_METHOD_NOARG("connected", quest_router_connected_clients),
|
||||
UBUS_METHOD_NOARG("connected6", quest_router_connected_clients6),
|
||||
UBUS_METHOD("sta", quest_router_wireless_stas, wl_policy),
|
||||
{ .name = "stas", .handler = quest_router_stas },
|
||||
UBUS_METHOD_NOARG("stas", quest_router_stas),
|
||||
UBUS_METHOD("ports", quest_router_ports, network_policy),
|
||||
UBUS_METHOD("leases", quest_network_leases, network_policy),
|
||||
UBUS_METHOD("host", quest_host_status, host_policy),
|
||||
|
|
@ -1526,7 +1511,6 @@ void *dump_router_info(void *arg)
|
|||
|
||||
jiffy_counts_t cur_jif, prev_jif;
|
||||
|
||||
dslstats_init(&router.dslstats);
|
||||
|
||||
init_db_hw_config();
|
||||
load_networks();
|
||||
|
|
|
|||
|
|
@ -12,6 +12,14 @@
|
|||
|
||||
#include <uci.h>
|
||||
|
||||
|
||||
#include <libubox/blobmsg.h>
|
||||
#include <libubox/uloop.h>
|
||||
#include <libubox/ustream.h>
|
||||
#include <libubox/utils.h>
|
||||
|
||||
#include <libubus.h>
|
||||
|
||||
#include "dslstats.h"
|
||||
|
||||
#define MAX_VIF 8
|
||||
|
|
@ -110,7 +118,6 @@ typedef struct {
|
|||
char uptime[64];
|
||||
unsigned int procs;
|
||||
unsigned int cpu;
|
||||
DSLStats dslstats;
|
||||
} Router;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue