1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-12 18:41:51 +00:00

Only add IP in global scope in multipath

This commit is contained in:
Ycarus (Yannick Chabanois) 2024-01-23 16:23:34 +01:00
parent 530d89c0c1
commit 8bb06c763b

View file

@ -145,8 +145,11 @@ else
ID=$(echo "${endpoint}" | sort | grep "dev $DEVICE " | awk '{print $3}')
IFF=$(echo "${endpoint}" | sort | grep -m 1 -E "dev $DEVICE " | awk '{print $4}')
#IP=$(ip a show $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
[ -f /usr/bin/jsonfilter ] && IP=$(ip -j a show $DEVICE | jsonfilter -e '@[0].addr_info[*].local')
[ -f /usr/bin/jq ] && IP=$(ip -j a show $DEVICE | jq -r '.[0].addr_info[].local')
if [ -f /usr/bin/jsonfilter ]; then
IP=$(ip -j a show $DEVICE scope global | jsonfilter -e '@[0].addr_info[*].local')
elif [ -f /usr/bin/jq ]; then
IP=$(ip -j a show $DEVICE scope global | jq -r '.[0].addr_info[].local')
fi
[ -z "$ID" ] && [ -n "$IP" ] && ID=$(echo "${endpoint}" show | grep "$IP " | awk '{print $3}')
RMID=$(echo "${endpoint}" | grep '::ffff' | awk '{ print $3 }')
[ -n "$RMID" ] && ip mptcp endpoint delete id $RMID 2>&1 >/dev/null