zephyr/subsys/net/Kconfig.hostname
Pragati Garg 0d8783ac0f net: posix: fix hostname config conflict with unique updates
Decouple NET_HOSTNAME_MAX_LEN from NET_HOSTNAME_DYNAMIC to resolve
Kconfig conflict when using POSIX networking with unique hostname
updates. This restores functionality that worked in Zephyr 3.6.

- Remove forced selection of NET_HOSTNAME_DYNAMIC from POSIX_NETWORKING
- Make NET_HOSTNAME_MAX_LEN available independently
- Add build assertions for hostname length validation
- Update test configurations for new dependency structure

Fixes: zephyrproject-rtos#95811
Signed-off-by: Pragati Garg <pragatigarg@eaton.com>
2026-04-21 18:39:36 -04:00

58 lines
1.7 KiB
Text

# Hostname config
# Copyright (c) 2017 Intel Corporation.
# SPDX-License-Identifier: Apache-2.0
config NET_HOSTNAME_ENABLE
bool "Add hostname to the device"
help
This is used for example in mDNS to respond to <hostname>.local
mDNS queries.
config NET_HOSTNAME_MAX_LEN
int "The maximum allowed hostname length"
# This corresponds to "zephyr"
default 6 if !NET_HOSTNAME_ENABLE
default 63
help
This will set the number of bytes allocated for the hostname.
When NET_HOSTNAME_ENABLE is disabled, this defaults to 6 to
accommodate the default "zephyr" hostname.
if NET_HOSTNAME_ENABLE
config NET_HOSTNAME
string "The hostname of this device"
default "zephyr"
help
The string should be a valid hostname.
config NET_HOSTNAME_DYNAMIC
bool "Allow the hostname to be set by the application"
depends on !NET_HOSTNAME_UNIQUE_UPDATE
help
This will enable the net_hostname_set() function. NET_HOSTNAME
will be used as default hostname.
config NET_HOSTNAME_UNIQUE
bool "Make hostname unique"
help
This will append link address to NET_HOSTNAME to create a unique
hostname. For example, zephyr00005e005357 could be the hostname
if this setting is enabled.
config NET_HOSTNAME_UNIQUE_UPDATE
bool "Update unique hostname"
depends on NET_HOSTNAME_UNIQUE
help
This will update the unique hostname on link address changes. By
default, this option is disabled, which means the unique hostname
is set once at start-up and is not updated afterwards.
module = NET_HOSTNAME
module-dep = NET_LOG
module-str = Log level for hostname configuration
module-help = Enables hostname configuration code to output debug messages.
source "subsys/net/Kconfig.template.log_config.net"
endif