chusiang / mysql-master-master

Automatically exported from code.google.com/p/mysql-master-master
GNU General Public License v2.0
1 stars 1 forks source link

check_ip not configuring a role ip #42

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use a role ip matching broadcast address
e.g.: use writer ip 192.168.1.2 in the network 192.168.1.0/24, broadcast
address if 192.168.1.255
2. Execute /opt/mmm/bin/check_ip 192.168.1.2 eth0
3. Execute ping 192.168.1.2

What is the expected output? What do you see instead?
The IP should be set on eth0 and the ping OK, but this is not the case:

# /sbin/ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether xx:xx:xx:xx:xx:xx brd ff:ff:ff:ff:ff:ff
    inet 192.168.80.12/24 brd 192.168.80.255 scope global eth0
    inet6 xxxx::xxx:xxxx:xxxx:xxxx/64 scope link
       valid_lft forever preferred_lft forever

What version of the product are you using? On what operating system?
RHEL5, with mmm v1.2.3

Please provide any additional information below.
In lib/ifconfig.pm, the test to check IP presence is not enought strict:

my $present = ($ips =~ /$ip/) ? 1 : 0;

will match the broadcast address present in /sbin/ip addr show output.

Fixed using:

my $present = ($ips =~ /inet $ip\//) ? 1 : 0;

Original issue reported on code.google.com by sli...@gmail.com on 12 May 2009 at 10:24

GoogleCodeExporter commented 9 years ago
my $present = ($ips =~ /\D+$ip\D+/) ? 1 : 0;

Original comment by m...@pascalhofmann.de on 20 May 2009 at 1:58

GoogleCodeExporter commented 9 years ago

Original comment by ryan.a.l...@gmail.com on 29 May 2009 at 8:09