4 # is this route intended for the
5 # $INTERFACE of this hotplug event
6 config_get interface "$config" interface
7 [ "$interface" != "$INTERFACE" ] && return 0
9 # get the real interface name from network config
10 config_get dev "$interface" ifname
12 config_get target "$config" target
13 config_get netmask "$config" netmask
14 config_get gateway "$config" gateway
15 config_get metric "$config" metric
17 # make sure there is a gateway and a target
19 echo "Missing target in route section $config"
22 [ -n "$gateway" ] || {
23 config_get gateway "$interface" gateway
26 netmask="${netmask:-255.255.255.255}"
27 dest="${netmask:+-net "$target" netmask "$netmask"}"
28 dest="${dest:--host "$target"}"
30 /sbin/route add $dest gw "$gateway" ${dev:+dev "$dev"} ${metric:+ metric "$metric"}
36 # is this route intended for the
37 # $INTERFACE of this hotplug event
38 config_get interface "$config" interface
39 [ "$interface" != "$INTERFACE" ] && return 0
41 # get the real interface name from network config
42 config_get dev "$interface" ifname
44 config_get target "$config" target
45 config_get gateway "$config" gateway
46 config_get metric "$config" metric
48 # make sure there is a gateway and a target
50 echo "Missing target in route section $config"
53 [ -n "$gateway" ] || {
54 config_get gateway "$interface" gateway
57 /sbin/route -A inet6 add $target ${gateway:+gw "$gateway"} ${dev:+dev "$dev"} ${metric:+ metric "$metric"}
64 config_foreach "add_route" route
65 config_foreach "add_route6" route6