netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bugfix for iproute2
@ 2009-11-02 23:45 Sven Anders
  2009-11-10 17:12 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Sven Anders @ 2009-11-02 23:45 UTC (permalink / raw)
  To: netdev; +Cc: shemminger


[-- Attachment #1.1: Type: text/plain, Size: 1892 bytes --]

Hello!

I already send this mail to Stephen Hemminger, but I'm not sure if it reached him.
Moreover I tried to join the LARTC mailing list (http://mailman.ds9a.nl/mailman/listinfo/lartc)
but it did not work. Is this mailing list dead?
Therefore I sent this mail again over this mailing list...


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 Anders

-- 
 Sven Anders <anders@anduras.de>                 () Ascii Ribbon Campaign
                                                 /\ Support plain text e-mail
 ANDURAS service solutions AG
 Innstrasse 71 - 94036 Passau - Germany
 Web: www.anduras.de - Tel: +49 (0)851-4 90 50-0 - Fax: +49 (0)851-4 90 50-55

Those who would give up essential Liberty, to purchase a little
temporary Safety, deserve neither Liberty nor Safety.
  - Benjamin Franklin


[-- Attachment #1.2: iproute-2.6.29-flush.patch --]
[-- Type: text/x-patch, Size: 627 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: signature.asc --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

[-- Attachment #1.4: anders.vcf --]
[-- Type: text/x-vcard, Size: 352 bytes --]

begin:vcard
fn:Sven Anders
n:Anders;Sven
org:ANDURAS AG;Research and Development
adr;quoted-printable:;;Innstra=C3=9Fe 71;Passau;Bavaria;94036;Germany
email;internet:anders@anduras.de
title:Dipl. Inf.
tel;work:++49 (0)851 / 490 50 -0
tel;fax:++49 (0)851 / 590 50 - 55
x-mozilla-html:FALSE
url:http://www.anduras.de
version:2.1
end:vcard


[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/x-pkcs7-signature, Size: 4888 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bugfix for iproute2
  2009-11-02 23:45 Bugfix for iproute2 Sven Anders
@ 2009-11-10 17:12 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2009-11-10 17:12 UTC (permalink / raw)
  To: Sven Anders; +Cc: netdev

On Tue, 03 Nov 2009 00:45:24 +0100
Sven Anders <anders@anduras.de> wrote:

> Hello!
> 
> I already send this mail to Stephen Hemminger, but I'm not sure if it reached him.
> Moreover I tried to join the LARTC mailing list (http://mailman.ds9a.nl/mailman/listinfo/lartc)
> but it did not work. Is this mailing list dead?
> Therefore I sent this mail again over this mailing list...
> 
> 
> 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 Anders
> 

Applied thanks.

-- 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-10 17:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-02 23:45 Bugfix for iproute2 Sven Anders
2009-11-10 17:12 ` Stephen Hemminger

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).