netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Haley <brian.haley@hp.com>
To: David Miller <davem@davemloft.net>
Cc: "Andrey Borzenkov" <arvidjaar@mail.ru>,
	"Vladislav Yasevich" <vladislav.yasevich@hp.com>,
	"Chuck Lever" <chuck.lever@oracle.com>,
	"Theodore Tso" <tytso@mit.edu>,
	Valdis.Kletnieks@vt.edu, "Rafael J. Wysocki" <rjw@sisk.pl>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	bonding-devel@lists.sourceforge.net,
	"\"J.A. Magallón\"" <jamagallon@ono.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Jay Vosburgh" <fubar@us.ibm.com>
Subject: [PATCH 2/2] SCTP: change sctp_ctl_sock_init() to try IPv4 if IPv6 fails
Date: Tue, 03 Mar 2009 21:38:54 -0500	[thread overview]
Message-ID: <49ADE9BE.2040303@hp.com> (raw)


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 <brian.haley@hp.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
---
  net/sctp/protocol.c |   11 ++++++++---
  1 files changed, 8 insertions(+), 3 deletions(-)

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
  		       "SCTP: Failed to create the SCTP control socket.\n");
-- 
1.5.4.3


             reply	other threads:[~2009-03-04  2:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-04  2:38 Brian Haley [this message]
2009-03-04 11:22 ` [PATCH 2/2] SCTP: change sctp_ctl_sock_init() to try IPv4 if IPv6 fails David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49ADE9BE.2040303@hp.com \
    --to=brian.haley@hp.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=arvidjaar@mail.ru \
    --cc=bonding-devel@lists.sourceforge.net \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=jamagallon@ono.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rjw@sisk.pl \
    --cc=tytso@mit.edu \
    --cc=vladislav.yasevich@hp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).