Re: [PATCH] network.dracutSetupString(): handle hosts outside the subnet (#577193)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tue, 30 Mar 2010, Hans de Goede wrote:

Out "ip route" output parsing did not handle the "ip route" output
properly in the case we were trying to find out which interface is
used to get to a host when that host lives outside our subnet.

This patch fixes this. Note this only fixes part of #577193, but as
the other part is really unrelated I'm splitting the fix into 2
patches.
---
network.py |    5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/network.py b/network.py
index a3fb8ee..f992d18 100644
--- a/network.py
+++ b/network.py
@@ -786,12 +786,13 @@ class Network:
                return ""

            routeInfo = route.split()
-            if routeInfo[0] != host or len(routeInfo) < 5:
+            if routeInfo[0] != host or len(routeInfo) < 5 or \
+               "dev" not in routeInfo or routeInfo.index("dev") > 3:

Sure we want:  "dev" not in routeInfo

In this test?

                log.error('Unexpected "ip route get to %s" reply: %s' %
                          (host, routeInfo))
                return ""

-            nic = routeInfo[2]
+            nic = routeInfo[routeInfo.index("dev") + 1]

Is this ok given the test above?  If "dev" not in routeInfo would mean this
would become:

    nic = routeInfo[-1 + 1]
    nic = routeInfo[0]

I don't know what the possible /sbin/ip output could look like.  On my system,
I get this:

dcantrel@mitre ~$ ip route get to 172.31.1.11
172.31.1.11 dev eth0  src 172.31.1.13
    cache  mtu 1500 advmss 1460 hoplimit 64


        if nic not in self.netdevices.keys():
            log.error('Unknown network interface: %s' % nic)


- -- David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAkuzYjAACgkQ5hsjjIy1VklS+wCgqaKP6zBWbdl0nKN/SL4XYUOS
GbAAoOlqGgFfIEkJ00/X6wipCrfrp3iF
=Ljw5
-----END PGP SIGNATURE-----

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux