cregit-Linux how code gets into the kernel

Release 4.8 net/ipv4/ip_output.c

Directory: net/ipv4
 * INET         An implementation of the TCP/IP protocol suite for the LINUX
 *              operating system.  INET is implemented using the  BSD Socket
 *              interface as the means of communication with the user level.
 *              The Internet Protocol (IP) output module.
 * Authors:     Ross Biro
 *              Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
 *              Donald Becker, <>
 *              Alan Cox, <>
 *              Richard Underwood
 *              Stefan Becker, <>
 *              Jorge Cwik, <>
 *              Arnt Gulbrandsen, <>
 *              Hirokazu Takahashi, <>
 *      See ip_input.c for original log
 *      Fixes:
 *              Alan Cox        :       Missing nonblock feature in ip_build_xmit.
 *              Mike Kilburn    :       htons() missing in ip_build_xmit.
 *              Bradford Johnson:       Fix faulty handling of some frames when
 *                                      no route is found.
 *              Alexander Demenshin:    Missing sk/skb free in ip_queue_xmit
 *                                      (in case if packet not accepted by
 *                                      output firewall rules)
 *              Mike McLagan    :       Routing by source
 *              Alexey Kuznetsov:       use new route cache
 *              Andi Kleen:             Fix broken PMTU recovery and remove
 *                                      some redundant tests.
 *      Vitaly E. Lavrov        :       Transparent proxy revived after year coma.
 *              Andi Kleen      :       Replace ip_reply with ip_send_reply.
 *              Andi Kleen      :       Split fast and slow ip_build_xmit path
 *                                      for decreased register pressure on x86
 *                                      and more readibility.
 *              Marc Boucher    :       When call_out_firewall returns FW_QUEUE,
 *                                      silently drop skb instead of failing with -EPERM.
 *              Detlev Wengorz  :       Copy protocol for fragments.
 *              Hirokazu Takahashi:     HW checksumming for outgoing UDP
 *                                      datagrams.
 *              Hirokazu Takahashi:     sendfile() on UDP works now.

#include <asm/uaccess.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/highmem.h>
#include <linux/slab.h>

#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/in.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>

#include <net/snmp.h>
#include <net/ip.h>
#include <net/protocol.h>
#include <net/route.h>
#include <net/xfrm.h>
#include <linux/skbuff.h>
#include <net/sock.h>
#include <net/arp.h>
#include <net/icmp.h>
#include <net/checksum.h>
#include <net/inetpeer.h>
#include <linux/igmp.h>
#include <linux/netfilter_ipv4.h>
#include <linux/netfilter_bridge.h>
#include <linux/netlink.h>
#include <linux/tcp.h>

static int
ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,
	    unsigned int mtu,
	    int (*output)(struct net *, struct sock *, struct sk_buff *));

/* Generate a checksum for an outgoing IP datagram. */

void ip_send_check(struct iphdr *iph) { iph->check = 0; iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl); }



int __ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) { struct iphdr *iph = ip_hdr(skb); iph->tot_len = htons(skb->len); ip_send_check(iph); return nf_hook(NFPROTO_IPV4, NF_INET_LOCAL_OUT, net, sk, skb, NULL, skb_dst(skb)->dev, dst_output); }


herbert xuherbert xu4766.20%111.11%
david s. millerdavid s. miller1014.08%111.11%
eric w. biedermaneric w. biederman912.68%444.44%
eric dumazeteric dumazet34.23%111.11%
jan engelhardtjan engelhardt11.41%111.11%
patrick mchardypatrick mchardy11.41%111.11%

int ip_local_out(struct net *net, struct sock *sk, struct sk_buff *skb) { int err; err = __ip_local_out(net, sk, skb); if (likely(err == 1)) err = dst_output(net, sk, skb); return err; }


herbert xuherbert xu3663.16%111.11%
eric w. biedermaneric w. biederman1424.56%777.78%
eric dumazeteric dumazet712.28%111.11%

static inline int ip_select_ttl(struct inet_sock *inet, struct dst_entry *dst) { int ttl = inet->uc_ttl; if (ttl < 0) ttl = ip4_dst_hoplimit(dst); return ttl; }


