multipath-tcp / mptcp-scripts

A set of scripts to ease the maintenance of the out-of-tree MultiPath TCP kernel
29 stars 38 forks source link

Script does not work for my shell #2

Open jscottandersonthe1 opened 8 years ago

jscottandersonthe1 commented 8 years ago

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.

cpaasch commented 8 years ago

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.

yosephmaloche commented 7 years ago

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?