summaryrefslogtreecommitdiff
path: root/arch/sandbox
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sandbox')
-rw-r--r--arch/sandbox/cpu/eth-raw-os.c7
-rw-r--r--arch/sandbox/include/asm/eth-raw-os.h9
2 files changed, 16 insertions, 0 deletions
diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c
index 12ddb345d9..df7acaa0bc 100644
--- a/arch/sandbox/cpu/eth-raw-os.c
+++ b/arch/sandbox/cpu/eth-raw-os.c
@@ -44,6 +44,13 @@ out:
return ret;
}
+int sandbox_eth_raw_os_idx_to_name(struct eth_sandbox_raw_priv *priv)
+{
+ if (!if_indextoname(priv->host_ifindex, priv->host_ifname))
+ return -errno;
+ return 0;
+}
+
static int _raw_packet_start(struct eth_sandbox_raw_priv *priv,
unsigned char *ethmac)
{
diff --git a/arch/sandbox/include/asm/eth-raw-os.h b/arch/sandbox/include/asm/eth-raw-os.h
index edd09d2e08..99f674e82e 100644
--- a/arch/sandbox/include/asm/eth-raw-os.h
+++ b/arch/sandbox/include/asm/eth-raw-os.h
@@ -42,6 +42,15 @@ struct eth_sandbox_raw_priv {
*/
int sandbox_eth_raw_os_is_local(const char *ifname);
+/*
+ * Look up the name of the interface based on the ifindex populated in priv.
+ *
+ * Overwrite the host_ifname member in priv based on looking up host_ifindex
+ *
+ * returns - 0 if success, negative if error
+ */
+int sandbox_eth_raw_os_idx_to_name(struct eth_sandbox_raw_priv *priv);
+
int sandbox_eth_raw_os_start(struct eth_sandbox_raw_priv *priv,
unsigned char *ethmac);
int sandbox_eth_raw_os_send(void *packet, int length,