Lines Matching refs:skb

100 static void *tcf_csum_skb_nextlayer(struct sk_buff *skb,  in tcf_csum_skb_nextlayer()  argument
104 int ntkoff = skb_network_offset(skb); in tcf_csum_skb_nextlayer()
107 if (!pskb_may_pull(skb, ipl + ntkoff) || (ipl < hl) || in tcf_csum_skb_nextlayer()
108 (skb_cloned(skb) && in tcf_csum_skb_nextlayer()
109 !skb_clone_writable(skb, hl + ntkoff) && in tcf_csum_skb_nextlayer()
110 pskb_expand_head(skb, 0, 0, GFP_ATOMIC))) in tcf_csum_skb_nextlayer()
113 return (void *)(skb_network_header(skb) + ihl); in tcf_csum_skb_nextlayer()
116 static int tcf_csum_ipv4_icmp(struct sk_buff *skb, in tcf_csum_ipv4_icmp() argument
121 icmph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*icmph)); in tcf_csum_ipv4_icmp()
126 skb->csum = csum_partial(icmph, ipl - ihl, 0); in tcf_csum_ipv4_icmp()
127 icmph->checksum = csum_fold(skb->csum); in tcf_csum_ipv4_icmp()
129 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv4_icmp()
134 static int tcf_csum_ipv4_igmp(struct sk_buff *skb, in tcf_csum_ipv4_igmp() argument
139 igmph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*igmph)); in tcf_csum_ipv4_igmp()
144 skb->csum = csum_partial(igmph, ipl - ihl, 0); in tcf_csum_ipv4_igmp()
145 igmph->csum = csum_fold(skb->csum); in tcf_csum_ipv4_igmp()
147 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv4_igmp()
152 static int tcf_csum_ipv6_icmp(struct sk_buff *skb, in tcf_csum_ipv6_icmp() argument
158 icmp6h = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*icmp6h)); in tcf_csum_ipv6_icmp()
162 ip6h = ipv6_hdr(skb); in tcf_csum_ipv6_icmp()
164 skb->csum = csum_partial(icmp6h, ipl - ihl, 0); in tcf_csum_ipv6_icmp()
167 skb->csum); in tcf_csum_ipv6_icmp()
169 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv6_icmp()
174 static int tcf_csum_ipv4_tcp(struct sk_buff *skb, in tcf_csum_ipv4_tcp() argument
180 tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph)); in tcf_csum_ipv4_tcp()
184 iph = ip_hdr(skb); in tcf_csum_ipv4_tcp()
186 skb->csum = csum_partial(tcph, ipl - ihl, 0); in tcf_csum_ipv4_tcp()
188 iph->saddr, iph->daddr, skb->csum); in tcf_csum_ipv4_tcp()
190 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv4_tcp()
195 static int tcf_csum_ipv6_tcp(struct sk_buff *skb, in tcf_csum_ipv6_tcp() argument
201 tcph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*tcph)); in tcf_csum_ipv6_tcp()
205 ip6h = ipv6_hdr(skb); in tcf_csum_ipv6_tcp()
207 skb->csum = csum_partial(tcph, ipl - ihl, 0); in tcf_csum_ipv6_tcp()
210 skb->csum); in tcf_csum_ipv6_tcp()
212 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv6_tcp()
217 static int tcf_csum_ipv4_udp(struct sk_buff *skb, in tcf_csum_ipv4_udp() argument
231 udph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*udph)); in tcf_csum_ipv4_udp()
235 iph = ip_hdr(skb); in tcf_csum_ipv4_udp()
244 skb->csum = csum_partial(udph, ipl - ihl, 0); in tcf_csum_ipv4_udp()
246 skb->csum = csum_partial(udph, ul, 0); in tcf_csum_ipv4_udp()
253 skb->csum = csum_partial(udph, ul, 0); in tcf_csum_ipv4_udp()
258 skb->csum); in tcf_csum_ipv4_udp()
264 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv4_udp()
270 static int tcf_csum_ipv6_udp(struct sk_buff *skb, in tcf_csum_ipv6_udp() argument
284 udph = tcf_csum_skb_nextlayer(skb, ihl, ipl, sizeof(*udph)); in tcf_csum_ipv6_udp()
288 ip6h = ipv6_hdr(skb); in tcf_csum_ipv6_udp()
295 skb->csum = csum_partial(udph, ipl - ihl, 0); in tcf_csum_ipv6_udp()
298 skb->csum = csum_partial(udph, ul, 0); in tcf_csum_ipv6_udp()
306 skb->csum = csum_partial(udph, ul, 0); in tcf_csum_ipv6_udp()
311 skb->csum); in tcf_csum_ipv6_udp()
316 skb->ip_summed = CHECKSUM_NONE; in tcf_csum_ipv6_udp()
322 static int tcf_csum_ipv4(struct sk_buff *skb, u32 update_flags) in tcf_csum_ipv4() argument
327 ntkoff = skb_network_offset(skb); in tcf_csum_ipv4()
329 if (!pskb_may_pull(skb, sizeof(*iph) + ntkoff)) in tcf_csum_ipv4()
332 iph = ip_hdr(skb); in tcf_csum_ipv4()
337 if (!tcf_csum_ipv4_icmp(skb, iph->ihl * 4, in tcf_csum_ipv4()
343 if (!tcf_csum_ipv4_igmp(skb, iph->ihl * 4, in tcf_csum_ipv4()
349 if (!tcf_csum_ipv4_tcp(skb, iph->ihl * 4, in tcf_csum_ipv4()
355 if (!tcf_csum_ipv4_udp(skb, iph->ihl * 4, in tcf_csum_ipv4()
361 if (!tcf_csum_ipv4_udp(skb, iph->ihl * 4, in tcf_csum_ipv4()
368 if (skb_cloned(skb) && in tcf_csum_ipv4()
369 !skb_clone_writable(skb, sizeof(*iph) + ntkoff) && in tcf_csum_ipv4()
370 pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) in tcf_csum_ipv4()
373 ip_send_check(ip_hdr(skb)); in tcf_csum_ipv4()
418 static int tcf_csum_ipv6(struct sk_buff *skb, u32 update_flags) in tcf_csum_ipv6() argument
427 ntkoff = skb_network_offset(skb); in tcf_csum_ipv6()
431 if (!pskb_may_pull(skb, hl + ntkoff)) in tcf_csum_ipv6()
434 ip6h = ipv6_hdr(skb); in tcf_csum_ipv6()
446 if (!pskb_may_pull(skb, hl + sizeof(*ip6xh) + ntkoff)) in tcf_csum_ipv6()
448 ip6xh = (void *)(skb_network_header(skb) + hl); in tcf_csum_ipv6()
450 if (!pskb_may_pull(skb, hl + ixhl + ntkoff)) in tcf_csum_ipv6()
452 ip6xh = (void *)(skb_network_header(skb) + hl); in tcf_csum_ipv6()
461 if (!tcf_csum_ipv6_icmp(skb, in tcf_csum_ipv6()
467 if (!tcf_csum_ipv6_tcp(skb, in tcf_csum_ipv6()
473 if (!tcf_csum_ipv6_udp(skb, hl, in tcf_csum_ipv6()
479 if (!tcf_csum_ipv6_udp(skb, hl, in tcf_csum_ipv6()
486 } while (pskb_may_pull(skb, hl + 1 + ntkoff)); in tcf_csum_ipv6()
496 static int tcf_csum(struct sk_buff *skb, in tcf_csum() argument
505 bstats_update(&p->tcf_bstats, skb); in tcf_csum()
513 switch (tc_skb_protocol(skb)) { in tcf_csum()
515 if (!tcf_csum_ipv4(skb, update_flags)) in tcf_csum()
519 if (!tcf_csum_ipv6(skb, update_flags)) in tcf_csum()
533 static int tcf_csum_dump(struct sk_buff *skb, in tcf_csum_dump() argument
536 unsigned char *b = skb_tail_pointer(skb); in tcf_csum_dump()
547 if (nla_put(skb, TCA_CSUM_PARMS, sizeof(opt), &opt)) in tcf_csum_dump()
552 if (nla_put(skb, TCA_CSUM_TM, sizeof(t), &t)) in tcf_csum_dump()
555 return skb->len; in tcf_csum_dump()
558 nlmsg_trim(skb, b); in tcf_csum_dump()