]> err.no Git - linux-2.6/blobdiff - net/dccp/ipv4.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.26
[linux-2.6] / net / dccp / ipv4.c
index cad62d8d87a0e40b18b862eccdf104caf65a9adf..b348dd70c68557f131666f0e7becb9ca2f509abd 100644 (file)
@@ -32,7 +32,7 @@
 #include "feat.h"
 
 /*
- * The dccp_ctl_sk is the global socket data structure used for responding to
+ * The per-net dccp.v4_ctl_sk socket is used for responding to
  * the Out-of-the-blue (OOTB) packets. A control sock will be created
  * for this socket at the initialization time.
  */
@@ -211,8 +211,9 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info)
                return;
        }
 
-       sk = inet_lookup(&init_net, &dccp_hashinfo, iph->daddr, dh->dccph_dport,
-                        iph->saddr, dh->dccph_sport, inet_iif(skb));
+       sk = inet_lookup(dev_net(skb->dev), &dccp_hashinfo,
+                       iph->daddr, dh->dccph_dport,
+                       iph->saddr, dh->dccph_sport, inet_iif(skb));
        if (sk == NULL) {
                ICMP_INC_STATS_BH(ICMP_MIB_INERRORS);
                return;
@@ -429,7 +430,7 @@ 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(&init_net, &dccp_hashinfo,
+       nsk = inet_lookup_established(sock_net(sk), &dccp_hashinfo,
                                      iph->saddr, dh->dccph_sport,
                                      iph->daddr, dh->dccph_dport,
                                      inet_iif(skb));
@@ -445,7 +446,7 @@ static struct sock *dccp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
        return sk;
 }
 
-static struct dst_entry* dccp_v4_route_skb(struct sock *sk,
+static struct dst_entry* dccp_v4_route_skb(struct net *net, struct sock *sk,
                                           struct sk_buff *skb)
 {
        struct rtable *rt;
@@ -462,7 +463,7 @@ static struct dst_entry* dccp_v4_route_skb(struct sock *sk,
                          };
 
        security_skb_classify_flow(skb, &fl);
-       if (ip_route_output_flow(&init_net, &rt, &fl, sk, 0)) {
+       if (ip_route_output_flow(net, &rt, &fl, sk, 0)) {
                IP_INC_STATS_BH(IPSTATS_MIB_OUTNOROUTES);
                return NULL;
        }
@@ -487,7 +488,6 @@ static int dccp_v4_send_response(struct sock *sk, struct request_sock *req)
 
                dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->loc_addr,
                                                              ireq->rmt_addr);
-               memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
                err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr,
                                            ireq->rmt_addr,
                                            ireq->opt);
@@ -515,7 +515,7 @@ static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
        if (rxskb->rtable->rt_type != RTN_LOCAL)
                return;
 
-       dst = dccp_v4_route_skb(ctl_sk, rxskb);
+       dst = dccp_v4_route_skb(net, ctl_sk, rxskb);
        if (dst == NULL)
                return;
 
@@ -810,7 +810,7 @@ static int dccp_v4_rcv(struct sk_buff *skb)
 
        /* Step 2:
         *      Look up flow ID in table and get corresponding socket */
-       sk = __inet_lookup(&init_net, &dccp_hashinfo,
+       sk = __inet_lookup(dev_net(skb->dst->dev), &dccp_hashinfo,
                           iph->saddr, dh->dccph_sport,
                           iph->daddr, dh->dccph_dport, inet_iif(skb));
        /*
@@ -951,6 +951,7 @@ static struct net_protocol dccp_v4_protocol = {
        .handler        = dccp_v4_rcv,
        .err_handler    = dccp_v4_err,
        .no_policy      = 1,
+       .netns_ok       = 1,
 };
 
 static const struct proto_ops inet_dccp_ops = {