aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@redhat.com>2014-08-01 06:29:44 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-02 18:31:31 -0400
commit06aa8b8a0345c78f4d9a1fb3f852952b12a0e40c (patch)
tree9511c6007eed4f71fe5e601688f35d6ff7dd4b9b /net
parentd2373862b3589260f0139a6e4969478f84154369 (diff)
inet: frags: rename last_in to flags
The last_in field has been used to store various flags different from first/last frag in so give it a more descriptive name: flags. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ieee802154/reassembly.c14
-rw-r--r--net/ipv4/inet_fragment.c14
-rw-r--r--net/ipv4/ip_fragment.c20
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c12
-rw-r--r--net/ipv6/reassembly.c18
5 files changed, 39 insertions, 39 deletions
diff --git a/net/ieee802154/reassembly.c b/net/ieee802154/reassembly.c
index f13d4f32e207..5607accd2fee 100644
--- a/net/ieee802154/reassembly.c
+++ b/net/ieee802154/reassembly.c
@@ -99,7 +99,7 @@ static void lowpan_frag_expire(unsigned long data)
99 99
100 spin_lock(&fq->q.lock); 100 spin_lock(&fq->q.lock);
101 101
102 if (fq->q.last_in & INET_FRAG_COMPLETE) 102 if (fq->q.flags & INET_FRAG_COMPLETE)
103 goto out; 103 goto out;
104 104
105 inet_frag_kill(&fq->q, &lowpan_frags); 105 inet_frag_kill(&fq->q, &lowpan_frags);
@@ -142,7 +142,7 @@ static int lowpan_frag_queue(struct lowpan_frag_queue *fq,
142 struct net_device *dev; 142 struct net_device *dev;
143 int end, offset; 143 int end, offset;
144 144
145 if (fq->q.last_in & INET_FRAG_COMPLETE) 145 if (fq->q.flags & INET_FRAG_COMPLETE)
146 goto err; 146 goto err;
147 147
148 offset = lowpan_cb(skb)->d_offset << 3; 148 offset = lowpan_cb(skb)->d_offset << 3;
@@ -154,14 +154,14 @@ static int lowpan_frag_queue(struct lowpan_frag_queue *fq,
154 * or have different end, the segment is corrupted. 154 * or have different end, the segment is corrupted.
155 */ 155 */
156 if (end < fq->q.len || 156 if (end < fq->q.len ||
157 ((fq->q.last_in & INET_FRAG_LAST_IN) && end != fq->q.len)) 157 ((fq->q.flags & INET_FRAG_LAST_IN) && end != fq->q.len))
158 goto err; 158 goto err;
159 fq->q.last_in |= INET_FRAG_LAST_IN; 159 fq->q.flags |= INET_FRAG_LAST_IN;
160 fq->q.len = end; 160 fq->q.len = end;
161 } else { 161 } else {
162 if (end > fq->q.len) { 162 if (end > fq->q.len) {
163 /* Some bits beyond end -> corruption. */ 163 /* Some bits beyond end -> corruption. */
164 if (fq->q.last_in & INET_FRAG_LAST_IN) 164 if (fq->q.flags & INET_FRAG_LAST_IN)
165 goto err; 165 goto err;
166 fq->q.len = end; 166 fq->q.len = end;
167 } 167 }
@@ -201,13 +201,13 @@ found:
201 if (frag_type == LOWPAN_DISPATCH_FRAG1) { 201 if (frag_type == LOWPAN_DISPATCH_FRAG1) {
202 /* Calculate uncomp. 6lowpan header to estimate full size */ 202 /* Calculate uncomp. 6lowpan header to estimate full size */
203 fq->q.meat += lowpan_uncompress_size(skb, NULL); 203 fq->q.meat += lowpan_uncompress_size(skb, NULL);
204 fq->q.last_in |= INET_FRAG_FIRST_IN; 204 fq->q.flags |= INET_FRAG_FIRST_IN;
205 } else { 205 } else {
206 fq->q.meat += skb->len; 206 fq->q.meat += skb->len;
207 } 207 }
208 add_frag_mem_limit(&fq->q, skb->truesize); 208 add_frag_mem_limit(&fq->q, skb->truesize);
209 209
210 if (fq->q.last_in == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) && 210 if (fq->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
211 fq->q.meat == fq->q.len) { 211 fq->q.meat == fq->q.len) {
212 int res; 212 int res;
213 unsigned long orefdst = skb->_skb_refdst; 213 unsigned long orefdst = skb->_skb_refdst;
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 62b1f73749dc..e3ebc6608e5d 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -152,8 +152,8 @@ evict_again:
152 } 152 }
153 153
154 /* suppress xmit of (icmp) error packet */ 154 /* suppress xmit of (icmp) error packet */
155 fq->last_in &= ~INET_FRAG_FIRST_IN; 155 fq->flags &= ~INET_FRAG_FIRST_IN;
156 fq->last_in |= INET_FRAG_EVICTED; 156 fq->flags |= INET_FRAG_EVICTED;
157 hlist_del(&fq->list); 157 hlist_del(&fq->list);
158 hlist_add_head(&fq->list, &expired); 158 hlist_add_head(&fq->list, &expired);
159 ++evicted; 159 ++evicted;
@@ -289,16 +289,16 @@ void inet_frag_kill(struct inet_frag_queue *fq, struct inet_frags *f)
289 if (del_timer(&fq->timer)) 289 if (del_timer(&fq->timer))
290 atomic_dec(&fq->refcnt); 290 atomic_dec(&fq->refcnt);
291 291
292 if (!(fq->last_in & INET_FRAG_COMPLETE)) { 292 if (!(fq->flags & INET_FRAG_COMPLETE)) {
293 fq_unlink(fq, f); 293 fq_unlink(fq, f);
294 atomic_dec(&fq->refcnt); 294 atomic_dec(&fq->refcnt);
295 fq->last_in |= INET_FRAG_COMPLETE; 295 fq->flags |= INET_FRAG_COMPLETE;
296 } 296 }
297} 297}
298EXPORT_SYMBOL(inet_frag_kill); 298EXPORT_SYMBOL(inet_frag_kill);
299 299
300static inline void frag_kfree_skb(struct netns_frags *nf, struct inet_frags *f, 300static inline void frag_kfree_skb(struct netns_frags *nf, struct inet_frags *f,
301 struct sk_buff *skb) 301 struct sk_buff *skb)
302{ 302{
303 if (f->skb_free) 303 if (f->skb_free)
304 f->skb_free(skb); 304 f->skb_free(skb);
@@ -311,7 +311,7 @@ void inet_frag_destroy(struct inet_frag_queue *q, struct inet_frags *f)
311 struct netns_frags *nf; 311 struct netns_frags *nf;
312 unsigned int sum, sum_truesize = 0; 312 unsigned int sum, sum_truesize = 0;
313 313
314 WARN_ON(!(q->last_in & INET_FRAG_COMPLETE)); 314 WARN_ON(!(q->flags & INET_FRAG_COMPLETE));
315 WARN_ON(del_timer(&q->timer) != 0); 315 WARN_ON(del_timer(&q->timer) != 0);
316 316
317 /* Release all fragment data. */ 317 /* Release all fragment data. */
@@ -349,7 +349,7 @@ static struct inet_frag_queue *inet_frag_intern(struct netns_frags *nf,
349 if (qp->net == nf && f->match(qp, arg)) { 349 if (qp->net == nf && f->match(qp, arg)) {
350 atomic_inc(&qp->refcnt); 350 atomic_inc(&qp->refcnt);
351 spin_unlock(&hb->chain_lock); 351 spin_unlock(&hb->chain_lock);
352 qp_in->last_in |= INET_FRAG_COMPLETE; 352 qp_in->flags |= INET_FRAG_COMPLETE;
353 inet_frag_put(qp_in, f); 353 inet_frag_put(qp_in, f);
354 return qp; 354 return qp;
355 } 355 }
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 634fc31aa243..6fce1ecc5bca 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -185,16 +185,16 @@ static void ip_expire(unsigned long arg)
185 185
186 spin_lock(&qp->q.lock); 186 spin_lock(&qp->q.lock);
187 187
188 if (qp->q.last_in & INET_FRAG_COMPLETE) 188 if (qp->q.flags & INET_FRAG_COMPLETE)
189 goto out; 189 goto out;
190 190
191 ipq_kill(qp); 191 ipq_kill(qp);
192 192
193 if (!(qp->q.last_in & INET_FRAG_EVICTED)) 193 if (!(qp->q.flags & INET_FRAG_EVICTED))
194 IP_INC_STATS_BH(net, IPSTATS_MIB_REASMTIMEOUT); 194 IP_INC_STATS_BH(net, IPSTATS_MIB_REASMTIMEOUT);
195 IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS); 195 IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS);
196 196
197 if ((qp->q.last_in & INET_FRAG_FIRST_IN) && qp->q.fragments != NULL) { 197 if ((qp->q.flags & INET_FRAG_FIRST_IN) && qp->q.fragments != NULL) {
198 struct sk_buff *head = qp->q.fragments; 198 struct sk_buff *head = qp->q.fragments;
199 const struct iphdr *iph; 199 const struct iphdr *iph;
200 int err; 200 int err;
@@ -302,7 +302,7 @@ static int ip_frag_reinit(struct ipq *qp)
302 } while (fp); 302 } while (fp);
303 sub_frag_mem_limit(&qp->q, sum_truesize); 303 sub_frag_mem_limit(&qp->q, sum_truesize);
304 304
305 qp->q.last_in = 0; 305 qp->q.flags = 0;
306 qp->q.len = 0; 306 qp->q.len = 0;
307 qp->q.meat = 0; 307 qp->q.meat = 0;
308 qp->q.fragments = NULL; 308 qp->q.fragments = NULL;
@@ -323,7 +323,7 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb)
323 int err = -ENOENT; 323 int err = -ENOENT;
324 u8 ecn; 324 u8 ecn;
325 325
326 if (qp->q.last_in & INET_FRAG_COMPLETE) 326 if (qp->q.flags & INET_FRAG_COMPLETE)
327 goto err; 327 goto err;
328 328
329 if (!(IPCB(skb)->flags & IPSKB_FRAG_COMPLETE) && 329 if (!(IPCB(skb)->flags & IPSKB_FRAG_COMPLETE) &&
@@ -350,9 +350,9 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb)
350 * or have different end, the segment is corrupted. 350 * or have different end, the segment is corrupted.
351 */ 351 */
352 if (end < qp->q.len || 352 if (end < qp->q.len ||
353 ((qp->q.last_in & INET_FRAG_LAST_IN) && end != qp->q.len)) 353 ((qp->q.flags & INET_FRAG_LAST_IN) && end != qp->q.len))
354 goto err; 354 goto err;
355 qp->q.last_in |= INET_FRAG_LAST_IN; 355 qp->q.flags |= INET_FRAG_LAST_IN;
356 qp->q.len = end; 356 qp->q.len = end;
357 } else { 357 } else {
358 if (end&7) { 358 if (end&7) {
@@ -362,7 +362,7 @@ static int ip_frag_queue(struct ipq *qp, struct sk_buff *skb)
362 } 362 }
363 if (end > qp->q.len) { 363 if (end > qp->q.len) {
364 /* Some bits beyond end -> corruption. */ 364 /* Some bits beyond end -> corruption. */
365 if (qp->q.last_in & INET_FRAG_LAST_IN) 365 if (qp->q.flags & INET_FRAG_LAST_IN)
366 goto err; 366 goto err;
367 qp->q.len = end; 367 qp->q.len = end;
368 } 368 }
@@ -471,13 +471,13 @@ found:
471 qp->ecn |= ecn; 471 qp->ecn |= ecn;
472 add_frag_mem_limit(&qp->q, skb->truesize); 472 add_frag_mem_limit(&qp->q, skb->truesize);
473 if (offset == 0) 473 if (offset == 0)
474 qp->q.last_in |= INET_FRAG_FIRST_IN; 474 qp->q.flags |= INET_FRAG_FIRST_IN;
475 475
476 if (ip_hdr(skb)->frag_off & htons(IP_DF) && 476 if (ip_hdr(skb)->frag_off & htons(IP_DF) &&
477 skb->len + ihl > qp->q.max_size) 477 skb->len + ihl > qp->q.max_size)
478 qp->q.max_size = skb->len + ihl; 478 qp->q.max_size = skb->len + ihl;
479 479
480 if (qp->q.last_in == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) && 480 if (qp->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
481 qp->q.meat == qp->q.len) { 481 qp->q.meat == qp->q.len) {
482 unsigned long orefdst = skb->_skb_refdst; 482 unsigned long orefdst = skb->_skb_refdst;
483 483
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index 3d4bccf6d67d..cca686e42b97 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -222,7 +222,7 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,
222 int offset, end; 222 int offset, end;
223 u8 ecn; 223 u8 ecn;
224 224
225 if (fq->q.last_in & INET_FRAG_COMPLETE) { 225 if (fq->q.flags & INET_FRAG_COMPLETE) {
226 pr_debug("Already completed\n"); 226 pr_debug("Already completed\n");
227 goto err; 227 goto err;
228 } 228 }
@@ -253,11 +253,11 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,
253 * or have different end, the segment is corrupted. 253 * or have different end, the segment is corrupted.
254 */ 254 */
255 if (end < fq->q.len || 255 if (end < fq->q.len ||
256 ((fq->q.last_in & INET_FRAG_LAST_IN) && end != fq->q.len)) { 256 ((fq->q.flags & INET_FRAG_LAST_IN) && end != fq->q.len)) {
257 pr_debug("already received last fragment\n"); 257 pr_debug("already received last fragment\n");
258 goto err; 258 goto err;
259 } 259 }
260 fq->q.last_in |= INET_FRAG_LAST_IN; 260 fq->q.flags |= INET_FRAG_LAST_IN;
261 fq->q.len = end; 261 fq->q.len = end;
262 } else { 262 } else {
263 /* Check if the fragment is rounded to 8 bytes. 263 /* Check if the fragment is rounded to 8 bytes.
@@ -272,7 +272,7 @@ static int nf_ct_frag6_queue(struct frag_queue *fq, struct sk_buff *skb,
272 } 272 }
273 if (end > fq->q.len) { 273 if (end > fq->q.len) {
274 /* Some bits beyond end -> corruption. */ 274 /* Some bits beyond end -> corruption. */
275 if (fq->q.last_in & INET_FRAG_LAST_IN) { 275 if (fq->q.flags & INET_FRAG_LAST_IN) {
276 pr_debug("last packet already reached.\n"); 276 pr_debug("last packet already reached.\n");
277 goto err; 277 goto err;
278 } 278 }
@@ -354,7 +354,7 @@ found:
354 */ 354 */
355 if (offset == 0) { 355 if (offset == 0) {
356 fq->nhoffset = nhoff; 356 fq->nhoffset = nhoff;
357 fq->q.last_in |= INET_FRAG_FIRST_IN; 357 fq->q.flags |= INET_FRAG_FIRST_IN;
358 } 358 }
359 359
360 return 0; 360 return 0;
@@ -617,7 +617,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user)
617 goto ret_orig; 617 goto ret_orig;
618 } 618 }
619 619
620 if (fq->q.last_in == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) && 620 if (fq->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
621 fq->q.meat == fq->q.len) { 621 fq->q.meat == fq->q.len) {
622 ret_skb = nf_ct_frag6_reasm(fq, dev); 622 ret_skb = nf_ct_frag6_reasm(fq, dev);
623 if (ret_skb == NULL) 623 if (ret_skb == NULL)
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 512ccc027ce3..b4baceed0d0d 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -131,7 +131,7 @@ void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq,
131 131
132 spin_lock(&fq->q.lock); 132 spin_lock(&fq->q.lock);
133 133
134 if (fq->q.last_in & INET_FRAG_COMPLETE) 134 if (fq->q.flags & INET_FRAG_COMPLETE)
135 goto out; 135 goto out;
136 136
137 inet_frag_kill(&fq->q, frags); 137 inet_frag_kill(&fq->q, frags);
@@ -141,13 +141,13 @@ void ip6_expire_frag_queue(struct net *net, struct frag_queue *fq,
141 if (!dev) 141 if (!dev)
142 goto out_rcu_unlock; 142 goto out_rcu_unlock;
143 143
144 if (!(fq->q.last_in & INET_FRAG_EVICTED)) 144 if (!(fq->q.flags & INET_FRAG_EVICTED))
145 IP6_INC_STATS_BH(net, __in6_dev_get(dev), 145 IP6_INC_STATS_BH(net, __in6_dev_get(dev),
146 IPSTATS_MIB_REASMTIMEOUT); 146 IPSTATS_MIB_REASMTIMEOUT);
147 IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS); 147 IP6_INC_STATS_BH(net, __in6_dev_get(dev), IPSTATS_MIB_REASMFAILS);
148 148
149 /* Don't send error if the first segment did not arrive. */ 149 /* Don't send error if the first segment did not arrive. */
150 if (!(fq->q.last_in & INET_FRAG_FIRST_IN) || !fq->q.fragments) 150 if (!(fq->q.flags & INET_FRAG_FIRST_IN) || !fq->q.fragments)
151 goto out_rcu_unlock; 151 goto out_rcu_unlock;
152 152
153 /* 153 /*
@@ -209,7 +209,7 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
209 struct net *net = dev_net(skb_dst(skb)->dev); 209 struct net *net = dev_net(skb_dst(skb)->dev);
210 u8 ecn; 210 u8 ecn;
211 211
212 if (fq->q.last_in & INET_FRAG_COMPLETE) 212 if (fq->q.flags & INET_FRAG_COMPLETE)
213 goto err; 213 goto err;
214 214
215 offset = ntohs(fhdr->frag_off) & ~0x7; 215 offset = ntohs(fhdr->frag_off) & ~0x7;
@@ -240,9 +240,9 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
240 * or have different end, the segment is corrupted. 240 * or have different end, the segment is corrupted.
241 */ 241 */
242 if (end < fq->q.len || 242 if (end < fq->q.len ||
243 ((fq->q.last_in & INET_FRAG_LAST_IN) && end != fq->q.len)) 243 ((fq->q.flags & INET_FRAG_LAST_IN) && end != fq->q.len))
244 goto err; 244 goto err;
245 fq->q.last_in |= INET_FRAG_LAST_IN; 245 fq->q.flags |= INET_FRAG_LAST_IN;
246 fq->q.len = end; 246 fq->q.len = end;
247 } else { 247 } else {
248 /* Check if the fragment is rounded to 8 bytes. 248 /* Check if the fragment is rounded to 8 bytes.
@@ -260,7 +260,7 @@ static int ip6_frag_queue(struct frag_queue *fq, struct sk_buff *skb,
260 } 260 }
261 if (end > fq->q.len) { 261 if (end > fq->q.len) {
262 /* Some bits beyond end -> corruption. */ 262 /* Some bits beyond end -> corruption. */
263 if (fq->q.last_in & INET_FRAG_LAST_IN) 263 if (fq->q.flags & INET_FRAG_LAST_IN)
264 goto err; 264 goto err;
265 fq->q.len = end; 265 fq->q.len = end;
266 } 266 }
@@ -335,10 +335,10 @@ found:
335 */ 335 */
336 if (offset == 0) { 336 if (offset == 0) {
337 fq->nhoffset = nhoff; 337 fq->nhoffset = nhoff;
338 fq->q.last_in |= INET_FRAG_FIRST_IN; 338 fq->q.flags |= INET_FRAG_FIRST_IN;
339 } 339 }
340 340
341 if (fq->q.last_in == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) && 341 if (fq->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
342 fq->q.meat == fq->q.len) { 342 fq->q.meat == fq->q.len) {
343 int res; 343 int res;
344 unsigned long orefdst = skb->_skb_refdst; 344 unsigned long orefdst = skb->_skb_refdst;