david s. millerdavid s. miller3997.50%266.67%
arnaldo carvalho de meloarnaldo carvalho de melo12.50%133.33%

/* * Add an ip header to a skbuff and send it out. * */
int ip_build_and_send_pkt(struct sk_buff *skb, const struct sock *sk, __be32 saddr, __be32 daddr, struct ip_options_rcu *opt) { struct inet_sock *inet = inet_sk(sk); struct rtable *rt = skb_rtable(skb); struct net *net = sock_net(sk); struct iphdr *iph; /* Build the IP header. */ skb_push(skb, sizeof(struct iphdr) + (opt ? opt->opt.optlen : 0)); skb_reset_network_header(skb); iph = ip_hdr(skb); iph->version = 4; iph->ihl = 5; iph->tos = inet->tos; iph->ttl = ip_select_ttl(inet, &rt->dst); iph->daddr = (opt && opt->opt.srr ? opt->opt.faddr : daddr); iph->saddr = saddr; iph->protocol = sk->sk_protocol; if (ip_dont_fragment(sk, &rt->dst)) { iph->frag_off = htons(IP_DF); iph->id = 0; } else { iph->frag_off = 0; __ip_select_ident(net, iph, 1); } if (opt && opt->opt.optlen) { iph->ihl += opt->opt.optlen>>2; ip_options_build(skb, &opt->opt, daddr, rt, 0); } skb->priority = sk->sk_priority; skb->mark = sk->sk_mark; /* Send it out. */ return ip_local_out(net, skb->sk, skb); }


eric dumazeteric dumazet5519.37%310.71%
david s. millerdavid s. miller3512.32%310.71%
arnaldo carvalho de meloarnaldo carvalho de melo175.99%414.29%
eric w. biedermaneric w. biederman175.99%310.71%
laszlo attila tothlaszlo attila toth82.82%13.57%
alexey kuznetsovalexey kuznetsov72.46%13.57%
al viroal viro20.70%13.57%
hannes frederic sowahannes frederic sowa10.35%13.57%
herbert xuherbert xu10.35%13.57%

static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *skb) { struct dst_entry *dst = skb_dst(skb); struct rtable *rt = (struct rtable *)dst; struct net_device *dev = dst->dev; unsigned int hh_len = LL_RESERVED_SPACE(dev); struct neighbour *neigh; u32 nexthop; if (rt->rt_type == RTN_MULTICAST) { IP_UPD_PO_STATS(net, IPSTATS_MIB_OUTMCAST, skb->len); } else if (rt->rt_type == RTN_BROADCAST) IP_UPD_PO_STATS(net, IPSTATS_MIB_OUTBCAST, skb->len); /* Be paranoid, rather than too clever. */ if (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) { struct sk_buff *skb2; skb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev)); if (!skb2) { kfree_skb(skb); return -ENOMEM; } if (skb->sk) skb_set_owner_w(skb2, skb->sk); consume_skb(skb); skb = skb2; } rcu_read_lock_bh(); nexthop = (__force u32) rt_nexthop(rt, ip_hdr(skb)->daddr); neigh = __ipv4_neigh_lookup_noref(dev, nexthop); if (unlikely(!neigh)) neigh = __neigh_create(&arp_tbl, &nexthop, dev, false); if (!IS_ERR(neigh)) { int res = dst_neigh_output(dst, neigh, skb); rcu_read_unlock_bh(); return res; } rcu_read_unlock_bh(); net_dbg_ratelimited("%s: No header cache and no neighbour!\n", __func__); kfree_skb(skb); return -EINVAL; }


alexey kuznetsovalexey kuznetsov8931.12%27.69%
david s. millerdavid s. miller6522.73%726.92%
mitsuru chinenmitsuru chinen3512.24%13.85%
eric dumazeteric dumazet186.29%311.54%
neil hormanneil horman144.90%13.85%
julian anastasovjulian anastasov82.80%13.85%
eric w. biedermaneric w. biederman72.45%27.69%
joe perchesjoe perches41.40%13.85%
vasiliy kulikovvasiliy kulikov41.40%13.85%
pavel emelianovpavel emelianov20.70%13.85%
stephen hemmingerstephen hemminger10.35%13.85%
ian morrisian morris10.35%13.85%
chuck leverchuck lever10.35%13.85%

