netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Donald Hunter <donald.hunter@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Jacob Keller <jacob.e.keller@intel.com>,
	Jiri Pirko <jiri@resnulli.us>,
	Stanislav Fomichev <sdf@google.com>,
	donald.hunter@redhat.com
Subject: Re: [PATCH net-next v2 0/5] tools/net/ynl: Add support for nlctrl netlink family
Date: Wed, 6 Mar 2024 10:32:19 -0800	[thread overview]
Message-ID: <20240306103219.0a2a29e0@kernel.org> (raw)
In-Reply-To: <20240306125704.63934-1-donald.hunter@gmail.com>

On Wed,  6 Mar 2024 12:56:59 +0000 Donald Hunter wrote:
> This series adds a new YNL spec for the nlctrl family, plus some fixes
> and enhancements for ynl.
> 
> Patch 1 fixes an extack decoding bug
> Patch 2 gives cleaner netlink error reporting
> Patch 3 fixes an array-nest codegen bug
> Patch 4 adds nest-type-value support to ynl
> Patch 5 contains the nlctrl spec

Somewhat incredibly the C seems to work, I tested with this sample:

// SPDX-License-Identifier: GPL-2.0
#include <stdio.h>
#include <string.h>

#include <ynl.h>

#include "nlctrl-user.h"

int main(int argc, char **argv)
{
	struct nlctrl_getfamily_list *fams;
	struct ynl_error yerr;
	struct ynl_sock *ys;
	char *name;

	ys = ynl_sock_create(&ynl_nlctrl_family, &yerr);
	if (!ys) {
		fprintf(stderr, "YNL: %s\n", yerr.msg);
		return 1;
	}

	printf("Select family ($name; or 0 = dump): ");
	scanf("%ms", &name);

	if (!name || !strcmp(name, "0")) {
		fams = nlctrl_getfamily_dump(ys);
		if (!fams)
			goto err_close;

		ynl_dump_foreach(fams, f)
			printf("%d: %s\n", f->family_id, f->family_name);
		nlctrl_getfamily_list_free(fams);
	} else {
		struct nlctrl_getfamily_req *req;
		struct nlctrl_getfamily_rsp *f;

		req = nlctrl_getfamily_req_alloc();
		nlctrl_getfamily_req_set_family_name(req, name);

		f = nlctrl_getfamily(ys, req);
		nlctrl_getfamily_req_free(req);
		if (!f)
			goto err_close;

		printf("%d: %s\n", f->family_id, f->family_name);
		nlctrl_getfamily_rsp_free(f);
	}
	free(name);

	ynl_sock_destroy(ys);
	return 0;

err_close:
	fprintf(stderr, "YNL: %s\n", ys->err.msg);
	ynl_sock_destroy(ys);
	return 2;
}

  parent reply	other threads:[~2024-03-06 18:32 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 12:56 [PATCH net-next v2 0/5] tools/net/ynl: Add support for nlctrl netlink family Donald Hunter
2024-03-06 12:57 ` [PATCH net-next v2 1/5] tools/net/ynl: Fix extack decoding for netlink-raw Donald Hunter
2024-03-06 16:33   ` Jakub Kicinski
2024-03-06 12:57 ` [PATCH net-next v2 2/5] tools/net/ynl: Report netlink errors without stacktrace Donald Hunter
2024-03-06 16:33   ` Jakub Kicinski
2024-03-06 12:57 ` [PATCH net-next v2 3/5] tools/net/ynl: Fix c codegen for array-nest Donald Hunter
2024-03-06 18:03   ` Jakub Kicinski
2024-03-06 12:57 ` [PATCH net-next v2 4/5] tools/net/ynl: Add nest-type-value decoding Donald Hunter
2024-03-06 18:07   ` Jakub Kicinski
2024-03-06 12:57 ` [PATCH net-next v2 5/5] doc/netlink/specs: Add spec for nlctrl netlink family Donald Hunter
2024-03-06 18:31   ` Jakub Kicinski
2024-03-06 22:54     ` Donald Hunter
2024-03-07  0:04       ` Jakub Kicinski
2024-03-07  8:58         ` Donald Hunter
2024-03-06 18:32 ` Jakub Kicinski [this message]
2024-03-06 22:14   ` [PATCH net-next v2 0/5] tools/net/ynl: Add support " Donald Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240306103219.0a2a29e0@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=donald.hunter@redhat.com \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).