summaryrefslogtreecommitdiff
path: root/meta-google
diff options
context:
space:
mode:
authorYuxiao Zhang <yuxiaozhang@google.com>2023-05-06 02:10:16 +0300
committerYuxiao Zhang <yuxiaozhang@google.com>2023-05-10 02:29:25 +0300
commit4382c5e98994472cbc896c1c241e534e6ef551c3 (patch)
tree46107110d411ef81e5591697e2aac01df77ee1c3 /meta-google
parenta89e204d25cd9a4db06165c8c8095eb8ebfaae18 (diff)
downloadopenbmc-4382c5e98994472cbc896c1c241e534e6ef551c3.tar.xz
meta-google: gbmc-bridge: skip gbmcbr config if ip does not change
GBMC bridge ip is set up via different sources at different moments. This change skips the unnecessary reconfiguration so that the network will be less disturbed. Change-Id: I0ecbad0693398b32037c6be7228444a7d7f89076 Signed-off-by: Yuxiao Zhang <yuxiaozhang@google.com>
Diffstat (limited to 'meta-google')
-rw-r--r--meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-lib.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-lib.sh b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-lib.sh
index d3bf95d89b..95516d6107 100644
--- a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-lib.sh
+++ b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-lib.sh
@@ -70,6 +70,9 @@ gbmc_br_reload_ip() {
return 0
fi
+ # Remove legacy network configuration
+ rm -rf /etc/systemd/network/{00,}-bmc-gbmcbr.network.d
+
local pfx_bytes=()
if ! ip_to_bytes pfx_bytes "$ip"; then
echo "Ignoring Invalid IPv6: $ip" >&2
@@ -111,17 +114,17 @@ EOF
gbmc_br_set_ip() {
local ip="${1-}"
-
+ local old_ip=
if [ -n "$ip" ]; then
+ old_ip="$(cat /var/google/gbmc-br-ip 2>/dev/null)"
+ [ "$old_ip" != "$ip" ] || return
mkdir -p /var/google || return
echo "$ip" >/var/google/gbmc-br-ip || return
else
+ [ -f "/var/google/gbmc-br-ip" ] || return
rm -rf /var/google/gbmc-br-ip
fi
- # Remove legacy network configuration
- rm -rf /etc/systemd/network/{00,}-bmc-gbmcbr.network.d
-
gbmc_br_run_hooks GBMC_BR_LIB_SET_IP_HOOKS "$ip" || return
gbmc_br_reload_ip "$ip"