mptcp-scripts icon indicating copy to clipboard operation
mptcp-scripts copied to clipboard

Script does not work for my shell

Open jscottandersonthe1 opened this issue 8 years ago • 2 comments

Looking at the instructions for manually adding and deleting rules and table entries I see that there is a disagreement. Here is what I ended up doing for the mptcp_up. Note that I did not touch the PPP case:

#!/bin/sh
# A script for setting up routing tables for MPTCP in the N950.
# Copy this script into /etc/network/if-up.d/
set -e
env > /etc/network/if_up_env
if [ "$IFACE" = lo -o "$MODE" != start ]; then
exit 0
fi
if [ -z $DEVICE_IFACE ]; then
exit 0
fi
\# FIRST, make a table-alias
if [ `grep $DEVICE_IFACE /etc/iproute2/rt_tables | wc -l` -eq 0 ]; then
NUM=`cat /etc/iproute2/rt_tables | wc -l`
echo "$NUM $DEVICE_IFACE" >> /etc/iproute2/rt_tables
else
NUM=`cat /etc/iproute2/rt_tables | grep $DEVICE_IFACE | cut -d\   -f 1`
fi
if [ -n $DHCP4_IP_ADDRESS ]; then
SUBNET=`echo $IP4_ADDRESS_0 | cut -d \  -f 1 | cut -d / -f 2`
ip route add $DHCP4_NETWORK_NUMBER/$SUBNET dev $DEVICE_IFACE scope link table $NUM
ip route add default via $DHCP4_ROUTERS dev $DEVICE_IFACE table $NUM
ip rule add from $DHCP4_IP_ADDRESS table $NUM
else
# PPP-interface
IPADDR=`echo $IP4_ADDRESS_0 | cut -d \ -f 1 | cut -d / -f 1`
ip route add table $DEVICE_IFACE default dev $DEVICE_IP_IFACE scope link
ip rule add from $IPADDR table $DEVICE_IFACE
fi

This script uses the first field of the line on which it finds the interface as the table number.

jscottandersonthe1 avatar May 16 '16 20:05 jscottandersonthe1

Can you repost the script with three times ` . Because, github makes this kinda unreadable.

Have a look at https://guides.github.com/features/mastering-markdown/ for more info on how to post code in github issues.

cpaasch avatar May 19 '16 01:05 cpaasch

Hello I was trying to use for both up and down.I copied inside /etc/network/if-up.d/. Then When I try to save and exit, it doesn't work. what is my mistake and how can I make it excitable as said on the guide?

yosephmaloche avatar Jun 20 '17 17:06 yosephmaloche