aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_fragment.c
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-01-22 09:02:14 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:10:34 -0500
commitac18e7509e7df327e30d6e073a787d922eaf211d (patch)
tree26be1582b59956c389a667d5426fdc538072795b /net/ipv4/ip_fragment.c
parent8d8354d2fb9277f165715a6e1cb92bcc89259975 (diff)
[NETNS][FRAGS]: Make the inet_frag_queue lookup work in namespaces.
Since fragment management code is consolidated, we cannot have the pointer from inet_frag_queue to struct net, since we must know what king of fragment this is. So, I introduce the netns_frags structure. This one is currently empty, but will be eventually filled with per-namespace attributes. Each inet_frag_queue is tagged with this one. The conntrack_reasm is not "netns-izated", so it has one static netns_frags instance to keep working in init namespace. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_fragment.c')
-rw-r--r--net/ipv4/ip_fragment.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index a53463e594b..56211ef46ee 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -236,7 +236,7 @@ out:
236/* Find the correct entry in the "incomplete datagrams" queue for 236/* Find the correct entry in the "incomplete datagrams" queue for
237 * this IP datagram, and create new one, if nothing is found. 237 * this IP datagram, and create new one, if nothing is found.
238 */ 238 */
239static inline struct ipq *ip_find(struct iphdr *iph, u32 user) 239static inline struct ipq *ip_find(struct net *net, struct iphdr *iph, u32 user)
240{ 240{
241 struct inet_frag_queue *q; 241 struct inet_frag_queue *q;
242 struct ip4_create_arg arg; 242 struct ip4_create_arg arg;
@@ -246,7 +246,7 @@ static inline struct ipq *ip_find(struct iphdr *iph, u32 user)
246 arg.user = user; 246 arg.user = user;
247 hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol); 247 hash = ipqhashfn(iph->id, iph->saddr, iph->daddr, iph->protocol);
248 248
249 q = inet_frag_find(&ip4_frags, &arg, hash); 249 q = inet_frag_find(&net->ipv4.frags, &ip4_frags, &arg, hash);
250 if (q == NULL) 250 if (q == NULL)
251 goto out_nomem; 251 goto out_nomem;
252 252
@@ -582,15 +582,17 @@ out_fail:
582int ip_defrag(struct sk_buff *skb, u32 user) 582int ip_defrag(struct sk_buff *skb, u32 user)
583{ 583{
584 struct ipq *qp; 584 struct ipq *qp;
585 struct net *net;
585 586
586 IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS); 587 IP_INC_STATS_BH(IPSTATS_MIB_REASMREQDS);
587 588
589 net = skb->dev->nd_net;
588 /* Start by cleaning up the memory. */ 590 /* Start by cleaning up the memory. */
589 if (atomic_read(&ip4_frags.mem) > ip4_frags_ctl.high_thresh) 591 if (atomic_read(&ip4_frags.mem) > ip4_frags_ctl.high_thresh)
590 ip_evictor(); 592 ip_evictor();
591 593
592 /* Lookup (or create) queue header */ 594 /* Lookup (or create) queue header */
593 if ((qp = ip_find(ip_hdr(skb), user)) != NULL) { 595 if ((qp = ip_find(net, ip_hdr(skb), user)) != NULL) {
594 int ret; 596 int ret;
595 597
596 spin_lock(&qp->q.lock); 598 spin_lock(&qp->q.lock);