diff options
author | William A. Kennington III <wak@google.com> | 2022-05-10 20:30:25 +0300 |
---|---|---|
committer | William A. Kennington III <wak@google.com> | 2022-05-11 02:42:31 +0300 |
commit | 10dc43a1a276869d0500fcf7c081ac6e914b1182 (patch) | |
tree | 2223b8b73ff4e35f5fc3a03f9c5e30f3f22cb057 /meta-google | |
parent | e6857814981dbbdaf24eaff796c1dd4bc4185743 (diff) | |
download | openbmc-10dc43a1a276869d0500fcf7c081ac6e914b1182.tar.xz |
meta-google: gbmc-ncsi-config: Allow BMC address assignment
We need to allow BMC address assignment so that we can deprecate the
impersonation assignment we are currently performing on the BMC.
Change-Id: Ia153d0a5692876ef2c36b71230d597e51904d467
Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'meta-google')
-rw-r--r-- | meta-google/recipes-google/ncsi/files/gbmc-ncsi-br-pub-addr.sh.in | 27 | ||||
-rw-r--r-- | meta-google/recipes-google/ncsi/files/gbmc-ncsi-nft.sh.in | 7 |
2 files changed, 25 insertions, 9 deletions
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 793403348e..9f008a9a44 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 @@ -29,21 +29,30 @@ gbmc_ncsi_br_pub_addr_update() { local pfx_bytes=() if [ -n "$gbmc_ncsi_br_pub_addr_lastip" ]; then ip_to_bytes pfx_bytes "$gbmc_ncsi_br_pub_addr_lastip" - # Ensure we don't have more than a /64 address - local i - for (( i = 8; i < 16; ++i )); do - if (( pfx_bytes[$i] != 0 )); then - pfx_bytes=() - break - fi - done + # Ensure we have a /64 or an fdxx address + if (( pfx_bytes[8] != 0xfd || pfx_bytes[9] == 0 )); then + local i + for (( i = 8; i < 16; ++i )); do + if (( pfx_bytes[$i] != 0 )); then + pfx_bytes=() + break + fi + done + fi fi local contents= if (( ${#pfx_bytes[@]} != 0 )); then pfx_bytes[8]=0xfd + # Save our old prefix assuming we have one + local old_offset="${pfx_bytes[9]}" + if (( old_offset == 0 )); then + old_offset=0x01 + else + pfx_bytes[9]=0x00 + fi local stateless_pfx="$(ip_bytes_to_str pfx_bytes)" - pfx_bytes[9]=0x01 + pfx_bytes[9]="$old_offset" local ncsi_pfx="$(ip_bytes_to_str pfx_bytes)" read -r -d '' contents <<EOF [Network] diff --git a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-nft.sh.in b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-nft.sh.in index 074ec5785f..1f3ba25607 100644 --- a/meta-google/recipes-google/ncsi/files/gbmc-ncsi-nft.sh.in +++ b/meta-google/recipes-google/ncsi/files/gbmc-ncsi-nft.sh.in @@ -36,6 +36,13 @@ gbmc_ncsi_nft_update() { local ip6="$gbmc_ncsi_nft_lastip6" if [ -n "$ip6" ]; then + # Normalize the provided ipv6 address to the impersonated ipv6 address + local ip6_bytes=() + ip_to_bytes ip6_bytes "$ip6" + for (( i=8; i<16; ++i )); do + ip6_bytes[$i]=0 + done + ip6="$(ip_bytes_to_str ip6_bytes)" contents+=" ip6 daddr $ip6/128 goto ncsi_legacy_input"$'\n' fi |