[IPv6] RAW: Compact the API for the kernel
[safe/jmp/linux-2.6] / net / ipv6 / udp.c
index b3ea8af..ee1cc3f 100644 (file)
@@ -1,9 +1,9 @@
 /*
  *     UDP over IPv6
- *     Linux INET6 implementation 
+ *     Linux INET6 implementation
  *
  *     Authors:
- *     Pedro Roque             <roque@di.fc.ul.pt>     
+ *     Pedro Roque             <roque@di.fc.ul.pt>
  *
  *     Based on linux/ipv4/udp.c
  *
@@ -27,7 +27,6 @@
 #include <linux/types.h>
 #include <linux/socket.h>
 #include <linux/sockios.h>
-#include <linux/sched.h>
 #include <linux/net.h>
 #include <linux/in6.h>
 #include <linux/netdevice.h>
@@ -67,11 +66,11 @@ static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport,
        unsigned short hnum = ntohs(dport);
        int badness = -1;
 
-       read_lock(&udp_hash_lock);
+       read_lock(&udp_hash_lock);
        sk_for_each(sk, node, &udptable[hnum & (UDP_HTABLE_SIZE - 1)]) {
                struct inet_sock *inet = inet_sk(sk);
 
-               if (inet->num == hnum && sk->sk_family == PF_INET6) {
+               if (sk->sk_hash == hnum && sk->sk_family == PF_INET6) {
                        struct ipv6_pinfo *np = inet6_sk(sk);
                        int score = 0;
                        if (inet->dport) {
@@ -94,10 +93,10 @@ static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport,
                                        continue;
                                score++;
                        }
-                       if(score == 4) {
+                       if (score == 4) {
                                result = sk;
                                break;
-                       } else if(score > badness) {
+                       } else if (score > badness) {
                                result = sk;
                                badness = score;
                        }
@@ -105,7 +104,7 @@ static struct sock *__udp6_lib_lookup(struct in6_addr *saddr, __be16 sport,
        }
        if (result)
                sock_hold(result);
-       read_unlock(&udp_hash_lock);
+       read_unlock(&udp_hash_lock);
        return result;
 }
 
@@ -120,13 +119,14 @@ int udpv6_recvmsg(struct kiocb *iocb, struct sock *sk,
 {
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct inet_sock *inet = inet_sk(sk);
-       struct sk_buff *skb;
-       size_t copied;
-       int err, copy_only, is_udplite = IS_UDPLITE(sk);
+       struct sk_buff *skb;
+       unsigned int ulen, copied;
+       int err;
+       int is_udplite = IS_UDPLITE(sk);
+
+       if (addr_len)
+               *addr_len=sizeof(struct sockaddr_in6);
 
-       if (addr_len)
-               *addr_len=sizeof(struct sockaddr_in6);
-  
        if (flags & MSG_ERRQUEUE)
                return ipv6_recv_error(sk, msg, len);
 
@@ -135,24 +135,25 @@ try_again:
        if (!skb)
                goto out;
 
-       copied = skb->len - sizeof(struct udphdr);
-       if (copied > len) {
-               copied = len;
-               msg->msg_flags |= MSG_TRUNC;
-       }
+       ulen = skb->len - sizeof(struct udphdr);
+       copied = len;
+       if (copied > ulen)
+               copied = ulen;
+       else if (copied < ulen)
+               msg->msg_flags |= MSG_TRUNC;
 
        /*
-        *      Decide whether to checksum and/or copy data.
+        * If checksum is needed at all, try to do it while copying the
+        * data.  If the data is truncated, or if we only want a partial
+        * coverage checksum (UDP-Lite), do it before the copy.
         */
-       copy_only = (skb->ip_summed==CHECKSUM_UNNECESSARY);
 
