#include "rt_names.h"
#include "bpf_util.h"
+#ifndef LIBDIR
+#define LIBDIR "/usr/lib"
+#endif
+
int preferred_family = AF_UNSPEC;
int human_readable;
int use_iec;
struct rtnl_handle rth = { .fd = -1 };
+const char *get_ip_lib_dir(void)
+{
+ const char *lib_dir;
+
+ lib_dir = getenv("IP_LIB_DIR");
+ if (!lib_dir)
+ lib_dir = LIBDIR "/ip";
+
+ return lib_dir;
+}
+
static void usage(void) __attribute__((noreturn));
static void usage(void)
int target_nsid;
};
+const char *get_ip_lib_dir(void);
+
int get_operstate(const char *name);
int print_linkinfo(struct nlmsghdr *n, void *arg);
int print_addrinfo(struct nlmsghdr *n, void *arg);
#include "namespace.h"
#define IPLINK_IOCTL_COMPAT 1
-#ifndef LIBDIR
-#define LIBDIR "/usr/lib"
-#endif
#ifndef GSO_MAX_SIZE
#define GSO_MAX_SIZE 65536
if (strcmp(l->id, id) == 0)
return l;
- snprintf(buf, sizeof(buf), LIBDIR "/ip/link_%s.so", id);
+ snprintf(buf, sizeof(buf), "%s/link_%s.so", get_ip_lib_dir(), id);
dlh = dlopen(buf, RTLD_LAZY);
if (dlh == NULL) {
/* look in current binary, only open once */