mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/add_dhcp_option' into 'master'
lwip/dhcp: add configure for enable vendor class identify option Closes IDFGH-4998 See merge request espressif/esp-idf!13867
This commit is contained in:
commit
fb24a2941c
@ -79,6 +79,8 @@ typedef enum{
|
||||
ESP_NETIF_REQUESTED_IP_ADDRESS = 50, /**< Request specific IP address */
|
||||
ESP_NETIF_IP_ADDRESS_LEASE_TIME = 51, /**< Request IP address lease time */
|
||||
ESP_NETIF_IP_REQUEST_RETRY_TIME = 52, /**< Request IP address retry counter */
|
||||
ESP_NETIF_VENDOR_CLASS_IDENTIFIER = 60, /**< Vendor Class Identifier of a DHCP client */
|
||||
ESP_NETIF_VENDOR_SPECIFIC_INFO = 43, /**< Vendor Specific Information of a DHCP server */
|
||||
} esp_netif_dhcp_option_id_t;
|
||||
|
||||
/** IP event declarations */
|
||||
|
@ -1,16 +1,8 @@
|
||||
// Copyright 2019 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: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <lwip/ip_addr.h>
|
||||
@ -1889,9 +1881,12 @@ esp_err_t esp_netif_dhcpc_option(esp_netif_t *esp_netif, esp_netif_dhcp_option_m
|
||||
*(uint8_t *)opt_val = dhcp->tries;
|
||||
}
|
||||
break;
|
||||
#if ESP_DHCP && !ESP_DHCP_DISABLE_VENDOR_CLASS_IDENTIFIER
|
||||
case ESP_NETIF_VENDOR_SPECIFIC_INFO:
|
||||
return dhcp_get_vendor_specific_information(opt_len, opt_val);
|
||||
#endif
|
||||
default:
|
||||
return ESP_ERR_ESP_NETIF_INVALID_PARAMS;
|
||||
break;
|
||||
}
|
||||
} else if (opt_op == ESP_NETIF_OP_SET) {
|
||||
if (esp_netif->dhcpc_status == ESP_NETIF_DHCP_STARTED) {
|
||||
@ -1903,9 +1898,12 @@ esp_err_t esp_netif_dhcpc_option(esp_netif_t *esp_netif, esp_netif_dhcp_option_m
|
||||
dhcp->tries = *(uint8_t *)opt_val;
|
||||
}
|
||||
break;
|
||||
#if ESP_DHCP && !ESP_DHCP_DISABLE_VENDOR_CLASS_IDENTIFIER
|
||||
case ESP_NETIF_VENDOR_CLASS_IDENTIFIER:
|
||||
return dhcp_set_vendor_class_identifier(opt_len, opt_val);
|
||||
#endif
|
||||
default:
|
||||
return ESP_ERR_ESP_NETIF_INVALID_PARAMS;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
return ESP_ERR_ESP_NETIF_INVALID_PARAMS;
|
||||
|
@ -258,6 +258,13 @@ menu "LWIP"
|
||||
in the DHCP packets as an option 61)
|
||||
Set this option to "y" in order to exclude option 61 from DHCP packets.
|
||||
|
||||
config LWIP_DHCP_DISABLE_VENDOR_CLASS_ID
|
||||
bool "DHCP: Disable Use of vendor class identification"
|
||||
default y
|
||||
help
|
||||
This option could be used to disable DHCP client vendor class identification.
|
||||
Set this option to "y" in order to exclude option 60 from DHCP packets.
|
||||
|
||||
config LWIP_DHCP_RESTORE_LAST_IP
|
||||
bool "DHCP: Restore last IP obtained from DHCP server"
|
||||
default n
|
||||
|
@ -1,34 +1,11 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
* SPDX-FileCopyrightText: 2001-2003 Swedish Institute of Computer Science
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Simon Goldschmidt
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* SPDX-FileContributor: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||
*/
|
||||
|
||||
#ifndef __LWIPOPTS_H__
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
@ -272,6 +249,11 @@
|
||||
*/
|
||||
#define DHCP_OPTIONS_LEN CONFIG_LWIP_DHCP_OPTIONS_LEN
|
||||
|
||||
/**
|
||||
* LWIP_DHCP_DISABLE_VENDOR_CLASS_ID==1: Do not add option 60 (Vendor Class Identifier) to DHCP packets
|
||||
*/
|
||||
#define ESP_DHCP_DISABLE_VENDOR_CLASS_IDENTIFIER CONFIG_LWIP_DHCP_DISABLE_VENDOR_CLASS_ID
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- AUTOIP options ----------
|
||||
|
@ -860,7 +860,6 @@ components/esp_netif/include/esp_netif_ppp.h
|
||||
components/esp_netif/include/esp_netif_slip.h
|
||||
components/esp_netif/include/esp_netif_sta_list.h
|
||||
components/esp_netif/loopback/esp_netif_loopback.c
|
||||
components/esp_netif/lwip/esp_netif_lwip.c
|
||||
components/esp_netif/lwip/esp_netif_lwip_defaults.c
|
||||
components/esp_netif/lwip/esp_netif_lwip_internal.h
|
||||
components/esp_netif/lwip/esp_netif_lwip_ppp.c
|
||||
@ -1776,7 +1775,6 @@ components/lwip/port/esp32/include/arch/vfs_lwip.h
|
||||
components/lwip/port/esp32/include/arpa/inet.h
|
||||
components/lwip/port/esp32/include/debug/lwip_debug.h
|
||||
components/lwip/port/esp32/include/lwip_default_hooks.h
|
||||
components/lwip/port/esp32/include/lwipopts.h
|
||||
components/lwip/port/esp32/include/netdb.h
|
||||
components/lwip/port/esp32/include/netif/dhcp_state.h
|
||||
components/lwip/port/esp32/include/netif/ethernetif.h
|
||||
|
Loading…
Reference in New Issue
Block a user