Skip to content

Commit

Permalink
Only add IP in global scope in multipath
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Jan 23, 2024
1 parent 530d89c commit 8bb06c7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions mptcp/files/usr/bin/multipath
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8bb06c7

Please sign in to comment.