OSDN Git Service

tools: ynl: add sample for netdev
authorJakub Kicinski <kuba@kernel.org>
Mon, 5 Jun 2023 19:01:08 +0000 (12:01 -0700)
committerJakub Kicinski <kuba@kernel.org>
Tue, 6 Jun 2023 19:31:32 +0000 (12:31 -0700)
commitee0202e2e731d074639461b3db2296bf44d847ce
tree65b79b41b3c90757860329b086e354d2b68312fc
parentd75fdfbc6f260f50cde5d1d566ab010a370df62e
tools: ynl: add sample for netdev

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)

Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/samples/.gitignore [new file with mode: 0644]
tools/net/ynl/samples/Makefile [new file with mode: 0644]
tools/net/ynl/samples/netdev.c [new file with mode: 0644]