Skip to content

Commit

Permalink
SCTP: change sctp_ctl_sock_init() to try IPv4 if IPv6 fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Brian Haley authored and David S. Miller committed Mar 4, 2009
1 parent fe7ca2e commit fb13d9f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions net/sctp/protocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,15 +717,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");
Expand Down

0 comments on commit fb13d9f

Please sign in to comment.