-       if (is_udplite  ||  (!copy_only  &&  msg->msg_flags&MSG_TRUNC)) {
-               if (__udp_lib_checksum_complete(skb))
+       if (copied < ulen || UDP_SKB_CB(skb)->partial_cov) {
+               if (udp_lib_checksum_complete(skb))
                        goto csum_copy_err;
-               copy_only = 1;
        }
 
-       if (copy_only)
+       if (skb_csum_unnecessary(skb))
                err = skb_copy_datagram_iovec(skb, sizeof(struct udphdr),
                                              msg->msg_iov, copied       );
        else {
@@ -168,18 +169,19 @@ try_again:
        /* Copy the address. */
        if (msg->msg_name) {
                struct sockaddr_in6 *sin6;
-         
+
                sin6 = (struct sockaddr_in6 *) msg->msg_name;
                sin6->sin6_family = AF_INET6;
-               sin6->sin6_port = skb->h.uh->source;
+               sin6->sin6_port = udp_hdr(skb)->source;
                sin6->sin6_flowinfo = 0;
                sin6->sin6_scope_id = 0;
 
                if (skb->protocol == htons(ETH_P_IP))
                        ipv6_addr_set(&sin6->sin6_addr, 0, 0,
-                                     htonl(0xffff), skb->nh.iph->saddr);
+                                     htonl(0xffff), ip_hdr(skb)->saddr);
                else {
-                       ipv6_addr_copy(&sin6->sin6_addr, &skb->nh.ipv6h->saddr);
+                       ipv6_addr_copy(&sin6->sin6_addr,
+                                      &ipv6_hdr(skb)->saddr);
                        if (ipv6_addr_type(&sin6->sin6_addr) & IPV6_ADDR_LINKLOCAL)
                                sin6->sin6_scope_id = IP6CB(skb)->iif;
                }
@@ -191,11 +193,11 @@ try_again:
        } else {
                if (np->rxopt.all)
                        datagram_recv_ctl(sk, msg, skb);
-       }
+       }
 
        err = copied;
        if (flags & MSG_TRUNC)
-               err = skb->len - sizeof(struct udphdr);
+               err = ulen;
 
 out_free:
        skb_free_datagram(sk, skb);
@@ -203,12 +205,11 @@ out:
        return err;
 
 csum_copy_err:
+       UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);
        skb_kill_datagram(sk, skb, flags);
 
-       if (flags & MSG_DONTWAIT) {
-               UDP6_INC_STATS_USER(UDP_MIB_INERRORS, is_udplite);
+       if (flags & MSG_DONTWAIT)
                return -EAGAIN;
-       }
        goto try_again;
 }
 
@@ -280,8 +281,10 @@ int udpv6_queue_rcv_skb(struct sock * sk, struct sk_buff *skb)
                }
        }
 
