From patchwork Mon Nov 9 19:39:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Anders X-Patchwork-Id: 38021 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 28050B7B77 for ; Tue, 10 Nov 2009 11:00:27 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753946AbZKIUNH (ORCPT ); Mon, 9 Nov 2009 15:13:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753942AbZKIUNH (ORCPT ); Mon, 9 Nov 2009 15:13:07 -0500 Received: from metropolitan.anduras.de ([80.237.200.159]:42424 "EHLO metropolitan.anduras.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751688AbZKIUNG (ORCPT ); Mon, 9 Nov 2009 15:13:06 -0500 X-Greylist: delayed 2020 seconds by postgrey-1.27 at vger.kernel.org; Mon, 09 Nov 2009 15:13:06 EST Received: from popper.anduras.office (p54918733.dip0.t-ipconnect.de [84.145.135.51]) (Authenticated sender: anduras@anduras.priv) by metropolitan.anduras.de (Postfix) with ESMTP id EE7DA1E5553 for ; Mon, 9 Nov 2009 20:39:27 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by popper.anduras.office (Postfix) with ESMTP id 793BD2140A5 for ; Mon, 9 Nov 2009 20:39:27 +0100 (CET) Received: from popper.anduras.office ([127.0.0.1]) by localhost (popper.anduras.office [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 12342-06 for ; Mon, 9 Nov 2009 20:39:27 +0100 (CET) Received: from [192.168.10.15] (suburban.anduras.office [10.10.20.242]) by popper.anduras.office (Postfix) with ESMTP id 4B48B214001 for ; Mon, 9 Nov 2009 20:39:24 +0100 (CET) Message-ID: <4AF86FE3.4090005@anduras.de> Date: Mon, 09 Nov 2009 20:39:15 +0100 From: Sven Anders Organization: Privat User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: netdev Subject: [PATCH] iproute2: ip route flush bugfix X-Enigmail-Version: 0.95.7 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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... --- 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;