aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/raw.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/raw.c')
-rw-r--r--net/ipv6/raw.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
index dae7f1a1e464..8072bd4139b7 100644
--- a/net/ipv6/raw.c
+++ b/net/ipv6/raw.c
@@ -32,7 +32,7 @@
32#include <linux/netfilter_ipv6.h> 32#include <linux/netfilter_ipv6.h>
33#include <linux/skbuff.h> 33#include <linux/skbuff.h>
34#include <linux/compat.h> 34#include <linux/compat.h>
35#include <asm/uaccess.h> 35#include <linux/uaccess.h>
36#include <asm/ioctls.h> 36#include <asm/ioctls.h>
37 37
38#include <net/net_namespace.h> 38#include <net/net_namespace.h>
@@ -172,7 +172,7 @@ static bool ipv6_raw_deliver(struct sk_buff *skb, int nexthdr)
172 read_lock(&raw_v6_hashinfo.lock); 172 read_lock(&raw_v6_hashinfo.lock);
173 sk = sk_head(&raw_v6_hashinfo.ht[hash]); 173 sk = sk_head(&raw_v6_hashinfo.ht[hash]);
174 174
175 if (sk == NULL) 175 if (!sk)
176 goto out; 176 goto out;
177 177
178 net = dev_net(skb->dev); 178 net = dev_net(skb->dev);
@@ -367,7 +367,7 @@ void raw6_icmp_error(struct sk_buff *skb, int nexthdr,
367 367
368 read_lock(&raw_v6_hashinfo.lock); 368 read_lock(&raw_v6_hashinfo.lock);
369 sk = sk_head(&raw_v6_hashinfo.ht[hash]); 369 sk = sk_head(&raw_v6_hashinfo.ht[hash]);
370 if (sk != NULL) { 370 if (sk) {
371 /* Note: ipv6_hdr(skb) != skb->data */ 371 /* Note: ipv6_hdr(skb) != skb->data */
372 const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data; 372 const struct ipv6hdr *ip6h = (const struct ipv6hdr *)skb->data;
373 saddr = &ip6h->saddr; 373 saddr = &ip6h->saddr;
@@ -456,9 +456,8 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb)
456 * we return it, otherwise we block. 456 * we return it, otherwise we block.
457 */ 457 */
458 458
459static int rawv6_recvmsg(struct kiocb *iocb, struct sock *sk, 459static int rawv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
460 struct msghdr *msg, size_t len, 460 int noblock, int flags, int *addr_len)
461 int noblock, int flags, int *addr_len)
462{ 461{
463 struct ipv6_pinfo *np = inet6_sk(sk); 462 struct ipv6_pinfo *np = inet6_sk(sk);
464 DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name); 463 DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name);
@@ -631,7 +630,7 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,
631 skb = sock_alloc_send_skb(sk, 630 skb = sock_alloc_send_skb(sk,
632 length + hlen + tlen + 15, 631 length + hlen + tlen + 15,
633 flags & MSG_DONTWAIT, &err); 632 flags & MSG_DONTWAIT, &err);
634 if (skb == NULL) 633 if (!skb)
635 goto error; 634 goto error;
636 skb_reserve(skb, hlen); 635 skb_reserve(skb, hlen);
637 636
@@ -653,8 +652,8 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,
653 goto error_fault; 652 goto error_fault;
654 653
655 IP6_UPD_PO_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len); 654 IP6_UPD_PO_STATS(sock_net(sk), rt->rt6i_idev, IPSTATS_MIB_OUT, skb->len);
656 err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, skb, NULL, 655 err = NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, sk, skb,
657 rt->dst.dev, dst_output); 656 NULL, rt->dst.dev, dst_output_sk);
658 if (err > 0) 657 if (err > 0)
659 err = net_xmit_errno(err); 658 err = net_xmit_errno(err);
660 if (err) 659 if (err)
@@ -730,8 +729,7 @@ static int raw6_getfrag(void *from, char *to, int offset, int len, int odd,
730 return ip_generic_getfrag(rfv->msg, to, offset, len, odd, skb); 729 return ip_generic_getfrag(rfv->msg, to, offset, len, odd, skb);
731} 730}
732 731
733static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk, 732static int rawv6_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
734 struct msghdr *msg, size_t len)
735{ 733{
736 struct ipv6_txoptions opt_space; 734 struct ipv6_txoptions opt_space;
737 DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name); 735 DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name);
@@ -791,7 +789,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
791 fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK; 789 fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK;
792 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) { 790 if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) {
793 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); 791 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
794 if (flowlabel == NULL) 792 if (!flowlabel)
795 return -EINVAL; 793 return -EINVAL;
796 } 794 }
797 } 795 }
@@ -833,13 +831,13 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
833 } 831 }
834 if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { 832 if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) {
835 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); 833 flowlabel = fl6_sock_lookup(sk, fl6.flowlabel);
836 if (flowlabel == NULL) 834 if (!flowlabel)
837 return -EINVAL; 835 return -EINVAL;
838 } 836 }
839 if (!(opt->opt_nflen|opt->opt_flen)) 837 if (!(opt->opt_nflen|opt->opt_flen))
840 opt = NULL; 838 opt = NULL;
841 } 839 }
842 if (opt == NULL) 840 if (!opt)
843 opt = np->opt; 841 opt = np->opt;
844 if (flowlabel) 842 if (flowlabel)
845 opt = fl6_merge_options(&opt_space, flowlabel, opt); 843 opt = fl6_merge_options(&opt_space, flowlabel, opt);
@@ -1132,7 +1130,7 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg)
1132 1130
1133 spin_lock_bh(&sk->sk_receive_queue.lock); 1131 spin_lock_bh(&sk->sk_receive_queue.lock);
1134 skb = skb_peek(&sk->sk_receive_queue); 1132 skb = skb_peek(&sk->sk_receive_queue);
1135 if (skb != NULL) 1133 if (skb)
1136 amount = skb_tail_pointer(skb) - 1134 amount = skb_tail_pointer(skb) -
1137 skb_transport_header(skb); 1135 skb_transport_header(skb);
1138 spin_unlock_bh(&sk->sk_receive_queue.lock); 1136 spin_unlock_bh(&sk->sk_receive_queue.lock);