From b08b459b63ed55ea7cef186e433ad4bd9e205bd3 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 6 Dec 2010 15:11:57 -0800 Subject: Fix check for local IP address Bug 6517 Fix buggy comparison with regular expression by using new is_local_address from lib/Vyatta/Misc.pm --- scripts/bgp/vyatta-bgp.pl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl index 67788174..383f085a 100755 --- a/scripts/bgp/vyatta-bgp.pl +++ b/scripts/bgp/vyatta-bgp.pl @@ -1073,13 +1073,9 @@ exit 0; # Make sure the peer IP isn't a local system IP sub check_neighbor_ip { my $neighbor = shift; - my $local_ips; - $local_ips = join( ' ', getIP() ); - - if ($local_ips =~ /$neighbor/g) { - die "Can't set neighbor address to local system IP.\n"; - } + die "Can't set neighbor address to local system IP.\n" + if (is_local_address($neighbor)); exit 0; } -- cgit v1.2.3