Skip to content

Commit

Permalink
Delete DHCP IP object while moving from DHCP to static (openbmc#48)
Browse files Browse the repository at this point in the history
Currently when DHCP is enabled, if user configures same DHCP IP
as static IP config then networkd disable DHCP, fails to add
static entry and return error to the client.

This issue only seen if user configures static IP which is same as
DHCP IP.

Tested by:
Configured same DHCP IP as static IP via redfish

Signed-off-by: Ravi Teja <[email protected]>
Change-Id: I7b703c0e70867f79212c3f8955d7f88d22b8328a
  • Loading branch information
raviteja-b authored Jul 27, 2022
1 parent a1e534b commit 805260e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ethernet_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ ObjectPath EthernetInterface::ip(IP::Protocol protType, std::string ipaddress,
log<level::INFO>("DHCP enabled on the interface"),
entry("INTERFACE=%s", interfaceName().c_str());
disableDHCP(protType);
// Delete the IP address object and that reloads the networkd
// to allow the same IP address to be set as Static IP
deleteObject(ipaddress);
}

IP::AddressOrigin origin = IP::AddressOrigin::Static;
Expand Down

0 comments on commit 805260e

Please sign in to comment.