Skip to content

DHCP Issue with WAN Interface Rename on RDKB (eth0 to erouter0) #504

@ngxquanganh

Description

@ngxquanganh

Hey folks,

First time posting an issue here, so hope I’m doing this right! I’m working on an RDKB device where the WAN interface gets renamed from eth0 to erouter0 by the GwProvApp-EthWan app (line 1436 in gw_prov_ethwan_sm.c). This happens after the dhcpcd service starts.

The Problem

The issue seems to come from if-linux.c, line 1138:

    if (strcmp(ifp->name, ifn) != 0) {
        dhcpcd_handleinterface(ctx, -1, ifn);
        dhcpcd_handleinterface(ctx, 1, ifn);
        return 0;
    }

I added some debug logs and noticed it’s trying to stop and start the new interface name (ifn, erouter0) instead of stopping the old name (ifp->name, eth0) and starting the new one. This messes up the DHCP process, leaving /etc/resolv.conf empty with no DNS info.

My Fix

I looked at the commit Linux: Improve interface renaming and changed the code to:

    if (strcmp(ifp->name, ifn) != 0) {
        dhcpcd_handleinterface(ctx, -1, ifp->name); // Stop old interface
        dhcpcd_handleinterface(ctx, 1, ifn);        // Start new interface
        return 0;
    }

After this, DHCP works fine, and /etc/resolv.conf gets the right DNS info.

Questions

Does this change look okay, or am I missing something the original code intended?
Could this break anything else?
Any advice for a newbie like me?
Thanks for checking this out! Excited to help out. 😊

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions