Skip to content

Commit

Permalink
Merge pull request #2312 from cybertron/static-dhcp-multi-addr
Browse files Browse the repository at this point in the history
Bug 1910165: [baremetal] Correctly handle multiple ipv6 addresses on interface
  • Loading branch information
openshift-merge-robot committed Jan 11, 2021
2 parents e70033b + bb8703c commit 9347e45
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions templates/common/baremetal/files/NetworkManager-static-dhcpv6.yaml
Expand Up @@ -11,7 +11,8 @@ contents:
exit 0
fi
LEASE_TIME=$(ip -j -6 a show "$DEVICE_IFACE" | jq -r '.[].addr_info[] | select(.scope=="global") | select(.deprecated!=true) | .preferred_life_time')
LEASE_TIME=$(ip -j -6 a show "$DEVICE_IFACE" | jq -r ".[].addr_info[] | select(.scope==\"global\") | select(.deprecated!=true) | select(.local==\"$DHCP6_IP6_ADDRESS\") | .preferred_life_time")
PREFIX_LEN=$(ip -j -6 a show "$DEVICE_IFACE" | jq -r ".[].addr_info[] | select(.scope==\"global\") | select(.deprecated!=true) | select(.local==\"$DHCP6_IP6_ADDRESS\") | .prefixlen")
if [ ${LEASE_TIME:-0} -lt 4294967295 ]
then
Expand All @@ -27,15 +28,7 @@ contents:
exit 0
fi
IPS=($IP6_ADDRESS_0)
# For ipv6 we have two addresses: DHCP and link-local. Make sure we're using the right one.
CHECK_STR="^${DHCP6_IP6_ADDRESS}/"
if [[ $IP6_ADDRESS_1 =~ ${CHECK_STR} ]]
then
IPS=($IP6_ADDRESS_1)
fi
CIDR=${IPS[0]}
CIDR="$DHCP6_IP6_ADDRESS/$PREFIX_LEN"
nmcli con mod "$CONNECTION_ID" ipv6.addresses "$CIDR"
nmcli con mod "$CONNECTION_ID" connection.autoconnect "yes"
nmcli con mod "$CONNECTION_ID" ipv6.method "manual"
Expand Down

0 comments on commit 9347e45

Please sign in to comment.