dccp: Kill dead code and add static markers.
[linux-2.6.git] / net / dccp / ipv4.c
index 2cf48ba..d4a166f 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <linux/dccp.h>
 #include <linux/icmp.h>
+#include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/skbuff.h>
 #include <linux/random.h>
@@ -62,10 +63,10 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
                nexthop = inet->opt->faddr;
        }
 
-       tmp = ip_route_connect(&rt, nexthop, inet->saddr,
+       tmp = ip_route_connect(&rt, nexthop, inet->inet_saddr,
                               RT_CONN_FLAGS(sk), sk->sk_bound_dev_if,
                               IPPROTO_DCCP,
-                              inet->sport, usin->sin_port, sk, 1);
+                              inet->inet_sport, usin->sin_port, sk, 1);
        if (tmp < 0)
                return tmp;
 
@@ -77,12 +78,12 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
        if (inet->opt == NULL || !inet->opt->srr)
                daddr = rt->rt_dst;
 
-       if (inet->saddr == 0)
-               inet->saddr = rt->rt_src;
-       inet->rcv_saddr = inet->saddr;
+       if (inet->inet_saddr == 0)
+               inet->inet_saddr = rt->rt_src;
+       inet->inet_rcv_saddr = inet->inet_saddr;
 
-       inet->dport = usin->sin_port;
-       inet->daddr = daddr;
+       inet->inet_dport = usin->sin_port;
+       inet->inet_daddr = daddr;
 
        inet_csk(sk)->icsk_ext_hdr_len = 0;
        if (inet->opt != NULL)
@@ -98,17 +99,19 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
        if (err != 0)
                goto failure;
 
-       err = ip_route_newports(&rt, IPPROTO_DCCP, inet->sport, inet->dport,
-                               sk);
+       err = ip_route_newports(&rt, IPPROTO_DCCP, inet->inet_sport,
+                               inet->inet_dport, sk);
        if (err != 0)
                goto failure;
 
        /* OK, now commit destination to socket.  */
-       sk_setup_caps(sk, &rt->u.dst);
+       sk_setup_caps(sk, &rt->dst);
 
-       dp->dccps_iss = secure_dccp_sequence_number(inet->saddr, inet->daddr,
-                                                   inet->sport, inet->dport);
-       inet->id = dp->dccps_iss ^ jiffies;
+       dp->dccps_iss = secure_dccp_sequence_number(inet->inet_saddr,
+                                                   inet->inet_daddr,
+                                                   inet->inet_sport,
+                                                   inet->inet_dport);
+       inet->inet_id = dp->dccps_iss ^ jiffies;
 
        err = dccp_connect(sk);
        rt = NULL;
@@ -123,7 +126,7 @@ failure:
        dccp_set_state(sk, DCCP_CLOSED);
        ip_rt_put(rt);
        sk->sk_route_caps = 0;
-       inet->dport = 0;
+       inet->inet_dport = 0;
        goto out;
 }
 
@@ -346,13 +349,15 @@ static inline __sum16 dccp_v4_csum_finish(struct sk_buff *skb,
        return csum_tcpudp_magic(src, dst, skb->len, IPPROTO_DCCP, skb->csum);
 }
 
-void dccp_v4_send_check(struct sock *sk, int unused, struct sk_buff *skb)
+void dccp_v4_send_check(struct sock *sk, struct sk_buff *skb)
 {
        const struct inet_sock *inet = inet_sk(sk);
        struct dccp_hdr *dh = dccp_hdr(skb);
 
        dccp_csum_outgoing(skb);
-       dh->dccph_checksum = dccp_v4_csum_finish(skb, inet->saddr, inet->daddr);
+       dh->dccph_checksum = dccp_v4_csum_finish(skb,
+                                                inet->inet_saddr,
+                                                inet->inet_daddr);
 }
 
 EXPORT_SYMBOL_GPL(dccp_v4_send_check);
@@ -393,18 +398,18 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
 
        newinet            = inet_sk(newsk);
        ireq               = inet_rsk(req);
