mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
multipath command doesn't check if all is ok when only requesting interface mode
This commit is contained in:
parent
058c3474cc
commit
17c8f0b7c8
1 changed files with 23 additions and 19 deletions
|
@ -131,31 +131,35 @@ if [ -f /proc/sys/net/mptcp/mptcp_enabled ]; then
|
|||
|
||||
printf "0x%02x" $(($(($IFF^$(($IFF&$IFF_MASK))))|$FLAG)) > $FLAG_PATH
|
||||
else
|
||||
# Remove not needed if* interfaces in MPTCP
|
||||
endpoint="$(ip mptcp endpoint show)"
|
||||
[ -n "$endpoint" ] && oldintfs=$(echo "${endpoint}" | grep "dev if" | awk '{ print $3 }')
|
||||
[ -n "$oldintfs" ] && {
|
||||
for oldintf in $oldintfs; do
|
||||
ip mptcp endpoint delete id $oldintf 2>&1 >/dev/null
|
||||
done
|
||||
}
|
||||
endpoint="$(ip mptcp endpoint show)"
|
||||
if [ -n "$TYPE" ]; then
|
||||
# Remove not needed if* interfaces in MPTCP
|
||||
[ -n "$endpoint" ] && oldintfs=$(echo "${endpoint}" | grep "dev if" | awk '{ print $3 }')
|
||||
[ -n "$oldintfs" ] && {
|
||||
for oldintf in $oldintfs; do
|
||||
ip mptcp endpoint delete id $oldintf 2>&1 >/dev/null
|
||||
done
|
||||
endpoint="$(ip mptcp endpoint show)"
|
||||
}
|
||||
fi
|
||||
if [ -n "$endpoint" ]; then
|
||||
ID=$(echo "${endpoint}" | sort | grep "dev $DEVICE " | awk '{print $3}')
|
||||
IFF=$(echo "${endpoint}" | sort | grep -m 1 -E "dev $DEVICE " | awk '{print $4; exit}')
|
||||
fi
|
||||
#IP=$(ip a show $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
|
||||
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')
|
||||
else
|
||||
echo "jsonfilter or jq are required"
|
||||
exit 1
|
||||
if [ -n "$TYPE" ]; then
|
||||
#IP=$(ip a show $DEVICE | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p')
|
||||
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')
|
||||
else
|
||||
echo "jsonfilter or jq are required"
|
||||
exit 1
|
||||
fi
|
||||
[ -z "$ID" ] && [ -n "$IP" ] && [ -n "$endpoint" ] && ID=$(echo "${endpoint}" show | grep "$IP " | awk '{print $3}')
|
||||
[ -n "$endpoint" ] && RMID=$(echo "${endpoint}" | grep '::ffff' | awk '{ print $3 }')
|
||||
[ -n "$RMID" ] && ip mptcp endpoint delete id $RMID 2>&1 >/dev/null
|
||||
fi
|
||||
[ -z "$ID" ] && [ -n "$IP" ] && [ -n "$endpoint" ] && ID=$(echo "${endpoint}" show | grep "$IP " | awk '{print $3}')
|
||||
[ -n "$endpoint" ] && RMID=$(echo "${endpoint}" | grep '::ffff' | awk '{ print $3 }')
|
||||
[ -n "$RMID" ] && ip mptcp endpoint delete id $RMID 2>&1 >/dev/null
|
||||
case $TYPE in
|
||||
"off")
|
||||
[ -n "$ID" ] && {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue