From: Sven Anders <sven@anduras.de>
To: netdev <netdev@vger.kernel.org>
Subject: [PATCH] iproute2: ip route flush bugfix
Date: Mon, 09 Nov 2009 20:39:15 +0100 [thread overview]
Message-ID: <4AF86FE3.4090005@anduras.de> (raw)
[-- Attachment #1.1: Type: text/plain, Size: 1673 bytes --]
Hello!
I experienced an error, if I try to perform a
ip route flush proto 4
with many routes in a complex environment, it
gave me the following error:
Failed to send flush request: Success
Flush terminated
I'm using version 2.6.29.
I check GIT, but there was only the "MSG_PEEK" fix.
I tracked it down to the rtnl_send_check() function
in lib/libnetlink.c.
In this function there is the following for loop:
for (h = (struct nlmsghdr *)resp; NLMSG_OK(h, status);
h = NLMSG_NEXT(h, status)) {
if (h->nlmsg_type == NLMSG_ERROR) {
struct nlmsgerr *err = (struct nlmsgerr*)NLMSG_DATA(h);
if (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr)))
fprintf(stderr, "ERROR truncated\n");
else
errno = -err->error;
}
return -1;
}
I think the "return -1;" should be inside the if statement.
I attached a patch for this. The first part of the patch is taken from
one of the late git commits.
Please note me, if the fix is wrong...
Regards
Sven
PS: This is a repost, because I neither received a confirmation nor a remark, that
the fix is wrong. Moreover the fix didn't make it in the GIT repository yet...
--
Sven Anders <anders@anduras.de> () Ascii Ribbon Campaign
/\ Support plain text e-mail
Weidestraße 19 - 30453 Hannover || Höllgasse 28 - 94032 Passau @ Germany
Web: http://staff2.anduras.de/anders/kim/ - Tel: +49 (0)170 / 80 911 80
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: iproute-2.6.29-flush.patch --]
[-- Type: text/x-patch; name="iproute-2.6.29-flush.patch", Size: 649 bytes --]
--- iproute2-2.6.29/lib/libnetlink.c.orig 2009-09-23 14:47:03.000000000 +0200
+++ iproute2-2.6.29/lib/libnetlink.c 2009-09-23 14:48:09.000000000 +0200
@@ -122,7 +122,7 @@ int rtnl_send_check(struct rtnl_handle *
return status;
/* Check for errors */
- status = recv(rth->fd, resp, sizeof(resp), MSG_DONTWAIT);
+ status = recv(rth->fd, resp, sizeof(resp), MSG_DONTWAIT|MSG_PEEK);
if (status < 0) {
if (errno == EAGAIN)
return 0;
@@ -137,8 +137,8 @@ int rtnl_send_check(struct rtnl_handle *
fprintf(stderr, "ERROR truncated\n");
else
errno = -err->error;
- }
return -1;
+ }
}
return 0;
[-- Attachment #1.3: sven.vcf --]
[-- Type: text/x-vcard, Size: 307 bytes --]
begin:vcard
fn:Sven Anders
n:Anders;Sven
adr;quoted-printable:;;Weidestra=C3=9Fe 19;Hannover;Niedersachsen;30453;Deutschland
email;internet:sven@anduras.de
tel;home:+49 (0)511 / 2123090
tel;cell:+49 (0)170 / 8091180
x-mozilla-html:FALSE
url:http://staff.anduras.de/anders
version:2.1
end:vcard
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next reply other threads:[~2009-11-09 20:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-09 19:39 Sven Anders [this message]
2009-11-09 20:24 ` [PATCH] iproute2: ip route flush bugfix Eric Dumazet
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=4AF86FE3.4090005@anduras.de \
--to=sven@anduras.de \
--cc=netdev@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).