-       if (udp_lib_checksum_complete(skb))
-               goto drop;
+       if (sk->sk_filter) {
+               if (udp_lib_checksum_complete(skb))
+                       goto drop;
+       }
 
        if ((rc = sock_queue_rcv_skb(sk,skb)) < 0) {
                /* Note that an ENOMEM error is charged twice */
@@ -309,7 +312,7 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
        sk_for_each_from(s, node) {
                struct inet_sock *inet = inet_sk(s);
 
-               if (inet->num == num && s->sk_family == PF_INET6) {
+               if (s->sk_hash == num && s->sk_family == PF_INET6) {
                        struct ipv6_pinfo *np = inet6_sk(s);
                        if (inet->dport) {
                                if (inet->dport != rmt_port)
@@ -326,7 +329,7 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
                                if (!ipv6_addr_equal(&np->rcv_saddr, loc_addr))
                                        continue;
                        }
-                       if(!inet6_mc_check(s, loc_addr, rmt_addr))
+                       if (!inet6_mc_check(s, loc_addr, rmt_addr))
                                continue;
                        return s;
                }
@@ -339,10 +342,10 @@ static struct sock *udp_v6_mcast_next(struct sock *sk,
  * so we don't need to lock the hashes.
  */
 static int __udp6_lib_mcast_deliver(struct sk_buff *skb, struct in6_addr *saddr,
-                          struct in6_addr *daddr, struct hlist_head udptable[])
+                          struct in6_addr *daddr, struct hlist_head udptable[])
 {
        struct sock *sk, *sk2;
-       const struct udphdr *uh = skb->h.uh;
+       const struct udphdr *uh = udp_hdr(skb);
        int dif;
 
        read_lock(&udp_hash_lock);
@@ -367,9 +370,20 @@ out:
        return 0;
 }
 
-static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh)
-
+static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh,
+                                int proto)
 {
+       int err;
+
+       UDP_SKB_CB(skb)->partial_cov = 0;
+       UDP_SKB_CB(skb)->cscov = skb->len;
+
+       if (proto == IPPROTO_UDPLITE) {
+               err = udplite_checksum_init(skb, uh);
+               if (err)
+                       return err;
+       }
+
        if (uh->check == 0) {
                /* RFC 2460 section 8.1 says that we SHOULD log
                   this error. Well, it is reasonable.
@@ -378,25 +392,23 @@ static inline int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh)
                return 1;
        }
        if (skb->ip_summed == CHECKSUM_COMPLETE &&
-           !csum_ipv6_magic(&skb->nh.ipv6h->saddr, &skb->nh.ipv6h->daddr,
-                            skb->len, IPPROTO_UDP, skb->csum             ))
+           !csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr,
+                            skb->len, proto, skb->csum))
                skb->ip_summed = CHECKSUM_UNNECESSARY;
 
-       if (skb->ip_summed != CHECKSUM_UNNECESSARY)
-               skb->csum = ~csum_unfold(csum_ipv6_magic(&skb->nh.ipv6h->saddr,
-                                                        &skb->nh.ipv6h->daddr,
-                                                        skb->len, IPPROTO_UDP,
-                                                        0));
+       if (!skb_csum_unnecessary(skb))
+               skb->csum = ~csum_unfold(csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
+                                                        &ipv6_hdr(skb)->daddr,
+                                                        skb->len, proto, 0));
 
-       return (UDP_SKB_CB(skb)->partial_cov = 0);
+       return 0;
 }
 
-int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
-                  int is_udplite)
+int __udp6_lib_rcv(struct sk_buff *skb, struct hlist_head udptable[],
+                  int proto)
 {
-       struct sk_buff *skb = *pskb;
        struct sock *sk;
-       struct udphdr *uh;
+       struct udphdr *uh;
        struct net_device *dev = skb->dev;
        struct in6_addr *saddr, *daddr;
        u32 ulen = 0;
@@ -404,15 +416,16 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
        if (!pskb_may_pull(skb, sizeof(struct udphdr)))
                goto short_packet;
 
-       saddr = &skb->nh.ipv6h->saddr;
-       daddr = &skb->nh.ipv6h->daddr;
-       uh = skb->h.uh;
+       saddr = &ipv6_hdr(skb)->saddr;
+       daddr = &ipv6_hdr(skb)->daddr;
+       uh = udp_hdr(skb);
 
        ulen = ntohs(uh->len);
        if (ulen > skb->len)
                goto short_packet;
 
-       if(! is_udplite ) {             /* UDP validates ulen. */
+       if (proto == IPPROTO_UDP) {
+               /* UDP validates ulen. */
 
                /* Check for jumbo payload */
                if (ulen == 0)
@@ -424,28 +437,24 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
                if (ulen < skb->len) {
                        if (pskb_trim_rcsum(skb, ulen))
                                goto short_packet;
-                       saddr = &skb->nh.ipv6h->saddr;
-                       daddr = &skb->nh.ipv6h->daddr;
-                       uh = skb->h.uh;
+                       saddr = &ipv6_hdr(skb)->saddr;
+                       daddr = &ipv6_hdr(skb)->daddr;
+                       uh = udp_hdr(skb);
                }
-
-               if (udp6_csum_init(skb, uh))
-                       goto discard;
-
-       } else  {                       /* UDP-Lite validates cscov. */
-               if (udplite6_csum_init(skb, uh))
-                       goto discard;
        }
 
-       /* 
-        *      Multicast receive code 
+       if (udp6_csum_init(skb, uh, proto))
+               goto discard;
+
+       /*
+        *      Multicast receive code
         */
        if (ipv6_addr_is_multicast(daddr))
                return __udp6_lib_mcast_deliver(skb, saddr, daddr, udptable);
 
        /* Unicast */
 
-       /* 
+       /*
         * check socket cache ... must talk to Alan about his plans
         * for sock caches... i'll skip this for now.
         */
@@ -458,33 +467,34 @@ int __udp6_lib_rcv(struct sk_buff **pskb, struct hlist_head udptable[],
 
                if (udp_lib_checksum_complete(skb))
                        goto discard;
-               UDP6_INC_STATS_BH(UDP_MIB_NOPORTS, is_udplite);
+               UDP6_INC_STATS_BH(UDP_MIB_NOPORTS, proto == IPPROTO_UDPLITE);
 
                icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0, dev);
 
                kfree_skb(skb);
-               return(0);
+               return 0;
        }
-       
+
        /* deliver */
-       
+
        udpv6_queue_rcv_skb(sk, skb);
        sock_put(sk);
-       return(0);
+       return 0;
 
-short_packet:  
+short_packet:
        LIMIT_NETDEBUG(KERN_DEBUG "UDP%sv6: short packet: %d/%u\n",
-                      is_udplite? "-Lite" : "",  ulen, skb->len);
+                      proto == IPPROTO_UDPLITE ? "-Lite" : "",
+                      ulen, skb->len);
 
 discard:
-       UDP6_INC_STATS_BH(UDP_MIB_INERRORS, is_udplite);
+       UDP6_INC_STATS_BH(UDP_MIB_INERRORS, proto == IPPROTO_UDPLITE);
        kfree_skb(skb);
-       return(0);      
+       return 0;
 }
 
