HomeClusterLabs Projects

findif.sh: Use the most specific matching route

Description

findif.sh: Use the most specific matching route

When more than one interface is configured with a network that matches
the IP address we're looking for, but with different networks, the "ip
route" command we're using returns more than one line:

ip -o -f inet route list match 10.122.24.59 scope link
10.122.0.0/18 dev eth1.12 proto kernel src 10.122.24.159
10.122.24.0/25 dev eth0 proto kernel src 10.122.24.53

The code assumed that only one line would be returned, and so it's
parsing only the first line, without trying to find out which line is
the best match. What we want is the route with the bigger netmask. It
turns out that it also means that it's the route with the bigger network
IP.

Co-Authored-By: Dejan Muhamedagic <dejan@suse.de>

https://bugzilla.novell.com/show_bug.cgi?id=892755

Details

Provenance
Vincent Untz <vuntz@suse.com>Authored on Aug 20 2014, 10:17 AM
Parents
rRc5902ff04e0a: Merge pull request #484 from kskmori/compat-ha-bin
Branches
Unknown
Tags
Unknown

Event Timeline