]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/dccp/ipv4.c
[IPV4]: ip_route_connect() ipv4 address arguments annotated
[net-next-2.6.git] / net / dccp / ipv4.c
index f2c011fd2ba128f92757aa816da604804d99394f..bf692c1c116f69a1384d7124c03212ee2d504ebb 100644 (file)
@@ -10,7 +10,6 @@
  *     2 of the License, or (at your option) any later version.
  */
 
-#include <linux/config.h>
 #include <linux/dccp.h>
 #include <linux/icmp.h>
 #include <linux/module.h>
@@ -51,15 +50,12 @@ int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len)
        struct dccp_sock *dp = dccp_sk(sk);
        const struct sockaddr_in *usin = (struct sockaddr_in *)uaddr;
        struct rtable *rt;
-       u32 daddr, nexthop;
+       __be32 daddr, nexthop;
        int tmp;
        int err;
 
        dp->dccps_role = DCCP_ROLE_CLIENT;
 
-       if (dccp_service_not_initialized(sk))
-               return -EPROTO;
-
        if (addr_len < sizeof(struct sockaddr_in))
                return -EINVAL;
 
@@ -502,11 +498,13 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
 
        dccp_openreq_init(req, &dp, skb);
 
+       if (security_inet_conn_request(sk, skb, req))
+               goto drop_and_free;
+
        ireq = inet_rsk(req);
        ireq->loc_addr = daddr;
        ireq->rmt_addr = saddr;
-       req->rcv_wnd    = 100; /* Fake, option parsing will get the
-                                 right value */
+       req->rcv_wnd    = dccp_feat_default_sequence_window;
        ireq->opt       = NULL;
 
        /* 
@@ -607,10 +605,10 @@ static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
        if (req != NULL)
                return dccp_check_req(sk, skb, req, prev);
 
-       nsk = __inet_lookup_established(&dccp_hashinfo,
-                                       iph->saddr, dh->dccph_sport,
-                                       iph->daddr, ntohs(dh->dccph_dport),
-                                       inet_iif(skb));
+       nsk = inet_lookup_established(&dccp_hashinfo,
+                                     iph->saddr, dh->dccph_sport,
+                                     iph->daddr, dh->dccph_dport,
+                                     inet_iif(skb));
        if (nsk != NULL) {
                if (nsk->sk_state != DCCP_TIME_WAIT) {
                        bh_lock_sock(nsk);
@@ -680,6 +678,7 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk,
                                     }
                          };
 
+       security_skb_classify_flow(skb, &fl);
        if (ip_route_output_flow(&rt, &fl, sk, 0)) {
                IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
                return NULL;
@@ -923,7 +922,7 @@ static int dccp_v4_rcv(struct sk_buff *skb)
         *      Look up flow ID in table and get corresponding socket */
        sk = __inet_lookup(&dccp_hashinfo,
                           skb->nh.iph->saddr, dh->dccph_sport,
-                          skb->nh.iph->daddr, ntohs(dh->dccph_dport),
+                          skb->nh.iph->daddr, dh->dccph_dport,
                           inet_iif(skb));
 
        /*