-
Notifications
You must be signed in to change notification settings - Fork 136
Description
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. 😊