diff options
-rw-r--r-- | net/ipv4/raw.c | 8 | ||||
-rw-r--r-- | net/ipv6/raw.c | 12 |
2 files changed, 12 insertions, 8 deletions
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 2c7a1639388a..66cc3befcd44 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c | |||
@@ -314,7 +314,7 @@ int raw_rcv(struct sock *sk, struct sk_buff *skb) | |||
314 | } | 314 | } |
315 | 315 | ||
316 | static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, | 316 | static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, |
317 | struct rtable *rt, | 317 | struct rtable **rtp, |
318 | unsigned int flags) | 318 | unsigned int flags) |
319 | { | 319 | { |
320 | struct inet_sock *inet = inet_sk(sk); | 320 | struct inet_sock *inet = inet_sk(sk); |
@@ -323,6 +323,7 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, | |||
323 | struct sk_buff *skb; | 323 | struct sk_buff *skb; |
324 | unsigned int iphlen; | 324 | unsigned int iphlen; |
325 | int err; | 325 | int err; |
326 | struct rtable *rt = *rtp; | ||
326 | 327 | ||
327 | if (length > rt->u.dst.dev->mtu) { | 328 | if (length > rt->u.dst.dev->mtu) { |
328 | ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->inet_dport, | 329 | ip_local_error(sk, EMSGSIZE, rt->rt_dst, inet->inet_dport, |
@@ -341,7 +342,8 @@ static int raw_send_hdrinc(struct sock *sk, void *from, size_t length, | |||
341 | 342 | ||
342 | skb->priority = sk->sk_priority; | 343 | skb->priority = sk->sk_priority; |
343 | skb->mark = sk->sk_mark; | 344 | skb->mark = sk->sk_mark; |
344 | skb_dst_set(skb, dst_clone(&rt->u.dst)); | 345 | skb_dst_set(skb, &rt->u.dst); |
346 | *rtp = NULL; | ||
345 | 347 | ||
346 | skb_reset_network_header(skb); | 348 | skb_reset_network_header(skb); |
347 | iph = ip_hdr(skb); | 349 | iph = ip_hdr(skb); |
@@ -576,7 +578,7 @@ back_from_confirm: | |||
576 | 578 | ||
577 | if (inet->hdrincl) | 579 | if (inet->hdrincl) |
578 | err = raw_send_hdrinc(sk, msg->msg_iov, len, | 580 | err = raw_send_hdrinc(sk, msg->msg_iov, len, |
579 | rt, msg->msg_flags); | 581 | &rt, msg->msg_flags); |
580 | 582 | ||
581 | else { | 583 | else { |
582 | if (!ipc.addr) | 584 | if (!ipc.addr) |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 864eb8e03b1b..968b96490729 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
@@ -602,13 +602,14 @@ out: | |||
602 | } | 602 | } |
603 | 603 | ||
604 | static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, | 604 | static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, |
605 | struct flowi *fl, struct rt6_info *rt, | 605 | struct flowi *fl, struct dst_entry **dstp, |
606 | unsigned int flags) | 606 | unsigned int flags) |
607 | { | 607 | { |
608 | struct ipv6_pinfo *np = inet6_sk(sk); | 608 | struct ipv6_pinfo *np = inet6_sk(sk); |
609 | struct ipv6hdr *iph; | 609 | struct ipv6hdr *iph; |
610 | struct sk_buff *skb; | 610 | struct sk_buff *skb; |
611 | int err; | 611 | int err; |
612 | struct rt6_info *rt = (struct rt6_info *)*dstp; | ||
612 | 613 | ||
613 | if (length > rt->u.dst.dev->mtu) { | 614 | if (length > rt->u.dst.dev->mtu) { |
614 | ipv6_local_error(sk, EMSGSIZE, fl, rt->u.dst.dev->mtu); | 615 | ipv6_local_error(sk, EMSGSIZE, fl, rt->u.dst.dev->mtu); |
@@ -626,7 +627,8 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length, | |||
626 | 627 | ||
627 | skb->priority = sk->sk_priority; | 628 | skb->priority = sk->sk_priority; |
628 | skb->mark = sk->sk_mark; | 629 | skb->mark = sk->sk_mark; |
629 | skb_dst_set(skb, dst_clone(&rt->u.dst)); | 630 | skb_dst_set(skb, &rt->u.dst); |
631 | *dstp = NULL; | ||
630 | 632 | ||
631 | skb_put(skb, length); | 633 | skb_put(skb, length); |
632 | skb_reset_network_header(skb); | 634 | skb_reset_network_header(skb); |
@@ -886,9 +888,9 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, | |||
886 | goto do_confirm; | 888 | goto do_confirm; |
887 | 889 | ||
888 | back_from_confirm: | 890 | back_from_confirm: |
889 | if (inet->hdrincl) { | 891 | if (inet->hdrincl) |
890 | err = rawv6_send_hdrinc(sk, msg->msg_iov, len, &fl, (struct rt6_info*)dst, msg->msg_flags); | 892 | err = rawv6_send_hdrinc(sk, msg->msg_iov, len, &fl, &dst, msg->msg_flags); |
891 | } else { | 893 | else { |
892 | lock_sock(sk); | 894 | lock_sock(sk); |
893 | err = ip6_append_data(sk, ip_generic_getfrag, msg->msg_iov, | 895 | err = ip6_append_data(sk, ip_generic_getfrag, msg->msg_iov, |
894 | len, 0, hlimit, tclass, opt, &fl, (struct rt6_info*)dst, | 896 | len, 0, hlimit, tclass, opt, &fl, (struct rt6_info*)dst, |