diff --git a/components/esp_netif/include/esp_netif_types.h b/components/esp_netif/include/esp_netif_types.h index b302e49e3ad8..cc7a37b9c49d 100644 --- a/components/esp_netif/include/esp_netif_types.h +++ b/components/esp_netif/include/esp_netif_types.h @@ -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 */ diff --git a/components/esp_netif/lwip/esp_netif_lwip.c b/components/esp_netif/lwip/esp_netif_lwip.c index 2e847146fe82..90f29f07ce2a 100644 --- a/components/esp_netif/lwip/esp_netif_lwip.c +++ b/components/esp_netif/lwip/esp_netif_lwip.c @@ -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 #include @@ -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; diff --git a/components/lwip/Kconfig b/components/lwip/Kconfig index dae592cafb82..560598d1bf66 100644 --- a/components/lwip/Kconfig +++ b/components/lwip/Kconfig @@ -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 diff --git a/components/lwip/port/esp32/include/lwipopts.h b/components/lwip/port/esp32/include/lwipopts.h index b9cfe17aca96..47215e99dae6 100644 --- a/components/lwip/port/esp32/include/lwipopts.h +++ b/components/lwip/port/esp32/include/lwipopts.h @@ -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 ----------