diff options
author | William A. Kennington III <wak@google.com> | 2024-03-22 12:37:48 +0300 |
---|---|---|
committer | William A. Kennington III <wak@google.com> | 2024-03-26 00:37:26 +0300 |
commit | 98da9efd2b44c1d434b872aae9a50f1f7087749b (patch) | |
tree | 184f31be1a500270a15defa9c61660c8c7fbe7b0 | |
parent | aa21bd6cbe54b6c195f044d33f17a180b8f8871f (diff) | |
download | openbmc-98da9efd2b44c1d434b872aae9a50f1f7087749b.tar.xz |
meta-google: gbmc-ncsi-config: ip-from-ra: Fix regex
Our current regex for looking at the DNS search list for a valid
hostname is not quite correct if there is any extra space in the text
output due to the program outputting extra spaces for single item lists.
Tested: Hostname is parsing correctly again on a smartnic platform.
Change-Id: Ibf267b63d5399049b9746b28da124e712c33a144
Signed-off-by: William A. Kennington III <wak@google.com>
-rwxr-xr-x | meta-google/recipes-google/ncsi/files/gbmc-ncsi-ip-from-ra.sh.in | 2 |
1 files changed, 1 insertions, 1 deletions
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 bf1c441d41..4aae5c86b3 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 @@ -75,7 +75,7 @@ while true; do (( t_pfx_b[9] |= 1 )) hextet="fd$(printf '%02x' "${t_pfx_b[9]}")" pfx="$(ip_bytes_to_str t_pfx_b)" - elif [[ "$line" =~ ^'DNS search list'' '*:' '*([^.]+)(.*[.]google[.]com)$ ]]; then + elif [[ "$line" =~ ^'DNS search list'' '*:' '*([^.]+)(.*[.]google[.]com)' '*$ ]]; then # Ideally, we use PCRE and with lookahead and can do this in a single regex # ^([a-zA-Z0-9-]+(?=-n[a-fA-F0-9]{1,4})|[a-zA-Z0-9-]+(?!-n[a-fA-F0-9]{1,4}))[^.]*[.]((?:[a-zA-Z0-9]*[.])*google[.]com)$ # Instead we do multiple steps to extract the needed info |