static int ip_finish_output_gso(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned int mtu) { netdev_features_t features; struct sk_buff *segs; int ret = 0; /* common case: fragmentation of segments is not allowed, * or seglen is <= mtu */ if (((IPCB(skb)->flags & IPSKB_FRAG_SEGS) == 0) || skb_gso_validate_mtu(skb, mtu)) return ip_finish_output2(net, sk, skb); /* Slowpath - GSO segment length is exceeding the dst MTU. * * This can happen in two cases: * 1) TCP GRO packet, DF bit not set * 2) skb arrived via virtio-net, we thus get TSO/GSO skbs directly * from host network stack. */ features = netif_skb_features(skb); BUILD_BUG_ON(sizeof(*IPCB(skb)) > SKB_SGO_CB_OFFSET); segs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK); if (IS_ERR_OR_NULL(segs)) { kfree_skb(skb); return -ENOMEM; } consume_skb(skb); do { struct sk_buff *nskb = segs->next; int err; segs->next = NULL; err = ip_fragment(net, sk, segs, mtu, ip_finish_output2); if (err && ret == 0) ret = err; segs = nskb; } while (segs); return ret; }


florian westphalflorian westphal15380.53%337.50%
konstantin khlebnikovkonstantin khlebnikov147.37%112.50%
eric w. biedermaneric w. biederman94.74%112.50%
david s. millerdavid s. miller94.74%112.50%
marcelo ricardo leitnermarcelo ricardo leitner31.58%112.50%
shmulik ladkanishmulik ladkani21.05%112.50%

