diff --git a/examples/network/sta_to_eth/main/Kconfig.projbuild b/examples/network/sta_to_eth/main/Kconfig.projbuild
index bc71e4059f..df49a96809 100644
--- a/examples/network/sta_to_eth/main/Kconfig.projbuild
+++ b/examples/network/sta_to_eth/main/Kconfig.projbuild
@@ -14,6 +14,49 @@ menu "Example Configuration"
prompt "Using unified provisioning"
endchoice
+ choice EXAMPLE_PROV_SECURITY_VERSION
+ bool "Protocomm security version"
+ depends on EXAMPLE_WIFI_CONFIGURATION_PROVISIONING
+ default EXAMPLE_PROV_SECURITY_VERSION_1
+ help
+ Wi-Fi provisioning component offers 3 security versions.
+ The example offers a choice between security version 1 and 2.
+
+ config EXAMPLE_PROV_SECURITY_VERSION_1
+ bool "Security version 1"
+ select ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_1
+
+ config EXAMPLE_PROV_SECURITY_VERSION_2
+ bool "Security version 2"
+ select ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_2
+
+ config EXAMPLE_PROV_SECURITY_VERSION_0
+ bool "Plain text communication -- not secure!"
+ select ESP_PROTOCOMM_SUPPORT_SECURITY_VERSION_0
+
+ endchoice
+
+ choice EXAMPLE_PROV_MODE
+ bool "Security version 2 mode"
+ depends on EXAMPLE_PROV_SECURITY_VERSION_2
+ default EXAMPLE_PROV_SEC2_DEV_MODE
+
+ config EXAMPLE_PROV_SEC2_DEV_MODE
+ bool "Security version 2 development mode"
+ depends on EXAMPLE_PROV_SECURITY_VERSION_2
+ help
+ This enables the development mode for
+ security version 2.
+ Please note that this mode is NOT recommended for production purpose.
+
+ config EXAMPLE_PROV_SEC2_PROD_MODE
+ bool "Security version 2 production mode"
+ depends on EXAMPLE_PROV_SECURITY_VERSION_2
+ help
+ This enables the production mode for
+ security version 2.
+ endchoice
+
choice EXAMPLE_WIRED_INTERFACE
prompt "Choose the Wired interface"
default EXAMPLE_WIRED_INTERFACE_IS_ETHERNET
diff --git a/examples/network/sta_to_eth/main/ethernet_iface.c b/examples/network/sta_to_eth/main/ethernet_iface.c
index bf81f8640e..9b46cf1eab 100644
--- a/examples/network/sta_to_eth/main/ethernet_iface.c
+++ b/examples/network/sta_to_eth/main/ethernet_iface.c
@@ -39,26 +39,26 @@ void eth_event_handler(void *arg, esp_event_base_t event_base,
esp_eth_handle_t eth_handle = *(esp_eth_handle_t *)event_data;
switch (event_id) {
- case ETHERNET_EVENT_CONNECTED:
- esp_eth_ioctl(eth_handle, ETH_CMD_G_MAC_ADDR, mac_addr);
- ESP_LOGI(TAG, "Ethernet Link Up");
- ESP_LOGI(TAG, "Ethernet HW Addr %02x:%02x:%02x:%02x:%02x:%02x",
- mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
- s_ethernet_is_connected = true;
- break;
- case ETHERNET_EVENT_DISCONNECTED:
- ESP_LOGI(TAG, "Ethernet Link Down");
- s_ethernet_is_connected = false;
- break;
- case ETHERNET_EVENT_START:
- ESP_LOGI(TAG, "Ethernet Started");
- break;
- case ETHERNET_EVENT_STOP:
- ESP_LOGI(TAG, "Ethernet Stopped");
- break;
- default:
- ESP_LOGI(TAG, "Default Event");
- break;
+ case ETHERNET_EVENT_CONNECTED:
+ esp_eth_ioctl(eth_handle, ETH_CMD_G_MAC_ADDR, mac_addr);
+ ESP_LOGI(TAG, "Ethernet Link Up");
+ ESP_LOGI(TAG, "Ethernet HW Addr %02x:%02x:%02x:%02x:%02x:%02x",
+ mac_addr[0], mac_addr[1], mac_addr[2], mac_addr[3], mac_addr[4], mac_addr[5]);
+ s_ethernet_is_connected = true;
+ break;
+ case ETHERNET_EVENT_DISCONNECTED:
+ ESP_LOGI(TAG, "Ethernet Link Down");
+ s_ethernet_is_connected = false;
+ break;
+ case ETHERNET_EVENT_START:
+ ESP_LOGI(TAG, "Ethernet Started");
+ break;
+ case ETHERNET_EVENT_STOP:
+ ESP_LOGI(TAG, "Ethernet Stopped");
+ break;
+ default:
+ ESP_LOGI(TAG, "Default Event");
+ break;
}
}
@@ -178,7 +178,7 @@ void mac_spoof(mac_spoof_direction_t direction, uint8_t *buffer, uint16_t len, u
static esp_err_t wired_recv(esp_eth_handle_t eth_handle, uint8_t *buffer, uint32_t len, void *priv)
{
- esp_err_t ret = s_rx_cb(buffer,len, buffer);
+ esp_err_t ret = s_rx_cb(buffer, len, buffer);
free(buffer);
return ret;
}
@@ -235,7 +235,7 @@ esp_err_t wired_send(void *buffer, uint16_t len, void *buff_free_arg)
* From the PC's NIC perspective the board acts as a separate network with it's own IP and MAC address
* (this network's MAC address is the native ESP32's Ethernet interface MAC)
*/
-static void l2_free(void *h, void* buffer)
+static void l2_free(void *h, void *buffer)
{
free(buffer);
}
@@ -281,9 +281,9 @@ esp_err_t wired_netif_init(void)
base_cfg.if_desc = "ethernet config device";
// 2) Use static config for driver's config pointing only to static transmit and free functions
esp_netif_driver_ifconfig_t driver_cfg = {
- .handle = (void*)1, // will be replaced by the driver pointer only tinyusb_net supports ti
- .transmit = netif_transmit,
- .driver_free_rx_buffer = l2_free
+ .handle = (void *)1, // will be replaced by the driver pointer only tinyusb_net supports ti
+ .transmit = netif_transmit,
+ .driver_free_rx_buffer = l2_free
};
// Config the esp-netif with:
@@ -291,10 +291,10 @@ esp_err_t wired_netif_init(void)
// 2) driver's config (connection to IO functions -- usb)
// 3) stack config (using lwip IO functions -- derive from eth)
esp_netif_config_t cfg = {
- .base = &base_cfg,
- .driver = &driver_cfg,
- // 3) use ethernet style of lwip netif settings
- .stack = ESP_NETIF_NETSTACK_DEFAULT_ETH
+ .base = &base_cfg,
+ .driver = &driver_cfg,
+ // 3) use ethernet style of lwip netif settings
+ .stack = ESP_NETIF_NETSTACK_DEFAULT_ETH
};
s_netif = esp_netif_new(&cfg);
diff --git a/examples/network/sta_to_eth/main/manual_config.c b/examples/network/sta_to_eth/main/manual_config.c
index 06864f3097..e95d041822 100644
--- a/examples/network/sta_to_eth/main/manual_config.c
+++ b/examples/network/sta_to_eth/main/manual_config.c
@@ -37,7 +37,7 @@ static esp_err_t http_get_handler(httpd_req_t *req)
"Password:
\n"
" "
"";
- char* buf = NULL;
+ char *buf = NULL;
size_t buf_len;
buf_len = httpd_req_get_url_query_len(req) + 1;
if (buf_len > 1) {
@@ -49,27 +49,27 @@ static esp_err_t http_get_handler(httpd_req_t *req)
if (httpd_query_key_value(buf, "ssid", param, sizeof(param)) == ESP_OK) {
ESP_LOGI(TAG, "ssid=%s", param);
- strncpy((char*)wifi_cfg.sta.ssid, param, sizeof(wifi_cfg.sta.ssid));
+ strncpy((char *)wifi_cfg.sta.ssid, param, sizeof(wifi_cfg.sta.ssid));
}
if (httpd_query_key_value(buf, "password", param, sizeof(param)) == ESP_OK) {
ESP_LOGI(TAG, "password=%s", param);
- strncpy((char*)wifi_cfg.sta.password, param, sizeof(wifi_cfg.sta.password));
+ strncpy((char *)wifi_cfg.sta.password, param, sizeof(wifi_cfg.sta.password));
}
- if (strlen((char*)wifi_cfg.sta.ssid) > 0 && strlen((char*)wifi_cfg.sta.password)) {
- const char wifi_configured[] = "
Connecting...
";
+ if (strlen((char *)wifi_cfg.sta.ssid) > 0 && strlen((char *)wifi_cfg.sta.password)) {
+ httpd_resp_set_type(req, "text/html");
esp_wifi_set_mode(WIFI_MODE_STA);
if (esp_wifi_set_storage(WIFI_STORAGE_FLASH) == ESP_OK &&
- esp_wifi_set_config(WIFI_IF_STA, &wifi_cfg) == ESP_OK) {
+ esp_wifi_set_config(WIFI_IF_STA, &wifi_cfg) == ESP_OK) {
+ const char wifi_configured[] = "Connecting...
";
ESP_LOGI(TAG, "WiFi settings accepted!");
+ httpd_resp_send(req, wifi_configured, strlen(wifi_configured));
} else {
+ const char wifi_config_failed[] = "Failed to configure WiFi settings
";
ESP_LOGE(TAG, "Failed to set WiFi config to flash");
+ httpd_resp_send(req, wifi_config_failed, strlen(wifi_config_failed));
}
-//
-// esp_wifi_set_config(WIFI_IF_STA, &wifi_cfg);
- httpd_resp_set_type(req, "text/html");
- httpd_resp_send(req, wifi_configured, strlen(wifi_configured));
free(buf);
if (s_flags) {
xEventGroupSetBits(*s_flags, s_success_bit);
@@ -87,9 +87,9 @@ static esp_err_t http_get_handler(httpd_req_t *req)
}
static const httpd_uri_t root = {
- .uri = "/",
- .method = HTTP_GET,
- .handler = http_get_handler,
+ .uri = "/",
+ .method = HTTP_GET,
+ .handler = http_get_handler,
};
static void start_webserver(void)
diff --git a/examples/network/sta_to_eth/main/provisioning.c b/examples/network/sta_to_eth/main/provisioning.c
index e53ca899b4..2a08088323 100644
--- a/examples/network/sta_to_eth/main/provisioning.c
+++ b/examples/network/sta_to_eth/main/provisioning.c
@@ -13,6 +13,74 @@
static const char *TAG = "NCM_provisioning";
+#if CONFIG_EXAMPLE_PROV_SECURITY_VERSION_2
+#if CONFIG_EXAMPLE_PROV_SEC2_DEV_MODE
+#define EXAMPLE_PROV_SEC2_USERNAME "wifiprov"
+#define EXAMPLE_PROV_SEC2_PWD "abcd1234"
+
+/* This salt,verifier has been generated for username = "wifiprov" and password = "abcd1234"
+ * IMPORTANT NOTE: For production cases, this must be unique to every device
+ * and should come from device manufacturing partition.*/
+static const char sec2_salt[] = {
+ 0x03, 0x6e, 0xe0, 0xc7, 0xbc, 0xb9, 0xed, 0xa8, 0x4c, 0x9e, 0xac, 0x97, 0xd9, 0x3d, 0xec, 0xf4
+};
+
+static const char sec2_verifier[] = {
+ 0x7c, 0x7c, 0x85, 0x47, 0x65, 0x08, 0x94, 0x6d, 0xd6, 0x36, 0xaf, 0x37, 0xd7, 0xe8, 0x91, 0x43,
+ 0x78, 0xcf, 0xfd, 0x61, 0x6c, 0x59, 0xd2, 0xf8, 0x39, 0x08, 0x12, 0x72, 0x38, 0xde, 0x9e, 0x24,
+ 0xa4, 0x70, 0x26, 0x1c, 0xdf, 0xa9, 0x03, 0xc2, 0xb2, 0x70, 0xe7, 0xb1, 0x32, 0x24, 0xda, 0x11,
+ 0x1d, 0x97, 0x18, 0xdc, 0x60, 0x72, 0x08, 0xcc, 0x9a, 0xc9, 0x0c, 0x48, 0x27, 0xe2, 0xae, 0x89,
+ 0xaa, 0x16, 0x25, 0xb8, 0x04, 0xd2, 0x1a, 0x9b, 0x3a, 0x8f, 0x37, 0xf6, 0xe4, 0x3a, 0x71, 0x2e,
+ 0xe1, 0x27, 0x86, 0x6e, 0xad, 0xce, 0x28, 0xff, 0x54, 0x46, 0x60, 0x1f, 0xb9, 0x96, 0x87, 0xdc,
+ 0x57, 0x40, 0xa7, 0xd4, 0x6c, 0xc9, 0x77, 0x54, 0xdc, 0x16, 0x82, 0xf0, 0xed, 0x35, 0x6a, 0xc4,
+ 0x70, 0xad, 0x3d, 0x90, 0xb5, 0x81, 0x94, 0x70, 0xd7, 0xbc, 0x65, 0xb2, 0xd5, 0x18, 0xe0, 0x2e,
+ 0xc3, 0xa5, 0xf9, 0x68, 0xdd, 0x64, 0x7b, 0xb8, 0xb7, 0x3c, 0x9c, 0xfc, 0x00, 0xd8, 0x71, 0x7e,
+ 0xb7, 0x9a, 0x7c, 0xb1, 0xb7, 0xc2, 0xc3, 0x18, 0x34, 0x29, 0x32, 0x43, 0x3e, 0x00, 0x99, 0xe9,
+ 0x82, 0x94, 0xe3, 0xd8, 0x2a, 0xb0, 0x96, 0x29, 0xb7, 0xdf, 0x0e, 0x5f, 0x08, 0x33, 0x40, 0x76,
+ 0x52, 0x91, 0x32, 0x00, 0x9f, 0x97, 0x2c, 0x89, 0x6c, 0x39, 0x1e, 0xc8, 0x28, 0x05, 0x44, 0x17,
+ 0x3f, 0x68, 0x02, 0x8a, 0x9f, 0x44, 0x61, 0xd1, 0xf5, 0xa1, 0x7e, 0x5a, 0x70, 0xd2, 0xc7, 0x23,
+ 0x81, 0xcb, 0x38, 0x68, 0xe4, 0x2c, 0x20, 0xbc, 0x40, 0x57, 0x76, 0x17, 0xbd, 0x08, 0xb8, 0x96,
+ 0xbc, 0x26, 0xeb, 0x32, 0x46, 0x69, 0x35, 0x05, 0x8c, 0x15, 0x70, 0xd9, 0x1b, 0xe9, 0xbe, 0xcc,
+ 0xa9, 0x38, 0xa6, 0x67, 0xf0, 0xad, 0x50, 0x13, 0x19, 0x72, 0x64, 0xbf, 0x52, 0xc2, 0x34, 0xe2,
+ 0x1b, 0x11, 0x79, 0x74, 0x72, 0xbd, 0x34, 0x5b, 0xb1, 0xe2, 0xfd, 0x66, 0x73, 0xfe, 0x71, 0x64,
+ 0x74, 0xd0, 0x4e, 0xbc, 0x51, 0x24, 0x19, 0x40, 0x87, 0x0e, 0x92, 0x40, 0xe6, 0x21, 0xe7, 0x2d,
+ 0x4e, 0x37, 0x76, 0x2f, 0x2e, 0xe2, 0x68, 0xc7, 0x89, 0xe8, 0x32, 0x13, 0x42, 0x06, 0x84, 0x84,
+ 0x53, 0x4a, 0xb3, 0x0c, 0x1b, 0x4c, 0x8d, 0x1c, 0x51, 0x97, 0x19, 0xab, 0xae, 0x77, 0xff, 0xdb,
+ 0xec, 0xf0, 0x10, 0x95, 0x34, 0x33, 0x6b, 0xcb, 0x3e, 0x84, 0x0f, 0xb9, 0xd8, 0x5f, 0xb8, 0xa0,
+ 0xb8, 0x55, 0x53, 0x3e, 0x70, 0xf7, 0x18, 0xf5, 0xce, 0x7b, 0x4e, 0xbf, 0x27, 0xce, 0xce, 0xa8,
+ 0xb3, 0xbe, 0x40, 0xc5, 0xc5, 0x32, 0x29, 0x3e, 0x71, 0x64, 0x9e, 0xde, 0x8c, 0xf6, 0x75, 0xa1,
+ 0xe6, 0xf6, 0x53, 0xc8, 0x31, 0xa8, 0x78, 0xde, 0x50, 0x40, 0xf7, 0x62, 0xde, 0x36, 0xb2, 0xba
+};
+#endif
+
+static esp_err_t example_get_sec2_salt(const char **salt, uint16_t *salt_len)
+{
+#if CONFIG_EXAMPLE_PROV_SEC2_DEV_MODE
+ ESP_LOGI(TAG, "Development mode: using hard coded salt");
+ *salt = sec2_salt;
+ *salt_len = sizeof(sec2_salt);
+ return ESP_OK;
+#elif CONFIG_EXAMPLE_PROV_SEC2_PROD_MODE
+ ESP_LOGE(TAG, "Not implemented!");
+ return ESP_FAIL;
+#endif
+}
+
+static esp_err_t example_get_sec2_verifier(const char **verifier, uint16_t *verifier_len)
+{
+#if CONFIG_EXAMPLE_PROV_SEC2_DEV_MODE
+ ESP_LOGI(TAG, "Development mode: using hard coded verifier");
+ *verifier = sec2_verifier;
+ *verifier_len = sizeof(sec2_verifier);
+ return ESP_OK;
+#elif CONFIG_EXAMPLE_PROV_SEC2_PROD_MODE
+ /* This code needs to be updated with appropriate implementation to provide verifier */
+ ESP_LOGE(TAG, "Not implemented!");
+ return ESP_FAIL;
+#endif
+}
+#endif // CONFIG_EXAMPLE_PROV_SECURITY_VERSION_2
+
struct events {
EventGroupHandle_t *flags;
int success_bit;
@@ -25,39 +93,39 @@ static void event_handler(void *arg, esp_event_base_t event_base,
{
struct events *handler_args = arg;
switch (event_id) {
- case WIFI_PROV_START:
- ESP_LOGI(TAG, "Provisioning started");
- break;
- case WIFI_PROV_CRED_RECV: {
- wifi_sta_config_t *wifi_sta_cfg = (wifi_sta_config_t *) event_data;
- ESP_LOGI(TAG, "Received Wi-Fi credentials"
- "\n\tSSID : %s\n\tPassword : %s",
- (const char *) wifi_sta_cfg->ssid,
- (const char *) wifi_sta_cfg->password);
- break;
- }
- case WIFI_PROV_CRED_FAIL: {
- wifi_prov_sta_fail_reason_t *reason = (wifi_prov_sta_fail_reason_t *) event_data;
- ESP_LOGE(TAG, "Provisioning failed!\n\tReason : %s"
- "\n\tPlease reset to factory and retry provisioning",
- (*reason == WIFI_PROV_STA_AUTH_ERROR) ?
- "Wi-Fi station authentication failed" : "Wi-Fi access-point not found");
- handler_args->success = false;
+ case WIFI_PROV_START:
+ ESP_LOGI(TAG, "Provisioning started");
+ break;
+ case WIFI_PROV_CRED_RECV: {
+ wifi_sta_config_t *wifi_sta_cfg = (wifi_sta_config_t *) event_data;
+ ESP_LOGI(TAG, "Received Wi-Fi credentials"
+ "\n\tSSID : %s\n\tPassword : %s",
+ (const char *) wifi_sta_cfg->ssid,
+ (const char *) wifi_sta_cfg->password);
+ break;
+ }
+ case WIFI_PROV_CRED_FAIL: {
+ wifi_prov_sta_fail_reason_t *reason = (wifi_prov_sta_fail_reason_t *) event_data;
+ ESP_LOGE(TAG, "Provisioning failed!\n\tReason : %s"
+ "\n\tPlease reset to factory and retry provisioning",
+ (*reason == WIFI_PROV_STA_AUTH_ERROR) ?
+ "Wi-Fi station authentication failed" : "Wi-Fi access-point not found");
+ handler_args->success = false;
- break;
- }
- case WIFI_PROV_CRED_SUCCESS:
- ESP_LOGI(TAG, "Provisioning successful");
- handler_args->success = true;
- break;
- case WIFI_PROV_END:
- /* De-initialize manager once provisioning is finished */
- wifi_prov_mgr_deinit();
- xEventGroupSetBits(*handler_args->flags, handler_args->success ? handler_args->success_bit : handler_args->fail_bit);
- free(handler_args);
- break;
- default:
- break;
+ break;
+ }
+ case WIFI_PROV_CRED_SUCCESS:
+ ESP_LOGI(TAG, "Provisioning successful");
+ handler_args->success = true;
+ break;
+ case WIFI_PROV_END:
+ /* De-initialize manager once provisioning is finished */
+ wifi_prov_mgr_deinit();
+ xEventGroupSetBits(*handler_args->flags, handler_args->success ? handler_args->success_bit : handler_args->fail_bit);
+ free(handler_args);
+ break;
+ default:
+ break;
}
}
@@ -75,16 +143,56 @@ esp_err_t start_provisioning(EventGroupHandle_t *flags, int success_bit, int fai
ESP_ERROR_CHECK(esp_event_handler_register(WIFI_PROV_EVENT, ESP_EVENT_ANY_ID, event_handler, handler_args));
/* Configuration for the provisioning manager */
wifi_prov_mgr_config_t config = {
- .scheme = wifi_prov_scheme_httpd,
+ .scheme = wifi_prov_scheme_httpd,
};
/* Initialize provisioning manager with the
* configuration parameters set above */
ESP_ERROR_CHECK(wifi_prov_mgr_init(config));
- /* TODO: Add more security options to menuconfig
+ /* What is the security level that we want (0, 1, 2):
+ * - WIFI_PROV_SECURITY_0 is simply plain text communication.
+ * - WIFI_PROV_SECURITY_1 is secure communication which consists of secure handshake
+ * - WIFI_PROV_SECURITY_2 SRP6a based authentication and key exchange
+ * Please check unified provisioning documentation for more details
*/
- ESP_ERROR_CHECK(wifi_prov_mgr_start_provisioning(WIFI_PROV_SECURITY_0, NULL, NULL, NULL));
+
+#ifdef CONFIG_EXAMPLE_PROV_SECURITY_VERSION_0
+ wifi_prov_security_t security = WIFI_PROV_SECURITY_0;
+#elif CONFIG_EXAMPLE_PROV_SECURITY_VERSION_1
+ wifi_prov_security_t security = WIFI_PROV_SECURITY_1;
+ const char *pop = "abcd1234"; /* Proof of possession */
+ wifi_prov_security1_params_t *sec_params = pop;
+
+#elif CONFIG_EXAMPLE_PROV_SECURITY_VERSION_2
+ wifi_prov_security_t security = WIFI_PROV_SECURITY_2;
+ /* The username must be the same one, which has been used in the generation of salt and verifier */
+
+#if CONFIG_EXAMPLE_PROV_SEC2_DEV_MODE
+ /* This pop field represents the password that will be used to generate salt and verifier.
+ * The field is present here in order to generate the QR code containing password.
+ * In production this password field shall not be stored on the device */
+ const char *username = EXAMPLE_PROV_SEC2_USERNAME;
+ const char *pop = EXAMPLE_PROV_SEC2_PWD;
+#elif CONFIG_EXAMPLE_PROV_SEC2_PROD_MODE
+ /* The username and password shall not be embedded in the firmware */
+ const char *username = NULL;
+ const char *pop = NULL;
+#endif
+ /* This is the structure for passing security parameters
+ * for the protocomm security 2.
+ * If dynamically allocated, sec2_params pointer and its content
+ * must be valid till WIFI_PROV_END event is triggered.
+ */
+ wifi_prov_security2_params_t sec2_params = {};
+
+ ESP_ERROR_CHECK(example_get_sec2_salt(&sec2_params.salt, &sec2_params.salt_len));
+ ESP_ERROR_CHECK(example_get_sec2_verifier(&sec2_params.verifier, &sec2_params.verifier_len));
+
+ wifi_prov_security2_params_t *sec_params = &sec2_params;
+#endif // CONFIG_EXAMPLE_PROV_SECURITY_VERSION_0 (VERSION_1, VERSION_2)
+
+ ESP_ERROR_CHECK(wifi_prov_mgr_start_provisioning(security, (const void *) sec_params, NULL, NULL)); // service name and key could be NULL
return ESP_OK;
}
diff --git a/examples/network/sta_to_eth/main/scheme_generic_httpd.c b/examples/network/sta_to_eth/main/scheme_generic_httpd.c
index c0fbef202d..e0bd85bbca 100644
--- a/examples/network/sta_to_eth/main/scheme_generic_httpd.c
+++ b/examples/network/sta_to_eth/main/scheme_generic_httpd.c
@@ -25,9 +25,9 @@ static esp_err_t prov_start(protocomm_t *pc, void *config)
return ESP_ERR_INVALID_ARG;
}
protocomm_httpd_config_t default_config = {
- .data = {
- .config = PROTOCOMM_HTTPD_DEFAULT_CONFIG()
- }
+ .data = {
+ .config = PROTOCOMM_HTTPD_DEFAULT_CONFIG()
+ }
};
/* Start protocomm server on top of HTTP */
@@ -60,7 +60,7 @@ static esp_err_t prov_stop(protocomm_t *pc)
*/
static void *new_config(void)
{
- return (void*)1;
+ return (void *)1;
}
static void delete_config(void *config)
@@ -81,11 +81,11 @@ static esp_err_t set_config_endpoint(void *config, const char *endpoint_name, ui
* @brief Creating a generic HTTPD scheme
*/
const wifi_prov_scheme_t wifi_prov_scheme_httpd = {
- .prov_start = prov_start,
- .prov_stop = prov_stop,
- .new_config = new_config,
- .delete_config = delete_config,
- .set_config_service = set_config_service,
- .set_config_endpoint = set_config_endpoint,
- .wifi_mode = WIFI_MODE_STA
+ .prov_start = prov_start,
+ .prov_stop = prov_stop,
+ .new_config = new_config,
+ .delete_config = delete_config,
+ .set_config_service = set_config_service,
+ .set_config_endpoint = set_config_endpoint,
+ .wifi_mode = WIFI_MODE_STA
};
diff --git a/examples/network/sta_to_eth/main/sta2wired_main.c b/examples/network/sta_to_eth/main/sta2wired_main.c
index 2a264a958d..64a94e9f39 100644
--- a/examples/network/sta_to_eth/main/sta2wired_main.c
+++ b/examples/network/sta_to_eth/main/sta2wired_main.c
@@ -35,7 +35,7 @@ const int PROV_FAIL_BIT = BIT4;
/**
* WiFi -- Wired packet path
*/
-static esp_err_t wired_recv_callback(void *buffer, uint16_t len, void* ctx)
+static esp_err_t wired_recv_callback(void *buffer, uint16_t len, void *ctx)
{
if (s_wifi_is_connected) {
mac_spoof(FROM_WIRED, buffer, len, s_sta_mac);
@@ -46,7 +46,7 @@ static esp_err_t wired_recv_callback(void *buffer, uint16_t len, void* ctx)
return ESP_OK;
}
-static void wifi_buff_free(void* buffer, void* ctx)
+static void wifi_buff_free(void *buffer, void *ctx)
{
esp_wifi_internal_free_rx_buffer(buffer);
}
@@ -62,7 +62,7 @@ static esp_err_t wifi_recv_callback(void *buffer, uint16_t len, void *eb)
}
static void event_handler(void *arg, esp_event_base_t event_base,
- int32_t event_id, void *event_data)
+ int32_t event_id, void *event_data)
{
if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED) {
ESP_LOGI(TAG, "Wi-Fi STA disconnected");
@@ -93,7 +93,7 @@ static esp_err_t connect_wifi(void)
return ESP_FAIL;
}
esp_wifi_connect();
- EventBits_t status = xEventGroupWaitBits(s_event_flags, CONNECTED_BIT, 0, 1, 10000/portTICK_PERIOD_MS);
+ EventBits_t status = xEventGroupWaitBits(s_event_flags, CONNECTED_BIT, 0, 1, 10000 / portTICK_PERIOD_MS);
if (status & CONNECTED_BIT) {
ESP_LOGI(TAG, "WiFi station connected successfully");
return ESP_OK;
@@ -108,7 +108,7 @@ static esp_err_t connect_wifi(void)
#define GPIO_INPUT CONFIG_EXAMPLE_RECONFIGURE_BUTTON
#define GPIO_LONG_PUSH_US 2000000 /* push for 2 seconds to reconfigure */
-static void IRAM_ATTR gpio_isr_handler(void* arg)
+static void IRAM_ATTR gpio_isr_handler(void *arg)
{
static int64_t last_pushed = -1;
if (gpio_get_level(GPIO_INPUT) == 0) {
@@ -129,9 +129,10 @@ static void IRAM_ATTR gpio_isr_handler(void* arg)
static void gpio_init(void)
{
gpio_config_t io_conf = { .intr_type = GPIO_INTR_ANYEDGE,
- .pin_bit_mask = (1ULL<