From 7d346b7258b63ddc31c007b8b63b11aaa8d07b54 Mon Sep 17 00:00:00 2001 From: "William A. Kennington III" Date: Fri, 29 Apr 2022 14:26:05 -0700 Subject: meta-google: gbmc-ncsi-config: Don't mark explicit addresses deprecated We want the machine to correctly report that the address was assigned from the host. If we don't do this it can sometimes become unassigned. Change-Id: I5de00c53c5fa831025b9ffdf1ad194b094075194 Signed-off-by: William A. Kennington III --- .../ncsi/files/gbmc-ncsi-br-deprecated-ips.sh.in | 37 ++++++++++++++-------- 1 file changed, 23 insertions(+), 14 deletions(-) (limited to 'meta-google') diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-deprecated-ips.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-deprecated-ips.sh.in index 96037ea450..fdfa87803f 100644 --- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-deprecated-ips.sh.in +++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-deprecated-ips.sh.in @@ -20,6 +20,25 @@ gbmc_ncsi_br_deprecated_ips_init= gbmc_ncsi_br_deprecated_ips_confip= gbmc_ncsi_br_deprecated_ips_lastip= +gbmc_ncsi_br_deprecated_ips_addr_contents() { + local addr="$1" + + # If our address is assigned explicitly, don't mark it deprecated + local line + for line in $(grep '^Address=' /etc/systemd/network/*-bmc-@NCSI_IF@.network); do + # Remove `Address=` on the input line + local apfx="$(echo "$line" | sed 's,^[^=]*=,,')" + # ip_pfx_concat is used to normalize the address string for comparison + [[ "$addr/128" == "$(ip_pfx_concat "$apfx" ::)" ]] && return + done + + cat <