diff options
author | Nils Schneider <nils@nilsschneider.net> | 2015-02-10 03:00:20 +0100 |
---|---|---|
committer | Nils Schneider <nils@nilsschneider.net> | 2015-02-10 03:34:10 +0100 |
commit | 7d153edb7d746ba617c3c81b5ab743fc8612dc41 (patch) | |
tree | 82fe6e4bbad23995c07a2526b1968b345526537f /ipv6 | |
parent | 9fdf0326d7c44a14abbc5345791396ebdce86f65 (diff) |
tayga: allow more flexible routing
In some scenarios (e.g. 464xlat) it is desirable to not route the mapped
prefix to tayga's interface. This adds an option 'noroutes' which, when
set to 1, will prevent such routes from being added.
Signed-off-by: Nils Schneider <nils@nilsschneider.net>
Diffstat (limited to 'ipv6')
-rwxr-xr-x | ipv6/tayga/files/tayga-proto.sh | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/ipv6/tayga/files/tayga-proto.sh b/ipv6/tayga/files/tayga-proto.sh index 6bec0b60d..b92c2a661 100755 --- a/ipv6/tayga/files/tayga-proto.sh +++ b/ipv6/tayga/files/tayga-proto.sh @@ -14,8 +14,8 @@ proto_tayga_setup() { local iface="$2" local link="tayga-$cfg" - local ipv4_addr ipv6_addr prefix dynamic_pool ipaddr ip6addr - json_get_vars ipv4_addr ipv6_addr prefix dynamic_pool ipaddr ip6addr + local ipv4_addr ipv6_addr prefix dynamic_pool ipaddr ip6addr noroutes + json_get_vars ipv4_addr ipv6_addr prefix dynamic_pool ipaddr ip6addr noroutes [ -z "$ipv4_addr" -o -z "$prefix" ] && { proto_notify_error "$cfg" "REQUIRED_PARAMETERS_MISSING" proto_block_restart "$cfg" @@ -49,16 +49,19 @@ proto_tayga_setup() { [ -n "$ipaddr" ] && proto_add_ipv4_address "$ipaddr" "255.255.255.255" [ -n "$ip6addr" ] && proto_add_ipv6_address "$ip6addr" "128" - [ -n "$ipv6_addr" ] && proto_add_ipv6_route "$ipv6_addr" "128" - [ -n "$dynamic_pool" ] && { - local pool="${dynamic_pool%%/*}" - local mask="${dynamic_pool##*/}" - proto_add_ipv4_route "$pool" "$mask" - } - [ -n "$prefix" ] && { - local prefix6="${prefix%%/*}" - local mask6="${prefix##*/}" - proto_add_ipv6_route "$prefix6" "$mask6" + + [ "$noroutes" != 1 ] && { + [ -n "$ipv6_addr" ] && proto_add_ipv6_route "$ipv6_addr" "128" + [ -n "$dynamic_pool" ] && { + local pool="${dynamic_pool%%/*}" + local mask="${dynamic_pool##*/}" + proto_add_ipv4_route "$pool" "$mask" + } + [ -n "$prefix" ] && { + local prefix6="${prefix%%/*}" + local mask6="${prefix##*/}" + proto_add_ipv6_route "$prefix6" "$mask6" + } } proto_send_update "$cfg" @@ -85,6 +88,7 @@ proto_tayga_init_config() { proto_config_add_string "dynamic_pool" proto_config_add_string "ipaddr" proto_config_add_string "ip6addr:ip6addr" + proto_config_add_boolean "noroutes" } [ -n "$INCLUDE_ONLY" ] || { |