From cca19dab99992659f79b000b3afc3264d53e5ff2 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 9 Feb 2020 11:14:42 -0800 Subject: [PATCH] interface: Introduce a method to get the time stamping information. In order to prevent users from open coding this logic, this patch provides a method that populates the time stamping information from the interface label. Signed-off-by: Richard Cochran Reviewed-by: Jacob Keller --- interface.c | 5 +++++ interface.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/interface.c b/interface.c index 7909a5e..460ceb8 100644 --- a/interface.c +++ b/interface.c @@ -6,6 +6,11 @@ */ #include "interface.h" +int interface_get_tsinfo(struct interface *iface) +{ + return sk_get_ts_info(iface->ts_label, &iface->ts_info); +} + const char *interface_label(struct interface *iface) { return iface->ts_label; diff --git a/interface.h b/interface.h index 89f3e94..05cfb10 100644 --- a/interface.h +++ b/interface.h @@ -24,6 +24,13 @@ struct interface { struct sk_ts_info ts_info; }; +/** + * Populate the time stamping information of a given interface. + * @param iface The interface of interest. + * @return zero on success, negative on failure. + */ +int interface_get_tsinfo(struct interface *iface); + /** * Obtain the time stamping label of a network interface. This can be * different from the name of the interface when bonding is in effect.