From 47f1bc4d818fac1ef1ad958a4bcba4954df09bae Mon Sep 17 00:00:00 2001 From: Claes Mogren Date: Fri, 2 Oct 2020 09:57:34 -0700 Subject: [PATCH] Match primary ENI IP correctly Fixes #1246 --- scripts/init.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/init.sh b/scripts/init.sh index df37afaadb..ef1e1e86a7 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -25,7 +25,7 @@ done echo "Configure rp_filter loose... " TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 60") HOST_IP=$(curl -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/local-ipv4) -PRIMARY_IF=$(ip -4 -o a | grep "$HOST_IP" | awk '{print $2}') +PRIMARY_IF=$(ip -4 -o a | grep "$HOST_IP/" | awk '{print $2}') sysctl -w "net.ipv4.conf.$PRIMARY_IF.rp_filter=2" cat "/proc/sys/net/ipv4/conf/$PRIMARY_IF/rp_filter"