-       newinet->daddr     = ireq->rmt_addr;
-       newinet->rcv_saddr = ireq->loc_addr;
-       newinet->saddr     = ireq->loc_addr;
+       newinet->inet_daddr     = ireq->rmt_addr;
+       newinet->inet_rcv_saddr = ireq->loc_addr;
+       newinet->inet_saddr     = ireq->loc_addr;
        newinet->opt       = ireq->opt;
        ireq->opt          = NULL;
        newinet->mc_index  = inet_iif(skb);
        newinet->mc_ttl    = ip_hdr(skb)->ttl;
-       newinet->id        = jiffies;
+       newinet->inet_id   = jiffies;
 
        dccp_sync_mss(newsk, dst_mtu(dst));
 
-       __inet_hash_nolisten(newsk);
+       __inet_hash_nolisten(newsk, NULL);
        __inet_inherit_port(sk, newsk);
 
        return newsk;
@@ -470,10 +475,11 @@ static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
                return NULL;
        }
 
-       return &rt->u.dst;
+       return &rt->dst;
 }
 
-static int dccp_v4_send_response(struct sock *sk, struct request_sock *req)
+static int dccp_v4_send_response(struct sock *sk, struct request_sock *req,
+                                struct request_values *rv_unused)
 {
        int err = -1;
        struct sk_buff *skb;
@@ -507,7 +513,7 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
        const struct iphdr *rxiph;
        struct sk_buff *skb;
        struct dst_entry *dst;
-       struct net *net = dev_net(rxskb->dst->dev);
+       struct net *net = dev_net(skb_dst(rxskb)->dev);
        struct sock *ctl_sk = net->dccp.v4_ctl_sk;
 
        /* Never send a reset in response to a reset. */
@@ -528,7 +534,7 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
        rxiph = ip_hdr(rxskb);
        dccp_hdr(skb)->dccph_checksum = dccp_v4_csum_finish(skb, rxiph->saddr,
                                                                 rxiph->daddr);
-       skb->dst = dst_clone(dst);
+       skb_dst_set(skb, dst_clone(dst));
 
        bh_lock_sock(ctl_sk);
        err = ip_build_and_send_pkt(skb, ctl_sk,
@@ -622,7 +628,7 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
        dreq->dreq_iss     = dccp_v4_init_sequence(skb);
        dreq->dreq_service = service;
 
-       if (dccp_v4_send_response(sk, req))
+       if (dccp_v4_send_response(sk, req, NULL))
                goto drop_and_free;
 
        inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT);
@@ -880,7 +886,7 @@ discard_and_relse:
        goto discard_it;
 }
 
-static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = {
+static const struct inet_connection_sock_af_ops dccp_ipv4_af_ops = {
        .queue_xmit        = ip_queue_xmit,
        .send_check        = dccp_v4_send_check,
        .rebuild_header    = inet_sk_rebuild_header,
@@ -948,7 +954,7 @@ static struct proto dccp_v4_prot = {
 #endif
 };
 
-static struct net_protocol dccp_v4_protocol = {
+static const struct net_protocol dccp_v4_protocol = {
        .handler        = dccp_v4_rcv,
        .err_handler    = dccp_v4_err,
        .no_policy      = 1,
@@ -987,21 +993,20 @@ static struct inet_protosw dccp_v4_protosw = {
        .protocol       = IPPROTO_DCCP,
        .prot           = &dccp_v4_prot,
        .ops            = &inet_dccp_ops,
-       .capability     = -1,
        .no_check       = 0,
        .flags          = INET_PROTOSW_ICSK,
 };
 
-static int dccp_v4_init_net(struct net *net)
+static int __net_init dccp_v4_init_net(struct net *net)
 {
-       int err;
+       if (dccp_hashinfo.bhash == NULL)
+               return -ESOCKTNOSUPPORT;
 
-       err = inet_ctl_sock_create(&net->dccp.v4_ctl_sk, PF_INET,
-                                  SOCK_DCCP, IPPROTO_DCCP, net);
-       return err;
+       return inet_ctl_sock_create(&net->dccp.v4_ctl_sk, PF_INET,
+                                   SOCK_DCCP, IPPROTO_DCCP, net);
 }
 
-static void dccp_v4_exit_net(struct net *net)
+static void __net_exit dccp_v4_exit_net(struct net *net)
 {
        inet_ctl_sock_destroy(net->dccp.v4_ctl_sk);
 }