aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/ip_output.c')
-rw-r--r--net/ipv4/ip_output.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index fc195a44fc2e..1da3d32f8289 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -288,9 +288,8 @@ int ip_output(struct sk_buff *skb)
288 !(IPCB(skb)->flags & IPSKB_REROUTED)); 288 !(IPCB(skb)->flags & IPSKB_REROUTED));
289} 289}
290 290
291int ip_queue_xmit(struct sk_buff *skb, int ipfragok) 291int ip_queue_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok)
292{ 292{
293 struct sock *sk = skb->sk;
294 struct inet_sock *inet = inet_sk(sk); 293 struct inet_sock *inet = inet_sk(sk);
295 struct ip_options *opt = inet->opt; 294 struct ip_options *opt = inet->opt;
296 struct rtable *rt; 295 struct rtable *rt;
@@ -342,7 +341,7 @@ packet_routed:
342 341
343 /* OK, we know where to send it, allocate and build IP header. */ 342 /* OK, we know where to send it, allocate and build IP header. */
344 iph = (struct iphdr *) skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0)); 343 iph = (struct iphdr *) skb_push(skb, sizeof(struct iphdr) + (opt ? opt->optlen : 0));
345 *((__u16 *)iph) = htons((4 << 12) | (5 << 8) | (inet->tos & 0xff)); 344 *((__be16 *)iph) = htons((4 << 12) | (5 << 8) | (inet->tos & 0xff));
346 iph->tot_len = htons(skb->len); 345 iph->tot_len = htons(skb->len);
347 if (ip_dont_fragment(sk, &rt->u.dst) && !ipfragok) 346 if (ip_dont_fragment(sk, &rt->u.dst) && !ipfragok)
348 iph->frag_off = htons(IP_DF); 347 iph->frag_off = htons(IP_DF);
@@ -386,6 +385,7 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
386 dst_release(to->dst); 385 dst_release(to->dst);
387 to->dst = dst_clone(from->dst); 386 to->dst = dst_clone(from->dst);
388 to->dev = from->dev; 387 to->dev = from->dev;
388 to->mark = from->mark;
389 389
390 /* Copy the flags to each fragment. */ 390 /* Copy the flags to each fragment. */
391 IPCB(to)->flags = IPCB(from)->flags; 391 IPCB(to)->flags = IPCB(from)->flags;
@@ -394,7 +394,6 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
394 to->tc_index = from->tc_index; 394 to->tc_index = from->tc_index;
395#endif 395#endif
396#ifdef CONFIG_NETFILTER 396#ifdef CONFIG_NETFILTER
397 to->nfmark = from->nfmark;
398 /* Connection association is same as pre-frag packet */ 397 /* Connection association is same as pre-frag packet */
399 nf_conntrack_put(to->nfct); 398 nf_conntrack_put(to->nfct);
400 to->nfct = from->nfct; 399 to->nfct = from->nfct;
@@ -683,7 +682,7 @@ ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk
683 if (memcpy_fromiovecend(to, iov, offset, len) < 0) 682 if (memcpy_fromiovecend(to, iov, offset, len) < 0)
684 return -EFAULT; 683 return -EFAULT;
685 } else { 684 } else {
686 unsigned int csum = 0; 685 __wsum csum = 0;
687 if (csum_partial_copy_fromiovecend(to, iov, offset, len, &csum) < 0) 686 if (csum_partial_copy_fromiovecend(to, iov, offset, len, &csum) < 0)
688 return -EFAULT; 687 return -EFAULT;
689 skb->csum = csum_block_add(skb->csum, csum, odd); 688 skb->csum = csum_block_add(skb->csum, csum, odd);
@@ -691,11 +690,11 @@ ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk
691 return 0; 690 return 0;
692} 691}
693 692
694static inline unsigned int 693static inline __wsum
695csum_page(struct page *page, int offset, int copy) 694csum_page(struct page *page, int offset, int copy)
696{ 695{
697 char *kaddr; 696 char *kaddr;
698 unsigned int csum; 697 __wsum csum;
699 kaddr = kmap(page); 698 kaddr = kmap(page);
700 csum = csum_partial(kaddr + offset, copy, 0); 699 csum = csum_partial(kaddr + offset, copy, 0);
701 kunmap(page); 700 kunmap(page);
@@ -1167,7 +1166,7 @@ ssize_t ip_append_page(struct sock *sk, struct page *page,
1167 } 1166 }
1168 1167
1169 if (skb->ip_summed == CHECKSUM_NONE) { 1168 if (skb->ip_summed == CHECKSUM_NONE) {
1170 unsigned int csum; 1169 __wsum csum;
1171 csum = csum_page(page, offset, len); 1170 csum = csum_page(page, offset, len);
1172 skb->csum = csum_block_add(skb->csum, csum, skb->len); 1171 skb->csum = csum_block_add(skb->csum, csum, skb->len);
1173 } 1172 }
@@ -1315,7 +1314,7 @@ void ip_flush_pending_frames(struct sock *sk)
1315static int ip_reply_glue_bits(void *dptr, char *to, int offset, 1314static int ip_reply_glue_bits(void *dptr, char *to, int offset,
1316 int len, int odd, struct sk_buff *skb) 1315 int len, int odd, struct sk_buff *skb)
1317{ 1316{
1318 unsigned int csum; 1317 __wsum csum;
1319 1318
1320 csum = csum_partial_copy_nocheck(dptr+offset, to, len, 0); 1319 csum = csum_partial_copy_nocheck(dptr+offset, to, len, 0);
1321 skb->csum = csum_block_add(skb->csum, csum, odd); 1320 skb->csum = csum_block_add(skb->csum, csum, odd);
@@ -1385,7 +1384,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
1385 &ipc, rt, MSG_DONTWAIT); 1384 &ipc, rt, MSG_DONTWAIT);
1386 if ((skb = skb_peek(&sk->sk_write_queue)) != NULL) { 1385 if ((skb = skb_peek(&sk->sk_write_queue)) != NULL) {
1387 if (arg->csumoffset >= 0) 1386 if (arg->csumoffset >= 0)
1388 *((u16 *)skb->h.raw + arg->csumoffset) = csum_fold(csum_add(skb->csum, arg->csum)); 1387 *((__sum16 *)skb->h.raw + arg->csumoffset) = csum_fold(csum_add(skb->csum, arg->csum));
1389 skb->ip_summed = CHECKSUM_NONE; 1388 skb->ip_summed = CHECKSUM_NONE;
1390 ip_push_pending_frames(sk); 1389 ip_push_pending_frames(sk);
1391 } 1390 }