From patchwork Fri Oct 31 22:13:13 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Dobriyan X-Patchwork-Id: 6754 X-Patchwork-Delegate: davem@davemloft.net 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 DF1C1DDDF5 for ; Sat, 1 Nov 2008 09:10:12 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752592AbYJaWKI (ORCPT ); Fri, 31 Oct 2008 18:10:08 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752532AbYJaWKI (ORCPT ); Fri, 31 Oct 2008 18:10:08 -0400 Received: from ug-out-1314.google.com ([66.249.92.174]:6923 "EHLO ug-out-1314.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751856AbYJaWKG (ORCPT ); Fri, 31 Oct 2008 18:10:06 -0400 Received: by ug-out-1314.google.com with SMTP id 39so1383524ugf.37 for ; Fri, 31 Oct 2008 15:10:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=kZtTeXLXDqq0bPEcL80EW7zooGM1COn0jdOL3mn5ZLM=; b=V5nLJDlZM5dhxNWJlcJrQ5QavI58002zAIlO4hIiFlcGBJbd0lJ9i3cQgerxALvNEZ aBCunNYVrVOLZH8+fH8dMKTXveDHTHEsEXSQL+W7i0ifZ0oWg4SODLQl3fwUhZ+ZTh2n CsUYiziOea8y6xKDUq6yDseWK28LcOsZOR5cw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=QW2mgk3dYqQmGJHrsQCM6SouWrU135sIl0uPvn61XZehL+QKwAuiJx30TPJq/YzpPh uaV3OaWXSiHwKWRS1D/f1vi2J1qWD7dJzX1E5YgzAqF89QHeFKGUBm5mIdFL+udvczG9 BoZZDRrUF8QKnQiAPWlO5W45JxH8TFesCcvgA= Received: by 10.66.221.19 with SMTP id t19mr210991ugg.69.1225491003690; Fri, 31 Oct 2008 15:10:03 -0700 (PDT) Received: from localhost (gw.zunet.ru [217.67.117.64]) by mx.google.com with ESMTPS id 18sm12832426ugk.47.2008.10.31.15.10.01 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 31 Oct 2008 15:10:02 -0700 (PDT) Date: Sat, 1 Nov 2008 01:13:13 +0300 From: Alexey Dobriyan To: yoshfuji@linux-ipv6.org, davem@davemloft.net Cc: netdev@vger.kernel.org Subject: [PATCH] key: fix setkey(8) policy set breakage Message-ID: <20081031221312.GA10575@x200.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Steps to reproduce: #/usr/sbin/setkey -f flush; spdflush; add 192.168.0.42 192.168.0.1 ah 24500 -A hmac-md5 "1234567890123456"; add 192.168.0.42 192.168.0.1 esp 24501 -E 3des-cbc "123456789012123456789012"; spdadd 192.168.0.42 192.168.0.1 any -P out ipsec esp/transport//require ah/transport//require; setkey: invalid keymsg length Policy dump will bail out with the same message after that. -recv(4, "\2\16\0\0\32\0\3\0\0\0\0\0\37\r\0\0\3\0\5\0\377 \0\0\2\0\0\0\300\250\0*\0"..., 32768, 0) = 208 +recv(4, "\2\16\0\0\36\0\3\0\0\0\0\0H\t\0\0\3\0\5\0\377 \0\0\2\0\0\0\300\250\0*\0"..., 32768, 0) = 208 Dunno how to explain this, but the following patch works. :^) Signed-off-by: Alexey Dobriyan --- net/key/af_key.c | 1 - 1 file changed, 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -2075,7 +2075,6 @@ static int pfkey_xfrm_policy2msg(struct sk_buff *skb, struct xfrm_policy *xp, in req_size += socklen * 2; } else { size -= 2*socklen; - socklen = 0; } rq = (void*)skb_put(skb, req_size); pol->sadb_x_policy_len += req_size/8;