Initial commit
This commit is contained in:
Executable
+78
@@ -0,0 +1,78 @@
|
||||
From 8095b90a438aebeba61721b30f0f7bd5f865c666 Mon Sep 17 00:00:00 2001
|
||||
From: "Chen.Zhao" <zhao.chen@luxshare-ict.com>
|
||||
Date: Tue, 26 Aug 2025 11:01:18 +0800
|
||||
Subject: [PATCH] Fix ipv4 and ipv6 ip issue Openbmc use dbus property to
|
||||
control ipv4/ipv6 ip mode: .DHCP4
|
||||
property b true emits-change
|
||||
writable .DHCP6 property b
|
||||
true emits-change writable .DHCPEnabled
|
||||
property s
|
||||
"xyz.openbmc_project.Network.Ethernet... emits-change writable
|
||||
|
||||
DHCP4=true, DHCP6=true, set DHCPEnabled to xyz.openbmc_project.Network.EthernetInterface.DHCPConf.both
|
||||
DHCP4=true, DHCP6=false, set DHCPEnabled to xyz.openbmc_project.Network.EthernetInterface.DHCPConf.v4
|
||||
DHCP4=false, DHCP6=true, set DHCPEnabled to xyz.openbmc_project.Network.EthernetInterface.DHCPConf.v6
|
||||
DHCP4=false, DHCP6=false, set DHCPEnabled to xyz.openbmc_project.Network.EthernetInterface.DHCPConf.none
|
||||
|
||||
re-write the EthernetInterface::dhcp4 and EthernetInterface::dhcp6 function to get current value and set value
|
||||
---
|
||||
src/ethernet_interface.cpp | 24 ++++++++++++++++++++----
|
||||
1 file changed, 20 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
|
||||
index 31c6145..43a68a8 100644
|
||||
--- a/src/ethernet_interface.cpp
|
||||
+++ b/src/ethernet_interface.cpp
|
||||
@@ -388,8 +388,10 @@ bool EthernetInterface::ipv6AcceptRA(bool value)
|
||||
|
||||
bool EthernetInterface::dhcp4(bool value)
|
||||
{
|
||||
- if (dhcp4() != EthernetInterfaceIntf::dhcp4(value))
|
||||
+ bool oldValue = dhcp4(); // get current value
|
||||
+ if (value != oldValue) // compare current value and set value
|
||||
{
|
||||
+ EthernetInterfaceIntf::dhcp4(value); //set new value
|
||||
writeConfigurationFile();
|
||||
manager.get().reloadConfigs();
|
||||
}
|
||||
@@ -398,8 +400,10 @@ bool EthernetInterface::dhcp4(bool value)
|
||||
|
||||
bool EthernetInterface::dhcp6(bool value)
|
||||
{
|
||||
- if (dhcp6() != EthernetInterfaceIntf::dhcp6(value))
|
||||
+ bool oldValue = dhcp6(); // get current value
|
||||
+ if (value != oldValue) // compare current value and set value
|
||||
{
|
||||
+ EthernetInterfaceIntf::dhcp6(value); //set new value
|
||||
writeConfigurationFile();
|
||||
manager.get().reloadConfigs();
|
||||
}
|
||||
@@ -684,11 +688,23 @@ void EthernetInterface::writeConfigurationFile()
|
||||
auto& network = config.map["Network"].emplace_back();
|
||||
auto& lla = network["LinkLocalAddressing"];
|
||||
#ifdef LINK_LOCAL_AUTOCONFIGURATION
|
||||
- lla.emplace_back("yes");
|
||||
+ if (dhcp4() && dhcp6())
|
||||
+ {
|
||||
+ lla.emplace_back("yes");
|
||||
+ }
|
||||
+ else if (dhcp4())
|
||||
+ {
|
||||
+ lla.emplace_back("ipv4");
|
||||
+ }
|
||||
+ else if (dhcp6())
|
||||
+ {
|
||||
+ lla.emplace_back("ipv6");
|
||||
+ }
|
||||
#else
|
||||
lla.emplace_back("no");
|
||||
#endif
|
||||
- network["IPv6AcceptRA"].emplace_back(ipv6AcceptRA() ? "true" : "false");
|
||||
+ network["IPv6AcceptRA"].emplace_back(
|
||||
+ (ipv6AcceptRA() && dhcp6()) ? "true" : "false");
|
||||
network["DHCP"].emplace_back(dhcp4() ? (dhcp6() ? "true" : "ipv4")
|
||||
: (dhcp6() ? "ipv6" : "false"));
|
||||
{
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
From dc27450fcd8cd509d540afccb06974e92a117cd6 Mon Sep 17 00:00:00 2001
|
||||
From: roly <Rolyli.Li@luxshare-ict.com>
|
||||
Date: Fri, 8 Nov 2024 14:31:08 +0800
|
||||
Subject: [PATCH] Fix static ip still exist after enable dhcp
|
||||
|
||||
---
|
||||
src/ethernet_interface.cpp | 19 ++++++++++++++++++-
|
||||
src/ethernet_interface.hpp | 12 ++++++++++++
|
||||
2 files changed, 30 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
|
||||
index 2851a1b..126255c 100644
|
||||
--- a/src/ethernet_interface.cpp
|
||||
+++ b/src/ethernet_interface.cpp
|
||||
@@ -266,6 +266,22 @@ ObjectPath EthernetInterface::ip(IP::Protocol protType, std::string ipaddress,
|
||||
Argument::ARGUMENT_VALUE(ipaddress.c_str()));
|
||||
}
|
||||
std::optional<stdplus::SubnetAny> ifaddr;
|
||||
+
|
||||
+ if (dhcpIsEnabled(protType))
|
||||
+ {
|
||||
+ log<level::INFO>("DHCP enabled on the interface, disabling");
|
||||
+ switch (protType)
|
||||
+ {
|
||||
+ case IP::Protocol::IPv4:
|
||||
+ dhcp4(false);
|
||||
+ break;
|
||||
+ case IP::Protocol::IPv6:
|
||||
+ dhcp6(false);
|
||||
+ ipv6AcceptRA(false);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
try
|
||||
{
|
||||
if (prefixLength == 0)
|
||||
@@ -702,7 +718,8 @@ void EthernetInterface::writeConfigurationFile()
|
||||
auto& address = network["Address"];
|
||||
for (const auto& addr : addrs)
|
||||
{
|
||||
- if (originIsManuallyAssigned(addr.second->origin()))
|
||||
+ if (originIsManuallyAssigned(addr.second->origin()) &&
|
||||
+ !dhcpIsEnabled(addr.second->type()))
|
||||
{
|
||||
address.emplace_back(stdplus::toStr(addr.first));
|
||||
}
|
||||
diff --git a/src/ethernet_interface.hpp b/src/ethernet_interface.hpp
|
||||
index 0e9c536..b927e69 100644
|
||||
--- a/src/ethernet_interface.hpp
|
||||
+++ b/src/ethernet_interface.hpp
|
||||
@@ -129,6 +129,18 @@ class EthernetInterface : public Ifaces
|
||||
using EthernetInterfaceIntf::dhcp6;
|
||||
bool dhcp6(bool value) override;
|
||||
|
||||
+ inline bool dhcpIsEnabled(IP::Protocol family) const
|
||||
+ {
|
||||
+ switch (family)
|
||||
+ {
|
||||
+ case IP::Protocol::IPv6:
|
||||
+ return dhcp6();
|
||||
+ case IP::Protocol::IPv4:
|
||||
+ return dhcp4();
|
||||
+ }
|
||||
+ throw std::logic_error("Unreachable");
|
||||
+ }
|
||||
+
|
||||
inline bool dhcpIsEnabled(stdplus::In4Addr) const
|
||||
{
|
||||
return dhcp4();
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
From c9ad304d3e9a40cf58e6d054a3b030cac4ca07d6 Mon Sep 17 00:00:00 2001
|
||||
From: "Chen.Zhao" <zhao.chen@luxshare-ict.com>
|
||||
Date: Fri, 9 May 2025 09:40:16 +0800
|
||||
Subject: [PATCH] Fix the issue where the gateway configuration is not taking
|
||||
effect
|
||||
|
||||
---
|
||||
src/ethernet_interface.cpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
|
||||
index 126255c..82e70a2 100644
|
||||
--- a/src/ethernet_interface.cpp
|
||||
+++ b/src/ethernet_interface.cpp
|
||||
@@ -891,6 +891,7 @@ std::string EthernetInterface::defaultGateway(std::string gateway)
|
||||
if (gateway != defaultGateway())
|
||||
{
|
||||
gateway = EthernetInterfaceIntf::defaultGateway(std::move(gateway));
|
||||
+ writeConfigurationFile();
|
||||
manager.get().reloadConfigs();
|
||||
}
|
||||
return gateway;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
From 9caa64de9ce05305682e97057962fced2b5d7be7 Mon Sep 17 00:00:00 2001
|
||||
From: Patrick Rudolph <patrick.rudolph@9elements.com>
|
||||
Date: Mon, 4 Sep 2023 11:22:31 +0200
|
||||
Subject: [PATCH] ethernet_interface: Fix configuration
|
||||
|
||||
Include config.h to satisfy #ifdefs used in code.
|
||||
Fixes config 'persist-mac' and 'uboot-env' having no effect.
|
||||
|
||||
Change-Id: I27a4984dc069871dc757388494fcf145069a6143
|
||||
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
|
||||
---
|
||||
src/ethernet_interface.cpp | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/ethernet_interface.cpp b/src/ethernet_interface.cpp
|
||||
index 2851a1b..0427363 100644
|
||||
--- a/src/ethernet_interface.cpp
|
||||
+++ b/src/ethernet_interface.cpp
|
||||
@@ -1,3 +1,4 @@
|
||||
+#include "config.h"
|
||||
|
||||
#include "ethernet_interface.hpp"
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://0001-Fix-static-ip-still-exist-after-enable-dhcp.patch \
|
||||
file://0001-Fix-the-issue-where-the-gateway-configuration-is-not.patch \
|
||||
file://0001-ethernet_interface-Fix-configuration.patch \
|
||||
file://0001-Fix-ipv4-and-ipv6-ip-issue.patch \
|
||||
"
|
||||
Reference in New Issue
Block a user