Changeset 9337


Ignore:
Timestamp:
2007-10-16T17:05:19+02:00 (9 years ago)
Author:
florian
Message:

Add route6 option to setup IPv6 routes (#2528)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/base-files/files/etc/hotplug.d/iface/10-routes

    r7953 r9337  
    3232} 
    3333 
     34add_route6() { 
     35        local config="$1" 
     36 
     37        # is this route intended for the 
     38        # $INTERFACE of this hotplug event 
     39        config_get interface "$config" interface 
     40        [ "$interface" != "$INTERFACE" ] && return 0 
     41         
     42        # get the real interface name from network config 
     43        config_get dev "$interface" ifname 
     44 
     45        config_get target "$config" target 
     46        config_get gateway "$config" gateway 
     47        config_get metric "$config" metric 
     48 
     49        # make sure there is a gateway and a target 
     50        [ -n "$target" ] || { 
     51                echo "Missing target in route section $config" 
     52                return 1 
     53        } 
     54        [ -n "$gateway" ] || { 
     55                echo "Missing gateway in route section $config" 
     56                return 1 
     57        } 
     58 
     59        /sbin/route -A inet6 add $target gw "$gateway" ${dev:+dev "$dev"} ${metric:+ metric "$metric"} 
     60} 
     61 
    3462case "$ACTION" in 
    3563        ifup) 
     
    3866                . /var/state/network 
    3967                config_foreach "add_route" route 
     68                config_foreach "add_route6" route6 
    4069        ;; 
    4170esac 
Note: See TracChangeset for help on using the changeset viewer.