Re: driver for pptp
Thanks for critique. >Please read Documentation/SubmittingPatches (and CodingStyle) and submit your >kernel patch to netdev. OK. >1) why wasn't it possible to use the PPPoX infrastructure of the kernel which >is already being used by PPPoE ? Or at least model it somehow similar to the >existing PPPoE/PPPoX infrastructure? I agree, I will rebuild module. >2) why are you using a timer for asynchronous processing of GRE frames? First of all, why does it have to happen asynchronously at all? Secondly, why using a timer when there's nothing time related (or do I miss something)? If deferred, out-of-context execution is required, there are other primitives such as tasklets. Because it is the mechanism of processing reordered packets. On timeout (i.e. there was a loss of packets) buffered packets continue to be processed. It for reduction of traffic if client is under firewall which may reorder packets. >3) you conflict with the ip_gre.c genric GRE encapsulation driver. this is because both want to reigster a proto handler for GRE. Ideally, there needs to be another demultiplex between the GRE protocl and its users. The code registered for GRE would look at the packet and determine whether e.g. it is a PPTP GRE packet and then pass it on to the pptp module. I contacted to the developer ip_gre.c and it has told too most but while there are no results. 4) your code doesn't look nonlinear skb clean Please give me more comments. 5) why did you chose to implement /dev/pptp rather than a socket family like the existing pppox/pppoe code? I agree, I will rebuild module. - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] driver for PPTP, second edition
Hello. I have developed the driver for Point-to-Point Tunneling Protocol (PPTP). This driver works in pair with plugin for pppd. It is enough to use pppd's plugin for start of the client. Also there is a server (based on pptpd) which uses this driver. By results of my testing the speed of transfer has increased on >50% and cpu usage has decreased on >50% in comparison with original pptpd and pptpclient. I have published the project on http://accel-pptp.sourceforge.net/ diff -uprN linux-2.6.16.orig/drivers/net/Kconfig linux-2.6.16.pptp/drivers/net/Kconfig --- linux-2.6.16.orig/drivers/net/Kconfig 2006-06-18 00:51:35.0 +0400 +++ linux-2.6.16.pptp/drivers/net/Kconfig 2006-06-18 01:10:19.0 +0400 @@ -2603,6 +2603,15 @@ config PPPOE which contains instruction on how to use this driver (under the heading "Kernel mode PPPoE"). +config PPTP + tristate "PPTP (Point-to-Point Tunneling Protocol) (EXPERIMENTAL)" + depends on EXPERIMENTAL && PPP + help + Support for Microsoft Point-to-Point Tunneling Protocol. + + See http://accel-pptp.sourceforge.net/ for information on + configuring PPTP clients and servers to utilize this driver. + config PPPOATM tristate "PPP over ATM" depends on ATM && PPP diff -uprN linux-2.6.16.orig/drivers/net/Makefile linux-2.6.16.pptp/drivers/net/Makefile --- linux-2.6.16.orig/drivers/net/Makefile 2006-06-18 00:51:34.0 +0400 +++ linux-2.6.16.pptp/drivers/net/Makefile 2006-06-18 00:57:02.0 +0400 @@ -118,6 +118,7 @@ obj-$(CONFIG_PPP_DEFLATE) += ppp_deflate obj-$(CONFIG_PPP_BSDCOMP) += bsd_comp.o obj-$(CONFIG_PPP_MPPE) += ppp_mppe.o obj-$(CONFIG_PPPOE) += pppox.o pppoe.o +obj-$(CONFIG_PPTP) += pppox.o pptp.o obj-$(CONFIG_SLIP) += slip.o ifeq ($(CONFIG_SLIP_COMPRESSED),y) diff -uprN linux-2.6.16.orig/drivers/net/pptp.c linux-2.6.16.pptp/drivers/net/pptp.c --- linux-2.6.16.orig/drivers/net/pptp.c1970-01-01 03:00:00.0 +0300 +++ linux-2.6.16.pptp/drivers/net/pptp.c2006-06-18 01:30:40.0 +0400 @@ -0,0 +1,928 @@ +/* + * Point-to-Point Tunneling Protocol for Linux + * + * Authors: Kozlov D. ([EMAIL PROTECTED]) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define PPTP_DRIVER_VERSION "0.7" + +MODULE_DESCRIPTION("Point-to-Point Tunneling Protocol for Linux"); +MODULE_AUTHOR("Kozlov D. ([EMAIL PROTECTED])"); +MODULE_LICENSE("GPL"); + +static int log_level=0; +static int min_window=5; +static int max_window=100; +module_param(min_window,int,5); +MODULE_PARM_DESC(min_window,"Minimum sliding window size (default=3)"); +module_param(max_window,int,100); +MODULE_PARM_DESC(max_window,"Maximum sliding window size (default=100)"); +module_param(log_level,int,0); + +static struct proc_dir_entry* proc_dir; + +#define HASH_SIZE 16 +#define HASH(addr) ((addr^(addr>>4))&0xF) +static DEFINE_RWLOCK(chan_lock); +static struct pppox_sock *chans[HASH_SIZE]; + +static int pptp_xmit(struct ppp_channel *chan, struct sk_buff *skb); +static int read_proc(char *page, char **start, off_t off,int count, + int *eof, void *data); +static int __pptp_rcv(struct pppox_sock *po,struct sk_buff *skb,int new); + +static struct ppp_channel_ops pptp_chan_ops= { + .start_xmit = pptp_xmit, +}; + +/* gre header structure: */ + +#define PPTP_GRE_PROTO 0x880B +#define PPTP_GRE_VER0x1 + +#define PPTP_GRE_FLAG_C0x80 +#define PPTP_GRE_FLAG_R0x40 +#define PPTP_GRE_FLAG_K0x20 +#define PPTP_GRE_FLAG_S0x10 +#define PPTP_GRE_FLAG_A0x80 + +#define PPTP_GRE_IS_C(f) ((f)&PPTP_GRE_FLAG_C) +#define PPTP_GRE_IS_R(f) ((f)&PPTP_GRE_FLAG_R) +#define PPTP_GRE_IS_K(f) ((f)&PPTP_GRE_FLAG_K) +#define PPTP_GRE_IS_S(f) ((f)&PPTP_GRE_FLAG_S) +#define PPTP_GRE_IS_A(f) ((f)&PPTP_GRE_FLAG_A) + +struct pptp_gre_header { + u_int8_t flags; /* bitfield */ + u_int8_t ver;/* should be PPTP_GRE_VER (enhanced GRE) */ + u_int16_t protocol; /* should be PPTP_GRE_PROTO (ppp-encaps) */ + u_int16_t payload_len; /* size of ppp payload, not inc. gre header */ + u_int16_t call_id; /* peer's call_id for this session */ + u_int32_t seq; /* sequence number. Present if S==1 */ + u_int32_t ack; /* seq number of highest packet recieved by */ +
Kernel panic (network stack)
-- Пересланное сообщение -- Тема: Kernel panic (network stack) Дата: 12 октября 2007 Отправитель: [EMAIL PROTECTED] получатель: [EMAIL PROTECTED] Hello! I develop network driver. It works fine while less then 100 network interfaces exists. Then i give kernel panic. What could cause it ? general protection fault: [1] PREEMPT SMP CPU 1 Modules linked in: ppp_deflate zlib_deflate zlib_inflate pptp pppox ppp_generic slhc rtc 8139too Pid: 0, comm: swapper Noy tainted 2.6.22-gentoo-r8 #5 RIP: 0010:[] [] put_page+0x1b/0x110 RSP: 0018:81000171fda0 EFLAGS: 00010286 RAX: 81000ec31080 RBX: a2e9690005e3 RCX: RDX: RSI: 005a RDI: a2e9690005e3 RBP: 81000ec31080 R08: 81000ec31046 R09: 0001 R10: R11: 80467910 R12: 81001a912800 R13: 0008 R14: 805f7440 R15: 81001a912800 FS: 2ad3cba47ae0() GS: 81001be7df40() knlGS: f7e3b6b0 CS: 0010 DS: 0018 ES: 0018 CR0: 08005003b CR2: 00413ae0 CR3: 011ef000 CR4: 06e0 Process swapper (pid:0, threadinfo 810001718000, task 81001be6e730 Stack: 0001 81000f16f0c0 81001a912800 0008 fff80463ab7 8100129d1e42 81000f16f0c0 81000f16f0c0 fff80463859 806081b0 80489fb5 Call Trace: [] skb_release_data+0x77/0xd0 [] kfree_skbmem+0x9/0x80 [] ip_rcv+0xc5/0x6a0 [] netif_receive_skb+0x3f5/0x400 [] netif_receive_skb+0x298/0x400 [] process_backlog+0x9b/0x130 [] net_rx_action+0x88/0x1d0 [] :8139too:rtl8139_interrupt+0x142/0x550 [] __do_softirq+0x6b/0xf0 [] call_softirq+0x1c/0x30 [] do_softirq+0x4a/0xb0 [] do_IRQ+0x80/0x100 [] default_idle+0x0/0x50 [] ret_from_intr+0x0/0xa ] default_idle+0x29/0x50 [] cpu_idle+0x90/0xa0 Code: 8b 07 f6 c4 40 0f 85 cc 00 00 00 f0 ff 4f 08 0f 94 c0 84 c0 RIP [] put_page+0x1b/0x110 RSP: 0018:81000171fda0 Kernel panic - not syncing: Aiee, killing interrupt handler! --- - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Kernel panic (network stack)
> > Hello! > > I develop network driver. > > It works fine while less then 100 network interfaces exists. > > Then i give kernel panic. What could cause it ? > > Since it probably in your code. Please code (or place to download) > the driver code. You can download from http://sourceforge.net/projects/accel-pptp /* * Point-to-Point Tunneling Protocol for Linux * * Authors: Kozlov D. ([EMAIL PROTECTED]) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * */ #include #include #include #include #include #include #include #include #include #include #include #include #include "if_pppox.h" #include #include #include #include #include #include #include #include #include #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) #include #include #else #include #endif #include #include #include #include #include #include #define PPTP_DRIVER_VERSION "0.7.8-r1" MODULE_DESCRIPTION("Point-to-Point Tunneling Protocol for Linux"); MODULE_AUTHOR("Kozlov D. ([EMAIL PROTECTED])"); MODULE_LICENSE("GPL"); static int log_level=0; static int log_packets=10; static int rx_stop=0; static int min_window=5; static int max_window=100; static int statistics=0; static int stat_collect_time=3; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) MODULE_PARM(min_window,"i"); MODULE_PARM(max_window,"i"); MODULE_PARM(log_level,"i"); MODULE_PARM(log_packets,"i"); MODULE_PARM(statistics,"i"); MODULE_PARM(stat_collect_time,"i"); #else module_param(min_window,int,0); module_param(max_window,int,0); module_param(log_level,int,0); module_param(log_packets,int,0); module_param(statistics,int,0); module_param(stat_collect_time,int,0); #endif MODULE_PARM_DESC(min_window,"Minimum sliding window size (default=3)"); MODULE_PARM_DESC(max_window,"Maximum sliding window size (default=100)"); MODULE_PARM_DESC(log_level,"Logging level (default=0)"); MODULE_PARM_DESC(statistics,"Performance statistics collection"); MODULE_PARM_DESC(stat_collect_time,"Statistics collect time (sec)"); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0) #define __wait_event_timeout(wq, condition, ret)\ do {\ wait_queue_t __wait;\ init_waitqueue_entry(&__wait, current); \ \ for (;;) { \ set_current_state(TASK_UNINTERRUPTIBLE);\ if (condition) \ break; \ ret = schedule_timeout(ret);\ if (!ret) \ break; \ } \ current->state = TASK_RUNNING; \ remove_wait_queue(&wq, &__wait);\ } while (0) #define wait_event_timeout(wq, condition, timeout) \ ({ \ long __ret = timeout; \ if (!(condition)) \ __wait_event_timeout(wq, condition, __ret); \ __ret; \ }) #define INIT_TIMER(_timer,_routine,_data) \ do { \ (_timer)->function=_routine; \ (_timer)->data=_data; \ init_timer(_timer); \ } while (0); static inline void *kzalloc(size_t size,int gfp) { void *p=kmalloc(size,gfp); memset(p,0,size); return p; } static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp) { *stamp = skb->stamp; } static inline void __net_timestamp(struct sk_buff *skb, const struct timeval *stamp) { struct timeval tv; do_gettimeofday(&tv); skb->stamp = *stamp; } #endif //= performance statistics = //static struct timeval stat_last_update={0,0}; unsigned long stat_last_update=0; static unsigned int tx_packets_avg=0; static unsigned int rx_packets_avg=0; static unsigned int ack_timeouts_avg=0; static unsigned int ack_works_avg=0; static unsigned int buf_works_avg=0; static unsigned int tx_packets_cur=0; static unsigned int rx_packets_cur=0; static unsigned int ack_timeouts_cur=0; static unsigned int ack_works_cur=0; static unsigned int buf_works_cur=0; static rwlock_t stat_lock=RW_LOCK_U
Re[2]: Kernel panic (network stack)
> > Hello! > > I develop network driver. > > It works fine while less then 100 network interfaces exists. > > Then i give kernel panic. What could cause it ? > > > > Since it probably in your code. Please code (or place to download) > the driver code. fixed in 0.7.9 - To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html