meta-google: gbmc-bridge: Use networkctl reconfigure

The other workarounds to try and restart networkd tend to result in
flaky behavior. We get much more consistent and fast reconfigurations if
we target the bridge directly.

Change-Id: I3222eba4a2d2b71e3893f93643f412e5238ee60e
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in
index f51b033..e033fd2 100644
--- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in
+++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in
@@ -63,25 +63,13 @@
     printf '%s' "$contents" >"$file"
   done
 
-  # We only restart networkd if we know we have a management network available
-  # on the machine and networkd is already running.
-  if [ -e /lib/systemd/network/-bmc-gbmcbrdummy.network ] && \
-     ! systemctl status systemd-networkd | grep -q inactive; then
-    echo "Restarting networkd" >&2
-    # HACK: We can't restart systemd-networkd without coordinating with
-    # phosphor-networkd, otherwise it will sometimes detect interfaces as
-    # unmanaged because it reads administrative state to determine enabled
-    # status. Adding an IP to phosphor-networkd is guaranteed to trigger the
-    # restart we want, and systemd-network will never actually accept the
-    # new value.
-    local start=$SECONDS
-    while (( SECONDS - start < 30 )); do
-      busctl call xyz.openbmc_project.Network \
-        /xyz/openbmc_project/network/gbmcbrdummy \
-        xyz.openbmc_project.Network.IP.Create IP ssys \
-        xyz.openbmc_project.Network.IP.Protocol.IPv6 ff02::1 128 '' && break
-      sleep 1
-    done
+  # Ensure that systemd-networkd performs a reconfiguration as it doesn't
+  # currently check the mtime of drop-in files.
+  touch -c /lib/systemd/network/*-bmc-gbmcbr.network
+
+  if [ "$(systemctl is-active systemd-networkd)" != 'inactive' ]; then
+    networkctl reload
+    networkctl reconfigure gbmcbr
   fi
 }
 
diff --git a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-ula.sh b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-ula.sh
index 6989710..8e28d39 100644
--- a/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-ula.sh
+++ b/meta-google/recipes-google/networking/gbmc-bridge/gbmc-br-ula.sh
@@ -40,10 +40,13 @@
     printf '%s' "$contents" >"$netfile"
   done
 
-  # We have to add the address after writing the systemd config to ensure we
-  # don't race with reconfiguration and drop the address.
-  if [ -n "$addr" ]; then
-    ip addr replace "$addr" dev gbmcbr
+  # Ensure that systemd-networkd performs a reconfiguration as it doesn't
+  # currently check the mtime of drop-in files.
+  touch -c /lib/systemd/network/*-bmc-gbmcbr.network
+
+  if [ "$(systemctl is-active systemd-networkd)" != 'inactive' ]; then
+    networkctl reload
+    networkctl reconfigure gbmcbr
   fi
 }