logging: backend: net: avoid early enabling

Avoid early enabling of the syslog backend in
the the dhcpv4 options parser.

When CONFIG_NET_IPV4_ACD is enabled, the assigned ip address has
not been checked, when the other dhcpv4 options are parsed, this would
lead to the syslog backend being enabled before the src ip address
is valid, so we get lots of warnings about dropd packets, this fixes
it at least on start. We will still get the warnings, when the iface
goes down and then up later.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit is contained in:
Fin Maaß 2025-05-05 10:18:22 +02:00 committed by Benjamin Cabé
commit e7047059b1

View file

@ -1205,9 +1205,10 @@ static bool dhcpv4_parse_options(struct net_pkt *pkt,
log_server.sin_family = AF_INET;
log_backend_net_set_ip((struct sockaddr *)&log_server);
#ifdef CONFIG_LOG_BACKEND_NET_AUTOSTART
log_backend_net_start();
#endif
if (IS_ENABLED(CONFIG_LOG_BACKEND_NET_AUTOSTART) &&
!IS_ENABLED(CONFIG_NET_CONFIG_SETTINGS)) {
log_backend_net_start();
}
NET_DBG("options_log_server: %s", net_sprint_ipv4_addr(&log_server));