ip: introduce ip_is_fragment helper inline function
There are enough instances of this: iph->frag_off & htons(IP_MF | IP_OFFSET) that a helper function is probably warranted. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
f470e5ae34
commit
56f8a75c17
@@ -82,7 +82,7 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
|
||||
#endif
|
||||
#endif
|
||||
/* Gather fragments. */
|
||||
if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
|
||||
if (ip_is_fragment(ip_hdr(skb))) {
|
||||
enum ip_defrag_users user = nf_ct_defrag_user(hooknum, skb);
|
||||
if (nf_ct_ipv4_gather_frags(skb, user))
|
||||
return NF_STOLEN;
|
||||
|
@@ -88,7 +88,7 @@ nf_nat_fn(unsigned int hooknum,
|
||||
|
||||
/* We never see fragments: conntrack defrags on pre-routing
|
||||
and local-out, and nf_nat_out protects post-routing. */
|
||||
NF_CT_ASSERT(!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)));
|
||||
NF_CT_ASSERT(!ip_is_fragment(ip_hdr(skb)));
|
||||
|
||||
ct = nf_ct_get(skb, &ctinfo);
|
||||
/* Can't track? It's not due to stress, or conntrack would
|
||||
|
Reference in New Issue
Block a user