aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/ax25.h2
-rw-r--r--include/net/ip.h1
-rw-r--r--include/net/ip6_fib.h9
-rw-r--r--include/net/ip6_route.h9
-rw-r--r--include/net/ip_fib.h14
-rw-r--r--include/net/neighbour.h7
-rw-r--r--include/net/request_sock.h255
-rw-r--r--include/net/route.h5
-rw-r--r--include/net/sch_generic.h122
-rw-r--r--include/net/sctp/command.h8
-rw-r--r--include/net/sctp/constants.h7
-rw-r--r--include/net/sctp/sctp.h17
-rw-r--r--include/net/sctp/sm.h6
-rw-r--r--include/net/sctp/structs.h41
-rw-r--r--include/net/sctp/user.h3
-rw-r--r--include/net/snmp.h14
-rw-r--r--include/net/sock.h4
-rw-r--r--include/net/tcp.h399
-rw-r--r--include/net/tcp_ecn.h13
-rw-r--r--include/net/x25.h9
-rw-r--r--include/net/xfrm.h28
21 files changed, 623 insertions, 350 deletions
diff --git a/include/net/ax25.h b/include/net/ax25.h
index 9e6368a54547..828a3a93dda1 100644
--- a/include/net/ax25.h
+++ b/include/net/ax25.h
@@ -220,7 +220,7 @@ static __inline__ void ax25_cb_put(ax25_cb *ax25)
220 } 220 }
221} 221}
222 222
223static inline unsigned short ax25_type_trans(struct sk_buff *skb, struct net_device *dev) 223static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev)
224{ 224{
225 skb->dev = dev; 225 skb->dev = dev;
226 skb->pkt_type = PACKET_HOST; 226 skb->pkt_type = PACKET_HOST;
diff --git a/include/net/ip.h b/include/net/ip.h
index 3f63992eb712..32360bbe143f 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -163,6 +163,7 @@ DECLARE_SNMP_STAT(struct linux_mib, net_statistics);
163 163
164extern int sysctl_local_port_range[2]; 164extern int sysctl_local_port_range[2];
165extern int sysctl_ip_default_ttl; 165extern int sysctl_ip_default_ttl;
166extern int sysctl_ip_nonlocal_bind;
166 167
167#ifdef CONFIG_INET 168#ifdef CONFIG_INET
168/* The function in 2.2 was invalid, producing wrong result for 169/* The function in 2.2 was invalid, producing wrong result for
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 319904518194..a66e9de16a6c 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -167,14 +167,17 @@ extern int fib6_walk_continue(struct fib6_walker_t *w);
167extern int fib6_add(struct fib6_node *root, 167extern int fib6_add(struct fib6_node *root,
168 struct rt6_info *rt, 168 struct rt6_info *rt,
169 struct nlmsghdr *nlh, 169 struct nlmsghdr *nlh,
170 void *rtattr); 170 void *rtattr,
171 struct netlink_skb_parms *req);
171 172
172extern int fib6_del(struct rt6_info *rt, 173extern int fib6_del(struct rt6_info *rt,
173 struct nlmsghdr *nlh, 174 struct nlmsghdr *nlh,
174 void *rtattr); 175 void *rtattr,
176 struct netlink_skb_parms *req);
175 177
176extern void inet6_rt_notify(int event, struct rt6_info *rt, 178extern void inet6_rt_notify(int event, struct rt6_info *rt,
177 struct nlmsghdr *nlh); 179 struct nlmsghdr *nlh,
180 struct netlink_skb_parms *req);
178 181
179extern void fib6_run_gc(unsigned long dummy); 182extern void fib6_run_gc(unsigned long dummy);
180 183
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index d5d1dd10cdb8..f920706d526b 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -41,13 +41,16 @@ extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg);
41 41
42extern int ip6_route_add(struct in6_rtmsg *rtmsg, 42extern int ip6_route_add(struct in6_rtmsg *rtmsg,
43 struct nlmsghdr *, 43 struct nlmsghdr *,
44 void *rtattr); 44 void *rtattr,
45 struct netlink_skb_parms *req);
45extern int ip6_ins_rt(struct rt6_info *, 46extern int ip6_ins_rt(struct rt6_info *,
46 struct nlmsghdr *, 47 struct nlmsghdr *,
47 void *rtattr); 48 void *rtattr,
49 struct netlink_skb_parms *req);
48extern int ip6_del_rt(struct rt6_info *, 50extern int ip6_del_rt(struct rt6_info *,
49 struct nlmsghdr *, 51 struct nlmsghdr *,
50 void *rtattr); 52 void *rtattr,
53 struct netlink_skb_parms *req);
51 54
52extern int ip6_rt_addr_add(struct in6_addr *addr, 55extern int ip6_rt_addr_add(struct in6_addr *addr,
53 struct net_device *dev, 56 struct net_device *dev,
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index e5a5f6b62f88..a4208a336ac0 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -109,6 +109,20 @@ struct fib_result {
109#endif 109#endif
110}; 110};
111 111
112struct fib_result_nl {
113 u32 fl_addr; /* To be looked up*/
114 u32 fl_fwmark;
115 unsigned char fl_tos;
116 unsigned char fl_scope;
117 unsigned char tb_id_in;
118
119 unsigned char tb_id; /* Results */
120 unsigned char prefixlen;
121 unsigned char nh_sel;
122 unsigned char type;
123 unsigned char scope;
124 int err;
125};
112 126
113#ifdef CONFIG_IP_ROUTE_MULTIPATH 127#ifdef CONFIG_IP_ROUTE_MULTIPATH
114 128
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 4f33bbc21e7f..89809891e5ab 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -65,11 +65,10 @@ struct neighbour;
65 65
66struct neigh_parms 66struct neigh_parms
67{ 67{
68 struct net_device *dev;
68 struct neigh_parms *next; 69 struct neigh_parms *next;
69 int (*neigh_setup)(struct neighbour *); 70 int (*neigh_setup)(struct neighbour *);
70 struct neigh_table *tbl; 71 struct neigh_table *tbl;
71 int entries;
72 void *priv;
73 72
74 void *sysctl_table; 73 void *sysctl_table;
75 74
@@ -192,7 +191,6 @@ struct neigh_table
192 atomic_t entries; 191 atomic_t entries;
193 rwlock_t lock; 192 rwlock_t lock;
194 unsigned long last_rand; 193 unsigned long last_rand;
195 struct neigh_parms *parms_list;
196 kmem_cache_t *kmem_cachep; 194 kmem_cache_t *kmem_cachep;
197 struct neigh_statistics *stats; 195 struct neigh_statistics *stats;
198 struct neighbour **hash_buckets; 196 struct neighbour **hash_buckets;
@@ -252,6 +250,9 @@ extern int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
252extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg); 250extern int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
253extern void neigh_app_ns(struct neighbour *n); 251extern void neigh_app_ns(struct neighbour *n);
254 252
253extern int neightbl_dump_info(struct sk_buff *skb, struct netlink_callback *cb);
254extern int neightbl_set(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg);
255
255extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); 256extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie);
256extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); 257extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *));
257extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); 258extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *));
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
new file mode 100644
index 000000000000..72fd6f5e86b1
--- /dev/null
+++ b/include/net/request_sock.h
@@ -0,0 +1,255 @@
1/*
2 * NET Generic infrastructure for Network protocols.
3 *
4 * Definitions for request_sock
5 *
6 * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
7 *
8 * From code originally in include/net/tcp.h
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 */
15#ifndef _REQUEST_SOCK_H
16#define _REQUEST_SOCK_H
17
18#include <linux/slab.h>
19#include <linux/spinlock.h>
20#include <linux/types.h>
21
22#include <net/sock.h>
23
24struct request_sock;
25struct sk_buff;
26struct dst_entry;
27struct proto;
28
29struct request_sock_ops {
30 int family;
31 kmem_cache_t *slab;
32 int obj_size;
33 int (*rtx_syn_ack)(struct sock *sk,
34 struct request_sock *req,
35 struct dst_entry *dst);
36 void (*send_ack)(struct sk_buff *skb,
37 struct request_sock *req);
38 void (*send_reset)(struct sk_buff *skb);
39 void (*destructor)(struct request_sock *req);
40};
41
42/* struct request_sock - mini sock to represent a connection request
43 */
44struct request_sock {
45 struct request_sock *dl_next; /* Must be first member! */
46 u16 mss;
47 u8 retrans;
48 u8 __pad;
49 /* The following two fields can be easily recomputed I think -AK */
50 u32 window_clamp; /* window clamp at creation time */
51 u32 rcv_wnd; /* rcv_wnd offered first time */
52 u32 ts_recent;
53 unsigned long expires;
54 struct request_sock_ops *rsk_ops;
55 struct sock *sk;
56};
57
58static inline struct request_sock *reqsk_alloc(struct request_sock_ops *ops)
59{
60 struct request_sock *req = kmem_cache_alloc(ops->slab, SLAB_ATOMIC);
61
62 if (req != NULL)
63 req->rsk_ops = ops;
64
65 return req;
66}
67
68static inline void __reqsk_free(struct request_sock *req)
69{
70 kmem_cache_free(req->rsk_ops->slab, req);
71}
72
73static inline void reqsk_free(struct request_sock *req)
74{
75 req->rsk_ops->destructor(req);
76 __reqsk_free(req);
77}
78
79extern int sysctl_max_syn_backlog;
80
81/** struct listen_sock - listen state
82 *
83 * @max_qlen_log - log_2 of maximal queued SYNs/REQUESTs
84 */
85struct listen_sock {
86 u8 max_qlen_log;
87 /* 3 bytes hole, try to use */
88 int qlen;
89 int qlen_young;
90 int clock_hand;
91 u32 hash_rnd;
92 struct request_sock *syn_table[0];
93};
94
95/** struct request_sock_queue - queue of request_socks
96 *
97 * @rskq_accept_head - FIFO head of established children
98 * @rskq_accept_tail - FIFO tail of established children
99 * @syn_wait_lock - serializer
100 *
101 * %syn_wait_lock is necessary only to avoid proc interface having to grab the main
102 * lock sock while browsing the listening hash (otherwise it's deadlock prone).
103 *
104 * This lock is acquired in read mode only from listening_get_next() seq_file
105 * op and it's acquired in write mode _only_ from code that is actively
106 * changing rskq_accept_head. All readers that are holding the master sock lock
107 * don't need to grab this lock in read mode too as rskq_accept_head. writes
108 * are always protected from the main sock lock.
109 */
110struct request_sock_queue {
111 struct request_sock *rskq_accept_head;
112 struct request_sock *rskq_accept_tail;
113 rwlock_t syn_wait_lock;
114 struct listen_sock *listen_opt;
115};
116
117extern int reqsk_queue_alloc(struct request_sock_queue *queue,
118 const int nr_table_entries);
119
120static inline struct listen_sock *reqsk_queue_yank_listen_sk(struct request_sock_queue *queue)
121{
122 struct listen_sock *lopt;
123
124 write_lock_bh(&queue->syn_wait_lock);
125 lopt = queue->listen_opt;
126 queue->listen_opt = NULL;
127 write_unlock_bh(&queue->syn_wait_lock);
128
129 return lopt;
130}
131
132static inline void reqsk_queue_destroy(struct request_sock_queue *queue)
133{
134 kfree(reqsk_queue_yank_listen_sk(queue));
135}
136
137static inline struct request_sock *
138 reqsk_queue_yank_acceptq(struct request_sock_queue *queue)
139{
140 struct request_sock *req = queue->rskq_accept_head;
141
142 queue->rskq_accept_head = queue->rskq_accept_head = NULL;
143 return req;
144}
145
146static inline int reqsk_queue_empty(struct request_sock_queue *queue)
147{
148 return queue->rskq_accept_head == NULL;
149}
150
151static inline void reqsk_queue_unlink(struct request_sock_queue *queue,
152 struct request_sock *req,
153 struct request_sock **prev_req)
154{
155 write_lock(&queue->syn_wait_lock);
156 *prev_req = req->dl_next;
157 write_unlock(&queue->syn_wait_lock);
158}
159
160static inline void reqsk_queue_add(struct request_sock_queue *queue,
161 struct request_sock *req,
162 struct sock *parent,
163 struct sock *child)
164{
165 req->sk = child;
166 sk_acceptq_added(parent);
167
168 if (queue->rskq_accept_head == NULL)
169 queue->rskq_accept_head = req;
170 else
171 queue->rskq_accept_tail->dl_next = req;
172
173 queue->rskq_accept_tail = req;
174 req->dl_next = NULL;
175}
176
177static inline struct request_sock *reqsk_queue_remove(struct request_sock_queue *queue)
178{
179 struct request_sock *req = queue->rskq_accept_head;
180
181 BUG_TRAP(req != NULL);
182
183 queue->rskq_accept_head = req->dl_next;
184 if (queue->rskq_accept_head == NULL)
185 queue->rskq_accept_tail = NULL;
186
187 return req;
188}
189
190static inline struct sock *reqsk_queue_get_child(struct request_sock_queue *queue,
191 struct sock *parent)
192{
193 struct request_sock *req = reqsk_queue_remove(queue);
194 struct sock *child = req->sk;
195
196 BUG_TRAP(child != NULL);
197
198 sk_acceptq_removed(parent);
199 __reqsk_free(req);
200 return child;
201}
202
203static inline int reqsk_queue_removed(struct request_sock_queue *queue,
204 struct request_sock *req)
205{
206 struct listen_sock *lopt = queue->listen_opt;
207
208 if (req->retrans == 0)
209 --lopt->qlen_young;
210
211 return --lopt->qlen;
212}
213
214static inline int reqsk_queue_added(struct request_sock_queue *queue)
215{
216 struct listen_sock *lopt = queue->listen_opt;
217 const int prev_qlen = lopt->qlen;
218
219 lopt->qlen_young++;
220 lopt->qlen++;
221 return prev_qlen;
222}
223
224static inline int reqsk_queue_len(struct request_sock_queue *queue)
225{
226 return queue->listen_opt != NULL ? queue->listen_opt->qlen : 0;
227}
228
229static inline int reqsk_queue_len_young(struct request_sock_queue *queue)
230{
231 return queue->listen_opt->qlen_young;
232}
233
234static inline int reqsk_queue_is_full(struct request_sock_queue *queue)
235{
236 return queue->listen_opt->qlen >> queue->listen_opt->max_qlen_log;
237}
238
239static inline void reqsk_queue_hash_req(struct request_sock_queue *queue,
240 u32 hash, struct request_sock *req,
241 unsigned timeout)
242{
243 struct listen_sock *lopt = queue->listen_opt;
244
245 req->expires = jiffies + timeout;
246 req->retrans = 0;
247 req->sk = NULL;
248 req->dl_next = lopt->syn_table[hash];
249
250 write_lock(&queue->syn_wait_lock);
251 lopt->syn_table[hash] = req;
252 write_unlock(&queue->syn_wait_lock);
253}
254
255#endif /* _REQUEST_SOCK_H */
diff --git a/include/net/route.h b/include/net/route.h
index efe92b239ef1..c3cd069a9aca 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -107,7 +107,7 @@ struct rt_cache_stat
107 107
108extern struct rt_cache_stat *rt_cache_stat; 108extern struct rt_cache_stat *rt_cache_stat;
109#define RT_CACHE_STAT_INC(field) \ 109#define RT_CACHE_STAT_INC(field) \
110 (per_cpu_ptr(rt_cache_stat, _smp_processor_id())->field++) 110 (per_cpu_ptr(rt_cache_stat, raw_smp_processor_id())->field++)
111 111
112extern struct ip_rt_acct *ip_rt_acct; 112extern struct ip_rt_acct *ip_rt_acct;
113 113
@@ -181,9 +181,6 @@ static inline int ip_route_newports(struct rtable **rp, u16 sport, u16 dport,
181 memcpy(&fl, &(*rp)->fl, sizeof(fl)); 181 memcpy(&fl, &(*rp)->fl, sizeof(fl));
182 fl.fl_ip_sport = sport; 182 fl.fl_ip_sport = sport;
183 fl.fl_ip_dport = dport; 183 fl.fl_ip_dport = dport;
184#if defined(CONFIG_IP_ROUTE_MULTIPATH_CACHED)
185 fl.flags |= FLOWI_FLAG_MULTIPATHOLDROUTE;
186#endif
187 ip_rt_put(*rp); 184 ip_rt_put(*rp);
188 *rp = NULL; 185 *rp = NULL;
189 return ip_route_output_flow(rp, &fl, sk, 0); 186 return ip_route_output_flow(rp, &fl, sk, 0);
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index c57504b3b518..7b97405e2dbf 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -172,4 +172,126 @@ tcf_destroy(struct tcf_proto *tp)
172 kfree(tp); 172 kfree(tp);
173} 173}
174 174
175static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
176 struct sk_buff_head *list)
177{
178 __skb_queue_tail(list, skb);
179 sch->qstats.backlog += skb->len;
180 sch->bstats.bytes += skb->len;
181 sch->bstats.packets++;
182
183 return NET_XMIT_SUCCESS;
184}
185
186static inline int qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch)
187{
188 return __qdisc_enqueue_tail(skb, sch, &sch->q);
189}
190
191static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch,
192 struct sk_buff_head *list)
193{
194 struct sk_buff *skb = __skb_dequeue(list);
195
196 if (likely(skb != NULL))
197 sch->qstats.backlog -= skb->len;
198
199 return skb;
200}
201
202static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
203{
204 return __qdisc_dequeue_head(sch, &sch->q);
205}
206
207static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch,
208 struct sk_buff_head *list)
209{
210 struct sk_buff *skb = __skb_dequeue_tail(list);
211
212 if (likely(skb != NULL))
213 sch->qstats.backlog -= skb->len;
214
215 return skb;
216}
217
218static inline struct sk_buff *qdisc_dequeue_tail(struct Qdisc *sch)
219{
220 return __qdisc_dequeue_tail(sch, &sch->q);
221}
222
223static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch,
224 struct sk_buff_head *list)
225{
226 __skb_queue_head(list, skb);
227 sch->qstats.backlog += skb->len;
228 sch->qstats.requeues++;
229
230 return NET_XMIT_SUCCESS;
231}
232
233static inline int qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch)
234{
235 return __qdisc_requeue(skb, sch, &sch->q);
236}
237
238static inline void __qdisc_reset_queue(struct Qdisc *sch,
239 struct sk_buff_head *list)
240{
241 /*
242 * We do not know the backlog in bytes of this list, it
243 * is up to the caller to correct it
244 */
245 skb_queue_purge(list);
246}
247
248static inline void qdisc_reset_queue(struct Qdisc *sch)
249{
250 __qdisc_reset_queue(sch, &sch->q);
251 sch->qstats.backlog = 0;
252}
253
254static inline unsigned int __qdisc_queue_drop(struct Qdisc *sch,
255 struct sk_buff_head *list)
256{
257 struct sk_buff *skb = __qdisc_dequeue_tail(sch, list);
258
259 if (likely(skb != NULL)) {
260 unsigned int len = skb->len;
261 kfree_skb(skb);
262 return len;
263 }
264
265 return 0;
266}
267
268static inline unsigned int qdisc_queue_drop(struct Qdisc *sch)
269{
270 return __qdisc_queue_drop(sch, &sch->q);
271}
272
273static inline int qdisc_drop(struct sk_buff *skb, struct Qdisc *sch)
274{
275 kfree_skb(skb);
276 sch->qstats.drops++;
277
278 return NET_XMIT_DROP;
279}
280
281static inline int qdisc_reshape_fail(struct sk_buff *skb, struct Qdisc *sch)
282{
283 sch->qstats.drops++;
284
285#ifdef CONFIG_NET_CLS_POLICE
286 if (sch->reshape_fail == NULL || sch->reshape_fail(skb, sch))
287 goto drop;
288
289 return NET_XMIT_SUCCESS;
290
291drop:
292#endif
293 kfree_skb(skb);
294 return NET_XMIT_DROP;
295}
296
175#endif 297#endif
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index ebc5282e6d58..dc107ffad483 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -65,9 +65,11 @@ typedef enum {
65 SCTP_CMD_TIMER_START, /* Start a timer. */ 65 SCTP_CMD_TIMER_START, /* Start a timer. */
66 SCTP_CMD_TIMER_RESTART, /* Restart a timer. */ 66 SCTP_CMD_TIMER_RESTART, /* Restart a timer. */
67 SCTP_CMD_TIMER_STOP, /* Stop a timer. */ 67 SCTP_CMD_TIMER_STOP, /* Stop a timer. */
68 SCTP_CMD_COUNTER_RESET, /* Reset a counter. */ 68 SCTP_CMD_INIT_CHOOSE_TRANSPORT, /* Choose transport for an INIT. */
69 SCTP_CMD_COUNTER_INC, /* Increment a counter. */ 69 SCTP_CMD_INIT_COUNTER_RESET, /* Reset init counter. */
70 SCTP_CMD_INIT_COUNTER_INC, /* Increment init counter. */
70 SCTP_CMD_INIT_RESTART, /* High level, do init timer work. */ 71 SCTP_CMD_INIT_RESTART, /* High level, do init timer work. */
72 SCTP_CMD_COOKIEECHO_RESTART, /* High level, do cookie-echo timer work. */
71 SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */ 73 SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */
72 SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */ 74 SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */
73 SCTP_CMD_STRIKE, /* Mark a strike against a transport. */ 75 SCTP_CMD_STRIKE, /* Mark a strike against a transport. */
@@ -118,7 +120,6 @@ typedef union {
118 int error; 120 int error;
119 sctp_state_t state; 121 sctp_state_t state;
120 sctp_event_timeout_t to; 122 sctp_event_timeout_t to;
121 sctp_counter_t counter;
122 void *ptr; 123 void *ptr;
123 struct sctp_chunk *chunk; 124 struct sctp_chunk *chunk;
124 struct sctp_association *asoc; 125 struct sctp_association *asoc;
@@ -165,7 +166,6 @@ SCTP_ARG_CONSTRUCTOR(U16, __u16, u16)
165SCTP_ARG_CONSTRUCTOR(U8, __u8, u8) 166SCTP_ARG_CONSTRUCTOR(U8, __u8, u8)
166SCTP_ARG_CONSTRUCTOR(ERROR, int, error) 167SCTP_ARG_CONSTRUCTOR(ERROR, int, error)
167SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state) 168SCTP_ARG_CONSTRUCTOR(STATE, sctp_state_t, state)
168SCTP_ARG_CONSTRUCTOR(COUNTER, sctp_counter_t, counter)
169SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to) 169SCTP_ARG_CONSTRUCTOR(TO, sctp_event_timeout_t, to)
170SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr) 170SCTP_ARG_CONSTRUCTOR(PTR, void *, ptr)
171SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk) 171SCTP_ARG_CONSTRUCTOR(CHUNK, struct sctp_chunk *, chunk)
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h
index 2b76c0f4babc..4868c7f7749d 100644
--- a/include/net/sctp/constants.h
+++ b/include/net/sctp/constants.h
@@ -263,13 +263,6 @@ enum { SCTP_MIN_PMTU = 576 };
263enum { SCTP_MAX_DUP_TSNS = 16 }; 263enum { SCTP_MAX_DUP_TSNS = 16 };
264enum { SCTP_MAX_GABS = 16 }; 264enum { SCTP_MAX_GABS = 16 };
265 265
266typedef enum {
267 SCTP_COUNTER_INIT_ERROR,
268} sctp_counter_t;
269
270/* How many counters does an association need? */
271#define SCTP_NUMBER_COUNTERS 5
272
273/* Here we define the default timers. */ 266/* Here we define the default timers. */
274 267
275/* cookie timer def = ? seconds */ 268/* cookie timer def = ? seconds */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 960abfa48d68..ef2738159ab3 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -223,6 +223,22 @@ DECLARE_SNMP_STAT(struct sctp_mib, sctp_statistics);
223extern int sctp_debug_flag; 223extern int sctp_debug_flag;
224#define SCTP_DEBUG_PRINTK(whatever...) \ 224#define SCTP_DEBUG_PRINTK(whatever...) \
225 ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever))) 225 ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever)))
226#define SCTP_DEBUG_PRINTK_IPADDR(lead, trail, leadparm, saddr, otherparms...) \
227 if (sctp_debug_flag) { \
228 if (saddr->sa.sa_family == AF_INET6) { \
229 printk(KERN_DEBUG \
230 lead "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x" trail, \
231 leadparm, \
232 NIP6(saddr->v6.sin6_addr), \
233 otherparms); \
234 } else { \
235 printk(KERN_DEBUG \
236 lead "%u.%u.%u.%u" trail, \
237 leadparm, \
238 NIPQUAD(saddr->v4.sin_addr.s_addr), \
239 otherparms); \
240 } \
241 }
226#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } 242#define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; }
227#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } 243#define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; }
228 244
@@ -236,6 +252,7 @@ extern int sctp_debug_flag;
236#else /* SCTP_DEBUG */ 252#else /* SCTP_DEBUG */
237 253
238#define SCTP_DEBUG_PRINTK(whatever...) 254#define SCTP_DEBUG_PRINTK(whatever...)
255#define SCTP_DEBUG_PRINTK_IPADDR(whatever...)
239#define SCTP_ENABLE_DEBUG 256#define SCTP_ENABLE_DEBUG
240#define SCTP_DISABLE_DEBUG 257#define SCTP_DISABLE_DEBUG
241#define SCTP_ASSERT(expr, str, func) 258#define SCTP_ASSERT(expr, str, func)
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index f4fcee104707..88d9fe5975d5 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -116,7 +116,8 @@ sctp_state_fn_t sctp_sf_eat_data_fast_4_4;
116sctp_state_fn_t sctp_sf_eat_sack_6_2; 116sctp_state_fn_t sctp_sf_eat_sack_6_2;
117sctp_state_fn_t sctp_sf_tabort_8_4_8; 117sctp_state_fn_t sctp_sf_tabort_8_4_8;
118sctp_state_fn_t sctp_sf_operr_notify; 118sctp_state_fn_t sctp_sf_operr_notify;
119sctp_state_fn_t sctp_sf_t1_timer_expire; 119sctp_state_fn_t sctp_sf_t1_init_timer_expire;
120sctp_state_fn_t sctp_sf_t1_cookie_timer_expire;
120sctp_state_fn_t sctp_sf_t2_timer_expire; 121sctp_state_fn_t sctp_sf_t2_timer_expire;
121sctp_state_fn_t sctp_sf_t4_timer_expire; 122sctp_state_fn_t sctp_sf_t4_timer_expire;
122sctp_state_fn_t sctp_sf_t5_timer_expire; 123sctp_state_fn_t sctp_sf_t5_timer_expire;
@@ -130,7 +131,6 @@ sctp_state_fn_t sctp_sf_do_ecne;
130sctp_state_fn_t sctp_sf_ootb; 131sctp_state_fn_t sctp_sf_ootb;
131sctp_state_fn_t sctp_sf_pdiscard; 132sctp_state_fn_t sctp_sf_pdiscard;
132sctp_state_fn_t sctp_sf_violation; 133sctp_state_fn_t sctp_sf_violation;
133sctp_state_fn_t sctp_sf_violation_chunklen;
134sctp_state_fn_t sctp_sf_discard_chunk; 134sctp_state_fn_t sctp_sf_discard_chunk;
135sctp_state_fn_t sctp_sf_do_5_2_1_siminit; 135sctp_state_fn_t sctp_sf_do_5_2_1_siminit;
136sctp_state_fn_t sctp_sf_do_5_2_2_dupinit; 136sctp_state_fn_t sctp_sf_do_5_2_2_dupinit;
@@ -258,8 +258,6 @@ struct sctp_chunk *sctp_make_fwdtsn(const struct sctp_association *asoc,
258void sctp_chunk_assign_tsn(struct sctp_chunk *); 258void sctp_chunk_assign_tsn(struct sctp_chunk *);
259void sctp_chunk_assign_ssn(struct sctp_chunk *); 259void sctp_chunk_assign_ssn(struct sctp_chunk *);
260 260
261void sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands, __u16 error);
262
263/* Prototypes for statetable processing. */ 261/* Prototypes for statetable processing. */
264 262
265int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype, 263int sctp_do_sm(sctp_event_t event_type, sctp_subtype_t subtype,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 6c24d9cd3d66..dfad4d3c581c 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -867,10 +867,13 @@ struct sctp_transport {
867 */ 867 */
868 unsigned long last_time_ecne_reduced; 868 unsigned long last_time_ecne_reduced;
869 869
870 /* active : The current active state of this destination, 870 /* The number of times INIT has been sent on this transport. */
871 * : i.e. DOWN, UP, etc. 871 int init_sent_count;
872
873 /* state : The current state of this destination,
874 * : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKOWN.
872 */ 875 */
873 int active; 876 int state;
874 877
875 /* hb_allowed : The current heartbeat state of this destination, 878 /* hb_allowed : The current heartbeat state of this destination,
876 * : i.e. ALLOW-HB, NO-HEARTBEAT, etc. 879 * : i.e. ALLOW-HB, NO-HEARTBEAT, etc.
@@ -1222,9 +1225,6 @@ struct sctp_endpoint {
1222 1225
1223 /* sendbuf acct. policy. */ 1226 /* sendbuf acct. policy. */
1224 __u32 sndbuf_policy; 1227 __u32 sndbuf_policy;
1225
1226 /* Name for debugging output... */
1227 char *debug_name;
1228}; 1228};
1229 1229
1230/* Recover the outter endpoint structure. */ 1230/* Recover the outter endpoint structure. */
@@ -1314,11 +1314,23 @@ struct sctp_association {
1314 * : association. Normally this information is 1314 * : association. Normally this information is
1315 * : hashed or keyed for quick lookup and access 1315 * : hashed or keyed for quick lookup and access
1316 * : of the TCB. 1316 * : of the TCB.
1317 * : The list is also initialized with the list
1318 * : of addresses passed with the sctp_connectx()
1319 * : call.
1317 * 1320 *
1318 * It is a list of SCTP_transport's. 1321 * It is a list of SCTP_transport's.
1319 */ 1322 */
1320 struct list_head transport_addr_list; 1323 struct list_head transport_addr_list;
1321 1324
1325 /* transport_count
1326 *
1327 * Peer : A count of the number of peer addresses
1328 * Transport : in the Peer Transport Address List.
1329 * Address :
1330 * Count :
1331 */
1332 __u16 transport_count;
1333
1322 /* port 1334 /* port
1323 * The transport layer port number. 1335 * The transport layer port number.
1324 */ 1336 */
@@ -1486,6 +1498,9 @@ struct sctp_association {
1486 /* Transport to which SHUTDOWN chunk was last sent. */ 1498 /* Transport to which SHUTDOWN chunk was last sent. */
1487 struct sctp_transport *shutdown_last_sent_to; 1499 struct sctp_transport *shutdown_last_sent_to;
1488 1500
1501 /* Transport to which INIT chunk was last sent. */
1502 struct sctp_transport *init_last_sent_to;
1503
1489 /* Next TSN : The next TSN number to be assigned to a new 1504 /* Next TSN : The next TSN number to be assigned to a new
1490 * : DATA chunk. This is sent in the INIT or INIT 1505 * : DATA chunk. This is sent in the INIT or INIT
1491 * : ACK chunk to the peer and incremented each 1506 * : ACK chunk to the peer and incremented each
@@ -1549,8 +1564,11 @@ struct sctp_association {
1549 /* The message size at which SCTP fragmentation will occur. */ 1564 /* The message size at which SCTP fragmentation will occur. */
1550 __u32 frag_point; 1565 __u32 frag_point;
1551 1566
1552 /* Currently only one counter is used to count INIT errors. */ 1567 /* Counter used to count INIT errors. */
1553 int counters[SCTP_NUMBER_COUNTERS]; 1568 int init_err_counter;
1569
1570 /* Count the number of INIT cycles (for doubling timeout). */
1571 int init_cycle;
1554 1572
1555 /* Default send parameters. */ 1573 /* Default send parameters. */
1556 __u16 default_stream; 1574 __u16 default_stream;
@@ -1708,6 +1726,8 @@ void sctp_association_free(struct sctp_association *);
1708void sctp_association_put(struct sctp_association *); 1726void sctp_association_put(struct sctp_association *);
1709void sctp_association_hold(struct sctp_association *); 1727void sctp_association_hold(struct sctp_association *);
1710 1728
1729struct sctp_transport *sctp_assoc_choose_init_transport(
1730 struct sctp_association *);
1711struct sctp_transport *sctp_assoc_choose_shutdown_transport( 1731struct sctp_transport *sctp_assoc_choose_shutdown_transport(
1712 struct sctp_association *); 1732 struct sctp_association *);
1713void sctp_assoc_update_retran_path(struct sctp_association *); 1733void sctp_assoc_update_retran_path(struct sctp_association *);
@@ -1717,9 +1737,12 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
1717 const union sctp_addr *laddr); 1737 const union sctp_addr *laddr);
1718struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *, 1738struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *,
1719 const union sctp_addr *address, 1739 const union sctp_addr *address,
1720 const int gfp); 1740 const int gfp,
1741 const int peer_state);
1721void sctp_assoc_del_peer(struct sctp_association *asoc, 1742void sctp_assoc_del_peer(struct sctp_association *asoc,
1722 const union sctp_addr *addr); 1743 const union sctp_addr *addr);
1744void sctp_assoc_rm_peer(struct sctp_association *asoc,
1745 struct sctp_transport *peer);
1723void sctp_assoc_control_transport(struct sctp_association *, 1746void sctp_assoc_control_transport(struct sctp_association *,
1724 struct sctp_transport *, 1747 struct sctp_transport *,
1725 sctp_transport_cmd_t, sctp_sn_error_t); 1748 sctp_transport_cmd_t, sctp_sn_error_t);
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 2758e8ce4f25..f6328aeddcce 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -111,6 +111,8 @@ enum sctp_optname {
111#define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM 111#define SCTP_GET_LOCAL_ADDRS_NUM SCTP_GET_LOCAL_ADDRS_NUM
112 SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */ 112 SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */
113#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS 113#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS
114 SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
115#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX
114}; 116};
115 117
116/* 118/*
@@ -527,6 +529,7 @@ struct sctp_paddrinfo {
527enum sctp_spinfo_state { 529enum sctp_spinfo_state {
528 SCTP_INACTIVE, 530 SCTP_INACTIVE,
529 SCTP_ACTIVE, 531 SCTP_ACTIVE,
532 SCTP_UNKNOWN = 0xffff /* Value used for transport state unknown */
530}; 533};
531 534
532/* 535/*
diff --git a/include/net/snmp.h b/include/net/snmp.h
index a15ab256276e..a36bed8ea210 100644
--- a/include/net/snmp.h
+++ b/include/net/snmp.h
@@ -128,18 +128,18 @@ struct linux_mib {
128#define SNMP_STAT_USRPTR(name) (name[1]) 128#define SNMP_STAT_USRPTR(name) (name[1])
129 129
130#define SNMP_INC_STATS_BH(mib, field) \ 130#define SNMP_INC_STATS_BH(mib, field) \
131 (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field]++) 131 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++)
132#define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \ 132#define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \
133 (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field + (offset)]++) 133 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field + (offset)]++)
134#define SNMP_INC_STATS_USER(mib, field) \ 134#define SNMP_INC_STATS_USER(mib, field) \
135 (per_cpu_ptr(mib[1], _smp_processor_id())->mibs[field]++) 135 (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field]++)
136#define SNMP_INC_STATS(mib, field) \ 136#define SNMP_INC_STATS(mib, field) \
137 (per_cpu_ptr(mib[!in_softirq()], _smp_processor_id())->mibs[field]++) 137 (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]++)
138#define SNMP_DEC_STATS(mib, field) \ 138#define SNMP_DEC_STATS(mib, field) \
139 (per_cpu_ptr(mib[!in_softirq()], _smp_processor_id())->mibs[field]--) 139 (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]--)
140#define SNMP_ADD_STATS_BH(mib, field, addend) \ 140#define SNMP_ADD_STATS_BH(mib, field, addend) \
141 (per_cpu_ptr(mib[0], _smp_processor_id())->mibs[field] += addend) 141 (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend)
142#define SNMP_ADD_STATS_USER(mib, field, addend) \ 142#define SNMP_ADD_STATS_USER(mib, field, addend) \
143 (per_cpu_ptr(mib[1], _smp_processor_id())->mibs[field] += addend) 143 (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field] += addend)
144 144
145#endif 145#endif
diff --git a/include/net/sock.h b/include/net/sock.h
index a9ef3a6a13f3..e593af5b1ecc 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -484,6 +484,8 @@ extern void sk_stream_kill_queues(struct sock *sk);
484 484
485extern int sk_wait_data(struct sock *sk, long *timeo); 485extern int sk_wait_data(struct sock *sk, long *timeo);
486 486
487struct request_sock_ops;
488
487/* Networking protocol blocks we attach to sockets. 489/* Networking protocol blocks we attach to sockets.
488 * socket layer -> transport layer interface 490 * socket layer -> transport layer interface
489 * transport -> network interface is defined by struct inet_proto 491 * transport -> network interface is defined by struct inet_proto
@@ -547,6 +549,8 @@ struct proto {
547 kmem_cache_t *slab; 549 kmem_cache_t *slab;
548 unsigned int obj_size; 550 unsigned int obj_size;
549 551
552 struct request_sock_ops *rsk_prot;
553
550 struct module *owner; 554 struct module *owner;
551 555
552 char name[32]; 556 char name[32];
diff --git a/include/net/tcp.h b/include/net/tcp.h
index e71f8ba3e101..ec9e20c27179 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -31,6 +31,7 @@
31#include <linux/cache.h> 31#include <linux/cache.h>
32#include <linux/percpu.h> 32#include <linux/percpu.h>
33#include <net/checksum.h> 33#include <net/checksum.h>
34#include <net/request_sock.h>
34#include <net/sock.h> 35#include <net/sock.h>
35#include <net/snmp.h> 36#include <net/snmp.h>
36#include <net/ip.h> 37#include <net/ip.h>
@@ -504,25 +505,6 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
504#else 505#else
505# define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG) 506# define TCP_TW_RECYCLE_TICK (12+2-TCP_TW_RECYCLE_SLOTS_LOG)
506#endif 507#endif
507
508#define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation
509 * max_cwnd = snd_cwnd * beta
510 */
511#define BICTCP_MAX_INCREMENT 32 /*
512 * Limit on the amount of
513 * increment allowed during
514 * binary search.
515 */
516#define BICTCP_FUNC_OF_MIN_INCR 11 /*
517 * log(B/Smin)/log(B/(B-1))+1,
518 * Smin:min increment
519 * B:log factor
520 */
521#define BICTCP_B 4 /*
522 * In binary search,
523 * go to point (max+min)/N
524 */
525
526/* 508/*
527 * TCP option 509 * TCP option
528 */ 510 */
@@ -563,7 +545,6 @@ static __inline__ int tcp_sk_listen_hashfn(struct sock *sk)
563#define TCP_NAGLE_PUSH 4 /* Cork is overriden for already queued data */ 545#define TCP_NAGLE_PUSH 4 /* Cork is overriden for already queued data */
564 546
565/* sysctl variables for tcp */ 547/* sysctl variables for tcp */
566extern int sysctl_max_syn_backlog;
567extern int sysctl_tcp_timestamps; 548extern int sysctl_tcp_timestamps;
568extern int sysctl_tcp_window_scaling; 549extern int sysctl_tcp_window_scaling;
569extern int sysctl_tcp_sack; 550extern int sysctl_tcp_sack;
@@ -596,16 +577,7 @@ extern int sysctl_tcp_adv_win_scale;
596extern int sysctl_tcp_tw_reuse; 577extern int sysctl_tcp_tw_reuse;
597extern int sysctl_tcp_frto; 578extern int sysctl_tcp_frto;
598extern int sysctl_tcp_low_latency; 579extern int sysctl_tcp_low_latency;
599extern int sysctl_tcp_westwood;
600extern int sysctl_tcp_vegas_cong_avoid;
601extern int sysctl_tcp_vegas_alpha;
602extern int sysctl_tcp_vegas_beta;
603extern int sysctl_tcp_vegas_gamma;
604extern int sysctl_tcp_nometrics_save; 580extern int sysctl_tcp_nometrics_save;
605extern int sysctl_tcp_bic;
606extern int sysctl_tcp_bic_fast_convergence;
607extern int sysctl_tcp_bic_low_window;
608extern int sysctl_tcp_bic_beta;
609extern int sysctl_tcp_moderate_rcvbuf; 581extern int sysctl_tcp_moderate_rcvbuf;
610extern int sysctl_tcp_tso_win_divisor; 582extern int sysctl_tcp_tso_win_divisor;
611 583
@@ -613,74 +585,6 @@ extern atomic_t tcp_memory_allocated;
613extern atomic_t tcp_sockets_allocated; 585extern atomic_t tcp_sockets_allocated;
614extern int tcp_memory_pressure; 586extern int tcp_memory_pressure;
615 587
616struct open_request;
617
618struct or_calltable {
619 int family;
620 int (*rtx_syn_ack) (struct sock *sk, struct open_request *req, struct dst_entry*);
621 void (*send_ack) (struct sk_buff *skb, struct open_request *req);
622 void (*destructor) (struct open_request *req);
623 void (*send_reset) (struct sk_buff *skb);
624};
625
626struct tcp_v4_open_req {
627 __u32 loc_addr;
628 __u32 rmt_addr;
629 struct ip_options *opt;
630};
631
632#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
633struct tcp_v6_open_req {
634 struct in6_addr loc_addr;
635 struct in6_addr rmt_addr;
636 struct sk_buff *pktopts;
637 int iif;
638};
639#endif
640
641/* this structure is too big */
642struct open_request {
643 struct open_request *dl_next; /* Must be first member! */
644 __u32 rcv_isn;
645 __u32 snt_isn;
646 __u16 rmt_port;
647 __u16 mss;
648 __u8 retrans;
649 __u8 __pad;
650 __u16 snd_wscale : 4,
651 rcv_wscale : 4,
652 tstamp_ok : 1,
653 sack_ok : 1,
654 wscale_ok : 1,
655 ecn_ok : 1,
656 acked : 1;
657 /* The following two fields can be easily recomputed I think -AK */
658 __u32 window_clamp; /* window clamp at creation time */
659 __u32 rcv_wnd; /* rcv_wnd offered first time */
660 __u32 ts_recent;
661 unsigned long expires;
662 struct or_calltable *class;
663 struct sock *sk;
664 union {
665 struct tcp_v4_open_req v4_req;
666#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
667 struct tcp_v6_open_req v6_req;
668#endif
669 } af;
670};
671
672/* SLAB cache for open requests. */
673extern kmem_cache_t *tcp_openreq_cachep;
674
675#define tcp_openreq_alloc() kmem_cache_alloc(tcp_openreq_cachep, SLAB_ATOMIC)
676#define tcp_openreq_fastfree(req) kmem_cache_free(tcp_openreq_cachep, req)
677
678static inline void tcp_openreq_free(struct open_request *req)
679{
680 req->class->destructor(req);
681 tcp_openreq_fastfree(req);
682}
683
684#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 588#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
685#define TCP_INET_FAMILY(fam) ((fam) == AF_INET) 589#define TCP_INET_FAMILY(fam) ((fam) == AF_INET)
686#else 590#else
@@ -708,7 +612,7 @@ struct tcp_func {
708 612
709 struct sock * (*syn_recv_sock) (struct sock *sk, 613 struct sock * (*syn_recv_sock) (struct sock *sk,
710 struct sk_buff *skb, 614 struct sk_buff *skb,
711 struct open_request *req, 615 struct request_sock *req,
712 struct dst_entry *dst); 616 struct dst_entry *dst);
713 617
714 int (*remember_stamp) (struct sock *sk); 618 int (*remember_stamp) (struct sock *sk);
@@ -852,8 +756,8 @@ extern enum tcp_tw_status tcp_timewait_state_process(struct tcp_tw_bucket *tw,
852 unsigned len); 756 unsigned len);
853 757
854extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, 758extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb,
855 struct open_request *req, 759 struct request_sock *req,
856 struct open_request **prev); 760 struct request_sock **prev);
857extern int tcp_child_process(struct sock *parent, 761extern int tcp_child_process(struct sock *parent,
858 struct sock *child, 762 struct sock *child,
859 struct sk_buff *skb); 763 struct sk_buff *skb);
@@ -903,12 +807,12 @@ extern int tcp_v4_conn_request(struct sock *sk,
903 struct sk_buff *skb); 807 struct sk_buff *skb);
904 808
905extern struct sock * tcp_create_openreq_child(struct sock *sk, 809extern struct sock * tcp_create_openreq_child(struct sock *sk,
906 struct open_request *req, 810 struct request_sock *req,
907 struct sk_buff *skb); 811 struct sk_buff *skb);
908 812
909extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, 813extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk,
910 struct sk_buff *skb, 814 struct sk_buff *skb,
911 struct open_request *req, 815 struct request_sock *req,
912 struct dst_entry *dst); 816 struct dst_entry *dst);
913 817
914extern int tcp_v4_do_rcv(struct sock *sk, 818extern int tcp_v4_do_rcv(struct sock *sk,
@@ -922,7 +826,7 @@ extern int tcp_connect(struct sock *sk);
922 826
923extern struct sk_buff * tcp_make_synack(struct sock *sk, 827extern struct sk_buff * tcp_make_synack(struct sock *sk,
924 struct dst_entry *dst, 828 struct dst_entry *dst,
925 struct open_request *req); 829 struct request_sock *req);
926 830
927extern int tcp_disconnect(struct sock *sk, int flags); 831extern int tcp_disconnect(struct sock *sk, int flags);
928 832
@@ -1204,6 +1108,82 @@ static inline void tcp_packets_out_dec(struct tcp_sock *tp,
1204 tp->packets_out -= tcp_skb_pcount(skb); 1108 tp->packets_out -= tcp_skb_pcount(skb);
1205} 1109}
1206 1110
1111/* Events passed to congestion control interface */
1112enum tcp_ca_event {
1113 CA_EVENT_TX_START, /* first transmit when no packets in flight */
1114 CA_EVENT_CWND_RESTART, /* congestion window restart */
1115 CA_EVENT_COMPLETE_CWR, /* end of congestion recovery */
1116 CA_EVENT_FRTO, /* fast recovery timeout */
1117 CA_EVENT_LOSS, /* loss timeout */
1118 CA_EVENT_FAST_ACK, /* in sequence ack */
1119 CA_EVENT_SLOW_ACK, /* other ack */
1120};
1121
1122/*
1123 * Interface for adding new TCP congestion control handlers
1124 */
1125#define TCP_CA_NAME_MAX 16
1126struct tcp_congestion_ops {
1127 struct list_head list;
1128
1129 /* initialize private data (optional) */
1130 void (*init)(struct tcp_sock *tp);
1131 /* cleanup private data (optional) */
1132 void (*release)(struct tcp_sock *tp);
1133
1134 /* return slow start threshold (required) */
1135 u32 (*ssthresh)(struct tcp_sock *tp);
1136 /* lower bound for congestion window (optional) */
1137 u32 (*min_cwnd)(struct tcp_sock *tp);
1138 /* do new cwnd calculation (required) */
1139 void (*cong_avoid)(struct tcp_sock *tp, u32 ack,
1140 u32 rtt, u32 in_flight, int good_ack);
1141 /* round trip time sample per acked packet (optional) */
1142 void (*rtt_sample)(struct tcp_sock *tp, u32 usrtt);
1143 /* call before changing ca_state (optional) */
1144 void (*set_state)(struct tcp_sock *tp, u8 new_state);
1145 /* call when cwnd event occurs (optional) */
1146 void (*cwnd_event)(struct tcp_sock *tp, enum tcp_ca_event ev);
1147 /* new value of cwnd after loss (optional) */
1148 u32 (*undo_cwnd)(struct tcp_sock *tp);
1149 /* hook for packet ack accounting (optional) */
1150 void (*pkts_acked)(struct tcp_sock *tp, u32 num_acked);
1151 /* get info for tcp_diag (optional) */
1152 void (*get_info)(struct tcp_sock *tp, u32 ext, struct sk_buff *skb);
1153
1154 char name[TCP_CA_NAME_MAX];
1155 struct module *owner;
1156};
1157
1158extern int tcp_register_congestion_control(struct tcp_congestion_ops *type);
1159extern void tcp_unregister_congestion_control(struct tcp_congestion_ops *type);
1160
1161extern void tcp_init_congestion_control(struct tcp_sock *tp);
1162extern void tcp_cleanup_congestion_control(struct tcp_sock *tp);
1163extern int tcp_set_default_congestion_control(const char *name);
1164extern void tcp_get_default_congestion_control(char *name);
1165extern int tcp_set_congestion_control(struct tcp_sock *tp, const char *name);
1166
1167extern struct tcp_congestion_ops tcp_init_congestion_ops;
1168extern u32 tcp_reno_ssthresh(struct tcp_sock *tp);
1169extern void tcp_reno_cong_avoid(struct tcp_sock *tp, u32 ack,
1170 u32 rtt, u32 in_flight, int flag);
1171extern u32 tcp_reno_min_cwnd(struct tcp_sock *tp);
1172extern struct tcp_congestion_ops tcp_reno;
1173
1174static inline void tcp_set_ca_state(struct tcp_sock *tp, u8 ca_state)
1175{
1176 if (tp->ca_ops->set_state)
1177 tp->ca_ops->set_state(tp, ca_state);
1178 tp->ca_state = ca_state;
1179}
1180
1181static inline void tcp_ca_event(struct tcp_sock *tp, enum tcp_ca_event event)
1182{
1183 if (tp->ca_ops->cwnd_event)
1184 tp->ca_ops->cwnd_event(tp, event);
1185}
1186
1207/* This determines how many packets are "in the network" to the best 1187/* This determines how many packets are "in the network" to the best
1208 * of our knowledge. In many cases it is conservative, but where 1188 * of our knowledge. In many cases it is conservative, but where
1209 * detailed information is available from the receiver (via SACK 1189 * detailed information is available from the receiver (via SACK
@@ -1223,91 +1203,6 @@ static __inline__ unsigned int tcp_packets_in_flight(const struct tcp_sock *tp)
1223 return (tp->packets_out - tp->left_out + tp->retrans_out); 1203 return (tp->packets_out - tp->left_out + tp->retrans_out);
1224} 1204}
1225 1205
1226/*
1227 * Which congestion algorithim is in use on the connection.
1228 */
1229#define tcp_is_vegas(__tp) ((__tp)->adv_cong == TCP_VEGAS)
1230#define tcp_is_westwood(__tp) ((__tp)->adv_cong == TCP_WESTWOOD)
1231#define tcp_is_bic(__tp) ((__tp)->adv_cong == TCP_BIC)
1232
1233/* Recalculate snd_ssthresh, we want to set it to:
1234 *
1235 * Reno:
1236 * one half the current congestion window, but no
1237 * less than two segments
1238 *
1239 * BIC:
1240 * behave like Reno until low_window is reached,
1241 * then increase congestion window slowly
1242 */
1243static inline __u32 tcp_recalc_ssthresh(struct tcp_sock *tp)
1244{
1245 if (tcp_is_bic(tp)) {
1246 if (sysctl_tcp_bic_fast_convergence &&
1247 tp->snd_cwnd < tp->bictcp.last_max_cwnd)
1248 tp->bictcp.last_max_cwnd = (tp->snd_cwnd *
1249 (BICTCP_BETA_SCALE
1250 + sysctl_tcp_bic_beta))
1251 / (2 * BICTCP_BETA_SCALE);
1252 else
1253 tp->bictcp.last_max_cwnd = tp->snd_cwnd;
1254
1255 if (tp->snd_cwnd > sysctl_tcp_bic_low_window)
1256 return max((tp->snd_cwnd * sysctl_tcp_bic_beta)
1257 / BICTCP_BETA_SCALE, 2U);
1258 }
1259
1260 return max(tp->snd_cwnd >> 1U, 2U);
1261}
1262
1263/* Stop taking Vegas samples for now. */
1264#define tcp_vegas_disable(__tp) ((__tp)->vegas.doing_vegas_now = 0)
1265
1266static inline void tcp_vegas_enable(struct tcp_sock *tp)
1267{
1268 /* There are several situations when we must "re-start" Vegas:
1269 *
1270 * o when a connection is established
1271 * o after an RTO
1272 * o after fast recovery
1273 * o when we send a packet and there is no outstanding
1274 * unacknowledged data (restarting an idle connection)
1275 *
1276 * In these circumstances we cannot do a Vegas calculation at the
1277 * end of the first RTT, because any calculation we do is using
1278 * stale info -- both the saved cwnd and congestion feedback are
1279 * stale.
1280 *
1281 * Instead we must wait until the completion of an RTT during
1282 * which we actually receive ACKs.
1283 */
1284
1285 /* Begin taking Vegas samples next time we send something. */
1286 tp->vegas.doing_vegas_now = 1;
1287
1288 /* Set the beginning of the next send window. */
1289 tp->vegas.beg_snd_nxt = tp->snd_nxt;
1290
1291 tp->vegas.cntRTT = 0;
1292 tp->vegas.minRTT = 0x7fffffff;
1293}
1294
1295/* Should we be taking Vegas samples right now? */
1296#define tcp_vegas_enabled(__tp) ((__tp)->vegas.doing_vegas_now)
1297
1298extern void tcp_ca_init(struct tcp_sock *tp);
1299
1300static inline void tcp_set_ca_state(struct tcp_sock *tp, u8 ca_state)
1301{
1302 if (tcp_is_vegas(tp)) {
1303 if (ca_state == TCP_CA_Open)
1304 tcp_vegas_enable(tp);
1305 else
1306 tcp_vegas_disable(tp);
1307 }
1308 tp->ca_state = ca_state;
1309}
1310
1311/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd. 1206/* If cwnd > ssthresh, we may raise ssthresh to be half-way to cwnd.
1312 * The exception is rate halving phase, when cwnd is decreasing towards 1207 * The exception is rate halving phase, when cwnd is decreasing towards
1313 * ssthresh. 1208 * ssthresh.
@@ -1356,7 +1251,7 @@ static inline void tcp_cwnd_validate(struct sock *sk, struct tcp_sock *tp)
1356static inline void __tcp_enter_cwr(struct tcp_sock *tp) 1251static inline void __tcp_enter_cwr(struct tcp_sock *tp)
1357{ 1252{
1358 tp->undo_marker = 0; 1253 tp->undo_marker = 0;
1359 tp->snd_ssthresh = tcp_recalc_ssthresh(tp); 1254 tp->snd_ssthresh = tp->ca_ops->ssthresh(tp);
1360 tp->snd_cwnd = min(tp->snd_cwnd, 1255 tp->snd_cwnd = min(tp->snd_cwnd,
1361 tcp_packets_in_flight(tp) + 1U); 1256 tcp_packets_in_flight(tp) + 1U);
1362 tp->snd_cwnd_cnt = 0; 1257 tp->snd_cwnd_cnt = 0;
@@ -1750,99 +1645,71 @@ static inline int tcp_full_space(const struct sock *sk)
1750 return tcp_win_from_space(sk->sk_rcvbuf); 1645 return tcp_win_from_space(sk->sk_rcvbuf);
1751} 1646}
1752 1647
1753static inline void tcp_acceptq_queue(struct sock *sk, struct open_request *req, 1648static inline void tcp_acceptq_queue(struct sock *sk, struct request_sock *req,
1754 struct sock *child) 1649 struct sock *child)
1755{ 1650{
1756 struct tcp_sock *tp = tcp_sk(sk); 1651 reqsk_queue_add(&tcp_sk(sk)->accept_queue, req, sk, child);
1757
1758 req->sk = child;
1759 sk_acceptq_added(sk);
1760
1761 if (!tp->accept_queue_tail) {
1762 tp->accept_queue = req;
1763 } else {
1764 tp->accept_queue_tail->dl_next = req;
1765 }
1766 tp->accept_queue_tail = req;
1767 req->dl_next = NULL;
1768} 1652}
1769 1653
1770struct tcp_listen_opt
1771{
1772 u8 max_qlen_log; /* log_2 of maximal queued SYNs */
1773 int qlen;
1774 int qlen_young;
1775 int clock_hand;
1776 u32 hash_rnd;
1777 struct open_request *syn_table[TCP_SYNQ_HSIZE];
1778};
1779
1780static inline void 1654static inline void
1781tcp_synq_removed(struct sock *sk, struct open_request *req) 1655tcp_synq_removed(struct sock *sk, struct request_sock *req)
1782{ 1656{
1783 struct tcp_listen_opt *lopt = tcp_sk(sk)->listen_opt; 1657 if (reqsk_queue_removed(&tcp_sk(sk)->accept_queue, req) == 0)
1784
1785 if (--lopt->qlen == 0)
1786 tcp_delete_keepalive_timer(sk); 1658 tcp_delete_keepalive_timer(sk);
1787 if (req->retrans == 0)
1788 lopt->qlen_young--;
1789} 1659}
1790 1660
1791static inline void tcp_synq_added(struct sock *sk) 1661static inline void tcp_synq_added(struct sock *sk)
1792{ 1662{
1793 struct tcp_listen_opt *lopt = tcp_sk(sk)->listen_opt; 1663 if (reqsk_queue_added(&tcp_sk(sk)->accept_queue) == 0)
1794
1795 if (lopt->qlen++ == 0)
1796 tcp_reset_keepalive_timer(sk, TCP_TIMEOUT_INIT); 1664 tcp_reset_keepalive_timer(sk, TCP_TIMEOUT_INIT);
1797 lopt->qlen_young++;
1798} 1665}
1799 1666
1800static inline int tcp_synq_len(struct sock *sk) 1667static inline int tcp_synq_len(struct sock *sk)
1801{ 1668{
1802 return tcp_sk(sk)->listen_opt->qlen; 1669 return reqsk_queue_len(&tcp_sk(sk)->accept_queue);
1803} 1670}
1804 1671
1805static inline int tcp_synq_young(struct sock *sk) 1672static inline int tcp_synq_young(struct sock *sk)
1806{ 1673{
1807 return tcp_sk(sk)->listen_opt->qlen_young; 1674 return reqsk_queue_len_young(&tcp_sk(sk)->accept_queue);
1808} 1675}
1809 1676
1810static inline int tcp_synq_is_full(struct sock *sk) 1677static inline int tcp_synq_is_full(struct sock *sk)
1811{ 1678{
1812 return tcp_synq_len(sk) >> tcp_sk(sk)->listen_opt->max_qlen_log; 1679 return reqsk_queue_is_full(&tcp_sk(sk)->accept_queue);
1813} 1680}
1814 1681
1815static inline void tcp_synq_unlink(struct tcp_sock *tp, struct open_request *req, 1682static inline void tcp_synq_unlink(struct tcp_sock *tp, struct request_sock *req,
1816 struct open_request **prev) 1683 struct request_sock **prev)
1817{ 1684{
1818 write_lock(&tp->syn_wait_lock); 1685 reqsk_queue_unlink(&tp->accept_queue, req, prev);
1819 *prev = req->dl_next;
1820 write_unlock(&tp->syn_wait_lock);
1821} 1686}
1822 1687
1823static inline void tcp_synq_drop(struct sock *sk, struct open_request *req, 1688static inline void tcp_synq_drop(struct sock *sk, struct request_sock *req,
1824 struct open_request **prev) 1689 struct request_sock **prev)
1825{ 1690{
1826 tcp_synq_unlink(tcp_sk(sk), req, prev); 1691 tcp_synq_unlink(tcp_sk(sk), req, prev);
1827 tcp_synq_removed(sk, req); 1692 tcp_synq_removed(sk, req);
1828 tcp_openreq_free(req); 1693 reqsk_free(req);
1829} 1694}
1830 1695
1831static __inline__ void tcp_openreq_init(struct open_request *req, 1696static __inline__ void tcp_openreq_init(struct request_sock *req,
1832 struct tcp_options_received *rx_opt, 1697 struct tcp_options_received *rx_opt,
1833 struct sk_buff *skb) 1698 struct sk_buff *skb)
1834{ 1699{
1700 struct inet_request_sock *ireq = inet_rsk(req);
1701
1835 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */ 1702 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */
1836 req->rcv_isn = TCP_SKB_CB(skb)->seq; 1703 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
1837 req->mss = rx_opt->mss_clamp; 1704 req->mss = rx_opt->mss_clamp;
1838 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0; 1705 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;
1839 req->tstamp_ok = rx_opt->tstamp_ok; 1706 ireq->tstamp_ok = rx_opt->tstamp_ok;
1840 req->sack_ok = rx_opt->sack_ok; 1707 ireq->sack_ok = rx_opt->sack_ok;
1841 req->snd_wscale = rx_opt->snd_wscale; 1708 ireq->snd_wscale = rx_opt->snd_wscale;
1842 req->wscale_ok = rx_opt->wscale_ok; 1709 ireq->wscale_ok = rx_opt->wscale_ok;
1843 req->acked = 0; 1710 ireq->acked = 0;
1844 req->ecn_ok = 0; 1711 ireq->ecn_ok = 0;
1845 req->rmt_port = skb->h.th->source; 1712 ireq->rmt_port = skb->h.th->source;
1846} 1713}
1847 1714
1848extern void tcp_enter_memory_pressure(void); 1715extern void tcp_enter_memory_pressure(void);
@@ -1972,52 +1839,4 @@ struct tcp_iter_state {
1972extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo); 1839extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo);
1973extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo); 1840extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo);
1974 1841
1975/* TCP Westwood functions and constants */
1976
1977#define TCP_WESTWOOD_INIT_RTT (20*HZ) /* maybe too conservative?! */
1978#define TCP_WESTWOOD_RTT_MIN (HZ/20) /* 50ms */
1979
1980static inline void tcp_westwood_update_rtt(struct tcp_sock *tp, __u32 rtt_seq)
1981{
1982 if (tcp_is_westwood(tp))
1983 tp->westwood.rtt = rtt_seq;
1984}
1985
1986static inline __u32 __tcp_westwood_bw_rttmin(const struct tcp_sock *tp)
1987{
1988 return max((tp->westwood.bw_est) * (tp->westwood.rtt_min) /
1989 (__u32) (tp->mss_cache_std),
1990 2U);
1991}
1992
1993static inline __u32 tcp_westwood_bw_rttmin(const struct tcp_sock *tp)
1994{
1995 return tcp_is_westwood(tp) ? __tcp_westwood_bw_rttmin(tp) : 0;
1996}
1997
1998static inline int tcp_westwood_ssthresh(struct tcp_sock *tp)
1999{
2000 __u32 ssthresh = 0;
2001
2002 if (tcp_is_westwood(tp)) {
2003 ssthresh = __tcp_westwood_bw_rttmin(tp);
2004 if (ssthresh)
2005 tp->snd_ssthresh = ssthresh;
2006 }
2007
2008 return (ssthresh != 0);
2009}
2010
2011static inline int tcp_westwood_cwnd(struct tcp_sock *tp)
2012{
2013 __u32 cwnd = 0;
2014
2015 if (tcp_is_westwood(tp)) {
2016 cwnd = __tcp_westwood_bw_rttmin(tp);
2017 if (cwnd)
2018 tp->snd_cwnd = cwnd;
2019 }
2020
2021 return (cwnd != 0);
2022}
2023#endif /* _TCP_H */ 1842#endif /* _TCP_H */
diff --git a/include/net/tcp_ecn.h b/include/net/tcp_ecn.h
index dc1456389a97..64980ee8c92a 100644
--- a/include/net/tcp_ecn.h
+++ b/include/net/tcp_ecn.h
@@ -2,6 +2,7 @@
2#define _NET_TCP_ECN_H_ 1 2#define _NET_TCP_ECN_H_ 1
3 3
4#include <net/inet_ecn.h> 4#include <net/inet_ecn.h>
5#include <net/request_sock.h>
5 6
6#define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH)) 7#define TCP_HP_BITS (~(TCP_RESERVED_BITS|TCP_FLAG_PSH))
7 8
@@ -38,9 +39,9 @@ static inline void TCP_ECN_send_syn(struct sock *sk, struct tcp_sock *tp,
38} 39}
39 40
40static __inline__ void 41static __inline__ void
41TCP_ECN_make_synack(struct open_request *req, struct tcphdr *th) 42TCP_ECN_make_synack(struct request_sock *req, struct tcphdr *th)
42{ 43{
43 if (req->ecn_ok) 44 if (inet_rsk(req)->ecn_ok)
44 th->ece = 1; 45 th->ece = 1;
45} 46}
46 47
@@ -111,16 +112,16 @@ static inline int TCP_ECN_rcv_ecn_echo(struct tcp_sock *tp, struct tcphdr *th)
111} 112}
112 113
113static inline void TCP_ECN_openreq_child(struct tcp_sock *tp, 114static inline void TCP_ECN_openreq_child(struct tcp_sock *tp,
114 struct open_request *req) 115 struct request_sock *req)
115{ 116{
116 tp->ecn_flags = req->ecn_ok ? TCP_ECN_OK : 0; 117 tp->ecn_flags = inet_rsk(req)->ecn_ok ? TCP_ECN_OK : 0;
117} 118}
118 119
119static __inline__ void 120static __inline__ void
120TCP_ECN_create_request(struct open_request *req, struct tcphdr *th) 121TCP_ECN_create_request(struct request_sock *req, struct tcphdr *th)
121{ 122{
122 if (sysctl_tcp_ecn && th->ece && th->cwr) 123 if (sysctl_tcp_ecn && th->ece && th->cwr)
123 req->ecn_ok = 1; 124 inet_rsk(req)->ecn_ok = 1;
124} 125}
125 126
126#endif 127#endif
diff --git a/include/net/x25.h b/include/net/x25.h
index 7a1ba5bbb868..8b39b98876e8 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -79,6 +79,8 @@ enum {
79#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */ 79#define X25_DEFAULT_PACKET_SIZE X25_PS128 /* Default Packet Size */
80#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */ 80#define X25_DEFAULT_THROUGHPUT 0x0A /* Deafult Throughput */
81#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */ 81#define X25_DEFAULT_REVERSE 0x00 /* Default Reverse Charging */
82#define X25_DENY_ACCPT_APPRV 0x01 /* Default value */
83#define X25_ALLOW_ACCPT_APPRV 0x00 /* Control enabled */
82 84
83#define X25_SMODULUS 8 85#define X25_SMODULUS 8
84#define X25_EMODULUS 128 86#define X25_EMODULUS 128
@@ -94,7 +96,7 @@ enum {
94#define X25_FAC_CLASS_C 0x80 96#define X25_FAC_CLASS_C 0x80
95#define X25_FAC_CLASS_D 0xC0 97#define X25_FAC_CLASS_D 0xC0
96 98
97#define X25_FAC_REVERSE 0x01 99#define X25_FAC_REVERSE 0x01 /* also fast select */
98#define X25_FAC_THROUGHPUT 0x02 100#define X25_FAC_THROUGHPUT 0x02
99#define X25_FAC_PACKET_SIZE 0x42 101#define X25_FAC_PACKET_SIZE 0x42
100#define X25_FAC_WINDOW_SIZE 0x43 102#define X25_FAC_WINDOW_SIZE 0x43
@@ -134,8 +136,8 @@ struct x25_sock {
134 struct sock sk; 136 struct sock sk;
135 struct x25_address source_addr, dest_addr; 137 struct x25_address source_addr, dest_addr;
136 struct x25_neigh *neighbour; 138 struct x25_neigh *neighbour;
137 unsigned int lci; 139 unsigned int lci, cudmatchlength;
138 unsigned char state, condition, qbitincl, intflag; 140 unsigned char state, condition, qbitincl, intflag, accptapprv;
139 unsigned short vs, vr, va, vl; 141 unsigned short vs, vr, va, vl;
140 unsigned long t2, t21, t22, t23; 142 unsigned long t2, t21, t22, t23;
141 unsigned short fraglen; 143 unsigned short fraglen;
@@ -242,7 +244,6 @@ extern int x25_validate_nr(struct sock *, unsigned short);
242extern void x25_write_internal(struct sock *, int); 244extern void x25_write_internal(struct sock *, int);
243extern int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *, int *); 245extern int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *, int *);
244extern void x25_disconnect(struct sock *, int, unsigned char, unsigned char); 246extern void x25_disconnect(struct sock *, int, unsigned char, unsigned char);
245extern int x25_check_calluserdata(struct x25_calluserdata *,struct x25_calluserdata *);
246 247
247/* x25_timer.c */ 248/* x25_timer.c */
248extern void x25_start_heartbeat(struct sock *); 249extern void x25_start_heartbeat(struct sock *);
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index d675836ba6c3..029522a4ceda 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -158,6 +158,20 @@ enum {
158 XFRM_STATE_DEAD 158 XFRM_STATE_DEAD
159}; 159};
160 160
161/* callback structure passed from either netlink or pfkey */
162struct km_event
163{
164 union {
165 u32 hard;
166 u32 proto;
167 u32 byid;
168 } data;
169
170 u32 seq;
171 u32 pid;
172 u32 event;
173};
174
161struct xfrm_type; 175struct xfrm_type;
162struct xfrm_dst; 176struct xfrm_dst;
163struct xfrm_policy_afinfo { 177struct xfrm_policy_afinfo {
@@ -179,6 +193,8 @@ struct xfrm_policy_afinfo {
179 193
180extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); 194extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo);
181extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); 195extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo);
196extern void km_policy_notify(struct xfrm_policy *xp, int dir, struct km_event *c);
197extern void km_state_notify(struct xfrm_state *x, struct km_event *c);
182 198
183#define XFRM_ACQ_EXPIRES 30 199#define XFRM_ACQ_EXPIRES 30
184 200
@@ -188,6 +204,7 @@ struct xfrm_state_afinfo {
188 rwlock_t lock; 204 rwlock_t lock;
189 struct list_head *state_bydst; 205 struct list_head *state_bydst;
190 struct list_head *state_byspi; 206 struct list_head *state_byspi;
207 int (*init_flags)(struct xfrm_state *x);
191 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, 208 void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl,
192 struct xfrm_tmpl *tmpl, 209 struct xfrm_tmpl *tmpl,
193 xfrm_address_t *daddr, xfrm_address_t *saddr); 210 xfrm_address_t *daddr, xfrm_address_t *saddr);
@@ -209,7 +226,7 @@ struct xfrm_type
209 struct module *owner; 226 struct module *owner;
210 __u8 proto; 227 __u8 proto;
211 228
212 int (*init_state)(struct xfrm_state *x, void *args); 229 int (*init_state)(struct xfrm_state *x);
213 void (*destructor)(struct xfrm_state *); 230 void (*destructor)(struct xfrm_state *);
214 int (*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); 231 int (*input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb);
215 int (*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb); 232 int (*post_input)(struct xfrm_state *, struct xfrm_decap_state *, struct sk_buff *skb);
@@ -290,11 +307,11 @@ struct xfrm_mgr
290{ 307{
291 struct list_head list; 308 struct list_head list;
292 char *id; 309 char *id;
293 int (*notify)(struct xfrm_state *x, int event); 310 int (*notify)(struct xfrm_state *x, struct km_event *c);
294 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir); 311 int (*acquire)(struct xfrm_state *x, struct xfrm_tmpl *, struct xfrm_policy *xp, int dir);
295 struct xfrm_policy *(*compile_policy)(u16 family, int opt, u8 *data, int len, int *dir); 312 struct xfrm_policy *(*compile_policy)(u16 family, int opt, u8 *data, int len, int *dir);
296 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport); 313 int (*new_mapping)(struct xfrm_state *x, xfrm_address_t *ipaddr, u16 sport);
297 int (*notify_policy)(struct xfrm_policy *x, int dir, int event); 314 int (*notify_policy)(struct xfrm_policy *x, int dir, struct km_event *c);
298}; 315};
299 316
300extern int xfrm_register_km(struct xfrm_mgr *km); 317extern int xfrm_register_km(struct xfrm_mgr *km);
@@ -656,7 +673,7 @@ static inline int xfrm_sk_clone_policy(struct sock *sk)
656 return 0; 673 return 0;
657} 674}
658 675
659extern void xfrm_policy_delete(struct xfrm_policy *pol, int dir); 676extern int xfrm_policy_delete(struct xfrm_policy *pol, int dir);
660 677
661static inline void xfrm_sk_free_policy(struct sock *sk) 678static inline void xfrm_sk_free_policy(struct sock *sk)
662{ 679{
@@ -817,12 +834,13 @@ extern int xfrm_state_add(struct xfrm_state *x);
817extern int xfrm_state_update(struct xfrm_state *x); 834extern int xfrm_state_update(struct xfrm_state *x);
818extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family); 835extern struct xfrm_state *xfrm_state_lookup(xfrm_address_t *daddr, u32 spi, u8 proto, unsigned short family);
819extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq); 836extern struct xfrm_state *xfrm_find_acq_byseq(u32 seq);
820extern void xfrm_state_delete(struct xfrm_state *x); 837extern int xfrm_state_delete(struct xfrm_state *x);
821extern void xfrm_state_flush(u8 proto); 838extern void xfrm_state_flush(u8 proto);
822extern int xfrm_replay_check(struct xfrm_state *x, u32 seq); 839extern int xfrm_replay_check(struct xfrm_state *x, u32 seq);
823extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq); 840extern void xfrm_replay_advance(struct xfrm_state *x, u32 seq);
824extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb); 841extern int xfrm_state_check(struct xfrm_state *x, struct sk_buff *skb);
825extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 842extern int xfrm_state_mtu(struct xfrm_state *x, int mtu);
843extern int xfrm_init_state(struct xfrm_state *x);
826extern int xfrm4_rcv(struct sk_buff *skb); 844extern int xfrm4_rcv(struct sk_buff *skb);
827extern int xfrm4_output(struct sk_buff *skb); 845extern int xfrm4_output(struct sk_buff *skb);
828extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler); 846extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler);