Lines Matching defs:skb
43 static bool ip_exceeds_mtu(const struct sk_buff *skb, unsigned int mtu)
45 if (skb->len <= mtu)
48 if (unlikely((ip_hdr(skb)->frag_off & htons(IP_DF)) == 0))
52 if (unlikely(IPCB(skb)->frag_max_size > mtu))
55 if (skb->ignore_df)
58 if (skb_is_gso(skb) && skb_gso_validate_network_len(skb, mtu))
65 static int ip_forward_finish(struct net *net, struct sock *sk, struct sk_buff *skb)
67 struct ip_options *opt = &(IPCB(skb)->opt);
72 if (skb->offload_l3_fwd_mark) {
73 consume_skb(skb);
79 ip_forward_options(skb);
81 skb_clear_tstamp(skb);
82 return dst_output(net, sk, skb);
85 int ip_forward(struct sk_buff *skb)
90 struct ip_options *opt = &(IPCB(skb)->opt);
95 if (skb->pkt_type != PACKET_HOST)
98 if (unlikely(skb->sk))
101 if (skb_warn_if_lro(skb))
104 if (!xfrm4_policy_check(NULL, XFRM_POLICY_FWD, skb)) {
109 if (IPCB(skb)->opt.router_alert && ip_call_ra_chain(skb))
112 skb_forward_csum(skb);
113 net = dev_net(skb->dev);
120 if (ip_hdr(skb)->ttl <= 1)
123 if (!xfrm4_route_forward(skb)) {
128 rt = skb_rtable(skb);
133 IPCB(skb)->flags |= IPSKB_FORWARDED;
135 if (ip_exceeds_mtu(skb, mtu)) {
137 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
144 if (skb_cow(skb, LL_RESERVED_SPACE(rt->dst.dev)+rt->dst.header_len))
146 iph = ip_hdr(skb);
148 /* Decrease ttl after skb cow done */
155 if (IPCB(skb)->flags & IPSKB_DOREDIRECT && !opt->srr &&
156 !skb_sec_path(skb))
157 ip_rt_send_redirect(skb);
160 skb->priority = rt_tos2priority(iph->tos);
163 net, NULL, skb, skb->dev, rt->dst.dev,
170 icmp_send(skb, ICMP_DEST_UNREACH, ICMP_SR_FAILED, 0);
176 icmp_send(skb, ICMP_TIME_EXCEEDED, ICMP_EXC_TTL, 0);
179 kfree_skb_reason(skb, reason);