meta-google: gbmc-ncsi-config: ip-from-ra: Fix rdisc latency
There will be undesirable buffering running rdisc directly from a
subshell, if we run it under `script` we will not suffer from output
buffering and instead immediately receive the printed lines from the RS
packet.
Tested: Verified on a smartnic system to prove that the address is still
set.
Change-Id: I3f340b0c731d5e6969b38008f30b388a5f749866
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in
index d0445d3..bf1c441 100755
--- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in
+++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in
@@ -60,6 +60,8 @@
while true; do
start=$SECONDS
while read -r line; do
+ # `script` terminates all lines with a CRLF, remove it
+ line="${line:0:-1}"
if [ -z "$line" ]; then
hextet=
pfx=
@@ -87,7 +89,7 @@
set_net || true
set_host || true
fi
- done < <(rdisc6 -d -m "$NCSI_IF" -w $(( w * 1000 )) 2>/dev/null)
+ done < <(exec script -q -c "rdisc6 -d -m $NCSI_IF -w $(( w * 1000 ))" /dev/null 2>/dev/null)
# If rdisc6 exits early we still want to wait the full `w` time before
# starting again.
(( timeout = start + w - SECONDS ))