summaryrefslogtreecommitdiff
path: root/scripts/vyatta-interfaces.pl
diff options
context:
space:
mode:
authorrbalocca <rbalocca@vyatta.com>2008-04-02 15:04:19 -0700
committerrbalocca <rbalocca@vyatta.com>2008-04-02 15:04:19 -0700
commitbfd1fedf32528a5fe714ba9491c5bc5dd2052e91 (patch)
tree84305f6415af8171a57dec453ee8d2a26f61e6e8 /scripts/vyatta-interfaces.pl
parent053d42ea27a5b89f0a19a09dd347bc37c6f07948 (diff)
parent35642e2e10aff32335690a5af2710bbb9ec3ea13 (diff)
downloadvyatta-cfg-bfd1fedf32528a5fe714ba9491c5bc5dd2052e91.tar.gz
vyatta-cfg-bfd1fedf32528a5fe714ba9491c5bc5dd2052e91.zip
Merge branch 'glendale' into hollywood
Diffstat (limited to 'scripts/vyatta-interfaces.pl')
-rwxr-xr-xscripts/vyatta-interfaces.pl40
1 files changed, 33 insertions, 7 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index e3afe68..c60288a 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -332,18 +332,44 @@ sub delete_eth_addrs {
dhcp_release_addr($intf);
update_dhcp_client();
system("rm -f /var/lib/dhcp3/dhclient_$intf\_lease");
- return;
+ exit 0;
}
my $version = is_ip_v4_or_v6($addr);
- if (!defined $version) {
- exit 1;
+
+ # If interface has address than delete it
+ if (is_ip_configured($intf, $addr)) {
+ if ($version == 4) {
+ exec 'ip', 'addr', 'del', $addr, 'dev', $intf;
+ } elsif ($version == 6) {
+ exec 'ip', '-6', 'addr', 'del', $addr, 'dev', $intf;
+ } else {
+ die "Bad ip version";
+ }
+ die "Can't exec ip";
}
- if ($version == 4) {
- return system("ip addr del $addr dev $intf");
+
+ # Interface address might have been removed by quagga link going down
+ # so tell quagga no to restore it on link-detect
+ my $vtysh;
+ if ( -x '/usr/bin/vyatta-vtysh' ) {
+ $vtysh = '/usr/bin/vyatta-vtysh';
+ } else {
+ $vtysh = '/usr/bin/vtysh';
}
- if ($version == 6) {
- return system("ip -6 addr del $addr dev $intf");
+
+ my @cmd = ();
+ if ($version == 4) {
+ @cmd = ('vtysh', '-c',
+ "configure terminal; interface $intf; no ip address $intf" );
+ } elsif ($version == 6) {
+ @cmd = ('vtysh', '-c',
+ "configure terminal; interface $intf; no ip6 address $intf" );
+ } else {
+ die "Bad ip version";
}
+ exec $vtysh, @cmd;
+
+ die "Can't exec vtysh";
}
sub update_mac {