diff mbox

[2/2] SCTP: change sctp_ctl_sock_init() to try IPv4 if IPv6 fails

Message ID 49ADE9BE.2040303@hp.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Brian Haley March 4, 2009, 2:38 a.m. UTC
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(-)

  		       "SCTP: Failed to create the SCTP control socket.\n");

Comments

David Miller March 4, 2009, 11:22 a.m. UTC | #1
From: Brian Haley <brian.haley@hp.com>
Date: Tue, 03 Mar 2009 21:38:54 -0500

> 
> 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>

Also applied, and also this patch had the same corruption issues.
--
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
diff mbox

Patch

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