-static __inline__ int udpv6_rcv(struct sk_buff **pskb)
+static __inline__ int udpv6_rcv(struct sk_buff *skb)
 {
-       return __udp6_lib_rcv(pskb, udp_hash, 0);
+       return __udp6_lib_rcv(skb, udp_hash, IPPROTO_UDP);
 }
 
 /*
@@ -498,17 +508,18 @@ static void udp_v6_flush_pending_frames(struct sock *sk)
                up->len = 0;
                up->pending = 0;
                ip6_flush_pending_frames(sk);
-        }
+       }
 }
 
 /*
  *     Sending
  */
 
-static int udp_v6_push_pending_frames(struct sock *sk, struct udp_sock *up)
+static int udp_v6_push_pending_frames(struct sock *sk)
 {
        struct sk_buff *skb;
        struct udphdr *uh;
+       struct udp_sock  *up = udp_sk(sk);
        struct inet_sock *inet = inet_sk(sk);
        struct flowi *fl = &inet->cork.fl;
        int err = 0;
@@ -521,7 +532,7 @@ static int udp_v6_push_pending_frames(struct sock *sk, struct udp_sock *up)
        /*
         * Create a UDP header
         */
-       uh = skb->h.uh;
+       uh = udp_hdr(skb);
        uh->source = fl->fl_ip_sport;
        uh->dest = fl->fl_ip_dport;
        uh->len = htons(up->len);
@@ -542,6 +553,8 @@ static int udp_v6_push_pending_frames(struct sock *sk, struct udp_sock *up)
 out:
        up->len = 0;
        up->pending = 0;
+       if (!err)
+               UDP6_INC_STATS_USER(UDP_MIB_OUTDATAGRAMS, up->pcflag);
        return err;
 }
 
@@ -593,11 +606,11 @@ int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk,
                if (sk->sk_state != TCP_ESTABLISHED)
                        return -EDESTADDRREQ;
                daddr = &np->daddr;
