aboutsummaryrefslogtreecommitdiffstats
path: root/main/static-routing/static-routing
blob: b4459f51eb3919a0688edcbda8387445c6896cf7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

# Static routing configuration script
# Copyright (c) 2016 Kaarle Ritvanen

if [ $MODE = start ]; then
	ACTION=add
elif [ $MODE = stop ]; then
	ACTION=del
else
	exit 1
fi

configure() {
	local class=$1
	shift

	local entry
	IFS=,
	for entry in $(eval "echo \"\$IF_$(echo $class | tr a-z A-Z)\""); do
		IFS=" "
		ip $class $ACTION $entry $*
	done
}

configure route src $IF_ADDRESS dev $IFACE
configure rule