]> git.pld-linux.org Git - projects/rc-scripts.git/blame - sysconfig/network-scripts/ifup-routes
- IPv6 specific rules and routes, rationale: some rules (and even routes)
[projects/rc-scripts.git] / sysconfig / network-scripts / ifup-routes
CommitLineData
12de71be 1#!/bin/sh
b0443108 2#
ec8b15cb 3# $Id$
b0443108 4#
625871bd
ER
5# Adds static routes which go through device $DEVICE
6# Called from ifup-post.
7742e157 7
12de71be 8if [ ! -f /etc/sysconfig/static-routes ]; then
b8c0e37b 9 return
7742e157 10fi
a9d7fb92 11
12# note the trailing white space character in the grep gets rid of aliases
a51d5138 13grep -E "^($DEVICE|any)[[:blank:]]" /etc/sysconfig/static-routes | while read device args; do
46db3d10 14 if [[ "$args" = *:* ]]; then
5e6dfc29
JR
15 if is_no "$IPV6_NETWORKING"; then
16 continue
17 fi
18 else
19 if is_no "$IPV4_NETWORKING"; then
20 continue
21 fi
74a7f2e4 22 fi
5e6dfc29 23 /sbin/ip route add $args dev $REALDEVICE
12de71be 24done
f3df266c
JK
25
26
27# based on information from http://avahi.org/wiki/AvahiAutoipd#Routes
28if is_yes "$ZEROCONF" && ! /sbin/ip link show dev $REALDEVICE | grep -q POINTOPOINT ; then
29 # metric based on device ifindex, so the same route may be added to
30 # multiple devices. Big, so it won't conflict with anything else.
31 if [ -f /sys/class/net/$REALDEVICE/ifindex ] ; then
32 metric="$(cat /sys/class/net/$REALDEVICE/ifindex)"
33 metric=$(($metric + 1000))
34 else
35 metric=1000
36 fi
37
38 # default route in default table, so it won't override default
39 # route set by other means
40 /sbin/ip route add default metric $metric dev $REALDEVICE table default
41
42 # add 169.254.0.0/16 route if not already present on the device
43 current=$(/sbin/ip route show 169.254.0.0/16 dev $REALDEVICE)
44 if [ -z "$current" ] ; then
45 /sbin/ip route add 169.254.0.0/16 metric $metric dev $REALDEVICE
46 fi
47
48 unset metric
49 unset current
50fi
This page took 0.303936 seconds and 4 git commands to generate.