]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/ipv4/af_inet.c
[SOCK]: Introduce sk_setup_caps
[net-next-2.6.git] / net / ipv4 / af_inet.c
index 658e7977924dad3eb6cd2830d8158d2109e2c261..9e83d7773d8f29a79ef5cfa1d248130d78fbe138 100644 (file)
 
 DEFINE_SNMP_STAT(struct linux_mib, net_statistics);
 
-#ifdef INET_REFCNT_DEBUG
-atomic_t inet_sock_nr;
-#endif
-
 extern void ip_mc_drop_socket(struct sock *sk);
 
 /* The inetsw table contains everything that inet_create needs to
@@ -153,11 +149,7 @@ void inet_sock_destruct(struct sock *sk)
        if (inet->opt)
                kfree(inet->opt);
        dst_release(sk->sk_dst_cache);
-#ifdef INET_REFCNT_DEBUG
-       atomic_dec(&inet_sock_nr);
-       printk(KERN_DEBUG "INET socket %p released, %d are still alive\n",
-              sk, atomic_read(&inet_sock_nr));
-#endif
+       sk_refcnt_debug_dec(sk);
 }
 
 /*
@@ -317,9 +309,7 @@ static int inet_create(struct socket *sock, int protocol)
        inet->mc_index  = 0;
        inet->mc_list   = NULL;
 
-#ifdef INET_REFCNT_DEBUG
-       atomic_inc(&inet_sock_nr);
-#endif
+       sk_refcnt_debug_inc(sk);
 
        if (inet->num) {
                /* It assumes that any protocol which allows
@@ -1009,6 +999,15 @@ static int __init init_ipv4_mibs(void)
 static int ipv4_proc_init(void);
 extern void ipfrag_init(void);
 
+/*
+ *     IP protocol layer initialiser
+ */
+
+static struct packet_type ip_packet_type = {
+       .type = __constant_htons(ETH_P_IP),
+       .func = ip_rcv,
+};
+
 static int __init inet_init(void)
 {
        struct sk_buff *dummy_skb;
@@ -1102,6 +1101,8 @@ static int __init inet_init(void)
 
        ipfrag_init();
 
+       dev_add_pack(&ip_packet_type);
+
        rc = 0;
 out:
        return rc;
@@ -1146,7 +1147,7 @@ static int __init ipv4_proc_init(void)
 #ifdef CONFIG_IP_FIB_TRIE
          if (fib_stat_proc_init())
                  goto out_fib_stat;
- #endif
+#endif
        if (ip_misc_proc_init())
                goto out_misc;
 out:
@@ -1194,7 +1195,3 @@ 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);
-#endif