-       } else 
+       } else
                daddr = NULL;
 
        if (daddr) {
-               if (ipv6_addr_type(daddr) == IPV6_ADDR_MAPPED) {
+               if (ipv6_addr_v4mapped(daddr)) {
                        struct sockaddr_in sin;
                        sin.sin_family = AF_INET;
                        sin.sin_port = sin6 ? sin6->sin6_port : inet->dport;
@@ -615,11 +628,11 @@ do_udp_sendmsg:
                return udp_sendmsg(iocb, sk, msg, len);
 
        /* Rough check on arithmetic overflow,
-          better check is made in ip6_build_xmit
+          better check is made in ip6_append_data().
           */
        if (len > INT_MAX - sizeof(struct udphdr))
                return -EMSGSIZE;
-       
+
        if (up->pending) {
                /*
                 * There are pending frames.
@@ -712,7 +725,7 @@ do_udp_sendmsg:
        if (ipv6_addr_any(&fl.fl6_src) && !ipv6_addr_any(&np->saddr))
                ipv6_addr_copy(&fl.fl6_src, &np->saddr);
        fl.fl_ip_sport = inet->sport;
-       
+
        /* merge ip6_build_xmit from ip6_output */
        if (opt && opt->srcrt) {
                struct rt0_hdr *rt0 = (struct rt0_hdr *) opt->srcrt;
@@ -735,8 +748,12 @@ do_udp_sendmsg:
        if (final_p)
                ipv6_addr_copy(&fl.fl6_dst, final_p);
 
-       if ((err = xfrm_lookup(&dst, &fl, sk, 0)) < 0)
-               goto out;
+       if ((err = __xfrm_lookup(&dst, &fl, sk, 1)) < 0) {
+               if (err == -EREMOTE)
+                       err = ip6_dst_blackhole(sk, &dst, &fl);
+               if (err < 0)
+                       goto out;
+       }
 
        if (hlimit < 0) {
                if (ipv6_addr_is_multicast(&fl.fl6_dst))
@@ -782,7 +799,7 @@ do_append_data:
        if (err)
                udp_v6_flush_pending_frames(sk);
        else if (!corkreq)
-               err = udp_v6_push_pending_frames(sk, up);
+               err = udp_v6_push_pending_frames(sk);
        else if (unlikely(skb_queue_empty(&sk->sk_write_queue)))
                up->pending = 0;
 
@@ -806,10 +823,8 @@ do_append_data:
        release_sock(sk);
 out:
        fl6_sock_release(flowlabel);
-       if (!err) {
-               UDP6_INC_STATS_USER(UDP_MIB_OUTDATAGRAMS, is_udplite);
+       if (!err)
                return len;
-       }
        /*
         * ENOBUFS = no kernel mem, SOCK_NOSPACE = no sndbuf space.  Reporting
         * ENOBUFS might not be good (it's not tunable per se), but otherwise
@@ -844,72 +859,12 @@ int udpv6_destroy_sock(struct sock *sk)
 /*
  *     Socket option code for UDP
  */
-static int do_udpv6_setsockopt(struct sock *sk, int level, int optname,
-                         char __user *optval, int optlen)
-{
-       struct udp_sock *up = udp_sk(sk);
-       int val;
-       int err = 0;
-
-       if(optlen<sizeof(int))
-               return -EINVAL;
-
-       if (get_user(val, (int __user *)optval))
-               return -EFAULT;
-
-       switch(optname) {
-       case UDP_CORK:
-               if (val != 0) {
-                       up->corkflag = 1;
-               } else {
-                       up->corkflag = 0;
-                       lock_sock(sk);
-                       udp_v6_push_pending_frames(sk, up);
-                       release_sock(sk);
-               }
-               break;
-       case UDP_ENCAP:
-               switch (val) {
-               case 0:
-                       up->encap_type = val;
-                       break;
-               default:
-                       err = -ENOPROTOOPT;
-                       break;
-               }
-               break;
-
-       case UDPLITE_SEND_CSCOV:
-               if (!up->pcflag)         /* Disable the option on UDP sockets */
-                       return -ENOPROTOOPT;
-               if (val != 0 && val < 8) /* Illegal coverage: use default (8) */
-                       val = 8;
-               up->pcslen = val;
-               up->pcflag |= UDPLITE_SEND_CC;
-               break;
-
-       case UDPLITE_RECV_CSCOV:
-               if (!up->pcflag)         /* Disable the option on UDP sockets */
-                       return -ENOPROTOOPT;
-               if (val != 0 && val < 8) /* Avoid silly minimal values.       */
-                       val = 8;
-               up->pcrlen = val;
-               up->pcflag |= UDPLITE_RECV_CC;
-               break;
-
-       default:
-               err = -ENOPROTOOPT;
-               break;
-       };
-
-       return err;
-}
-
 int udpv6_setsockopt(struct sock *sk, int level, int optname,
                     char __user *optval, int optlen)
 {
        if (level == SOL_UDP  ||  level == SOL_UDPLITE)
-               return do_udpv6_setsockopt(sk, level, optname, optval, optlen);
+               return udp_lib_setsockopt(sk, level, optname, optval, optlen,
+                                         udp_v6_push_pending_frames);
        return ipv6_setsockopt(sk, level, optname, optval, optlen);
 }
 
@@ -918,58 +873,17 @@ int compat_udpv6_setsockopt(struct sock *sk, int level, int optname,
                            char __user *optval, int optlen)
 {
        if (level == SOL_UDP  ||  level == SOL_UDPLITE)
-               return do_udpv6_setsockopt(sk, level, optname, optval, optlen);
+               return udp_lib_setsockopt(sk, level, optname, optval, optlen,
+                                         udp_v6_push_pending_frames);
        return compat_ipv6_setsockopt(sk, level, optname, optval, optlen);
 }
 #endif
 
-static int do_udpv6_getsockopt(struct sock *sk, int level, int optname,
-                         char __user *optval, int __user *optlen)
-{
-       struct udp_sock *up = udp_sk(sk);
-       int val, len;
-
-       if(get_user(len,optlen))
-               return -EFAULT;
-
-       len = min_t(unsigned int, len, sizeof(int));
-       
-       if(len < 0)
-               return -EINVAL;
-
-       switch(optname) {
-       case UDP_CORK:
-               val = up->corkflag;
-               break;
-
-       case UDP_ENCAP:
-               val = up->encap_type;
-               break;
-
-       case UDPLITE_SEND_CSCOV:
-               val = up->pcslen;
-               break;
-
-       case UDPLITE_RECV_CSCOV:
-               val = up->pcrlen;
-               break;
-
-       default:
-               return -ENOPROTOOPT;
-       };
-
-       if(put_user(len, optlen))
-               return -EFAULT;
-       if(copy_to_user(optval, &val,len))
-               return -EFAULT;
-       return 0;
-}
-
 int udpv6_getsockopt(struct sock *sk, int level, int optname,
                     char __user *optval, int __user *optlen)
 {
        if (level == SOL_UDP  ||  level == SOL_UDPLITE)
-               return do_udpv6_getsockopt(sk, level, optname, optval, optlen);
+               return udp_lib_getsockopt(sk, level, optname, optval, optlen);
        return ipv6_getsockopt(sk, level, optname, optval, optlen);
 }
 
@@ -978,7 +892,7 @@ int compat_udpv6_getsockopt(struct sock *sk, int level, int optname,
                            char __user *optval, int __user *optlen)
 {
        if (level == SOL_UDP  ||  level == SOL_UDPLITE)
-               return do_udpv6_getsockopt(sk, level, optname, optval, optlen);
+               return udp_lib_getsockopt(sk, level, optname, optval, optlen);
        return compat_ipv6_getsockopt(sk, level, optname, optval, optlen);
 }
 #endif
@@ -1011,7 +925,7 @@ static void udp6_sock_seq_show(struct seq_file *seq, struct sock *sp, int bucket
                   src->s6_addr32[2], src->s6_addr32[3], srcp,
                   dest->s6_addr32[0], dest->s6_addr32[1],
                   dest->s6_addr32[2], dest->s6_addr32[3], destp,
-                  sp->sk_state, 
+                  sp->sk_state,
                   atomic_read(&sp->sk_wmem_alloc),
                   atomic_read(&sp->sk_rmem_alloc),
                   0, 0L, 0,
@@ -1056,6 +970,8 @@ void udp6_proc_exit(void) {
 
 /* ------------------------------------------------------------------------ */
 
+DEFINE_PROTO_INUSE(udpv6)
+
 struct proto udpv6_prot = {
        .name              = "UDPv6",
        .owner             = THIS_MODULE,
@@ -1077,6 +993,7 @@ struct proto udpv6_prot = {
        .compat_setsockopt = compat_udpv6_setsockopt,
        .compat_getsockopt = compat_udpv6_getsockopt,
 #endif
+       REF_PROTO_INUSE(udpv6)
 };
 
 static struct inet_protosw udpv6_protosw = {