From patchwork Thu Jul 16 15:04:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Dykstra X-Patchwork-Id: 29865 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id 1B54EB707F for ; Fri, 17 Jul 2009 01:05:11 +1000 (EST) Received: by ozlabs.org (Postfix) id 0F7BADDDA0; Fri, 17 Jul 2009 01:05:11 +1000 (EST) 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 9EDE4DDD04 for ; Fri, 17 Jul 2009 01:05:10 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757604AbZGPPE7 (ORCPT ); Thu, 16 Jul 2009 11:04:59 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932390AbZGPPE7 (ORCPT ); Thu, 16 Jul 2009 11:04:59 -0400 Received: from mail-ew0-f226.google.com ([209.85.219.226]:50506 "EHLO mail-ew0-f226.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757599AbZGPPE6 (ORCPT ); Thu, 16 Jul 2009 11:04:58 -0400 Received: by ewy26 with SMTP id 26so193966ewy.37 for ; Thu, 16 Jul 2009 08:04:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:content-type :date:message-id:mime-version:x-mailer:content-transfer-encoding; bh=wdfoTCQ3Oq/JT9MQttuOptHSL+RgMNKtHFqBmhzsIhc=; b=rwwiB3eFx0CHpgNDhWFVeda9Q/ngYEd4XyZ3+uvsn3b0YtiC+d/1CaKPZ7O5tq5uoy X0LdmwU2NioHCsaES6euWaRdiF6r8fQLss8d8otJuZQMTJp66IwvHAdTQm94qIN9ZjAK nWAZR3jw/Wg6XyGSohSAOxS9CaLp8aCY0NqzU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; b=wDnSKJYmjtvQ9ubh8otVAjn5ieDPGVrpdTKI4xikKRsC1tq+A2rZ9GxNP+9hIXaEkj FGh9AKcg6/NQcexA3zr5aF6TTHTFDGzNz03Nps78puEjXXfvw4ggb+NTTsCmEC2lamX0 pt263vnWzz8xEhr7kM9Rn/VPzesn2sy74Jr/4= Received: by 10.216.10.76 with SMTP id 54mr2354025weu.58.1247756695061; Thu, 16 Jul 2009 08:04:55 -0700 (PDT) Received: from ?192.168.221.201? ([24.118.80.156]) by mx.google.com with ESMTPS id g11sm241946gve.16.2009.07.16.08.04.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 16 Jul 2009 08:04:54 -0700 (PDT) Subject: [PATCHv2] tcp: Fix MD5 signature checking on IPv4 mapped sockets From: John Dykstra To: netdev , Stephen Hemminger Date: Thu, 16 Jul 2009 10:04:51 -0500 Message-Id: <1247756691.7627.5.camel@Maple> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This revision to the patch removes a misplaced blank line. --- Fix MD5 signature checking so that an IPv4 active open to an IPv6 socket can succeed. In particular, use the correct address family's signature generation function for the SYN/ACK. Reported-by: Stephen Hemminger Signed-off-by: John Dykstra --- include/net/tcp.h | 5 +++++ net/ipv4/tcp_ipv4.c | 1 + net/ipv4/tcp_output.c | 2 +- net/ipv6/tcp_ipv6.c | 1 + 4 files changed, 8 insertions(+), 1 deletions(-) diff --git a/include/net/tcp.h b/include/net/tcp.h index 19f4150..88af843 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -1425,6 +1425,11 @@ struct tcp_request_sock_ops { #ifdef CONFIG_TCP_MD5SIG struct tcp_md5sig_key *(*md5_lookup) (struct sock *sk, struct request_sock *req); + int (*calc_md5_hash) (char *location, + struct tcp_md5sig_key *md5, + struct sock *sk, + struct request_sock *req, + struct sk_buff *skb); #endif }; diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 5a1ca26..7c107eb 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -1160,6 +1160,7 @@ struct request_sock_ops tcp_request_sock_ops __read_mostly = { #ifdef CONFIG_TCP_MD5SIG static struct tcp_request_sock_ops tcp_request_sock_ipv4_ops = { .md5_lookup = tcp_v4_reqsk_md5_lookup, + .calc_md5_hash = tcp_v4_md5_hash_skb, }; #endif diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 5bdf08d..bd62712 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -2261,7 +2261,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst, #ifdef CONFIG_TCP_MD5SIG /* Okay, we have all we need - do the md5 hash if needed */ if (md5) { - tp->af_specific->calc_md5_hash(md5_hash_location, + tcp_rsk(req)->af_specific->calc_md5_hash(md5_hash_location, md5, NULL, req, skb); } #endif diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c index 58810c6..ae3d657 100644 --- a/net/ipv6/tcp_ipv6.c +++ b/net/ipv6/tcp_ipv6.c @@ -896,6 +896,7 @@ struct request_sock_ops tcp6_request_sock_ops __read_mostly = { #ifdef CONFIG_TCP_MD5SIG static struct tcp_request_sock_ops tcp_request_sock_ipv6_ops = { .md5_lookup = tcp_v6_reqsk_md5_lookup, + .calc_md5_hash = tcp_v6_md5_hash_skb, }; #endif