3 #include "utils/includes.h"
4 #include "utils/common.h"
5 #include "utils/ucode.h"
8 #include "hw_features.h"
9 #include "ap_drv_ops.h"
12 #include <libubox/uloop.h>
14 static uc_resource_type_t
*global_type
, *bss_type
, *iface_type
;
15 static struct hapd_interfaces
*interfaces
;
16 static uc_value_t
*global
, *bss_registry
, *iface_registry
;
20 hostapd_ucode_bss_get_uval(struct hostapd_data
*hapd
)
25 return wpa_ucode_registry_get(bss_registry
, hapd
->ucode
.idx
);
27 val
= uc_resource_new(bss_type
, hapd
);
28 hapd
->ucode
.idx
= wpa_ucode_registry_add(bss_registry
, val
);
34 hostapd_ucode_iface_get_uval(struct hostapd_iface
*hapd
)
39 return wpa_ucode_registry_get(iface_registry
, hapd
->ucode
.idx
);
41 val
= uc_resource_new(iface_type
, hapd
);
42 hapd
->ucode
.idx
= wpa_ucode_registry_add(iface_registry
, val
);
48 hostapd_ucode_update_bss_list(struct hostapd_iface
*iface
, uc_value_t
*if_bss
, uc_value_t
*bss
)
53 list
= ucv_array_new(vm
);
54 for (i
= 0; i
< iface
->num_bss
; i
++) {
55 struct hostapd_data
*hapd
= iface
->bss
[i
];
56 uc_value_t
*val
= hostapd_ucode_bss_get_uval(hapd
);
58 ucv_array_set(list
, i
, ucv_get(ucv_string_new(hapd
->conf
->iface
)));
59 ucv_object_add(bss
, hapd
->conf
->iface
, ucv_get(val
));
61 ucv_object_add(if_bss
, iface
->phy
, ucv_get(list
));
65 hostapd_ucode_update_interfaces(void)
67 uc_value_t
*ifs
= ucv_object_new(vm
);
68 uc_value_t
*if_bss
= ucv_array_new(vm
);
69 uc_value_t
*bss
= ucv_object_new(vm
);
72 for (i
= 0; i
< interfaces
->count
; i
++) {
73 struct hostapd_iface
*iface
= interfaces
->iface
[i
];
75 ucv_object_add(ifs
, iface
->phy
, ucv_get(hostapd_ucode_iface_get_uval(iface
)));
76 hostapd_ucode_update_bss_list(iface
, if_bss
, bss
);
79 ucv_object_add(ucv_prototype_get(global
), "interfaces", ucv_get(ifs
));
80 ucv_object_add(ucv_prototype_get(global
), "interface_bss", ucv_get(if_bss
));
81 ucv_object_add(ucv_prototype_get(global
), "bss", ucv_get(bss
));
86 uc_hostapd_add_iface(uc_vm_t
*vm
, size_t nargs
)
88 uc_value_t
*iface
= uc_fn_arg(0);
91 if (ucv_type(iface
) != UC_STRING
)
92 return ucv_int64_new(-1);
94 ret
= hostapd_add_iface(interfaces
, ucv_string_get(iface
));
95 hostapd_ucode_update_interfaces();
97 return ucv_int64_new(ret
);
101 uc_hostapd_remove_iface(uc_vm_t
*vm
, size_t nargs
)
103 uc_value_t
*iface
= uc_fn_arg(0);
105 if (ucv_type(iface
) != UC_STRING
)
108 hostapd_remove_iface(interfaces
, ucv_string_get(iface
));
109 hostapd_ucode_update_interfaces();
114 static struct hostapd_vlan
*
115 bss_conf_find_vlan(struct hostapd_bss_config
*bss
, int id
)
117 struct hostapd_vlan
*vlan
;
119 for (vlan
= bss
->vlan
; vlan
; vlan
= vlan
->next
)
120 if (vlan
->vlan_id
== id
)
127 bss_conf_rename_vlan(struct hostapd_data
*hapd
, struct hostapd_vlan
*vlan
,
130 if (!strcmp(ifname
, vlan
->ifname
))
133 hostapd_drv_if_rename(hapd
, WPA_IF_AP_VLAN
, vlan
->ifname
, ifname
);
134 os_strlcpy(vlan
->ifname
, ifname
, sizeof(vlan
->ifname
));
140 bss_reload_vlans(struct hostapd_data
*hapd
, struct hostapd_bss_config
*bss
)
142 struct hostapd_bss_config
*old_bss
= hapd
->conf
;
143 struct hostapd_vlan
*vlan
, *vlan_new
, *wildcard
;
144 char ifname
[IFNAMSIZ
+ 1], vlan_ifname
[IFNAMSIZ
+ 1], *pos
;
147 vlan
= bss_conf_find_vlan(old_bss
, VLAN_ID_WILDCARD
);
148 wildcard
= bss_conf_find_vlan(bss
, VLAN_ID_WILDCARD
);
149 if (!!vlan
!= !!wildcard
)
152 if (vlan
&& wildcard
&& strcmp(vlan
->ifname
, wildcard
->ifname
) != 0)
153 strcpy(vlan
->ifname
, wildcard
->ifname
);
157 for (vlan
= bss
->vlan
; vlan
; vlan
= vlan
->next
) {
158 if (vlan
->vlan_id
== VLAN_ID_WILDCARD
||
159 vlan
->dynamic_vlan
> 0)
162 if (!bss_conf_find_vlan(old_bss
, vlan
->vlan_id
))
166 for (vlan
= old_bss
->vlan
; vlan
; vlan
= vlan
->next
) {
167 if (vlan
->vlan_id
== VLAN_ID_WILDCARD
)
170 if (vlan
->dynamic_vlan
== 0) {
171 vlan_new
= bss_conf_find_vlan(bss
, vlan
->vlan_id
);
175 if (bss_conf_rename_vlan(hapd
, vlan
, vlan_new
->ifname
))
184 os_strlcpy(ifname
, wildcard
->ifname
, sizeof(ifname
));
185 pos
= os_strchr(ifname
, '#');
190 ret
= os_snprintf(vlan_ifname
, sizeof(vlan_ifname
), "%s%d%s",
191 ifname
, vlan
->vlan_id
, pos
);
192 if (os_snprintf_error(sizeof(vlan_ifname
), ret
))
195 if (bss_conf_rename_vlan(hapd
, vlan
, vlan_ifname
))
203 uc_hostapd_bss_set_config(uc_vm_t
*vm
, size_t nargs
)
205 struct hostapd_data
*hapd
= uc_fn_thisval("hostapd.bss");
206 struct hostapd_bss_config
*old_bss
;
207 struct hostapd_iface
*iface
;
208 struct hostapd_config
*conf
;
209 uc_value_t
*file
= uc_fn_arg(0);
210 uc_value_t
*index
= uc_fn_arg(1);
211 uc_value_t
*files_only
= uc_fn_arg(2);
212 unsigned int i
, idx
= 0;
215 if (!hapd
|| ucv_type(file
) != UC_STRING
)
218 if (ucv_type(index
) == UC_INTEGER
)
219 idx
= ucv_int64_get(index
);
222 conf
= interfaces
->config_read_cb(ucv_string_get(file
));
226 if (idx
> conf
->num_bss
|| !conf
->bss
[idx
])
229 if (ucv_boolean_get(files_only
)) {
230 struct hostapd_bss_config
*bss
= conf
->bss
[idx
];
231 struct hostapd_bss_config
*old_bss
= hapd
->conf
;
233 #define swap_field(name) \
235 void *ptr = old_bss->name; \
236 old_bss->name = bss->name; \
240 swap_field(ssid
.wpa_psk_file
);
241 ret
= bss_reload_vlans(hapd
, bss
);
245 hostapd_bss_deinit_no_free(hapd
);
246 hostapd_drv_stop_ap(hapd
);
247 hostapd_free_hapd_data(hapd
);
249 old_bss
= hapd
->conf
;
250 for (i
= 0; i
< iface
->conf
->num_bss
; i
++)
251 if (iface
->conf
->bss
[i
] == hapd
->conf
)
252 iface
->conf
->bss
[i
] = conf
->bss
[idx
];
253 hapd
->conf
= conf
->bss
[idx
];
254 conf
->bss
[idx
] = old_bss
;
256 hostapd_setup_bss(hapd
, hapd
== iface
->bss
[0], true);
257 hostapd_ucode_update_interfaces();
262 hostapd_config_free(conf
);
264 return ucv_int64_new(ret
);
268 hostapd_remove_iface_bss_conf(struct hostapd_config
*iconf
,
269 struct hostapd_bss_config
*conf
)
273 for (i
= 0; i
< iconf
->num_bss
; i
++)
274 if (iconf
->bss
[i
] == conf
)
277 if (i
== iconf
->num_bss
)
280 for (i
++; i
< iconf
->num_bss
; i
++)
281 iconf
->bss
[i
- 1] = iconf
->bss
[i
];
287 uc_hostapd_bss_delete(uc_vm_t
*vm
, size_t nargs
)
289 struct hostapd_data
*hapd
= uc_fn_thisval("hostapd.bss");
290 struct hostapd_iface
*iface
;
297 if (iface
->num_bss
== 1) {
298 wpa_printf(MSG_ERROR
, "trying to delete last bss of an iface: %s\n", hapd
->conf
->iface
);
302 for (idx
= 0; idx
< iface
->num_bss
; idx
++)
303 if (iface
->bss
[idx
] == hapd
)
306 if (idx
== iface
->num_bss
)
309 for (i
= idx
+ 1; i
< iface
->num_bss
; i
++)
310 iface
->bss
[i
- 1] = iface
->bss
[i
];
314 iface
->bss
[0]->interface_added
= 0;
315 hostapd_drv_set_first_bss(iface
->bss
[0]);
316 hapd
->interface_added
= 1;
318 hostapd_drv_stop_ap(hapd
);
319 hostapd_bss_deinit(hapd
);
320 hostapd_remove_iface_bss_conf(iface
->conf
, hapd
->conf
);
321 hostapd_config_free_bss(hapd
->conf
);
324 hostapd_ucode_update_interfaces();
331 uc_hostapd_iface_add_bss(uc_vm_t
*vm
, size_t nargs
)
333 struct hostapd_iface
*iface
= uc_fn_thisval("hostapd.iface");
334 struct hostapd_bss_config
*bss
;
335 struct hostapd_config
*conf
;
336 struct hostapd_data
*hapd
;
337 uc_value_t
*file
= uc_fn_arg(0);
338 uc_value_t
*index
= uc_fn_arg(1);
339 unsigned int idx
= 0;
340 uc_value_t
*ret
= NULL
;
342 if (!iface
|| ucv_type(file
) != UC_STRING
)
345 if (ucv_type(index
) == UC_INTEGER
)
346 idx
= ucv_int64_get(index
);
348 conf
= interfaces
->config_read_cb(ucv_string_get(file
));
349 if (!conf
|| idx
> conf
->num_bss
|| !conf
->bss
[idx
])
352 bss
= conf
->bss
[idx
];
353 hapd
= hostapd_alloc_bss_data(iface
, iface
->conf
, bss
);
357 hapd
->driver
= iface
->bss
[0]->driver
;
358 hapd
->drv_priv
= iface
->bss
[0]->drv_priv
;
359 if (interfaces
->ctrl_iface_init
&&
360 interfaces
->ctrl_iface_init(hapd
) < 0)
363 if (iface
->state
== HAPD_IFACE_ENABLED
&&
364 hostapd_setup_bss(hapd
, -1, true))
367 iface
->bss
= os_realloc_array(iface
->bss
, iface
->num_bss
+ 1,
368 sizeof(*iface
->bss
));
369 iface
->bss
[iface
->num_bss
++] = hapd
;
371 iface
->conf
->bss
= os_realloc_array(iface
->conf
->bss
,
372 iface
->conf
->num_bss
+ 1,
373 sizeof(*iface
->conf
->bss
));
374 iface
->conf
->bss
[iface
->conf
->num_bss
] = bss
;
375 conf
->bss
[idx
] = NULL
;
376 ret
= hostapd_ucode_bss_get_uval(hapd
);
377 hostapd_ucode_update_interfaces();
381 if (interfaces
->ctrl_iface_deinit
)
382 interfaces
->ctrl_iface_deinit(hapd
);
384 hostapd_free_hapd_data(hapd
);
387 hostapd_config_free(conf
);
392 uc_hostapd_iface_set_bss_order(uc_vm_t
*vm
, size_t nargs
)
394 struct hostapd_iface
*iface
= uc_fn_thisval("hostapd.iface");
395 uc_value_t
*bss_list
= uc_fn_arg(0);
396 struct hostapd_data
**new_bss
;
397 struct hostapd_bss_config
**new_conf
;
402 if (ucv_type(bss_list
) != UC_ARRAY
||
403 ucv_array_length(bss_list
) != iface
->num_bss
)
406 new_bss
= calloc(iface
->num_bss
, sizeof(*new_bss
));
407 new_conf
= calloc(iface
->num_bss
, sizeof(*new_conf
));
408 for (size_t i
= 0; i
< iface
->num_bss
; i
++) {
409 struct hostapd_data
*bss
;
411 bss
= ucv_resource_data(ucv_array_get(bss_list
, i
), "hostapd.bss");
412 if (bss
->iface
!= iface
)
415 for (size_t k
= 0; k
< i
; k
++)
416 if (new_bss
[k
] == bss
)
420 new_conf
[i
] = bss
->conf
;
423 new_bss
[0]->interface_added
= 0;
424 for (size_t i
= 1; i
< iface
->num_bss
; i
++)
425 new_bss
[i
]->interface_added
= 1;
428 iface
->bss
= new_bss
;
430 free(iface
->conf
->bss
);
431 iface
->conf
->bss
= new_conf
;
432 iface
->conf
->num_bss
= iface
->num_bss
;
433 hostapd_drv_set_first_bss(iface
->bss
[0]);
435 return ucv_boolean_new(true);
444 uc_hostapd_bss_ctrl(uc_vm_t
*vm
, size_t nargs
)
446 struct hostapd_data
*hapd
= uc_fn_thisval("hostapd.bss");
447 uc_value_t
*arg
= uc_fn_arg(0);
448 struct sockaddr_storage from
= {};
449 static char reply
[4096];
452 if (!hapd
|| !interfaces
->ctrl_iface_recv
||
453 ucv_type(arg
) != UC_STRING
)
456 reply_len
= interfaces
->ctrl_iface_recv(hapd
, ucv_string_get(arg
),
457 reply
, sizeof(reply
),
458 &from
, sizeof(from
));
462 if (reply_len
&& reply
[reply_len
- 1] == '\n')
465 return ucv_string_new_length(reply
, reply_len
);
469 uc_hostapd_disable_iface(struct hostapd_iface
*iface
)
471 switch (iface
->state
) {
472 case HAPD_IFACE_DISABLED
:
477 iface
->scan_cb
= NULL
;
481 hostapd_disable_iface(iface
);
487 uc_hostapd_iface_stop(uc_vm_t
*vm
, size_t nargs
)
489 struct hostapd_iface
*iface
= uc_fn_thisval("hostapd.iface");
495 if (iface
->state
!= HAPD_IFACE_ENABLED
)
496 uc_hostapd_disable_iface(iface
);
498 for (i
= 0; i
< iface
->num_bss
; i
++) {
499 struct hostapd_data
*hapd
= iface
->bss
[i
];
501 hostapd_drv_stop_ap(hapd
);
502 hapd
->beacon_set_done
= 0;
509 uc_hostapd_iface_start(uc_vm_t
*vm
, size_t nargs
)
511 struct hostapd_iface
*iface
= uc_fn_thisval("hostapd.iface");
512 uc_value_t
*info
= uc_fn_arg(0);
513 struct hostapd_config
*conf
;
514 bool changed
= false;
526 if (ucv_type(info
) != UC_OBJECT
)
529 #define UPDATE_VAL(field, name) \
530 if ((intval = ucv_int64_get(ucv_object_get(info, name, NULL))) && \
531 !errno && intval != conf->field) do { \
532 conf->field = intval; \
537 UPDATE_VAL(op_class
, "op_class");
538 UPDATE_VAL(hw_mode
, "hw_mode");
539 UPDATE_VAL(channel
, "channel");
540 UPDATE_VAL(secondary_channel
, "sec_channel");
542 (iface
->bss
[0]->beacon_set_done
||
543 iface
->state
== HAPD_IFACE_DFS
))
544 return ucv_boolean_new(true);
546 intval
= ucv_int64_get(ucv_object_get(info
, "center_seg0_idx", NULL
));
548 hostapd_set_oper_centr_freq_seg0_idx(conf
, intval
);
550 intval
= ucv_int64_get(ucv_object_get(info
, "center_seg1_idx", NULL
));
552 hostapd_set_oper_centr_freq_seg1_idx(conf
, intval
);
554 intval
= ucv_int64_get(ucv_object_get(info
, "oper_chwidth", NULL
));
556 hostapd_set_oper_chwidth(conf
, intval
);
558 intval
= ucv_int64_get(ucv_object_get(info
, "frequency", NULL
));
560 iface
->freq
= intval
;
566 switch (iface
->state
) {
567 case HAPD_IFACE_ENABLED
:
568 if (!hostapd_is_dfs_required(iface
) ||
569 hostapd_is_dfs_chan_available(iface
))
571 wpa_printf(MSG_INFO
, "DFS CAC required on new channel, restart interface");
574 uc_hostapd_disable_iface(iface
);
578 if (conf
->channel
&& !iface
->freq
)
579 iface
->freq
= hostapd_hw_get_freq(iface
->bss
[0], conf
->channel
);
581 if (iface
->state
!= HAPD_IFACE_ENABLED
) {
582 hostapd_enable_iface(iface
);
583 return ucv_boolean_new(true);
586 for (i
= 0; i
< iface
->num_bss
; i
++) {
587 struct hostapd_data
*hapd
= iface
->bss
[i
];
590 hapd
->conf
->start_disabled
= 0;
591 hostapd_set_freq(hapd
, conf
->hw_mode
, iface
->freq
,
599 conf
->secondary_channel
,
600 hostapd_get_oper_chwidth(conf
),
601 hostapd_get_oper_centr_freq_seg0_idx(conf
),
602 hostapd_get_oper_centr_freq_seg1_idx(conf
));
604 ieee802_11_set_beacon(hapd
);
607 return ucv_boolean_new(true);
611 uc_hostapd_iface_switch_channel(uc_vm_t
*vm
, size_t nargs
)
613 struct hostapd_iface
*iface
= uc_fn_thisval("hostapd.iface");
614 uc_value_t
*info
= uc_fn_arg(0);
615 struct hostapd_config
*conf
;
616 struct csa_settings csa
= {};
620 if (!iface
|| ucv_type(info
) != UC_OBJECT
)
624 if ((intval
= ucv_int64_get(ucv_object_get(info
, "csa_count", NULL
))) && !errno
)
625 csa
.cs_count
= intval
;
626 if ((intval
= ucv_int64_get(ucv_object_get(info
, "sec_channel", NULL
))) && !errno
)
627 csa
.freq_params
.sec_channel_offset
= intval
;
629 csa
.freq_params
.ht_enabled
= conf
->ieee80211n
;
630 csa
.freq_params
.vht_enabled
= conf
->ieee80211ac
;
631 csa
.freq_params
.he_enabled
= conf
->ieee80211ax
;
632 #ifdef CONFIG_IEEE80211BE
633 csa
.freq_params
.eht_enabled
= conf
->ieee80211be
;
635 intval
= ucv_int64_get(ucv_object_get(info
, "oper_chwidth", NULL
));
637 intval
= hostapd_get_oper_chwidth(conf
);
639 csa
.freq_params
.bandwidth
= 40 << intval
;
641 csa
.freq_params
.bandwidth
= csa
.freq_params
.sec_channel_offset
? 40 : 20;
643 if ((intval
= ucv_int64_get(ucv_object_get(info
, "frequency", NULL
))) && !errno
)
644 csa
.freq_params
.freq
= intval
;
645 if ((intval
= ucv_int64_get(ucv_object_get(info
, "center_freq1", NULL
))) && !errno
)
646 csa
.freq_params
.center_freq1
= intval
;
647 if ((intval
= ucv_int64_get(ucv_object_get(info
, "center_freq2", NULL
))) && !errno
)
648 csa
.freq_params
.center_freq2
= intval
;
650 for (i
= 0; i
< iface
->num_bss
; i
++)
651 ret
= hostapd_switch_channel(iface
->bss
[i
], &csa
);
653 return ucv_boolean_new(!ret
);
657 uc_hostapd_bss_rename(uc_vm_t
*vm
, size_t nargs
)
659 struct hostapd_data
*hapd
= uc_fn_thisval("hostapd.bss");
660 uc_value_t
*ifname_arg
= uc_fn_arg(0);
661 char prev_ifname
[IFNAMSIZ
+ 1];
662 struct sta_info
*sta
;
666 if (!hapd
|| ucv_type(ifname_arg
) != UC_STRING
)
669 os_strlcpy(prev_ifname
, hapd
->conf
->iface
, sizeof(prev_ifname
));
670 ifname
= ucv_string_get(ifname_arg
);
672 hostapd_ubus_free_bss(hapd
);
673 if (interfaces
->ctrl_iface_deinit
)
674 interfaces
->ctrl_iface_deinit(hapd
);
676 ret
= hostapd_drv_if_rename(hapd
, WPA_IF_AP_BSS
, NULL
, ifname
);
680 for (sta
= hapd
->sta_list
; sta
; sta
= sta
->next
) {
681 char cur_name
[IFNAMSIZ
+ 1], new_name
[IFNAMSIZ
+ 1];
683 if (!(sta
->flags
& WLAN_STA_WDS
) || sta
->pending_wds_enable
)
686 snprintf(cur_name
, sizeof(cur_name
), "%s.sta%d", prev_ifname
, sta
->aid
);
687 snprintf(new_name
, sizeof(new_name
), "%s.sta%d", ifname
, sta
->aid
);
688 hostapd_drv_if_rename(hapd
, WPA_IF_AP_VLAN
, cur_name
, new_name
);
691 if (!strncmp(hapd
->conf
->ssid
.vlan
, hapd
->conf
->iface
, sizeof(hapd
->conf
->ssid
.vlan
)))
692 os_strlcpy(hapd
->conf
->ssid
.vlan
, ifname
, sizeof(hapd
->conf
->ssid
.vlan
));
693 os_strlcpy(hapd
->conf
->iface
, ifname
, sizeof(hapd
->conf
->iface
));
694 hostapd_ubus_add_bss(hapd
);
696 hostapd_ucode_update_interfaces();
698 if (interfaces
->ctrl_iface_init
)
699 interfaces
->ctrl_iface_init(hapd
);
701 return ret
? NULL
: ucv_boolean_new(true);
705 int hostapd_ucode_init(struct hapd_interfaces
*ifaces
)
707 static const uc_function_list_t global_fns
[] = {
708 { "printf", uc_wpa_printf
},
709 { "getpid", uc_wpa_getpid
},
710 { "sha1", uc_wpa_sha1
},
711 { "freq_info", uc_wpa_freq_info
},
712 { "add_iface", uc_hostapd_add_iface
},
713 { "remove_iface", uc_hostapd_remove_iface
},
714 { "udebug_set", uc_wpa_udebug_set
},
716 static const uc_function_list_t bss_fns
[] = {
717 { "ctrl", uc_hostapd_bss_ctrl
},
718 { "set_config", uc_hostapd_bss_set_config
},
719 { "rename", uc_hostapd_bss_rename
},
720 { "delete", uc_hostapd_bss_delete
},
722 static const uc_function_list_t iface_fns
[] = {
723 { "set_bss_order", uc_hostapd_iface_set_bss_order
},
724 { "add_bss", uc_hostapd_iface_add_bss
},
725 { "stop", uc_hostapd_iface_stop
},
726 { "start", uc_hostapd_iface_start
},
727 { "switch_channel", uc_hostapd_iface_switch_channel
},
729 uc_value_t
*data
, *proto
;
732 vm
= wpa_ucode_create_vm();
734 global_type
= uc_type_declare(vm
, "hostapd.global", global_fns
, NULL
);
735 bss_type
= uc_type_declare(vm
, "hostapd.bss", bss_fns
, NULL
);
736 iface_type
= uc_type_declare(vm
, "hostapd.iface", iface_fns
, NULL
);
738 bss_registry
= ucv_array_new(vm
);
739 uc_vm_registry_set(vm
, "hostap.bss_registry", bss_registry
);
741 iface_registry
= ucv_array_new(vm
);
742 uc_vm_registry_set(vm
, "hostap.iface_registry", iface_registry
);
744 global
= wpa_ucode_global_init("hostapd", global_type
);
746 if (wpa_ucode_run(HOSTAPD_UC_PATH
"hostapd.uc"))
757 void hostapd_ucode_free(void)
759 if (wpa_ucode_call_prepare("shutdown") == 0)
760 ucv_put(wpa_ucode_call(0));
764 void hostapd_ucode_free_iface(struct hostapd_iface
*iface
)
766 wpa_ucode_registry_remove(iface_registry
, iface
->ucode
.idx
);
769 void hostapd_ucode_add_bss(struct hostapd_data
*hapd
)
773 if (wpa_ucode_call_prepare("bss_add"))
776 val
= hostapd_ucode_bss_get_uval(hapd
);
777 uc_value_push(ucv_get(ucv_string_new(hapd
->conf
->iface
)));
778 uc_value_push(ucv_get(val
));
779 ucv_put(wpa_ucode_call(2));
783 void hostapd_ucode_reload_bss(struct hostapd_data
*hapd
)
787 if (wpa_ucode_call_prepare("bss_reload"))
790 val
= hostapd_ucode_bss_get_uval(hapd
);
791 uc_value_push(ucv_get(ucv_string_new(hapd
->conf
->iface
)));
792 uc_value_push(ucv_get(val
));
793 ucv_put(wpa_ucode_call(2));
797 void hostapd_ucode_free_bss(struct hostapd_data
*hapd
)
801 val
= wpa_ucode_registry_remove(bss_registry
, hapd
->ucode
.idx
);
806 if (wpa_ucode_call_prepare("bss_remove"))
809 uc_value_push(ucv_string_new(hapd
->conf
->iface
));
810 uc_value_push(ucv_get(val
));
811 ucv_put(wpa_ucode_call(2));