Skip to content

Commit

Permalink
chore(astyle) astyle run on DHCPS captiveportal files
Browse files Browse the repository at this point in the history
  • Loading branch information
jkingsman committed Apr 9, 2024
1 parent cbc6ac3 commit 8e7a672
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 20 deletions.
4 changes: 2 additions & 2 deletions components/esp_netif/include/esp_netif_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extern "C" {


/**
* @brief Definition of ESP-NETIF bridge controll
* @brief Definition of ESP-NETIF bridge control
*/
#define ESP_NETIF_BR_FLOOD -1
#define ESP_NETIF_BR_DROP 0
Expand Down Expand Up @@ -128,7 +128,7 @@ typedef struct {
*/
typedef struct {
esp_netif_t *esp_netif; /*!< Pointer to corresponding esp-netif object */
esp_netif_ip_info_t ip_info; /*!< IP address, netmask, gatway IP address */
esp_netif_ip_info_t ip_info; /*!< IP address, netmask, gateway IP address */
bool ip_changed; /*!< Whether the assigned IP has changed or not */
} ip_event_got_ip_t;

Expand Down
2 changes: 1 addition & 1 deletion components/lwip/apps/dhcpserver/dhcpserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,7 @@ static s16_t parse_msg(dhcps_t *dhcps, struct dhcps_msg *m, u16_t len)
dhcps->client_address.addr = dhcps->client_address_plus.addr;
}

if (flag == false) { // search the fisrt unused ip
if (flag == false) { // search the first unused ip
if (first_address.addr < pdhcps_pool->ip.addr) {
flag = true;
} else {
Expand Down
18 changes: 5 additions & 13 deletions components/lwip/include/apps/dhcpserver/dhcpserver_options.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
// Copyright 2017 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at

// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once

#ifdef __cplusplus
Expand Down
4 changes: 2 additions & 2 deletions examples/protocols/http_server/captive_portal/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

This example demonstrates two methods of a captive portal, used to direct users to an authentication page or other necessary starting point before browsing.

One approach redirects all DNS IP questions to point to the softAP and redirect all HTTP requests to the captive portal root page. This triggers the captive portal (sign in) to appear on Android, iOS, and Windows. Note that the example will not redirect HTTPS requests.
One approach response to all DNS queries with the address of the softAP, and redirects all HTTP requests to the captive portal root page. This "funnelling" of DNS and traffic triggers the captive portal (sign in) to appear on Android, iOS, and Windows. Note that the example will not redirect HTTPS requests.

The other approach is a more modern method which includes a field in the DHCP offer (AKA DHCP Option 114), provided when the client is assigned an IP address, which specifies to the client where the captive portal is. This is advantageous because it doesn't require the overhead of DNS redirects and can work more reliably around HTTPS, HTST, and other protection systems, as well as being more standards compliant. This feature is toggleable in the `Example Configuration`, but does not conflict with the DNS methodology -- these two methods work towards the same goal and can complement each other.
The other approach is a more modern method which includes a field in the DHCP offer (AKA DHCP Option 114), provided when the client is assigned an IP address, which specifies to the client where the captive portal is. This is advantageous because it doesn't require the overhead of DNS redirects and can work more reliably around HTTPS, HTST, and other security systems, as well as being more standards compliant. This feature is toggleable in the `Example Configuration`, but does not conflict with the DNS methodology -- these two methods work towards the same goal and can complement each other.

## How to Use Example

Expand Down
2 changes: 1 addition & 1 deletion examples/protocols/http_server/captive_portal/main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void app_main(void)
#if CONFIG_ESP_ENABLE_DHCP_CAPTIVEPORTAL
dhcp_set_captiveportal_url();
#endif

// Start the server for the first time
start_webserver();

Expand Down
1 change: 0 additions & 1 deletion tools/ci/check_copyright_ignore.txt
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ components/hal/spi_slave_hal_iram.c
components/idf_test/include/idf_performance.h
components/log/host_test/log_test/main/log_test.cpp
components/lwip/apps/ping/ping.c
components/lwip/include/apps/dhcpserver/dhcpserver_options.h
components/lwip/include/apps/esp_ping.h
components/lwip/include/apps/ping/ping.h
components/mbedtls/esp_crt_bundle/test_gen_crt_bundle/test_gen_crt_bundle.py
Expand Down

0 comments on commit 8e7a672

Please sign in to comment.