summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2008-03-31 16:41:03 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2008-03-31 16:41:03 -0700
commit7b6cc54983fc930787b8c30d552454727ac4f606 (patch)
treef3721c888a393f74da75811510f502c2cf6b56f6
parent06702f2ed04408962d7e8e6323db97e29dd32669 (diff)
parent454ba249959ca26b512030c259b02ddc89f24582 (diff)
downloadvyatta-cfg-7b6cc54983fc930787b8c30d552454727ac4f606.tar.gz
vyatta-cfg-7b6cc54983fc930787b8c30d552454727ac4f606.zip
Merge branch 'glendale' of git.vyatta.com:/git/vyatta-cfg into glendale
-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 {