Lines Matching refs:skb
148 bool ip_call_ra_chain(struct sk_buff *skb) in ip_call_ra_chain() argument
151 u8 protocol = ip_hdr(skb)->protocol; in ip_call_ra_chain()
153 struct net_device *dev = skb->dev; in ip_call_ra_chain()
165 if (ip_is_fragment(ip_hdr(skb))) { in ip_call_ra_chain()
166 if (ip_defrag(net, skb, IP_DEFRAG_CALL_RA_CHAIN)) in ip_call_ra_chain()
170 struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC); in ip_call_ra_chain()
179 raw_rcv(last, skb); in ip_call_ra_chain()
187 void ip_protocol_deliver_rcu(struct net *net, struct sk_buff *skb, int protocol) in ip_protocol_deliver_rcu() argument
193 raw = raw_local_deliver(skb, protocol); in ip_protocol_deliver_rcu()
198 if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { in ip_protocol_deliver_rcu()
199 kfree_skb_reason(skb, in ip_protocol_deliver_rcu()
203 nf_reset_ct(skb); in ip_protocol_deliver_rcu()
206 skb); in ip_protocol_deliver_rcu()
214 if (xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { in ip_protocol_deliver_rcu()
216 icmp_send(skb, ICMP_DEST_UNREACH, in ip_protocol_deliver_rcu()
219 kfree_skb_reason(skb, SKB_DROP_REASON_IP_NOPROTO); in ip_protocol_deliver_rcu()
222 consume_skb(skb); in ip_protocol_deliver_rcu()
227 static int ip_local_deliver_finish(struct net *net, struct sock *sk, struct sk_buff *skb) in ip_local_deliver_finish() argument
229 skb_clear_delivery_time(skb); in ip_local_deliver_finish()
230 __skb_pull(skb, skb_network_header_len(skb)); in ip_local_deliver_finish()
233 ip_protocol_deliver_rcu(net, skb, ip_hdr(skb)->protocol); in ip_local_deliver_finish()
242 int ip_local_deliver(struct sk_buff *skb) in ip_local_deliver() argument
247 struct net *net = dev_net(skb->dev); in ip_local_deliver()
249 if (ip_is_fragment(ip_hdr(skb))) { in ip_local_deliver()
250 if (ip_defrag(net, skb, IP_DEFRAG_LOCAL_DELIVER)) in ip_local_deliver()
255 net, NULL, skb, skb->dev, NULL, in ip_local_deliver()
260 static inline bool ip_rcv_options(struct sk_buff *skb, struct net_device *dev) in ip_rcv_options() argument
272 if (skb_cow(skb, skb_headroom(skb))) { in ip_rcv_options()
277 iph = ip_hdr(skb); in ip_rcv_options()
278 opt = &(IPCB(skb)->opt); in ip_rcv_options()
281 if (ip_options_compile(dev_net(dev), opt, skb)) { in ip_rcv_options()
299 if (ip_options_rcv_srr(skb, dev)) in ip_rcv_options()
308 static bool ip_can_use_hint(const struct sk_buff *skb, const struct iphdr *iph, in ip_can_use_hint() argument
311 return hint && !skb_dst(skb) && ip_hdr(hint)->daddr == iph->daddr && in ip_can_use_hint()
315 int tcp_v4_early_demux(struct sk_buff *skb);
316 int udp_v4_early_demux(struct sk_buff *skb);
318 struct sk_buff *skb, struct net_device *dev, in ip_rcv_finish_core() argument
321 const struct iphdr *iph = ip_hdr(skb); in ip_rcv_finish_core()
327 if (ip_can_use_hint(skb, iph, hint)) { in ip_rcv_finish_core()
328 err = ip_route_use_hint(skb, iph->daddr, iph->saddr, iph->tos, in ip_rcv_finish_core()
335 !skb_dst(skb) && in ip_rcv_finish_core()
336 !skb->sk && in ip_rcv_finish_core()
341 tcp_v4_early_demux(skb); in ip_rcv_finish_core()
344 iph = ip_hdr(skb); in ip_rcv_finish_core()
349 err = udp_v4_early_demux(skb); in ip_rcv_finish_core()
354 iph = ip_hdr(skb); in ip_rcv_finish_core()
364 if (!skb_valid_dst(skb)) { in ip_rcv_finish_core()
365 err = ip_route_input_noref(skb, iph->daddr, iph->saddr, in ip_rcv_finish_core()
373 IPCB(skb)->flags |= IPSKB_NOPOLICY; in ip_rcv_finish_core()
377 if (unlikely(skb_dst(skb)->tclassid)) { in ip_rcv_finish_core()
379 u32 idx = skb_dst(skb)->tclassid; in ip_rcv_finish_core()
381 st[idx&0xFF].o_bytes += skb->len; in ip_rcv_finish_core()
383 st[(idx>>16)&0xFF].i_bytes += skb->len; in ip_rcv_finish_core()
387 if (iph->ihl > 5 && ip_rcv_options(skb, dev)) in ip_rcv_finish_core()
390 rt = skb_rtable(skb); in ip_rcv_finish_core()
392 __IP_UPD_PO_STATS(net, IPSTATS_MIB_INMCAST, skb->len); in ip_rcv_finish_core()
394 __IP_UPD_PO_STATS(net, IPSTATS_MIB_INBCAST, skb->len); in ip_rcv_finish_core()
395 } else if (skb->pkt_type == PACKET_BROADCAST || in ip_rcv_finish_core()
396 skb->pkt_type == PACKET_MULTICAST) { in ip_rcv_finish_core()
424 kfree_skb_reason(skb, drop_reason); in ip_rcv_finish_core()
435 static int ip_rcv_finish(struct net *net, struct sock *sk, struct sk_buff *skb) in ip_rcv_finish() argument
437 struct net_device *dev = skb->dev; in ip_rcv_finish()
443 skb = l3mdev_ip_rcv(skb); in ip_rcv_finish()
444 if (!skb) in ip_rcv_finish()
447 ret = ip_rcv_finish_core(net, sk, skb, dev, NULL); in ip_rcv_finish()
449 ret = dst_input(skb); in ip_rcv_finish()
456 static struct sk_buff *ip_rcv_core(struct sk_buff *skb, struct net *net) in ip_rcv_core() argument
465 if (skb->pkt_type == PACKET_OTHERHOST) { in ip_rcv_core()
466 dev_core_stats_rx_otherhost_dropped_inc(skb->dev); in ip_rcv_core()
471 __IP_UPD_PO_STATS(net, IPSTATS_MIB_IN, skb->len); in ip_rcv_core()
473 skb = skb_share_check(skb, GFP_ATOMIC); in ip_rcv_core()
474 if (!skb) { in ip_rcv_core()
480 if (!pskb_may_pull(skb, sizeof(struct iphdr))) in ip_rcv_core()
483 iph = ip_hdr(skb); in ip_rcv_core()
504 max_t(unsigned short, 1, skb_shinfo(skb)->gso_segs)); in ip_rcv_core()
506 if (!pskb_may_pull(skb, iph->ihl*4)) in ip_rcv_core()
509 iph = ip_hdr(skb); in ip_rcv_core()
514 len = iph_totlen(skb, iph); in ip_rcv_core()
515 if (skb->len < len) { in ip_rcv_core()
526 if (pskb_trim_rcsum(skb, len)) { in ip_rcv_core()
531 iph = ip_hdr(skb); in ip_rcv_core()
532 skb->transport_header = skb->network_header + iph->ihl*4; in ip_rcv_core()
535 memset(IPCB(skb), 0, sizeof(struct inet_skb_parm)); in ip_rcv_core()
536 IPCB(skb)->iif = skb->skb_iif; in ip_rcv_core()
539 if (!skb_sk_is_prefetched(skb)) in ip_rcv_core()
540 skb_orphan(skb); in ip_rcv_core()
542 return skb; in ip_rcv_core()
552 kfree_skb_reason(skb, drop_reason); in ip_rcv_core()
560 int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, in ip_rcv() argument
565 skb = ip_rcv_core(skb, net); in ip_rcv()
566 if (skb == NULL) in ip_rcv()
570 net, NULL, skb, dev, NULL, in ip_rcv()
576 struct sk_buff *skb, *next; in ip_sublist_rcv_finish() local
578 list_for_each_entry_safe(skb, next, head, list) { in ip_sublist_rcv_finish()
579 skb_list_del_init(skb); in ip_sublist_rcv_finish()
580 dst_input(skb); in ip_sublist_rcv_finish()
585 struct sk_buff *skb, int rt_type) in ip_extract_route_hint() argument
588 IPCB(skb)->flags & IPSKB_MULTIPATH) in ip_extract_route_hint()
591 return skb; in ip_extract_route_hint()
597 struct sk_buff *skb, *next, *hint = NULL; in ip_list_rcv_finish() local
602 list_for_each_entry_safe(skb, next, head, list) { in ip_list_rcv_finish()
603 struct net_device *dev = skb->dev; in ip_list_rcv_finish()
606 skb_list_del_init(skb); in ip_list_rcv_finish()
610 skb = l3mdev_ip_rcv(skb); in ip_list_rcv_finish()
611 if (!skb) in ip_list_rcv_finish()
613 if (ip_rcv_finish_core(net, sk, skb, dev, hint) == NET_RX_DROP) in ip_list_rcv_finish()
616 dst = skb_dst(skb); in ip_list_rcv_finish()
618 hint = ip_extract_route_hint(net, skb, in ip_list_rcv_finish()
628 list_add_tail(&skb->list, &sublist); in ip_list_rcv_finish()
648 struct sk_buff *skb, *next; in ip_list_rcv() local
652 list_for_each_entry_safe(skb, next, head, list) { in ip_list_rcv()
653 struct net_device *dev = skb->dev; in ip_list_rcv()
656 skb_list_del_init(skb); in ip_list_rcv()
657 skb = ip_rcv_core(skb, net); in ip_list_rcv()
658 if (skb == NULL) in ip_list_rcv()
670 list_add_tail(&skb->list, &sublist); in ip_list_rcv()