diff --git a/clock.c b/clock.c index 9ffb43e..afee960 100644 --- a/clock.c +++ b/clock.c @@ -948,7 +948,7 @@ struct clock *clock_create(enum clock_type type, struct config *config, c->timestamping = timestamping; required_modes = clock_required_modes(c); STAILQ_FOREACH(iface, &config->interfaces, list) { - rtnl_get_ts_label(iface); + rtnl_get_ts_device(iface->name, iface->ts_label); ensure_ts_label(iface); sk_get_ts_info(iface->ts_label, &iface->ts_info); if (iface->ts_info.valid && diff --git a/nsm.c b/nsm.c index cefea5d..fc10a60 100644 --- a/nsm.c +++ b/nsm.c @@ -267,7 +267,7 @@ static int nsm_open(struct nsm *nsm, struct config *cfg) int count = 0; STAILQ_FOREACH(iface, &cfg->interfaces, list) { - rtnl_get_ts_label(iface); + rtnl_get_ts_device(iface->name, iface->ts_label); if (iface->ts_label[0] == '\0') { strncpy(iface->ts_label, iface->name, MAX_IFNAME_SIZE); } diff --git a/rtnl.c b/rtnl.c index cea936b..f9a572b 100644 --- a/rtnl.c +++ b/rtnl.c @@ -43,13 +43,13 @@ int rtnl_close(int fd) return close(fd); } -static void rtnl_get_ts_label_callback(void *ctx, int linkup, int ts_index) +static void rtnl_get_ts_device_callback(void *ctx, int linkup, int ts_index) { int *dst = ctx; *dst = ts_index; } -int rtnl_get_ts_label(struct interface *iface) +int rtnl_get_ts_device(char *device, char *ts_device) { int err, fd; int ts_index = -1; @@ -58,13 +58,13 @@ int rtnl_get_ts_label(struct interface *iface) if (fd < 0) return fd; - err = rtnl_link_query(fd, iface->name); + err = rtnl_link_query(fd, device); if (err) { goto no_info; } - rtnl_link_status(fd, iface->name, rtnl_get_ts_label_callback, &ts_index); - if (ts_index > 0 && if_indextoname(ts_index, iface->ts_label)) + rtnl_link_status(fd, device, rtnl_get_ts_device_callback, &ts_index); + if (ts_index > 0 && if_indextoname(ts_index, ts_device)) err = 0; else err = -1; diff --git a/rtnl.h b/rtnl.h index 2906d74..f877cd2 100644 --- a/rtnl.h +++ b/rtnl.h @@ -20,8 +20,6 @@ #ifndef HAVE_RTNL_H #define HAVE_RTNL_H -#include "config.h" - typedef void (*rtnl_callback)(void *ctx, int linkup, int ts_index); /** @@ -32,11 +30,14 @@ typedef void (*rtnl_callback)(void *ctx, int linkup, int ts_index); int rtnl_close(int fd); /** - * Get interface ts_label information - * @param iface struct interface. - * @return Zero on success, or -1 on error. + * Get name of the slave interface which timestamps packets going through + * a master interface (e.g. bond0) + * @param device Name of the master interface. + * @param ts_device Buffer for the name of the slave interface, which must be + * at least IF_NAMESIZE bytes long. + * @return Zero on success, or -1 on error. */ -int rtnl_get_ts_label(struct interface *iface); +int rtnl_get_ts_device(char *device, char *ts_device); /** * Request the link status from the kernel.