static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *skb) { unsigned int mtu; #if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM) /* Policy lookup after SNAT yielded a new policy */ if (skb_dst(skb)->xfrm) { IPCB(skb)->flags |= IPSKB_REROUTED; return dst_output(net, sk, skb); } #endif mtu = ip_skb_dst_mtu(sk, skb); if (skb_is_gso(skb)) return ip_finish_output_gso(net, sk, skb, mtu); if (skb->len > mtu || (IPCB(skb)->flags & IPSKB_FRAG_PMTU)) return ip_fragment(net, sk, skb, mtu, ip_finish_output2); return ip_finish_output2(net, sk, skb); }


patrick mchardypatrick mchardy4834.29%318.75%
florian westphalflorian westphal4028.57%318.75%
eric w. biedermaneric w. biederman1410.00%425.00%
david s. millerdavid s. miller139.29%16.25%
eric dumazeteric dumazet32.14%16.25%
shmulik ladkanishmulik ladkani21.43%16.25%
adrian bunkadrian bunk10.71%16.25%

int ip_mc_output(struct net *net, struct sock *sk, struct sk_buff *skb) { struct rtable *rt = skb_rtable(skb); struct net_device *dev = rt->; /* * If the indicated interface is up and running, send the packet. */ IP_UPD_PO_STATS(net, IPSTATS_MIB_OUT, skb->len); skb->dev = dev; skb->protocol = htons(ETH_P_IP); /* * Multicasts are looped back for other local users */ if (rt->rt_flags&RTCF_MULTICAST) { if (sk_mc_loop(sk) #ifdef CONFIG_IP_MROUTE /* Small optimization: do not loopback not local frames, which returned after forwarding; they will be dropped by ip_mr_input in any case. Note, that local frames are looped back to be delivered to local recipients. This check is duplicated in ip_mr_input at the moment. */ && ((rt->rt_flags & RTCF_LOCAL) || !(IPCB(skb)->flags & IPSKB_FORWARDED)) #endif ) { struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); if (newskb) NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING, net, sk, newskb, NULL, newskb->dev, dev_loopback_xmit); } /* Multicasts with ttl 0 must not go beyond the host */ if (ip_hdr(skb)->ttl == 0) { kfree_skb(skb); return 0; } } if (rt->rt_flags&RTCF_BROADCAST) { struct sk_buff *newskb = skb_clone(skb, GFP_ATOMIC); if (newskb) NF_HOOK(NFPROTO_IPV4, NF_INET_POST_ROUTING, net, sk, newskb, NULL, newskb->dev, dev_loopback_xmit); } return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING, net, sk, skb, NULL, skb->dev, ip_finish_output, !(IPCB(skb)->flags & IPSKB_REROUTED)); }


patrick mchardypatrick mchardy249.38%310.34%
eric w. biedermaneric w. biederman155.86%310.34%
eric dumazeteric dumazet83.12%26.90%
linus torvaldslinus torvalds83.12%13.45%
david s. millerdavid s. miller83.12%26.90%
neil hormanneil horman51.95%13.45%
alexey kuznetsovalexey kuznetsov41.56%13.45%
arnaldo carvalho de meloarnaldo carvalho de melo31.17%13.45%
jan engelhardtjan engelhardt31.17%13.45%
michel machadomichel machado20.78%13.45%
hideaki yoshifujihideaki yoshifuji10.39%13.45%
octavian purdilaoctavian purdila10.39%13.45%
herbert xuherbert xu10.39%13.45%
pavel emelianovpavel emelianov10.39%13.45%

int ip_output(struct net *net, struct sock *sk, struct sk_buff *skb) { struct net_device *dev = skb_dst(skb)->dev; IP_UPD_PO_STATS(net, IPSTATS_MIB_OUT, skb->len); skb->dev = dev; skb->protocol = htons(ETH_P_IP); return NF_HOOK_COND(NFPROTO_IPV4, NF_INET_POST_ROUTING, net, sk, skb, NULL, dev, ip_finish_output, !(IPCB(skb)->flags & IPSKB_REROUTED)); }


patrick mchardypatrick mchardy3842.22%316.67%
eric w. biedermaneric w. biederman1011.11%316.67%
eric dumazeteric dumazet88.89%211.11%
alexey kuznetsovalexey kuznetsov77.78%15.56%
neil hormanneil horman55.56%15.56%
ananda rajuananda raju22.22%15.56%
david s. millerdavid s. miller22.22%15.56%
herbert xuherbert xu11.11%15.56%
pavel emelianovpavel emelianov11.11%15.56%
jan engelhardtjan engelhardt11.11%15.56%

/* * copy saddr and daddr, possibly using 64bit load/stores * Equivalent to : * iph->saddr = fl4->saddr; * iph->daddr = fl4->daddr; */
static void ip_copy_addrs(struct iphdr *iph, const struct flowi4 *fl4) { BUILD_BUG_ON(offsetof(typeof(*fl4), daddr) != offsetof(typeof(*fl4), saddr) + sizeof(fl4->saddr)); memcpy(&iph->saddr, &fl4->saddr, sizeof(fl4->saddr) + sizeof(fl4->daddr)); }


eric dumazeteric dumazet76100.00%1100.00%

/* Note: skb->sk can be different from sk, in case of tunnels */
int ip_queue_xmit(struct sock *sk, struct sk_buff *skb, struct flowi *fl) { struct inet_sock *inet = inet_sk(sk); struct net *net = sock_net(sk); struct ip_options_rcu *inet_opt; struct flowi4 *fl4; struct rtable *rt; struct iphdr *iph; int res; /* Skip all of this if the packet is already routed, * f.e. by something like SCTP. */ rcu_read_lock(); inet_opt = rcu_dereference(inet->inet_opt); fl4 = &fl->u.ip4; rt = skb_rtable(skb); if (rt) goto packet_routed; /* Make sure we can route this packet. */ rt = (struct rtable *)__sk_dst_check(sk, 0); if (!rt) { __be32 daddr; /* Use correct destination address if we have options. */ daddr = inet->inet_daddr; if (inet_opt && inet_opt->opt.srr) daddr = inet_opt->opt.faddr; /* If this fails, retransmit mechanism of transport layer will * keep trying until route appears or the connection times * itself out. */ rt = ip_route_output_ports(net, fl4, sk, daddr, inet->inet_saddr, inet->inet_dport, inet->inet_sport, sk->sk_protocol, RT_CONN_FLAGS(sk), sk->sk_bound_dev_if); if (IS_ERR(rt)) goto no_route; sk_setup_caps(sk, &rt->dst); } skb_dst_set_noref(skb, &rt->dst); packet_routed: if (inet_opt && inet_opt->opt.is_strictroute && rt->rt_uses_gateway) goto no_route; /* OK, we know where to send it, allocate and build IP header. */ skb_push(skb, sizeof(struct iphdr) + (inet_opt ? inet_opt->opt.optlen : 0)); skb_reset_network_header(skb); iph = ip_hdr(skb); *((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (inet->tos & 0xff)); if (ip_dont_fragment(sk, &rt->dst) && !skb->ignore_df) iph->frag_off = htons(IP_DF); else iph->frag_off = 0; iph->ttl = ip_select_ttl(inet, &rt->dst); iph->protocol = sk->sk_protocol; ip_copy_addrs(iph, fl4); /* Transport layer set skb-> itself. */ if (inet_opt && inet_opt->opt.optlen) { iph->ihl += inet_opt->opt.optlen >> 2; ip_options_build(skb, &inet_opt->opt, inet->inet_daddr, rt, 0); } ip_select_ident_segs(net, skb, sk, skb_shinfo(skb)->gso_segs ?: 1); /* TODO : should we use skb->sk here instead of sk ? */ skb->priority = sk->sk_priority; skb->mark = sk->sk_mark; res = ip_local_out(net, sk, skb); rcu_read_unlock(); return res; no_route: rcu_read_unlock(); IP_INC_STATS(net, IPSTATS_MIB_OUTNOROUTES); kfree_skb(skb); return -EHOSTUNREACH; }


alexey kuznetsovalexey kuznetsov21243.80%35.45%
eric dumazeteric dumazet7315.08%814.55%
david s. millerdavid s. miller6112.60%1018.18%
eric w. biedermaneric w. biederman183.72%47.27%
arnaldo carvalho de meloarnaldo carvalho de melo163.31%59.09%
laszlo attila tothlaszlo attila toth81.65%11.82%
herbert xuherbert xu40.83%23.64%
hideaki yoshifujihideaki yoshifuji30.62%23.64%
al viroal viro20.41%23.64%
denis v. lunevdenis v. lunev20.41%23.64%
venkat yekkiralavenkat yekkirala20.41%11.82%
shan weishan wei20.41%11.82%
sridhar samudralasridhar samudrala20.41%11.82%
pavel emelianovpavel emelianov10.21%11.82%
linus torvaldslinus torvalds10.21%11.82%
americo wangamerico wang10.21%11.82%
julian anastasovjulian anastasov10.21%11.82%
ansis attekaansis atteka10.21%11.82%
ian morrisian morris10.21%11.82%
hannes frederic sowahannes frederic sowa10.21%11.82%
atis elstsatis elsts10.21%11.82%

static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from) { to->pkt_type = from->pkt_type; to->priority = from->priority; to->protocol = from->protocol; skb_dst_drop(to); skb_dst_copy(to, from); to->dev = from->dev; to->mark = from->mark; /* Copy the flags to each fragment. */ IPCB(to)->flags = IPCB(from)->flags; #ifdef CONFIG_NET_SCHED to->tc_index = from->tc_index; #endif nf_copy(to, from); #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE) to->ipvs_property = from->ipvs_property; #endif skb_copy_secmark(to, from); }


alexey kuznetsovalexey kuznetsov8262.60%110.00%
julian anastasovjulian anastasov1914.50%110.00%
thomas grafthomas graf86.11%110.00%
james morrisjames morris75.34%110.00%
eric dumazeteric dumazet53.82%220.00%
patrick mchardypatrick mchardy43.05%110.00%
jozsef kadlecsikjozsef kadlecsik43.05%220.00%
yasuyuki kozakaiyasuyuki kozakai21.53%110.00%

static int ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, unsigned int mtu, int (*output)(struct net *, struct sock *, struct sk_buff *)) { struct iphdr *iph = ip_hdr(skb); if ((iph->frag_off & htons(IP_DF)) == 0) return ip_do_fragment(net, sk, skb, output); if (unlikely(!skb->ignore_df || (IPCB(skb)->frag_max_size && IPCB(skb)->frag_max_size > mtu))) { IP_INC_STATS(net, IPSTATS_MIB_FRAGFAILS); icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu)); kfree_skb(skb); return -EMSGSIZE; } return ip_do_fragment(net, sk, skb, output); }


alexey kuznetsovalexey kuznetsov6743.79%214.29%
florian westphalflorian westphal2113.73%214.29%
patrick mchardypatrick mchardy1811.76%17.14%
eric w. biedermaneric w. biederman149.15%214.29%
andy zhouandy zhou138.50%17.14%
david s. millerdavid s. miller95.88%17.14%
wei dongwei dong53.27%17.14%
eric dumazeteric dumazet21.31%17.14%
hannes frederic sowahannes frederic sowa21.31%17.14%
americo wangamerico wang10.65%17.14%
pavel emelianovpavel emelianov10.65%17.14%

/* * This IP datagram is too large to be sent in one piece. Break it up into * smaller pieces (each of size equal to IP header plus * a block of the data of the original IP data part) that will yet fit in a * single device frame, and queue such a frame for sending. */
int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb, int (*output)(struct net *, struct sock *, struct sk_buff *)) { struct iphdr *iph; int ptr; struct net_device *dev; struct sk_buff *skb2; unsigned int mtu, hlen, left, len, ll_rs; int offset; __be16 not_last_frag; struct rtable *rt = skb_rtable(skb); int err = 0; dev = rt->; /* for offloaded checksums cleanup checksum before fragmentation */ if (skb->ip_summed == CHECKSUM_PARTIAL && (err = skb_checksum_help(skb))) goto fail; /* * Point into the IP datagram header. */ iph = ip_hdr(skb); mtu = ip_skb_dst_mtu(sk, skb); if (IPCB(skb)->frag_max_size && IPCB(skb)->frag_max_size < mtu) mtu = IPCB(skb)->frag_max_size; /* * Setup starting values. */ hlen = iph->ihl * 4; mtu = mtu - hlen; /* Size of data space */ IPCB(skb)->flags |= IPSKB_FRAG_COMPLETE; /* When frag_list is given, use it. First, check its validity: * some transformers could create wrong frag_list or break existing * one, it is not prohibited. In this case fall back to copying. * * LATER: this step can be merged to real generation of fragments, * we can switch to copy when see the first bad fragment. */ if (skb_has_frag_list(skb)) { struct sk_buff *frag, *frag2; int first_len = skb_pagelen(skb); if (first_len - hlen > mtu || ((first_len - hlen) & 7) || ip_is_fragment(iph) || skb_cloned(skb)) goto slow_path; skb_walk_frags(skb, frag) { /* Correct geometry. */ if (frag->len > mtu || ((frag->len & 7) && frag->next) || skb_headroom(frag) < hlen) goto slow_path_clean; /* Partially cloned skb? */ if (skb_shared(frag)) goto slow_path_clean; BUG_ON(frag->sk); if (skb->sk) { frag->sk = skb->sk; frag->destructor = sock_wfree; } skb->truesize -= frag->truesize; } /* Everything is OK. Generate! */ err = 0; offset = 0; frag = skb_shinfo(skb)->frag_list; skb_frag_list_init(skb); skb->data_len = first_len - skb_headlen(skb); skb->len = first_len; iph->tot_len = htons(first_len); iph->frag_off = htons(IP_MF); ip_send_check(iph); for (;;) { /* Prepare header of the next frame, * before previous one went down. */ if (frag) { frag->ip_summed = CHECKSUM_NONE; skb_reset_transport_header(frag); __skb_push(frag, hlen); skb_reset_network_header(frag); memcpy(skb_network_header(frag), iph, hlen); iph = ip_hdr(frag)