ip_output.c (4af358f81881e1d083a916c9269b5ac0936e180d) | ip_output.c (f6b72b6217f8c24f2a54988e58af858b4e66024d) |
---|---|
1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * The Internet Protocol (IP) output module. 7 * 8 * Authors: Ross Biro --- 168 unchanged lines hidden (view full) --- 177EXPORT_SYMBOL_GPL(ip_build_and_send_pkt); 178 179static inline int ip_finish_output2(struct sk_buff *skb) 180{ 181 struct dst_entry *dst = skb_dst(skb); 182 struct rtable *rt = (struct rtable *)dst; 183 struct net_device *dev = dst->dev; 184 unsigned int hh_len = LL_RESERVED_SPACE(dev); | 1/* 2 * INET An implementation of the TCP/IP protocol suite for the LINUX 3 * operating system. INET is implemented using the BSD Socket 4 * interface as the means of communication with the user level. 5 * 6 * The Internet Protocol (IP) output module. 7 * 8 * Authors: Ross Biro --- 168 unchanged lines hidden (view full) --- 177EXPORT_SYMBOL_GPL(ip_build_and_send_pkt); 178 179static inline int ip_finish_output2(struct sk_buff *skb) 180{ 181 struct dst_entry *dst = skb_dst(skb); 182 struct rtable *rt = (struct rtable *)dst; 183 struct net_device *dev = dst->dev; 184 unsigned int hh_len = LL_RESERVED_SPACE(dev); |
185 struct neighbour *neigh; |
|
185 186 if (rt->rt_type == RTN_MULTICAST) { 187 IP_UPD_PO_STATS(dev_net(dev), IPSTATS_MIB_OUTMCAST, skb->len); 188 } else if (rt->rt_type == RTN_BROADCAST) 189 IP_UPD_PO_STATS(dev_net(dev), IPSTATS_MIB_OUTBCAST, skb->len); 190 191 /* Be paranoid, rather than too clever. */ 192 if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { --- 5 unchanged lines hidden (view full) --- 198 return -ENOMEM; 199 } 200 if (skb->sk) 201 skb_set_owner_w(skb2, skb->sk); 202 kfree_skb(skb); 203 skb = skb2; 204 } 205 | 186 187 if (rt->rt_type == RTN_MULTICAST) { 188 IP_UPD_PO_STATS(dev_net(dev), IPSTATS_MIB_OUTMCAST, skb->len); 189 } else if (rt->rt_type == RTN_BROADCAST) 190 IP_UPD_PO_STATS(dev_net(dev), IPSTATS_MIB_OUTBCAST, skb->len); 191 192 /* Be paranoid, rather than too clever. */ 193 if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { --- 5 unchanged lines hidden (view full) --- 199 return -ENOMEM; 200 } 201 if (skb->sk) 202 skb_set_owner_w(skb2, skb->sk); 203 kfree_skb(skb); 204 skb = skb2; 205 } 206 |
206 if (dst->hh) 207 return neigh_hh_output(dst->hh, skb); 208 else if (dst->neighbour) 209 return dst->neighbour->output(skb); 210 | 207 neigh = dst->neighbour; 208 if (neigh) { 209 struct hh_cache *hh = &neigh->hh; 210 if (hh->hh_len) 211 return neigh_hh_output(hh, skb); 212 else 213 return dst->neighbour->output(skb); 214 } |
211 if (net_ratelimit()) 212 printk(KERN_DEBUG "ip_finish_output2: No header cache and no neighbour!\n"); 213 kfree_skb(skb); 214 return -EINVAL; 215} 216 217static inline int ip_skb_dst_mtu(struct sk_buff *skb) 218{ --- 265 unchanged lines hidden (view full) --- 484 * we can switch to copy when see the first bad fragment. 485 */ 486 if (skb_has_frag_list(skb)) { 487 struct sk_buff *frag, *frag2; 488 int first_len = skb_pagelen(skb); 489 490 if (first_len - hlen > mtu || 491 ((first_len - hlen) & 7) || | 215 if (net_ratelimit()) 216 printk(KERN_DEBUG "ip_finish_output2: No header cache and no neighbour!\n"); 217 kfree_skb(skb); 218 return -EINVAL; 219} 220 221static inline int ip_skb_dst_mtu(struct sk_buff *skb) 222{ --- 265 unchanged lines hidden (view full) --- 488 * we can switch to copy when see the first bad fragment. 489 */ 490 if (skb_has_frag_list(skb)) { 491 struct sk_buff *frag, *frag2; 492 int first_len = skb_pagelen(skb); 493 494 if (first_len - hlen > mtu || 495 ((first_len - hlen) & 7) || |
492 (iph->frag_off & htons(IP_MF|IP_OFFSET)) || | 496 ip_is_fragment(iph) || |
493 skb_cloned(skb)) 494 goto slow_path; 495 496 skb_walk_frags(skb, frag) { 497 /* Correct geometry. */ 498 if (frag->len > mtu || 499 ((frag->len & 7) && frag->next) || 500 skb_headroom(frag) < hlen) --- 1029 unchanged lines hidden --- | 497 skb_cloned(skb)) 498 goto slow_path; 499 500 skb_walk_frags(skb, frag) { 501 /* Correct geometry. */ 502 if (frag->len > mtu || 503 ((frag->len & 7) && frag->next) || 504 skb_headroom(frag) < hlen) --- 1029 unchanged lines hidden --- |