[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <647dab8865654_d27b6294f8@willemb.c.googlers.com.notmuch>
Date: Mon, 05 Jun 2023 05:31:52 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Jakub Kicinski <kuba@...nel.org>,
davem@...emloft.net
Cc: netdev@...r.kernel.org,
edumazet@...gle.com,
pabeni@...hat.com,
simon.horman@...igine.com,
Jakub Kicinski <kuba@...nel.org>
Subject: RE: [PATCH net-next v2 4/4] tools: ynl: add sample for netdev
Jakub Kicinski wrote:
> Add a sample application using the C library.
> My main goal is to make writing selftests easier but until
> I have some of those ready I think it's useful to show off
> the functionality and let people poke and tinker.
>
> Sample outputs - dump:
>
> $ ./netdev
> Select ifc ($ifindex; or 0 = dump; or -2 ntf check): 0
> lo[1] 0:
> enp1s0[2] 23: basic redirect rx-sg
>
> Notifications (watching veth pair getting added and deleted):
>
> $ ./netdev
> Select ifc ($ifindex; or 0 = dump; or -2 ntf check): -2
> [53] 0: (ntf: dev-add-ntf)
> [54] 0: (ntf: dev-add-ntf)
> [54] 23: basic redirect rx-sg (ntf: dev-change-ntf)
> [53] 23: basic redirect rx-sg (ntf: dev-change-ntf)
> [53] 23: basic redirect rx-sg (ntf: dev-del-ntf)
> [54] 23: basic redirect rx-sg (ntf: dev-del-ntf)
>
> Signed-off-by: Jakub Kicinski <kuba@...nel.org>
> ---
> tools/net/ynl/samples/.gitignore | 1 +
> tools/net/ynl/samples/Makefile | 28 ++++++++
> tools/net/ynl/samples/netdev.c | 108 +++++++++++++++++++++++++++++++
> 3 files changed, 137 insertions(+)
> create mode 100644 tools/net/ynl/samples/.gitignore
> create mode 100644 tools/net/ynl/samples/Makefile
> create mode 100644 tools/net/ynl/samples/netdev.c
>
> diff --git a/tools/net/ynl/samples/.gitignore b/tools/net/ynl/samples/.gitignore
> new file mode 100644
> index 000000000000..7b1f5179cb54
> --- /dev/null
> +++ b/tools/net/ynl/samples/.gitignore
> @@ -0,0 +1 @@
> +netdev
> diff --git a/tools/net/ynl/samples/Makefile b/tools/net/ynl/samples/Makefile
> new file mode 100644
> index 000000000000..54eb5e3b9ab4
> --- /dev/null
> +++ b/tools/net/ynl/samples/Makefile
> @@ -0,0 +1,28 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +CC=gcc
> +CFLAGS=-std=gnu99 -O2 -W -Wall -Wextra -Wno-unused-parameter -Wshadow \
> + -I../lib/ -I../generated/
Should new userspace code also use gnu11?
> +ifeq ("$(DEBUG)","1")
> + CFLAGS += -g -fsanitize=address -fsanitize=leak -static-libasan
> +endif
> +
> +LDLIBS=-lmnl ../lib/ynl.a ../generated/protos.a
> +
> +SRCS=$(wildcard *.c)
> +BINS=$(patsubst %.c,%,${SRCS})
> +
> +include $(wildcard *.d)
> +
> +all: $(BINS)
> +
> +$(BINS): ../lib/ynl.a ../generated/protos.a
> +
> +clean:
> + rm -f *.o *.d *~
> +
> +hardclean: clean
> + rm -f $(BINS)
> +
> +.PHONY: all clean
> +.DEFAULT_GOAL=all
Powered by blists - more mailing lists