mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2025-12-15 11:22:43 +03:00
imds-net-sync should only work with secondary ipv4s on an interface
This commit is contained in:
parent
ed67197e7b
commit
fda9a350a1
@ -49,14 +49,15 @@ iface_ip6s() {
|
||||
}
|
||||
|
||||
imds_ip4s() {
|
||||
local ip4s=$(imds "@nic:$IFACE,@ipv4")
|
||||
local ip4=$(imds "@nic:$IFACE,@ipv4")
|
||||
local ip4s=$(echo "$ip4" | tail +2) # secondary IPv4s
|
||||
local ip4p ip4_cidr ip4_gw
|
||||
|
||||
# non-eth0 interfaces need custom route tables
|
||||
#
|
||||
if [ "$IFACE" != eth0 ] && [ -n "$ip4s" ] &&
|
||||
[ -z $(ip +F -4 route show table "$RTABLE" 2>/dev/null) ]; then
|
||||
ip4p=$(echo "$ip4s" | head -1) # primary IPv4
|
||||
ip4p=$(echo "$ip4" | head -1) # primary IPv4
|
||||
ip4_cidr=$(imds "@nic:$IFACE,@ipv4-net") # TODO: get from iface instead?
|
||||
# TODO: this may not hold true for non-AWS clouds
|
||||
ip4_gw=$(echo "$ip4_cidr" | cut -d/ -f1 |
|
||||
@ -68,6 +69,8 @@ imds_ip4s() {
|
||||
echo "$ip4s"
|
||||
}
|
||||
|
||||
# TODO: 3.18+ when we use dhcpcd for ipv4 & ipv6, we only need to do secondary IPv6s
|
||||
# circle back and see how amazon-ec2-net-utils is handling everything these days
|
||||
imds_ip6s() {
|
||||
local ip6s gw tries=20
|
||||
ip6s=$(imds "@nic:$IFACE,@ipv6")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user