don't hardcode the netmask
This commit is contained in:
parent
d053d7241d
commit
55f588cd06
2 changed files with 15 additions and 1 deletions
|
@ -7,6 +7,7 @@ define tinc::vpn_net(
|
|||
$tinc_interface = 'eth0',
|
||||
$tinc_internal_interface = 'eth1',
|
||||
$tinc_internal_ip = 'absent',
|
||||
$tinc_internal_netmask = 'absent',
|
||||
$tinc_bridge_interface = 'absent',
|
||||
$override_mtu = false,
|
||||
$port = '655',
|
||||
|
@ -132,6 +133,19 @@ define tinc::vpn_net(
|
|||
} else {
|
||||
$real_tinc_internal_ip = $tinc_internal_ip
|
||||
}
|
||||
if $tinc_internal_netmask == 'absent' {
|
||||
$tinc_br_netmask = "::netmask_${real_tinc_bridge_interface}"
|
||||
$tinc_br_netmask = inline_template('<%= scope.lookupvar(@tinc_br_netmask) %>')
|
||||
case $tinc_br_netmask {
|
||||
'',undef: {
|
||||
$tinc_orig_netmask = "::netmask_${tinc_internal_interface}"
|
||||
$real_tinc_internal_netmask = inline_template('<%= scope.lookupvar(@tinc_orig_netmask) %>')
|
||||
}
|
||||
default: { $real_tinc_internal_netmask = $tinc_br_netmask }
|
||||
}
|
||||
} else {
|
||||
$real_tinc_internal_netmask = $tinc_internal_netmask
|
||||
}
|
||||
|
||||
file { "/etc/tinc/${name}/tinc-up":
|
||||
content => template('tinc/tinc-up.erb'),
|
||||
|
|
|
@ -4,7 +4,7 @@ grep <%= @real_tinc_bridge_interface %> /proc/net/dev | awk -F: '{ print $1 }' |
|
|||
if [ $? -gt 0 ]; then
|
||||
brctl addbr <%= @real_tinc_bridge_interface %>
|
||||
ifconfig <%= @tinc_internal_interface %> 0.0.0.0
|
||||
ifconfig <%= @real_tinc_bridge_interface %> <%= @real_tinc_internal_ip %> netmask 255.255.255.0
|
||||
ifconfig <%= @real_tinc_bridge_interface %> <%= @real_tinc_internal_ip %> netmask <%= @real_tinc_internal_netmask %>
|
||||
brctl addif <%= @real_tinc_bridge_interface %> <%= @tinc_internal_interface %>
|
||||
ifconfig <%= @tinc_internal_interface %> up
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue