[SCTP] Add support for ip_nonlocal_bind sysctl & IP_FREEBIND socket option
authorNeil Horman <nhorman@redhat.com>
Mon, 13 Jun 2005 22:12:33 +0000 (15:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 13 Jun 2005 22:12:33 +0000 (15:12 -0700)
Signed-off-by: Neil Horman <nhorman@redhat.com>
Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip.h
net/ipv4/af_inet.c
net/sctp/protocol.c

index 3f63992eb71292da8a08f6ed44dc3f72a743b245..32360bbe143faebcefe80eb9ae7a43d19585680c 100644 (file)
@@ -163,6 +163,7 @@ DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
 
 extern int sysctl_local_port_range[2];
 extern int sysctl_ip_default_ttl;
+extern int sysctl_ip_nonlocal_bind;
 
 #ifdef CONFIG_INET
 /* The function in 2.2 was invalid, producing wrong result for
index b3cb49ce5fad433acafce912f9efeb5e81d7d3a2..03942f13394471c2e0816a70765da05fc518d9ff 100644 (file)
@@ -1181,6 +1181,7 @@ EXPORT_SYMBOL(inet_stream_connect);
 EXPORT_SYMBOL(inet_stream_ops);
 EXPORT_SYMBOL(inet_unregister_protosw);
 EXPORT_SYMBOL(net_statistics);
+EXPORT_SYMBOL(sysctl_ip_nonlocal_bind);
 
 #ifdef INET_REFCNT_DEBUG
 EXPORT_SYMBOL(inet_sock_nr);
index 2e1f9c3556f5922a9018c30055949f7a64f333be..5135e1a25d25c1413984520c7204f6df3d7d2df4 100644 (file)
@@ -378,10 +378,13 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp)
 {
        int ret = inet_addr_type(addr->v4.sin_addr.s_addr);
 
-       /* FIXME: ip_nonlocal_bind sysctl support. */
 
-       if (addr->v4.sin_addr.s_addr != INADDR_ANY && ret != RTN_LOCAL)
+       if (addr->v4.sin_addr.s_addr != INADDR_ANY &&
+          ret != RTN_LOCAL &&
+          !sp->inet.freebind &&
+          !sysctl_ip_nonlocal_bind)
                return 0;
+
        return 1;
 }