mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
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 <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
f470e5ae34
commit
56f8a75c17
19 changed files with 27 additions and 23 deletions
|
|
@ -165,7 +165,7 @@ int ip_call_ra_chain(struct sk_buff *skb)
|
|||
(!sk->sk_bound_dev_if ||
|
||||
sk->sk_bound_dev_if == dev->ifindex) &&
|
||||
net_eq(sock_net(sk), dev_net(dev))) {
|
||||
if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
|
||||
if (ip_is_fragment(ip_hdr(skb))) {
|
||||
if (ip_defrag(skb, IP_DEFRAG_CALL_RA_CHAIN))
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -256,7 +256,7 @@ int ip_local_deliver(struct sk_buff *skb)
|
|||
* Reassemble IP fragments.
|
||||
*/
|
||||
|
||||
if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
|
||||
if (ip_is_fragment(ip_hdr(skb))) {
|
||||
if (ip_defrag(skb, IP_DEFRAG_LOCAL_DELIVER))
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
|
|||
|
||||
if (first_len - hlen > mtu ||
|
||||
((first_len - hlen) & 7) ||
|
||||
(iph->frag_off & htons(IP_MF|IP_OFFSET)) ||
|
||||
ip_is_fragment(iph) ||
|
||||
skb_cloned(skb))
|
||||
goto slow_path;
|
||||
|
||||
|
|
|
|||
|
|
@ -932,7 +932,7 @@ static int __init ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, str
|
|||
goto drop;
|
||||
|
||||
/* Fragments are not supported */
|
||||
if (h->frag_off & htons(IP_OFFSET | IP_MF)) {
|
||||
if (ip_is_fragment(h)) {
|
||||
if (net_ratelimit())
|
||||
printk(KERN_ERR "DHCP/BOOTP: Ignoring fragmented "
|
||||
"reply.\n");
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse)
|
|||
memset(fl4, 0, sizeof(struct flowi4));
|
||||
fl4->flowi4_mark = skb->mark;
|
||||
|
||||
if (!(iph->frag_off & htons(IP_MF | IP_OFFSET))) {
|
||||
if (!ip_is_fragment(iph)) {
|
||||
switch (iph->protocol) {
|
||||
case IPPROTO_UDP:
|
||||
case IPPROTO_UDPLITE:
|
||||
|
|
|
|||
Loading…
Reference in a new issue