dhcpcd-discuss

Re: Configuration profiles handling by libdhcpcd

Roy Marples

Fri May 31 15:43:19 2019

Hi

On 27/05/2019 21:38, Langlois, Maxime wrote:
Hi Roy,

I'm experimenting with libdhcpcd to manage the configuration and get
update on interfaces status.

I noticed a weird behavior: when switching from static to dhcp on an
interface which is using a static fallbcak profile, the profile gets
dropped along with the static settings.

Let me clarify this with an example:


Initial settings file:

interface eth1
static ip_address=192.201.13.2/24
static routers=192.201.13.1
fallback static-eth1

profile static-eth1
static ip_address=192.168.3.31/24
static routers=192.168.3.1


Settings file after switching eth1 interface to DHCP using libdhcpcd:

interface eth1
fallback static-eth1
profile static-eth1


Conclusion is that anything that is static and linked to eth1 gets dropped. However I think the fallback profile should have been preserved.

Can you try this patch please?
Let me know if it works!

Roy

diff --git a/src/libdhcpcd/config.c b/src/libdhcpcd/config.c
index 53949f4..ba4bc07 100644
--- a/src/libdhcpcd/config.c
+++ b/src/libdhcpcd/config.c
@@ -267,7 +267,9 @@ config(DHCPCD_CONNECTION *con, int action, const char *block, const char *name,
                } else {
                        /* Start of a block, skip if not ours */
                        if (strcmp(option, "interface") == 0 ||
-                           strcmp(option, "ssid") == 0)
+                           strcmp(option, "ssid") == 0 ||
+                           strcmp(option, "profile") == 0 ||
+                           strcmp(option, "fallback") == 0)
                        {
                                if (block && name && line &&
                                    strcmp(option, block) == 0 &&



Follow-Ups:
Re: Configuration profiles handling by libdhcpcdLanglois, Maxime
References:
static routers not exposed in hooksLanglois, Maxime
Re: static routers not exposed in hooksRoy Marples
Configuration profiles handling by libdhcpcdLanglois, Maxime
Archive administrator: postmaster@marples.name