Lines Matching refs:skb

99 static void *tcf_csum_skb_nextlayer(struct sk_buff *skb,  in tcf_csum_skb_nextlayer()  argument
103 int ntkoff = skb_network_offset(skb); in tcf_csum_skb_nextlayer()
106 if (!pskb_may_pull(skb, ipl + ntkoff) || (ipl < hl) || in tcf_csum_skb_nextlayer()
107 (skb_cloned(skb) && in tcf_csum_skb_nextlayer()
108 !skb_clone_writable(skb, hl + ntkoff) && in tcf_csum_skb_nextlayer()
109 pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) in tcf_csum_skb_nextlayer()
112 return (void *)(skb_network_header(skb) + ihl); in tcf_csum_skb_nextlayer()
115 static int tcf_csum_ipv4_icmp(struct sk_buff *skb, in tcf_csum_ipv4_icmp() argument
120 icmph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*icmph)); in tcf_csum_ipv4_icmp()
125 skb->csum = csum_partial(icmph, ipl - ihl, 0); in tcf_csum_ipv4_icmp()
126 icmph->checksum = csum_fold(skb->csum); in tcf_csum_ipv4_icmp()
128 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv4_icmp()
133 static int tcf_csum_ipv4_igmp(struct sk_buff *skb, in tcf_csum_ipv4_igmp() argument
138 igmph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*igmph)); in tcf_csum_ipv4_igmp()
143 skb->csum = csum_partial(igmph, ipl - ihl, 0); in tcf_csum_ipv4_igmp()
144 igmph->csum = csum_fold(skb->csum); in tcf_csum_ipv4_igmp()
146 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv4_igmp()
151 static int tcf_csum_ipv6_icmp(struct sk_buff *skb, in tcf_csum_ipv6_icmp() argument
157 icmp6h = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*icmp6h)); in tcf_csum_ipv6_icmp()
161 ip6h = ipv6_hdr(skb); in tcf_csum_ipv6_icmp()
163 skb->csum = csum_partial(icmp6h, ipl - ihl, 0); in tcf_csum_ipv6_icmp()
166 skb->csum); in tcf_csum_ipv6_icmp()
168 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv6_icmp()
173 static int tcf_csum_ipv4_tcp(struct sk_buff *skb, in tcf_csum_ipv4_tcp() argument
179 tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph)); in tcf_csum_ipv4_tcp()
183 iph = ip_hdr(skb); in tcf_csum_ipv4_tcp()
185 skb->csum = csum_partial(tcph, ipl - ihl, 0); in tcf_csum_ipv4_tcp()
187 iph->saddr, iph->daddr, skb->csum); in tcf_csum_ipv4_tcp()
189 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv4_tcp()
194 static int tcf_csum_ipv6_tcp(struct sk_buff *skb, in tcf_csum_ipv6_tcp() argument
200 tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph)); in tcf_csum_ipv6_tcp()
204 ip6h = ipv6_hdr(skb); in tcf_csum_ipv6_tcp()
206 skb->csum = csum_partial(tcph, ipl - ihl, 0); in tcf_csum_ipv6_tcp()
209 skb->csum); in tcf_csum_ipv6_tcp()
211 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv6_tcp()
216 static int tcf_csum_ipv4_udp(struct sk_buff *skb, in tcf_csum_ipv4_udp() argument
230 udph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*udph)); in tcf_csum_ipv4_udp()
234 iph = ip_hdr(skb); in tcf_csum_ipv4_udp()
243 skb->csum = csum_partial(udph, ipl - ihl, 0); in tcf_csum_ipv4_udp()
245 skb->csum = csum_partial(udph, ul, 0); in tcf_csum_ipv4_udp()
252 skb->csum = csum_partial(udph, ul, 0); in tcf_csum_ipv4_udp()
257 skb->csum); in tcf_csum_ipv4_udp()
263 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv4_udp()
269 static int tcf_csum_ipv6_udp(struct sk_buff *skb, in tcf_csum_ipv6_udp() argument
283 udph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*udph)); in tcf_csum_ipv6_udp()
287 ip6h = ipv6_hdr(skb); in tcf_csum_ipv6_udp()
294 skb->csum = csum_partial(udph, ipl - ihl, 0); in tcf_csum_ipv6_udp()
297 skb->csum = csum_partial(udph, ul, 0); in tcf_csum_ipv6_udp()
305 skb->csum = csum_partial(udph, ul, 0); in tcf_csum_ipv6_udp()
310 skb->csum); in tcf_csum_ipv6_udp()
315 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv6_udp()
321 static int tcf_csum_ipv4(struct sk_buff *skb, u32 update_flags) in tcf_csum_ipv4() argument
326 ntkoff = skb_network_offset(skb); in tcf_csum_ipv4()
328 if (!pskb_may_pull(skb, sizeof(*iph) + ntkoff)) in tcf_csum_ipv4()
331 iph = ip_hdr(skb); in tcf_csum_ipv4()
336 if (!tcf_csum_ipv4_icmp(skb, iph->ihl * 4, in tcf_csum_ipv4()
342 if (!tcf_csum_ipv4_igmp(skb, iph->ihl * 4, in tcf_csum_ipv4()
348 if (!tcf_csum_ipv4_tcp(skb, iph->ihl * 4, in tcf_csum_ipv4()
354 if (!tcf_csum_ipv4_udp(skb, iph->ihl * 4, in tcf_csum_ipv4()
360 if (!tcf_csum_ipv4_udp(skb, iph->ihl * 4, in tcf_csum_ipv4()
367 if (skb_cloned(skb) && in tcf_csum_ipv4()
368 !skb_clone_writable(skb, sizeof(*iph) + ntkoff) && in tcf_csum_ipv4()
369 pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) in tcf_csum_ipv4()
372 ip_send_check(ip_hdr(skb)); in tcf_csum_ipv4()
417 static int tcf_csum_ipv6(struct sk_buff *skb, u32 update_flags) in tcf_csum_ipv6() argument
426 ntkoff = skb_network_offset(skb); in tcf_csum_ipv6()
430 if (!pskb_may_pull(skb, hl + ntkoff)) in tcf_csum_ipv6()
433 ip6h = ipv6_hdr(skb); in tcf_csum_ipv6()
445 if (!pskb_may_pull(skb, hl + sizeof(*ip6xh) + ntkoff)) in tcf_csum_ipv6()
447 ip6xh = (void *)(skb_network_header(skb) + hl); in tcf_csum_ipv6()
449 if (!pskb_may_pull(skb, hl + ixhl + ntkoff)) in tcf_csum_ipv6()
451 ip6xh = (void *)(skb_network_header(skb) + hl); in tcf_csum_ipv6()
460 if (!tcf_csum_ipv6_icmp(skb, in tcf_csum_ipv6()
466 if (!tcf_csum_ipv6_tcp(skb, in tcf_csum_ipv6()
472 if (!tcf_csum_ipv6_udp(skb, hl, in tcf_csum_ipv6()
478 if (!tcf_csum_ipv6_udp(skb, hl, in tcf_csum_ipv6()
485 } while (pskb_may_pull(skb, hl + 1 + ntkoff)); in tcf_csum_ipv6()
495 static int tcf_csum(struct sk_buff *skb, in tcf_csum() argument
504 bstats_update(&p->tcf_bstats, skb); in tcf_csum()
512 switch (tc_skb_protocol(skb)) { in tcf_csum()
514 if (!tcf_csum_ipv4(skb, update_flags)) in tcf_csum()
518 if (!tcf_csum_ipv6(skb, update_flags)) in tcf_csum()
532 static int tcf_csum_dump(struct sk_buff *skb, in tcf_csum_dump() argument
535 unsigned char *b = skb_tail_pointer(skb); in tcf_csum_dump()
546 if (nla_put(skb, TCA_CSUM_PARMS, sizeof(opt), &opt)) in tcf_csum_dump()
551 if (nla_put(skb, TCA_CSUM_TM, sizeof(t), &t)) in tcf_csum_dump()
554 return skb->len; in tcf_csum_dump()
557 nlmsg_trim(skb, b); in tcf_csum_dump()