meta-google: gbmc-bridge: Add optional fixed IP offset
Some of our machines do not support receiving DHCP packets to determine
their addresses, and need a workaround to piggyback off DHCPd nodes in
the system.
This change allows a machine to set a fixed numeric offset address,
where it can read the correct BMC prefix from RAs of other nodes and
then generate a fixed address for itself.
Tested: Ran on a 2 node BMC machine with one using this fixed scheme.
Verified that it correctly found an address and hostname.
Change-Id: Ibd79f800a582db44cf2ad469dbe0a75f13dcaeed
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meta-google/recipes-google/networking/gbmc-bridge.bb b/meta-google/recipes-google/networking/gbmc-bridge.bb
index a9f2761..3c51c16 100644
--- a/meta-google/recipes-google/networking/gbmc-bridge.bb
+++ b/meta-google/recipes-google/networking/gbmc-bridge.bb
@@ -20,6 +20,8 @@
file://gbmc-br-hostname.sh \
file://gbmc-br-hostname.service \
file://gbmc-ip-from-ra.sh \
+ file://gbmc-br-ip-from-ra.sh.in \
+ file://gbmc-br-ip-from-ra.service \
file://gbmc-br-gw-src.sh \
file://gbmc-br-nft.sh \
file://gbmc-br-dhcp.sh \
@@ -57,10 +59,18 @@
gbmc-br-dhcp.service \
gbmc-br-dhcp-term.service \
gbmc-br-load-ip.service \
+ ${@"gbmc-br-ip-from-ra.service" if d.getVar('GBMC_BR_FIXED_OFFSET') != "" else ""} \
"
GBMC_BR_MAC_ADDR ?= ""
+# Enables the assignment of IP address and hostname by discovering the
+# machine name and BMC prefix from another BMC on the bridge network.
+# This is intended only to be used when there is a single expansion tray
+# on the BMC network. If more than one machine uses this feature with the
+# same offset in the same machine network, it will collide with others.
+GBMC_BR_FIXED_OFFSET ?= ""
+
# Generated via https://cd34.com/rfc4193/ based on a MAC from a machine I own
# and we allocated it downstream. Intended to only be used within a complete
# system of multiple network endpoints.
@@ -145,6 +155,12 @@
install -d ${D}/${bindir}
install -m0755 ${WORKDIR}/gbmc-start-dhcp.sh ${D}${bindir}/
+
+ if [ -n "${GBMC_BR_FIXED_OFFSET}" ]; then
+ sed 's,@IP_OFFSET@,${GBMC_BR_FIXED_OFFSET},' ${WORKDIR}/gbmc-br-ip-from-ra.sh.in >${WORKDIR}/gbmc-br-ip-from-ra.sh
+ install -m0755 ${WORKDIR}/gbmc-br-ip-from-ra.sh ${D}${libexecdir}/
+ install -m0644 ${WORKDIR}/gbmc-br-ip-from-ra.service ${D}${systemd_system_unitdir}/
+ fi
}
do_rm_work:prepend() {