diff --git a/interface.c b/interface.c index 460ceb8..662552d 100644 --- a/interface.c +++ b/interface.c @@ -6,6 +6,13 @@ */ #include "interface.h" +void interface_ensure_tslabel(struct interface *iface) +{ + if (!iface->ts_label[0]) { + strncpy(iface->ts_label, iface->name, MAX_IFNAME_SIZE); + } +} + int interface_get_tsinfo(struct interface *iface) { return sk_get_ts_info(iface->ts_label, &iface->ts_info); diff --git a/interface.h b/interface.h index 05cfb10..371185d 100644 --- a/interface.h +++ b/interface.h @@ -24,6 +24,12 @@ struct interface { struct sk_ts_info ts_info; }; +/** + * Ensures that an interface has a proper time stamping label. + * @param iface The interface of interest. + */ +void interface_ensure_tslabel(struct interface *iface); + /** * Populate the time stamping information of a given interface. * @param iface The interface of interest.