diff options
author | Tom Gundersen <teg@jklm.no> | 2014-07-19 01:37:22 +0200 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-07-21 13:32:27 +0200 |
commit | 653912918f594ebbca46806b302ef6b477402575 (patch) | |
tree | 1f997e695a8a6493c9d9bc6dac9d14fa59edc6ff /src/network/sd-network.c | |
parent | 0e8415f2e5c42e87ca3b7a96138675f64696cb7a (diff) |
sd-network: drop get_ifindices
People should use rtnl for this, and then only query sd-network by the ifindices it finds.
Diffstat (limited to 'src/network/sd-network.c')
-rw-r--r-- | src/network/sd-network.c | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/network/sd-network.c b/src/network/sd-network.c index 0844e58686..91d6275056 100644 --- a/src/network/sd-network.c +++ b/src/network/sd-network.c @@ -206,64 +206,6 @@ _public_ int sd_network_dhcp_use_ntp(int ifindex) { return network_get_boolean("DHCP_USE_NTP", ifindex); } -_public_ int sd_network_get_ifindices(int **ifindices) { - _cleanup_closedir_ DIR *d; - int r = 0; - unsigned n = 0; - _cleanup_free_ int *l = NULL; - - d = opendir("/run/systemd/netif/links/"); - if (!d) - return -errno; - - for (;;) { - struct dirent *de; - int k; - int ifindex; - - errno = 0; - de = readdir(d); - if (!de && errno != 0) - return -errno; - - if (!de) - break; - - dirent_ensure_type(d, de); - - if (!dirent_is_file(de)) - continue; - - k = safe_atoi(de->d_name, &ifindex); - if (k < 0) - continue; - - if (ifindices) { - if ((unsigned) r >= n) { - int *t; - - n = MAX(16, 2*r); - t = realloc(l, sizeof(int) * n); - if (!t) - return -ENOMEM; - - l = t; - } - - assert((unsigned) r < n); - l[r++] = ifindex; - } else - r++; - } - - if (ifindices) { - *ifindices = l; - l = NULL; - } - - return r; -} - static inline int MONITOR_TO_FD(sd_network_monitor *m) { return (int) (unsigned long) m - 1; } |