All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Vlasenko <vda.linux@googlemail.com>
To: netfilter-devel@lists.netfilter.org, kaber@netfilter.org,
	webmaster@gnumonks.org
Subject: [PATCH] fix dreaded "Unknown error 4294967295"
Date: Sat, 23 Sep 2006 13:43:32 +0200	[thread overview]
Message-ID: <200609231343.32610.vda.linux@googlemail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 326 bytes --]

google.com gives 968 hits on 'iptables "Unknown error 4294967295"'.

The reason is that iptables sets errno
to error return value of setsockopt(), which is always -1.

A few small inrelated changes are also there:
stray ')' in message, array of error messages made static,
prevention of errno corruption in ipq_perror.
--
vda

[-- Attachment #2: iptables-1.3.5.patch --]
[-- Type: text/x-diff, Size: 1730 bytes --]

diff -urpN iptables-1.3.5.0/libipq/libipq.c iptables-1.3.5.1/libipq/libipq.c
--- iptables-1.3.5.0/libipq/libipq.c	2005-07-28 16:53:11.000000000 +0200
+++ iptables-1.3.5.1/libipq/libipq.c	2006-09-21 22:12:41.000000000 +0200
@@ -366,13 +366,14 @@ char *ipq_errstr(void)
 
 void ipq_perror(const char *s)
 {
+	int e = errno;
 	if (s)
 		fputs(s, stderr);
 	else
 		fputs("ERROR", stderr);
 	if (ipq_errno)
 		fprintf(stderr, ": %s", ipq_errstr());
-	if (errno)
-		fprintf(stderr, ": %s", strerror(errno));
+	if (e)
+		fprintf(stderr, ": %s", strerror(e));
 	fputc('\n', stderr);
 }
diff -urpN iptables-1.3.5.0/libiptc/libiptc.c iptables-1.3.5.1/libiptc/libiptc.c
--- iptables-1.3.5.0/libiptc/libiptc.c	2006-01-30 09:43:09.000000000 +0100
+++ iptables-1.3.5.1/libiptc/libiptc.c	2006-09-21 23:22:33.000000000 +0200
@@ -1118,7 +1118,7 @@ const char *standard_target_map(int verd
 			return LABEL_QUEUE;
 			break;
 		default:
-			fprintf(stderr, "ERROR: %d not a valid target)\n",
+			fprintf(stderr, "ERROR: %d not a valid target\n",
 				verdict);
 			abort();
 			break;
@@ -2097,7 +2097,7 @@ TC_COMMIT(TC_HANDLE_T *handle)
 	ret = setsockopt(sockfd, TC_IPPROTO, SO_SET_REPLACE, repl,
 			 sizeof(*repl) + repl->size);
 	if (ret < 0) {
-		errno = ret;
+		/* errno = ret; */
 		goto out_free_newcounters;
 	}
 
@@ -2191,7 +2191,7 @@ TC_COMMIT(TC_HANDLE_T *handle)
 	ret = setsockopt(sockfd, TC_IPPROTO, SO_SET_ADD_COUNTERS,
 			 newcounters, counterlen);
 	if (ret < 0) {
-		errno = ret;
+		/* errno = ret; */
 		goto out_free_newcounters;
 	}
 
@@ -2225,7 +2225,7 @@ const char *
 TC_STRERROR(int err)
 {
 	unsigned int i;
-	struct table_struct {
+	static const struct table_struct {
 		void *fn;
 		int err;
 		const char *message;

             reply	other threads:[~2006-09-23 11:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-23 11:43 Denis Vlasenko [this message]
2006-09-25  9:35 ` [PATCH] fix dreaded "Unknown error 4294967295" Patrick McHardy
2006-09-25 20:43   ` Denis Vlasenko
2006-09-26 10:50     ` Patrick McHardy

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=200609231343.32610.vda.linux@googlemail.com \
    --to=vda.linux@googlemail.com \
    --cc=kaber@netfilter.org \
    --cc=netfilter-devel@lists.netfilter.org \
    --cc=webmaster@gnumonks.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.