]> err.no Git - linux-2.6/blobdiff - net/ipv6/raw.c
ipv4: replace dst_metric() with dst_mtu() in net/ipv4/route.c.
[linux-2.6] / net / ipv6 / raw.c
index 396f0ea11090a98d6a07898d0e79d58fb7652313..01d47674f7e5c802214565108e14a820ef7963fc 100644 (file)
@@ -7,8 +7,6 @@
  *
  *     Adapted from linux/net/ipv4/raw.c
  *
- *     $Id: raw.c,v 1.51 2002/02/01 22:01:04 davem Exp $
- *
  *     Fixes:
  *     Hideaki YOSHIFUJI       :       sin6_scope_id support
  *     YOSHIFUJI,H.@USAGI      :       raw checksum (RFC2292(bis) compliance)
@@ -609,7 +607,6 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
        struct ipv6_pinfo *np = inet6_sk(sk);
        struct ipv6hdr *iph;
        struct sk_buff *skb;
-       unsigned int hh_len;
        int err;
 
        if (length > rt->u.dst.dev->mtu) {
@@ -619,13 +616,12 @@ static int rawv6_send_hdrinc(struct sock *sk, void *from, int length,
        if (flags&MSG_PROBE)
                goto out;
 
-       hh_len = LL_RESERVED_SPACE(rt->u.dst.dev);
-
-       skb = sock_alloc_send_skb(sk, length+hh_len+15,
-                                 flags&MSG_DONTWAIT, &err);
+       skb = sock_alloc_send_skb(sk,
+                                 length + LL_ALLOCATED_SPACE(rt->u.dst.dev) + 15,
+                                 flags & MSG_DONTWAIT, &err);
        if (skb == NULL)
                goto error;
-       skb_reserve(skb, hh_len);
+       skb_reserve(skb, LL_RESERVED_SPACE(rt->u.dst.dev));
 
        skb->priority = sk->sk_priority;
        skb->mark = sk->sk_mark;
@@ -815,7 +811,7 @@ static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
                memset(opt, 0, sizeof(struct ipv6_txoptions));
                opt->tot_len = sizeof(struct ipv6_txoptions);
 
-               err = datagram_send_ctl(msg, &fl, opt, &hlimit, &tclass);
+               err = datagram_send_ctl(sock_net(sk), msg, &fl, opt, &hlimit, &tclass);
                if (err < 0) {
                        fl6_sock_release(flowlabel);
                        return err;
@@ -1161,11 +1157,20 @@ static int rawv6_ioctl(struct sock *sk, int cmd, unsigned long arg)
 static void rawv6_close(struct sock *sk, long timeout)
 {
        if (inet_sk(sk)->num == IPPROTO_RAW)
-               ip6_ra_control(sk, -1, NULL);
+               ip6_ra_control(sk, -1);
        ip6mr_sk_done(sk);
        sk_common_release(sk);
 }
 
+static void raw6_destroy(struct sock *sk)
+{
+       lock_sock(sk);
+       ip6_flush_pending_frames(sk);
+       release_sock(sk);
+
+       inet6_destroy_sock(sk);
+}
+
 static int rawv6_init_sk(struct sock *sk)
 {
        struct raw6_sock *rp = raw6_sk(sk);
@@ -1189,11 +1194,11 @@ struct proto rawv6_prot = {
        .name              = "RAWv6",
        .owner             = THIS_MODULE,
        .close             = rawv6_close,
+       .destroy           = raw6_destroy,
        .connect           = ip6_datagram_connect,
        .disconnect        = udp_disconnect,
        .ioctl             = rawv6_ioctl,
        .init              = rawv6_init_sk,
-       .destroy           = inet6_destroy_sock,
        .setsockopt        = rawv6_setsockopt,
        .getsockopt        = rawv6_getsockopt,
        .sendmsg           = rawv6_sendmsg,
@@ -1246,7 +1251,7 @@ static int raw6_seq_show(struct seq_file *seq, void *v)
                           "local_address                         "
                           "remote_address                        "
                           "st tx_queue rx_queue tr tm->when retrnsmt"
-                          "   uid  timeout inode  drops\n");
+                          "   uid  timeout inode ref pointer drops\n");
        else
                raw6_sock_seq_show(seq, v, raw_seq_private(seq)->bucket);
        return 0;