diff options
author | Brian Haley <brian.haley@hp.com> | 2009-03-04 06:20:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-03-04 06:20:26 -0500 |
commit | fb13d9f9e450bceafd88ac8a98f7a98e8096a5fe (patch) | |
tree | 69b9341aeca187891f5a683c47150ffb0fce4d71 /net | |
parent | fe7ca2e1e847b65c12d245cbf402af89da96888a (diff) |
SCTP: change sctp_ctl_sock_init() to try IPv4 if IPv6 fails
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | 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 4e6638449639..c4986d0f7419 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -717,15 +717,20 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev, | |||
717 | static int sctp_ctl_sock_init(void) | 717 | static int sctp_ctl_sock_init(void) |
718 | { | 718 | { |
719 | int err; | 719 | int err; |
720 | sa_family_t family; | 720 | sa_family_t family = PF_INET; |
721 | 721 | ||
722 | if (sctp_get_pf_specific(PF_INET6)) | 722 | if (sctp_get_pf_specific(PF_INET6)) |
723 | family = PF_INET6; | 723 | family = PF_INET6; |
724 | else | ||
725 | family = PF_INET; | ||
726 | 724 | ||
727 | err = inet_ctl_sock_create(&sctp_ctl_sock, family, | 725 | err = inet_ctl_sock_create(&sctp_ctl_sock, family, |
728 | SOCK_SEQPACKET, IPPROTO_SCTP, &init_net); | 726 | SOCK_SEQPACKET, IPPROTO_SCTP, &init_net); |
727 | |||
728 | /* If IPv6 socket could not be created, try the IPv4 socket */ | ||
729 | if (err < 0 && family == PF_INET6) | ||
730 | err = inet_ctl_sock_create(&sctp_ctl_sock, AF_INET, | ||
731 | SOCK_SEQPACKET, IPPROTO_SCTP, | ||
732 | &init_net); | ||
733 | |||
729 | if (err < 0) { | 734 | if (err < 0) { |
730 | printk(KERN_ERR | 735 | printk(KERN_ERR |
731 | "SCTP: Failed to create the SCTP control socket.\n"); | 736 | "SCTP: Failed to create the SCTP control socket.\n"); |