Revision: 505
          http://vde.svn.sourceforge.net/vde/?rev=505&view=rev
Author:   rd235
Date:     2011-06-28 17:27:47 +0000 (Tue, 28 Jun 2011)

Log Message:
-----------
IPN: support for 2.6.39

Modified Paths:
--------------
    trunk/ipn/af_ipn.c
    trunk/ipn/ipn_netdev.c

Modified: trunk/ipn/af_ipn.c
===================================================================
--- trunk/ipn/af_ipn.c  2011-06-28 16:19:40 UTC (rev 504)
+++ trunk/ipn/af_ipn.c  2011-06-28 17:27:47 UTC (rev 505)
@@ -53,6 +53,9 @@
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
 #define IPN_PRE2637
 #endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
+#define IPN_PRE2639
+#endif
 
 /*extension of RCV_SHUTDOWN defined in include/net/sock.h
  * when the bit is set recv fails */
@@ -600,11 +603,19 @@
        }
 
        /* check if there is already an ipn-network socket with that name */
+#ifndef IPN_PRE2630
+       err = kern_path(sunaddr->sun_path, LOOKUP_FOLLOW, &nd.path);
+#else
        err = path_lookup(sunaddr->sun_path, LOOKUP_FOLLOW, &nd);
+#endif
        if (err) { /* it does not exist, NEW IPN socket! */
                unsigned int mode;
                /* Is it everything okay with the parent? */
+#ifndef IPN_PRE2639
+               err = kern_path_parent(sunaddr->sun_path, &nd);
+#else
                err = path_lookup(sunaddr->sun_path, LOOKUP_PARENT, &nd);
+#endif
                if (err)
                        goto out_mknod_parent;
                /* Do I have the permission to create a file? */
@@ -742,7 +753,13 @@
                int addr_len, int flags){
        struct sockaddr_un *sunaddr=(struct sockaddr_un*)addr;
        struct ipn_node *ipn_node=((struct ipn_sock *)sock->sk)->node;
+#ifndef IPN_PRE2639
+       struct path ndpath;
+#else
        struct nameidata nd;
+#define ndpath nd.path
+#endif
+
        struct ipn_network *ipnn,*previousipnn;
        int err=0;
        int portno;
@@ -760,17 +777,21 @@
                if (err < 0)
                        goto out;
                addr_len=err;
+#ifndef IPN_PRE2639
+               err = kern_path(sunaddr->sun_path, LOOKUP_FOLLOW, &ndpath);
+#else
                err = path_lookup(sunaddr->sun_path, LOOKUP_FOLLOW, &nd);
+#endif
                if (err)
                        goto out;
-               err = inode_permission(nd.path.dentry->d_inode, MAY_READ);
+               err = inode_permission(ndpath.dentry->d_inode, MAY_READ);
                if (err) {
                        if (err == -EACCES || err == -EROFS)
                                mustshutdown|=RCV_SHUTDOWN;
                        else
                                goto put_fail;
                }
-               err = inode_permission(nd.path.dentry->d_inode, MAY_WRITE);
+               err = inode_permission(ndpath.dentry->d_inode, MAY_WRITE);
                if (err) {
                        if (err == -EACCES)
                                mustshutdown|=SEND_SHUTDOWN;
@@ -787,11 +808,11 @@
                        err=0;
                        ipn_node->shutdown=mustshutdown;
                }
-               if (!S_ISSOCK(nd.path.dentry->d_inode->i_mode)) {
+               if (!S_ISSOCK(ndpath.dentry->d_inode->i_mode)) {
                        err = -ECONNREFUSED;
                        goto put_fail;
                }
-               ipnn=ipn_find_network_byinode(nd.path.dentry->d_inode);
+               ipnn=ipn_find_network_byinode(ndpath.dentry->d_inode);
                if (!ipnn || (ipnn->flags & IPN_FLAG_TERMINATED)) {
                        err = -ECONNREFUSED;
                        goto put_fail;
@@ -802,7 +823,7 @@
                        err = -EPROTO;
                        goto put_fail;
                }
-               path_put(&nd.path);
+               path_put(&ndpath);
                ipn_node->ipn=ipnn;
        } else
                ipnn=ipn_node->ipn;
@@ -833,7 +854,7 @@
        return err;
 
 put_fail:
-       path_put(&nd.path);
+       path_put(&ndpath);
 out:
        up(&ipn_glob_mutex);
        return err;

Modified: trunk/ipn/ipn_netdev.c
===================================================================
--- trunk/ipn/ipn_netdev.c      2011-06-28 16:19:40 UTC (rev 504)
+++ trunk/ipn/ipn_netdev.c      2011-06-28 17:27:47 UTC (rev 505)
@@ -36,12 +36,18 @@
 #define DRV_NAME  "ipn"
 #define DRV_VERSION "0.3.1"
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
+#define IPN_PRE2624
+#endif
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,29)
 #define IPN_PRE2629
 #endif
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)
 #define IPN_PRE2637
 #endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39)
+#define IPN_PRE2639
+#endif
 
 static const struct ethtool_ops ipn_ethtool_ops;
 
@@ -100,9 +106,16 @@
 /* receive from a GRAB via interface hook */
 struct sk_buff *ipn_handle_hook(struct ipn_node *ipn_node, struct sk_buff *skb)
 #else
+#ifdef IPN_PRE2639
 static struct sk_buff *ipn_handle_frame(struct sk_buff *skb)
+#else
+static rx_handler_result_t ipn_handle_frame(struct sk_buff **pskb)
 #endif
+#endif
 {
+#ifndef IPN_PRE2639
+       struct sk_buff *skb = *pskb;
+#endif
        char *data=(skb->data)-(skb->mac_len);
        int len=skb->len+skb->mac_len;
 #ifndef IPN_PRE2637
@@ -122,7 +135,11 @@
                }
        }
 
+#ifdef IPN_PRE2639
        return (skb);
+#else
+       return RX_HANDLER_PASS;
+#endif
 }
 
 #ifndef IPN_PRE2629
@@ -180,7 +197,11 @@
                        }
 #endif
 #endif
+#ifdef IPN_PRE2624
+                       dev=dev_get_by_name(name);
+#else
                        dev=dev_get_by_name(net,name);
+#endif
                        if (dev) {
                                if (dev->flags & IFF_LOOPBACK)
                                        *err= -EINVAL;


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
vde-users mailing list
vde-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/vde-users

Reply via email to