From: Patrick McHardy <kaber@trash.net>
To: Harald Welte <laforge@gnumonks.org>
Cc: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Subject: Re: [PATCH] complete nfnl_talk
Date: Mon, 02 Jun 2003 21:48:53 +0200 [thread overview]
Message-ID: <3EDBAA25.9090808@trash.net> (raw)
In-Reply-To: <3EDB99E2.8050100@trash.net>
One tought about the patch:
> int nfnl_talk(struct nfnl_handle *nfnlh, struct nlmsghdr *n, pid_t peer,
> unsigned groups, struct nlmsghdr *answer,
> int (*junk)(struct sockaddr_nl *, struct nlmsghdr *n, void *),
> void *jarg)
>
>
...
>
>+ if (h->nlmsg_type == NLMSG_ERROR) {
>+ struct nlmsgerr *err = NLMSG_DATA(h);
>+ if (l < sizeof(struct nlmsgerr))
>+ nfnl_error("ERROR truncated\n");
>+ else {
>+ errno = -err->error;
>+ if (errno == 0) {
>+ if (answer)
>+ memcpy(answer, h, h->nlmsg_len);
>+ return 0;
>+ }
>+ perror("CTNETLINK answers");
>+ }
>+ return -1;
>
>
applications might want to handle the error themselves, an alternative
would be:
errno = -err->error;
if (anwer) {
memcpy(answer, h, h->nlmsg_len);
return errno;
} else if (errno)
perror("CTNETLINK answers);
return errno;
What do you think ?
Patrick
prev parent reply other threads:[~2003-06-02 19:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-02 18:39 [PATCH] complete nfnl_talk Patrick McHardy
2003-06-02 19:11 ` Martin Josefsson
2003-06-02 19:31 ` Patrick McHardy
2003-06-02 19:48 ` Patrick McHardy [this message]
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=3EDBAA25.9090808@trash.net \
--to=kaber@trash.net \
--cc=laforge@gnumonks.org \
--cc=netfilter-devel@lists.netfilter.org \
/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.