af_packet: mc_drop/flush_mclist changes
[safe/jmp/linux-2.6] / net / sctp / protocol.c
index cb2c50d..d9f4cc2 100644 (file)
@@ -160,6 +160,7 @@ static void sctp_proc_exit(void)
                remove_proc_entry("sctp", init_net.proc_net);
        }
 #endif
+       percpu_counter_destroy(&sctp_sockets_allocated);
 }
 
 /* Private helper to extract ipv4 address and stash them in
@@ -295,19 +296,19 @@ static void sctp_v4_from_sk(union sctp_addr *addr, struct sock *sk)
 {
        addr->v4.sin_family = AF_INET;
        addr->v4.sin_port = 0;
-       addr->v4.sin_addr.s_addr = inet_sk(sk)->rcv_saddr;
+       addr->v4.sin_addr.s_addr = inet_sk(sk)->inet_rcv_saddr;
 }
 
 /* Initialize sk->sk_rcv_saddr from sctp_addr. */
 static void sctp_v4_to_sk_saddr(union sctp_addr *addr, struct sock *sk)
 {
-       inet_sk(sk)->rcv_saddr = addr->v4.sin_addr.s_addr;
+       inet_sk(sk)->inet_rcv_saddr = addr->v4.sin_addr.s_addr;
 }
 
 /* Initialize sk->sk_daddr from sctp_addr. */
 static void sctp_v4_to_sk_daddr(union sctp_addr *addr, struct sock *sk)
 {
-       inet_sk(sk)->daddr = addr->v4.sin_addr.s_addr;
+       inet_sk(sk)->inet_daddr = addr->v4.sin_addr.s_addr;
 }
 
 /* Initialize a sctp_addr from an address parameter. */
@@ -430,16 +431,14 @@ static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp)
  * of requested destination address, sender and receiver
  * SHOULD include all of its addresses with level greater
  * than or equal to L.
+ *
+ * IPv4 scoping can be controlled through sysctl option
+ * net.sctp.addr_scope_policy
  */
 static sctp_scope_t sctp_v4_scope(union sctp_addr *addr)
 {
        sctp_scope_t retval;
 
-       /* Should IPv4 scoping be a sysctl configurable option
-        * so users can turn it off (default on) for certain
-        * unconventional networking environments?
-        */
-
        /* Check for unusable SCTP addresses. */
        if (IS_IPV4_UNUSABLE_ADDRESS(addr->v4.sin_addr.s_addr)) {
                retval =  SCTP_SCOPE_UNUSABLE;
@@ -599,7 +598,7 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk,
 
        newinet = inet_sk(newsk);
 
-       newinet->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr;
+       newinet->inet_daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr;
 
        sk_refcnt_debug_inc(newsk);
 
@@ -925,7 +924,7 @@ static struct inet_protosw sctp_stream_protosw = {
 };
 
 /* Register with IP layer.  */
-static struct net_protocol sctp_protocol = {
+static const struct net_protocol sctp_protocol = {
        .handler     = sctp_rcv,
        .err_handler = sctp_v4_err,
        .no_policy   = 1,
@@ -1185,10 +1184,10 @@ SCTP_STATIC __init int sctp_init(void)
        /* Size and allocate the association hash table.
         * The methodology is similar to that of the tcp hash tables.
         */
-       if (num_physpages >= (128 * 1024))
-               goal = num_physpages >> (22 - PAGE_SHIFT);
+       if (totalram_pages >= (128 * 1024))
+               goal = totalram_pages >> (22 - PAGE_SHIFT);
        else
-               goal = num_physpages >> (24 - PAGE_SHIFT);
+               goal = totalram_pages >> (24 - PAGE_SHIFT);
 
        for (order = 0; (1UL << order) < goal; order++)
                ;
@@ -1258,6 +1257,9 @@ SCTP_STATIC __init int sctp_init(void)
        /* Disable AUTH by default. */
        sctp_auth_enable = 0;
 
+       /* Set SCOPE policy to enabled */
+       sctp_scope_policy = SCTP_SCOPE_POLICY_ENABLE;
+
        sctp_sysctl_register();
 
        INIT_LIST_HEAD(&sctp_address_families);
@@ -1370,6 +1372,8 @@ SCTP_STATIC __exit void sctp_exit(void)
        sctp_proc_exit();
        cleanup_sctp_mibs();
 
+       rcu_barrier(); /* Wait for completion of call_rcu()'s */
+
        kmem_cache_destroy(sctp_chunk_cachep);
        kmem_cache_destroy(sctp_bucket_cachep);
 }