From a3c0a88b82c6611abee42a406b17b1446bdeb4b8 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 9 Feb 2020 10:56:54 -0800 Subject: [PATCH] interface: Introduce an access method for the time stamping label. Many of the users only require a read only reference to the time stamping label of the interface. This patch adds an appropriate method. Signed-off-by: Richard Cochran Reviewed-by: Jacob Keller --- interface.c | 5 +++++ interface.h | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/interface.c b/interface.c index 1231db9..7909a5e 100644 --- a/interface.c +++ b/interface.c @@ -6,6 +6,11 @@ */ #include "interface.h" +const char *interface_label(struct interface *iface) +{ + return iface->ts_label; +} + const char *interface_name(struct interface *iface) { return iface->name; diff --git a/interface.h b/interface.h index 94d5b8f..89f3e94 100644 --- a/interface.h +++ b/interface.h @@ -24,6 +24,15 @@ struct interface { struct sk_ts_info ts_info; }; +/** + * Obtain the time stamping label of a network interface. This can be + * different from the name of the interface when bonding is in effect. + * + * @param iface The interface of interest. + * @return The time stamping device name of the network interface. + */ +const char *interface_label(struct interface *iface); + /** * Obtains the name of a network interface. * @param iface The interface of interest.