mirror of
https://github.com/berlin-open-wireless-lab/DAWN.git
synced 2025-03-09 15:40:12 +00:00
change ubus json format to array of mac messages
This commit is contained in:
parent
9f32fb8257
commit
a9d5b1eeee
1 changed files with 7 additions and 22 deletions
|
@ -1088,19 +1088,22 @@ static struct ubus_object dawn_object = {
|
|||
static int parse_add_mac_to_file(struct blob_attr *msg) {
|
||||
struct blob_attr *tb[__ADD_DEL_MAC_MAX];
|
||||
struct blob_attr *attr;
|
||||
uint8_t addr[ETH_ALEN];
|
||||
|
||||
printf("PASRING MAC!\n");
|
||||
|
||||
blobmsg_parse(add_del_policy, __ADD_DEL_MAC_MAX, tb, blob_data(msg), blob_len(msg));
|
||||
|
||||
if (!tb[MAC_ADDR])
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
int len = blobmsg_data_len(tb[BLACKLIST_CLIENT_ARRAY]);
|
||||
int len = blobmsg_data_len(tb[MAC_ADDR]);
|
||||
printf("LEN of array maclist: %d\n", len);
|
||||
|
||||
__blob_for_each_attr(attr, blobmsg_data(tb[MAC_ADDR]), len)
|
||||
{
|
||||
uint8_t hdwr_addr[ETH_ALEN];
|
||||
hwaddr_aton(blobmsg_data(blobmsg_data(attr), hdwr_addr);
|
||||
printf("ITERATION THOUGH MACLIST!\n");
|
||||
uint8_t addr[ETH_ALEN];
|
||||
hwaddr_aton(blobmsg_data(attr), addr);
|
||||
|
||||
if (insert_to_maclist(addr) == 0) {
|
||||
write_mac_to_file("/etc/dawn/mac_list", addr);
|
||||
|
@ -1110,24 +1113,6 @@ static int parse_add_mac_to_file(struct blob_attr *msg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int parse_add_mac_to_file(struct blob_attr *msg) {
|
||||
struct blob_attr *tb[__ADD_DEL_MAC_MAX];
|
||||
uint8_t addr[ETH_ALEN];
|
||||
|
||||
blobmsg_parse(add_del_policy, __ADD_DEL_MAC_MAX, tb, blob_data(msg), blob_len(msg));
|
||||
|
||||
if (!tb[MAC_ADDR])
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
if (hwaddr_aton(blobmsg_data(tb[MAC_ADDR]), addr))
|
||||
return UBUS_STATUS_INVALID_ARGUMENT;
|
||||
|
||||
if (insert_to_maclist(addr) == 0) {
|
||||
write_mac_to_file("/etc/dawn/mac_list", addr);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int add_mac(struct ubus_context *ctx, struct ubus_object *obj,
|
||||
struct ubus_request_data *req, const char *method,
|
||||
struct blob_attr *msg) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue