From 91ad2f441a6dd1ef69ac244bc5a03f21b9403cd2 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 25 Dec 2018 00:53:52 +0200 Subject: [PATCH] macsec_linux: Add driver status information wpa_supplicant STATUS-DRIVER control interface command can now be used to fetch the macsec_linux driver status information like parent interface name. Signed-off-by: Jouni Malinen --- src/drivers/driver_macsec_linux.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/drivers/driver_macsec_linux.c b/src/drivers/driver_macsec_linux.c index 9a2643696..4605ee64a 100644 --- a/src/drivers/driver_macsec_linux.c +++ b/src/drivers/driver_macsec_linux.c @@ -1331,6 +1331,30 @@ static int macsec_drv_disable_transmit_sa(void *priv, struct transmit_sa *sa) } +static int macsec_drv_status(void *priv, char *buf, size_t buflen) +{ + struct macsec_drv_data *drv = priv; + int res; + char *pos, *end; + + pos = buf; + end = buf + buflen; + + res = os_snprintf(pos, end - pos, + "ifname=%s\n" + "ifi=%d\n" + "parent_ifname=%s\n" + "parent_ifi=%d\n", + drv->common.ifname, drv->ifi, + drv->ifname, drv->parent_ifi); + if (os_snprintf_error(end - pos, res)) + return pos - buf; + pos += res; + + return pos - buf; +} + + const struct wpa_driver_ops wpa_driver_macsec_linux_ops = { .name = "macsec_linux", .desc = "MACsec Ethernet driver for Linux", @@ -1363,4 +1387,6 @@ const struct wpa_driver_ops wpa_driver_macsec_linux_ops = { .delete_transmit_sa = macsec_drv_delete_transmit_sa, .enable_transmit_sa = macsec_drv_enable_transmit_sa, .disable_transmit_sa = macsec_drv_disable_transmit_sa, + + .status = macsec_drv_status, };