Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script does not work for my shell #2

Open
jscottandersonthe1 opened this issue May 16, 2016 · 2 comments
Open

Script does not work for my shell #2

jscottandersonthe1 opened this issue May 16, 2016 · 2 comments
Assignees

Comments

@jscottandersonthe1
Copy link

jscottandersonthe1 commented May 16, 2016

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
Copy link
Member

cpaasch commented May 19, 2016

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 cpaasch self-assigned this Oct 26, 2016
@yosephmaloche
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants