App-DHCPClientUtils
view release on metacpan or search on metacpan
scripts/multi-homed-routing.pl view on Meta::CPAN
[% END %]
[% IF if.weight %]
IF[% if.table %]_WEIGHT=[% if.weight %]
[% END %]
[% END %]
# Helper functions
function verify_ip() {
local IP
local device=\\\$1
local IP_in=\\\$2
IP=\\\$(\\\$IP_TOOL -4 -o addr show dev \\\$device 2> /dev/null)
if [[ \\\$IP =~ inet[[:space:]]+([0-9.]+)/ ]]; then
if [ \\\${BASH_REMATCH\[1\]} != \\\$IP_in ]; then
echo "IP-address for \\\$device expected to be \\\$IP_in, got \\\${BASH_REMATCH\[1\]}."
echo "Re-run multi-homed-routing.pl to update routing setup."
return 1
scripts/multi-homed-routing.pl view on Meta::CPAN
return 0
}
# Keep track of interfaces. We need all of them for this to work properly.
fail_cnt=0
[% FOREACH if IN interfaces %]
# Check interface [% if.device %]
verify_ip \\\$IF[% if.table %]_DEVICE \\\$IF[% if.table %]_IP
if [ \\\$? -eq 0 ]; then
# Add table [% if.table %] for interface [% if.device %]
\\\$IP_TOOL route flush table [% if.table %]
[% FOREACH if2 IN interfaces %]
[% other_device = if2.device %][% IF if.device == if2.device %]
\\\$IP_TOOL route add \\\$IF[% if2.table %]_NET dev \\\$IF[% if2.table %]_DEVICE src \\\$IF[% if2.table %]_IP table [% if.table %]
[% ELSIF if.crossref.\$other_device == 1 %]
( run in 1.160 second using v1.01-cache-2.11-cpan-39bf76dae61 )