ip_output.c (3527a86b7ae17c949307d00e1eb7087604bca1b4) ip_output.c (b6a7719aedd7e5c0f2df7641aa47386111682df4)
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

--- 134 unchanged lines hidden (view full) ---

143 if (ip_dont_fragment(sk, &rt->dst))
144 iph->frag_off = htons(IP_DF);
145 else
146 iph->frag_off = 0;
147 iph->ttl = ip_select_ttl(inet, &rt->dst);
148 iph->daddr = (opt && opt->opt.srr ? opt->opt.faddr : daddr);
149 iph->saddr = saddr;
150 iph->protocol = sk->sk_protocol;
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

--- 134 unchanged lines hidden (view full) ---

143 if (ip_dont_fragment(sk, &rt->dst))
144 iph->frag_off = htons(IP_DF);
145 else
146 iph->frag_off = 0;
147 iph->ttl = ip_select_ttl(inet, &rt->dst);
148 iph->daddr = (opt && opt->opt.srr ? opt->opt.faddr : daddr);
149 iph->saddr = saddr;
150 iph->protocol = sk->sk_protocol;
151 ip_select_ident(skb, sk);
151 ip_select_ident(sock_net(sk), skb, sk);
152
153 if (opt && opt->opt.optlen) {
154 iph->ihl += opt->opt.optlen>>2;
155 ip_options_build(skb, &opt->opt, daddr, rt, 0);
156 }
157
158 skb->priority = sk->sk_priority;
159 skb->mark = sk->sk_mark;

--- 265 unchanged lines hidden (view full) ---

425
426 /* Transport layer set skb->h.foo itself. */
427
428 if (inet_opt && inet_opt->opt.optlen) {
429 iph->ihl += inet_opt->opt.optlen >> 2;
430 ip_options_build(skb, &inet_opt->opt, inet->inet_daddr, rt, 0);
431 }
432
152
153 if (opt && opt->opt.optlen) {
154 iph->ihl += opt->opt.optlen>>2;
155 ip_options_build(skb, &opt->opt, daddr, rt, 0);
156 }
157
158 skb->priority = sk->sk_priority;
159 skb->mark = sk->sk_mark;

--- 265 unchanged lines hidden (view full) ---

425
426 /* Transport layer set skb->h.foo itself. */
427
428 if (inet_opt && inet_opt->opt.optlen) {
429 iph->ihl += inet_opt->opt.optlen >> 2;
430 ip_options_build(skb, &inet_opt->opt, inet->inet_daddr, rt, 0);
431 }
432
433 ip_select_ident_segs(skb, sk, skb_shinfo(skb)->gso_segs ?: 1);
433 ip_select_ident_segs(sock_net(sk), skb, sk,
434 skb_shinfo(skb)->gso_segs ?: 1);
434
435 /* TODO : should we use skb->sk here instead of sk ? */
436 skb->priority = sk->sk_priority;
437 skb->mark = sk->sk_mark;
438
439 res = ip_local_out(skb);
440 rcu_read_unlock();
441 return res;

--- 189 unchanged lines hidden (view full) ---

631 /* for offloaded checksums cleanup checksum before fragmentation */
632 if ((skb->ip_summed == CHECKSUM_PARTIAL) && skb_checksum_help(skb))
633 goto fail;
634 iph = ip_hdr(skb);
635
636 left = skb->len - hlen; /* Space per frame */
637 ptr = hlen; /* Where to start from */
638
435
436 /* TODO : should we use skb->sk here instead of sk ? */
437 skb->priority = sk->sk_priority;
438 skb->mark = sk->sk_mark;
439
440 res = ip_local_out(skb);
441 rcu_read_unlock();
442 return res;

--- 189 unchanged lines hidden (view full) ---

632 /* for offloaded checksums cleanup checksum before fragmentation */
633 if ((skb->ip_summed == CHECKSUM_PARTIAL) && skb_checksum_help(skb))
634 goto fail;
635 iph = ip_hdr(skb);
636
637 left = skb->len - hlen; /* Space per frame */
638 ptr = hlen; /* Where to start from */
639
639 /* for bridged IP traffic encapsulated inside f.e. a vlan header,
640 * we need to make room for the encapsulating header
641 */
642 ll_rs = LL_RESERVED_SPACE_EXTRA(rt->dst.dev, nf_bridge_pad(skb));
640 ll_rs = LL_RESERVED_SPACE(rt->dst.dev);
643
644 /*
645 * Fragment the datagram.
646 */
647
648 offset = (ntohs(iph->frag_off) & IP_OFFSET) << 3;
649 not_last_frag = iph->frag_off & htons(IP_MF);
650

--- 726 unchanged lines hidden (view full) ---

1377 iph = ip_hdr(skb);
1378 iph->version = 4;
1379 iph->ihl = 5;
1380 iph->tos = (cork->tos != -1) ? cork->tos : inet->tos;
1381 iph->frag_off = df;
1382 iph->ttl = ttl;
1383 iph->protocol = sk->sk_protocol;
1384 ip_copy_addrs(iph, fl4);
641
642 /*
643 * Fragment the datagram.
644 */
645
646 offset = (ntohs(iph->frag_off) & IP_OFFSET) << 3;
647 not_last_frag = iph->frag_off & htons(IP_MF);
648

--- 726 unchanged lines hidden (view full) ---

1375 iph = ip_hdr(skb);
1376 iph->version = 4;
1377 iph->ihl = 5;
1378 iph->tos = (cork->tos != -1) ? cork->tos : inet->tos;
1379 iph->frag_off = df;
1380 iph->ttl = ttl;
1381 iph->protocol = sk->sk_protocol;
1382 ip_copy_addrs(iph, fl4);
1385 ip_select_ident(skb, sk);
1383 ip_select_ident(net, skb, sk);
1386
1387 if (opt) {
1388 iph->ihl += opt->optlen>>2;
1389 ip_options_build(skb, opt, cork->addr, rt, 0);
1390 }
1391
1392 skb->priority = (cork->tos != -1) ? cork->priority: sk->sk_priority;
1393 skb->mark = sk->sk_mark;

--- 193 unchanged lines hidden ---
1384
1385 if (opt) {
1386 iph->ihl += opt->optlen>>2;
1387 ip_options_build(skb, opt, cork->addr, rt, 0);
1388 }
1389
1390 skb->priority = (cork->tos != -1) ? cork->priority: sk->sk_priority;
1391 skb->mark = sk->sk_mark;

--- 193 unchanged lines hidden ---