]> err.no Git - linux-2.6/blobdiff - net/sctp/ipv6.c
Merge refs/heads/ieee80211-wifi from master.kernel.org:/pub/scm/linux/kernel/git...
[linux-2.6] / net / sctp / ipv6.c
index c9d9ea064734ad58e18c14e03055816b0c219dd7..fa3be2b8fb5ffcaa88ac19e5919f7703461f90ef 100644 (file)
@@ -66,8 +66,8 @@
 #include <linux/seq_file.h>
 
 #include <net/protocol.h>
-#include <net/tcp.h>
 #include <net/ndisc.h>
+#include <net/ip.h>
 #include <net/ipv6.h>
 #include <net/transp_v6.h>
 #include <net/addrconf.h>
@@ -91,7 +91,6 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        struct ipv6hdr *iph = (struct ipv6hdr *)skb->data;
        struct sctphdr *sh = (struct sctphdr *)(skb->data + offset);
        struct sock *sk;
-       struct sctp_endpoint *ep;
        struct sctp_association *asoc;
        struct sctp_transport *transport;
        struct ipv6_pinfo *np;
@@ -105,7 +104,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        savesctp  = skb->h.raw;
        skb->nh.ipv6h = iph;
        skb->h.raw = (char *)sh;
-       sk = sctp_err_lookup(AF_INET6, skb, sh, &ep, &asoc, &transport);
+       sk = sctp_err_lookup(AF_INET6, skb, sh, &asoc, &transport);
        /* Put back, the original pointers. */
        skb->nh.raw = saveip;
        skb->h.raw = savesctp;
@@ -124,7 +123,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
                goto out_unlock;
        case ICMPV6_PARAMPROB:
                if (ICMPV6_UNK_NEXTHDR == code) {
-                       sctp_icmp_proto_unreachable(sk, ep, asoc, transport);
+                       sctp_icmp_proto_unreachable(sk, asoc, transport);
                        goto out_unlock;
                }
                break;
@@ -142,7 +141,7 @@ SCTP_STATIC void sctp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
        }
 
 out_unlock:
-       sctp_err_finish(sk, ep, asoc);
+       sctp_err_finish(sk, asoc);
 out:
        if (likely(idev != NULL))
                in6_dev_put(idev);
@@ -642,10 +641,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
        else
                newinet->pmtudisc = IP_PMTUDISC_WANT;
 
-#ifdef INET_REFCNT_DEBUG
-       atomic_inc(&inet6_sock_nr);
-       atomic_inc(&inet_sock_nr);
-#endif
+       sk_refcnt_debug_inc(newsk);
 
        if (newsk->sk_prot->init(newsk)) {
                sk_common_release(newsk);
@@ -812,26 +808,23 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr)
        if (addr->sa.sa_family != AF_INET6)
                af = sctp_get_af_specific(addr->sa.sa_family);
        else {
-               struct sock *sk;
                int type = ipv6_addr_type(&addr->v6.sin6_addr);
-               sk = sctp_opt2sk(opt);
+               struct net_device *dev;
+
                if (type & IPV6_ADDR_LINKLOCAL) {
-                       /* Note: Behavior similar to af_inet6.c:
-                        *  1) Overrides previous bound_dev_if
-                        *  2) Destructive even if bind isn't successful.
-                        */
-
-                       if (addr->v6.sin6_scope_id)
-                               sk->sk_bound_dev_if = addr->v6.sin6_scope_id;
-                       if (!sk->sk_bound_dev_if)
+                       if (!addr->v6.sin6_scope_id)
+                               return 0;
+                       dev = dev_get_by_index(addr->v6.sin6_scope_id);
+                       if (!dev)
                                return 0;
+                       dev_put(dev);
                }
                af = opt->pf->af;
        }
        return af->available(addr, opt);
 }
 
-/* Verify that the provided sockaddr looks bindable.   Common verification,
+/* Verify that the provided sockaddr looks sendable.   Common verification,
  * has already been taken care of.
  */
 static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr)
@@ -842,19 +835,16 @@ static int sctp_inet6_send_verify(struct sctp_sock *opt, union sctp_addr *addr)
        if (addr->sa.sa_family != AF_INET6)
                af = sctp_get_af_specific(addr->sa.sa_family);
        else {
-               struct sock *sk;
                int type = ipv6_addr_type(&addr->v6.sin6_addr);
-               sk = sctp_opt2sk(opt);
+               struct net_device *dev;
+
                if (type & IPV6_ADDR_LINKLOCAL) {
-                       /* Note: Behavior similar to af_inet6.c:
-                        *  1) Overrides previous bound_dev_if
-                        *  2) Destructive even if bind isn't successful.
-                        */
-
-                       if (addr->v6.sin6_scope_id)
-                               sk->sk_bound_dev_if = addr->v6.sin6_scope_id;
-                       if (!sk->sk_bound_dev_if)
+                       if (!addr->v6.sin6_scope_id)
+                               return 0;
+                       dev = dev_get_by_index(addr->v6.sin6_scope_id);
+                       if (!dev)
                                return 0;
+                       dev_put(dev);
                }
                af = opt->pf->af;
        }