netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH] qa: fix handling of ATTR_HELPER_INFO attribute
Date: Mon, 19 Nov 2012 22:40:32 +0100	[thread overview]
Message-ID: <1353361232-2437-1-git-send-email-fw@strlen.de> (raw)

The attribute is variable-length and must be thus be set via set_attr_l().

Signed-off-by: Florian Westphal <fw@strlen.de>
---
 I'll push this in a couple of days if noone objects.

 qa/test_api.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/qa/test_api.c b/qa/test_api.c
index 92cdafb..3c0f0f9 100644
--- a/qa/test_api.c
+++ b/qa/test_api.c
@@ -83,9 +83,6 @@ int main(void)
 	ret = fork();
 	if (ret == 0) {
 		for (i=0; i<ATTR_MAX; i++) {
-			data[0] = (uint8_t) i;
-			nfct_set_attr(ct, i, data);
-			val = nfct_get_attr(ct, i);
 			/* These attributes cannot be set, ignore them. */
 			switch(i) {
 			case ATTR_ORIG_COUNTER_PACKETS:
@@ -96,8 +93,18 @@ int main(void)
 			case ATTR_SECCTX:
 			case ATTR_TIMESTAMP_START:
 			case ATTR_TIMESTAMP_STOP:
+			case ATTR_CONNLABELS:
 				continue;
+			/* These attributes require special handling */
+			case ATTR_HELPER_INFO:
+				nfct_set_attr_l(ct, i, data, sizeof(data));
+				break;
+			default:
+				data[0] = (uint8_t) i;
+				nfct_set_attr(ct, i, data);
 			}
+			val = nfct_get_attr(ct, i);
+
 			if (val[0] != data[0]) {
 				printf("ERROR: set/get operations don't match "
 				       "for attribute %d (%x != %x)\n",
-- 
1.7.8.6


                 reply	other threads:[~2012-11-19 21:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1353361232-2437-1-git-send-email-fw@strlen.de \
    --to=fw@strlen.de \
    --cc=netfilter-devel@vger.kernel.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 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).