netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Graf <tgraf@suug.ch>
To: Julius Volz <juliusv@google.com>
Cc: Patrick McHardy <kaber@trash.net>,
	netdev@vger.kernel.org, lvs-devel@vger.kernel.org,
	vbusam@google.com, horms@verge.net.au, davem@davemloft.net
Subject: Re: [PATCH 2/2] IPVS: Add genetlink interface implementation
Date: Thu, 10 Jul 2008 13:36:49 +0200	[thread overview]
Message-ID: <20080710113649.GS20815@postel.suug.ch> (raw)
In-Reply-To: <20080710112017.GA26952@google.com>

* Julius Volz <juliusv@google.com> 2008-07-10 13:20
> +/* IPVS genetlink family */
> +static struct genl_family ip_vs_genl_family = {
> +	.id		= GENL_ID_GENERATE,
> +	.hdrsize	= 0,
> +	.name		= IPVS_GENL_NAME,
> +	.version	= IPVS_GENL_VERSION,
> +	.maxattr	= IPVS_CMD_MAX

It's not a bug but looks like a typo, maxattr should
specify the number of first level attributes.

> +static int ip_vs_genl_dump_service(struct sk_buff *skb, struct ip_vs_service *svc,
> +				   struct netlink_callback *cb)
> +{
> +	void *hdr;
> +
> +	hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq,
> +			  &ip_vs_genl_family, NLM_F_MULTI,
> +			  IPVS_CMD_GET_SERVICES);

Typically, netlink code follows the following semantics WRT to
commands/message types:
-> GET_SERVICE (NLM_F_DUMP)
<- NEW_SERVICE
<- NEW_SERVICE
<- NEW_SERVICE

If you are ever going to send notifications, you can use the very same
NEW_SERVICE and userspace can use the same parsing functions.

> +static int ip_vs_genl_get_cmd(struct sk_buff *skb, struct genl_info *info)
> +{
> +	struct sk_buff *msg;
> +	void *reply;
> +	int ret, cmd;
> +
> +	mutex_lock(&__ip_vs_mutex);
> +
> +	cmd = info->genlhdr->cmd;
> +
> +	msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);

This should be nlmsg_new(NLMSG_DEFAULT_SIZE, ...) , NLMSG_GOODSIZE is for use
with skb_alloc().

  reply	other threads:[~2008-07-10 11:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-09 15:11 [PATCH 0/2] IPVS: Add Generic Netlink configuration interface Julius Volz
2008-07-09 15:11 ` [PATCH 1/2] IPVS: Add genetlink interface definitions to ip_vs.h Julius Volz
2008-07-09 15:11 ` [PATCH 2/2] IPVS: Add genetlink interface implementation Julius Volz
2008-07-09 15:17   ` YOSHIFUJI Hideaki / 吉藤英明
2008-07-09 15:24     ` Julius Volz
2008-07-09 16:43   ` Patrick McHardy
2008-07-09 18:16     ` Julius Volz
2008-07-10 12:15       ` Patrick McHardy
2008-07-10 13:58         ` Julius Volz
2008-07-10 14:43           ` Thomas Graf
2008-07-10 11:20     ` Julius Volz
2008-07-10 11:36       ` Thomas Graf [this message]
2008-07-10 12:33         ` Julius Volz
2008-07-10 14:41           ` Thomas Graf
2008-07-10 15:13             ` Julius Volz
2008-07-10 21:16               ` Thomas Graf
2008-07-10 23:16                 ` Julius Volz
2008-07-16 12:15                   ` Thomas Graf
2008-07-16 13:03                     ` Julius Volz

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=20080710113649.GS20815@postel.suug.ch \
    --to=tgraf@suug.ch \
    --cc=davem@davemloft.net \
    --cc=horms@verge.net.au \
    --cc=juliusv@google.com \
    --cc=kaber@trash.net \
    --cc=lvs-devel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=vbusam@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).