From patchwork Wed Mar 4 02:38:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Haley X-Patchwork-Id: 24024 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 A04C6DDF7B for ; Wed, 4 Mar 2009 13:39:09 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752836AbZCDCjE (ORCPT ); Tue, 3 Mar 2009 21:39:04 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752682AbZCDCjD (ORCPT ); Tue, 3 Mar 2009 21:39:03 -0500 Received: from g5t0006.atlanta.hp.com ([15.192.0.43]:29119 "EHLO g5t0006.atlanta.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750760AbZCDCjA (ORCPT ); Tue, 3 Mar 2009 21:39:00 -0500 Received: from g4t0009.houston.hp.com (g4t0009.houston.hp.com [16.234.32.26]) by g5t0006.atlanta.hp.com (Postfix) with ESMTP id 1E1EAC03D; Wed, 4 Mar 2009 02:38:59 +0000 (UTC) Received: from [192.168.1.100] (squirrel.fc.hp.com [15.11.146.57]) by g4t0009.houston.hp.com (Postfix) with ESMTP id EFBA0C014; Wed, 4 Mar 2009 02:38:54 +0000 (UTC) Message-ID: <49ADE9BE.2040303@hp.com> Date: Tue, 03 Mar 2009 21:38:54 -0500 From: Brian Haley Organization: Open Source and Linux Organization User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: David Miller CC: Andrey Borzenkov , Vladislav Yasevich , Chuck Lever , Theodore Tso , Valdis.Kletnieks@vt.edu, "Rafael J. Wysocki" , "netdev@vger.kernel.org" , bonding-devel@lists.sourceforge.net, =?ISO-8859-1?Q?=22J=2EA=2E_Magall?= =?ISO-8859-1?Q?=F3n=22?= , Linux Kernel Mailing List , Jay Vosburgh Subject: [PATCH 2/2] SCTP: change sctp_ctl_sock_init() to try IPv4 if IPv6 fails Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Change sctp_ctl_sock_init() to try IPv4 if IPv6 socket registration fails. Required if the IPv6 module is loaded with "disable=1", else SCTP will fail to load. Signed-off-by: Brian Haley Signed-off-by: Vlad Yasevich --- net/sctp/protocol.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) "SCTP: Failed to create the SCTP control socket.\n"); diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index c1e316e..e8c6287 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c @@ -692,15 +692,20 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, static int sctp_ctl_sock_init(void) { int err; - sa_family_t family; + sa_family_t family = PF_INET; if (sctp_get_pf_specific(PF_INET6)) family = PF_INET6; - else - family = PF_INET; err = inet_ctl_sock_create(&sctp_ctl_sock, family, SOCK_SEQPACKET, IPPROTO_SCTP, &init_net); + + /* If IPv6 socket could not be created, try the IPv4 socket */ + if (err < 0 && family == PF_INET6) + err = inet_ctl_sock_create(&sctp_ctl_sock, AF_INET, + SOCK_SEQPACKET, IPPROTO_SCTP, + &init_net); + if (err < 0) { printk(KERN_ERR