GithubHelp home page GithubHelp logo

Comments (4)

tserong avatar tserong commented on July 19, 2024

I hit the same problem with a 3.x kernel on SUSE, and I can confirm that your patch fixes it. I would suggest a small tweak as follows, so it doesn't modify *best_netmask until after the procfile is successfully opened, and removes the nested 'if' (although, really, this is probably mostly academic...)

diff --git a/tools/findif.c b/tools/findif.c
index 72452f7..b911ae2 100644
--- a/tools/findif.c
+++ b/tools/findif.c
@@ -198,6 +198,7 @@ SearchUsingProcRoute (char *address, struct in_addr *in
        ,   PROCROUTE);
        rc = OCF_ERR_GENERIC; goto out;
    }
+   *best_netmask = 0;
    while (fgets(buf, sizeof(buf), routefd) != NULL) {
        if (sscanf(buf, "%[^\t]\t%lx%lx%lx%lx%lx%lx%lx"
        ,   interface, &dest, &gw, &flags, &refcnt, &use
@@ -208,7 +209,7 @@ SearchUsingProcRoute (char *address, struct in_addr *in
            rc = OCF_ERR_GENERIC; goto out;
        }
        if ( (in->s_addr&mask) == (in_addr_t)(dest&mask)
-       &&  metric < best_metric) {
+       &&  metric <= best_metric && mask >= *best_netmask) {
            best_metric = metric;
            *best_netmask = mask;
            strncpy(best_if, interface, best_iflen);

from resource-agents.

dmuhamedagic avatar dmuhamedagic commented on July 19, 2024

Good work! Many thanks. Tim, can you please apply your version of the patch.

from resource-agents.

tserong avatar tserong commented on July 19, 2024

Done: de3074c

from resource-agents.

b-a-t avatar b-a-t commented on July 19, 2024

Just want to thank you, guys, for the quick resolution of the problem and commit! Nice team work :)

from resource-agents.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.