From f40a31e695638e0422fdce3c4c6eb39cd1f11f91 Mon Sep 17 00:00:00 2001 From: Joe Hershberger Date: Mon, 2 Jul 2018 14:47:54 -0500 Subject: sandbox: eth-raw: Add a SIMPLE_BUS to enumerate host interfaces Ask the OS for each of its interfaces and for each one, bind a U-Boot device and then probe it. This will allocate the priv data structure that is then populated. Signed-off-by: Joe Hershberger Reviewed-by: Simon Glass --- arch/sandbox/include/asm/eth-raw-os.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'arch/sandbox/include/asm') diff --git a/arch/sandbox/include/asm/eth-raw-os.h b/arch/sandbox/include/asm/eth-raw-os.h index 99f674e82e6..0b511db70c3 100644 --- a/arch/sandbox/include/asm/eth-raw-os.h +++ b/arch/sandbox/include/asm/eth-raw-os.h @@ -34,6 +34,17 @@ struct eth_sandbox_raw_priv { unsigned short local_bind_udp_port; }; +/* A struct to mimic if_nameindex but that does not depend on Linux headers */ +struct sandbox_eth_raw_if_nameindex { + unsigned int if_index; /* Index of interface (1, 2, ...) */ + char *if_name; /* Null-terminated name ("eth0", etc.) */ +}; + +/* Enumerate host network interfaces */ +struct sandbox_eth_raw_if_nameindex *sandbox_eth_raw_if_nameindex(void); +/* Free the data structure of enumerated network interfaces */ +void sandbox_eth_raw_if_freenameindex(struct sandbox_eth_raw_if_nameindex *ptr); + /* * Check if the interface named "ifname" is a localhost interface or not. * ifname - the interface name on the host to check -- cgit v1.2.3