]> git.ipfire.org Git - people/stevee/network.git/commitdiff
libnetwork: Actually store index
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 19 Sep 2018 14:56:33 +0000 (15:56 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 19 Sep 2018 14:56:33 +0000 (15:56 +0100)
Index was always zero and therefore only the first PHY could
be queried only.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libnetwork/phy.c

index 3b443af52f29d6e4c8b73c429e4f085220656d37..b11ce9b9c0dd1a6ac316a0ec699bcc7264a2a04b 100644 (file)
@@ -314,6 +314,7 @@ NETWORK_EXPORT int network_phy_new(struct network_ctx* ctx, struct network_phy**
        p->refcount = 1;
 
        p->name = strdup(name);
+       p->index = index;
 
        // Load information from kernel
        int r = phy_get_info(p);
@@ -324,7 +325,7 @@ NETWORK_EXPORT int network_phy_new(struct network_ctx* ctx, struct network_phy**
                return r;
        }
 
-       DEBUG(p->ctx, "Allocated phy at %p\n", p);
+       DEBUG(p->ctx, "Allocated phy at %p (index = %d)\n", p, p->index);
        *phy = p;
        return 0;
 }