From 7da5ab62165f59dae168c38526974bd5cfe522e2 Mon Sep 17 00:00:00 2001 From: rd235 Date: Thu, 2 Jul 2009 14:04:43 +0000 Subject: [PATCH] chrdev persistence + ioctl renumbering (following the IOR/IOW scheme) git-svn-id: https://vde.svn.sourceforge.net/svnroot/vde/trunk@373 d37a7db1-d92d-0410-89df-f68f52f87b57 --- ipn/af_ipn.c | 66 ++++++++++++++++++++++++++++++++++++++++++++----------- ipn/af_ipn.h | 36 ++++++++++++++++++++---------- ipn/ipn_chrdev.c | 34 ++++++++++++++++++++++++++++ ipn/ipn_chrdev.h | 8 +++++++ ipn/test/README | 5 +++++ ipn/test/test0.c | 24 +------------------- ipn/test/test0n.c | 24 +------------------- ipn/test/test0x.c | 23 +------------------ ipn/test/test1.c | 9 +------- ipn/test/test1x.c | 9 +------- ipn/test/test2.c | 34 +--------------------------- ipn/test/test3.c | 34 +--------------------------- ipn/test/test4.c | 34 +--------------------------- ipn/test/test4x.c | 34 +--------------------------- 14 files changed, 133 insertions(+), 241 deletions(-) create mode 100644 ipn/test/README diff --git a/ipn/af_ipn.c b/ipn/af_ipn.c index 7587950..21595cf 100644 --- a/ipn/af_ipn.c +++ b/ipn/af_ipn.c @@ -117,12 +117,26 @@ static struct ipn_network *ipn_find_network_byinode(struct inode *i) &ipn_network_table[i->i_ino & (IPN_HASH_SIZE - 1)], hnode) { struct dentry *dentry = ipnn->dentry; - if(ipnn->refcnt > 0 && dentry && dentry->d_inode == i) - goto found; + if(dentry && dentry->d_inode == i) + return ipnn; } - ipnn = NULL; -found: - return ipnn; + return NULL; +} + +struct ipn_network *ipn_find_network_byfun( + int (*fun)(struct ipn_network *,void *),void *funarg) +{ + struct ipn_network *ipnn; + struct hlist_node *node; + int ipn_table_scan; + + for (ipn_table_scan=0;ipn_table_scanrefcnt--; - if (ipnn->refcnt == 0) + if (ipnn->refcnt == 0 && !ipn_is_persistent_chrdev(ipnn)) { if (ipnn->chrdev) ipn_deregister_chrdev(ipnn); @@ -527,6 +541,19 @@ static int ipn_mkname(struct sockaddr_un * sunaddr, int len) return len; } +static int ipn_node_bind(struct ipn_node *ipn_node, struct ipn_network *ipnn) +{ + if (ipnn == NULL) + return -ENOENT; + if (ipn_node->ipn != NULL) + return -EISCONN; + ipnn->refcnt++; + list_add_tail(&ipn_node->nodelist,&ipnn->unconnectqueue); + ipn_node->ipn=ipnn; + ipn_node->flags |= IPN_NODEFLAG_BOUND; + return 0; +} + /* IPN BIND */ static int ipn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) { @@ -644,7 +671,7 @@ static int ipn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) } INIT_LIST_HEAD(&ipnn->unconnectqueue); INIT_LIST_HEAD(&ipnn->connectqueue); - ipnn->refcnt=1; + ipnn->refcnt=0; #ifndef IPN_PRE2625 ipnn->dentry=nd.path.dentry; ipnn->mnt=nd.path.mnt; @@ -695,15 +722,12 @@ static int ipn_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) if (!ipnn || (ipnn->flags & IPN_FLAG_TERMINATED) || (ipnn->flags & IPN_FLAG_EXCL)) goto put_fail; - list_add_tail(&ipn_node->nodelist,&ipnn->unconnectqueue); - ipnn->refcnt++; } if (ipn_node->pbp) { kfree(ipn_node->pbp); ipn_node->pbp=NULL; } - ipn_node->ipn=ipnn; - ipn_node->flags |= IPN_NODEFLAG_BOUND; + ipn_node_bind(ipn_node,ipnn); up(&ipn_glob_mutex); return 0; @@ -831,10 +855,10 @@ static int ipn_connect(struct socket *sock, struct sockaddr *addr, sock->state = SS_CONNECTED; ipn_node->portno=portno; ipnn->connport[portno]=ipn_node; - if (!(ipn_node->flags & IPN_NODEFLAG_BOUND)) { + if (!(ipn_node->flags & IPN_NODEFLAG_BOUND)) ipnn->refcnt++; + else list_del(&ipn_node->nodelist); - } list_add_tail(&ipn_node->nodelist,&ipnn->connectqueue); ipn_net_update_counters(ipnn, (ipn_node->shutdown & RCV_SHUTDOWN)?0:1, @@ -1165,6 +1189,7 @@ static int ipn_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { ifr.ifr_name[IFNAMSIZ-1] = '\0'; break; case IPN_REGISTER_CHRDEV: + case IPN_JOIN_CHRDEV: if (copy_from_user(&devr, argp, sizeof(devr))) return -EFAULT; /*printk("IPN_REGISTER_CHRDEV %p %d %d %d\n", @@ -1178,6 +1203,19 @@ static int ipn_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { return ipn_setpersist_netdev(&ifr,1); case IPN_CLRPERSIST_NETDEV: return ipn_setpersist_netdev(&ifr,0); + case IPN_JOIN_CHRDEV: + { + int rv; + if (!capable(CAP_MKNOD)) + return -EPERM; + if (ipn_node->ipn != NULL) + return -EISCONN; + if (down_interruptible(&ipn_glob_mutex)) + return -ERESTARTSYS; + rv=ipn_node_bind(ipn_node, ipn_find_chrdev(&devr)); + up(&ipn_glob_mutex); + return rv; + } case SIOCSIFHWADDR: if (capable(CAP_NET_ADMIN)) return -EPERM; @@ -1196,6 +1234,8 @@ static int ipn_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { return ipn_join_netdev(sock,&ifr); case IPN_SETPERSIST: return ipn_setpersist(ipn_node,arg); + case IPN_CHRDEV_PERSIST: + return ipn_chrdev_persistence(ipnn,arg); case IPN_REGISTER_CHRDEV: { int rv; diff --git a/ipn/af_ipn.h b/ipn/af_ipn.h index cde82fa..ba40270 100644 --- a/ipn/af_ipn.h +++ b/ipn/af_ipn.h @@ -45,18 +45,6 @@ #define IPN_FLAG_FLEXMTU 4 #define IPN_FLAG_TERMINATED 0x1000 -/* Ioctl defines */ -#define IPN_CHECK _IOW('I', 199, int) -#define IPN_SETPERSIST_NETDEV _IOW('I', 200, int) -#define IPN_CLRPERSIST_NETDEV _IOW('I', 201, int) -#define IPN_CONN_NETDEV _IOW('I', 202, int) -#define IPN_JOIN_NETDEV _IOW('I', 203, int) -#define IPN_SETPERSIST _IOW('I', 204, int) -#define IPN_REGISTER_CHRDEV _IOW('I', 301, int) -#define IPN_UNREGISTER_CHRDEV _IOW('I', 302, int) - -#define IPN_OOB_NUMNODE_TAG 0 - /* ioctl request for IPN_REGISTER_CHRDEV * @dev: first device (if major==0 alloc a dynamic major) * @count: num of minors @@ -69,6 +57,21 @@ struct chrdevreq { char name[64]; }; +/* Ioctl defines */ + +#define IPN_CHECK _IO('I', 199) +#define IPN_SETPERSIST_NETDEV _IOR('I', 200, struct ifreq) +#define IPN_CLRPERSIST_NETDEV _IOR('I', 201, struct ifreq) +#define IPN_CONN_NETDEV _IOR('I', 202, struct ifreq) +#define IPN_JOIN_NETDEV _IOR('I', 203, struct ifreq) +#define IPN_SETPERSIST _IOR('I', 204, struct ifreq) +#define IPN_REGISTER_CHRDEV _IOWR('I', 301, struct chrdevreq) +#define IPN_UNREGISTER_CHRDEV _IOR('I', 302, struct chrdevreq) +#define IPN_JOIN_CHRDEV _IOR('I', 303, struct chrdevreq) +#define IPN_CHRDEV_PERSIST _IOR('I', 304, int) + +#define IPN_OOB_NUMNODE_TAG 0 + /* OOB message for change of numnodes * Common fields for oob IPN signaling: * @level=level of the service who generated the oob @@ -84,6 +87,10 @@ struct numnode_oob { int numwriters; }; +/* these flags are used in IPN_CONN_NETDEV*/ +#define IPN_NODEFLAG_TAP 0x10 /* This is a tap interface */ +#define IPN_NODEFLAG_GRAB 0x20 /* This is a grab of a real interface */ + #ifdef __KERNEL__ #include #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) @@ -148,8 +155,11 @@ struct ipn_node { #define IPN_NODEFLAG_BOUND 0x1 /* bind succeeded */ #define IPN_NODEFLAG_INUSE 0x2 /* is currently "used" (0 for persistent, unbound interfaces) */ #define IPN_NODEFLAG_PERSIST 0x4 /* if persist does not disappear on close (net interfaces) */ +#if 0 +/* these flags are used in IPN_CONN_NETDEV*/ #define IPN_NODEFLAG_TAP 0x10 /* This is a tap interface */ #define IPN_NODEFLAG_GRAB 0x20 /* This is a grab of a real interface */ +#endif #define IPN_NODEFLAG_DEVMASK 0x30 /* True if this is a device */ #define IPN_NODEFLAG_OOB_NUMNODES 0x40 /* Node wants OOB for NNODES */ @@ -282,6 +292,8 @@ unsigned int ipn_node_poll(struct ipn_node *ipn_node, struct file *file, poll_ta int ipn_node_ioctl(struct ipn_node *ipn_node, unsigned int cmd, unsigned long arg); int ipn_node_write(struct ipn_node *ipn_node, struct iovec *msg_iov, int len); int ipn_node_read(struct ipn_node *ipn_node, struct iovec *msg_iov, size_t len, int *msg_flags, int flags); +struct ipn_network *ipn_find_network_byfun( + int (*fun)(struct ipn_network *,void *),void *funarg); #ifndef IPN_STEALING extern struct sk_buff *(*ipn_handle_frame_hook)(struct ipn_node *p, diff --git a/ipn/ipn_chrdev.c b/ipn/ipn_chrdev.c index 19fd32f..f86db38 100644 --- a/ipn/ipn_chrdev.c +++ b/ipn/ipn_chrdev.c @@ -32,6 +32,7 @@ #include "ipn_chrdev.h" #include "ipn_msgbuf.h" +#define IPN_CHRDEV_PERSISTENT 1 /* struct ipn_chrdev: * this is the type of the ipnn->chrdev field, when ipnn->chrdev is non-null, * a character device (or a range of character devices) gives access to the ipn-network. @@ -165,6 +166,23 @@ static struct class *sysfs_register(struct chrdevreq *devr) return devclass; } +static int chrdev_match(struct ipn_network *ipnn,void *arg) +{ + struct chrdevreq *devr=arg; + if (ipnn->chrdev != NULL && + MAJOR(ipnn->chrdev->dev) == devr->major && + devr->minor >= MINOR(ipnn->chrdev->dev) && + devr->minor < MINOR(ipnn->chrdev->dev) + ipnn->chrdev->dev_count) + return 1; + else + return 0; +} + +struct ipn_network *ipn_find_chrdev(struct chrdevreq *devr) +{ + return ipn_find_network_byfun(chrdev_match,devr); +} + /* register/allocate a chrdev range for this ipn network. * ipnn is locked during this op */ int ipn_register_chrdev(struct ipn_network *ipnn, struct chrdevreq *devr) { @@ -221,3 +239,19 @@ int ipn_deregister_chrdev(struct ipn_network *ipnn) { return 0; } +int ipn_chrdev_persistence(struct ipn_network *ipnn, int persistent) { + if (ipnn==NULL || ipnn->chrdev==NULL) + return EINVAL; + if (persistent) + ipnn->chrdev->flags |= IPN_CHRDEV_PERSISTENT; + else + ipnn->chrdev->flags &= ~IPN_CHRDEV_PERSISTENT; + return 0; +} + +int ipn_is_persistent_chrdev(struct ipn_network *ipnn) { + if (ipnn==NULL || ipnn->chrdev==NULL) + return 0; + return (ipnn->chrdev->flags & IPN_CHRDEV_PERSISTENT)?1:0; +} + diff --git a/ipn/ipn_chrdev.h b/ipn/ipn_chrdev.h index c924177..1f2e181 100644 --- a/ipn/ipn_chrdev.h +++ b/ipn/ipn_chrdev.h @@ -21,7 +21,15 @@ */ #include "af_ipn.h" +/* register a chr device range for this ipn network */ int ipn_register_chrdev(struct ipn_network *ipnn, struct chrdevreq *devr); +/* unregister the chr device of this ipn network */ int ipn_deregister_chrdev(struct ipn_network *ipnn); +/* set/unset persistence */ +int ipn_chrdev_persistence(struct ipn_network *ipnn, int persistent); +/* test persistence */ +int ipn_is_persistent_chrdev(struct ipn_network *ipnn); +/* search which ipn network registered a chr device */ +struct ipn_network *ipn_find_chrdev(struct chrdevreq *devr); #endif diff --git a/ipn/test/README b/ipn/test/README new file mode 100644 index 0000000..acb6cfb --- /dev/null +++ b/ipn/test/README @@ -0,0 +1,5 @@ + +compile these tests in this way: + +cc -I.. -o test test.c + diff --git a/ipn/test/test0.c b/ipn/test/test0.c index e01f490..9e0b16b 100644 --- a/ipn/test/test0.c +++ b/ipn/test/test0.c @@ -3,29 +3,7 @@ #include #include #include - -#define AF_IPN AF_NETBEUI -#define PF_IPN AF_IPN -#define IPN_ANY 0 -#define IPN_BROADCAST 1 -#define IPN_HUB 1 -#define IPN_VDESWITCH 2 -#define IPN_VDESWITCH_L3 3 - -#define IPN_SO_PREBIND 0x80 -#define IPN_SO_PORT 0 -#define IPN_SO_DESCR 1 -#define IPN_SO_MTU (IPN_SO_PREBIND | 0) -#define IPN_SO_NUMNODES (IPN_SO_PREBIND | 1) -#define IPN_SO_MSGPOOLSIZE (IPN_SO_PREBIND | 2) -#define IPN_SO_FLAGS (IPN_SO_PREBIND | 3) -#define IPN_SO_MODE (IPN_SO_PREBIND | 4) - -#define IPN_PORTNO_ANY -1 - -#define IPN_DESCRLEN 32 - -#define IPN_FLAG_LOSSLESS 1 +#include char buf[256]; struct sockaddr_un sun={.sun_family=AF_IPN,.sun_path="/tmp/sockipn"}; diff --git a/ipn/test/test0n.c b/ipn/test/test0n.c index 48ed3ef..b447743 100644 --- a/ipn/test/test0n.c +++ b/ipn/test/test0n.c @@ -3,29 +3,7 @@ #include #include #include - -#define AF_IPN AF_NETBEUI -#define PF_IPN AF_IPN -#define IPN_ANY 0 -#define IPN_BROADCAST 1 -#define IPN_HUB 1 -#define IPN_VDESWITCH 2 -#define IPN_VDESWITCH_L3 3 - -#define IPN_SO_PREBIND 0x80 -#define IPN_SO_PORT 0 -#define IPN_SO_DESCR 1 -#define IPN_SO_MTU (IPN_SO_PREBIND | 0) -#define IPN_SO_NUMNODES (IPN_SO_PREBIND | 1) -#define IPN_SO_MSGPOOLSIZE (IPN_SO_PREBIND | 2) -#define IPN_SO_FLAGS (IPN_SO_PREBIND | 3) -#define IPN_SO_MODE (IPN_SO_PREBIND | 4) - -#define IPN_PORTNO_ANY -1 - -#define IPN_DESCRLEN 32 - -#define IPN_FLAG_LOSSLESS 1 +#include char buf[256]; struct sockaddr_un sun={.sun_family=AF_IPN,.sun_path="/tmp/sockipn"}; diff --git a/ipn/test/test0x.c b/ipn/test/test0x.c index 4510908..6494dea 100644 --- a/ipn/test/test0x.c +++ b/ipn/test/test0x.c @@ -3,28 +3,7 @@ #include #include #include - -#define AF_IPN AF_NETBEUI -#define PF_IPN AF_IPN -#define IPN_ANY 0 -#define IPN_BROADCAST 1 -#define IPN_HUB 1 -#define IPN_VDESWITCH 2 -#define IPN_VDESWITCH_L3 3 - -#define IPN_SO_PREBIND 0x80 -#define IPN_SO_PORT 0 -#define IPN_SO_DESCR 1 -#define IPN_SO_MTU (IPN_SO_PREBIND | 0) -#define IPN_SO_NUMNODES (IPN_SO_PREBIND | 1) -#define IPN_SO_MSGPOOLSIZE (IPN_SO_PREBIND | 2) -#define IPN_SO_FLAGS (IPN_SO_PREBIND | 3) - -#define IPN_PORTNO_ANY -1 - -#define IPN_DESCRLEN 32 - -#define IPN_FLAG_LOSSLESS 1 +#include #define LIMIT 10000 char buf[256]; diff --git a/ipn/test/test1.c b/ipn/test/test1.c index f478be6..e42a9d3 100644 --- a/ipn/test/test1.c +++ b/ipn/test/test1.c @@ -3,14 +3,7 @@ #include #include #include - -#define AF_IPN AF_NETBEUI -#define PF_IPN AF_IPN -#define IPN_ANY 0 -#define IPN_BROADCAST 1 -#define IPN_HUB 1 -#define IPN_VDESWITCH 2 -#define IPN_VDESWITCH_L3 3 +#include char buf[256]; struct sockaddr_un sun={.sun_family=AF_IPN,.sun_path="/tmp/sockipn"}; diff --git a/ipn/test/test1x.c b/ipn/test/test1x.c index 2c2c8a6..348f20f 100644 --- a/ipn/test/test1x.c +++ b/ipn/test/test1x.c @@ -3,14 +3,7 @@ #include #include #include - -#define AF_IPN AF_NETBEUI -#define PF_IPN AF_IPN -#define IPN_ANY 0 -#define IPN_BROADCAST 1 -#define IPN_HUB 1 -#define IPN_VDESWITCH 2 -#define IPN_VDESWITCH_L3 3 +#include unsigned char buf[256]; struct sockaddr_un sun={.sun_family=AF_IPN,.sun_path="/tmp/sockipn"}; diff --git a/ipn/test/test2.c b/ipn/test/test2.c index 741dba6..bc55182 100644 --- a/ipn/test/test2.c +++ b/ipn/test/test2.c @@ -6,39 +6,7 @@ #include #include #include - -#define AF_IPN AF_NETBEUI -#define PF_IPN AF_IPN -#define IPN_ANY 0 -#define IPN_BROADCAST 1 -#define IPN_HUB 1 -#define IPN_VDESWITCH 2 -#define IPN_VDESWITCH_L3 3 - -#define IPN_SO_PREBIND 0x80 -#define IPN_SO_PORT 0 -#define IPN_SO_DESCR 1 -#define IPN_SO_MTU (IPN_SO_PREBIND | 0) -#define IPN_SO_NUMNODES (IPN_SO_PREBIND | 1) -#define IPN_SO_MSGPOOLSIZE (IPN_SO_PREBIND | 2) -#define IPN_SO_FLAGS (IPN_SO_PREBIND | 3) -#define IPN_SO_MODE (IPN_SO_PREBIND | 4) - -/* Ioctl defines */ -#define IPN_SETPERSIST_NETDEV _IOW('I', 200, int) -#define IPN_CLRPERSIST_NETDEV _IOW('I', 201, int) -#define IPN_CONN_NETDEV _IOW('I', 202, int) -#define IPN_JOIN_NETDEV _IOW('I', 203, int) -#define IPN_SETPERSIST _IOW('I', 204, int) - -#define IPN_NODEFLAG_TAP 0x10 /* This is a tap interface */ -#define IPN_NODEFLAG_GRAB 0x20 /* This is a grab of a real interface */ - -#define IPN_PORTNO_ANY -1 - -#define IPN_DESCRLEN 32 - -#define IPN_FLAG_LOSSLESS 1 +#include char buf[256]; struct sockaddr_un sun={.sun_family=AF_IPN,.sun_path="/tmp/sockipn"}; diff --git a/ipn/test/test3.c b/ipn/test/test3.c index fdfdcd7..8efd274 100644 --- a/ipn/test/test3.c +++ b/ipn/test/test3.c @@ -6,39 +6,7 @@ #include #include #include - -#define AF_IPN AF_NETBEUI -#define PF_IPN AF_IPN -#define IPN_ANY 0 -#define IPN_BROADCAST 1 -#define IPN_HUB 1 -#define IPN_VDESWITCH 2 -#define IPN_VDESWITCH_L3 3 - -#define IPN_SO_PREBIND 0x80 -#define IPN_SO_PORT 0 -#define IPN_SO_DESCR 1 -#define IPN_SO_MTU (IPN_SO_PREBIND | 0) -#define IPN_SO_NUMNODES (IPN_SO_PREBIND | 1) -#define IPN_SO_MSGPOOLSIZE (IPN_SO_PREBIND | 2) -#define IPN_SO_FLAGS (IPN_SO_PREBIND | 3) -#define IPN_SO_MODE (IPN_SO_PREBIND | 4) - -/* Ioctl defines */ -#define IPN_SETPERSIST_NETDEV _IOW('I', 200, int) -#define IPN_CLRPERSIST_NETDEV _IOW('I', 201, int) -#define IPN_CONN_NETDEV _IOW('I', 202, int) -#define IPN_JOIN_NETDEV _IOW('I', 203, int) -#define IPN_SETPERSIST _IOW('I', 204, int) - -#define IPN_NODEFLAG_TAP 0x10 /* This is a tap interface */ -#define IPN_NODEFLAG_GRAB 0x20 /* This is a grab of a real interface */ - -#define IPN_PORTNO_ANY -1 - -#define IPN_DESCRLEN 32 - -#define IPN_FLAG_LOSSLESS 1 +#include char buf[256]; struct sockaddr_un sun={.sun_family=AF_IPN,.sun_path="/tmp/sockipn"}; diff --git a/ipn/test/test4.c b/ipn/test/test4.c index 8b88a9d..762aa95 100644 --- a/ipn/test/test4.c +++ b/ipn/test/test4.c @@ -6,39 +6,7 @@ #include #include #include - -#define AF_IPN AF_NETBEUI -#define PF_IPN AF_IPN -#define IPN_ANY 0 -#define IPN_BROADCAST 1 -#define IPN_HUB 1 -#define IPN_VDESWITCH 2 -#define IPN_VDESWITCH_L3 3 - -#define IPN_SO_PREBIND 0x80 -#define IPN_SO_PORT 0 -#define IPN_SO_DESCR 1 -#define IPN_SO_MTU (IPN_SO_PREBIND | 0) -#define IPN_SO_NUMNODES (IPN_SO_PREBIND | 1) -#define IPN_SO_MSGPOOLSIZE (IPN_SO_PREBIND | 2) -#define IPN_SO_FLAGS (IPN_SO_PREBIND | 3) -#define IPN_SO_MODE (IPN_SO_PREBIND | 4) - -/* Ioctl defines */ -#define IPN_SETPERSIST_NETDEV _IOW('I', 200, int) -#define IPN_CLRPERSIST_NETDEV _IOW('I', 201, int) -#define IPN_CONN_NETDEV _IOW('I', 202, int) -#define IPN_JOIN_NETDEV _IOW('I', 203, int) -#define IPN_SETPERSIST _IOW('I', 204, int) - -#define IPN_NODEFLAG_TAP 0x10 /* This is a tap interface */ -#define IPN_NODEFLAG_GRAB 0x20 /* This is a grab of a real interface */ - -#define IPN_PORTNO_ANY -1 - -#define IPN_DESCRLEN 32 - -#define IPN_FLAG_LOSSLESS 1 +#include /*#define IPNTYPE IPN_BROADCAST*/ #define IPNTYPE IPN_VDESWITCH diff --git a/ipn/test/test4x.c b/ipn/test/test4x.c index fe4c13d..eb75c41 100644 --- a/ipn/test/test4x.c +++ b/ipn/test/test4x.c @@ -6,39 +6,7 @@ #include #include #include - -#define AF_IPN AF_NETBEUI -#define PF_IPN AF_IPN -#define IPN_ANY 0 -#define IPN_BROADCAST 1 -#define IPN_HUB 1 -#define IPN_VDESWITCH 2 -#define IPN_VDESWITCH_L3 3 - -#define IPN_SO_PREBIND 0x80 -#define IPN_SO_PORT 0 -#define IPN_SO_DESCR 1 -#define IPN_SO_MTU (IPN_SO_PREBIND | 0) -#define IPN_SO_NUMNODES (IPN_SO_PREBIND | 1) -#define IPN_SO_MSGPOOLSIZE (IPN_SO_PREBIND | 2) -#define IPN_SO_FLAGS (IPN_SO_PREBIND | 3) -#define IPN_SO_MODE (IPN_SO_PREBIND | 4) - -/* Ioctl defines */ -#define IPN_SETPERSIST_NETDEV _IOW('I', 200, int) -#define IPN_CLRPERSIST_NETDEV _IOW('I', 201, int) -#define IPN_CONN_NETDEV _IOW('I', 202, int) -#define IPN_JOIN_NETDEV _IOW('I', 203, int) -#define IPN_SETPERSIST _IOW('I', 204, int) - -#define IPN_NODEFLAG_TAP 0x10 /* This is a tap interface */ -#define IPN_NODEFLAG_GRAB 0x20 /* This is a grab of a real interface */ - -#define IPN_PORTNO_ANY -1 - -#define IPN_DESCRLEN 32 - -#define IPN_FLAG_LOSSLESS 1 +#include /*#define IPNTYPE IPN_BROADCAST*/ #define IPNTYPE IPN_VDESWITCH -- 2.11.4.GIT