diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2010-08-22 02:05:39 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-22 02:05:39 -0400 |
commit | 00959ade36acadc00e757f87060bf6e4501d545f (patch) | |
tree | 9bfe790d4a8b63b0e6653388da73dfd777eea8ff /include | |
parent | 1003489e06c04d807c783a8958f2ccc9aed7a244 (diff) |
PPTP: PPP over IPv4 (Point-to-Point Tunneling Protocol)
PPP: introduce "pptp" module which implements point-to-point tunneling protocol using pppox framework
NET: introduce the "gre" module for demultiplexing GRE packets on version criteria
(required to pptp and ip_gre may coexists)
NET: ip_gre: update to use the "gre" module
This patch introduces then pptp support to the linux kernel which
dramatically speeds up pptp vpn connections and decreases cpu usage in
comparison of existing user-space implementation
(poptop/pptpclient). There is accel-pptp project
(https://sourceforge.net/projects/accel-pptp/) to utilize this module,
it contains plugin for pppd to use pptp in client-mode and modified
pptpd (poptop) to build high-performance pptp NAS.
There was many changes from initial submitted patch, most important are:
1. using rcu instead of read-write locks
2. using static bitmap instead of dynamically allocated
3. using vmalloc for memory allocation instead of BITS_PER_LONG + __get_free_pages
4. fixed many coding style issues
Thanks to Eric Dumazet.
Signed-off-by: Dmitry Kozlov <xeb@mail.ru>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/if_pppox.h | 52 | ||||
-rw-r--r-- | include/net/gre.h | 18 |
2 files changed, 53 insertions, 17 deletions
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index 1925e0c3f162..1525b2156b2a 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h | |||
@@ -40,25 +40,35 @@ | |||
40 | * PPPoE addressing definition | 40 | * PPPoE addressing definition |
41 | */ | 41 | */ |
42 | typedef __be16 sid_t; | 42 | typedef __be16 sid_t; |
43 | struct pppoe_addr{ | 43 | struct pppoe_addr { |
44 | sid_t sid; /* Session identifier */ | 44 | sid_t sid; /* Session identifier */ |
45 | unsigned char remote[ETH_ALEN]; /* Remote address */ | 45 | unsigned char remote[ETH_ALEN]; /* Remote address */ |
46 | char dev[IFNAMSIZ]; /* Local device to use */ | 46 | char dev[IFNAMSIZ]; /* Local device to use */ |
47 | }; | 47 | }; |
48 | 48 | ||
49 | /************************************************************************ | 49 | /************************************************************************ |
50 | * Protocols supported by AF_PPPOX | 50 | * PPTP addressing definition |
51 | */ | 51 | */ |
52 | struct pptp_addr { | ||
53 | u16 call_id; | ||
54 | struct in_addr sin_addr; | ||
55 | }; | ||
56 | |||
57 | /************************************************************************ | ||
58 | * Protocols supported by AF_PPPOX | ||
59 | */ | ||
52 | #define PX_PROTO_OE 0 /* Currently just PPPoE */ | 60 | #define PX_PROTO_OE 0 /* Currently just PPPoE */ |
53 | #define PX_PROTO_OL2TP 1 /* Now L2TP also */ | 61 | #define PX_PROTO_OL2TP 1 /* Now L2TP also */ |
54 | #define PX_MAX_PROTO 2 | 62 | #define PX_PROTO_PPTP 2 |
55 | 63 | #define PX_MAX_PROTO 3 | |
56 | struct sockaddr_pppox { | 64 | |
57 | sa_family_t sa_family; /* address family, AF_PPPOX */ | 65 | struct sockaddr_pppox { |
58 | unsigned int sa_protocol; /* protocol identifier */ | 66 | sa_family_t sa_family; /* address family, AF_PPPOX */ |
59 | union{ | 67 | unsigned int sa_protocol; /* protocol identifier */ |
60 | struct pppoe_addr pppoe; | 68 | union { |
61 | }sa_addr; | 69 | struct pppoe_addr pppoe; |
70 | struct pptp_addr pptp; | ||
71 | } sa_addr; | ||
62 | } __packed; | 72 | } __packed; |
63 | 73 | ||
64 | /* The use of the above union isn't viable because the size of this | 74 | /* The use of the above union isn't viable because the size of this |
@@ -101,7 +111,7 @@ struct pppoe_tag { | |||
101 | __be16 tag_type; | 111 | __be16 tag_type; |
102 | __be16 tag_len; | 112 | __be16 tag_len; |
103 | char tag_data[0]; | 113 | char tag_data[0]; |
104 | } __attribute ((packed)); | 114 | } __packed; |
105 | 115 | ||
106 | /* Tag identifiers */ | 116 | /* Tag identifiers */ |
107 | #define PTT_EOL __cpu_to_be16(0x0000) | 117 | #define PTT_EOL __cpu_to_be16(0x0000) |
@@ -150,15 +160,23 @@ struct pppoe_opt { | |||
150 | relayed to (PPPoE relaying) */ | 160 | relayed to (PPPoE relaying) */ |
151 | }; | 161 | }; |
152 | 162 | ||
163 | struct pptp_opt { | ||
164 | struct pptp_addr src_addr; | ||
165 | struct pptp_addr dst_addr; | ||
166 | u32 ack_sent, ack_recv; | ||
167 | u32 seq_sent, seq_recv; | ||
168 | int ppp_flags; | ||
169 | }; | ||
153 | #include <net/sock.h> | 170 | #include <net/sock.h> |
154 | 171 | ||
155 | struct pppox_sock { | 172 | struct pppox_sock { |
156 | /* struct sock must be the first member of pppox_sock */ | 173 | /* struct sock must be the first member of pppox_sock */ |
157 | struct sock sk; | 174 | struct sock sk; |
158 | struct ppp_channel chan; | 175 | struct ppp_channel chan; |
159 | struct pppox_sock *next; /* for hash table */ | 176 | struct pppox_sock *next; /* for hash table */ |
160 | union { | 177 | union { |
161 | struct pppoe_opt pppoe; | 178 | struct pppoe_opt pppoe; |
179 | struct pptp_opt pptp; | ||
162 | } proto; | 180 | } proto; |
163 | __be16 num; | 181 | __be16 num; |
164 | }; | 182 | }; |
diff --git a/include/net/gre.h b/include/net/gre.h new file mode 100644 index 000000000000..82665474bcb7 --- /dev/null +++ b/include/net/gre.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #ifndef __LINUX_GRE_H | ||
2 | #define __LINUX_GRE_H | ||
3 | |||
4 | #include <linux/skbuff.h> | ||
5 | |||
6 | #define GREPROTO_CISCO 0 | ||
7 | #define GREPROTO_PPTP 1 | ||
8 | #define GREPROTO_MAX 2 | ||
9 | |||
10 | struct gre_protocol { | ||
11 | int (*handler)(struct sk_buff *skb); | ||
12 | void (*err_handler)(struct sk_buff *skb, u32 info); | ||
13 | }; | ||
14 | |||
15 | int gre_add_protocol(const struct gre_protocol *proto, u8 version); | ||
16 | int gre_del_protocol(const struct gre_protocol *proto, u8 version); | ||
17 | |||
18 | #endif | ||