On Thu, 30 Nov 2023 13:02:20 +1100 David Gibson <david(a)gibson.dropbear.id.au> wrote:Future debugging will want to identify a specific passt interface. We make a distinction in these helpers between the name of the *type* of pif, and name of the pif itself. For the time being these are always the same thing, since we have at most instance of each type of pif. However, that might change in future. Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- Makefile | 3 ++- pif.c | 21 +++++++++++++++++++++ pif.h | 19 +++++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 pif.c diff --git a/Makefile b/Makefile index d14b029..af4fa87 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,8 @@ FLAGS += -DDUAL_STACK_SOCKETS=$(DUAL_STACK_SOCKETS) PASST_SRCS = arch.c arp.c checksum.c conf.c dhcp.c dhcpv6.c flow.c icmp.c \ igmp.c isolation.c lineread.c log.c mld.c ndp.c netlink.c packet.c \ - passt.c pasta.c pcap.c port_fwd.c tap.c tcp.c tcp_splice.c udp.c util.c + passt.c pasta.c pcap.c pif.c port_fwd.c tap.c tcp.c tcp_splice.c udp.c \ + util.c QRAP_SRCS = qrap.c SRCS = $(PASST_SRCS) $(QRAP_SRCS) diff --git a/pif.c b/pif.c new file mode 100644 index 0000000..ebf01cc --- /dev/null +++ b/pif.c @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later + * Copyright Red Hat + * Author: David Gibson <david(a)gibson.dropbear.id.au> + * + * Passt/pasta interface types and IDs + */ + +#include <stdint.h> +#include <assert.h> + +#include "util.h" +#include "pif.h" + +const char *pif_type_str[] = { + [PIF_NONE] = "<none>", + [PIF_HOST] = "HOST", + [PIF_TAP] = "TAP", + [PIF_SPLICE] = "SPLICE",Nit, not worth respinning in my opinion: those are just English nouns, not acronyms, so they could simply be printed as "host", "tap", and "splice". -- Stefano