From: Patrick McHardy <kaber@trash.net>
To: Pablo Neira <pablo@eurodev.net>
Cc: Harald Welte <laforge@netfilter.org>,
Netfilter Development Mailinglist
<netfilter-devel@lists.netfilter.org>
Subject: Re: [PATCH 3/3] Implement private protocol info changing
Date: Sun, 04 Sep 2005 20:02:22 +0200 [thread overview]
Message-ID: <431B36AE.2080505@trash.net> (raw)
In-Reply-To: <430E2DE3.3020700@eurodev.net>
Pablo Neira wrote:
> This patch add support to change the state of the private protocol
> information via conntrack_netlink.
The patches look fine to me, besides the two issues mentioned below.
I have a couple of fixes which conflict with them though, please
resend after they hit Linus's tree.
> ------------------------------------------------------------------------
>
> Index: netfilter-2.6.14/net/ipv4/netfilter/ip_conntrack_netlink.c
> ===================================================================
> --- netfilter-2.6.14.orig/net/ipv4/netfilter/ip_conntrack_netlink.c 2005-08-13 10:45:09.000000000 +0200
> +++ netfilter-2.6.14/net/ipv4/netfilter/ip_conntrack_netlink.c 2005-08-13 10:51:34.000000000 +0200
> @@ -948,6 +948,36 @@
> return 0;
> }
>
> +static inline int
> +ctnetlink_change_protoinfo(struct ip_conntrack *ct, struct nfattr *cda[])
> +{
> + struct nfattr *tb[CTA_PROTOINFO_MAX], *attr = cda[CTA_PROTOINFO-1];
> + struct ip_conntrack_protocol *proto;
> + u_int16_t npt = ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum;
> + int err;
> +
> + if (nfattr_parse_nested(tb, CTA_PROTOINFO_MAX, attr) < 0)
> + goto nfattr_failure;
nfattr_failure is usually used when there isn't enough space in
the skb, not when parsing. So I would prefer to only use it in
functions putting data in the skb to avoid confusion. Also
-1 (-EPERM) isn't a suitable error to return to userspace.
> +
> + proto = ip_conntrack_proto_find_get(npt);
> + if (!proto)
> + return -EINVAL;
> +
> + if (proto->from_nfattr) {
> + err = proto->from_nfattr(tb, ct);
> + if (err < 0) {
> + ip_conntrack_proto_put(proto);
> + return -EINVAL;
> + }
> + }
> + ip_conntrack_proto_put(proto);
> +
> + return 0;
This would be simpler and would propagate the error properly if you
would write it like this:
...
if (proto->from_nfattr)
err = proto->from_nfattr(tb, ct);
ip_conntrack_proto_put(proto);
return err;
next prev parent reply other threads:[~2005-09-04 18:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-25 20:45 [PATCH 3/3] Implement private protocol info changing Pablo Neira
2005-09-04 18:02 ` Patrick McHardy [this message]
2005-09-05 10:04 ` Harald Welte
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=431B36AE.2080505@trash.net \
--to=kaber@trash.net \
--cc=laforge@netfilter.org \
--cc=netfilter-devel@lists.netfilter.org \
--cc=pablo@eurodev.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.