mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-22 01:13:00 +02:00
confd: wifi: Update wpa_supplicant config when wifi setting change
For example changing SSID
This commit is contained in:
+9
-12
@@ -14,18 +14,15 @@
|
||||
|
||||
#define WPA_SUPPLICANT_CONF "/etc/wpa_supplicant-%s.conf"
|
||||
|
||||
/*
|
||||
* Determine WiFi mode from YANG configuration
|
||||
*/
|
||||
typedef enum wifi_mode_t {
|
||||
wifi_station,
|
||||
wifi_ap,
|
||||
wifi_unknown
|
||||
} wifi_mode_t;
|
||||
|
||||
static wifi_mode_t wifi_get_mode(struct lyd_node *wifi)
|
||||
wifi_mode_t wifi_get_mode(struct lyd_node *iface)
|
||||
{
|
||||
struct lyd_node *ap;
|
||||
struct lyd_node *ap, *wifi;
|
||||
|
||||
wifi = lydx_get_child(iface, "wifi");
|
||||
if (!wifi)
|
||||
return wifi_unknown;
|
||||
|
||||
|
||||
ap = lydx_get_child(wifi, "access-point");
|
||||
if (ap) {
|
||||
@@ -60,7 +57,7 @@ int wifi_mode_changed(struct lyd_node *wifi)
|
||||
/*
|
||||
* Generate wpa_supplicant config for station mode
|
||||
*/
|
||||
static int wifi_gen_station(struct lyd_node *cif)
|
||||
int wifi_gen_station(struct lyd_node *cif)
|
||||
{
|
||||
const char *ifname, *ssid, *secret_name, *secret, *security_mode, *radio;
|
||||
struct lyd_node *security, *secret_node, *radio_node, *station, *wifi;
|
||||
@@ -213,7 +210,7 @@ int wifi_add_iface(struct lyd_node *cif, struct dagger *net)
|
||||
return SR_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
mode = wifi_get_mode(wifi);
|
||||
mode = wifi_get_mode(cif);
|
||||
probe_timeout = wifi_get_probe_timeout(net->session, radio);
|
||||
|
||||
fprintf(iw, "# Generated by Infix confd - WiFi Interface Creation\n");
|
||||
|
||||
@@ -452,9 +452,8 @@ static int netdag_gen_afspec_set(sr_session_ctx_t *session, struct dagger *net,
|
||||
case IFT_ETH:
|
||||
return netdag_gen_ethtool(net, cif, dif);
|
||||
case IFT_WIFI:
|
||||
/* WiFi daemon config (hostapd/wpa_supplicant) is handled by
|
||||
* hardware.c when the radio (phy) is configured. Interface
|
||||
* creation/deletion is handled in netdag_gen_afspec_add(). */
|
||||
if (wifi_get_mode(cif) == wifi_station)
|
||||
return wifi_gen_station(cif);
|
||||
return 0;
|
||||
case IFT_DUMMY:
|
||||
case IFT_GRE:
|
||||
|
||||
@@ -124,9 +124,17 @@ int bridge_mcd_gen(struct lyd_node *cifs);
|
||||
int bridge_port_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
|
||||
/* if-wifi.c */
|
||||
typedef enum wifi_mode_t {
|
||||
wifi_station,
|
||||
wifi_ap,
|
||||
wifi_unknown
|
||||
} wifi_mode_t;
|
||||
|
||||
int wifi_add_iface(struct lyd_node *cif, struct dagger *net);
|
||||
int wifi_del_iface(struct lyd_node *dif, struct dagger *net);
|
||||
int wifi_mode_changed(struct lyd_node *wifi);
|
||||
int wifi_gen_station(struct lyd_node *cif);
|
||||
wifi_mode_t wifi_get_mode(struct lyd_node *wifi);
|
||||
|
||||
/* if-gre.c */
|
||||
int gre_gen(struct lyd_node *dif, struct lyd_node *cif, FILE *ip);
|
||||
|
||||
Reference in New Issue
Block a user