linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / net / pppoe.c
index ce1a9bf..e023b38 100644 (file)
@@ -85,7 +85,7 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb);
 static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb);
 
-static struct proto_ops pppoe_ops;
+static const struct proto_ops pppoe_ops;
 static DEFINE_RWLOCK(pppoe_hash_lock);
 
 static struct ppp_channel_ops pppoe_chan_ops;
@@ -377,13 +377,12 @@ abort_kfree:
  ***********************************************************************/
 static int pppoe_rcv(struct sk_buff *skb,
                     struct net_device *dev,
-                    struct packet_type *pt)
+                    struct packet_type *pt,
+                    struct net_device *orig_dev)
 
 {
        struct pppoe_hdr *ph;
        struct pppox_sock *po;
-       struct sock *sk;
-       int ret;
 
        if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
                goto drop;
@@ -394,24 +393,8 @@ static int pppoe_rcv(struct sk_buff *skb,
        ph = (struct pppoe_hdr *) skb->nh.raw;
 
        po = get_item((unsigned long) ph->sid, eth_hdr(skb)->h_source);
-       if (!po) 
-               goto drop;
-
-       sk = sk_pppox(po);
-       bh_lock_sock(sk);
-
-       /* Socket state is unknown, must put skb into backlog. */
-       if (sock_owned_by_user(sk) != 0) {
-               sk_add_backlog(sk, skb);
-               ret = NET_RX_SUCCESS;
-       } else {
-               ret = pppoe_rcv_core(sk, skb);
-       }
-
-       bh_unlock_sock(sk);
-       sock_put(sk);
-
-       return ret;
+       if (po != NULL) 
+               return sk_receive_skb(sk_pppox(po), skb);
 drop:
        kfree_skb(skb);
 out:
@@ -426,7 +409,8 @@ out:
  ***********************************************************************/
 static int pppoe_disc_rcv(struct sk_buff *skb,
                          struct net_device *dev,
-                         struct packet_type *pt)
+                         struct packet_type *pt,
+                         struct net_device *orig_dev)
 
 {
        struct pppoe_hdr *ph;
@@ -617,6 +601,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
                po->chan.hdrlen = (sizeof(struct pppoe_hdr) +
                                   dev->hard_header_len);
 
+               po->chan.mtu = dev->mtu - sizeof(struct pppoe_hdr);
                po->chan.private = sk;
                po->chan.ops = &pppoe_chan_ops;
 
@@ -1068,7 +1053,7 @@ static int __init pppoe_proc_init(void)
 {
        struct proc_dir_entry *p;
 
-       p = create_proc_entry("pppoe", S_IRUGO, proc_net);
+       p = create_proc_entry("net/pppoe", S_IRUGO, NULL);
        if (!p)
                return -ENOMEM;
 
@@ -1079,9 +1064,7 @@ static int __init pppoe_proc_init(void)
 static inline int pppoe_proc_init(void) { return 0; }
 #endif /* CONFIG_PROC_FS */
 
-/* ->ioctl are set at pppox_create */
-
-static struct proto_ops pppoe_ops = {
+static const struct proto_ops pppoe_ops = {
     .family            = AF_PPPOX,
     .owner             = THIS_MODULE,
     .release           = pppoe_release,
@@ -1097,7 +1080,8 @@ static struct proto_ops pppoe_ops = {
     .getsockopt                = sock_no_getsockopt,
     .sendmsg           = pppoe_sendmsg,
     .recvmsg           = pppoe_recvmsg,
-    .mmap              = sock_no_mmap
+    .mmap              = sock_no_mmap,
+    .ioctl             = pppox_ioctl,
 };
 
 static struct pppox_proto pppoe_proto = {
@@ -1140,7 +1124,7 @@ static void __exit pppoe_exit(void)
        dev_remove_pack(&pppoes_ptype);
        dev_remove_pack(&pppoed_ptype);
        unregister_netdevice_notifier(&pppoe_notifier);
-       remove_proc_entry("pppoe", proc_net);
+       remove_proc_entry("net/pppoe", NULL);
        proto_unregister(&pppoe_sk_proto);
 }