diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-29 06:54:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-01-29 06:54:01 -0500 |
commit | 0ba6c33bcddc64a54b5f1c25a696c4767dc76292 (patch) | |
tree | 62e616f97a4762d8e75bf732e4827af2d15d52c5 /include | |
parent | 21af0297c7e56024a5ccc4d8ad2a590f9ec371ba (diff) | |
parent | 85040bcb4643cba578839e953f25e2d1965d83d0 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.25: (1470 commits)
[IPV6] ADDRLABEL: Fix double free on label deletion.
[PPP]: Sparse warning fixes.
[IPV4] fib_trie: remove unneeded NULL check
[IPV4] fib_trie: More whitespace cleanup.
[NET_SCHED]: Use nla_policy for attribute validation in ematches
[NET_SCHED]: Use nla_policy for attribute validation in actions
[NET_SCHED]: Use nla_policy for attribute validation in classifiers
[NET_SCHED]: Use nla_policy for attribute validation in packet schedulers
[NET_SCHED]: sch_api: introduce constant for rate table size
[NET_SCHED]: Use typeful attribute parsing helpers
[NET_SCHED]: Use typeful attribute construction helpers
[NET_SCHED]: Use NLA_PUT_STRING for string dumping
[NET_SCHED]: Use nla_nest_start/nla_nest_end
[NET_SCHED]: Propagate nla_parse return value
[NET_SCHED]: act_api: use PTR_ERR in tcf_action_init/tcf_action_get
[NET_SCHED]: act_api: use nlmsg_parse
[NET_SCHED]: act_api: fix netlink API conversion bug
[NET_SCHED]: sch_netem: use nla_parse_nested_compat
[NET_SCHED]: sch_atm: fix format string warning
[NETNS]: Add namespace for ICMP replying code.
...
Diffstat (limited to 'include')
144 files changed, 3699 insertions, 1262 deletions
diff --git a/include/asm-powerpc/pasemi_dma.h b/include/asm-powerpc/pasemi_dma.h new file mode 100644 index 000000000000..b4526ff3a50d --- /dev/null +++ b/include/asm-powerpc/pasemi_dma.h | |||
@@ -0,0 +1,467 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 PA Semi, Inc | ||
3 | * | ||
4 | * Hardware register layout and descriptor formats for the on-board | ||
5 | * DMA engine on PA Semi PWRficient. Used by ethernet, function and security | ||
6 | * drivers. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to the Free Software | ||
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
20 | */ | ||
21 | |||
22 | #ifndef ASM_PASEMI_DMA_H | ||
23 | #define ASM_PASEMI_DMA_H | ||
24 | |||
25 | /* status register layout in IOB region, at 0xfb800000 */ | ||
26 | struct pasdma_status { | ||
27 | u64 rx_sta[64]; /* RX channel status */ | ||
28 | u64 tx_sta[20]; /* TX channel status */ | ||
29 | }; | ||
30 | |||
31 | |||
32 | /* All these registers live in the PCI configuration space for the DMA PCI | ||
33 | * device. Use the normal PCI config access functions for them. | ||
34 | */ | ||
35 | enum { | ||
36 | PAS_DMA_CAP_TXCH = 0x44, /* Transmit Channel Info */ | ||
37 | PAS_DMA_CAP_RXCH = 0x48, /* Transmit Channel Info */ | ||
38 | PAS_DMA_CAP_IFI = 0x4c, /* Interface Info */ | ||
39 | PAS_DMA_COM_TXCMD = 0x100, /* Transmit Command Register */ | ||
40 | PAS_DMA_COM_TXSTA = 0x104, /* Transmit Status Register */ | ||
41 | PAS_DMA_COM_RXCMD = 0x108, /* Receive Command Register */ | ||
42 | PAS_DMA_COM_RXSTA = 0x10c, /* Receive Status Register */ | ||
43 | }; | ||
44 | |||
45 | |||
46 | #define PAS_DMA_CAP_TXCH_TCHN_M 0x00ff0000 /* # of TX channels */ | ||
47 | #define PAS_DMA_CAP_TXCH_TCHN_S 16 | ||
48 | |||
49 | #define PAS_DMA_CAP_RXCH_RCHN_M 0x00ff0000 /* # of RX channels */ | ||
50 | #define PAS_DMA_CAP_RXCH_RCHN_S 16 | ||
51 | |||
52 | #define PAS_DMA_CAP_IFI_IOFF_M 0xff000000 /* Cfg reg for intf pointers */ | ||
53 | #define PAS_DMA_CAP_IFI_IOFF_S 24 | ||
54 | #define PAS_DMA_CAP_IFI_NIN_M 0x00ff0000 /* # of interfaces */ | ||
55 | #define PAS_DMA_CAP_IFI_NIN_S 16 | ||
56 | |||
57 | #define PAS_DMA_COM_TXCMD_EN 0x00000001 /* enable */ | ||
58 | #define PAS_DMA_COM_TXSTA_ACT 0x00000001 /* active */ | ||
59 | #define PAS_DMA_COM_RXCMD_EN 0x00000001 /* enable */ | ||
60 | #define PAS_DMA_COM_RXSTA_ACT 0x00000001 /* active */ | ||
61 | |||
62 | |||
63 | /* Per-interface and per-channel registers */ | ||
64 | #define _PAS_DMA_RXINT_STRIDE 0x20 | ||
65 | #define PAS_DMA_RXINT_RCMDSTA(i) (0x200+(i)*_PAS_DMA_RXINT_STRIDE) | ||
66 | #define PAS_DMA_RXINT_RCMDSTA_EN 0x00000001 | ||
67 | #define PAS_DMA_RXINT_RCMDSTA_ST 0x00000002 | ||
68 | #define PAS_DMA_RXINT_RCMDSTA_MBT 0x00000008 | ||
69 | #define PAS_DMA_RXINT_RCMDSTA_MDR 0x00000010 | ||
70 | #define PAS_DMA_RXINT_RCMDSTA_MOO 0x00000020 | ||
71 | #define PAS_DMA_RXINT_RCMDSTA_MBP 0x00000040 | ||
72 | #define PAS_DMA_RXINT_RCMDSTA_BT 0x00000800 | ||
73 | #define PAS_DMA_RXINT_RCMDSTA_DR 0x00001000 | ||
74 | #define PAS_DMA_RXINT_RCMDSTA_OO 0x00002000 | ||
75 | #define PAS_DMA_RXINT_RCMDSTA_BP 0x00004000 | ||
76 | #define PAS_DMA_RXINT_RCMDSTA_TB 0x00008000 | ||
77 | #define PAS_DMA_RXINT_RCMDSTA_ACT 0x00010000 | ||
78 | #define PAS_DMA_RXINT_RCMDSTA_DROPS_M 0xfffe0000 | ||
79 | #define PAS_DMA_RXINT_RCMDSTA_DROPS_S 17 | ||
80 | #define PAS_DMA_RXINT_CFG(i) (0x204+(i)*_PAS_DMA_RXINT_STRIDE) | ||
81 | #define PAS_DMA_RXINT_CFG_RBP 0x80000000 | ||
82 | #define PAS_DMA_RXINT_CFG_ITRR 0x40000000 | ||
83 | #define PAS_DMA_RXINT_CFG_DHL_M 0x07000000 | ||
84 | #define PAS_DMA_RXINT_CFG_DHL_S 24 | ||
85 | #define PAS_DMA_RXINT_CFG_DHL(x) (((x) << PAS_DMA_RXINT_CFG_DHL_S) & \ | ||
86 | PAS_DMA_RXINT_CFG_DHL_M) | ||
87 | #define PAS_DMA_RXINT_CFG_ITR 0x00400000 | ||
88 | #define PAS_DMA_RXINT_CFG_LW 0x00200000 | ||
89 | #define PAS_DMA_RXINT_CFG_L2 0x00100000 | ||
90 | #define PAS_DMA_RXINT_CFG_HEN 0x00080000 | ||
91 | #define PAS_DMA_RXINT_CFG_WIF 0x00000002 | ||
92 | #define PAS_DMA_RXINT_CFG_WIL 0x00000001 | ||
93 | |||
94 | #define PAS_DMA_RXINT_INCR(i) (0x210+(i)*_PAS_DMA_RXINT_STRIDE) | ||
95 | #define PAS_DMA_RXINT_INCR_INCR_M 0x0000ffff | ||
96 | #define PAS_DMA_RXINT_INCR_INCR_S 0 | ||
97 | #define PAS_DMA_RXINT_INCR_INCR(x) ((x) & 0x0000ffff) | ||
98 | #define PAS_DMA_RXINT_BASEL(i) (0x218+(i)*_PAS_DMA_RXINT_STRIDE) | ||
99 | #define PAS_DMA_RXINT_BASEL_BRBL(x) ((x) & ~0x3f) | ||
100 | #define PAS_DMA_RXINT_BASEU(i) (0x21c+(i)*_PAS_DMA_RXINT_STRIDE) | ||
101 | #define PAS_DMA_RXINT_BASEU_BRBH(x) ((x) & 0xfff) | ||
102 | #define PAS_DMA_RXINT_BASEU_SIZ_M 0x3fff0000 /* # of cache lines worth of buffer ring */ | ||
103 | #define PAS_DMA_RXINT_BASEU_SIZ_S 16 /* 0 = 16K */ | ||
104 | #define PAS_DMA_RXINT_BASEU_SIZ(x) (((x) << PAS_DMA_RXINT_BASEU_SIZ_S) & \ | ||
105 | PAS_DMA_RXINT_BASEU_SIZ_M) | ||
106 | |||
107 | |||
108 | #define _PAS_DMA_TXCHAN_STRIDE 0x20 /* Size per channel */ | ||
109 | #define _PAS_DMA_TXCHAN_TCMDSTA 0x300 /* Command / Status */ | ||
110 | #define _PAS_DMA_TXCHAN_CFG 0x304 /* Configuration */ | ||
111 | #define _PAS_DMA_TXCHAN_DSCRBU 0x308 /* Descriptor BU Allocation */ | ||
112 | #define _PAS_DMA_TXCHAN_INCR 0x310 /* Descriptor increment */ | ||
113 | #define _PAS_DMA_TXCHAN_CNT 0x314 /* Descriptor count/offset */ | ||
114 | #define _PAS_DMA_TXCHAN_BASEL 0x318 /* Descriptor ring base (low) */ | ||
115 | #define _PAS_DMA_TXCHAN_BASEU 0x31c /* (high) */ | ||
116 | #define PAS_DMA_TXCHAN_TCMDSTA(c) (0x300+(c)*_PAS_DMA_TXCHAN_STRIDE) | ||
117 | #define PAS_DMA_TXCHAN_TCMDSTA_EN 0x00000001 /* Enabled */ | ||
118 | #define PAS_DMA_TXCHAN_TCMDSTA_ST 0x00000002 /* Stop interface */ | ||
119 | #define PAS_DMA_TXCHAN_TCMDSTA_ACT 0x00010000 /* Active */ | ||
120 | #define PAS_DMA_TXCHAN_TCMDSTA_SZ 0x00000800 | ||
121 | #define PAS_DMA_TXCHAN_TCMDSTA_DB 0x00000400 | ||
122 | #define PAS_DMA_TXCHAN_TCMDSTA_DE 0x00000200 | ||
123 | #define PAS_DMA_TXCHAN_TCMDSTA_DA 0x00000100 | ||
124 | #define PAS_DMA_TXCHAN_CFG(c) (0x304+(c)*_PAS_DMA_TXCHAN_STRIDE) | ||
125 | #define PAS_DMA_TXCHAN_CFG_TY_IFACE 0x00000000 /* Type = interface */ | ||
126 | #define PAS_DMA_TXCHAN_CFG_TATTR_M 0x0000003c | ||
127 | #define PAS_DMA_TXCHAN_CFG_TATTR_S 2 | ||
128 | #define PAS_DMA_TXCHAN_CFG_TATTR(x) (((x) << PAS_DMA_TXCHAN_CFG_TATTR_S) & \ | ||
129 | PAS_DMA_TXCHAN_CFG_TATTR_M) | ||
130 | #define PAS_DMA_TXCHAN_CFG_WT_M 0x000001c0 | ||
131 | #define PAS_DMA_TXCHAN_CFG_WT_S 6 | ||
132 | #define PAS_DMA_TXCHAN_CFG_WT(x) (((x) << PAS_DMA_TXCHAN_CFG_WT_S) & \ | ||
133 | PAS_DMA_TXCHAN_CFG_WT_M) | ||
134 | #define PAS_DMA_TXCHAN_CFG_TRD 0x00010000 /* translate data */ | ||
135 | #define PAS_DMA_TXCHAN_CFG_TRR 0x00008000 /* translate rings */ | ||
136 | #define PAS_DMA_TXCHAN_CFG_UP 0x00004000 /* update tx descr when sent */ | ||
137 | #define PAS_DMA_TXCHAN_CFG_CL 0x00002000 /* Clean last line */ | ||
138 | #define PAS_DMA_TXCHAN_CFG_CF 0x00001000 /* Clean first line */ | ||
139 | #define PAS_DMA_TXCHAN_INCR(c) (0x310+(c)*_PAS_DMA_TXCHAN_STRIDE) | ||
140 | #define PAS_DMA_TXCHAN_BASEL(c) (0x318+(c)*_PAS_DMA_TXCHAN_STRIDE) | ||
141 | #define PAS_DMA_TXCHAN_BASEL_BRBL_M 0xffffffc0 | ||
142 | #define PAS_DMA_TXCHAN_BASEL_BRBL_S 0 | ||
143 | #define PAS_DMA_TXCHAN_BASEL_BRBL(x) (((x) << PAS_DMA_TXCHAN_BASEL_BRBL_S) & \ | ||
144 | PAS_DMA_TXCHAN_BASEL_BRBL_M) | ||
145 | #define PAS_DMA_TXCHAN_BASEU(c) (0x31c+(c)*_PAS_DMA_TXCHAN_STRIDE) | ||
146 | #define PAS_DMA_TXCHAN_BASEU_BRBH_M 0x00000fff | ||
147 | #define PAS_DMA_TXCHAN_BASEU_BRBH_S 0 | ||
148 | #define PAS_DMA_TXCHAN_BASEU_BRBH(x) (((x) << PAS_DMA_TXCHAN_BASEU_BRBH_S) & \ | ||
149 | PAS_DMA_TXCHAN_BASEU_BRBH_M) | ||
150 | /* # of cache lines worth of buffer ring */ | ||
151 | #define PAS_DMA_TXCHAN_BASEU_SIZ_M 0x3fff0000 | ||
152 | #define PAS_DMA_TXCHAN_BASEU_SIZ_S 16 /* 0 = 16K */ | ||
153 | #define PAS_DMA_TXCHAN_BASEU_SIZ(x) (((x) << PAS_DMA_TXCHAN_BASEU_SIZ_S) & \ | ||
154 | PAS_DMA_TXCHAN_BASEU_SIZ_M) | ||
155 | |||
156 | #define _PAS_DMA_RXCHAN_STRIDE 0x20 /* Size per channel */ | ||
157 | #define _PAS_DMA_RXCHAN_CCMDSTA 0x800 /* Command / Status */ | ||
158 | #define _PAS_DMA_RXCHAN_CFG 0x804 /* Configuration */ | ||
159 | #define _PAS_DMA_RXCHAN_INCR 0x810 /* Descriptor increment */ | ||
160 | #define _PAS_DMA_RXCHAN_CNT 0x814 /* Descriptor count/offset */ | ||
161 | #define _PAS_DMA_RXCHAN_BASEL 0x818 /* Descriptor ring base (low) */ | ||
162 | #define _PAS_DMA_RXCHAN_BASEU 0x81c /* (high) */ | ||
163 | #define PAS_DMA_RXCHAN_CCMDSTA(c) (0x800+(c)*_PAS_DMA_RXCHAN_STRIDE) | ||
164 | #define PAS_DMA_RXCHAN_CCMDSTA_EN 0x00000001 /* Enabled */ | ||
165 | #define PAS_DMA_RXCHAN_CCMDSTA_ST 0x00000002 /* Stop interface */ | ||
166 | #define PAS_DMA_RXCHAN_CCMDSTA_ACT 0x00010000 /* Active */ | ||
167 | #define PAS_DMA_RXCHAN_CCMDSTA_DU 0x00020000 | ||
168 | #define PAS_DMA_RXCHAN_CCMDSTA_OD 0x00002000 | ||
169 | #define PAS_DMA_RXCHAN_CCMDSTA_FD 0x00001000 | ||
170 | #define PAS_DMA_RXCHAN_CCMDSTA_DT 0x00000800 | ||
171 | #define PAS_DMA_RXCHAN_CFG(c) (0x804+(c)*_PAS_DMA_RXCHAN_STRIDE) | ||
172 | #define PAS_DMA_RXCHAN_CFG_CTR 0x00000400 | ||
173 | #define PAS_DMA_RXCHAN_CFG_HBU_M 0x00000380 | ||
174 | #define PAS_DMA_RXCHAN_CFG_HBU_S 7 | ||
175 | #define PAS_DMA_RXCHAN_CFG_HBU(x) (((x) << PAS_DMA_RXCHAN_CFG_HBU_S) & \ | ||
176 | PAS_DMA_RXCHAN_CFG_HBU_M) | ||
177 | #define PAS_DMA_RXCHAN_INCR(c) (0x810+(c)*_PAS_DMA_RXCHAN_STRIDE) | ||
178 | #define PAS_DMA_RXCHAN_BASEL(c) (0x818+(c)*_PAS_DMA_RXCHAN_STRIDE) | ||
179 | #define PAS_DMA_RXCHAN_BASEL_BRBL_M 0xffffffc0 | ||
180 | #define PAS_DMA_RXCHAN_BASEL_BRBL_S 0 | ||
181 | #define PAS_DMA_RXCHAN_BASEL_BRBL(x) (((x) << PAS_DMA_RXCHAN_BASEL_BRBL_S) & \ | ||
182 | PAS_DMA_RXCHAN_BASEL_BRBL_M) | ||
183 | #define PAS_DMA_RXCHAN_BASEU(c) (0x81c+(c)*_PAS_DMA_RXCHAN_STRIDE) | ||
184 | #define PAS_DMA_RXCHAN_BASEU_BRBH_M 0x00000fff | ||
185 | #define PAS_DMA_RXCHAN_BASEU_BRBH_S 0 | ||
186 | #define PAS_DMA_RXCHAN_BASEU_BRBH(x) (((x) << PAS_DMA_RXCHAN_BASEU_BRBH_S) & \ | ||
187 | PAS_DMA_RXCHAN_BASEU_BRBH_M) | ||
188 | /* # of cache lines worth of buffer ring */ | ||
189 | #define PAS_DMA_RXCHAN_BASEU_SIZ_M 0x3fff0000 | ||
190 | #define PAS_DMA_RXCHAN_BASEU_SIZ_S 16 /* 0 = 16K */ | ||
191 | #define PAS_DMA_RXCHAN_BASEU_SIZ(x) (((x) << PAS_DMA_RXCHAN_BASEU_SIZ_S) & \ | ||
192 | PAS_DMA_RXCHAN_BASEU_SIZ_M) | ||
193 | |||
194 | #define PAS_STATUS_PCNT_M 0x000000000000ffffull | ||
195 | #define PAS_STATUS_PCNT_S 0 | ||
196 | #define PAS_STATUS_DCNT_M 0x00000000ffff0000ull | ||
197 | #define PAS_STATUS_DCNT_S 16 | ||
198 | #define PAS_STATUS_BPCNT_M 0x0000ffff00000000ull | ||
199 | #define PAS_STATUS_BPCNT_S 32 | ||
200 | #define PAS_STATUS_CAUSE_M 0xf000000000000000ull | ||
201 | #define PAS_STATUS_TIMER 0x1000000000000000ull | ||
202 | #define PAS_STATUS_ERROR 0x2000000000000000ull | ||
203 | #define PAS_STATUS_SOFT 0x4000000000000000ull | ||
204 | #define PAS_STATUS_INT 0x8000000000000000ull | ||
205 | |||
206 | #define PAS_IOB_COM_PKTHDRCNT 0x120 | ||
207 | #define PAS_IOB_COM_PKTHDRCNT_PKTHDR1_M 0x0fff0000 | ||
208 | #define PAS_IOB_COM_PKTHDRCNT_PKTHDR1_S 16 | ||
209 | #define PAS_IOB_COM_PKTHDRCNT_PKTHDR0_M 0x00000fff | ||
210 | #define PAS_IOB_COM_PKTHDRCNT_PKTHDR0_S 0 | ||
211 | |||
212 | #define PAS_IOB_DMA_RXCH_CFG(i) (0x1100 + (i)*4) | ||
213 | #define PAS_IOB_DMA_RXCH_CFG_CNTTH_M 0x00000fff | ||
214 | #define PAS_IOB_DMA_RXCH_CFG_CNTTH_S 0 | ||
215 | #define PAS_IOB_DMA_RXCH_CFG_CNTTH(x) (((x) << PAS_IOB_DMA_RXCH_CFG_CNTTH_S) & \ | ||
216 | PAS_IOB_DMA_RXCH_CFG_CNTTH_M) | ||
217 | #define PAS_IOB_DMA_TXCH_CFG(i) (0x1200 + (i)*4) | ||
218 | #define PAS_IOB_DMA_TXCH_CFG_CNTTH_M 0x00000fff | ||
219 | #define PAS_IOB_DMA_TXCH_CFG_CNTTH_S 0 | ||
220 | #define PAS_IOB_DMA_TXCH_CFG_CNTTH(x) (((x) << PAS_IOB_DMA_TXCH_CFG_CNTTH_S) & \ | ||
221 | PAS_IOB_DMA_TXCH_CFG_CNTTH_M) | ||
222 | #define PAS_IOB_DMA_RXCH_STAT(i) (0x1300 + (i)*4) | ||
223 | #define PAS_IOB_DMA_RXCH_STAT_INTGEN 0x00001000 | ||
224 | #define PAS_IOB_DMA_RXCH_STAT_CNTDEL_M 0x00000fff | ||
225 | #define PAS_IOB_DMA_RXCH_STAT_CNTDEL_S 0 | ||
226 | #define PAS_IOB_DMA_RXCH_STAT_CNTDEL(x) (((x) << PAS_IOB_DMA_RXCH_STAT_CNTDEL_S) &\ | ||
227 | PAS_IOB_DMA_RXCH_STAT_CNTDEL_M) | ||
228 | #define PAS_IOB_DMA_TXCH_STAT(i) (0x1400 + (i)*4) | ||
229 | #define PAS_IOB_DMA_TXCH_STAT_INTGEN 0x00001000 | ||
230 | #define PAS_IOB_DMA_TXCH_STAT_CNTDEL_M 0x00000fff | ||
231 | #define PAS_IOB_DMA_TXCH_STAT_CNTDEL_S 0 | ||
232 | #define PAS_IOB_DMA_TXCH_STAT_CNTDEL(x) (((x) << PAS_IOB_DMA_TXCH_STAT_CNTDEL_S) &\ | ||
233 | PAS_IOB_DMA_TXCH_STAT_CNTDEL_M) | ||
234 | #define PAS_IOB_DMA_RXCH_RESET(i) (0x1500 + (i)*4) | ||
235 | #define PAS_IOB_DMA_RXCH_RESET_PCNT_M 0xffff0000 | ||
236 | #define PAS_IOB_DMA_RXCH_RESET_PCNT_S 16 | ||
237 | #define PAS_IOB_DMA_RXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_RXCH_RESET_PCNT_S) & \ | ||
238 | PAS_IOB_DMA_RXCH_RESET_PCNT_M) | ||
239 | #define PAS_IOB_DMA_RXCH_RESET_PCNTRST 0x00000020 | ||
240 | #define PAS_IOB_DMA_RXCH_RESET_DCNTRST 0x00000010 | ||
241 | #define PAS_IOB_DMA_RXCH_RESET_TINTC 0x00000008 | ||
242 | #define PAS_IOB_DMA_RXCH_RESET_DINTC 0x00000004 | ||
243 | #define PAS_IOB_DMA_RXCH_RESET_SINTC 0x00000002 | ||
244 | #define PAS_IOB_DMA_RXCH_RESET_PINTC 0x00000001 | ||
245 | #define PAS_IOB_DMA_TXCH_RESET(i) (0x1600 + (i)*4) | ||
246 | #define PAS_IOB_DMA_TXCH_RESET_PCNT_M 0xffff0000 | ||
247 | #define PAS_IOB_DMA_TXCH_RESET_PCNT_S 16 | ||
248 | #define PAS_IOB_DMA_TXCH_RESET_PCNT(x) (((x) << PAS_IOB_DMA_TXCH_RESET_PCNT_S) & \ | ||
249 | PAS_IOB_DMA_TXCH_RESET_PCNT_M) | ||
250 | #define PAS_IOB_DMA_TXCH_RESET_PCNTRST 0x00000020 | ||
251 | #define PAS_IOB_DMA_TXCH_RESET_DCNTRST 0x00000010 | ||
252 | #define PAS_IOB_DMA_TXCH_RESET_TINTC 0x00000008 | ||
253 | #define PAS_IOB_DMA_TXCH_RESET_DINTC 0x00000004 | ||
254 | #define PAS_IOB_DMA_TXCH_RESET_SINTC 0x00000002 | ||
255 | #define PAS_IOB_DMA_TXCH_RESET_PINTC 0x00000001 | ||
256 | |||
257 | #define PAS_IOB_DMA_COM_TIMEOUTCFG 0x1700 | ||
258 | #define PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_M 0x00ffffff | ||
259 | #define PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_S 0 | ||
260 | #define PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(x) (((x) << PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_S) & \ | ||
261 | PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT_M) | ||
262 | |||
263 | /* Transmit descriptor fields */ | ||
264 | #define XCT_MACTX_T 0x8000000000000000ull | ||
265 | #define XCT_MACTX_ST 0x4000000000000000ull | ||
266 | #define XCT_MACTX_NORES 0x0000000000000000ull | ||
267 | #define XCT_MACTX_8BRES 0x1000000000000000ull | ||
268 | #define XCT_MACTX_24BRES 0x2000000000000000ull | ||
269 | #define XCT_MACTX_40BRES 0x3000000000000000ull | ||
270 | #define XCT_MACTX_I 0x0800000000000000ull | ||
271 | #define XCT_MACTX_O 0x0400000000000000ull | ||
272 | #define XCT_MACTX_E 0x0200000000000000ull | ||
273 | #define XCT_MACTX_VLAN_M 0x0180000000000000ull | ||
274 | #define XCT_MACTX_VLAN_NOP 0x0000000000000000ull | ||
275 | #define XCT_MACTX_VLAN_REMOVE 0x0080000000000000ull | ||
276 | #define XCT_MACTX_VLAN_INSERT 0x0100000000000000ull | ||
277 | #define XCT_MACTX_VLAN_REPLACE 0x0180000000000000ull | ||
278 | #define XCT_MACTX_CRC_M 0x0060000000000000ull | ||
279 | #define XCT_MACTX_CRC_NOP 0x0000000000000000ull | ||
280 | #define XCT_MACTX_CRC_INSERT 0x0020000000000000ull | ||
281 | #define XCT_MACTX_CRC_PAD 0x0040000000000000ull | ||
282 | #define XCT_MACTX_CRC_REPLACE 0x0060000000000000ull | ||
283 | #define XCT_MACTX_SS 0x0010000000000000ull | ||
284 | #define XCT_MACTX_LLEN_M 0x00007fff00000000ull | ||
285 | #define XCT_MACTX_LLEN_S 32ull | ||
286 | #define XCT_MACTX_LLEN(x) ((((long)(x)) << XCT_MACTX_LLEN_S) & \ | ||
287 | XCT_MACTX_LLEN_M) | ||
288 | #define XCT_MACTX_IPH_M 0x00000000f8000000ull | ||
289 | #define XCT_MACTX_IPH_S 27ull | ||
290 | #define XCT_MACTX_IPH(x) ((((long)(x)) << XCT_MACTX_IPH_S) & \ | ||
291 | XCT_MACTX_IPH_M) | ||
292 | #define XCT_MACTX_IPO_M 0x0000000007c00000ull | ||
293 | #define XCT_MACTX_IPO_S 22ull | ||
294 | #define XCT_MACTX_IPO(x) ((((long)(x)) << XCT_MACTX_IPO_S) & \ | ||
295 | XCT_MACTX_IPO_M) | ||
296 | #define XCT_MACTX_CSUM_M 0x0000000000000060ull | ||
297 | #define XCT_MACTX_CSUM_NOP 0x0000000000000000ull | ||
298 | #define XCT_MACTX_CSUM_TCP 0x0000000000000040ull | ||
299 | #define XCT_MACTX_CSUM_UDP 0x0000000000000060ull | ||
300 | #define XCT_MACTX_V6 0x0000000000000010ull | ||
301 | #define XCT_MACTX_C 0x0000000000000004ull | ||
302 | #define XCT_MACTX_AL2 0x0000000000000002ull | ||
303 | |||
304 | /* Receive descriptor fields */ | ||
305 | #define XCT_MACRX_T 0x8000000000000000ull | ||
306 | #define XCT_MACRX_ST 0x4000000000000000ull | ||
307 | #define XCT_MACRX_RR_M 0x3000000000000000ull | ||
308 | #define XCT_MACRX_RR_NORES 0x0000000000000000ull | ||
309 | #define XCT_MACRX_RR_8BRES 0x1000000000000000ull | ||
310 | #define XCT_MACRX_O 0x0400000000000000ull | ||
311 | #define XCT_MACRX_E 0x0200000000000000ull | ||
312 | #define XCT_MACRX_FF 0x0100000000000000ull | ||
313 | #define XCT_MACRX_PF 0x0080000000000000ull | ||
314 | #define XCT_MACRX_OB 0x0040000000000000ull | ||
315 | #define XCT_MACRX_OD 0x0020000000000000ull | ||
316 | #define XCT_MACRX_FS 0x0010000000000000ull | ||
317 | #define XCT_MACRX_NB_M 0x000fc00000000000ull | ||
318 | #define XCT_MACRX_NB_S 46ULL | ||
319 | #define XCT_MACRX_NB(x) ((((long)(x)) << XCT_MACRX_NB_S) & \ | ||
320 | XCT_MACRX_NB_M) | ||
321 | #define XCT_MACRX_LLEN_M 0x00003fff00000000ull | ||
322 | #define XCT_MACRX_LLEN_S 32ULL | ||
323 | #define XCT_MACRX_LLEN(x) ((((long)(x)) << XCT_MACRX_LLEN_S) & \ | ||
324 | XCT_MACRX_LLEN_M) | ||
325 | #define XCT_MACRX_CRC 0x0000000080000000ull | ||
326 | #define XCT_MACRX_LEN_M 0x0000000060000000ull | ||
327 | #define XCT_MACRX_LEN_TOOSHORT 0x0000000020000000ull | ||
328 | #define XCT_MACRX_LEN_BELOWMIN 0x0000000040000000ull | ||
329 | #define XCT_MACRX_LEN_TRUNC 0x0000000060000000ull | ||
330 | #define XCT_MACRX_CAST_M 0x0000000018000000ull | ||
331 | #define XCT_MACRX_CAST_UNI 0x0000000000000000ull | ||
332 | #define XCT_MACRX_CAST_MULTI 0x0000000008000000ull | ||
333 | #define XCT_MACRX_CAST_BROAD 0x0000000010000000ull | ||
334 | #define XCT_MACRX_CAST_PAUSE 0x0000000018000000ull | ||
335 | #define XCT_MACRX_VLC_M 0x0000000006000000ull | ||
336 | #define XCT_MACRX_FM 0x0000000001000000ull | ||
337 | #define XCT_MACRX_HTY_M 0x0000000000c00000ull | ||
338 | #define XCT_MACRX_HTY_IPV4_OK 0x0000000000000000ull | ||
339 | #define XCT_MACRX_HTY_IPV6 0x0000000000400000ull | ||
340 | #define XCT_MACRX_HTY_IPV4_BAD 0x0000000000800000ull | ||
341 | #define XCT_MACRX_HTY_NONIP 0x0000000000c00000ull | ||
342 | #define XCT_MACRX_IPP_M 0x00000000003f0000ull | ||
343 | #define XCT_MACRX_IPP_S 16 | ||
344 | #define XCT_MACRX_CSUM_M 0x000000000000ffffull | ||
345 | #define XCT_MACRX_CSUM_S 0 | ||
346 | |||
347 | #define XCT_PTR_T 0x8000000000000000ull | ||
348 | #define XCT_PTR_LEN_M 0x7ffff00000000000ull | ||
349 | #define XCT_PTR_LEN_S 44 | ||
350 | #define XCT_PTR_LEN(x) ((((long)(x)) << XCT_PTR_LEN_S) & \ | ||
351 | XCT_PTR_LEN_M) | ||
352 | #define XCT_PTR_ADDR_M 0x00000fffffffffffull | ||
353 | #define XCT_PTR_ADDR_S 0 | ||
354 | #define XCT_PTR_ADDR(x) ((((long)(x)) << XCT_PTR_ADDR_S) & \ | ||
355 | XCT_PTR_ADDR_M) | ||
356 | |||
357 | /* Receive interface 8byte result fields */ | ||
358 | #define XCT_RXRES_8B_L4O_M 0xff00000000000000ull | ||
359 | #define XCT_RXRES_8B_L4O_S 56 | ||
360 | #define XCT_RXRES_8B_RULE_M 0x00ffff0000000000ull | ||
361 | #define XCT_RXRES_8B_RULE_S 40 | ||
362 | #define XCT_RXRES_8B_EVAL_M 0x000000ffff000000ull | ||
363 | #define XCT_RXRES_8B_EVAL_S 24 | ||
364 | #define XCT_RXRES_8B_HTYPE_M 0x0000000000f00000ull | ||
365 | #define XCT_RXRES_8B_HASH_M 0x00000000000fffffull | ||
366 | #define XCT_RXRES_8B_HASH_S 0 | ||
367 | |||
368 | /* Receive interface buffer fields */ | ||
369 | #define XCT_RXB_LEN_M 0x0ffff00000000000ull | ||
370 | #define XCT_RXB_LEN_S 44 | ||
371 | #define XCT_RXB_LEN(x) ((((long)(x)) << XCT_RXB_LEN_S) & \ | ||
372 | XCT_RXB_LEN_M) | ||
373 | #define XCT_RXB_ADDR_M 0x00000fffffffffffull | ||
374 | #define XCT_RXB_ADDR_S 0 | ||
375 | #define XCT_RXB_ADDR(x) ((((long)(x)) << XCT_RXB_ADDR_S) & \ | ||
376 | XCT_RXB_ADDR_M) | ||
377 | |||
378 | /* Copy descriptor fields */ | ||
379 | #define XCT_COPY_T 0x8000000000000000ull | ||
380 | #define XCT_COPY_ST 0x4000000000000000ull | ||
381 | #define XCT_COPY_RR_M 0x3000000000000000ull | ||
382 | #define XCT_COPY_RR_NORES 0x0000000000000000ull | ||
383 | #define XCT_COPY_RR_8BRES 0x1000000000000000ull | ||
384 | #define XCT_COPY_RR_24BRES 0x2000000000000000ull | ||
385 | #define XCT_COPY_RR_40BRES 0x3000000000000000ull | ||
386 | #define XCT_COPY_I 0x0800000000000000ull | ||
387 | #define XCT_COPY_O 0x0400000000000000ull | ||
388 | #define XCT_COPY_E 0x0200000000000000ull | ||
389 | #define XCT_COPY_STY_ZERO 0x01c0000000000000ull | ||
390 | #define XCT_COPY_DTY_PREF 0x0038000000000000ull | ||
391 | #define XCT_COPY_LLEN_M 0x0007ffff00000000ull | ||
392 | #define XCT_COPY_LLEN_S 32 | ||
393 | #define XCT_COPY_LLEN(x) ((((long)(x)) << XCT_COPY_LLEN_S) & \ | ||
394 | XCT_COPY_LLEN_M) | ||
395 | #define XCT_COPY_SE 0x0000000000000001ull | ||
396 | |||
397 | /* Control descriptor fields */ | ||
398 | #define CTRL_CMD_T 0x8000000000000000ull | ||
399 | #define CTRL_CMD_META_EVT 0x2000000000000000ull | ||
400 | #define CTRL_CMD_O 0x0400000000000000ull | ||
401 | #define CTRL_CMD_REG_M 0x000000000000000full | ||
402 | #define CTRL_CMD_REG_S 0 | ||
403 | #define CTRL_CMD_REG(x) ((((long)(x)) << CTRL_CMD_REG_S) & \ | ||
404 | CTRL_CMD_REG_M) | ||
405 | |||
406 | |||
407 | |||
408 | /* Prototypes for the shared DMA functions in the platform code. */ | ||
409 | |||
410 | /* DMA TX Channel type. Right now only limitations used are event types 0/1, | ||
411 | * for event-triggered DMA transactions. | ||
412 | */ | ||
413 | |||
414 | enum pasemi_dmachan_type { | ||
415 | RXCHAN = 0, /* Any RX chan */ | ||
416 | TXCHAN = 1, /* Any TX chan */ | ||
417 | TXCHAN_EVT0 = 0x1001, /* TX chan in event class 0 (chan 0-9) */ | ||
418 | TXCHAN_EVT1 = 0x2001, /* TX chan in event class 1 (chan 10-19) */ | ||
419 | }; | ||
420 | |||
421 | struct pasemi_dmachan { | ||
422 | int chno; /* Channel number */ | ||
423 | enum pasemi_dmachan_type chan_type; /* TX / RX */ | ||
424 | u64 *status; /* Ptr to cacheable status */ | ||
425 | int irq; /* IRQ used by channel */ | ||
426 | unsigned int ring_size; /* size of allocated ring */ | ||
427 | dma_addr_t ring_dma; /* DMA address for ring */ | ||
428 | u64 *ring_virt; /* Virt address for ring */ | ||
429 | void *priv; /* Ptr to start of client struct */ | ||
430 | }; | ||
431 | |||
432 | /* Read/write the different registers in the I/O Bridge, Ethernet | ||
433 | * and DMA Controller | ||
434 | */ | ||
435 | extern unsigned int pasemi_read_iob_reg(unsigned int reg); | ||
436 | extern void pasemi_write_iob_reg(unsigned int reg, unsigned int val); | ||
437 | |||
438 | extern unsigned int pasemi_read_mac_reg(int intf, unsigned int reg); | ||
439 | extern void pasemi_write_mac_reg(int intf, unsigned int reg, unsigned int val); | ||
440 | |||
441 | extern unsigned int pasemi_read_dma_reg(unsigned int reg); | ||
442 | extern void pasemi_write_dma_reg(unsigned int reg, unsigned int val); | ||
443 | |||
444 | /* Channel management routines */ | ||
445 | |||
446 | extern void *pasemi_dma_alloc_chan(enum pasemi_dmachan_type type, | ||
447 | int total_size, int offset); | ||
448 | extern void pasemi_dma_free_chan(struct pasemi_dmachan *chan); | ||
449 | |||
450 | extern void pasemi_dma_start_chan(const struct pasemi_dmachan *chan, | ||
451 | const u32 cmdsta); | ||
452 | extern int pasemi_dma_stop_chan(const struct pasemi_dmachan *chan); | ||
453 | |||
454 | /* Common routines to allocate rings and buffers */ | ||
455 | |||
456 | extern int pasemi_dma_alloc_ring(struct pasemi_dmachan *chan, int ring_size); | ||
457 | extern void pasemi_dma_free_ring(struct pasemi_dmachan *chan); | ||
458 | |||
459 | extern void *pasemi_dma_alloc_buf(struct pasemi_dmachan *chan, int size, | ||
460 | dma_addr_t *handle); | ||
461 | extern void pasemi_dma_free_buf(struct pasemi_dmachan *chan, int size, | ||
462 | dma_addr_t *handle); | ||
463 | |||
464 | /* Initialize the library, must be called before any other functions */ | ||
465 | extern int pasemi_dma_init(void); | ||
466 | |||
467 | #endif /* ASM_PASEMI_DMA_H */ | ||
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index ad99ce9f9169..27b9350052b4 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -1,4 +1,5 @@ | |||
1 | header-y += byteorder/ | 1 | header-y += byteorder/ |
2 | header-y += can/ | ||
2 | header-y += dvb/ | 3 | header-y += dvb/ |
3 | header-y += hdlc/ | 4 | header-y += hdlc/ |
4 | header-y += isdn/ | 5 | header-y += isdn/ |
@@ -40,6 +41,7 @@ header-y += baycom.h | |||
40 | header-y += bfs_fs.h | 41 | header-y += bfs_fs.h |
41 | header-y += blkpg.h | 42 | header-y += blkpg.h |
42 | header-y += bpqether.h | 43 | header-y += bpqether.h |
44 | header-y += can.h | ||
43 | header-y += cdk.h | 45 | header-y += cdk.h |
44 | header-y += chio.h | 46 | header-y += chio.h |
45 | header-y += coda_psdev.h | 47 | header-y += coda_psdev.h |
@@ -228,7 +230,6 @@ unifdef-y += if_ltalk.h | |||
228 | unifdef-y += if_link.h | 230 | unifdef-y += if_link.h |
229 | unifdef-y += if_pppol2tp.h | 231 | unifdef-y += if_pppol2tp.h |
230 | unifdef-y += if_pppox.h | 232 | unifdef-y += if_pppox.h |
231 | unifdef-y += if_shaper.h | ||
232 | unifdef-y += if_tr.h | 233 | unifdef-y += if_tr.h |
233 | unifdef-y += if_tun.h | 234 | unifdef-y += if_tun.h |
234 | unifdef-y += if_vlan.h | 235 | unifdef-y += if_vlan.h |
diff --git a/include/linux/atmbr2684.h b/include/linux/atmbr2684.h index 969fb6c9e1cc..52bf72affbba 100644 --- a/include/linux/atmbr2684.h +++ b/include/linux/atmbr2684.h | |||
@@ -14,6 +14,9 @@ | |||
14 | #define BR2684_MEDIA_FDDI (3) | 14 | #define BR2684_MEDIA_FDDI (3) |
15 | #define BR2684_MEDIA_802_6 (4) /* 802.6 */ | 15 | #define BR2684_MEDIA_802_6 (4) /* 802.6 */ |
16 | 16 | ||
17 | /* used only at device creation: */ | ||
18 | #define BR2684_FLAG_ROUTED (1<<16) /* payload is routed, not bridged */ | ||
19 | |||
17 | /* | 20 | /* |
18 | * Is there FCS inbound on this VC? This currently isn't supported. | 21 | * Is there FCS inbound on this VC? This currently isn't supported. |
19 | */ | 22 | */ |
@@ -36,15 +39,22 @@ | |||
36 | #define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */ | 39 | #define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */ |
37 | 40 | ||
38 | /* | 41 | /* |
42 | * Is this VC bridged or routed? | ||
43 | */ | ||
44 | |||
45 | #define BR2684_PAYLOAD_ROUTED (0) | ||
46 | #define BR2684_PAYLOAD_BRIDGED (1) | ||
47 | |||
48 | /* | ||
39 | * This is for the ATM_NEWBACKENDIF call - these are like socket families: | 49 | * This is for the ATM_NEWBACKENDIF call - these are like socket families: |
40 | * the first element of the structure is the backend number and the rest | 50 | * the first element of the structure is the backend number and the rest |
41 | * is per-backend specific | 51 | * is per-backend specific |
42 | */ | 52 | */ |
43 | struct atm_newif_br2684 { | 53 | struct atm_newif_br2684 { |
44 | atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ | 54 | atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ |
45 | int media; /* BR2684_MEDIA_* */ | 55 | int media; /* BR2684_MEDIA_*, flags in upper bits */ |
46 | char ifname[IFNAMSIZ]; | 56 | char ifname[IFNAMSIZ]; |
47 | int mtu; | 57 | int mtu; |
48 | }; | 58 | }; |
49 | 59 | ||
50 | /* | 60 | /* |
@@ -55,10 +65,10 @@ struct atm_newif_br2684 { | |||
55 | #define BR2684_FIND_BYNUM (1) | 65 | #define BR2684_FIND_BYNUM (1) |
56 | #define BR2684_FIND_BYIFNAME (2) | 66 | #define BR2684_FIND_BYIFNAME (2) |
57 | struct br2684_if_spec { | 67 | struct br2684_if_spec { |
58 | int method; /* BR2684_FIND_* */ | 68 | int method; /* BR2684_FIND_* */ |
59 | union { | 69 | union { |
60 | char ifname[IFNAMSIZ]; | 70 | char ifname[IFNAMSIZ]; |
61 | int devnum; | 71 | int devnum; |
62 | } spec; | 72 | } spec; |
63 | }; | 73 | }; |
64 | 74 | ||
@@ -68,16 +78,16 @@ struct br2684_if_spec { | |||
68 | * is per-backend specific | 78 | * is per-backend specific |
69 | */ | 79 | */ |
70 | struct atm_backend_br2684 { | 80 | struct atm_backend_br2684 { |
71 | atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ | 81 | atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */ |
72 | struct br2684_if_spec ifspec; | 82 | struct br2684_if_spec ifspec; |
73 | int fcs_in; /* BR2684_FCSIN_* */ | 83 | int fcs_in; /* BR2684_FCSIN_* */ |
74 | int fcs_out; /* BR2684_FCSOUT_* */ | 84 | int fcs_out; /* BR2684_FCSOUT_* */ |
75 | int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */ | 85 | int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */ |
76 | int encaps; /* BR2684_ENCAPS_* */ | 86 | int encaps; /* BR2684_ENCAPS_* */ |
77 | int has_vpiid; /* 1: use vpn_id - Unsupported */ | 87 | int has_vpiid; /* 1: use vpn_id - Unsupported */ |
78 | __u8 vpn_id[7]; | 88 | __u8 vpn_id[7]; |
79 | int send_padding; /* unsupported */ | 89 | int send_padding; /* unsupported */ |
80 | int min_size; /* we will pad smaller packets than this */ | 90 | int min_size; /* we will pad smaller packets than this */ |
81 | }; | 91 | }; |
82 | 92 | ||
83 | /* | 93 | /* |
@@ -86,8 +96,8 @@ struct atm_backend_br2684 { | |||
86 | * efficient per-if in/out filters, this support will be removed | 96 | * efficient per-if in/out filters, this support will be removed |
87 | */ | 97 | */ |
88 | struct br2684_filter { | 98 | struct br2684_filter { |
89 | __be32 prefix; /* network byte order */ | 99 | __be32 prefix; /* network byte order */ |
90 | __be32 netmask; /* 0 = disable filter */ | 100 | __be32 netmask; /* 0 = disable filter */ |
91 | }; | 101 | }; |
92 | 102 | ||
93 | struct br2684_filter_set { | 103 | struct br2684_filter_set { |
@@ -95,6 +105,11 @@ struct br2684_filter_set { | |||
95 | struct br2684_filter filter; | 105 | struct br2684_filter filter; |
96 | }; | 106 | }; |
97 | 107 | ||
108 | enum br2684_payload { | ||
109 | p_routed = BR2684_PAYLOAD_ROUTED, | ||
110 | p_bridged = BR2684_PAYLOAD_BRIDGED, | ||
111 | }; | ||
112 | |||
98 | #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \ | 113 | #define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \ |
99 | struct br2684_filter_set) | 114 | struct br2684_filter_set) |
100 | 115 | ||
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h index 2096e5c72827..a3d07c29d16c 100644 --- a/include/linux/atmdev.h +++ b/include/linux/atmdev.h | |||
@@ -359,7 +359,7 @@ struct atm_dev { | |||
359 | struct proc_dir_entry *proc_entry; /* proc entry */ | 359 | struct proc_dir_entry *proc_entry; /* proc entry */ |
360 | char *proc_name; /* proc entry name */ | 360 | char *proc_name; /* proc entry name */ |
361 | #endif | 361 | #endif |
362 | struct class_device class_dev; /* sysfs class device */ | 362 | struct device class_dev; /* sysfs device */ |
363 | struct list_head dev_list; /* linkage */ | 363 | struct list_head dev_list; /* linkage */ |
364 | }; | 364 | }; |
365 | 365 | ||
@@ -461,7 +461,7 @@ static inline void atm_dev_put(struct atm_dev *dev) | |||
461 | BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags)); | 461 | BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags)); |
462 | if (dev->ops->dev_close) | 462 | if (dev->ops->dev_close) |
463 | dev->ops->dev_close(dev); | 463 | dev->ops->dev_close(dev); |
464 | class_device_put(&dev->class_dev); | 464 | put_device(&dev->class_dev); |
465 | } | 465 | } |
466 | } | 466 | } |
467 | 467 | ||
diff --git a/include/linux/can.h b/include/linux/can.h new file mode 100644 index 000000000000..d18333302cbd --- /dev/null +++ b/include/linux/can.h | |||
@@ -0,0 +1,111 @@ | |||
1 | /* | ||
2 | * linux/can.h | ||
3 | * | ||
4 | * Definitions for CAN network layer (socket addr / CAN frame / CAN filter) | ||
5 | * | ||
6 | * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | ||
7 | * Urs Thuermann <urs.thuermann@volkswagen.de> | ||
8 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Send feedback to <socketcan-users@lists.berlios.de> | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef CAN_H | ||
16 | #define CAN_H | ||
17 | |||
18 | #include <linux/types.h> | ||
19 | #include <linux/socket.h> | ||
20 | |||
21 | /* controller area network (CAN) kernel definitions */ | ||
22 | |||
23 | /* special address description flags for the CAN_ID */ | ||
24 | #define CAN_EFF_FLAG 0x80000000U /* EFF/SFF is set in the MSB */ | ||
25 | #define CAN_RTR_FLAG 0x40000000U /* remote transmission request */ | ||
26 | #define CAN_ERR_FLAG 0x20000000U /* error frame */ | ||
27 | |||
28 | /* valid bits in CAN ID for frame formats */ | ||
29 | #define CAN_SFF_MASK 0x000007FFU /* standard frame format (SFF) */ | ||
30 | #define CAN_EFF_MASK 0x1FFFFFFFU /* extended frame format (EFF) */ | ||
31 | #define CAN_ERR_MASK 0x1FFFFFFFU /* omit EFF, RTR, ERR flags */ | ||
32 | |||
33 | /* | ||
34 | * Controller Area Network Identifier structure | ||
35 | * | ||
36 | * bit 0-28 : CAN identifier (11/29 bit) | ||
37 | * bit 29 : error frame flag (0 = data frame, 1 = error frame) | ||
38 | * bit 30 : remote transmission request flag (1 = rtr frame) | ||
39 | * bit 31 : frame format flag (0 = standard 11 bit, 1 = extended 29 bit) | ||
40 | */ | ||
41 | typedef __u32 canid_t; | ||
42 | |||
43 | /* | ||
44 | * Controller Area Network Error Frame Mask structure | ||
45 | * | ||
46 | * bit 0-28 : error class mask (see include/linux/can/error.h) | ||
47 | * bit 29-31 : set to zero | ||
48 | */ | ||
49 | typedef __u32 can_err_mask_t; | ||
50 | |||
51 | /** | ||
52 | * struct can_frame - basic CAN frame structure | ||
53 | * @can_id: the CAN ID of the frame and CAN_*_FLAG flags, see above. | ||
54 | * @can_dlc: the data length field of the CAN frame | ||
55 | * @data: the CAN frame payload. | ||
56 | */ | ||
57 | struct can_frame { | ||
58 | canid_t can_id; /* 32 bit CAN_ID + EFF/RTR/ERR flags */ | ||
59 | __u8 can_dlc; /* data length code: 0 .. 8 */ | ||
60 | __u8 data[8] __attribute__((aligned(8))); | ||
61 | }; | ||
62 | |||
63 | /* particular protocols of the protocol family PF_CAN */ | ||
64 | #define CAN_RAW 1 /* RAW sockets */ | ||
65 | #define CAN_BCM 2 /* Broadcast Manager */ | ||
66 | #define CAN_TP16 3 /* VAG Transport Protocol v1.6 */ | ||
67 | #define CAN_TP20 4 /* VAG Transport Protocol v2.0 */ | ||
68 | #define CAN_MCNET 5 /* Bosch MCNet */ | ||
69 | #define CAN_ISOTP 6 /* ISO 15765-2 Transport Protocol */ | ||
70 | #define CAN_NPROTO 7 | ||
71 | |||
72 | #define SOL_CAN_BASE 100 | ||
73 | |||
74 | /** | ||
75 | * struct sockaddr_can - the sockaddr structure for CAN sockets | ||
76 | * @can_family: address family number AF_CAN. | ||
77 | * @can_ifindex: CAN network interface index. | ||
78 | * @can_addr: protocol specific address information | ||
79 | */ | ||
80 | struct sockaddr_can { | ||
81 | sa_family_t can_family; | ||
82 | int can_ifindex; | ||
83 | union { | ||
84 | /* transport protocol class address information (e.g. ISOTP) */ | ||
85 | struct { canid_t rx_id, tx_id; } tp; | ||
86 | |||
87 | /* reserved for future CAN protocols address information */ | ||
88 | } can_addr; | ||
89 | }; | ||
90 | |||
91 | /** | ||
92 | * struct can_filter - CAN ID based filter in can_register(). | ||
93 | * @can_id: relevant bits of CAN ID which are not masked out. | ||
94 | * @can_mask: CAN mask (see description) | ||
95 | * | ||
96 | * Description: | ||
97 | * A filter matches, when | ||
98 | * | ||
99 | * <received_can_id> & mask == can_id & mask | ||
100 | * | ||
101 | * The filter can be inverted (CAN_INV_FILTER bit set in can_id) or it can | ||
102 | * filter for error frames (CAN_ERR_FLAG bit set in mask). | ||
103 | */ | ||
104 | struct can_filter { | ||
105 | canid_t can_id; | ||
106 | canid_t can_mask; | ||
107 | }; | ||
108 | |||
109 | #define CAN_INV_FILTER 0x20000000U /* to be set in can_filter.can_id */ | ||
110 | |||
111 | #endif /* CAN_H */ | ||
diff --git a/include/linux/can/Kbuild b/include/linux/can/Kbuild new file mode 100644 index 000000000000..eff898aac02b --- /dev/null +++ b/include/linux/can/Kbuild | |||
@@ -0,0 +1,3 @@ | |||
1 | header-y += raw.h | ||
2 | header-y += bcm.h | ||
3 | header-y += error.h | ||
diff --git a/include/linux/can/bcm.h b/include/linux/can/bcm.h new file mode 100644 index 000000000000..7f293273c444 --- /dev/null +++ b/include/linux/can/bcm.h | |||
@@ -0,0 +1,65 @@ | |||
1 | /* | ||
2 | * linux/can/bcm.h | ||
3 | * | ||
4 | * Definitions for CAN Broadcast Manager (BCM) | ||
5 | * | ||
6 | * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | ||
7 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | ||
8 | * All rights reserved. | ||
9 | * | ||
10 | * Send feedback to <socketcan-users@lists.berlios.de> | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef CAN_BCM_H | ||
15 | #define CAN_BCM_H | ||
16 | |||
17 | /** | ||
18 | * struct bcm_msg_head - head of messages to/from the broadcast manager | ||
19 | * @opcode: opcode, see enum below. | ||
20 | * @flags: special flags, see below. | ||
21 | * @count: number of frames to send before changing interval. | ||
22 | * @ival1: interval for the first @count frames. | ||
23 | * @ival2: interval for the following frames. | ||
24 | * @can_id: CAN ID of frames to be sent or received. | ||
25 | * @nframes: number of frames appended to the message head. | ||
26 | * @frames: array of CAN frames. | ||
27 | */ | ||
28 | struct bcm_msg_head { | ||
29 | __u32 opcode; | ||
30 | __u32 flags; | ||
31 | __u32 count; | ||
32 | struct timeval ival1, ival2; | ||
33 | canid_t can_id; | ||
34 | __u32 nframes; | ||
35 | struct can_frame frames[0]; | ||
36 | }; | ||
37 | |||
38 | enum { | ||
39 | TX_SETUP = 1, /* create (cyclic) transmission task */ | ||
40 | TX_DELETE, /* remove (cyclic) transmission task */ | ||
41 | TX_READ, /* read properties of (cyclic) transmission task */ | ||
42 | TX_SEND, /* send one CAN frame */ | ||
43 | RX_SETUP, /* create RX content filter subscription */ | ||
44 | RX_DELETE, /* remove RX content filter subscription */ | ||
45 | RX_READ, /* read properties of RX content filter subscription */ | ||
46 | TX_STATUS, /* reply to TX_READ request */ | ||
47 | TX_EXPIRED, /* notification on performed transmissions (count=0) */ | ||
48 | RX_STATUS, /* reply to RX_READ request */ | ||
49 | RX_TIMEOUT, /* cyclic message is absent */ | ||
50 | RX_CHANGED /* updated CAN frame (detected content change) */ | ||
51 | }; | ||
52 | |||
53 | #define SETTIMER 0x0001 | ||
54 | #define STARTTIMER 0x0002 | ||
55 | #define TX_COUNTEVT 0x0004 | ||
56 | #define TX_ANNOUNCE 0x0008 | ||
57 | #define TX_CP_CAN_ID 0x0010 | ||
58 | #define RX_FILTER_ID 0x0020 | ||
59 | #define RX_CHECK_DLC 0x0040 | ||
60 | #define RX_NO_AUTOTIMER 0x0080 | ||
61 | #define RX_ANNOUNCE_RESUME 0x0100 | ||
62 | #define TX_RESET_MULTI_IDX 0x0200 | ||
63 | #define RX_RTR_FRAME 0x0400 | ||
64 | |||
65 | #endif /* CAN_BCM_H */ | ||
diff --git a/include/linux/can/core.h b/include/linux/can/core.h new file mode 100644 index 000000000000..e9ca210ffa5b --- /dev/null +++ b/include/linux/can/core.h | |||
@@ -0,0 +1,64 @@ | |||
1 | /* | ||
2 | * linux/can/core.h | ||
3 | * | ||
4 | * Protoypes and definitions for CAN protocol modules using the PF_CAN core | ||
5 | * | ||
6 | * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | ||
7 | * Urs Thuermann <urs.thuermann@volkswagen.de> | ||
8 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Send feedback to <socketcan-users@lists.berlios.de> | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef CAN_CORE_H | ||
16 | #define CAN_CORE_H | ||
17 | |||
18 | #include <linux/can.h> | ||
19 | #include <linux/skbuff.h> | ||
20 | #include <linux/netdevice.h> | ||
21 | |||
22 | #define CAN_VERSION "20071116" | ||
23 | |||
24 | /* increment this number each time you change some user-space interface */ | ||
25 | #define CAN_ABI_VERSION "8" | ||
26 | |||
27 | #define CAN_VERSION_STRING "rev " CAN_VERSION " abi " CAN_ABI_VERSION | ||
28 | |||
29 | #define DNAME(dev) ((dev) ? (dev)->name : "any") | ||
30 | |||
31 | /** | ||
32 | * struct can_proto - CAN protocol structure | ||
33 | * @type: type argument in socket() syscall, e.g. SOCK_DGRAM. | ||
34 | * @protocol: protocol number in socket() syscall. | ||
35 | * @capability: capability needed to open the socket, or -1 for no restriction. | ||
36 | * @ops: pointer to struct proto_ops for sock->ops. | ||
37 | * @prot: pointer to struct proto structure. | ||
38 | */ | ||
39 | struct can_proto { | ||
40 | int type; | ||
41 | int protocol; | ||
42 | int capability; | ||
43 | struct proto_ops *ops; | ||
44 | struct proto *prot; | ||
45 | }; | ||
46 | |||
47 | /* function prototypes for the CAN networklayer core (af_can.c) */ | ||
48 | |||
49 | extern int can_proto_register(struct can_proto *cp); | ||
50 | extern void can_proto_unregister(struct can_proto *cp); | ||
51 | |||
52 | extern int can_rx_register(struct net_device *dev, canid_t can_id, | ||
53 | canid_t mask, | ||
54 | void (*func)(struct sk_buff *, void *), | ||
55 | void *data, char *ident); | ||
56 | |||
57 | extern void can_rx_unregister(struct net_device *dev, canid_t can_id, | ||
58 | canid_t mask, | ||
59 | void (*func)(struct sk_buff *, void *), | ||
60 | void *data); | ||
61 | |||
62 | extern int can_send(struct sk_buff *skb, int loop); | ||
63 | |||
64 | #endif /* CAN_CORE_H */ | ||
diff --git a/include/linux/can/error.h b/include/linux/can/error.h new file mode 100644 index 000000000000..d4127fd9e681 --- /dev/null +++ b/include/linux/can/error.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * linux/can/error.h | ||
3 | * | ||
4 | * Definitions of the CAN error frame to be filtered and passed to the user. | ||
5 | * | ||
6 | * Author: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | ||
7 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | ||
8 | * All rights reserved. | ||
9 | * | ||
10 | * Send feedback to <socketcan-users@lists.berlios.de> | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #ifndef CAN_ERROR_H | ||
15 | #define CAN_ERROR_H | ||
16 | |||
17 | #define CAN_ERR_DLC 8 /* dlc for error frames */ | ||
18 | |||
19 | /* error class (mask) in can_id */ | ||
20 | #define CAN_ERR_TX_TIMEOUT 0x00000001U /* TX timeout (by netdevice driver) */ | ||
21 | #define CAN_ERR_LOSTARB 0x00000002U /* lost arbitration / data[0] */ | ||
22 | #define CAN_ERR_CRTL 0x00000004U /* controller problems / data[1] */ | ||
23 | #define CAN_ERR_PROT 0x00000008U /* protocol violations / data[2..3] */ | ||
24 | #define CAN_ERR_TRX 0x00000010U /* transceiver status / data[4] */ | ||
25 | #define CAN_ERR_ACK 0x00000020U /* received no ACK on transmission */ | ||
26 | #define CAN_ERR_BUSOFF 0x00000040U /* bus off */ | ||
27 | #define CAN_ERR_BUSERROR 0x00000080U /* bus error (may flood!) */ | ||
28 | #define CAN_ERR_RESTARTED 0x00000100U /* controller restarted */ | ||
29 | |||
30 | /* arbitration lost in bit ... / data[0] */ | ||
31 | #define CAN_ERR_LOSTARB_UNSPEC 0x00 /* unspecified */ | ||
32 | /* else bit number in bitstream */ | ||
33 | |||
34 | /* error status of CAN-controller / data[1] */ | ||
35 | #define CAN_ERR_CRTL_UNSPEC 0x00 /* unspecified */ | ||
36 | #define CAN_ERR_CRTL_RX_OVERFLOW 0x01 /* RX buffer overflow */ | ||
37 | #define CAN_ERR_CRTL_TX_OVERFLOW 0x02 /* TX buffer overflow */ | ||
38 | #define CAN_ERR_CRTL_RX_WARNING 0x04 /* reached warning level for RX errors */ | ||
39 | #define CAN_ERR_CRTL_TX_WARNING 0x08 /* reached warning level for TX errors */ | ||
40 | #define CAN_ERR_CRTL_RX_PASSIVE 0x10 /* reached error passive status RX */ | ||
41 | #define CAN_ERR_CRTL_TX_PASSIVE 0x20 /* reached error passive status TX */ | ||
42 | /* (at least one error counter exceeds */ | ||
43 | /* the protocol-defined level of 127) */ | ||
44 | |||
45 | /* error in CAN protocol (type) / data[2] */ | ||
46 | #define CAN_ERR_PROT_UNSPEC 0x00 /* unspecified */ | ||
47 | #define CAN_ERR_PROT_BIT 0x01 /* single bit error */ | ||
48 | #define CAN_ERR_PROT_FORM 0x02 /* frame format error */ | ||
49 | #define CAN_ERR_PROT_STUFF 0x04 /* bit stuffing error */ | ||
50 | #define CAN_ERR_PROT_BIT0 0x08 /* unable to send dominant bit */ | ||
51 | #define CAN_ERR_PROT_BIT1 0x10 /* unable to send recessive bit */ | ||
52 | #define CAN_ERR_PROT_OVERLOAD 0x20 /* bus overload */ | ||
53 | #define CAN_ERR_PROT_ACTIVE 0x40 /* active error announcement */ | ||
54 | #define CAN_ERR_PROT_TX 0x80 /* error occured on transmission */ | ||
55 | |||
56 | /* error in CAN protocol (location) / data[3] */ | ||
57 | #define CAN_ERR_PROT_LOC_UNSPEC 0x00 /* unspecified */ | ||
58 | #define CAN_ERR_PROT_LOC_SOF 0x03 /* start of frame */ | ||
59 | #define CAN_ERR_PROT_LOC_ID28_21 0x02 /* ID bits 28 - 21 (SFF: 10 - 3) */ | ||
60 | #define CAN_ERR_PROT_LOC_ID20_18 0x06 /* ID bits 20 - 18 (SFF: 2 - 0 )*/ | ||
61 | #define CAN_ERR_PROT_LOC_SRTR 0x04 /* substitute RTR (SFF: RTR) */ | ||
62 | #define CAN_ERR_PROT_LOC_IDE 0x05 /* identifier extension */ | ||
63 | #define CAN_ERR_PROT_LOC_ID17_13 0x07 /* ID bits 17-13 */ | ||
64 | #define CAN_ERR_PROT_LOC_ID12_05 0x0F /* ID bits 12-5 */ | ||
65 | #define CAN_ERR_PROT_LOC_ID04_00 0x0E /* ID bits 4-0 */ | ||
66 | #define CAN_ERR_PROT_LOC_RTR 0x0C /* RTR */ | ||
67 | #define CAN_ERR_PROT_LOC_RES1 0x0D /* reserved bit 1 */ | ||
68 | #define CAN_ERR_PROT_LOC_RES0 0x09 /* reserved bit 0 */ | ||
69 | #define CAN_ERR_PROT_LOC_DLC 0x0B /* data length code */ | ||
70 | #define CAN_ERR_PROT_LOC_DATA 0x0A /* data section */ | ||
71 | #define CAN_ERR_PROT_LOC_CRC_SEQ 0x08 /* CRC sequence */ | ||
72 | #define CAN_ERR_PROT_LOC_CRC_DEL 0x18 /* CRC delimiter */ | ||
73 | #define CAN_ERR_PROT_LOC_ACK 0x19 /* ACK slot */ | ||
74 | #define CAN_ERR_PROT_LOC_ACK_DEL 0x1B /* ACK delimiter */ | ||
75 | #define CAN_ERR_PROT_LOC_EOF 0x1A /* end of frame */ | ||
76 | #define CAN_ERR_PROT_LOC_INTERM 0x12 /* intermission */ | ||
77 | |||
78 | /* error status of CAN-transceiver / data[4] */ | ||
79 | /* CANH CANL */ | ||
80 | #define CAN_ERR_TRX_UNSPEC 0x00 /* 0000 0000 */ | ||
81 | #define CAN_ERR_TRX_CANH_NO_WIRE 0x04 /* 0000 0100 */ | ||
82 | #define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05 /* 0000 0101 */ | ||
83 | #define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06 /* 0000 0110 */ | ||
84 | #define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07 /* 0000 0111 */ | ||
85 | #define CAN_ERR_TRX_CANL_NO_WIRE 0x40 /* 0100 0000 */ | ||
86 | #define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50 /* 0101 0000 */ | ||
87 | #define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60 /* 0110 0000 */ | ||
88 | #define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */ | ||
89 | #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */ | ||
90 | |||
91 | /* controller specific additional information / data[5..7] */ | ||
92 | |||
93 | #endif /* CAN_ERROR_H */ | ||
diff --git a/include/linux/can/raw.h b/include/linux/can/raw.h new file mode 100644 index 000000000000..b2a0f87492c5 --- /dev/null +++ b/include/linux/can/raw.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * linux/can/raw.h | ||
3 | * | ||
4 | * Definitions for raw CAN sockets | ||
5 | * | ||
6 | * Authors: Oliver Hartkopp <oliver.hartkopp@volkswagen.de> | ||
7 | * Urs Thuermann <urs.thuermann@volkswagen.de> | ||
8 | * Copyright (c) 2002-2007 Volkswagen Group Electronic Research | ||
9 | * All rights reserved. | ||
10 | * | ||
11 | * Send feedback to <socketcan-users@lists.berlios.de> | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #ifndef CAN_RAW_H | ||
16 | #define CAN_RAW_H | ||
17 | |||
18 | #include <linux/can.h> | ||
19 | |||
20 | #define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW) | ||
21 | |||
22 | /* for socket options affecting the socket (not the global system) */ | ||
23 | |||
24 | enum { | ||
25 | CAN_RAW_FILTER = 1, /* set 0 .. n can_filter(s) */ | ||
26 | CAN_RAW_ERR_FILTER, /* set filter for error frames */ | ||
27 | CAN_RAW_LOOPBACK, /* local loopback (default:on) */ | ||
28 | CAN_RAW_RECV_OWN_MSGS /* receive my own msgs (default:off) */ | ||
29 | }; | ||
30 | |||
31 | #endif | ||
diff --git a/include/linux/connector.h b/include/linux/connector.h index 13fc4541bf23..da6dd957f908 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h | |||
@@ -112,7 +112,6 @@ struct cn_queue_dev { | |||
112 | struct list_head queue_list; | 112 | struct list_head queue_list; |
113 | spinlock_t queue_lock; | 113 | spinlock_t queue_lock; |
114 | 114 | ||
115 | int netlink_groups; | ||
116 | struct sock *nls; | 115 | struct sock *nls; |
117 | }; | 116 | }; |
118 | 117 | ||
@@ -133,15 +132,13 @@ struct cn_callback_data { | |||
133 | 132 | ||
134 | struct cn_callback_entry { | 133 | struct cn_callback_entry { |
135 | struct list_head callback_entry; | 134 | struct list_head callback_entry; |
136 | struct cn_callback *cb; | ||
137 | struct work_struct work; | 135 | struct work_struct work; |
138 | struct cn_queue_dev *pdev; | 136 | struct cn_queue_dev *pdev; |
139 | 137 | ||
140 | struct cn_callback_id id; | 138 | struct cn_callback_id id; |
141 | struct cn_callback_data data; | 139 | struct cn_callback_data data; |
142 | 140 | ||
143 | int seq, group; | 141 | u32 seq, group; |
144 | struct sock *nls; | ||
145 | }; | 142 | }; |
146 | 143 | ||
147 | struct cn_ctl_entry { | 144 | struct cn_ctl_entry { |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 333c3ea82a5d..484e45c7c89a 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -205,6 +205,7 @@ struct dccp_so_feat { | |||
205 | #define DCCP_SOCKOPT_CHANGE_L 3 | 205 | #define DCCP_SOCKOPT_CHANGE_L 3 |
206 | #define DCCP_SOCKOPT_CHANGE_R 4 | 206 | #define DCCP_SOCKOPT_CHANGE_R 4 |
207 | #define DCCP_SOCKOPT_GET_CUR_MPS 5 | 207 | #define DCCP_SOCKOPT_GET_CUR_MPS 5 |
208 | #define DCCP_SOCKOPT_SERVER_TIMEWAIT 6 | ||
208 | #define DCCP_SOCKOPT_SEND_CSCOV 10 | 209 | #define DCCP_SOCKOPT_SEND_CSCOV 10 |
209 | #define DCCP_SOCKOPT_RECV_CSCOV 11 | 210 | #define DCCP_SOCKOPT_RECV_CSCOV 11 |
210 | #define DCCP_SOCKOPT_CCID_RX_INFO 128 | 211 | #define DCCP_SOCKOPT_CCID_RX_INFO 128 |
@@ -227,37 +228,50 @@ struct dccp_so_feat { | |||
227 | #include <net/tcp_states.h> | 228 | #include <net/tcp_states.h> |
228 | 229 | ||
229 | enum dccp_state { | 230 | enum dccp_state { |
230 | DCCP_OPEN = TCP_ESTABLISHED, | 231 | DCCP_OPEN = TCP_ESTABLISHED, |
231 | DCCP_REQUESTING = TCP_SYN_SENT, | 232 | DCCP_REQUESTING = TCP_SYN_SENT, |
232 | DCCP_PARTOPEN = TCP_FIN_WAIT1, /* FIXME: | 233 | DCCP_LISTEN = TCP_LISTEN, |
233 | This mapping is horrible, but TCP has | 234 | DCCP_RESPOND = TCP_SYN_RECV, |
234 | no matching state for DCCP_PARTOPEN, | 235 | /* |
235 | as TCP_SYN_RECV is already used by | 236 | * States involved in closing a DCCP connection: |
236 | DCCP_RESPOND, why don't stop using TCP | 237 | * 1) ACTIVE_CLOSEREQ is entered by a server sending a CloseReq. |
237 | mapping of states? OK, now we don't use | 238 | * |
238 | sk_stream_sendmsg anymore, so doesn't | 239 | * 2) CLOSING can have three different meanings (RFC 4340, 8.3): |
239 | seem to exist any reason for us to | 240 | * a. Client has performed active-close, has sent a Close to the server |
240 | do the TCP mapping here */ | 241 | * from state OPEN or PARTOPEN, and is waiting for the final Reset |
241 | DCCP_LISTEN = TCP_LISTEN, | 242 | * (in this case, SOCK_DONE == 1). |
242 | DCCP_RESPOND = TCP_SYN_RECV, | 243 | * b. Client is asked to perform passive-close, by receiving a CloseReq |
243 | DCCP_CLOSING = TCP_CLOSING, | 244 | * in (PART)OPEN state. It sends a Close and waits for final Reset |
244 | DCCP_TIME_WAIT = TCP_TIME_WAIT, | 245 | * (in this case, SOCK_DONE == 0). |
245 | DCCP_CLOSED = TCP_CLOSE, | 246 | * c. Server performs an active-close as in (a), keeps TIMEWAIT state. |
246 | DCCP_MAX_STATES = TCP_MAX_STATES, | 247 | * |
248 | * 3) The following intermediate states are employed to give passively | ||
249 | * closing nodes a chance to process their unread data: | ||
250 | * - PASSIVE_CLOSE (from OPEN => CLOSED) and | ||
251 | * - PASSIVE_CLOSEREQ (from (PART)OPEN to CLOSING; case (b) above). | ||
252 | */ | ||
253 | DCCP_ACTIVE_CLOSEREQ = TCP_FIN_WAIT1, | ||
254 | DCCP_PASSIVE_CLOSE = TCP_CLOSE_WAIT, /* any node receiving a Close */ | ||
255 | DCCP_CLOSING = TCP_CLOSING, | ||
256 | DCCP_TIME_WAIT = TCP_TIME_WAIT, | ||
257 | DCCP_CLOSED = TCP_CLOSE, | ||
258 | DCCP_PARTOPEN = TCP_MAX_STATES, | ||
259 | DCCP_PASSIVE_CLOSEREQ, /* clients receiving CloseReq */ | ||
260 | DCCP_MAX_STATES | ||
247 | }; | 261 | }; |
248 | 262 | ||
249 | #define DCCP_STATE_MASK 0xf | 263 | #define DCCP_STATE_MASK 0x1f |
250 | #define DCCP_ACTION_FIN (1<<7) | ||
251 | 264 | ||
252 | enum { | 265 | enum { |
253 | DCCPF_OPEN = TCPF_ESTABLISHED, | 266 | DCCPF_OPEN = TCPF_ESTABLISHED, |
254 | DCCPF_REQUESTING = TCPF_SYN_SENT, | 267 | DCCPF_REQUESTING = TCPF_SYN_SENT, |
255 | DCCPF_PARTOPEN = TCPF_FIN_WAIT1, | 268 | DCCPF_LISTEN = TCPF_LISTEN, |
256 | DCCPF_LISTEN = TCPF_LISTEN, | 269 | DCCPF_RESPOND = TCPF_SYN_RECV, |
257 | DCCPF_RESPOND = TCPF_SYN_RECV, | 270 | DCCPF_ACTIVE_CLOSEREQ = TCPF_FIN_WAIT1, |
258 | DCCPF_CLOSING = TCPF_CLOSING, | 271 | DCCPF_CLOSING = TCPF_CLOSING, |
259 | DCCPF_TIME_WAIT = TCPF_TIME_WAIT, | 272 | DCCPF_TIME_WAIT = TCPF_TIME_WAIT, |
260 | DCCPF_CLOSED = TCPF_CLOSE, | 273 | DCCPF_CLOSED = TCPF_CLOSE, |
274 | DCCPF_PARTOPEN = (1 << DCCP_PARTOPEN), | ||
261 | }; | 275 | }; |
262 | 276 | ||
263 | static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) | 277 | static inline struct dccp_hdr *dccp_hdr(const struct sk_buff *skb) |
@@ -393,13 +407,23 @@ struct dccp_opt_pend { | |||
393 | 407 | ||
394 | extern void dccp_minisock_init(struct dccp_minisock *dmsk); | 408 | extern void dccp_minisock_init(struct dccp_minisock *dmsk); |
395 | 409 | ||
396 | extern int dccp_parse_options(struct sock *sk, struct sk_buff *skb); | 410 | /** |
397 | 411 | * struct dccp_request_sock - represent DCCP-specific connection request | |
412 | * @dreq_inet_rsk: structure inherited from | ||
413 | * @dreq_iss: initial sequence number sent on the Response (RFC 4340, 7.1) | ||
414 | * @dreq_isr: initial sequence number received on the Request | ||
415 | * @dreq_service: service code present on the Request (there is just one) | ||
416 | * The following two fields are analogous to the ones in dccp_sock: | ||
417 | * @dreq_timestamp_echo: last received timestamp to echo (13.1) | ||
418 | * @dreq_timestamp_echo: the time of receiving the last @dreq_timestamp_echo | ||
419 | */ | ||
398 | struct dccp_request_sock { | 420 | struct dccp_request_sock { |
399 | struct inet_request_sock dreq_inet_rsk; | 421 | struct inet_request_sock dreq_inet_rsk; |
400 | __u64 dreq_iss; | 422 | __u64 dreq_iss; |
401 | __u64 dreq_isr; | 423 | __u64 dreq_isr; |
402 | __be32 dreq_service; | 424 | __be32 dreq_service; |
425 | __u32 dreq_timestamp_echo; | ||
426 | __u32 dreq_timestamp_time; | ||
403 | }; | 427 | }; |
404 | 428 | ||
405 | static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) | 429 | static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) |
@@ -409,6 +433,9 @@ static inline struct dccp_request_sock *dccp_rsk(const struct request_sock *req) | |||
409 | 433 | ||
410 | extern struct inet_timewait_death_row dccp_death_row; | 434 | extern struct inet_timewait_death_row dccp_death_row; |
411 | 435 | ||
436 | extern int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq, | ||
437 | struct sk_buff *skb); | ||
438 | |||
412 | struct dccp_options_received { | 439 | struct dccp_options_received { |
413 | u32 dccpor_ndp; /* only 24 bits */ | 440 | u32 dccpor_ndp; /* only 24 bits */ |
414 | u32 dccpor_timestamp; | 441 | u32 dccpor_timestamp; |
@@ -462,8 +489,8 @@ struct dccp_ackvec; | |||
462 | * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss | 489 | * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss |
463 | * @dccps_service - first (passive sock) or unique (active sock) service code | 490 | * @dccps_service - first (passive sock) or unique (active sock) service code |
464 | * @dccps_service_list - second .. last service code on passive socket | 491 | * @dccps_service_list - second .. last service code on passive socket |
465 | * @dccps_timestamp_time - time of latest TIMESTAMP option | ||
466 | * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option | 492 | * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option |
493 | * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo | ||
467 | * @dccps_l_ack_ratio - feature-local Ack Ratio | 494 | * @dccps_l_ack_ratio - feature-local Ack Ratio |
468 | * @dccps_r_ack_ratio - feature-remote Ack Ratio | 495 | * @dccps_r_ack_ratio - feature-remote Ack Ratio |
469 | * @dccps_pcslen - sender partial checksum coverage (via sockopt) | 496 | * @dccps_pcslen - sender partial checksum coverage (via sockopt) |
@@ -479,6 +506,7 @@ struct dccp_ackvec; | |||
479 | * @dccps_role - role of this sock, one of %dccp_role | 506 | * @dccps_role - role of this sock, one of %dccp_role |
480 | * @dccps_hc_rx_insert_options - receiver wants to add options when acking | 507 | * @dccps_hc_rx_insert_options - receiver wants to add options when acking |
481 | * @dccps_hc_tx_insert_options - sender wants to add options when sending | 508 | * @dccps_hc_tx_insert_options - sender wants to add options when sending |
509 | * @dccps_server_timewait - server holds timewait state on close (RFC 4340, 8.3) | ||
482 | * @dccps_xmit_timer - timer for when CCID is not ready to send | 510 | * @dccps_xmit_timer - timer for when CCID is not ready to send |
483 | * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs) | 511 | * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs) |
484 | */ | 512 | */ |
@@ -498,8 +526,8 @@ struct dccp_sock { | |||
498 | __u64 dccps_gar; | 526 | __u64 dccps_gar; |
499 | __be32 dccps_service; | 527 | __be32 dccps_service; |
500 | struct dccp_service_list *dccps_service_list; | 528 | struct dccp_service_list *dccps_service_list; |
501 | ktime_t dccps_timestamp_time; | ||
502 | __u32 dccps_timestamp_echo; | 529 | __u32 dccps_timestamp_echo; |
530 | __u32 dccps_timestamp_time; | ||
503 | __u16 dccps_l_ack_ratio; | 531 | __u16 dccps_l_ack_ratio; |
504 | __u16 dccps_r_ack_ratio; | 532 | __u16 dccps_r_ack_ratio; |
505 | __u16 dccps_pcslen; | 533 | __u16 dccps_pcslen; |
@@ -515,6 +543,7 @@ struct dccp_sock { | |||
515 | enum dccp_role dccps_role:2; | 543 | enum dccp_role dccps_role:2; |
516 | __u8 dccps_hc_rx_insert_options:1; | 544 | __u8 dccps_hc_rx_insert_options:1; |
517 | __u8 dccps_hc_tx_insert_options:1; | 545 | __u8 dccps_hc_tx_insert_options:1; |
546 | __u8 dccps_server_timewait:1; | ||
518 | struct timer_list dccps_xmit_timer; | 547 | struct timer_list dccps_xmit_timer; |
519 | }; | 548 | }; |
520 | 549 | ||
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 30621c27159f..5de6d911cdf7 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
@@ -54,6 +54,8 @@ | |||
54 | #define IEEE80211_STYPE_ACTION 0x00D0 | 54 | #define IEEE80211_STYPE_ACTION 0x00D0 |
55 | 55 | ||
56 | /* control */ | 56 | /* control */ |
57 | #define IEEE80211_STYPE_BACK_REQ 0x0080 | ||
58 | #define IEEE80211_STYPE_BACK 0x0090 | ||
57 | #define IEEE80211_STYPE_PSPOLL 0x00A0 | 59 | #define IEEE80211_STYPE_PSPOLL 0x00A0 |
58 | #define IEEE80211_STYPE_RTS 0x00B0 | 60 | #define IEEE80211_STYPE_RTS 0x00B0 |
59 | #define IEEE80211_STYPE_CTS 0x00C0 | 61 | #define IEEE80211_STYPE_CTS 0x00C0 |
@@ -81,18 +83,18 @@ | |||
81 | 83 | ||
82 | 84 | ||
83 | /* miscellaneous IEEE 802.11 constants */ | 85 | /* miscellaneous IEEE 802.11 constants */ |
84 | #define IEEE80211_MAX_FRAG_THRESHOLD 2346 | 86 | #define IEEE80211_MAX_FRAG_THRESHOLD 2352 |
85 | #define IEEE80211_MAX_RTS_THRESHOLD 2347 | 87 | #define IEEE80211_MAX_RTS_THRESHOLD 2353 |
86 | #define IEEE80211_MAX_AID 2007 | 88 | #define IEEE80211_MAX_AID 2007 |
87 | #define IEEE80211_MAX_TIM_LEN 251 | 89 | #define IEEE80211_MAX_TIM_LEN 251 |
88 | #define IEEE80211_MAX_DATA_LEN 2304 | ||
89 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section | 90 | /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section |
90 | 6.2.1.1.2. | 91 | 6.2.1.1.2. |
91 | 92 | ||
92 | The figure in section 7.1.2 suggests a body size of up to 2312 | 93 | 802.11e clarifies the figure in section 7.1.2. The frame body is |
93 | bytes is allowed, which is a bit confusing, I suspect this | 94 | up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */ |
94 | represents the 2304 bytes of real data, plus a possible 8 bytes of | 95 | #define IEEE80211_MAX_DATA_LEN 2304 |
95 | WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */ | 96 | /* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */ |
97 | #define IEEE80211_MAX_FRAME_LEN 2352 | ||
96 | 98 | ||
97 | #define IEEE80211_MAX_SSID_LEN 32 | 99 | #define IEEE80211_MAX_SSID_LEN 32 |
98 | 100 | ||
@@ -185,6 +187,25 @@ struct ieee80211_mgmt { | |||
185 | u8 new_chan; | 187 | u8 new_chan; |
186 | u8 switch_count; | 188 | u8 switch_count; |
187 | } __attribute__((packed)) chan_switch; | 189 | } __attribute__((packed)) chan_switch; |
190 | struct{ | ||
191 | u8 action_code; | ||
192 | u8 dialog_token; | ||
193 | __le16 capab; | ||
194 | __le16 timeout; | ||
195 | __le16 start_seq_num; | ||
196 | } __attribute__((packed)) addba_req; | ||
197 | struct{ | ||
198 | u8 action_code; | ||
199 | u8 dialog_token; | ||
200 | __le16 status; | ||
201 | __le16 capab; | ||
202 | __le16 timeout; | ||
203 | } __attribute__((packed)) addba_resp; | ||
204 | struct{ | ||
205 | u8 action_code; | ||
206 | __le16 params; | ||
207 | __le16 reason_code; | ||
208 | } __attribute__((packed)) delba; | ||
188 | } u; | 209 | } u; |
189 | } __attribute__ ((packed)) action; | 210 | } __attribute__ ((packed)) action; |
190 | } u; | 211 | } u; |
@@ -205,6 +226,66 @@ struct ieee80211_cts { | |||
205 | u8 ra[6]; | 226 | u8 ra[6]; |
206 | } __attribute__ ((packed)); | 227 | } __attribute__ ((packed)); |
207 | 228 | ||
229 | /** | ||
230 | * struct ieee80211_bar - HT Block Ack Request | ||
231 | * | ||
232 | * This structure refers to "HT BlockAckReq" as | ||
233 | * described in 802.11n draft section 7.2.1.7.1 | ||
234 | */ | ||
235 | struct ieee80211_bar { | ||
236 | __le16 frame_control; | ||
237 | __le16 duration; | ||
238 | __u8 ra[6]; | ||
239 | __u8 ta[6]; | ||
240 | __le16 control; | ||
241 | __le16 start_seq_num; | ||
242 | } __attribute__((packed)); | ||
243 | |||
244 | /** | ||
245 | * struct ieee80211_ht_cap - HT capabilities | ||
246 | * | ||
247 | * This structure refers to "HT capabilities element" as | ||
248 | * described in 802.11n draft section 7.3.2.52 | ||
249 | */ | ||
250 | struct ieee80211_ht_cap { | ||
251 | __le16 cap_info; | ||
252 | u8 ampdu_params_info; | ||
253 | u8 supp_mcs_set[16]; | ||
254 | __le16 extended_ht_cap_info; | ||
255 | __le32 tx_BF_cap_info; | ||
256 | u8 antenna_selection_info; | ||
257 | } __attribute__ ((packed)); | ||
258 | |||
259 | /** | ||
260 | * struct ieee80211_ht_cap - HT additional information | ||
261 | * | ||
262 | * This structure refers to "HT information element" as | ||
263 | * described in 802.11n draft section 7.3.2.53 | ||
264 | */ | ||
265 | struct ieee80211_ht_addt_info { | ||
266 | u8 control_chan; | ||
267 | u8 ht_param; | ||
268 | __le16 operation_mode; | ||
269 | __le16 stbc_param; | ||
270 | u8 basic_set[16]; | ||
271 | } __attribute__ ((packed)); | ||
272 | |||
273 | /* 802.11n HT capabilities masks */ | ||
274 | #define IEEE80211_HT_CAP_SUP_WIDTH 0x0002 | ||
275 | #define IEEE80211_HT_CAP_MIMO_PS 0x000C | ||
276 | #define IEEE80211_HT_CAP_GRN_FLD 0x0010 | ||
277 | #define IEEE80211_HT_CAP_SGI_20 0x0020 | ||
278 | #define IEEE80211_HT_CAP_SGI_40 0x0040 | ||
279 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 | ||
280 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 | ||
281 | #define IEEE80211_HT_CAP_AMPDU_FACTOR 0x03 | ||
282 | #define IEEE80211_HT_CAP_AMPDU_DENSITY 0x1C | ||
283 | /* 802.11n HT IE masks */ | ||
284 | #define IEEE80211_HT_IE_CHA_SEC_OFFSET 0x03 | ||
285 | #define IEEE80211_HT_IE_CHA_WIDTH 0x04 | ||
286 | #define IEEE80211_HT_IE_HT_PROTECTION 0x0003 | ||
287 | #define IEEE80211_HT_IE_NON_GF_STA_PRSNT 0x0004 | ||
288 | #define IEEE80211_HT_IE_NON_HT_STA_PRSNT 0x0010 | ||
208 | 289 | ||
209 | /* Authentication algorithms */ | 290 | /* Authentication algorithms */ |
210 | #define WLAN_AUTH_OPEN 0 | 291 | #define WLAN_AUTH_OPEN 0 |
@@ -271,6 +352,18 @@ enum ieee80211_statuscode { | |||
271 | WLAN_STATUS_UNSUPP_RSN_VERSION = 44, | 352 | WLAN_STATUS_UNSUPP_RSN_VERSION = 44, |
272 | WLAN_STATUS_INVALID_RSN_IE_CAP = 45, | 353 | WLAN_STATUS_INVALID_RSN_IE_CAP = 45, |
273 | WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, | 354 | WLAN_STATUS_CIPHER_SUITE_REJECTED = 46, |
355 | /* 802.11e */ | ||
356 | WLAN_STATUS_UNSPECIFIED_QOS = 32, | ||
357 | WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33, | ||
358 | WLAN_STATUS_ASSOC_DENIED_LOWACK = 34, | ||
359 | WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35, | ||
360 | WLAN_STATUS_REQUEST_DECLINED = 37, | ||
361 | WLAN_STATUS_INVALID_QOS_PARAM = 38, | ||
362 | WLAN_STATUS_CHANGE_TSPEC = 39, | ||
363 | WLAN_STATUS_WAIT_TS_DELAY = 47, | ||
364 | WLAN_STATUS_NO_DIRECT_LINK = 48, | ||
365 | WLAN_STATUS_STA_NOT_PRESENT = 49, | ||
366 | WLAN_STATUS_STA_NOT_QSTA = 50, | ||
274 | }; | 367 | }; |
275 | 368 | ||
276 | 369 | ||
@@ -301,6 +394,16 @@ enum ieee80211_reasoncode { | |||
301 | WLAN_REASON_INVALID_RSN_IE_CAP = 22, | 394 | WLAN_REASON_INVALID_RSN_IE_CAP = 22, |
302 | WLAN_REASON_IEEE8021X_FAILED = 23, | 395 | WLAN_REASON_IEEE8021X_FAILED = 23, |
303 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, | 396 | WLAN_REASON_CIPHER_SUITE_REJECTED = 24, |
397 | /* 802.11e */ | ||
398 | WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32, | ||
399 | WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33, | ||
400 | WLAN_REASON_DISASSOC_LOW_ACK = 34, | ||
401 | WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35, | ||
402 | WLAN_REASON_QSTA_LEAVE_QBSS = 36, | ||
403 | WLAN_REASON_QSTA_NOT_USE = 37, | ||
404 | WLAN_REASON_QSTA_REQUIRE_SETUP = 38, | ||
405 | WLAN_REASON_QSTA_TIMEOUT = 39, | ||
406 | WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45, | ||
304 | }; | 407 | }; |
305 | 408 | ||
306 | 409 | ||
@@ -319,6 +422,15 @@ enum ieee80211_eid { | |||
319 | WLAN_EID_HP_PARAMS = 8, | 422 | WLAN_EID_HP_PARAMS = 8, |
320 | WLAN_EID_HP_TABLE = 9, | 423 | WLAN_EID_HP_TABLE = 9, |
321 | WLAN_EID_REQUEST = 10, | 424 | WLAN_EID_REQUEST = 10, |
425 | /* 802.11e */ | ||
426 | WLAN_EID_QBSS_LOAD = 11, | ||
427 | WLAN_EID_EDCA_PARAM_SET = 12, | ||
428 | WLAN_EID_TSPEC = 13, | ||
429 | WLAN_EID_TCLAS = 14, | ||
430 | WLAN_EID_SCHEDULE = 15, | ||
431 | WLAN_EID_TS_DELAY = 43, | ||
432 | WLAN_EID_TCLAS_PROCESSING = 44, | ||
433 | WLAN_EID_QOS_CAPA = 46, | ||
322 | /* 802.11h */ | 434 | /* 802.11h */ |
323 | WLAN_EID_PWR_CONSTRAINT = 32, | 435 | WLAN_EID_PWR_CONSTRAINT = 32, |
324 | WLAN_EID_PWR_CAPABILITY = 33, | 436 | WLAN_EID_PWR_CAPABILITY = 33, |
@@ -333,6 +445,9 @@ enum ieee80211_eid { | |||
333 | /* 802.11g */ | 445 | /* 802.11g */ |
334 | WLAN_EID_ERP_INFO = 42, | 446 | WLAN_EID_ERP_INFO = 42, |
335 | WLAN_EID_EXT_SUPP_RATES = 50, | 447 | WLAN_EID_EXT_SUPP_RATES = 50, |
448 | /* 802.11n */ | ||
449 | WLAN_EID_HT_CAPABILITY = 45, | ||
450 | WLAN_EID_HT_EXTRA_INFO = 61, | ||
336 | /* 802.11i */ | 451 | /* 802.11i */ |
337 | WLAN_EID_RSN = 48, | 452 | WLAN_EID_RSN = 48, |
338 | WLAN_EID_WPA = 221, | 453 | WLAN_EID_WPA = 221, |
@@ -341,6 +456,32 @@ enum ieee80211_eid { | |||
341 | WLAN_EID_QOS_PARAMETER = 222 | 456 | WLAN_EID_QOS_PARAMETER = 222 |
342 | }; | 457 | }; |
343 | 458 | ||
459 | /* Action category code */ | ||
460 | enum ieee80211_category { | ||
461 | WLAN_CATEGORY_SPECTRUM_MGMT = 0, | ||
462 | WLAN_CATEGORY_QOS = 1, | ||
463 | WLAN_CATEGORY_DLS = 2, | ||
464 | WLAN_CATEGORY_BACK = 3, | ||
465 | WLAN_CATEGORY_WMM = 17, | ||
466 | }; | ||
467 | |||
468 | /* BACK action code */ | ||
469 | enum ieee80211_back_actioncode { | ||
470 | WLAN_ACTION_ADDBA_REQ = 0, | ||
471 | WLAN_ACTION_ADDBA_RESP = 1, | ||
472 | WLAN_ACTION_DELBA = 2, | ||
473 | }; | ||
474 | |||
475 | /* BACK (block-ack) parties */ | ||
476 | enum ieee80211_back_parties { | ||
477 | WLAN_BACK_RECIPIENT = 0, | ||
478 | WLAN_BACK_INITIATOR = 1, | ||
479 | WLAN_BACK_TIMER = 2, | ||
480 | }; | ||
481 | |||
482 | /* A-MSDU 802.11n */ | ||
483 | #define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080 | ||
484 | |||
344 | /* cipher suite selectors */ | 485 | /* cipher suite selectors */ |
345 | #define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00 | 486 | #define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00 |
346 | #define WLAN_CIPHER_SUITE_WEP40 0x000FAC01 | 487 | #define WLAN_CIPHER_SUITE_WEP40 0x000FAC01 |
diff --git a/include/linux/if.h b/include/linux/if.h index 32bf419351f1..5c9d1fa93fef 100644 --- a/include/linux/if.h +++ b/include/linux/if.h | |||
@@ -50,7 +50,9 @@ | |||
50 | #define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ | 50 | #define IFF_LOWER_UP 0x10000 /* driver signals L1 up */ |
51 | #define IFF_DORMANT 0x20000 /* driver signals dormant */ | 51 | #define IFF_DORMANT 0x20000 /* driver signals dormant */ |
52 | 52 | ||
53 | #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|\ | 53 | #define IFF_ECHO 0x40000 /* echo sent packets */ |
54 | |||
55 | #define IFF_VOLATILE (IFF_LOOPBACK|IFF_POINTOPOINT|IFF_BROADCAST|IFF_ECHO|\ | ||
54 | IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) | 56 | IFF_MASTER|IFF_SLAVE|IFF_RUNNING|IFF_LOWER_UP|IFF_DORMANT) |
55 | 57 | ||
56 | /* Private (from user) interface flags (netdevice->priv_flags). */ | 58 | /* Private (from user) interface flags (netdevice->priv_flags). */ |
@@ -61,6 +63,7 @@ | |||
61 | #define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ | 63 | #define IFF_MASTER_ALB 0x10 /* bonding master, balance-alb. */ |
62 | #define IFF_BONDING 0x20 /* bonding master or slave */ | 64 | #define IFF_BONDING 0x20 /* bonding master or slave */ |
63 | #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ | 65 | #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ |
66 | #define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ | ||
64 | 67 | ||
65 | #define IF_GET_IFACE 0x0001 /* for querying only */ | 68 | #define IF_GET_IFACE 0x0001 /* for querying only */ |
66 | #define IF_GET_PROTO 0x0002 | 69 | #define IF_GET_PROTO 0x0002 |
diff --git a/include/linux/if_addrlabel.h b/include/linux/if_addrlabel.h new file mode 100644 index 000000000000..9fe79c95dd28 --- /dev/null +++ b/include/linux/if_addrlabel.h | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | * if_addrlabel.h - netlink interface for address labels | ||
3 | * | ||
4 | * Copyright (C)2007 USAGI/WIDE Project, All Rights Reserved. | ||
5 | * | ||
6 | * Authors: | ||
7 | * YOSHIFUJI Hideaki @ USAGI/WIDE <yoshfuji@linux-ipv6.org> | ||
8 | */ | ||
9 | |||
10 | #ifndef __LINUX_IF_ADDRLABEL_H | ||
11 | #define __LINUX_IF_ADDRLABEL_H | ||
12 | |||
13 | struct ifaddrlblmsg | ||
14 | { | ||
15 | __u8 ifal_family; /* Address family */ | ||
16 | __u8 __ifal_reserved; /* Reserved */ | ||
17 | __u8 ifal_prefixlen; /* Prefix length */ | ||
18 | __u8 ifal_flags; /* Flags */ | ||
19 | __u32 ifal_index; /* Link index */ | ||
20 | __u32 ifal_seq; /* sequence number */ | ||
21 | }; | ||
22 | |||
23 | enum | ||
24 | { | ||
25 | IFAL_ADDRESS = 1, | ||
26 | IFAL_LABEL = 2, | ||
27 | __IFAL_MAX | ||
28 | }; | ||
29 | |||
30 | #define IFAL_MAX (__IFAL_MAX - 1) | ||
31 | |||
32 | #endif | ||
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index ed7b93c3083a..296e8e86e91d 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h | |||
@@ -52,6 +52,7 @@ | |||
52 | #define ARPHRD_ROSE 270 | 52 | #define ARPHRD_ROSE 270 |
53 | #define ARPHRD_X25 271 /* CCITT X.25 */ | 53 | #define ARPHRD_X25 271 /* CCITT X.25 */ |
54 | #define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */ | 54 | #define ARPHRD_HWX25 272 /* Boards with X.25 in firmware */ |
55 | #define ARPHRD_CAN 280 /* Controller Area Network */ | ||
55 | #define ARPHRD_PPP 512 | 56 | #define ARPHRD_PPP 512 |
56 | #define ARPHRD_CISCO 513 /* Cisco HDLC */ | 57 | #define ARPHRD_CISCO 513 /* Cisco HDLC */ |
57 | #define ARPHRD_HDLC ARPHRD_CISCO | 58 | #define ARPHRD_HDLC ARPHRD_CISCO |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index 5f9297793661..e157c1399b61 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -90,6 +90,7 @@ | |||
90 | #define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ | 90 | #define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ |
91 | #define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ | 91 | #define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ |
92 | #define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ | 92 | #define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ |
93 | #define ETH_P_CAN 0x000C /* Controller Area Network */ | ||
93 | #define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ | 94 | #define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ |
94 | #define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ | 95 | #define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ |
95 | #define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ | 96 | #define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ |
@@ -123,12 +124,15 @@ int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr); | |||
123 | extern struct ctl_table ether_table[]; | 124 | extern struct ctl_table ether_table[]; |
124 | #endif | 125 | #endif |
125 | 126 | ||
127 | extern ssize_t sysfs_format_mac(char *buf, const unsigned char *addr, int len); | ||
128 | |||
126 | /* | 129 | /* |
127 | * Display a 6 byte device address (MAC) in a readable format. | 130 | * Display a 6 byte device address (MAC) in a readable format. |
128 | */ | 131 | */ |
132 | extern char *print_mac(char *buf, const unsigned char *addr); | ||
129 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" | 133 | #define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" |
130 | extern char *print_mac(char *buf, const u8 *addr); | 134 | #define MAC_BUF_SIZE 18 |
131 | #define DECLARE_MAC_BUF(var) char var[18] __maybe_unused | 135 | #define DECLARE_MAC_BUF(var) char var[MAC_BUF_SIZE] __maybe_unused |
132 | 136 | ||
133 | #endif | 137 | #endif |
134 | 138 | ||
diff --git a/include/linux/if_frad.h b/include/linux/if_frad.h index f272a80caa3e..5c34240de746 100644 --- a/include/linux/if_frad.h +++ b/include/linux/if_frad.h | |||
@@ -137,7 +137,7 @@ struct frhdr | |||
137 | 137 | ||
138 | unsigned char NLPID; | 138 | unsigned char NLPID; |
139 | unsigned char OUI[3]; | 139 | unsigned char OUI[3]; |
140 | unsigned short PID; | 140 | __be16 PID; |
141 | 141 | ||
142 | #define IP_NLPID pad | 142 | #define IP_NLPID pad |
143 | } __attribute__((packed)); | 143 | } __attribute__((packed)); |
diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h deleted file mode 100644 index 3b1b7ba19825..000000000000 --- a/include/linux/if_shaper.h +++ /dev/null | |||
@@ -1,51 +0,0 @@ | |||
1 | #ifndef __LINUX_SHAPER_H | ||
2 | #define __LINUX_SHAPER_H | ||
3 | |||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #define SHAPER_QLEN 10 | ||
7 | /* | ||
8 | * This is a bit speed dependent (read it shouldn't be a constant!) | ||
9 | * | ||
10 | * 5 is about right for 28.8 upwards. Below that double for every | ||
11 | * halving of speed or so. - ie about 20 for 9600 baud. | ||
12 | */ | ||
13 | #define SHAPER_LATENCY (5*HZ) | ||
14 | #define SHAPER_MAXSLIP 2 | ||
15 | #define SHAPER_BURST (HZ/50) /* Good for >128K then */ | ||
16 | |||
17 | struct shaper | ||
18 | { | ||
19 | struct sk_buff_head sendq; | ||
20 | __u32 bytespertick; | ||
21 | __u32 bitspersec; | ||
22 | __u32 shapelatency; | ||
23 | __u32 shapeclock; | ||
24 | unsigned long recovery; /* Time we can next clock a packet out on | ||
25 | an empty queue */ | ||
26 | spinlock_t lock; | ||
27 | struct net_device *dev; | ||
28 | struct net_device_stats* (*get_stats)(struct net_device *dev); | ||
29 | struct timer_list timer; | ||
30 | }; | ||
31 | |||
32 | #endif | ||
33 | |||
34 | #define SHAPER_SET_DEV 0x0001 | ||
35 | #define SHAPER_SET_SPEED 0x0002 | ||
36 | #define SHAPER_GET_DEV 0x0003 | ||
37 | #define SHAPER_GET_SPEED 0x0004 | ||
38 | |||
39 | struct shaperconf | ||
40 | { | ||
41 | __u16 ss_cmd; | ||
42 | union | ||
43 | { | ||
44 | char ssu_name[14]; | ||
45 | __u32 ssu_speed; | ||
46 | } ss_u; | ||
47 | #define ss_speed ss_u.ssu_speed | ||
48 | #define ss_name ss_u.ssu_name | ||
49 | }; | ||
50 | |||
51 | #endif | ||
diff --git a/include/linux/if_tr.h b/include/linux/if_tr.h index 046e9d95ba9a..5bcec8b2c5e2 100644 --- a/include/linux/if_tr.h +++ b/include/linux/if_tr.h | |||
@@ -49,9 +49,6 @@ static inline struct trh_hdr *tr_hdr(const struct sk_buff *skb) | |||
49 | { | 49 | { |
50 | return (struct trh_hdr *)skb_mac_header(skb); | 50 | return (struct trh_hdr *)skb_mac_header(skb); |
51 | } | 51 | } |
52 | #ifdef CONFIG_SYSCTL | ||
53 | extern struct ctl_table tr_table[]; | ||
54 | #endif | ||
55 | #endif | 52 | #endif |
56 | 53 | ||
57 | /* This is an Token-Ring LLC structure */ | 54 | /* This is an Token-Ring LLC structure */ |
diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h index 33e489d5bb33..72f1c5f47be3 100644 --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h | |||
@@ -21,6 +21,8 @@ | |||
21 | /* Uncomment to enable debugging */ | 21 | /* Uncomment to enable debugging */ |
22 | /* #define TUN_DEBUG 1 */ | 22 | /* #define TUN_DEBUG 1 */ |
23 | 23 | ||
24 | #include <linux/types.h> | ||
25 | |||
24 | #ifdef __KERNEL__ | 26 | #ifdef __KERNEL__ |
25 | 27 | ||
26 | #ifdef TUN_DEBUG | 28 | #ifdef TUN_DEBUG |
@@ -88,7 +90,7 @@ struct tun_struct { | |||
88 | 90 | ||
89 | struct tun_pi { | 91 | struct tun_pi { |
90 | unsigned short flags; | 92 | unsigned short flags; |
91 | unsigned short proto; | 93 | __be16 proto; |
92 | }; | 94 | }; |
93 | #define TUN_PKT_STRIP 0x0001 | 95 | #define TUN_PKT_STRIP 0x0001 |
94 | 96 | ||
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h index 660b5010c2d9..228eb4eb3129 100644 --- a/include/linux/if_tunnel.h +++ b/include/linux/if_tunnel.h | |||
@@ -17,6 +17,9 @@ | |||
17 | #define GRE_FLAGS __constant_htons(0x00F8) | 17 | #define GRE_FLAGS __constant_htons(0x00F8) |
18 | #define GRE_VERSION __constant_htons(0x0007) | 18 | #define GRE_VERSION __constant_htons(0x0007) |
19 | 19 | ||
20 | /* i_flags values for SIT mode */ | ||
21 | #define SIT_ISATAP 0x0001 | ||
22 | |||
20 | struct ip_tunnel_parm | 23 | struct ip_tunnel_parm |
21 | { | 24 | { |
22 | char name[IFNAMSIZ]; | 25 | char name[IFNAMSIZ]; |
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 976d4b1067d1..34f40efc7607 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h | |||
@@ -16,11 +16,6 @@ | |||
16 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
17 | 17 | ||
18 | /* externally defined structs */ | 18 | /* externally defined structs */ |
19 | struct vlan_group; | ||
20 | struct net_device; | ||
21 | struct packet_type; | ||
22 | struct vlan_collection; | ||
23 | struct vlan_dev_info; | ||
24 | struct hlist_node; | 19 | struct hlist_node; |
25 | 20 | ||
26 | #include <linux/netdevice.h> | 21 | #include <linux/netdevice.h> |
@@ -39,12 +34,30 @@ struct hlist_node; | |||
39 | #define VLAN_ETH_DATA_LEN 1500 /* Max. octets in payload */ | 34 | #define VLAN_ETH_DATA_LEN 1500 /* Max. octets in payload */ |
40 | #define VLAN_ETH_FRAME_LEN 1518 /* Max. octets in frame sans FCS */ | 35 | #define VLAN_ETH_FRAME_LEN 1518 /* Max. octets in frame sans FCS */ |
41 | 36 | ||
37 | /* | ||
38 | * struct vlan_hdr - vlan header | ||
39 | * @h_vlan_TCI: priority and VLAN ID | ||
40 | * @h_vlan_encapsulated_proto: packet type ID or len | ||
41 | */ | ||
42 | struct vlan_hdr { | ||
43 | __be16 h_vlan_TCI; | ||
44 | __be16 h_vlan_encapsulated_proto; | ||
45 | }; | ||
46 | |||
47 | /** | ||
48 | * struct vlan_ethhdr - vlan ethernet header (ethhdr + vlan_hdr) | ||
49 | * @h_dest: destination ethernet address | ||
50 | * @h_source: source ethernet address | ||
51 | * @h_vlan_proto: ethernet protocol (always 0x8100) | ||
52 | * @h_vlan_TCI: priority and VLAN ID | ||
53 | * @h_vlan_encapsulated_proto: packet type ID or len | ||
54 | */ | ||
42 | struct vlan_ethhdr { | 55 | struct vlan_ethhdr { |
43 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ | 56 | unsigned char h_dest[ETH_ALEN]; |
44 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ | 57 | unsigned char h_source[ETH_ALEN]; |
45 | __be16 h_vlan_proto; /* Should always be 0x8100 */ | 58 | __be16 h_vlan_proto; |
46 | __be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */ | 59 | __be16 h_vlan_TCI; |
47 | __be16 h_vlan_encapsulated_proto; /* packet type ID field (or len) */ | 60 | __be16 h_vlan_encapsulated_proto; |
48 | }; | 61 | }; |
49 | 62 | ||
50 | #include <linux/skbuff.h> | 63 | #include <linux/skbuff.h> |
@@ -54,18 +67,11 @@ static inline struct vlan_ethhdr *vlan_eth_hdr(const struct sk_buff *skb) | |||
54 | return (struct vlan_ethhdr *)skb_mac_header(skb); | 67 | return (struct vlan_ethhdr *)skb_mac_header(skb); |
55 | } | 68 | } |
56 | 69 | ||
57 | struct vlan_hdr { | ||
58 | __be16 h_vlan_TCI; /* Encapsulates priority and VLAN ID */ | ||
59 | __be16 h_vlan_encapsulated_proto; /* packet type ID field (or len) */ | ||
60 | }; | ||
61 | |||
62 | #define VLAN_VID_MASK 0xfff | 70 | #define VLAN_VID_MASK 0xfff |
63 | 71 | ||
64 | /* found in socket.c */ | 72 | /* found in socket.c */ |
65 | extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); | 73 | extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); |
66 | 74 | ||
67 | #define VLAN_NAME "vlan" | ||
68 | |||
69 | /* if this changes, algorithm will have to be reworked because this | 75 | /* if this changes, algorithm will have to be reworked because this |
70 | * depends on completely exhausting the VLAN identifier space. Thus | 76 | * depends on completely exhausting the VLAN identifier space. Thus |
71 | * it gives constant time look-up, but in many cases it wastes memory. | 77 | * it gives constant time look-up, but in many cases it wastes memory. |
@@ -76,19 +82,22 @@ extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *)); | |||
76 | 82 | ||
77 | struct vlan_group { | 83 | struct vlan_group { |
78 | int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ | 84 | int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ |
85 | unsigned int nr_vlans; | ||
79 | struct hlist_node hlist; /* linked list */ | 86 | struct hlist_node hlist; /* linked list */ |
80 | struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; | 87 | struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; |
81 | struct rcu_head rcu; | 88 | struct rcu_head rcu; |
82 | }; | 89 | }; |
83 | 90 | ||
84 | static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, int vlan_id) | 91 | static inline struct net_device *vlan_group_get_device(struct vlan_group *vg, |
92 | unsigned int vlan_id) | ||
85 | { | 93 | { |
86 | struct net_device **array; | 94 | struct net_device **array; |
87 | array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; | 95 | array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; |
88 | return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN]; | 96 | return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN]; |
89 | } | 97 | } |
90 | 98 | ||
91 | static inline void vlan_group_set_device(struct vlan_group *vg, int vlan_id, | 99 | static inline void vlan_group_set_device(struct vlan_group *vg, |
100 | unsigned int vlan_id, | ||
92 | struct net_device *dev) | 101 | struct net_device *dev) |
93 | { | 102 | { |
94 | struct net_device **array; | 103 | struct net_device **array; |
@@ -132,22 +141,18 @@ struct vlan_dev_info { | |||
132 | struct proc_dir_entry *dent; /* Holds the proc data */ | 141 | struct proc_dir_entry *dent; /* Holds the proc data */ |
133 | unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */ | 142 | unsigned long cnt_inc_headroom_on_tx; /* How many times did we have to grow the skb on TX. */ |
134 | unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */ | 143 | unsigned long cnt_encap_on_xmit; /* How many times did we have to encapsulate the skb on TX. */ |
135 | struct net_device_stats dev_stats; /* Device stats (rx-bytes, tx-pkts, etc...) */ | ||
136 | }; | 144 | }; |
137 | 145 | ||
138 | #define VLAN_DEV_INFO(x) ((struct vlan_dev_info *)(x->priv)) | 146 | static inline struct vlan_dev_info *vlan_dev_info(const struct net_device *dev) |
139 | |||
140 | /* inline functions */ | ||
141 | |||
142 | static inline struct net_device_stats *vlan_dev_get_stats(struct net_device *dev) | ||
143 | { | 147 | { |
144 | return &(VLAN_DEV_INFO(dev)->dev_stats); | 148 | return netdev_priv(dev); |
145 | } | 149 | } |
146 | 150 | ||
151 | /* inline functions */ | ||
147 | static inline __u32 vlan_get_ingress_priority(struct net_device *dev, | 152 | static inline __u32 vlan_get_ingress_priority(struct net_device *dev, |
148 | unsigned short vlan_tag) | 153 | unsigned short vlan_tag) |
149 | { | 154 | { |
150 | struct vlan_dev_info *vip = VLAN_DEV_INFO(dev); | 155 | struct vlan_dev_info *vip = vlan_dev_info(dev); |
151 | 156 | ||
152 | return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7]; | 157 | return vip->ingress_priority_map[(vlan_tag >> 13) & 0x7]; |
153 | } | 158 | } |
@@ -188,7 +193,7 @@ static inline int __vlan_hwaccel_rx(struct sk_buff *skb, | |||
188 | 193 | ||
189 | skb->dev->last_rx = jiffies; | 194 | skb->dev->last_rx = jiffies; |
190 | 195 | ||
191 | stats = vlan_dev_get_stats(skb->dev); | 196 | stats = &skb->dev->stats; |
192 | stats->rx_packets++; | 197 | stats->rx_packets++; |
193 | stats->rx_bytes += skb->len; | 198 | stats->rx_bytes += skb->len; |
194 | 199 | ||
@@ -266,12 +271,12 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, unsigned short | |||
266 | memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN); | 271 | memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN); |
267 | 272 | ||
268 | /* first, the ethernet type */ | 273 | /* first, the ethernet type */ |
269 | veth->h_vlan_proto = __constant_htons(ETH_P_8021Q); | 274 | veth->h_vlan_proto = htons(ETH_P_8021Q); |
270 | 275 | ||
271 | /* now, the tag */ | 276 | /* now, the tag */ |
272 | veth->h_vlan_TCI = htons(tag); | 277 | veth->h_vlan_TCI = htons(tag); |
273 | 278 | ||
274 | skb->protocol = __constant_htons(ETH_P_8021Q); | 279 | skb->protocol = htons(ETH_P_8021Q); |
275 | skb->mac_header -= VLAN_HLEN; | 280 | skb->mac_header -= VLAN_HLEN; |
276 | skb->network_header -= VLAN_HLEN; | 281 | skb->network_header -= VLAN_HLEN; |
277 | 282 | ||
@@ -326,7 +331,7 @@ static inline int __vlan_get_tag(struct sk_buff *skb, unsigned short *tag) | |||
326 | { | 331 | { |
327 | struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; | 332 | struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb->data; |
328 | 333 | ||
329 | if (veth->h_vlan_proto != __constant_htons(ETH_P_8021Q)) { | 334 | if (veth->h_vlan_proto != htons(ETH_P_8021Q)) { |
330 | return -EINVAL; | 335 | return -EINVAL; |
331 | } | 336 | } |
332 | 337 | ||
diff --git a/include/linux/in.h b/include/linux/in.h index 3975cbf52f20..70c6df882694 100644 --- a/include/linux/in.h +++ b/include/linux/in.h | |||
@@ -246,13 +246,69 @@ struct sockaddr_in { | |||
246 | #include <asm/byteorder.h> | 246 | #include <asm/byteorder.h> |
247 | 247 | ||
248 | #ifdef __KERNEL__ | 248 | #ifdef __KERNEL__ |
249 | /* Some random defines to make it easier in the kernel.. */ | ||
250 | #define LOOPBACK(x) (((x) & htonl(0xff000000)) == htonl(0x7f000000)) | ||
251 | #define MULTICAST(x) (((x) & htonl(0xf0000000)) == htonl(0xe0000000)) | ||
252 | #define BADCLASS(x) (((x) & htonl(0xf0000000)) == htonl(0xf0000000)) | ||
253 | #define ZERONET(x) (((x) & htonl(0xff000000)) == htonl(0x00000000)) | ||
254 | #define LOCAL_MCAST(x) (((x) & htonl(0xFFFFFF00)) == htonl(0xE0000000)) | ||
255 | 249 | ||
250 | static inline bool ipv4_is_loopback(__be32 addr) | ||
251 | { | ||
252 | return (addr & htonl(0xff000000)) == htonl(0x7f000000); | ||
253 | } | ||
254 | |||
255 | static inline bool ipv4_is_multicast(__be32 addr) | ||
256 | { | ||
257 | return (addr & htonl(0xf0000000)) == htonl(0xe0000000); | ||
258 | } | ||
259 | |||
260 | static inline bool ipv4_is_local_multicast(__be32 addr) | ||
261 | { | ||
262 | return (addr & htonl(0xffffff00)) == htonl(0xe0000000); | ||
263 | } | ||
264 | |||
265 | static inline bool ipv4_is_lbcast(__be32 addr) | ||
266 | { | ||
267 | /* limited broadcast */ | ||
268 | return addr == INADDR_BROADCAST; | ||
269 | } | ||
270 | |||
271 | static inline bool ipv4_is_zeronet(__be32 addr) | ||
272 | { | ||
273 | return (addr & htonl(0xff000000)) == htonl(0x00000000); | ||
274 | } | ||
275 | |||
276 | /* Special-Use IPv4 Addresses (RFC3330) */ | ||
277 | |||
278 | static inline bool ipv4_is_private_10(__be32 addr) | ||
279 | { | ||
280 | return (addr & htonl(0xff000000)) == htonl(0x0a000000); | ||
281 | } | ||
282 | |||
283 | static inline bool ipv4_is_private_172(__be32 addr) | ||
284 | { | ||
285 | return (addr & htonl(0xfff00000)) == htonl(0xac100000); | ||
286 | } | ||
287 | |||
288 | static inline bool ipv4_is_private_192(__be32 addr) | ||
289 | { | ||
290 | return (addr & htonl(0xffff0000)) == htonl(0xc0a80000); | ||
291 | } | ||
292 | |||
293 | static inline bool ipv4_is_linklocal_169(__be32 addr) | ||
294 | { | ||
295 | return (addr & htonl(0xffff0000)) == htonl(0xa9fe0000); | ||
296 | } | ||
297 | |||
298 | static inline bool ipv4_is_anycast_6to4(__be32 addr) | ||
299 | { | ||
300 | return (addr & htonl(0xffffff00)) == htonl(0xc0586300); | ||
301 | } | ||
302 | |||
303 | static inline bool ipv4_is_test_192(__be32 addr) | ||
304 | { | ||
305 | return (addr & htonl(0xffffff00)) == htonl(0xc0000200); | ||
306 | } | ||
307 | |||
308 | static inline bool ipv4_is_test_198(__be32 addr) | ||
309 | { | ||
310 | return (addr & htonl(0xfffe0000)) == htonl(0xc6120000); | ||
311 | } | ||
256 | #endif | 312 | #endif |
257 | 313 | ||
258 | #endif /* _LINUX_IN_H */ | 314 | #endif /* _LINUX_IN_H */ |
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index d83fee2dc643..8d9eaaebded7 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
@@ -44,7 +44,8 @@ struct in_device | |||
44 | }; | 44 | }; |
45 | 45 | ||
46 | #define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1]) | 46 | #define IPV4_DEVCONF(cnf, attr) ((cnf).data[NET_IPV4_CONF_ ## attr - 1]) |
47 | #define IPV4_DEVCONF_ALL(attr) IPV4_DEVCONF(ipv4_devconf, attr) | 47 | #define IPV4_DEVCONF_ALL(net, attr) \ |
48 | IPV4_DEVCONF((*(net)->ipv4.devconf_all), attr) | ||
48 | 49 | ||
49 | static inline int ipv4_devconf_get(struct in_device *in_dev, int index) | 50 | static inline int ipv4_devconf_get(struct in_device *in_dev, int index) |
50 | { | 51 | { |
@@ -71,16 +72,17 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
71 | ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) | 72 | ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) |
72 | 73 | ||
73 | #define IN_DEV_ANDCONF(in_dev, attr) \ | 74 | #define IN_DEV_ANDCONF(in_dev, attr) \ |
74 | (IPV4_DEVCONF_ALL(attr) && IN_DEV_CONF_GET((in_dev), attr)) | 75 | (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \ |
76 | IN_DEV_CONF_GET((in_dev), attr)) | ||
75 | #define IN_DEV_ORCONF(in_dev, attr) \ | 77 | #define IN_DEV_ORCONF(in_dev, attr) \ |
76 | (IPV4_DEVCONF_ALL(attr) || IN_DEV_CONF_GET((in_dev), attr)) | 78 | (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \ |
79 | IN_DEV_CONF_GET((in_dev), attr)) | ||
77 | #define IN_DEV_MAXCONF(in_dev, attr) \ | 80 | #define IN_DEV_MAXCONF(in_dev, attr) \ |
78 | (max(IPV4_DEVCONF_ALL(attr), IN_DEV_CONF_GET((in_dev), attr))) | 81 | (max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \ |
82 | IN_DEV_CONF_GET((in_dev), attr))) | ||
79 | 83 | ||
80 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) | 84 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) |
81 | #define IN_DEV_MFORWARD(in_dev) (IPV4_DEVCONF_ALL(MC_FORWARDING) && \ | 85 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) |
82 | IPV4_DEVCONF((in_dev)->cnf, \ | ||
83 | MC_FORWARDING)) | ||
84 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_ANDCONF((in_dev), RP_FILTER) | 86 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_ANDCONF((in_dev), RP_FILTER) |
85 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ | 87 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ |
86 | ACCEPT_SOURCE_ROUTE) | 88 | ACCEPT_SOURCE_ROUTE) |
@@ -127,15 +129,14 @@ struct in_ifaddr | |||
127 | extern int register_inetaddr_notifier(struct notifier_block *nb); | 129 | extern int register_inetaddr_notifier(struct notifier_block *nb); |
128 | extern int unregister_inetaddr_notifier(struct notifier_block *nb); | 130 | extern int unregister_inetaddr_notifier(struct notifier_block *nb); |
129 | 131 | ||
130 | extern struct net_device *ip_dev_find(__be32 addr); | 132 | extern struct net_device *ip_dev_find(struct net *net, __be32 addr); |
131 | extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); | 133 | extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); |
132 | extern int devinet_ioctl(unsigned int cmd, void __user *); | 134 | extern int devinet_ioctl(unsigned int cmd, void __user *); |
133 | extern void devinet_init(void); | 135 | extern void devinet_init(void); |
134 | extern struct in_device *inetdev_by_index(int); | 136 | extern struct in_device *inetdev_by_index(struct net *, int); |
135 | extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); | 137 | extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); |
136 | extern __be32 inet_confirm_addr(const struct net_device *dev, __be32 dst, __be32 local, int scope); | 138 | extern __be32 inet_confirm_addr(struct in_device *in_dev, __be32 dst, __be32 local, int scope); |
137 | extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask); | 139 | extern struct in_ifaddr *inet_ifa_byprefix(struct in_device *in_dev, __be32 prefix, __be32 mask); |
138 | extern void inet_forward_change(void); | ||
139 | 140 | ||
140 | static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa) | 141 | static __inline__ int inet_ifa_match(__be32 addr, struct in_ifaddr *ifa) |
141 | { | 142 | { |
diff --git a/include/linux/net.h b/include/linux/net.h index 596131ea46f4..c414d90e647b 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/socket.h> | 22 | #include <asm/socket.h> |
23 | 23 | ||
24 | struct poll_table_struct; | 24 | struct poll_table_struct; |
25 | struct pipe_inode_info; | ||
25 | struct inode; | 26 | struct inode; |
26 | struct net; | 27 | struct net; |
27 | 28 | ||
@@ -172,6 +173,8 @@ struct proto_ops { | |||
172 | struct vm_area_struct * vma); | 173 | struct vm_area_struct * vma); |
173 | ssize_t (*sendpage) (struct socket *sock, struct page *page, | 174 | ssize_t (*sendpage) (struct socket *sock, struct page *page, |
174 | int offset, size_t size, int flags); | 175 | int offset, size_t size, int flags); |
176 | ssize_t (*splice_read)(struct socket *sock, loff_t *ppos, | ||
177 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); | ||
175 | }; | 178 | }; |
176 | 179 | ||
177 | struct net_proto_family { | 180 | struct net_proto_family { |
@@ -183,6 +186,13 @@ struct net_proto_family { | |||
183 | struct iovec; | 186 | struct iovec; |
184 | struct kvec; | 187 | struct kvec; |
185 | 188 | ||
189 | enum { | ||
190 | SOCK_WAKE_IO, | ||
191 | SOCK_WAKE_WAITD, | ||
192 | SOCK_WAKE_SPACE, | ||
193 | SOCK_WAKE_URG, | ||
194 | }; | ||
195 | |||
186 | extern int sock_wake_async(struct socket *sk, int how, int band); | 196 | extern int sock_wake_async(struct socket *sk, int how, int band); |
187 | extern int sock_register(const struct net_proto_family *fam); | 197 | extern int sock_register(const struct net_proto_family *fam); |
188 | extern void sock_unregister(int family); | 198 | extern void sock_unregister(int family); |
@@ -327,7 +337,6 @@ static const struct proto_ops name##_ops = { \ | |||
327 | 337 | ||
328 | #ifdef CONFIG_SYSCTL | 338 | #ifdef CONFIG_SYSCTL |
329 | #include <linux/sysctl.h> | 339 | #include <linux/sysctl.h> |
330 | extern ctl_table net_table[]; | ||
331 | extern int net_msg_cost; | 340 | extern int net_msg_cost; |
332 | extern int net_msg_burst; | 341 | extern int net_msg_burst; |
333 | #endif | 342 | #endif |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 16adac688af5..d74e79bacd2d 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -7,6 +7,8 @@ | |||
7 | #include <linux/skbuff.h> | 7 | #include <linux/skbuff.h> |
8 | #include <linux/net.h> | 8 | #include <linux/net.h> |
9 | #include <linux/if.h> | 9 | #include <linux/if.h> |
10 | #include <linux/in.h> | ||
11 | #include <linux/in6.h> | ||
10 | #include <linux/wait.h> | 12 | #include <linux/wait.h> |
11 | #include <linux/list.h> | 13 | #include <linux/list.h> |
12 | #endif | 14 | #endif |
@@ -39,6 +41,23 @@ | |||
39 | #define NFC_ALTERED 0x8000 | 41 | #define NFC_ALTERED 0x8000 |
40 | #endif | 42 | #endif |
41 | 43 | ||
44 | enum nf_inet_hooks { | ||
45 | NF_INET_PRE_ROUTING, | ||
46 | NF_INET_LOCAL_IN, | ||
47 | NF_INET_FORWARD, | ||
48 | NF_INET_LOCAL_OUT, | ||
49 | NF_INET_POST_ROUTING, | ||
50 | NF_INET_NUMHOOKS | ||
51 | }; | ||
52 | |||
53 | union nf_inet_addr { | ||
54 | u_int32_t all[4]; | ||
55 | __be32 ip; | ||
56 | __be32 ip6[4]; | ||
57 | struct in_addr in; | ||
58 | struct in6_addr in6; | ||
59 | }; | ||
60 | |||
42 | #ifdef __KERNEL__ | 61 | #ifdef __KERNEL__ |
43 | #ifdef CONFIG_NETFILTER | 62 | #ifdef CONFIG_NETFILTER |
44 | 63 | ||
@@ -92,19 +111,6 @@ struct nf_sockopt_ops | |||
92 | struct module *owner; | 111 | struct module *owner; |
93 | }; | 112 | }; |
94 | 113 | ||
95 | /* Each queued (to userspace) skbuff has one of these. */ | ||
96 | struct nf_info | ||
97 | { | ||
98 | /* The ops struct which sent us to userspace. */ | ||
99 | struct nf_hook_ops *elem; | ||
100 | |||
101 | /* If we're sent to userspace, this keeps housekeeping info */ | ||
102 | int pf; | ||
103 | unsigned int hook; | ||
104 | struct net_device *indev, *outdev; | ||
105 | int (*okfn)(struct sk_buff *); | ||
106 | }; | ||
107 | |||
108 | /* Function to register/unregister hook points. */ | 114 | /* Function to register/unregister hook points. */ |
109 | int nf_register_hook(struct nf_hook_ops *reg); | 115 | int nf_register_hook(struct nf_hook_ops *reg); |
110 | void nf_unregister_hook(struct nf_hook_ops *reg); | 116 | void nf_unregister_hook(struct nf_hook_ops *reg); |
@@ -118,71 +124,12 @@ void nf_unregister_sockopt(struct nf_sockopt_ops *reg); | |||
118 | 124 | ||
119 | #ifdef CONFIG_SYSCTL | 125 | #ifdef CONFIG_SYSCTL |
120 | /* Sysctl registration */ | 126 | /* Sysctl registration */ |
121 | struct ctl_table_header *nf_register_sysctl_table(struct ctl_table *path, | 127 | extern struct ctl_path nf_net_netfilter_sysctl_path[]; |
122 | struct ctl_table *table); | 128 | extern struct ctl_path nf_net_ipv4_netfilter_sysctl_path[]; |
123 | void nf_unregister_sysctl_table(struct ctl_table_header *header, | ||
124 | struct ctl_table *table); | ||
125 | extern struct ctl_table nf_net_netfilter_sysctl_path[]; | ||
126 | extern struct ctl_table nf_net_ipv4_netfilter_sysctl_path[]; | ||
127 | #endif /* CONFIG_SYSCTL */ | 129 | #endif /* CONFIG_SYSCTL */ |
128 | 130 | ||
129 | extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; | 131 | extern struct list_head nf_hooks[NPROTO][NF_MAX_HOOKS]; |
130 | 132 | ||
131 | /* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will | ||
132 | * disappear once iptables is replaced with pkttables. Please DO NOT use them | ||
133 | * for any new code! */ | ||
134 | #define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | ||
135 | #define NF_LOG_TCPOPT 0x02 /* Log TCP options */ | ||
136 | #define NF_LOG_IPOPT 0x04 /* Log IP options */ | ||
137 | #define NF_LOG_UID 0x08 /* Log UID owning local socket */ | ||
138 | #define NF_LOG_MASK 0x0f | ||
139 | |||
140 | #define NF_LOG_TYPE_LOG 0x01 | ||
141 | #define NF_LOG_TYPE_ULOG 0x02 | ||
142 | |||
143 | struct nf_loginfo { | ||
144 | u_int8_t type; | ||
145 | union { | ||
146 | struct { | ||
147 | u_int32_t copy_len; | ||
148 | u_int16_t group; | ||
149 | u_int16_t qthreshold; | ||
150 | } ulog; | ||
151 | struct { | ||
152 | u_int8_t level; | ||
153 | u_int8_t logflags; | ||
154 | } log; | ||
155 | } u; | ||
156 | }; | ||
157 | |||
158 | typedef void nf_logfn(unsigned int pf, | ||
159 | unsigned int hooknum, | ||
160 | const struct sk_buff *skb, | ||
161 | const struct net_device *in, | ||
162 | const struct net_device *out, | ||
163 | const struct nf_loginfo *li, | ||
164 | const char *prefix); | ||
165 | |||
166 | struct nf_logger { | ||
167 | struct module *me; | ||
168 | nf_logfn *logfn; | ||
169 | char *name; | ||
170 | }; | ||
171 | |||
172 | /* Function to register/unregister log function. */ | ||
173 | int nf_log_register(int pf, struct nf_logger *logger); | ||
174 | void nf_log_unregister(struct nf_logger *logger); | ||
175 | void nf_log_unregister_pf(int pf); | ||
176 | |||
177 | /* Calls the registered backend logging function */ | ||
178 | void nf_log_packet(int pf, | ||
179 | unsigned int hooknum, | ||
180 | const struct sk_buff *skb, | ||
181 | const struct net_device *in, | ||
182 | const struct net_device *out, | ||
183 | struct nf_loginfo *li, | ||
184 | const char *fmt, ...); | ||
185 | |||
186 | int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, | 133 | int nf_hook_slow(int pf, unsigned int hook, struct sk_buff *skb, |
187 | struct net_device *indev, struct net_device *outdev, | 134 | struct net_device *indev, struct net_device *outdev, |
188 | int (*okfn)(struct sk_buff *), int thresh); | 135 | int (*okfn)(struct sk_buff *), int thresh); |
@@ -265,65 +212,28 @@ int compat_nf_setsockopt(struct sock *sk, int pf, int optval, | |||
265 | int compat_nf_getsockopt(struct sock *sk, int pf, int optval, | 212 | int compat_nf_getsockopt(struct sock *sk, int pf, int optval, |
266 | char __user *opt, int *len); | 213 | char __user *opt, int *len); |
267 | 214 | ||
268 | /* Packet queuing */ | ||
269 | struct nf_queue_handler { | ||
270 | int (*outfn)(struct sk_buff *skb, struct nf_info *info, | ||
271 | unsigned int queuenum, void *data); | ||
272 | void *data; | ||
273 | char *name; | ||
274 | }; | ||
275 | extern int nf_register_queue_handler(int pf, | ||
276 | struct nf_queue_handler *qh); | ||
277 | extern int nf_unregister_queue_handler(int pf, | ||
278 | struct nf_queue_handler *qh); | ||
279 | extern void nf_unregister_queue_handlers(struct nf_queue_handler *qh); | ||
280 | extern void nf_reinject(struct sk_buff *skb, | ||
281 | struct nf_info *info, | ||
282 | unsigned int verdict); | ||
283 | |||
284 | /* FIXME: Before cache is ever used, this must be implemented for real. */ | ||
285 | extern void nf_invalidate_cache(int pf); | ||
286 | |||
287 | /* Call this before modifying an existing packet: ensures it is | 215 | /* Call this before modifying an existing packet: ensures it is |
288 | modifiable and linear to the point you care about (writable_len). | 216 | modifiable and linear to the point you care about (writable_len). |
289 | Returns true or false. */ | 217 | Returns true or false. */ |
290 | extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len); | 218 | extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len); |
291 | 219 | ||
292 | static inline void nf_csum_replace4(__sum16 *sum, __be32 from, __be32 to) | 220 | struct flowi; |
293 | { | 221 | struct nf_queue_entry; |
294 | __be32 diff[] = { ~from, to }; | ||
295 | |||
296 | *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); | ||
297 | } | ||
298 | |||
299 | static inline void nf_csum_replace2(__sum16 *sum, __be16 from, __be16 to) | ||
300 | { | ||
301 | nf_csum_replace4(sum, (__force __be32)from, (__force __be32)to); | ||
302 | } | ||
303 | |||
304 | extern void nf_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, | ||
305 | __be32 from, __be32 to, int pseudohdr); | ||
306 | |||
307 | static inline void nf_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, | ||
308 | __be16 from, __be16 to, int pseudohdr) | ||
309 | { | ||
310 | nf_proto_csum_replace4(sum, skb, (__force __be32)from, | ||
311 | (__force __be32)to, pseudohdr); | ||
312 | } | ||
313 | 222 | ||
314 | struct nf_afinfo { | 223 | struct nf_afinfo { |
315 | unsigned short family; | 224 | unsigned short family; |
316 | __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, | 225 | __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, |
317 | unsigned int dataoff, u_int8_t protocol); | 226 | unsigned int dataoff, u_int8_t protocol); |
227 | int (*route)(struct dst_entry **dst, struct flowi *fl); | ||
318 | void (*saveroute)(const struct sk_buff *skb, | 228 | void (*saveroute)(const struct sk_buff *skb, |
319 | struct nf_info *info); | 229 | struct nf_queue_entry *entry); |
320 | int (*reroute)(struct sk_buff *skb, | 230 | int (*reroute)(struct sk_buff *skb, |
321 | const struct nf_info *info); | 231 | const struct nf_queue_entry *entry); |
322 | int route_key_size; | 232 | int route_key_size; |
323 | }; | 233 | }; |
324 | 234 | ||
325 | extern struct nf_afinfo *nf_afinfo[]; | 235 | extern const struct nf_afinfo *nf_afinfo[NPROTO]; |
326 | static inline struct nf_afinfo *nf_get_afinfo(unsigned short family) | 236 | static inline const struct nf_afinfo *nf_get_afinfo(unsigned short family) |
327 | { | 237 | { |
328 | return rcu_dereference(nf_afinfo[family]); | 238 | return rcu_dereference(nf_afinfo[family]); |
329 | } | 239 | } |
@@ -332,7 +242,7 @@ static inline __sum16 | |||
332 | nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, | 242 | nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, |
333 | u_int8_t protocol, unsigned short family) | 243 | u_int8_t protocol, unsigned short family) |
334 | { | 244 | { |
335 | struct nf_afinfo *afinfo; | 245 | const struct nf_afinfo *afinfo; |
336 | __sum16 csum = 0; | 246 | __sum16 csum = 0; |
337 | 247 | ||
338 | rcu_read_lock(); | 248 | rcu_read_lock(); |
@@ -343,10 +253,8 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff, | |||
343 | return csum; | 253 | return csum; |
344 | } | 254 | } |
345 | 255 | ||
346 | extern int nf_register_afinfo(struct nf_afinfo *afinfo); | 256 | extern int nf_register_afinfo(const struct nf_afinfo *afinfo); |
347 | extern void nf_unregister_afinfo(struct nf_afinfo *afinfo); | 257 | extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); |
348 | |||
349 | #define nf_info_reroute(x) ((void *)x + sizeof(struct nf_info)) | ||
350 | 258 | ||
351 | #include <net/flow.h> | 259 | #include <net/flow.h> |
352 | extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); | 260 | extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); |
@@ -354,11 +262,16 @@ extern void (*ip_nat_decode_session)(struct sk_buff *, struct flowi *); | |||
354 | static inline void | 262 | static inline void |
355 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) | 263 | nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, int family) |
356 | { | 264 | { |
357 | #if defined(CONFIG_IP_NF_NAT_NEEDED) || defined(CONFIG_NF_NAT_NEEDED) | 265 | #ifdef CONFIG_NF_NAT_NEEDED |
358 | void (*decodefn)(struct sk_buff *, struct flowi *); | 266 | void (*decodefn)(struct sk_buff *, struct flowi *); |
359 | 267 | ||
360 | if (family == AF_INET && (decodefn = ip_nat_decode_session) != NULL) | 268 | if (family == AF_INET) { |
361 | decodefn(skb, fl); | 269 | rcu_read_lock(); |
270 | decodefn = rcu_dereference(ip_nat_decode_session); | ||
271 | if (decodefn) | ||
272 | decodefn(skb, fl); | ||
273 | rcu_read_unlock(); | ||
274 | } | ||
362 | #endif | 275 | #endif |
363 | } | 276 | } |
364 | 277 | ||
diff --git a/include/linux/netfilter/Kbuild b/include/linux/netfilter/Kbuild index b87e83a5e070..91fef0cae42f 100644 --- a/include/linux/netfilter/Kbuild +++ b/include/linux/netfilter/Kbuild | |||
@@ -10,6 +10,7 @@ header-y += xt_DSCP.h | |||
10 | header-y += xt_MARK.h | 10 | header-y += xt_MARK.h |
11 | header-y += xt_NFLOG.h | 11 | header-y += xt_NFLOG.h |
12 | header-y += xt_NFQUEUE.h | 12 | header-y += xt_NFQUEUE.h |
13 | header-y += xt_RATEEST.h | ||
13 | header-y += xt_SECMARK.h | 14 | header-y += xt_SECMARK.h |
14 | header-y += xt_TCPMSS.h | 15 | header-y += xt_TCPMSS.h |
15 | header-y += xt_comment.h | 16 | header-y += xt_comment.h |
@@ -20,14 +21,17 @@ header-y += xt_dccp.h | |||
20 | header-y += xt_dscp.h | 21 | header-y += xt_dscp.h |
21 | header-y += xt_esp.h | 22 | header-y += xt_esp.h |
22 | header-y += xt_hashlimit.h | 23 | header-y += xt_hashlimit.h |
24 | header-y += xt_iprange.h | ||
23 | header-y += xt_helper.h | 25 | header-y += xt_helper.h |
24 | header-y += xt_length.h | 26 | header-y += xt_length.h |
25 | header-y += xt_limit.h | 27 | header-y += xt_limit.h |
26 | header-y += xt_mac.h | 28 | header-y += xt_mac.h |
27 | header-y += xt_mark.h | 29 | header-y += xt_mark.h |
28 | header-y += xt_multiport.h | 30 | header-y += xt_multiport.h |
31 | header-y += xt_owner.h | ||
29 | header-y += xt_pkttype.h | 32 | header-y += xt_pkttype.h |
30 | header-y += xt_policy.h | 33 | header-y += xt_policy.h |
34 | header-y += xt_rateest.h | ||
31 | header-y += xt_realm.h | 35 | header-y += xt_realm.h |
32 | header-y += xt_sctp.h | 36 | header-y += xt_sctp.h |
33 | header-y += xt_state.h | 37 | header-y += xt_state.h |
diff --git a/include/linux/netfilter/nf_conntrack_common.h b/include/linux/netfilter/nf_conntrack_common.h index 9e0dae07861e..bad1eb760f61 100644 --- a/include/linux/netfilter/nf_conntrack_common.h +++ b/include/linux/netfilter/nf_conntrack_common.h | |||
@@ -129,6 +129,14 @@ enum ip_conntrack_events | |||
129 | /* Mark is set */ | 129 | /* Mark is set */ |
130 | IPCT_MARK_BIT = 12, | 130 | IPCT_MARK_BIT = 12, |
131 | IPCT_MARK = (1 << IPCT_MARK_BIT), | 131 | IPCT_MARK = (1 << IPCT_MARK_BIT), |
132 | |||
133 | /* NAT sequence adjustment */ | ||
134 | IPCT_NATSEQADJ_BIT = 13, | ||
135 | IPCT_NATSEQADJ = (1 << IPCT_NATSEQADJ_BIT), | ||
136 | |||
137 | /* Secmark is set */ | ||
138 | IPCT_SECMARK_BIT = 14, | ||
139 | IPCT_SECMARK = (1 << IPCT_SECMARK_BIT), | ||
132 | }; | 140 | }; |
133 | 141 | ||
134 | enum ip_conntrack_expect_events { | 142 | enum ip_conntrack_expect_events { |
diff --git a/include/linux/netfilter/nf_conntrack_h323.h b/include/linux/netfilter/nf_conntrack_h323.h index aabd24ac7631..26f9226ea72b 100644 --- a/include/linux/netfilter/nf_conntrack_h323.h +++ b/include/linux/netfilter/nf_conntrack_h323.h | |||
@@ -31,7 +31,7 @@ struct nf_conn; | |||
31 | 31 | ||
32 | extern int get_h225_addr(struct nf_conn *ct, unsigned char *data, | 32 | extern int get_h225_addr(struct nf_conn *ct, unsigned char *data, |
33 | TransportAddress *taddr, | 33 | TransportAddress *taddr, |
34 | union nf_conntrack_address *addr, __be16 *port); | 34 | union nf_inet_addr *addr, __be16 *port); |
35 | extern void nf_conntrack_h245_expect(struct nf_conn *new, | 35 | extern void nf_conntrack_h245_expect(struct nf_conn *new, |
36 | struct nf_conntrack_expect *this); | 36 | struct nf_conntrack_expect *this); |
37 | extern void nf_conntrack_q931_expect(struct nf_conn *new, | 37 | extern void nf_conntrack_q931_expect(struct nf_conn *new, |
@@ -39,12 +39,12 @@ extern void nf_conntrack_q931_expect(struct nf_conn *new, | |||
39 | extern int (*set_h245_addr_hook) (struct sk_buff *skb, | 39 | extern int (*set_h245_addr_hook) (struct sk_buff *skb, |
40 | unsigned char **data, int dataoff, | 40 | unsigned char **data, int dataoff, |
41 | H245_TransportAddress *taddr, | 41 | H245_TransportAddress *taddr, |
42 | union nf_conntrack_address *addr, | 42 | union nf_inet_addr *addr, |
43 | __be16 port); | 43 | __be16 port); |
44 | extern int (*set_h225_addr_hook) (struct sk_buff *skb, | 44 | extern int (*set_h225_addr_hook) (struct sk_buff *skb, |
45 | unsigned char **data, int dataoff, | 45 | unsigned char **data, int dataoff, |
46 | TransportAddress *taddr, | 46 | TransportAddress *taddr, |
47 | union nf_conntrack_address *addr, | 47 | union nf_inet_addr *addr, |
48 | __be16 port); | 48 | __be16 port); |
49 | extern int (*set_sig_addr_hook) (struct sk_buff *skb, | 49 | extern int (*set_sig_addr_hook) (struct sk_buff *skb, |
50 | struct nf_conn *ct, | 50 | struct nf_conn *ct, |
diff --git a/include/linux/netfilter/nf_conntrack_sctp.h b/include/linux/netfilter/nf_conntrack_sctp.h index 5cf2c115cce4..768f78c4ac53 100644 --- a/include/linux/netfilter/nf_conntrack_sctp.h +++ b/include/linux/netfilter/nf_conntrack_sctp.h | |||
@@ -21,7 +21,6 @@ struct ip_ct_sctp | |||
21 | enum sctp_conntrack state; | 21 | enum sctp_conntrack state; |
22 | 22 | ||
23 | __be32 vtag[IP_CT_DIR_MAX]; | 23 | __be32 vtag[IP_CT_DIR_MAX]; |
24 | u_int32_t ttag[IP_CT_DIR_MAX]; | ||
25 | }; | 24 | }; |
26 | 25 | ||
27 | #endif /* _NF_CONNTRACK_SCTP_H */ | 26 | #endif /* _NF_CONNTRACK_SCTP_H */ |
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h index 4affa3fe78e0..e3e1533aba2d 100644 --- a/include/linux/netfilter/nfnetlink_conntrack.h +++ b/include/linux/netfilter/nfnetlink_conntrack.h | |||
@@ -37,6 +37,9 @@ enum ctattr_type { | |||
37 | CTA_ID, | 37 | CTA_ID, |
38 | CTA_NAT_DST, | 38 | CTA_NAT_DST, |
39 | CTA_TUPLE_MASTER, | 39 | CTA_TUPLE_MASTER, |
40 | CTA_NAT_SEQ_ADJ_ORIG, | ||
41 | CTA_NAT_SEQ_ADJ_REPLY, | ||
42 | CTA_SECMARK, | ||
40 | __CTA_MAX | 43 | __CTA_MAX |
41 | }; | 44 | }; |
42 | #define CTA_MAX (__CTA_MAX - 1) | 45 | #define CTA_MAX (__CTA_MAX - 1) |
@@ -119,6 +122,14 @@ enum ctattr_protonat { | |||
119 | }; | 122 | }; |
120 | #define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) | 123 | #define CTA_PROTONAT_MAX (__CTA_PROTONAT_MAX - 1) |
121 | 124 | ||
125 | enum ctattr_natseq { | ||
126 | CTA_NAT_SEQ_CORRECTION_POS, | ||
127 | CTA_NAT_SEQ_OFFSET_BEFORE, | ||
128 | CTA_NAT_SEQ_OFFSET_AFTER, | ||
129 | __CTA_NAT_SEQ_MAX | ||
130 | }; | ||
131 | #define CTA_NAT_SEQ_MAX (__CTA_NAT_SEQ_MAX - 1) | ||
132 | |||
122 | enum ctattr_expect { | 133 | enum ctattr_expect { |
123 | CTA_EXPECT_UNSPEC, | 134 | CTA_EXPECT_UNSPEC, |
124 | CTA_EXPECT_MASTER, | 135 | CTA_EXPECT_MASTER, |
diff --git a/include/linux/netfilter/nfnetlink_log.h b/include/linux/netfilter/nfnetlink_log.h index 5966afa026e9..a85721332924 100644 --- a/include/linux/netfilter/nfnetlink_log.h +++ b/include/linux/netfilter/nfnetlink_log.h | |||
@@ -47,6 +47,7 @@ enum nfulnl_attr_type { | |||
47 | NFULA_UID, /* user id of socket */ | 47 | NFULA_UID, /* user id of socket */ |
48 | NFULA_SEQ, /* instance-local sequence number */ | 48 | NFULA_SEQ, /* instance-local sequence number */ |
49 | NFULA_SEQ_GLOBAL, /* global sequence number */ | 49 | NFULA_SEQ_GLOBAL, /* global sequence number */ |
50 | NFULA_GID, /* group id of socket */ | ||
50 | 51 | ||
51 | __NFULA_MAX | 52 | __NFULA_MAX |
52 | }; | 53 | }; |
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h index 03e6ce979eaa..b99ede51318a 100644 --- a/include/linux/netfilter/x_tables.h +++ b/include/linux/netfilter/x_tables.h | |||
@@ -126,6 +126,49 @@ struct xt_counters_info | |||
126 | 126 | ||
127 | #define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ | 127 | #define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */ |
128 | 128 | ||
129 | /* fn returns 0 to continue iteration */ | ||
130 | #define XT_MATCH_ITERATE(type, e, fn, args...) \ | ||
131 | ({ \ | ||
132 | unsigned int __i; \ | ||
133 | int __ret = 0; \ | ||
134 | struct xt_entry_match *__m; \ | ||
135 | \ | ||
136 | for (__i = sizeof(type); \ | ||
137 | __i < (e)->target_offset; \ | ||
138 | __i += __m->u.match_size) { \ | ||
139 | __m = (void *)e + __i; \ | ||
140 | \ | ||
141 | __ret = fn(__m , ## args); \ | ||
142 | if (__ret != 0) \ | ||
143 | break; \ | ||
144 | } \ | ||
145 | __ret; \ | ||
146 | }) | ||
147 | |||
148 | /* fn returns 0 to continue iteration */ | ||
149 | #define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \ | ||
150 | ({ \ | ||
151 | unsigned int __i, __n; \ | ||
152 | int __ret = 0; \ | ||
153 | type *__entry; \ | ||
154 | \ | ||
155 | for (__i = 0, __n = 0; __i < (size); \ | ||
156 | __i += __entry->next_offset, __n++) { \ | ||
157 | __entry = (void *)(entries) + __i; \ | ||
158 | if (__n < n) \ | ||
159 | continue; \ | ||
160 | \ | ||
161 | __ret = fn(__entry , ## args); \ | ||
162 | if (__ret != 0) \ | ||
163 | break; \ | ||
164 | } \ | ||
165 | __ret; \ | ||
166 | }) | ||
167 | |||
168 | /* fn returns 0 to continue iteration */ | ||
169 | #define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \ | ||
170 | XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args) | ||
171 | |||
129 | #ifdef __KERNEL__ | 172 | #ifdef __KERNEL__ |
130 | 173 | ||
131 | #include <linux/netdevice.h> | 174 | #include <linux/netdevice.h> |
@@ -265,13 +308,16 @@ struct xt_table_info | |||
265 | unsigned int initial_entries; | 308 | unsigned int initial_entries; |
266 | 309 | ||
267 | /* Entry points and underflows */ | 310 | /* Entry points and underflows */ |
268 | unsigned int hook_entry[NF_IP_NUMHOOKS]; | 311 | unsigned int hook_entry[NF_INET_NUMHOOKS]; |
269 | unsigned int underflow[NF_IP_NUMHOOKS]; | 312 | unsigned int underflow[NF_INET_NUMHOOKS]; |
270 | 313 | ||
271 | /* ipt_entry tables: one per CPU */ | 314 | /* ipt_entry tables: one per CPU */ |
272 | char *entries[NR_CPUS]; | 315 | /* Note : this field MUST be the last one, see XT_TABLE_INFO_SZ */ |
316 | char *entries[1]; | ||
273 | }; | 317 | }; |
274 | 318 | ||
319 | #define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \ | ||
320 | + nr_cpu_ids * sizeof(char *)) | ||
275 | extern int xt_register_target(struct xt_target *target); | 321 | extern int xt_register_target(struct xt_target *target); |
276 | extern void xt_unregister_target(struct xt_target *target); | 322 | extern void xt_unregister_target(struct xt_target *target); |
277 | extern int xt_register_targets(struct xt_target *target, unsigned int n); | 323 | extern int xt_register_targets(struct xt_target *target, unsigned int n); |
@@ -378,9 +424,13 @@ struct compat_xt_counters_info | |||
378 | extern void xt_compat_lock(int af); | 424 | extern void xt_compat_lock(int af); |
379 | extern void xt_compat_unlock(int af); | 425 | extern void xt_compat_unlock(int af); |
380 | 426 | ||
427 | extern int xt_compat_add_offset(int af, unsigned int offset, short delta); | ||
428 | extern void xt_compat_flush_offsets(int af); | ||
429 | extern short xt_compat_calc_jump(int af, unsigned int offset); | ||
430 | |||
381 | extern int xt_compat_match_offset(struct xt_match *match); | 431 | extern int xt_compat_match_offset(struct xt_match *match); |
382 | extern void xt_compat_match_from_user(struct xt_entry_match *m, | 432 | extern int xt_compat_match_from_user(struct xt_entry_match *m, |
383 | void **dstptr, int *size); | 433 | void **dstptr, int *size); |
384 | extern int xt_compat_match_to_user(struct xt_entry_match *m, | 434 | extern int xt_compat_match_to_user(struct xt_entry_match *m, |
385 | void __user **dstptr, int *size); | 435 | void __user **dstptr, int *size); |
386 | 436 | ||
diff --git a/include/linux/netfilter/xt_CONNMARK.h b/include/linux/netfilter/xt_CONNMARK.h index 9f744689fffc..4e58ba43c289 100644 --- a/include/linux/netfilter/xt_CONNMARK.h +++ b/include/linux/netfilter/xt_CONNMARK.h | |||
@@ -22,4 +22,9 @@ struct xt_connmark_target_info { | |||
22 | u_int8_t mode; | 22 | u_int8_t mode; |
23 | }; | 23 | }; |
24 | 24 | ||
25 | struct xt_connmark_tginfo1 { | ||
26 | u_int32_t ctmark, ctmask, nfmask; | ||
27 | u_int8_t mode; | ||
28 | }; | ||
29 | |||
25 | #endif /*_XT_CONNMARK_H_target*/ | 30 | #endif /*_XT_CONNMARK_H_target*/ |
diff --git a/include/linux/netfilter/xt_DSCP.h b/include/linux/netfilter/xt_DSCP.h index 3c7c963997bd..14da1968e2c6 100644 --- a/include/linux/netfilter/xt_DSCP.h +++ b/include/linux/netfilter/xt_DSCP.h | |||
@@ -17,4 +17,9 @@ struct xt_DSCP_info { | |||
17 | u_int8_t dscp; | 17 | u_int8_t dscp; |
18 | }; | 18 | }; |
19 | 19 | ||
20 | struct xt_tos_target_info { | ||
21 | u_int8_t tos_value; | ||
22 | u_int8_t tos_mask; | ||
23 | }; | ||
24 | |||
20 | #endif /* _XT_DSCP_TARGET_H */ | 25 | #endif /* _XT_DSCP_TARGET_H */ |
diff --git a/include/linux/netfilter/xt_MARK.h b/include/linux/netfilter/xt_MARK.h index b021e93ee5d6..778b278fd9f2 100644 --- a/include/linux/netfilter/xt_MARK.h +++ b/include/linux/netfilter/xt_MARK.h | |||
@@ -18,4 +18,8 @@ struct xt_mark_target_info_v1 { | |||
18 | u_int8_t mode; | 18 | u_int8_t mode; |
19 | }; | 19 | }; |
20 | 20 | ||
21 | struct xt_mark_tginfo2 { | ||
22 | u_int32_t mark, mask; | ||
23 | }; | ||
24 | |||
21 | #endif /*_XT_MARK_H_target */ | 25 | #endif /*_XT_MARK_H_target */ |
diff --git a/include/linux/netfilter/xt_RATEEST.h b/include/linux/netfilter/xt_RATEEST.h new file mode 100644 index 000000000000..f79e3133cbea --- /dev/null +++ b/include/linux/netfilter/xt_RATEEST.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _XT_RATEEST_TARGET_H | ||
2 | #define _XT_RATEEST_TARGET_H | ||
3 | |||
4 | struct xt_rateest_target_info { | ||
5 | char name[IFNAMSIZ]; | ||
6 | int8_t interval; | ||
7 | u_int8_t ewma_log; | ||
8 | |||
9 | /* Used internally by the kernel */ | ||
10 | struct xt_rateest *est __attribute__((aligned(8))); | ||
11 | }; | ||
12 | |||
13 | #endif /* _XT_RATEEST_TARGET_H */ | ||
diff --git a/include/linux/netfilter/xt_TCPOPTSTRIP.h b/include/linux/netfilter/xt_TCPOPTSTRIP.h new file mode 100644 index 000000000000..2db543214ff5 --- /dev/null +++ b/include/linux/netfilter/xt_TCPOPTSTRIP.h | |||
@@ -0,0 +1,13 @@ | |||
1 | #ifndef _XT_TCPOPTSTRIP_H | ||
2 | #define _XT_TCPOPTSTRIP_H | ||
3 | |||
4 | #define tcpoptstrip_set_bit(bmap, idx) \ | ||
5 | (bmap[(idx) >> 5] |= 1U << (idx & 31)) | ||
6 | #define tcpoptstrip_test_bit(bmap, idx) \ | ||
7 | (((1U << (idx & 31)) & bmap[(idx) >> 5]) != 0) | ||
8 | |||
9 | struct xt_tcpoptstrip_target_info { | ||
10 | u_int32_t strip_bmap[8]; | ||
11 | }; | ||
12 | |||
13 | #endif /* _XT_TCPOPTSTRIP_H */ | ||
diff --git a/include/linux/netfilter/xt_connlimit.h b/include/linux/netfilter/xt_connlimit.h index 37e933c9987d..7e3284bcbd2b 100644 --- a/include/linux/netfilter/xt_connlimit.h +++ b/include/linux/netfilter/xt_connlimit.h | |||
@@ -5,12 +5,17 @@ struct xt_connlimit_data; | |||
5 | 5 | ||
6 | struct xt_connlimit_info { | 6 | struct xt_connlimit_info { |
7 | union { | 7 | union { |
8 | __be32 v4_mask; | 8 | union nf_inet_addr mask; |
9 | __be32 v6_mask[4]; | 9 | #ifndef __KERNEL__ |
10 | union { | ||
11 | __be32 v4_mask; | ||
12 | __be32 v6_mask[4]; | ||
13 | }; | ||
14 | #endif | ||
10 | }; | 15 | }; |
11 | unsigned int limit, inverse; | 16 | unsigned int limit, inverse; |
12 | 17 | ||
13 | /* this needs to be at the end */ | 18 | /* Used internally by the kernel */ |
14 | struct xt_connlimit_data *data __attribute__((aligned(8))); | 19 | struct xt_connlimit_data *data __attribute__((aligned(8))); |
15 | }; | 20 | }; |
16 | 21 | ||
diff --git a/include/linux/netfilter/xt_connmark.h b/include/linux/netfilter/xt_connmark.h index c592f6ae0883..359ef86918dc 100644 --- a/include/linux/netfilter/xt_connmark.h +++ b/include/linux/netfilter/xt_connmark.h | |||
@@ -15,4 +15,9 @@ struct xt_connmark_info { | |||
15 | u_int8_t invert; | 15 | u_int8_t invert; |
16 | }; | 16 | }; |
17 | 17 | ||
18 | struct xt_connmark_mtinfo1 { | ||
19 | u_int32_t mark, mask; | ||
20 | u_int8_t invert; | ||
21 | }; | ||
22 | |||
18 | #endif /*_XT_CONNMARK_H*/ | 23 | #endif /*_XT_CONNMARK_H*/ |
diff --git a/include/linux/netfilter/xt_conntrack.h b/include/linux/netfilter/xt_conntrack.h index 70b6f718cf4c..d2492a3329be 100644 --- a/include/linux/netfilter/xt_conntrack.h +++ b/include/linux/netfilter/xt_conntrack.h | |||
@@ -6,7 +6,9 @@ | |||
6 | #define _XT_CONNTRACK_H | 6 | #define _XT_CONNTRACK_H |
7 | 7 | ||
8 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | 8 | #include <linux/netfilter/nf_conntrack_tuple_common.h> |
9 | #include <linux/in.h> | 9 | #ifdef __KERNEL__ |
10 | # include <linux/in.h> | ||
11 | #endif | ||
10 | 12 | ||
11 | #define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) | 13 | #define XT_CONNTRACK_STATE_BIT(ctinfo) (1 << ((ctinfo)%IP_CT_IS_REPLY+1)) |
12 | #define XT_CONNTRACK_STATE_INVALID (1 << 0) | 14 | #define XT_CONNTRACK_STATE_INVALID (1 << 0) |
@@ -60,4 +62,16 @@ struct xt_conntrack_info | |||
60 | /* Inverse flags */ | 62 | /* Inverse flags */ |
61 | u_int8_t invflags; | 63 | u_int8_t invflags; |
62 | }; | 64 | }; |
65 | |||
66 | struct xt_conntrack_mtinfo1 { | ||
67 | union nf_inet_addr origsrc_addr, origsrc_mask; | ||
68 | union nf_inet_addr origdst_addr, origdst_mask; | ||
69 | union nf_inet_addr replsrc_addr, replsrc_mask; | ||
70 | union nf_inet_addr repldst_addr, repldst_mask; | ||
71 | u_int32_t expires_min, expires_max; | ||
72 | u_int16_t l4proto; | ||
73 | u_int8_t state_mask, status_mask; | ||
74 | u_int8_t match_flags, invert_flags; | ||
75 | }; | ||
76 | |||
63 | #endif /*_XT_CONNTRACK_H*/ | 77 | #endif /*_XT_CONNTRACK_H*/ |
diff --git a/include/linux/netfilter/xt_dscp.h b/include/linux/netfilter/xt_dscp.h index 1da61e6acaf7..f49bc1a648dc 100644 --- a/include/linux/netfilter/xt_dscp.h +++ b/include/linux/netfilter/xt_dscp.h | |||
@@ -20,4 +20,10 @@ struct xt_dscp_info { | |||
20 | u_int8_t invert; | 20 | u_int8_t invert; |
21 | }; | 21 | }; |
22 | 22 | ||
23 | struct xt_tos_match_info { | ||
24 | u_int8_t tos_mask; | ||
25 | u_int8_t tos_value; | ||
26 | u_int8_t invert; | ||
27 | }; | ||
28 | |||
23 | #endif /* _XT_DSCP_H */ | 29 | #endif /* _XT_DSCP_H */ |
diff --git a/include/linux/netfilter/xt_hashlimit.h b/include/linux/netfilter/xt_hashlimit.h index b4556b8edbfd..c19972e4564d 100644 --- a/include/linux/netfilter/xt_hashlimit.h +++ b/include/linux/netfilter/xt_hashlimit.h | |||
@@ -29,9 +29,9 @@ struct hashlimit_cfg { | |||
29 | struct xt_hashlimit_info { | 29 | struct xt_hashlimit_info { |
30 | char name [IFNAMSIZ]; /* name */ | 30 | char name [IFNAMSIZ]; /* name */ |
31 | struct hashlimit_cfg cfg; | 31 | struct hashlimit_cfg cfg; |
32 | struct xt_hashlimit_htable *hinfo; | ||
33 | 32 | ||
34 | /* Used internally by the kernel */ | 33 | /* Used internally by the kernel */ |
34 | struct xt_hashlimit_htable *hinfo; | ||
35 | union { | 35 | union { |
36 | void *ptr; | 36 | void *ptr; |
37 | struct xt_hashlimit_info *master; | 37 | struct xt_hashlimit_info *master; |
diff --git a/include/linux/netfilter/xt_iprange.h b/include/linux/netfilter/xt_iprange.h new file mode 100644 index 000000000000..a4299c7d3680 --- /dev/null +++ b/include/linux/netfilter/xt_iprange.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _LINUX_NETFILTER_XT_IPRANGE_H | ||
2 | #define _LINUX_NETFILTER_XT_IPRANGE_H 1 | ||
3 | |||
4 | enum { | ||
5 | IPRANGE_SRC = 1 << 0, /* match source IP address */ | ||
6 | IPRANGE_DST = 1 << 1, /* match destination IP address */ | ||
7 | IPRANGE_SRC_INV = 1 << 4, /* negate the condition */ | ||
8 | IPRANGE_DST_INV = 1 << 5, /* -"- */ | ||
9 | }; | ||
10 | |||
11 | struct xt_iprange_mtinfo { | ||
12 | union nf_inet_addr src_min, src_max; | ||
13 | union nf_inet_addr dst_min, dst_max; | ||
14 | u_int8_t flags; | ||
15 | }; | ||
16 | |||
17 | #endif /* _LINUX_NETFILTER_XT_IPRANGE_H */ | ||
diff --git a/include/linux/netfilter/xt_mark.h b/include/linux/netfilter/xt_mark.h index 802dd4842caf..fae74bc3f34e 100644 --- a/include/linux/netfilter/xt_mark.h +++ b/include/linux/netfilter/xt_mark.h | |||
@@ -6,4 +6,9 @@ struct xt_mark_info { | |||
6 | u_int8_t invert; | 6 | u_int8_t invert; |
7 | }; | 7 | }; |
8 | 8 | ||
9 | struct xt_mark_mtinfo1 { | ||
10 | u_int32_t mark, mask; | ||
11 | u_int8_t invert; | ||
12 | }; | ||
13 | |||
9 | #endif /*_XT_MARK_H*/ | 14 | #endif /*_XT_MARK_H*/ |
diff --git a/include/linux/netfilter/xt_owner.h b/include/linux/netfilter/xt_owner.h new file mode 100644 index 000000000000..eacd34efebd5 --- /dev/null +++ b/include/linux/netfilter/xt_owner.h | |||
@@ -0,0 +1,16 @@ | |||
1 | #ifndef _XT_OWNER_MATCH_H | ||
2 | #define _XT_OWNER_MATCH_H | ||
3 | |||
4 | enum { | ||
5 | XT_OWNER_UID = 1 << 0, | ||
6 | XT_OWNER_GID = 1 << 1, | ||
7 | XT_OWNER_SOCKET = 1 << 2, | ||
8 | }; | ||
9 | |||
10 | struct xt_owner_match_info { | ||
11 | u_int32_t uid; | ||
12 | u_int32_t gid; | ||
13 | u_int8_t match, invert; | ||
14 | }; | ||
15 | |||
16 | #endif /* _XT_OWNER_MATCH_H */ | ||
diff --git a/include/linux/netfilter/xt_policy.h b/include/linux/netfilter/xt_policy.h index 45654d359a68..053d8cc65464 100644 --- a/include/linux/netfilter/xt_policy.h +++ b/include/linux/netfilter/xt_policy.h | |||
@@ -27,18 +27,33 @@ struct xt_policy_spec | |||
27 | reqid:1; | 27 | reqid:1; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | #ifndef __KERNEL__ | ||
30 | union xt_policy_addr | 31 | union xt_policy_addr |
31 | { | 32 | { |
32 | struct in_addr a4; | 33 | struct in_addr a4; |
33 | struct in6_addr a6; | 34 | struct in6_addr a6; |
34 | }; | 35 | }; |
36 | #endif | ||
35 | 37 | ||
36 | struct xt_policy_elem | 38 | struct xt_policy_elem |
37 | { | 39 | { |
38 | union xt_policy_addr saddr; | 40 | union { |
39 | union xt_policy_addr smask; | 41 | #ifdef __KERNEL__ |
40 | union xt_policy_addr daddr; | 42 | struct { |
41 | union xt_policy_addr dmask; | 43 | union nf_inet_addr saddr; |
44 | union nf_inet_addr smask; | ||
45 | union nf_inet_addr daddr; | ||
46 | union nf_inet_addr dmask; | ||
47 | }; | ||
48 | #else | ||
49 | struct { | ||
50 | union xt_policy_addr saddr; | ||
51 | union xt_policy_addr smask; | ||
52 | union xt_policy_addr daddr; | ||
53 | union xt_policy_addr dmask; | ||
54 | }; | ||
55 | #endif | ||
56 | }; | ||
42 | __be32 spi; | 57 | __be32 spi; |
43 | u_int32_t reqid; | 58 | u_int32_t reqid; |
44 | u_int8_t proto; | 59 | u_int8_t proto; |
diff --git a/include/linux/netfilter/xt_quota.h b/include/linux/netfilter/xt_quota.h index acd7fd77bbee..4c8368d781e5 100644 --- a/include/linux/netfilter/xt_quota.h +++ b/include/linux/netfilter/xt_quota.h | |||
@@ -9,6 +9,8 @@ enum xt_quota_flags { | |||
9 | struct xt_quota_info { | 9 | struct xt_quota_info { |
10 | u_int32_t flags; | 10 | u_int32_t flags; |
11 | u_int32_t pad; | 11 | u_int32_t pad; |
12 | |||
13 | /* Used internally by the kernel */ | ||
12 | aligned_u64 quota; | 14 | aligned_u64 quota; |
13 | struct xt_quota_info *master; | 15 | struct xt_quota_info *master; |
14 | }; | 16 | }; |
diff --git a/include/linux/netfilter/xt_rateest.h b/include/linux/netfilter/xt_rateest.h new file mode 100644 index 000000000000..2010cb74250f --- /dev/null +++ b/include/linux/netfilter/xt_rateest.h | |||
@@ -0,0 +1,35 @@ | |||
1 | #ifndef _XT_RATEEST_MATCH_H | ||
2 | #define _XT_RATEEST_MATCH_H | ||
3 | |||
4 | enum xt_rateest_match_flags { | ||
5 | XT_RATEEST_MATCH_INVERT = 1<<0, | ||
6 | XT_RATEEST_MATCH_ABS = 1<<1, | ||
7 | XT_RATEEST_MATCH_REL = 1<<2, | ||
8 | XT_RATEEST_MATCH_DELTA = 1<<3, | ||
9 | XT_RATEEST_MATCH_BPS = 1<<4, | ||
10 | XT_RATEEST_MATCH_PPS = 1<<5, | ||
11 | }; | ||
12 | |||
13 | enum xt_rateest_match_mode { | ||
14 | XT_RATEEST_MATCH_NONE, | ||
15 | XT_RATEEST_MATCH_EQ, | ||
16 | XT_RATEEST_MATCH_LT, | ||
17 | XT_RATEEST_MATCH_GT, | ||
18 | }; | ||
19 | |||
20 | struct xt_rateest_match_info { | ||
21 | char name1[IFNAMSIZ]; | ||
22 | char name2[IFNAMSIZ]; | ||
23 | u_int16_t flags; | ||
24 | u_int16_t mode; | ||
25 | u_int32_t bps1; | ||
26 | u_int32_t pps1; | ||
27 | u_int32_t bps2; | ||
28 | u_int32_t pps2; | ||
29 | |||
30 | /* Used internally by the kernel */ | ||
31 | struct xt_rateest *est1 __attribute__((aligned(8))); | ||
32 | struct xt_rateest *est2 __attribute__((aligned(8))); | ||
33 | }; | ||
34 | |||
35 | #endif /* _XT_RATEEST_MATCH_H */ | ||
diff --git a/include/linux/netfilter/xt_statistic.h b/include/linux/netfilter/xt_statistic.h index c344e9916e23..3d38bc975048 100644 --- a/include/linux/netfilter/xt_statistic.h +++ b/include/linux/netfilter/xt_statistic.h | |||
@@ -23,6 +23,7 @@ struct xt_statistic_info { | |||
23 | struct { | 23 | struct { |
24 | u_int32_t every; | 24 | u_int32_t every; |
25 | u_int32_t packet; | 25 | u_int32_t packet; |
26 | /* Used internally by the kernel */ | ||
26 | u_int32_t count; | 27 | u_int32_t count; |
27 | } nth; | 28 | } nth; |
28 | } u; | 29 | } u; |
diff --git a/include/linux/netfilter/xt_string.h b/include/linux/netfilter/xt_string.h index 3b3419f2637d..bb21dd1aee2d 100644 --- a/include/linux/netfilter/xt_string.h +++ b/include/linux/netfilter/xt_string.h | |||
@@ -12,6 +12,8 @@ struct xt_string_info | |||
12 | char pattern[XT_STRING_MAX_PATTERN_SIZE]; | 12 | char pattern[XT_STRING_MAX_PATTERN_SIZE]; |
13 | u_int8_t patlen; | 13 | u_int8_t patlen; |
14 | u_int8_t invert; | 14 | u_int8_t invert; |
15 | |||
16 | /* Used internally by the kernel */ | ||
15 | struct ts_config __attribute__((aligned(8))) *config; | 17 | struct ts_config __attribute__((aligned(8))) *config; |
16 | }; | 18 | }; |
17 | 19 | ||
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h index 2fc73fa8e37f..53dd4df27aa1 100644 --- a/include/linux/netfilter_arp/arp_tables.h +++ b/include/linux/netfilter_arp/arp_tables.h | |||
@@ -217,21 +217,8 @@ static __inline__ struct arpt_entry_target *arpt_get_target(struct arpt_entry *e | |||
217 | } | 217 | } |
218 | 218 | ||
219 | /* fn returns 0 to continue iteration */ | 219 | /* fn returns 0 to continue iteration */ |
220 | #define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ | 220 | #define ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ |
221 | ({ \ | 221 | XT_ENTRY_ITERATE(struct arpt_entry, entries, size, fn, ## args) |
222 | unsigned int __i; \ | ||
223 | int __ret = 0; \ | ||
224 | struct arpt_entry *__entry; \ | ||
225 | \ | ||
226 | for (__i = 0; __i < (size); __i += __entry->next_offset) { \ | ||
227 | __entry = (void *)(entries) + __i; \ | ||
228 | \ | ||
229 | __ret = fn(__entry , ## args); \ | ||
230 | if (__ret != 0) \ | ||
231 | break; \ | ||
232 | } \ | ||
233 | __ret; \ | ||
234 | }) | ||
235 | 222 | ||
236 | /* | 223 | /* |
237 | * Main firewall chains definitions and global var's definitions. | 224 | * Main firewall chains definitions and global var's definitions. |
@@ -293,6 +280,37 @@ extern unsigned int arpt_do_table(struct sk_buff *skb, | |||
293 | const struct net_device *out, | 280 | const struct net_device *out, |
294 | struct arpt_table *table); | 281 | struct arpt_table *table); |
295 | 282 | ||
296 | #define ARPT_ALIGN(s) (((s) + (__alignof__(struct arpt_entry)-1)) & ~(__alignof__(struct arpt_entry)-1)) | 283 | #define ARPT_ALIGN(s) XT_ALIGN(s) |
284 | |||
285 | #ifdef CONFIG_COMPAT | ||
286 | #include <net/compat.h> | ||
287 | |||
288 | struct compat_arpt_entry | ||
289 | { | ||
290 | struct arpt_arp arp; | ||
291 | u_int16_t target_offset; | ||
292 | u_int16_t next_offset; | ||
293 | compat_uint_t comefrom; | ||
294 | struct compat_xt_counters counters; | ||
295 | unsigned char elems[0]; | ||
296 | }; | ||
297 | |||
298 | static inline struct arpt_entry_target * | ||
299 | compat_arpt_get_target(struct compat_arpt_entry *e) | ||
300 | { | ||
301 | return (void *)e + e->target_offset; | ||
302 | } | ||
303 | |||
304 | #define COMPAT_ARPT_ALIGN(s) COMPAT_XT_ALIGN(s) | ||
305 | |||
306 | /* fn returns 0 to continue iteration */ | ||
307 | #define COMPAT_ARPT_ENTRY_ITERATE(entries, size, fn, args...) \ | ||
308 | XT_ENTRY_ITERATE(struct compat_arpt_entry, entries, size, fn, ## args) | ||
309 | |||
310 | #define COMPAT_ARPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \ | ||
311 | XT_ENTRY_ITERATE_CONTINUE(struct compat_arpt_entry, entries, size, n, \ | ||
312 | fn, ## args) | ||
313 | |||
314 | #endif /* CONFIG_COMPAT */ | ||
297 | #endif /*__KERNEL__*/ | 315 | #endif /*__KERNEL__*/ |
298 | #endif /* _ARPTABLES_H */ | 316 | #endif /* _ARPTABLES_H */ |
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h index 1a63adf5c4c1..9a10092e358c 100644 --- a/include/linux/netfilter_ipv4.h +++ b/include/linux/netfilter_ipv4.h | |||
@@ -36,7 +36,6 @@ | |||
36 | #define NFC_IP_DST_PT 0x0400 | 36 | #define NFC_IP_DST_PT 0x0400 |
37 | /* Something else about the proto */ | 37 | /* Something else about the proto */ |
38 | #define NFC_IP_PROTO_UNKNOWN 0x2000 | 38 | #define NFC_IP_PROTO_UNKNOWN 0x2000 |
39 | #endif /* ! __KERNEL__ */ | ||
40 | 39 | ||
41 | /* IP Hooks */ | 40 | /* IP Hooks */ |
42 | /* After promisc drops, checksum checks. */ | 41 | /* After promisc drops, checksum checks. */ |
@@ -50,6 +49,7 @@ | |||
50 | /* Packets about to hit the wire. */ | 49 | /* Packets about to hit the wire. */ |
51 | #define NF_IP_POST_ROUTING 4 | 50 | #define NF_IP_POST_ROUTING 4 |
52 | #define NF_IP_NUMHOOKS 5 | 51 | #define NF_IP_NUMHOOKS 5 |
52 | #endif /* ! __KERNEL__ */ | ||
53 | 53 | ||
54 | enum nf_ip_hook_priorities { | 54 | enum nf_ip_hook_priorities { |
55 | NF_IP_PRI_FIRST = INT_MIN, | 55 | NF_IP_PRI_FIRST = INT_MIN, |
diff --git a/include/linux/netfilter_ipv4/ip_tables.h b/include/linux/netfilter_ipv4/ip_tables.h index d79ed69cbc1f..45fcad91e67b 100644 --- a/include/linux/netfilter_ipv4/ip_tables.h +++ b/include/linux/netfilter_ipv4/ip_tables.h | |||
@@ -156,10 +156,10 @@ struct ipt_getinfo | |||
156 | unsigned int valid_hooks; | 156 | unsigned int valid_hooks; |
157 | 157 | ||
158 | /* Hook entry points: one per netfilter hook. */ | 158 | /* Hook entry points: one per netfilter hook. */ |
159 | unsigned int hook_entry[NF_IP_NUMHOOKS]; | 159 | unsigned int hook_entry[NF_INET_NUMHOOKS]; |
160 | 160 | ||
161 | /* Underflow points. */ | 161 | /* Underflow points. */ |
162 | unsigned int underflow[NF_IP_NUMHOOKS]; | 162 | unsigned int underflow[NF_INET_NUMHOOKS]; |
163 | 163 | ||
164 | /* Number of entries */ | 164 | /* Number of entries */ |
165 | unsigned int num_entries; | 165 | unsigned int num_entries; |
@@ -185,10 +185,10 @@ struct ipt_replace | |||
185 | unsigned int size; | 185 | unsigned int size; |
186 | 186 | ||
187 | /* Hook entry points. */ | 187 | /* Hook entry points. */ |
188 | unsigned int hook_entry[NF_IP_NUMHOOKS]; | 188 | unsigned int hook_entry[NF_INET_NUMHOOKS]; |
189 | 189 | ||
190 | /* Underflow points. */ | 190 | /* Underflow points. */ |
191 | unsigned int underflow[NF_IP_NUMHOOKS]; | 191 | unsigned int underflow[NF_INET_NUMHOOKS]; |
192 | 192 | ||
193 | /* Information about old entries: */ | 193 | /* Information about old entries: */ |
194 | /* Number of counters (must be equal to current number of entries). */ | 194 | /* Number of counters (must be equal to current number of entries). */ |
@@ -229,60 +229,12 @@ ipt_get_target(struct ipt_entry *e) | |||
229 | } | 229 | } |
230 | 230 | ||
231 | /* fn returns 0 to continue iteration */ | 231 | /* fn returns 0 to continue iteration */ |
232 | #define IPT_MATCH_ITERATE(e, fn, args...) \ | 232 | #define IPT_MATCH_ITERATE(e, fn, args...) \ |
233 | ({ \ | 233 | XT_MATCH_ITERATE(struct ipt_entry, e, fn, ## args) |
234 | unsigned int __i; \ | ||
235 | int __ret = 0; \ | ||
236 | struct ipt_entry_match *__match; \ | ||
237 | \ | ||
238 | for (__i = sizeof(struct ipt_entry); \ | ||
239 | __i < (e)->target_offset; \ | ||
240 | __i += __match->u.match_size) { \ | ||
241 | __match = (void *)(e) + __i; \ | ||
242 | \ | ||
243 | __ret = fn(__match , ## args); \ | ||
244 | if (__ret != 0) \ | ||
245 | break; \ | ||
246 | } \ | ||
247 | __ret; \ | ||
248 | }) | ||
249 | 234 | ||
250 | /* fn returns 0 to continue iteration */ | 235 | /* fn returns 0 to continue iteration */ |
251 | #define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ | 236 | #define IPT_ENTRY_ITERATE(entries, size, fn, args...) \ |
252 | ({ \ | 237 | XT_ENTRY_ITERATE(struct ipt_entry, entries, size, fn, ## args) |
253 | unsigned int __i; \ | ||
254 | int __ret = 0; \ | ||
255 | struct ipt_entry *__entry; \ | ||
256 | \ | ||
257 | for (__i = 0; __i < (size); __i += __entry->next_offset) { \ | ||
258 | __entry = (void *)(entries) + __i; \ | ||
259 | \ | ||
260 | __ret = fn(__entry , ## args); \ | ||
261 | if (__ret != 0) \ | ||
262 | break; \ | ||
263 | } \ | ||
264 | __ret; \ | ||
265 | }) | ||
266 | |||
267 | /* fn returns 0 to continue iteration */ | ||
268 | #define IPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \ | ||
269 | ({ \ | ||
270 | unsigned int __i, __n; \ | ||
271 | int __ret = 0; \ | ||
272 | struct ipt_entry *__entry; \ | ||
273 | \ | ||
274 | for (__i = 0, __n = 0; __i < (size); \ | ||
275 | __i += __entry->next_offset, __n++) { \ | ||
276 | __entry = (void *)(entries) + __i; \ | ||
277 | if (__n < n) \ | ||
278 | continue; \ | ||
279 | \ | ||
280 | __ret = fn(__entry , ## args); \ | ||
281 | if (__ret != 0) \ | ||
282 | break; \ | ||
283 | } \ | ||
284 | __ret; \ | ||
285 | }) | ||
286 | 238 | ||
287 | /* | 239 | /* |
288 | * Main firewall chains definitions and global var's definitions. | 240 | * Main firewall chains definitions and global var's definitions. |
@@ -359,8 +311,28 @@ struct compat_ipt_entry | |||
359 | unsigned char elems[0]; | 311 | unsigned char elems[0]; |
360 | }; | 312 | }; |
361 | 313 | ||
314 | /* Helper functions */ | ||
315 | static inline struct ipt_entry_target * | ||
316 | compat_ipt_get_target(struct compat_ipt_entry *e) | ||
317 | { | ||
318 | return (void *)e + e->target_offset; | ||
319 | } | ||
320 | |||
362 | #define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s) | 321 | #define COMPAT_IPT_ALIGN(s) COMPAT_XT_ALIGN(s) |
363 | 322 | ||
323 | /* fn returns 0 to continue iteration */ | ||
324 | #define COMPAT_IPT_MATCH_ITERATE(e, fn, args...) \ | ||
325 | XT_MATCH_ITERATE(struct compat_ipt_entry, e, fn, ## args) | ||
326 | |||
327 | /* fn returns 0 to continue iteration */ | ||
328 | #define COMPAT_IPT_ENTRY_ITERATE(entries, size, fn, args...) \ | ||
329 | XT_ENTRY_ITERATE(struct compat_ipt_entry, entries, size, fn, ## args) | ||
330 | |||
331 | /* fn returns 0 to continue iteration */ | ||
332 | #define COMPAT_IPT_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \ | ||
333 | XT_ENTRY_ITERATE_CONTINUE(struct compat_ipt_entry, entries, size, n, \ | ||
334 | fn, ## args) | ||
335 | |||
364 | #endif /* CONFIG_COMPAT */ | 336 | #endif /* CONFIG_COMPAT */ |
365 | #endif /*__KERNEL__*/ | 337 | #endif /*__KERNEL__*/ |
366 | #endif /* _IPTABLES_H */ | 338 | #endif /* _IPTABLES_H */ |
diff --git a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h index daf50be22c9d..e5a3687c8a72 100644 --- a/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h +++ b/include/linux/netfilter_ipv4/ipt_CLUSTERIP.h | |||
@@ -27,6 +27,7 @@ struct ipt_clusterip_tgt_info { | |||
27 | u_int32_t hash_mode; | 27 | u_int32_t hash_mode; |
28 | u_int32_t hash_initval; | 28 | u_int32_t hash_initval; |
29 | 29 | ||
30 | /* Used internally by the kernel */ | ||
30 | struct clusterip_config *config; | 31 | struct clusterip_config *config; |
31 | }; | 32 | }; |
32 | 33 | ||
diff --git a/include/linux/netfilter_ipv4/ipt_addrtype.h b/include/linux/netfilter_ipv4/ipt_addrtype.h index 166ed01a8122..446de6aef983 100644 --- a/include/linux/netfilter_ipv4/ipt_addrtype.h +++ b/include/linux/netfilter_ipv4/ipt_addrtype.h | |||
@@ -1,6 +1,20 @@ | |||
1 | #ifndef _IPT_ADDRTYPE_H | 1 | #ifndef _IPT_ADDRTYPE_H |
2 | #define _IPT_ADDRTYPE_H | 2 | #define _IPT_ADDRTYPE_H |
3 | 3 | ||
4 | enum { | ||
5 | IPT_ADDRTYPE_INVERT_SOURCE = 0x0001, | ||
6 | IPT_ADDRTYPE_INVERT_DEST = 0x0002, | ||
7 | IPT_ADDRTYPE_LIMIT_IFACE_IN = 0x0004, | ||
8 | IPT_ADDRTYPE_LIMIT_IFACE_OUT = 0x0008, | ||
9 | }; | ||
10 | |||
11 | struct ipt_addrtype_info_v1 { | ||
12 | u_int16_t source; /* source-type mask */ | ||
13 | u_int16_t dest; /* dest-type mask */ | ||
14 | u_int32_t flags; | ||
15 | }; | ||
16 | |||
17 | /* revision 0 */ | ||
4 | struct ipt_addrtype_info { | 18 | struct ipt_addrtype_info { |
5 | u_int16_t source; /* source-type mask */ | 19 | u_int16_t source; /* source-type mask */ |
6 | u_int16_t dest; /* dest-type mask */ | 20 | u_int16_t dest; /* dest-type mask */ |
diff --git a/include/linux/netfilter_ipv4/ipt_iprange.h b/include/linux/netfilter_ipv4/ipt_iprange.h index a92fefc3c7ec..5f1aebde4d2f 100644 --- a/include/linux/netfilter_ipv4/ipt_iprange.h +++ b/include/linux/netfilter_ipv4/ipt_iprange.h | |||
@@ -2,11 +2,7 @@ | |||
2 | #define _IPT_IPRANGE_H | 2 | #define _IPT_IPRANGE_H |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | 5 | #include <linux/netfilter/xt_iprange.h> | |
6 | #define IPRANGE_SRC 0x01 /* Match source IP address */ | ||
7 | #define IPRANGE_DST 0x02 /* Match destination IP address */ | ||
8 | #define IPRANGE_SRC_INV 0x10 /* Negate the condition */ | ||
9 | #define IPRANGE_DST_INV 0x20 /* Negate the condition */ | ||
10 | 6 | ||
11 | struct ipt_iprange { | 7 | struct ipt_iprange { |
12 | /* Inclusive: network order. */ | 8 | /* Inclusive: network order. */ |
diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h index 66ca8e3100dc..3475a65dae9b 100644 --- a/include/linux/netfilter_ipv6.h +++ b/include/linux/netfilter_ipv6.h | |||
@@ -40,8 +40,6 @@ | |||
40 | #define NFC_IP6_DST_PT 0x0400 | 40 | #define NFC_IP6_DST_PT 0x0400 |
41 | /* Something else about the proto */ | 41 | /* Something else about the proto */ |
42 | #define NFC_IP6_PROTO_UNKNOWN 0x2000 | 42 | #define NFC_IP6_PROTO_UNKNOWN 0x2000 |
43 | #endif /* ! __KERNEL__ */ | ||
44 | |||
45 | 43 | ||
46 | /* IP6 Hooks */ | 44 | /* IP6 Hooks */ |
47 | /* After promisc drops, checksum checks. */ | 45 | /* After promisc drops, checksum checks. */ |
@@ -55,6 +53,7 @@ | |||
55 | /* Packets about to hit the wire. */ | 53 | /* Packets about to hit the wire. */ |
56 | #define NF_IP6_POST_ROUTING 4 | 54 | #define NF_IP6_POST_ROUTING 4 |
57 | #define NF_IP6_NUMHOOKS 5 | 55 | #define NF_IP6_NUMHOOKS 5 |
56 | #endif /* ! __KERNEL__ */ | ||
58 | 57 | ||
59 | 58 | ||
60 | enum nf_ip6_hook_priorities { | 59 | enum nf_ip6_hook_priorities { |
diff --git a/include/linux/netfilter_ipv6/ip6_tables.h b/include/linux/netfilter_ipv6/ip6_tables.h index 7dc481ce7cba..110801d699ee 100644 --- a/include/linux/netfilter_ipv6/ip6_tables.h +++ b/include/linux/netfilter_ipv6/ip6_tables.h | |||
@@ -216,10 +216,10 @@ struct ip6t_getinfo | |||
216 | unsigned int valid_hooks; | 216 | unsigned int valid_hooks; |
217 | 217 | ||
218 | /* Hook entry points: one per netfilter hook. */ | 218 | /* Hook entry points: one per netfilter hook. */ |
219 | unsigned int hook_entry[NF_IP6_NUMHOOKS]; | 219 | unsigned int hook_entry[NF_INET_NUMHOOKS]; |
220 | 220 | ||
221 | /* Underflow points. */ | 221 | /* Underflow points. */ |
222 | unsigned int underflow[NF_IP6_NUMHOOKS]; | 222 | unsigned int underflow[NF_INET_NUMHOOKS]; |
223 | 223 | ||
224 | /* Number of entries */ | 224 | /* Number of entries */ |
225 | unsigned int num_entries; | 225 | unsigned int num_entries; |
@@ -245,10 +245,10 @@ struct ip6t_replace | |||
245 | unsigned int size; | 245 | unsigned int size; |
246 | 246 | ||
247 | /* Hook entry points. */ | 247 | /* Hook entry points. */ |
248 | unsigned int hook_entry[NF_IP6_NUMHOOKS]; | 248 | unsigned int hook_entry[NF_INET_NUMHOOKS]; |
249 | 249 | ||
250 | /* Underflow points. */ | 250 | /* Underflow points. */ |
251 | unsigned int underflow[NF_IP6_NUMHOOKS]; | 251 | unsigned int underflow[NF_INET_NUMHOOKS]; |
252 | 252 | ||
253 | /* Information about old entries: */ | 253 | /* Information about old entries: */ |
254 | /* Number of counters (must be equal to current number of entries). */ | 254 | /* Number of counters (must be equal to current number of entries). */ |
@@ -289,40 +289,12 @@ ip6t_get_target(struct ip6t_entry *e) | |||
289 | } | 289 | } |
290 | 290 | ||
291 | /* fn returns 0 to continue iteration */ | 291 | /* fn returns 0 to continue iteration */ |
292 | #define IP6T_MATCH_ITERATE(e, fn, args...) \ | 292 | #define IP6T_MATCH_ITERATE(e, fn, args...) \ |
293 | ({ \ | 293 | XT_MATCH_ITERATE(struct ip6t_entry, e, fn, ## args) |
294 | unsigned int __i; \ | ||
295 | int __ret = 0; \ | ||
296 | struct ip6t_entry_match *__m; \ | ||
297 | \ | ||
298 | for (__i = sizeof(struct ip6t_entry); \ | ||
299 | __i < (e)->target_offset; \ | ||
300 | __i += __m->u.match_size) { \ | ||
301 | __m = (void *)(e) + __i; \ | ||
302 | \ | ||
303 | __ret = fn(__m , ## args); \ | ||
304 | if (__ret != 0) \ | ||
305 | break; \ | ||
306 | } \ | ||
307 | __ret; \ | ||
308 | }) | ||
309 | 294 | ||
310 | /* fn returns 0 to continue iteration */ | 295 | /* fn returns 0 to continue iteration */ |
311 | #define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ | 296 | #define IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ |
312 | ({ \ | 297 | XT_ENTRY_ITERATE(struct ip6t_entry, entries, size, fn, ## args) |
313 | unsigned int __i; \ | ||
314 | int __ret = 0; \ | ||
315 | struct ip6t_entry *__e; \ | ||
316 | \ | ||
317 | for (__i = 0; __i < (size); __i += __e->next_offset) { \ | ||
318 | __e = (void *)(entries) + __i; \ | ||
319 | \ | ||
320 | __ret = fn(__e , ## args); \ | ||
321 | if (__ret != 0) \ | ||
322 | break; \ | ||
323 | } \ | ||
324 | __ret; \ | ||
325 | }) | ||
326 | 298 | ||
327 | /* | 299 | /* |
328 | * Main firewall chains definitions and global var's definitions. | 300 | * Main firewall chains definitions and global var's definitions. |
@@ -352,7 +324,42 @@ extern int ip6_masked_addrcmp(const struct in6_addr *addr1, | |||
352 | const struct in6_addr *mask, | 324 | const struct in6_addr *mask, |
353 | const struct in6_addr *addr2); | 325 | const struct in6_addr *addr2); |
354 | 326 | ||
355 | #define IP6T_ALIGN(s) (((s) + (__alignof__(struct ip6t_entry)-1)) & ~(__alignof__(struct ip6t_entry)-1)) | 327 | #define IP6T_ALIGN(s) XT_ALIGN(s) |
356 | 328 | ||
329 | #ifdef CONFIG_COMPAT | ||
330 | #include <net/compat.h> | ||
331 | |||
332 | struct compat_ip6t_entry | ||
333 | { | ||
334 | struct ip6t_ip6 ipv6; | ||
335 | compat_uint_t nfcache; | ||
336 | u_int16_t target_offset; | ||
337 | u_int16_t next_offset; | ||
338 | compat_uint_t comefrom; | ||
339 | struct compat_xt_counters counters; | ||
340 | unsigned char elems[0]; | ||
341 | }; | ||
342 | |||
343 | static inline struct ip6t_entry_target * | ||
344 | compat_ip6t_get_target(struct compat_ip6t_entry *e) | ||
345 | { | ||
346 | return (void *)e + e->target_offset; | ||
347 | } | ||
348 | |||
349 | #define COMPAT_IP6T_ALIGN(s) COMPAT_XT_ALIGN(s) | ||
350 | |||
351 | /* fn returns 0 to continue iteration */ | ||
352 | #define COMPAT_IP6T_MATCH_ITERATE(e, fn, args...) \ | ||
353 | XT_MATCH_ITERATE(struct compat_ip6t_entry, e, fn, ## args) | ||
354 | |||
355 | /* fn returns 0 to continue iteration */ | ||
356 | #define COMPAT_IP6T_ENTRY_ITERATE(entries, size, fn, args...) \ | ||
357 | XT_ENTRY_ITERATE(struct compat_ip6t_entry, entries, size, fn, ## args) | ||
358 | |||
359 | #define COMPAT_IP6T_ENTRY_ITERATE_CONTINUE(entries, size, n, fn, args...) \ | ||
360 | XT_ENTRY_ITERATE_CONTINUE(struct compat_ip6t_entry, entries, size, n, \ | ||
361 | fn, ## args) | ||
362 | |||
363 | #endif /* CONFIG_COMPAT */ | ||
357 | #endif /*__KERNEL__*/ | 364 | #endif /*__KERNEL__*/ |
358 | #endif /* _IP6_TABLES_H */ | 365 | #endif /* _IP6_TABLES_H */ |
diff --git a/include/linux/netlink.h b/include/linux/netlink.h index d5bfaba595c7..bd13b6f4a98e 100644 --- a/include/linux/netlink.h +++ b/include/linux/netlink.h | |||
@@ -178,6 +178,7 @@ extern struct sock *netlink_kernel_create(struct net *net, | |||
178 | void (*input)(struct sk_buff *skb), | 178 | void (*input)(struct sk_buff *skb), |
179 | struct mutex *cb_mutex, | 179 | struct mutex *cb_mutex, |
180 | struct module *module); | 180 | struct module *module); |
181 | extern void netlink_kernel_release(struct sock *sk); | ||
181 | extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); | 182 | extern int netlink_change_ngroups(struct sock *sk, unsigned int groups); |
182 | extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); | 183 | extern void netlink_clear_multicast_users(struct sock *sk, unsigned int group); |
183 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); | 184 | extern void netlink_ack(struct sk_buff *in_skb, struct nlmsghdr *nlh, int err); |
@@ -245,7 +246,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) | |||
245 | } | 246 | } |
246 | 247 | ||
247 | #define NLMSG_NEW(skb, pid, seq, type, len, flags) \ | 248 | #define NLMSG_NEW(skb, pid, seq, type, len, flags) \ |
248 | ({ if (skb_tailroom(skb) < (int)NLMSG_SPACE(len)) \ | 249 | ({ if (unlikely(skb_tailroom(skb) < (int)NLMSG_SPACE(len))) \ |
249 | goto nlmsg_failure; \ | 250 | goto nlmsg_failure; \ |
250 | __nlmsg_put(skb, pid, seq, type, len, flags); }) | 251 | __nlmsg_put(skb, pid, seq, type, len, flags); }) |
251 | 252 | ||
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 20250d963d72..a0525a1f4715 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
@@ -20,12 +20,11 @@ struct netpoll { | |||
20 | 20 | ||
21 | u32 local_ip, remote_ip; | 21 | u32 local_ip, remote_ip; |
22 | u16 local_port, remote_port; | 22 | u16 local_port, remote_port; |
23 | u8 local_mac[ETH_ALEN], remote_mac[ETH_ALEN]; | 23 | u8 remote_mac[ETH_ALEN]; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | struct netpoll_info { | 26 | struct netpoll_info { |
27 | atomic_t refcnt; | 27 | atomic_t refcnt; |
28 | int rx_flags; | ||
29 | spinlock_t rx_lock; | 28 | spinlock_t rx_lock; |
30 | struct netpoll *rx_np; /* netpoll that registered an rx_hook */ | 29 | struct netpoll *rx_np; /* netpoll that registered an rx_hook */ |
31 | struct sk_buff_head arp_tx; /* list of arp requests to reply to */ | 30 | struct sk_buff_head arp_tx; /* list of arp requests to reply to */ |
@@ -51,12 +50,12 @@ static inline int netpoll_rx(struct sk_buff *skb) | |||
51 | unsigned long flags; | 50 | unsigned long flags; |
52 | int ret = 0; | 51 | int ret = 0; |
53 | 52 | ||
54 | if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags)) | 53 | if (!npinfo || !npinfo->rx_np) |
55 | return 0; | 54 | return 0; |
56 | 55 | ||
57 | spin_lock_irqsave(&npinfo->rx_lock, flags); | 56 | spin_lock_irqsave(&npinfo->rx_lock, flags); |
58 | /* check rx_flags again with the lock held */ | 57 | /* check rx_np again with the lock held */ |
59 | if (npinfo->rx_flags && __netpoll_rx(skb)) | 58 | if (npinfo->rx_np && __netpoll_rx(skb)) |
60 | ret = 1; | 59 | ret = 1; |
61 | spin_unlock_irqrestore(&npinfo->rx_lock, flags); | 60 | spin_unlock_irqrestore(&npinfo->rx_lock, flags); |
62 | 61 | ||
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 538ee1dd3d0a..9fecf902419c 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -7,6 +7,18 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * DOC: Station handling | ||
11 | * | ||
12 | * Stations are added per interface, but a special case exists with VLAN | ||
13 | * interfaces. When a station is bound to an AP interface, it may be moved | ||
14 | * into a VLAN identified by a VLAN interface index (%NL80211_ATTR_STA_VLAN). | ||
15 | * The station is still assumed to belong to the AP interface it was added | ||
16 | * to. | ||
17 | * | ||
18 | * TODO: need more info? | ||
19 | */ | ||
20 | |||
21 | /** | ||
10 | * enum nl80211_commands - supported nl80211 commands | 22 | * enum nl80211_commands - supported nl80211 commands |
11 | * | 23 | * |
12 | * @NL80211_CMD_UNSPEC: unspecified command to catch errors | 24 | * @NL80211_CMD_UNSPEC: unspecified command to catch errors |
@@ -37,6 +49,35 @@ | |||
37 | * userspace to request deletion of a virtual interface, then requires | 49 | * userspace to request deletion of a virtual interface, then requires |
38 | * attribute %NL80211_ATTR_IFINDEX. | 50 | * attribute %NL80211_ATTR_IFINDEX. |
39 | * | 51 | * |
52 | * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified | ||
53 | * by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC. | ||
54 | * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT or | ||
55 | * %NL80211_ATTR_KEY_THRESHOLD. | ||
56 | * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, | ||
57 | * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER | ||
58 | * attributes. | ||
59 | * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX | ||
60 | * or %NL80211_ATTR_MAC. | ||
61 | * | ||
62 | * @NL80211_CMD_GET_BEACON: retrieve beacon information (returned in a | ||
63 | * %NL80222_CMD_NEW_BEACON message) | ||
64 | * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface | ||
65 | * using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, | ||
66 | * %NL80211_BEACON_HEAD and %NL80211_BEACON_TAIL attributes. | ||
67 | * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, | ||
68 | * parameters are like for %NL80211_CMD_SET_BEACON. | ||
69 | * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it | ||
70 | * | ||
71 | * @NL80211_CMD_GET_STATION: Get station attributes for station identified by | ||
72 | * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. | ||
73 | * @NL80211_CMD_SET_STATION: Set station attributes for station identified by | ||
74 | * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX. | ||
75 | * @NL80211_CMD_NEW_STATION: Add a station with given attributes to the | ||
76 | * the interface identified by %NL80211_ATTR_IFINDEX. | ||
77 | * @NL80211_CMD_DEL_STATION: Remove a station identified by %NL80211_ATTR_MAC | ||
78 | * or, if no MAC address given, all stations, on the interface identified | ||
79 | * by %NL80211_ATTR_IFINDEX. | ||
80 | * | ||
40 | * @NL80211_CMD_MAX: highest used command number | 81 | * @NL80211_CMD_MAX: highest used command number |
41 | * @__NL80211_CMD_AFTER_LAST: internal use | 82 | * @__NL80211_CMD_AFTER_LAST: internal use |
42 | */ | 83 | */ |
@@ -54,6 +95,21 @@ enum nl80211_commands { | |||
54 | NL80211_CMD_NEW_INTERFACE, | 95 | NL80211_CMD_NEW_INTERFACE, |
55 | NL80211_CMD_DEL_INTERFACE, | 96 | NL80211_CMD_DEL_INTERFACE, |
56 | 97 | ||
98 | NL80211_CMD_GET_KEY, | ||
99 | NL80211_CMD_SET_KEY, | ||
100 | NL80211_CMD_NEW_KEY, | ||
101 | NL80211_CMD_DEL_KEY, | ||
102 | |||
103 | NL80211_CMD_GET_BEACON, | ||
104 | NL80211_CMD_SET_BEACON, | ||
105 | NL80211_CMD_NEW_BEACON, | ||
106 | NL80211_CMD_DEL_BEACON, | ||
107 | |||
108 | NL80211_CMD_GET_STATION, | ||
109 | NL80211_CMD_SET_STATION, | ||
110 | NL80211_CMD_NEW_STATION, | ||
111 | NL80211_CMD_DEL_STATION, | ||
112 | |||
57 | /* add commands here */ | 113 | /* add commands here */ |
58 | 114 | ||
59 | /* used to define NL80211_CMD_MAX below */ | 115 | /* used to define NL80211_CMD_MAX below */ |
@@ -75,6 +131,36 @@ enum nl80211_commands { | |||
75 | * @NL80211_ATTR_IFNAME: network interface name | 131 | * @NL80211_ATTR_IFNAME: network interface name |
76 | * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype | 132 | * @NL80211_ATTR_IFTYPE: type of virtual interface, see &enum nl80211_iftype |
77 | * | 133 | * |
134 | * @NL80211_ATTR_MAC: MAC address (various uses) | ||
135 | * | ||
136 | * @NL80211_ATTR_KEY_DATA: (temporal) key data; for TKIP this consists of | ||
137 | * 16 bytes encryption key followed by 8 bytes each for TX and RX MIC | ||
138 | * keys | ||
139 | * @NL80211_ATTR_KEY_IDX: key ID (u8, 0-3) | ||
140 | * @NL80211_ATTR_KEY_CIPHER: key cipher suite (u32, as defined by IEEE 802.11 | ||
141 | * section 7.3.2.25.1, e.g. 0x000FAC04) | ||
142 | * @NL80211_ATTR_KEY_SEQ: transmit key sequence number (IV/PN) for TKIP and | ||
143 | * CCMP keys, each six bytes in little endian | ||
144 | * | ||
145 | * @NL80211_ATTR_BEACON_INTERVAL: beacon interval in TU | ||
146 | * @NL80211_ATTR_DTIM_PERIOD: DTIM period for beaconing | ||
147 | * @NL80211_ATTR_BEACON_HEAD: portion of the beacon before the TIM IE | ||
148 | * @NL80211_ATTR_BEACON_TAIL: portion of the beacon after the TIM IE | ||
149 | * | ||
150 | * @NL80211_ATTR_STA_AID: Association ID for the station (u16) | ||
151 | * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of | ||
152 | * &enum nl80211_sta_flags. | ||
153 | * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by | ||
154 | * IEEE 802.11 7.3.1.6 (u16). | ||
155 | * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported | ||
156 | * rates as defined by IEEE 802.11 7.3.2.2 but without the length | ||
157 | * restriction (at most %NL80211_MAX_SUPP_RATES). | ||
158 | * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station | ||
159 | * to, or the AP interface the station was originally added to to. | ||
160 | * @NL80211_ATTR_STA_STATS: statistics for a station, part of station info | ||
161 | * given for %NL80211_CMD_GET_STATION, nested attribute containing | ||
162 | * info as possible, see &enum nl80211_sta_stats. | ||
163 | * | ||
78 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 164 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
79 | * @__NL80211_ATTR_AFTER_LAST: internal use | 165 | * @__NL80211_ATTR_AFTER_LAST: internal use |
80 | */ | 166 | */ |
@@ -89,12 +175,34 @@ enum nl80211_attrs { | |||
89 | NL80211_ATTR_IFNAME, | 175 | NL80211_ATTR_IFNAME, |
90 | NL80211_ATTR_IFTYPE, | 176 | NL80211_ATTR_IFTYPE, |
91 | 177 | ||
178 | NL80211_ATTR_MAC, | ||
179 | |||
180 | NL80211_ATTR_KEY_DATA, | ||
181 | NL80211_ATTR_KEY_IDX, | ||
182 | NL80211_ATTR_KEY_CIPHER, | ||
183 | NL80211_ATTR_KEY_SEQ, | ||
184 | NL80211_ATTR_KEY_DEFAULT, | ||
185 | |||
186 | NL80211_ATTR_BEACON_INTERVAL, | ||
187 | NL80211_ATTR_DTIM_PERIOD, | ||
188 | NL80211_ATTR_BEACON_HEAD, | ||
189 | NL80211_ATTR_BEACON_TAIL, | ||
190 | |||
191 | NL80211_ATTR_STA_AID, | ||
192 | NL80211_ATTR_STA_FLAGS, | ||
193 | NL80211_ATTR_STA_LISTEN_INTERVAL, | ||
194 | NL80211_ATTR_STA_SUPPORTED_RATES, | ||
195 | NL80211_ATTR_STA_VLAN, | ||
196 | NL80211_ATTR_STA_STATS, | ||
197 | |||
92 | /* add attributes here, update the policy in nl80211.c */ | 198 | /* add attributes here, update the policy in nl80211.c */ |
93 | 199 | ||
94 | __NL80211_ATTR_AFTER_LAST, | 200 | __NL80211_ATTR_AFTER_LAST, |
95 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 | 201 | NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 |
96 | }; | 202 | }; |
97 | 203 | ||
204 | #define NL80211_MAX_SUPP_RATES 32 | ||
205 | |||
98 | /** | 206 | /** |
99 | * enum nl80211_iftype - (virtual) interface types | 207 | * enum nl80211_iftype - (virtual) interface types |
100 | * | 208 | * |
@@ -126,4 +234,50 @@ enum nl80211_iftype { | |||
126 | NL80211_IFTYPE_MAX = __NL80211_IFTYPE_AFTER_LAST - 1 | 234 | NL80211_IFTYPE_MAX = __NL80211_IFTYPE_AFTER_LAST - 1 |
127 | }; | 235 | }; |
128 | 236 | ||
237 | /** | ||
238 | * enum nl80211_sta_flags - station flags | ||
239 | * | ||
240 | * Station flags. When a station is added to an AP interface, it is | ||
241 | * assumed to be already associated (and hence authenticated.) | ||
242 | * | ||
243 | * @NL80211_STA_FLAG_AUTHORIZED: station is authorized (802.1X) | ||
244 | * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames | ||
245 | * with short barker preamble | ||
246 | * @NL80211_STA_FLAG_WME: station is WME/QoS capable | ||
247 | */ | ||
248 | enum nl80211_sta_flags { | ||
249 | __NL80211_STA_FLAG_INVALID, | ||
250 | NL80211_STA_FLAG_AUTHORIZED, | ||
251 | NL80211_STA_FLAG_SHORT_PREAMBLE, | ||
252 | NL80211_STA_FLAG_WME, | ||
253 | |||
254 | /* keep last */ | ||
255 | __NL80211_STA_FLAG_AFTER_LAST, | ||
256 | NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 | ||
257 | }; | ||
258 | |||
259 | /** | ||
260 | * enum nl80211_sta_stats - station statistics | ||
261 | * | ||
262 | * These attribute types are used with %NL80211_ATTR_STA_STATS | ||
263 | * when getting information about a station. | ||
264 | * | ||
265 | * @__NL80211_STA_STAT_INVALID: attribute number 0 is reserved | ||
266 | * @NL80211_STA_STAT_INACTIVE_TIME: time since last activity (u32, msecs) | ||
267 | * @NL80211_STA_STAT_RX_BYTES: total received bytes (u32, from this station) | ||
268 | * @NL80211_STA_STAT_TX_BYTES: total transmitted bytes (u32, to this station) | ||
269 | * @__NL80211_STA_STAT_AFTER_LAST: internal | ||
270 | * @NL80211_STA_STAT_MAX: highest possible station stats attribute | ||
271 | */ | ||
272 | enum nl80211_sta_stats { | ||
273 | __NL80211_STA_STAT_INVALID, | ||
274 | NL80211_STA_STAT_INACTIVE_TIME, | ||
275 | NL80211_STA_STAT_RX_BYTES, | ||
276 | NL80211_STA_STAT_TX_BYTES, | ||
277 | |||
278 | /* keep last */ | ||
279 | __NL80211_STA_STAT_AFTER_LAST, | ||
280 | NL80211_STA_STAT_MAX = __NL80211_STA_STAT_AFTER_LAST - 1 | ||
281 | }; | ||
282 | |||
129 | #endif /* __LINUX_NL80211_H */ | 283 | #endif /* __LINUX_NL80211_H */ |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 1fbd0256e86b..c69531348363 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -1943,6 +1943,7 @@ | |||
1943 | #define PCI_DEVICE_ID_NX2_5706 0x164a | 1943 | #define PCI_DEVICE_ID_NX2_5706 0x164a |
1944 | #define PCI_DEVICE_ID_NX2_5708 0x164c | 1944 | #define PCI_DEVICE_ID_NX2_5708 0x164c |
1945 | #define PCI_DEVICE_ID_TIGON3_5702FE 0x164d | 1945 | #define PCI_DEVICE_ID_TIGON3_5702FE 0x164d |
1946 | #define PCI_DEVICE_ID_NX2_57710 0x164e | ||
1946 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 | 1947 | #define PCI_DEVICE_ID_TIGON3_5705 0x1653 |
1947 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 | 1948 | #define PCI_DEVICE_ID_TIGON3_5705_2 0x1654 |
1948 | #define PCI_DEVICE_ID_TIGON3_5720 0x1658 | 1949 | #define PCI_DEVICE_ID_TIGON3_5720 0x1658 |
@@ -2081,6 +2082,9 @@ | |||
2081 | #define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea | 2082 | #define PCI_DEVICE_ID_ALTIMA_AC9100 0x03ea |
2082 | #define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb | 2083 | #define PCI_DEVICE_ID_ALTIMA_AC1003 0x03eb |
2083 | 2084 | ||
2085 | #define PCI_VENDOR_ID_BELKIN 0x1799 | ||
2086 | #define PCI_DEVICE_ID_BELKIN_F5D7010V7 0x701f | ||
2087 | |||
2084 | #define PCI_VENDOR_ID_LENOVO 0x17aa | 2088 | #define PCI_VENDOR_ID_LENOVO 0x17aa |
2085 | 2089 | ||
2086 | #define PCI_VENDOR_ID_ARECA 0x17d3 | 2090 | #define PCI_VENDOR_ID_ARECA 0x17d3 |
@@ -2109,6 +2113,8 @@ | |||
2109 | #define PCI_DEVICE_ID_HERC_WIN 0x5732 | 2113 | #define PCI_DEVICE_ID_HERC_WIN 0x5732 |
2110 | #define PCI_DEVICE_ID_HERC_UNI 0x5832 | 2114 | #define PCI_DEVICE_ID_HERC_UNI 0x5832 |
2111 | 2115 | ||
2116 | #define PCI_VENDOR_ID_RDC 0x17f3 | ||
2117 | |||
2112 | #define PCI_VENDOR_ID_SITECOM 0x182d | 2118 | #define PCI_VENDOR_ID_SITECOM 0x182d |
2113 | #define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 | 2119 | #define PCI_DEVICE_ID_SITECOM_DC105V2 0x3069 |
2114 | 2120 | ||
diff --git a/include/linux/pcounter.h b/include/linux/pcounter.h new file mode 100644 index 000000000000..a82d9f2628ca --- /dev/null +++ b/include/linux/pcounter.h | |||
@@ -0,0 +1,74 @@ | |||
1 | #ifndef __LINUX_PCOUNTER_H | ||
2 | #define __LINUX_PCOUNTER_H | ||
3 | /* | ||
4 | * Using a dynamic percpu 'int' variable has a cost : | ||
5 | * 1) Extra dereference | ||
6 | * Current per_cpu_ptr() implementation uses an array per 'percpu variable'. | ||
7 | * 2) memory cost of NR_CPUS*(32+sizeof(void *)) instead of num_possible_cpus()*4 | ||
8 | * | ||
9 | * This pcounter implementation is an abstraction to be able to use | ||
10 | * either a static or a dynamic per cpu variable. | ||
11 | * One dynamic per cpu variable gets a fast & cheap implementation, we can | ||
12 | * change pcounter implementation too. | ||
13 | */ | ||
14 | struct pcounter { | ||
15 | #ifdef CONFIG_SMP | ||
16 | void (*add)(struct pcounter *self, int inc); | ||
17 | int (*getval)(const struct pcounter *self, int cpu); | ||
18 | int *per_cpu_values; | ||
19 | #else | ||
20 | int val; | ||
21 | #endif | ||
22 | }; | ||
23 | |||
24 | #ifdef CONFIG_SMP | ||
25 | #include <linux/percpu.h> | ||
26 | |||
27 | #define DEFINE_PCOUNTER(NAME) \ | ||
28 | static DEFINE_PER_CPU(int, NAME##_pcounter_values); \ | ||
29 | static void NAME##_pcounter_add(struct pcounter *self, int val) \ | ||
30 | { \ | ||
31 | __get_cpu_var(NAME##_pcounter_values) += val; \ | ||
32 | } \ | ||
33 | static int NAME##_pcounter_getval(const struct pcounter *self, int cpu) \ | ||
34 | { \ | ||
35 | return per_cpu(NAME##_pcounter_values, cpu); \ | ||
36 | } \ | ||
37 | |||
38 | #define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER) \ | ||
39 | MEMBER = { \ | ||
40 | .add = NAME##_pcounter_add, \ | ||
41 | .getval = NAME##_pcounter_getval, \ | ||
42 | } | ||
43 | |||
44 | |||
45 | static inline void pcounter_add(struct pcounter *self, int inc) | ||
46 | { | ||
47 | self->add(self, inc); | ||
48 | } | ||
49 | |||
50 | extern int pcounter_getval(const struct pcounter *self); | ||
51 | extern int pcounter_alloc(struct pcounter *self); | ||
52 | extern void pcounter_free(struct pcounter *self); | ||
53 | |||
54 | |||
55 | #else /* CONFIG_SMP */ | ||
56 | |||
57 | static inline void pcounter_add(struct pcounter *self, int inc) | ||
58 | { | ||
59 | self->val += inc; | ||
60 | } | ||
61 | |||
62 | static inline int pcounter_getval(const struct pcounter *self) | ||
63 | { | ||
64 | return self->val; | ||
65 | } | ||
66 | |||
67 | #define DEFINE_PCOUNTER(NAME) | ||
68 | #define PCOUNTER_MEMBER_INITIALIZER(NAME, MEMBER) | ||
69 | #define pcounter_alloc(self) 0 | ||
70 | #define pcounter_free(self) | ||
71 | |||
72 | #endif /* CONFIG_SMP */ | ||
73 | |||
74 | #endif /* __LINUX_PCOUNTER_H */ | ||
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index 919af93b7059..32761352e858 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
@@ -83,6 +83,8 @@ struct tc_ratespec | |||
83 | __u32 rate; | 83 | __u32 rate; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | #define TC_RTAB_SIZE 1024 | ||
87 | |||
86 | /* FIFO section */ | 88 | /* FIFO section */ |
87 | 89 | ||
88 | struct tc_fifo_qopt | 90 | struct tc_fifo_qopt |
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h index a5316829215b..8f92546b403d 100644 --- a/include/linux/proc_fs.h +++ b/include/linux/proc_fs.h | |||
@@ -201,6 +201,8 @@ static inline struct proc_dir_entry *create_proc_info_entry(const char *name, | |||
201 | extern struct proc_dir_entry *proc_net_fops_create(struct net *net, | 201 | extern struct proc_dir_entry *proc_net_fops_create(struct net *net, |
202 | const char *name, mode_t mode, const struct file_operations *fops); | 202 | const char *name, mode_t mode, const struct file_operations *fops); |
203 | extern void proc_net_remove(struct net *net, const char *name); | 203 | extern void proc_net_remove(struct net *net, const char *name); |
204 | extern struct proc_dir_entry *proc_net_mkdir(struct net *net, const char *name, | ||
205 | struct proc_dir_entry *parent); | ||
204 | 206 | ||
205 | #else | 207 | #else |
206 | 208 | ||
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 4e81836191df..b014f6b7fe29 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h | |||
@@ -100,6 +100,13 @@ enum { | |||
100 | RTM_NEWNDUSEROPT = 68, | 100 | RTM_NEWNDUSEROPT = 68, |
101 | #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT | 101 | #define RTM_NEWNDUSEROPT RTM_NEWNDUSEROPT |
102 | 102 | ||
103 | RTM_NEWADDRLABEL = 72, | ||
104 | #define RTM_NEWADDRLABEL RTM_NEWADDRLABEL | ||
105 | RTM_DELADDRLABEL, | ||
106 | #define RTM_NEWADDRLABEL RTM_NEWADDRLABEL | ||
107 | RTM_GETADDRLABEL, | ||
108 | #define RTM_GETADDRLABEL RTM_GETADDRLABEL | ||
109 | |||
103 | __RTM_MAX, | 110 | __RTM_MAX, |
104 | #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) | 111 | #define RTM_MAX (((__RTM_MAX + 3) & ~3) - 1) |
105 | }; | 112 | }; |
@@ -613,11 +620,11 @@ extern int __rtattr_parse_nested_compat(struct rtattr *tb[], int maxattr, | |||
613 | ({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \ | 620 | ({ data = RTA_PAYLOAD(rta) >= len ? RTA_DATA(rta) : NULL; \ |
614 | __rtattr_parse_nested_compat(tb, max, rta, len); }) | 621 | __rtattr_parse_nested_compat(tb, max, rta, len); }) |
615 | 622 | ||
616 | extern int rtnetlink_send(struct sk_buff *skb, u32 pid, u32 group, int echo); | 623 | extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo); |
617 | extern int rtnl_unicast(struct sk_buff *skb, u32 pid); | 624 | extern int rtnl_unicast(struct sk_buff *skb, struct net *net, u32 pid); |
618 | extern int rtnl_notify(struct sk_buff *skb, u32 pid, u32 group, | 625 | extern int rtnl_notify(struct sk_buff *skb, struct net *net, u32 pid, u32 group, |
619 | struct nlmsghdr *nlh, gfp_t flags); | 626 | struct nlmsghdr *nlh, gfp_t flags); |
620 | extern void rtnl_set_sk_err(u32 group, int error); | 627 | extern void rtnl_set_sk_err(struct net *net, u32 group, int error); |
621 | extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); | 628 | extern int rtnetlink_put_metrics(struct sk_buff *skb, u32 *metrics); |
622 | extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, | 629 | extern int rtnl_put_cacheinfo(struct sk_buff *skb, struct dst_entry *dst, |
623 | u32 id, u32 ts, u32 tsage, long expires, | 630 | u32 id, u32 ts, u32 tsage, long expires, |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index ebbc02b325fc..648dfeb444db 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -63,5 +63,18 @@ extern struct list_head *seq_list_start_head(struct list_head *head, | |||
63 | extern struct list_head *seq_list_next(void *v, struct list_head *head, | 63 | extern struct list_head *seq_list_next(void *v, struct list_head *head, |
64 | loff_t *ppos); | 64 | loff_t *ppos); |
65 | 65 | ||
66 | struct net; | ||
67 | struct seq_net_private { | ||
68 | struct net *net; | ||
69 | }; | ||
70 | |||
71 | int seq_open_net(struct inode *, struct file *, | ||
72 | const struct seq_operations *, int); | ||
73 | int seq_release_net(struct inode *, struct file *); | ||
74 | static inline struct net *seq_file_net(struct seq_file *seq) | ||
75 | { | ||
76 | return ((struct seq_net_private *)seq->private)->net; | ||
77 | } | ||
78 | |||
66 | #endif | 79 | #endif |
67 | #endif | 80 | #endif |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index bddd50bd6878..c618fbf7d173 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -95,6 +95,7 @@ | |||
95 | 95 | ||
96 | struct net_device; | 96 | struct net_device; |
97 | struct scatterlist; | 97 | struct scatterlist; |
98 | struct pipe_inode_info; | ||
98 | 99 | ||
99 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | 100 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) |
100 | struct nf_conntrack { | 101 | struct nf_conntrack { |
@@ -287,6 +288,7 @@ struct sk_buff { | |||
287 | __u8 pkt_type:3, | 288 | __u8 pkt_type:3, |
288 | fclone:2, | 289 | fclone:2, |
289 | ipvs_property:1, | 290 | ipvs_property:1, |
291 | peeked:1, | ||
290 | nf_trace:1; | 292 | nf_trace:1; |
291 | __be16 protocol; | 293 | __be16 protocol; |
292 | 294 | ||
@@ -1537,6 +1539,8 @@ static inline int pskb_trim_rcsum(struct sk_buff *skb, unsigned int len) | |||
1537 | skb = skb->prev) | 1539 | skb = skb->prev) |
1538 | 1540 | ||
1539 | 1541 | ||
1542 | extern struct sk_buff *__skb_recv_datagram(struct sock *sk, unsigned flags, | ||
1543 | int *peeked, int *err); | ||
1540 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, | 1544 | extern struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, |
1541 | int noblock, int *err); | 1545 | int noblock, int *err); |
1542 | extern unsigned int datagram_poll(struct file *file, struct socket *sock, | 1546 | extern unsigned int datagram_poll(struct file *file, struct socket *sock, |
@@ -1548,7 +1552,7 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, | |||
1548 | int hlen, | 1552 | int hlen, |
1549 | struct iovec *iov); | 1553 | struct iovec *iov); |
1550 | extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); | 1554 | extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); |
1551 | extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb, | 1555 | extern int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, |
1552 | unsigned int flags); | 1556 | unsigned int flags); |
1553 | extern __wsum skb_checksum(const struct sk_buff *skb, int offset, | 1557 | extern __wsum skb_checksum(const struct sk_buff *skb, int offset, |
1554 | int len, __wsum csum); | 1558 | int len, __wsum csum); |
@@ -1559,6 +1563,11 @@ extern int skb_store_bits(struct sk_buff *skb, int offset, | |||
1559 | extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, | 1563 | extern __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, |
1560 | int offset, u8 *to, int len, | 1564 | int offset, u8 *to, int len, |
1561 | __wsum csum); | 1565 | __wsum csum); |
1566 | extern int skb_splice_bits(struct sk_buff *skb, | ||
1567 | unsigned int offset, | ||
1568 | struct pipe_inode_info *pipe, | ||
1569 | unsigned int len, | ||
1570 | unsigned int flags); | ||
1562 | extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); | 1571 | extern void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to); |
1563 | extern void skb_split(struct sk_buff *skb, | 1572 | extern void skb_split(struct sk_buff *skb, |
1564 | struct sk_buff *skb1, const u32 len); | 1573 | struct sk_buff *skb1, const u32 len); |
diff --git a/include/linux/snmp.h b/include/linux/snmp.h index 89f0c2b5f405..86d3effb2836 100644 --- a/include/linux/snmp.h +++ b/include/linux/snmp.h | |||
@@ -217,4 +217,35 @@ enum | |||
217 | __LINUX_MIB_MAX | 217 | __LINUX_MIB_MAX |
218 | }; | 218 | }; |
219 | 219 | ||
220 | /* linux Xfrm mib definitions */ | ||
221 | enum | ||
222 | { | ||
223 | LINUX_MIB_XFRMNUM = 0, | ||
224 | LINUX_MIB_XFRMINERROR, /* XfrmInError */ | ||
225 | LINUX_MIB_XFRMINBUFFERERROR, /* XfrmInBufferError */ | ||
226 | LINUX_MIB_XFRMINHDRERROR, /* XfrmInHdrError */ | ||
227 | LINUX_MIB_XFRMINNOSTATES, /* XfrmInNoStates */ | ||
228 | LINUX_MIB_XFRMINSTATEPROTOERROR, /* XfrmInStateProtoError */ | ||
229 | LINUX_MIB_XFRMINSTATEMODEERROR, /* XfrmInStateModeError */ | ||
230 | LINUX_MIB_XFRMINSEQOUTOFWINDOW, /* XfrmInSeqOutOfWindow */ | ||
231 | LINUX_MIB_XFRMINSTATEEXPIRED, /* XfrmInStateExpired */ | ||
232 | LINUX_MIB_XFRMINSTATEMISMATCH, /* XfrmInStateMismatch */ | ||
233 | LINUX_MIB_XFRMINSTATEINVALID, /* XfrmInStateInvalid */ | ||
234 | LINUX_MIB_XFRMINTMPLMISMATCH, /* XfrmInTmplMismatch */ | ||
235 | LINUX_MIB_XFRMINNOPOLS, /* XfrmInNoPols */ | ||
236 | LINUX_MIB_XFRMINPOLBLOCK, /* XfrmInPolBlock */ | ||
237 | LINUX_MIB_XFRMINPOLERROR, /* XfrmInPolError */ | ||
238 | LINUX_MIB_XFRMOUTERROR, /* XfrmOutError */ | ||
239 | LINUX_MIB_XFRMOUTBUNDLEGENERROR, /* XfrmOutBundleGenError */ | ||
240 | LINUX_MIB_XFRMOUTBUNDLECHECKERROR, /* XfrmOutBundleCheckError */ | ||
241 | LINUX_MIB_XFRMOUTNOSTATES, /* XfrmOutNoStates */ | ||
242 | LINUX_MIB_XFRMOUTSTATEPROTOERROR, /* XfrmOutStateProtoError */ | ||
243 | LINUX_MIB_XFRMOUTSTATEMODEERROR, /* XfrmOutStateModeError */ | ||
244 | LINUX_MIB_XFRMOUTSTATEEXPIRED, /* XfrmOutStateExpired */ | ||
245 | LINUX_MIB_XFRMOUTPOLBLOCK, /* XfrmOutPolBlock */ | ||
246 | LINUX_MIB_XFRMOUTPOLDEAD, /* XfrmOutPolDead */ | ||
247 | LINUX_MIB_XFRMOUTPOLERROR, /* XfrmOutPolError */ | ||
248 | __LINUX_MIB_XFRMMAX | ||
249 | }; | ||
250 | |||
220 | #endif /* _LINUX_SNMP_H */ | 251 | #endif /* _LINUX_SNMP_H */ |
diff --git a/include/linux/socket.h b/include/linux/socket.h index c22ef1c1afb8..bd2b30a74e76 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -24,7 +24,6 @@ struct __kernel_sockaddr_storage { | |||
24 | #include <linux/types.h> /* pid_t */ | 24 | #include <linux/types.h> /* pid_t */ |
25 | #include <linux/compiler.h> /* __user */ | 25 | #include <linux/compiler.h> /* __user */ |
26 | 26 | ||
27 | extern int sysctl_somaxconn; | ||
28 | #ifdef CONFIG_PROC_FS | 27 | #ifdef CONFIG_PROC_FS |
29 | struct seq_file; | 28 | struct seq_file; |
30 | extern void socket_seq_show(struct seq_file *seq); | 29 | extern void socket_seq_show(struct seq_file *seq); |
@@ -185,6 +184,7 @@ struct ucred { | |||
185 | #define AF_PPPOX 24 /* PPPoX sockets */ | 184 | #define AF_PPPOX 24 /* PPPoX sockets */ |
186 | #define AF_WANPIPE 25 /* Wanpipe API Sockets */ | 185 | #define AF_WANPIPE 25 /* Wanpipe API Sockets */ |
187 | #define AF_LLC 26 /* Linux LLC */ | 186 | #define AF_LLC 26 /* Linux LLC */ |
187 | #define AF_CAN 29 /* Controller Area Network */ | ||
188 | #define AF_TIPC 30 /* TIPC sockets */ | 188 | #define AF_TIPC 30 /* TIPC sockets */ |
189 | #define AF_BLUETOOTH 31 /* Bluetooth sockets */ | 189 | #define AF_BLUETOOTH 31 /* Bluetooth sockets */ |
190 | #define AF_IUCV 32 /* IUCV sockets */ | 190 | #define AF_IUCV 32 /* IUCV sockets */ |
@@ -220,6 +220,7 @@ struct ucred { | |||
220 | #define PF_PPPOX AF_PPPOX | 220 | #define PF_PPPOX AF_PPPOX |
221 | #define PF_WANPIPE AF_WANPIPE | 221 | #define PF_WANPIPE AF_WANPIPE |
222 | #define PF_LLC AF_LLC | 222 | #define PF_LLC AF_LLC |
223 | #define PF_CAN AF_CAN | ||
223 | #define PF_TIPC AF_TIPC | 224 | #define PF_TIPC AF_TIPC |
224 | #define PF_BLUETOOTH AF_BLUETOOTH | 225 | #define PF_BLUETOOTH AF_BLUETOOTH |
225 | #define PF_IUCV AF_IUCV | 226 | #define PF_IUCV AF_IUCV |
diff --git a/include/linux/splice.h b/include/linux/splice.h index 33e447f98a54..528dcb93c2f2 100644 --- a/include/linux/splice.h +++ b/include/linux/splice.h | |||
@@ -53,6 +53,7 @@ struct splice_pipe_desc { | |||
53 | int nr_pages; /* number of pages in map */ | 53 | int nr_pages; /* number of pages in map */ |
54 | unsigned int flags; /* splice flags */ | 54 | unsigned int flags; /* splice flags */ |
55 | const struct pipe_buf_operations *ops;/* ops associated with output pipe */ | 55 | const struct pipe_buf_operations *ops;/* ops associated with output pipe */ |
56 | void (*spd_release)(struct splice_pipe_desc *, unsigned int); | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *, | 59 | typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *, |
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index 2b5c312c4960..e18f5c23b930 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
@@ -15,22 +15,19 @@ struct pcmcia_device; | |||
15 | struct ssb_bus; | 15 | struct ssb_bus; |
16 | struct ssb_driver; | 16 | struct ssb_driver; |
17 | 17 | ||
18 | 18 | struct ssb_sprom { | |
19 | struct ssb_sprom_r1 { | 19 | u8 revision; |
20 | u16 pci_spid; /* Subsystem Product ID for PCI */ | ||
21 | u16 pci_svid; /* Subsystem Vendor ID for PCI */ | ||
22 | u16 pci_pid; /* Product ID for PCI */ | ||
23 | u8 il0mac[6]; /* MAC address for 802.11b/g */ | 20 | u8 il0mac[6]; /* MAC address for 802.11b/g */ |
24 | u8 et0mac[6]; /* MAC address for Ethernet */ | 21 | u8 et0mac[6]; /* MAC address for Ethernet */ |
25 | u8 et1mac[6]; /* MAC address for 802.11a */ | 22 | u8 et1mac[6]; /* MAC address for 802.11a */ |
26 | u8 et0phyaddr:5; /* MII address for enet0 */ | 23 | u8 et0phyaddr; /* MII address for enet0 */ |
27 | u8 et1phyaddr:5; /* MII address for enet1 */ | 24 | u8 et1phyaddr; /* MII address for enet1 */ |
28 | u8 et0mdcport:1; /* MDIO for enet0 */ | 25 | u8 et0mdcport; /* MDIO for enet0 */ |
29 | u8 et1mdcport:1; /* MDIO for enet1 */ | 26 | u8 et1mdcport; /* MDIO for enet1 */ |
30 | u8 board_rev; /* Board revision */ | 27 | u8 board_rev; /* Board revision number from SPROM. */ |
31 | u8 country_code:4; /* Country Code */ | 28 | u8 country_code; /* Country Code */ |
32 | u8 antenna_a:2; /* Antenna 0/1 available for A-PHY */ | 29 | u8 ant_available_a; /* A-PHY antenna available bits (up to 4) */ |
33 | u8 antenna_bg:2; /* Antenna 0/1 available for B-PHY and G-PHY */ | 30 | u8 ant_available_bg; /* B/G-PHY antenna available bits (up to 4) */ |
34 | u16 pa0b0; | 31 | u16 pa0b0; |
35 | u16 pa0b1; | 32 | u16 pa0b1; |
36 | u16 pa0b2; | 33 | u16 pa0b2; |
@@ -41,61 +38,26 @@ struct ssb_sprom_r1 { | |||
41 | u8 gpio1; /* GPIO pin 1 */ | 38 | u8 gpio1; /* GPIO pin 1 */ |
42 | u8 gpio2; /* GPIO pin 2 */ | 39 | u8 gpio2; /* GPIO pin 2 */ |
43 | u8 gpio3; /* GPIO pin 3 */ | 40 | u8 gpio3; /* GPIO pin 3 */ |
44 | u16 maxpwr_a; /* A-PHY Power Amplifier Max Power (in dBm Q5.2) */ | 41 | u16 maxpwr_a; /* A-PHY Amplifier Max Power (in dBm Q5.2) */ |
45 | u16 maxpwr_bg; /* B/G-PHY Power Amplifier Max Power (in dBm Q5.2) */ | 42 | u16 maxpwr_bg; /* B/G-PHY Amplifier Max Power (in dBm Q5.2) */ |
46 | u8 itssi_a; /* Idle TSSI Target for A-PHY */ | 43 | u8 itssi_a; /* Idle TSSI Target for A-PHY */ |
47 | u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ | 44 | u8 itssi_bg; /* Idle TSSI Target for B/G-PHY */ |
48 | u16 boardflags_lo; /* Boardflags (low 16 bits) */ | 45 | u16 boardflags_lo; /* Boardflags (low 16 bits) */ |
49 | u8 antenna_gain_a; /* A-PHY Antenna gain (in dBm Q5.2) */ | ||
50 | u8 antenna_gain_bg; /* B/G-PHY Antenna gain (in dBm Q5.2) */ | ||
51 | u8 oem[8]; /* OEM string (rev 1 only) */ | ||
52 | }; | ||
53 | |||
54 | struct ssb_sprom_r2 { | ||
55 | u16 boardflags_hi; /* Boardflags (high 16 bits) */ | 46 | u16 boardflags_hi; /* Boardflags (high 16 bits) */ |
56 | u8 maxpwr_a_lo; /* A-PHY Max Power Low */ | ||
57 | u8 maxpwr_a_hi; /* A-PHY Max Power High */ | ||
58 | u16 pa1lob0; /* A-PHY PA Low Settings */ | ||
59 | u16 pa1lob1; /* A-PHY PA Low Settings */ | ||
60 | u16 pa1lob2; /* A-PHY PA Low Settings */ | ||
61 | u16 pa1hib0; /* A-PHY PA High Settings */ | ||
62 | u16 pa1hib1; /* A-PHY PA High Settings */ | ||
63 | u16 pa1hib2; /* A-PHY PA High Settings */ | ||
64 | u8 ofdm_pwr_off; /* OFDM Power Offset from CCK Level */ | ||
65 | u8 country_str[2]; /* Two char Country Code */ | ||
66 | }; | ||
67 | |||
68 | struct ssb_sprom_r3 { | ||
69 | u32 ofdmapo; /* A-PHY OFDM Mid Power Offset */ | ||
70 | u32 ofdmalpo; /* A-PHY OFDM Low Power Offset */ | ||
71 | u32 ofdmahpo; /* A-PHY OFDM High Power Offset */ | ||
72 | u8 gpioldc_on_cnt; /* GPIO LED Powersave Duty Cycle ON count */ | ||
73 | u8 gpioldc_off_cnt; /* GPIO LED Powersave Duty Cycle OFF count */ | ||
74 | u8 cckpo_1M:4; /* CCK Power Offset for Rate 1M */ | ||
75 | u8 cckpo_2M:4; /* CCK Power Offset for Rate 2M */ | ||
76 | u8 cckpo_55M:4; /* CCK Power Offset for Rate 5.5M */ | ||
77 | u8 cckpo_11M:4; /* CCK Power Offset for Rate 11M */ | ||
78 | u32 ofdmgpo; /* G-PHY OFDM Power Offset */ | ||
79 | }; | ||
80 | |||
81 | struct ssb_sprom_r4 { | ||
82 | /* TODO */ | ||
83 | }; | ||
84 | 47 | ||
85 | struct ssb_sprom { | 48 | /* Antenna gain values for up to 4 antennas |
86 | u8 revision; | 49 | * on each band. Values in dBm/4 (Q5.2). Negative gain means the |
87 | u8 crc; | 50 | * loss in the connectors is bigger than the gain. */ |
88 | /* The valid r# fields are selected by the "revision". | 51 | struct { |
89 | * Revision 3 and lower inherit from lower revisions. | ||
90 | */ | ||
91 | union { | ||
92 | struct { | 52 | struct { |
93 | struct ssb_sprom_r1 r1; | 53 | s8 a0, a1, a2, a3; |
94 | struct ssb_sprom_r2 r2; | 54 | } ghz24; /* 2.4GHz band */ |
95 | struct ssb_sprom_r3 r3; | 55 | struct { |
96 | }; | 56 | s8 a0, a1, a2, a3; |
97 | struct ssb_sprom_r4 r4; | 57 | } ghz5; /* 5GHz band */ |
98 | }; | 58 | } antenna_gain; |
59 | |||
60 | /* TODO - add any parameters needed from rev 2, 3, or 4 SPROMs */ | ||
99 | }; | 61 | }; |
100 | 62 | ||
101 | /* Information about the PCB the circuitry is soldered on. */ | 63 | /* Information about the PCB the circuitry is soldered on. */ |
@@ -270,7 +232,8 @@ struct ssb_bus { | |||
270 | struct ssb_device *mapped_device; | 232 | struct ssb_device *mapped_device; |
271 | /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ | 233 | /* Currently mapped PCMCIA segment. (bustype == SSB_BUSTYPE_PCMCIA only) */ |
272 | u8 mapped_pcmcia_seg; | 234 | u8 mapped_pcmcia_seg; |
273 | /* Lock for core and segment switching. */ | 235 | /* Lock for core and segment switching. |
236 | * On PCMCIA-host busses this is used to protect the whole MMIO access. */ | ||
274 | spinlock_t bar_lock; | 237 | spinlock_t bar_lock; |
275 | 238 | ||
276 | /* The bus this backplane is running on. */ | 239 | /* The bus this backplane is running on. */ |
@@ -288,6 +251,7 @@ struct ssb_bus { | |||
288 | /* ID information about the Chip. */ | 251 | /* ID information about the Chip. */ |
289 | u16 chip_id; | 252 | u16 chip_id; |
290 | u16 chip_rev; | 253 | u16 chip_rev; |
254 | u16 sprom_size; /* number of words in sprom */ | ||
291 | u8 chip_package; | 255 | u8 chip_package; |
292 | 256 | ||
293 | /* List of devices (cores) on the backplane. */ | 257 | /* List of devices (cores) on the backplane. */ |
@@ -402,6 +366,13 @@ static inline void ssb_pcihost_unregister(struct pci_driver *driver) | |||
402 | { | 366 | { |
403 | pci_unregister_driver(driver); | 367 | pci_unregister_driver(driver); |
404 | } | 368 | } |
369 | |||
370 | static inline | ||
371 | void ssb_pcihost_set_power_state(struct ssb_device *sdev, pci_power_t state) | ||
372 | { | ||
373 | if (sdev->bus->bustype == SSB_BUSTYPE_PCI) | ||
374 | pci_set_power_state(sdev->bus->host_pci, state); | ||
375 | } | ||
405 | #endif /* CONFIG_SSB_PCIHOST */ | 376 | #endif /* CONFIG_SSB_PCIHOST */ |
406 | 377 | ||
407 | 378 | ||
diff --git a/include/linux/ssb/ssb_regs.h b/include/linux/ssb/ssb_regs.h index 47c7c71a5acf..ebad0bac9801 100644 --- a/include/linux/ssb/ssb_regs.h +++ b/include/linux/ssb/ssb_regs.h | |||
@@ -147,6 +147,10 @@ | |||
147 | #define SSB_IDLOW_SSBREV 0xF0000000 /* Sonics Backplane Revision code */ | 147 | #define SSB_IDLOW_SSBREV 0xF0000000 /* Sonics Backplane Revision code */ |
148 | #define SSB_IDLOW_SSBREV_22 0x00000000 /* <= 2.2 */ | 148 | #define SSB_IDLOW_SSBREV_22 0x00000000 /* <= 2.2 */ |
149 | #define SSB_IDLOW_SSBREV_23 0x10000000 /* 2.3 */ | 149 | #define SSB_IDLOW_SSBREV_23 0x10000000 /* 2.3 */ |
150 | #define SSB_IDLOW_SSBREV_24 0x40000000 /* ?? Found in BCM4328 */ | ||
151 | #define SSB_IDLOW_SSBREV_25 0x50000000 /* ?? Not Found yet */ | ||
152 | #define SSB_IDLOW_SSBREV_26 0x60000000 /* ?? Found in some BCM4311/2 */ | ||
153 | #define SSB_IDLOW_SSBREV_27 0x70000000 /* ?? Found in some BCM4311/2 */ | ||
150 | #define SSB_IDHIGH 0x0FFC /* SB Identification High */ | 154 | #define SSB_IDHIGH 0x0FFC /* SB Identification High */ |
151 | #define SSB_IDHIGH_RCLO 0x0000000F /* Revision Code (low part) */ | 155 | #define SSB_IDHIGH_RCLO 0x0000000F /* Revision Code (low part) */ |
152 | #define SSB_IDHIGH_CC 0x00008FF0 /* Core Code */ | 156 | #define SSB_IDHIGH_CC 0x00008FF0 /* Core Code */ |
@@ -162,11 +166,16 @@ | |||
162 | */ | 166 | */ |
163 | #define SSB_SPROMSIZE_WORDS 64 | 167 | #define SSB_SPROMSIZE_WORDS 64 |
164 | #define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16)) | 168 | #define SSB_SPROMSIZE_BYTES (SSB_SPROMSIZE_WORDS * sizeof(u16)) |
169 | #define SSB_SPROMSIZE_WORDS_R123 64 | ||
170 | #define SSB_SPROMSIZE_WORDS_R4 220 | ||
171 | #define SSB_SPROMSIZE_BYTES_R123 (SSB_SPROMSIZE_WORDS_R123 * sizeof(u16)) | ||
172 | #define SSB_SPROMSIZE_BYTES_R4 (SSB_SPROMSIZE_WORDS_R4 * sizeof(u16)) | ||
165 | #define SSB_SPROM_BASE 0x1000 | 173 | #define SSB_SPROM_BASE 0x1000 |
166 | #define SSB_SPROM_REVISION 0x107E | 174 | #define SSB_SPROM_REVISION 0x107E |
167 | #define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */ | 175 | #define SSB_SPROM_REVISION_REV 0x00FF /* SPROM Revision number */ |
168 | #define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */ | 176 | #define SSB_SPROM_REVISION_CRC 0xFF00 /* SPROM CRC8 value */ |
169 | #define SSB_SPROM_REVISION_CRC_SHIFT 8 | 177 | #define SSB_SPROM_REVISION_CRC_SHIFT 8 |
178 | |||
170 | /* SPROM Revision 1 */ | 179 | /* SPROM Revision 1 */ |
171 | #define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */ | 180 | #define SSB_SPROM1_SPID 0x1004 /* Subsystem Product ID for PCI */ |
172 | #define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */ | 181 | #define SSB_SPROM1_SVID 0x1006 /* Subsystem Vendor ID for PCI */ |
@@ -184,10 +193,10 @@ | |||
184 | #define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */ | 193 | #define SSB_SPROM1_BINF_BREV 0x00FF /* Board Revision */ |
185 | #define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */ | 194 | #define SSB_SPROM1_BINF_CCODE 0x0F00 /* Country Code */ |
186 | #define SSB_SPROM1_BINF_CCODE_SHIFT 8 | 195 | #define SSB_SPROM1_BINF_CCODE_SHIFT 8 |
187 | #define SSB_SPROM1_BINF_ANTA 0x3000 /* Available A-PHY antennas */ | 196 | #define SSB_SPROM1_BINF_ANTBG 0x3000 /* Available B-PHY and G-PHY antennas */ |
188 | #define SSB_SPROM1_BINF_ANTA_SHIFT 12 | 197 | #define SSB_SPROM1_BINF_ANTBG_SHIFT 12 |
189 | #define SSB_SPROM1_BINF_ANTBG 0xC000 /* Available B-PHY antennas */ | 198 | #define SSB_SPROM1_BINF_ANTA 0xC000 /* Available A-PHY antennas */ |
190 | #define SSB_SPROM1_BINF_ANTBG_SHIFT 14 | 199 | #define SSB_SPROM1_BINF_ANTA_SHIFT 14 |
191 | #define SSB_SPROM1_PA0B0 0x105E | 200 | #define SSB_SPROM1_PA0B0 0x105E |
192 | #define SSB_SPROM1_PA0B1 0x1060 | 201 | #define SSB_SPROM1_PA0B1 0x1060 |
193 | #define SSB_SPROM1_PA0B2 0x1062 | 202 | #define SSB_SPROM1_PA0B2 0x1062 |
@@ -212,10 +221,11 @@ | |||
212 | #define SSB_SPROM1_ITSSI_A_SHIFT 8 | 221 | #define SSB_SPROM1_ITSSI_A_SHIFT 8 |
213 | #define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */ | 222 | #define SSB_SPROM1_BFLLO 0x1072 /* Boardflags (low 16 bits) */ |
214 | #define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */ | 223 | #define SSB_SPROM1_AGAIN 0x1074 /* Antenna Gain (in dBm Q5.2) */ |
215 | #define SSB_SPROM1_AGAIN_A 0x00FF /* A-PHY */ | 224 | #define SSB_SPROM1_AGAIN_BG 0x00FF /* B-PHY and G-PHY */ |
216 | #define SSB_SPROM1_AGAIN_BG 0xFF00 /* B-PHY and G-PHY */ | 225 | #define SSB_SPROM1_AGAIN_BG_SHIFT 0 |
217 | #define SSB_SPROM1_AGAIN_BG_SHIFT 8 | 226 | #define SSB_SPROM1_AGAIN_A 0xFF00 /* A-PHY */ |
218 | #define SSB_SPROM1_OEM 0x1076 /* 8 bytes OEM string (rev 1 only) */ | 227 | #define SSB_SPROM1_AGAIN_A_SHIFT 8 |
228 | |||
219 | /* SPROM Revision 2 (inherits from rev 1) */ | 229 | /* SPROM Revision 2 (inherits from rev 1) */ |
220 | #define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */ | 230 | #define SSB_SPROM2_BFLHI 0x1038 /* Boardflags (high 16 bits) */ |
221 | #define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */ | 231 | #define SSB_SPROM2_MAXP_A 0x103A /* A-PHY Max Power */ |
@@ -232,7 +242,11 @@ | |||
232 | #define SSB_SPROM2_OPO_VALUE 0x00FF | 242 | #define SSB_SPROM2_OPO_VALUE 0x00FF |
233 | #define SSB_SPROM2_OPO_UNUSED 0xFF00 | 243 | #define SSB_SPROM2_OPO_UNUSED 0xFF00 |
234 | #define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */ | 244 | #define SSB_SPROM2_CCODE 0x107C /* Two char Country Code */ |
235 | /* SPROM Revision 3 (inherits from rev 2) */ | 245 | |
246 | /* SPROM Revision 3 (inherits most data from rev 2) */ | ||
247 | #define SSB_SPROM3_IL0MAC 0x104A /* 6 bytes MAC address for 802.11b/g */ | ||
248 | #define SSB_SPROM3_ET0MAC 0x1050 /* 6 bytes MAC address for Ethernet ?? */ | ||
249 | #define SSB_SPROM3_ET1MAC 0x1050 /* 6 bytes MAC address for 802.11a ?? */ | ||
236 | #define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ | 250 | #define SSB_SPROM3_OFDMAPO 0x102C /* A-PHY OFDM Mid Power Offset (4 bytes, BigEndian) */ |
237 | #define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ | 251 | #define SSB_SPROM3_OFDMALPO 0x1030 /* A-PHY OFDM Low Power Offset (4 bytes, BigEndian) */ |
238 | #define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ | 252 | #define SSB_SPROM3_OFDMAHPO 0x1034 /* A-PHY OFDM High Power Offset (4 bytes, BigEndian) */ |
@@ -251,6 +265,57 @@ | |||
251 | #define SSB_SPROM3_CCKPO_11M_SHIFT 12 | 265 | #define SSB_SPROM3_CCKPO_11M_SHIFT 12 |
252 | #define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ | 266 | #define SSB_SPROM3_OFDMGPO 0x107A /* G-PHY OFDM Power Offset (4 bytes, BigEndian) */ |
253 | 267 | ||
268 | /* SPROM Revision 4 */ | ||
269 | #define SSB_SPROM4_IL0MAC 0x104C /* 6 byte MAC address for a/b/g/n */ | ||
270 | #define SSB_SPROM4_ET0MAC 0x1018 /* 6 bytes MAC address for Ethernet ?? */ | ||
271 | #define SSB_SPROM4_ET1MAC 0x1018 /* 6 bytes MAC address for 802.11a ?? */ | ||
272 | #define SSB_SPROM4_ETHPHY 0x105A /* Ethernet PHY settings ?? */ | ||
273 | #define SSB_SPROM4_ETHPHY_ET0A 0x001F /* MII Address for enet0 */ | ||
274 | #define SSB_SPROM4_ETHPHY_ET1A 0x03E0 /* MII Address for enet1 */ | ||
275 | #define SSB_SPROM4_ETHPHY_ET1A_SHIFT 5 | ||
276 | #define SSB_SPROM4_ETHPHY_ET0M (1<<14) /* MDIO for enet0 */ | ||
277 | #define SSB_SPROM4_ETHPHY_ET1M (1<<15) /* MDIO for enet1 */ | ||
278 | #define SSB_SPROM4_CCODE 0x1052 /* Country Code (2 bytes) */ | ||
279 | #define SSB_SPROM4_ANTAVAIL 0x105D /* Antenna available bitfields */ | ||
280 | #define SSB_SPROM4_ANTAVAIL_A 0x00FF /* A-PHY bitfield */ | ||
281 | #define SSB_SPROM4_ANTAVAIL_A_SHIFT 0 | ||
282 | #define SSB_SPROM4_ANTAVAIL_BG 0xFF00 /* B-PHY and G-PHY bitfield */ | ||
283 | #define SSB_SPROM4_ANTAVAIL_BG_SHIFT 8 | ||
284 | #define SSB_SPROM4_BFLLO 0x1044 /* Boardflags (low 16 bits) */ | ||
285 | #define SSB_SPROM4_AGAIN01 0x105E /* Antenna Gain (in dBm Q5.2) */ | ||
286 | #define SSB_SPROM4_AGAIN0 0x00FF /* Antenna 0 */ | ||
287 | #define SSB_SPROM4_AGAIN0_SHIFT 0 | ||
288 | #define SSB_SPROM4_AGAIN1 0xFF00 /* Antenna 1 */ | ||
289 | #define SSB_SPROM4_AGAIN1_SHIFT 8 | ||
290 | #define SSB_SPROM4_AGAIN23 0x1060 | ||
291 | #define SSB_SPROM4_AGAIN2 0x00FF /* Antenna 2 */ | ||
292 | #define SSB_SPROM4_AGAIN2_SHIFT 0 | ||
293 | #define SSB_SPROM4_AGAIN3 0xFF00 /* Antenna 3 */ | ||
294 | #define SSB_SPROM4_AGAIN3_SHIFT 8 | ||
295 | #define SSB_SPROM4_BFLHI 0x1046 /* Board Flags Hi */ | ||
296 | #define SSB_SPROM4_MAXP_BG 0x1080 /* Max Power BG in path 1 */ | ||
297 | #define SSB_SPROM4_MAXP_BG_MASK 0x00FF /* Mask for Max Power BG */ | ||
298 | #define SSB_SPROM4_ITSSI_BG 0xFF00 /* Mask for path 1 itssi_bg */ | ||
299 | #define SSB_SPROM4_ITSSI_BG_SHIFT 8 | ||
300 | #define SSB_SPROM4_MAXP_A 0x108A /* Max Power A in path 1 */ | ||
301 | #define SSB_SPROM4_MAXP_A_MASK 0x00FF /* Mask for Max Power A */ | ||
302 | #define SSB_SPROM4_ITSSI_A 0xFF00 /* Mask for path 1 itssi_a */ | ||
303 | #define SSB_SPROM4_ITSSI_A_SHIFT 8 | ||
304 | #define SSB_SPROM4_GPIOA 0x1056 /* Gen. Purpose IO # 0 and 1 */ | ||
305 | #define SSB_SPROM4_GPIOA_P0 0x00FF /* Pin 0 */ | ||
306 | #define SSB_SPROM4_GPIOA_P1 0xFF00 /* Pin 1 */ | ||
307 | #define SSB_SPROM4_GPIOA_P1_SHIFT 8 | ||
308 | #define SSB_SPROM4_GPIOB 0x1058 /* Gen. Purpose IO # 2 and 3 */ | ||
309 | #define SSB_SPROM4_GPIOB_P2 0x00FF /* Pin 2 */ | ||
310 | #define SSB_SPROM4_GPIOB_P3 0xFF00 /* Pin 3 */ | ||
311 | #define SSB_SPROM4_GPIOB_P3_SHIFT 8 | ||
312 | #define SSB_SPROM4_PA0B0 0x1082 /* The paXbY locations are */ | ||
313 | #define SSB_SPROM4_PA0B1 0x1084 /* only guesses */ | ||
314 | #define SSB_SPROM4_PA0B2 0x1086 | ||
315 | #define SSB_SPROM4_PA1B0 0x108E | ||
316 | #define SSB_SPROM4_PA1B1 0x1090 | ||
317 | #define SSB_SPROM4_PA1B2 0x1092 | ||
318 | |||
254 | /* Values for SSB_SPROM1_BINF_CCODE */ | 319 | /* Values for SSB_SPROM1_BINF_CCODE */ |
255 | enum { | 320 | enum { |
256 | SSB_SPROM1CCODE_WORLD = 0, | 321 | SSB_SPROM1CCODE_WORLD = 0, |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 4f5047df8a9e..89faebfe48b8 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -945,7 +945,10 @@ enum | |||
945 | 945 | ||
946 | /* For the /proc/sys support */ | 946 | /* For the /proc/sys support */ |
947 | struct ctl_table; | 947 | struct ctl_table; |
948 | struct nsproxy; | ||
948 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); | 949 | extern struct ctl_table_header *sysctl_head_next(struct ctl_table_header *prev); |
950 | extern struct ctl_table_header *__sysctl_head_next(struct nsproxy *namespaces, | ||
951 | struct ctl_table_header *prev); | ||
949 | extern void sysctl_head_finish(struct ctl_table_header *prev); | 952 | extern void sysctl_head_finish(struct ctl_table_header *prev); |
950 | extern int sysctl_perm(struct ctl_table *table, int op); | 953 | extern int sysctl_perm(struct ctl_table *table, int op); |
951 | 954 | ||
@@ -1049,6 +1052,13 @@ struct ctl_table | |||
1049 | void *extra2; | 1052 | void *extra2; |
1050 | }; | 1053 | }; |
1051 | 1054 | ||
1055 | struct ctl_table_root { | ||
1056 | struct list_head root_list; | ||
1057 | struct list_head header_list; | ||
1058 | struct list_head *(*lookup)(struct ctl_table_root *root, | ||
1059 | struct nsproxy *namespaces); | ||
1060 | }; | ||
1061 | |||
1052 | /* struct ctl_table_header is used to maintain dynamic lists of | 1062 | /* struct ctl_table_header is used to maintain dynamic lists of |
1053 | struct ctl_table trees. */ | 1063 | struct ctl_table trees. */ |
1054 | struct ctl_table_header | 1064 | struct ctl_table_header |
@@ -1057,12 +1067,26 @@ struct ctl_table_header | |||
1057 | struct list_head ctl_entry; | 1067 | struct list_head ctl_entry; |
1058 | int used; | 1068 | int used; |
1059 | struct completion *unregistering; | 1069 | struct completion *unregistering; |
1070 | struct ctl_table *ctl_table_arg; | ||
1071 | struct ctl_table_root *root; | ||
1072 | }; | ||
1073 | |||
1074 | /* struct ctl_path describes where in the hierarchy a table is added */ | ||
1075 | struct ctl_path { | ||
1076 | const char *procname; | ||
1077 | int ctl_name; | ||
1060 | }; | 1078 | }; |
1061 | 1079 | ||
1080 | void register_sysctl_root(struct ctl_table_root *root); | ||
1081 | struct ctl_table_header *__register_sysctl_paths( | ||
1082 | struct ctl_table_root *root, struct nsproxy *namespaces, | ||
1083 | const struct ctl_path *path, struct ctl_table *table); | ||
1062 | struct ctl_table_header *register_sysctl_table(struct ctl_table * table); | 1084 | struct ctl_table_header *register_sysctl_table(struct ctl_table * table); |
1085 | struct ctl_table_header *register_sysctl_paths(const struct ctl_path *path, | ||
1086 | struct ctl_table *table); | ||
1063 | 1087 | ||
1064 | void unregister_sysctl_table(struct ctl_table_header * table); | 1088 | void unregister_sysctl_table(struct ctl_table_header * table); |
1065 | int sysctl_check_table(struct ctl_table *table); | 1089 | int sysctl_check_table(struct nsproxy *namespaces, struct ctl_table *table); |
1066 | 1090 | ||
1067 | #else /* __KERNEL__ */ | 1091 | #else /* __KERNEL__ */ |
1068 | 1092 | ||
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index bac17c59b24e..08027f1d7f31 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -330,10 +330,12 @@ struct tcp_sock { | |||
330 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ | 330 | struct tcp_sack_block duplicate_sack[1]; /* D-SACK block */ |
331 | struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ | 331 | struct tcp_sack_block selective_acks[4]; /* The SACKS themselves*/ |
332 | 332 | ||
333 | struct tcp_sack_block_wire recv_sack_cache[4]; | 333 | struct tcp_sack_block recv_sack_cache[4]; |
334 | 334 | ||
335 | u32 highest_sack; /* Start seq of globally highest revd SACK | 335 | struct sk_buff *highest_sack; /* highest skb with SACK received |
336 | * (validity guaranteed only if sacked_out > 0) */ | 336 | * (validity guaranteed only if |
337 | * sacked_out > 0) | ||
338 | */ | ||
337 | 339 | ||
338 | /* from STCP, retrans queue hinting */ | 340 | /* from STCP, retrans queue hinting */ |
339 | struct sk_buff* lost_skb_hint; | 341 | struct sk_buff* lost_skb_hint; |
@@ -341,10 +343,7 @@ struct tcp_sock { | |||
341 | struct sk_buff *scoreboard_skb_hint; | 343 | struct sk_buff *scoreboard_skb_hint; |
342 | struct sk_buff *retransmit_skb_hint; | 344 | struct sk_buff *retransmit_skb_hint; |
343 | struct sk_buff *forward_skb_hint; | 345 | struct sk_buff *forward_skb_hint; |
344 | struct sk_buff *fastpath_skb_hint; | ||
345 | 346 | ||
346 | int fastpath_cnt_hint; /* Lags behind by current skb's pcount | ||
347 | * compared to respective fackets_out */ | ||
348 | int lost_cnt_hint; | 347 | int lost_cnt_hint; |
349 | int retransmit_cnt_hint; | 348 | int retransmit_cnt_hint; |
350 | 349 | ||
diff --git a/include/linux/tty.h b/include/linux/tty.h index defd2ab72449..402de892b3ed 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ | 24 | #define NR_UNIX98_PTY_DEFAULT 4096 /* Default maximum for Unix98 ptys */ |
25 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ | 25 | #define NR_UNIX98_PTY_MAX (1 << MINORBITS) /* Absolute limit */ |
26 | #define NR_LDISCS 17 | 26 | #define NR_LDISCS 18 |
27 | 27 | ||
28 | /* line disciplines */ | 28 | /* line disciplines */ |
29 | #define N_TTY 0 | 29 | #define N_TTY 0 |
@@ -44,6 +44,7 @@ | |||
44 | #define N_SYNC_PPP 14 /* synchronous PPP */ | 44 | #define N_SYNC_PPP 14 /* synchronous PPP */ |
45 | #define N_HCI 15 /* Bluetooth HCI UART */ | 45 | #define N_HCI 15 /* Bluetooth HCI UART */ |
46 | #define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ | 46 | #define N_GIGASET_M101 16 /* Siemens Gigaset M101 serial DECT adapter */ |
47 | #define N_SLCAN 17 /* Serial / USB serial CAN Adaptors */ | ||
47 | 48 | ||
48 | /* | 49 | /* |
49 | * This character is the same as _POSIX_VDISABLE: it cannot be used as | 50 | * This character is the same as _POSIX_VDISABLE: it cannot be used as |
diff --git a/include/linux/wireless.h b/include/linux/wireless.h index 0987aa7a6cf5..74e84caa1e20 100644 --- a/include/linux/wireless.h +++ b/include/linux/wireless.h | |||
@@ -541,6 +541,16 @@ | |||
541 | /* Maximum size of returned data */ | 541 | /* Maximum size of returned data */ |
542 | #define IW_SCAN_MAX_DATA 4096 /* In bytes */ | 542 | #define IW_SCAN_MAX_DATA 4096 /* In bytes */ |
543 | 543 | ||
544 | /* Scan capability flags - in (struct iw_range *)->scan_capa */ | ||
545 | #define IW_SCAN_CAPA_NONE 0x00 | ||
546 | #define IW_SCAN_CAPA_ESSID 0x01 | ||
547 | #define IW_SCAN_CAPA_BSSID 0x02 | ||
548 | #define IW_SCAN_CAPA_CHANNEL 0x04 | ||
549 | #define IW_SCAN_CAPA_MODE 0x08 | ||
550 | #define IW_SCAN_CAPA_RATE 0x10 | ||
551 | #define IW_SCAN_CAPA_TYPE 0x20 | ||
552 | #define IW_SCAN_CAPA_TIME 0x40 | ||
553 | |||
544 | /* Max number of char in custom event - use multiple of them if needed */ | 554 | /* Max number of char in custom event - use multiple of them if needed */ |
545 | #define IW_CUSTOM_MAX 256 /* In bytes */ | 555 | #define IW_CUSTOM_MAX 256 /* In bytes */ |
546 | 556 | ||
@@ -963,6 +973,9 @@ struct iw_range | |||
963 | __u16 old_num_channels; | 973 | __u16 old_num_channels; |
964 | __u8 old_num_frequency; | 974 | __u8 old_num_frequency; |
965 | 975 | ||
976 | /* Scan capabilities */ | ||
977 | __u8 scan_capa; /* IW_SCAN_CAPA_* bit field */ | ||
978 | |||
966 | /* Wireless event capability bitmasks */ | 979 | /* Wireless event capability bitmasks */ |
967 | __u32 event_capa[6]; | 980 | __u32 event_capa[6]; |
968 | 981 | ||
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h index b58adc52448d..9b5b00c4ef9d 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -91,9 +91,9 @@ struct xfrm_replay_state | |||
91 | }; | 91 | }; |
92 | 92 | ||
93 | struct xfrm_algo { | 93 | struct xfrm_algo { |
94 | char alg_name[64]; | 94 | char alg_name[64]; |
95 | int alg_key_len; /* in bits */ | 95 | unsigned int alg_key_len; /* in bits */ |
96 | char alg_key[0]; | 96 | char alg_key[0]; |
97 | }; | 97 | }; |
98 | 98 | ||
99 | struct xfrm_stats { | 99 | struct xfrm_stats { |
@@ -114,6 +114,7 @@ enum | |||
114 | XFRM_POLICY_IN = 0, | 114 | XFRM_POLICY_IN = 0, |
115 | XFRM_POLICY_OUT = 1, | 115 | XFRM_POLICY_OUT = 1, |
116 | XFRM_POLICY_FWD = 2, | 116 | XFRM_POLICY_FWD = 2, |
117 | XFRM_POLICY_MASK = 3, | ||
117 | XFRM_POLICY_MAX = 3 | 118 | XFRM_POLICY_MAX = 3 |
118 | }; | 119 | }; |
119 | 120 | ||
@@ -328,6 +329,7 @@ struct xfrm_usersa_info { | |||
328 | #define XFRM_STATE_DECAP_DSCP 2 | 329 | #define XFRM_STATE_DECAP_DSCP 2 |
329 | #define XFRM_STATE_NOPMTUDISC 4 | 330 | #define XFRM_STATE_NOPMTUDISC 4 |
330 | #define XFRM_STATE_WILDRECV 8 | 331 | #define XFRM_STATE_WILDRECV 8 |
332 | #define XFRM_STATE_ICMP 16 | ||
331 | }; | 333 | }; |
332 | 334 | ||
333 | struct xfrm_usersa_id { | 335 | struct xfrm_usersa_id { |
@@ -362,6 +364,8 @@ struct xfrm_userpolicy_info { | |||
362 | #define XFRM_POLICY_BLOCK 1 | 364 | #define XFRM_POLICY_BLOCK 1 |
363 | __u8 flags; | 365 | __u8 flags; |
364 | #define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ | 366 | #define XFRM_POLICY_LOCALOK 1 /* Allow user to override global policy */ |
367 | /* Automatically expand selector to include matching ICMP payloads. */ | ||
368 | #define XFRM_POLICY_ICMP 2 | ||
365 | __u8 share; | 369 | __u8 share; |
366 | }; | 370 | }; |
367 | 371 | ||
diff --git a/include/net/act_api.h b/include/net/act_api.h index 68b4eaf7719d..565eed8fe496 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -89,7 +89,7 @@ struct tc_action_ops { | |||
89 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); | 89 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); |
90 | int (*cleanup)(struct tc_action *, int bind); | 90 | int (*cleanup)(struct tc_action *, int bind); |
91 | int (*lookup)(struct tc_action *, u32); | 91 | int (*lookup)(struct tc_action *, u32); |
92 | int (*init)(struct rtattr *, struct rtattr *, struct tc_action *, int , int); | 92 | int (*init)(struct nlattr *, struct nlattr *, struct tc_action *, int , int); |
93 | int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); | 93 | int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); |
94 | }; | 94 | }; |
95 | 95 | ||
@@ -104,7 +104,7 @@ extern u32 tcf_hash_new_index(u32 *idx_gen, struct tcf_hashinfo *hinfo); | |||
104 | extern int tcf_hash_search(struct tc_action *a, u32 index); | 104 | extern int tcf_hash_search(struct tc_action *a, u32 index); |
105 | extern struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, | 105 | extern struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, |
106 | int bind, struct tcf_hashinfo *hinfo); | 106 | int bind, struct tcf_hashinfo *hinfo); |
107 | extern struct tcf_common *tcf_hash_create(u32 index, struct rtattr *est, | 107 | extern struct tcf_common *tcf_hash_create(u32 index, struct nlattr *est, |
108 | struct tc_action *a, int size, | 108 | struct tc_action *a, int size, |
109 | int bind, u32 *idx_gen, | 109 | int bind, u32 *idx_gen, |
110 | struct tcf_hashinfo *hinfo); | 110 | struct tcf_hashinfo *hinfo); |
@@ -114,8 +114,8 @@ extern int tcf_register_action(struct tc_action_ops *a); | |||
114 | extern int tcf_unregister_action(struct tc_action_ops *a); | 114 | extern int tcf_unregister_action(struct tc_action_ops *a); |
115 | extern void tcf_action_destroy(struct tc_action *a, int bind); | 115 | extern void tcf_action_destroy(struct tc_action *a, int bind); |
116 | extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res); | 116 | extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res); |
117 | extern struct tc_action *tcf_action_init(struct rtattr *rta, struct rtattr *est, char *n, int ovr, int bind, int *err); | 117 | extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); |
118 | extern struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est, char *n, int ovr, int bind, int *err); | 118 | extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); |
119 | extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); | 119 | extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); |
120 | extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); | 120 | extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); |
121 | extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); | 121 | extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); |
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 33b593e17441..496503c03846 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #define IPV6_MAX_ADDRESSES 16 | 18 | #define IPV6_MAX_ADDRESSES 16 |
19 | 19 | ||
20 | #include <linux/in.h> | ||
20 | #include <linux/in6.h> | 21 | #include <linux/in6.h> |
21 | 22 | ||
22 | struct prefix_info { | 23 | struct prefix_info { |
@@ -58,15 +59,20 @@ extern int addrconf_add_ifaddr(void __user *arg); | |||
58 | extern int addrconf_del_ifaddr(void __user *arg); | 59 | extern int addrconf_del_ifaddr(void __user *arg); |
59 | extern int addrconf_set_dstaddr(void __user *arg); | 60 | extern int addrconf_set_dstaddr(void __user *arg); |
60 | 61 | ||
61 | extern int ipv6_chk_addr(struct in6_addr *addr, | 62 | extern int ipv6_chk_addr(struct net *net, |
63 | struct in6_addr *addr, | ||
62 | struct net_device *dev, | 64 | struct net_device *dev, |
63 | int strict); | 65 | int strict); |
66 | |||
64 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 67 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
65 | extern int ipv6_chk_home_addr(struct in6_addr *addr); | 68 | extern int ipv6_chk_home_addr(struct net *net, |
69 | struct in6_addr *addr); | ||
66 | #endif | 70 | #endif |
67 | extern struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, | 71 | extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, |
68 | struct net_device *dev, | 72 | struct in6_addr *addr, |
69 | int strict); | 73 | struct net_device *dev, |
74 | int strict); | ||
75 | |||
70 | extern int ipv6_get_saddr(struct dst_entry *dst, | 76 | extern int ipv6_get_saddr(struct dst_entry *dst, |
71 | struct in6_addr *daddr, | 77 | struct in6_addr *daddr, |
72 | struct in6_addr *saddr); | 78 | struct in6_addr *saddr); |
@@ -84,6 +90,14 @@ extern void addrconf_leave_solict(struct inet6_dev *idev, | |||
84 | struct in6_addr *addr); | 90 | struct in6_addr *addr); |
85 | 91 | ||
86 | /* | 92 | /* |
93 | * IPv6 Address Label subsystem (addrlabel.c) | ||
94 | */ | ||
95 | extern int ipv6_addr_label_init(void); | ||
96 | extern void ipv6_addr_label_rtnl_register(void); | ||
97 | extern u32 ipv6_addr_label(const struct in6_addr *addr, | ||
98 | int type, int ifindex); | ||
99 | |||
100 | /* | ||
87 | * multicast prototypes (mcast.c) | 101 | * multicast prototypes (mcast.c) |
88 | */ | 102 | */ |
89 | extern int ipv6_sock_mc_join(struct sock *sk, int ifindex, | 103 | extern int ipv6_sock_mc_join(struct sock *sk, int ifindex, |
@@ -241,6 +255,26 @@ static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) | |||
241 | addr->s6_addr32[3] == htonl(0x00000002)); | 255 | addr->s6_addr32[3] == htonl(0x00000002)); |
242 | } | 256 | } |
243 | 257 | ||
258 | static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr) | ||
259 | { | ||
260 | eui[0] = (ipv4_is_zeronet(addr) || ipv4_is_private_10(addr) || | ||
261 | ipv4_is_loopback(addr) || ipv4_is_linklocal_169(addr) || | ||
262 | ipv4_is_private_172(addr) || ipv4_is_test_192(addr) || | ||
263 | ipv4_is_anycast_6to4(addr) || ipv4_is_private_192(addr) || | ||
264 | ipv4_is_test_198(addr) || ipv4_is_multicast(addr) || | ||
265 | ipv4_is_lbcast(addr)) ? 0x00 : 0x02; | ||
266 | eui[1] = 0; | ||
267 | eui[2] = 0x5E; | ||
268 | eui[3] = 0xFE; | ||
269 | memcpy (eui+4, &addr, 4); | ||
270 | return 0; | ||
271 | } | ||
272 | |||
273 | static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) | ||
274 | { | ||
275 | return ((addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE)); | ||
276 | } | ||
277 | |||
244 | #ifdef CONFIG_PROC_FS | 278 | #ifdef CONFIG_PROC_FS |
245 | extern int if6_proc_init(void); | 279 | extern int if6_proc_init(void); |
246 | extern void if6_proc_exit(void); | 280 | extern void if6_proc_exit(void); |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index a1c805d7f488..2dfa96b0575e 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -59,12 +59,11 @@ struct unix_sock { | |||
59 | #define unix_sk(__sk) ((struct unix_sock *)__sk) | 59 | #define unix_sk(__sk) ((struct unix_sock *)__sk) |
60 | 60 | ||
61 | #ifdef CONFIG_SYSCTL | 61 | #ifdef CONFIG_SYSCTL |
62 | extern int sysctl_unix_max_dgram_qlen; | 62 | extern int unix_sysctl_register(struct net *net); |
63 | extern void unix_sysctl_register(void); | 63 | extern void unix_sysctl_unregister(struct net *net); |
64 | extern void unix_sysctl_unregister(void); | ||
65 | #else | 64 | #else |
66 | static inline void unix_sysctl_register(void) {} | 65 | static inline int unix_sysctl_register(struct net *net) { return 0; } |
67 | static inline void unix_sysctl_unregister(void) {} | 66 | static inline void unix_sysctl_unregister(struct net *net) {} |
68 | #endif | 67 | #endif |
69 | #endif | 68 | #endif |
70 | #endif | 69 | #endif |
diff --git a/include/net/arp.h b/include/net/arp.h index f02664568600..752eb47b2678 100644 --- a/include/net/arp.h +++ b/include/net/arp.h | |||
@@ -5,13 +5,12 @@ | |||
5 | #include <linux/if_arp.h> | 5 | #include <linux/if_arp.h> |
6 | #include <net/neighbour.h> | 6 | #include <net/neighbour.h> |
7 | 7 | ||
8 | #define HAVE_ARP_CREATE | ||
9 | 8 | ||
10 | extern struct neigh_table arp_tbl; | 9 | extern struct neigh_table arp_tbl; |
11 | 10 | ||
12 | extern void arp_init(void); | 11 | extern void arp_init(void); |
13 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); | 12 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); |
14 | extern int arp_ioctl(unsigned int cmd, void __user *arg); | 13 | extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); |
15 | extern void arp_send(int type, int ptype, __be32 dest_ip, | 14 | extern void arp_send(int type, int ptype, __be32 dest_ip, |
16 | struct net_device *dev, __be32 src_ip, | 15 | struct net_device *dev, __be32 src_ip, |
17 | unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); | 16 | unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); |
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index 25aa575db807..98ec7a320689 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
@@ -252,8 +252,8 @@ static inline void rfcomm_dlc_put(struct rfcomm_dlc *d) | |||
252 | rfcomm_dlc_free(d); | 252 | rfcomm_dlc_free(d); |
253 | } | 253 | } |
254 | 254 | ||
255 | extern void FASTCALL(__rfcomm_dlc_throttle(struct rfcomm_dlc *d)); | 255 | extern void __rfcomm_dlc_throttle(struct rfcomm_dlc *d); |
256 | extern void FASTCALL(__rfcomm_dlc_unthrottle(struct rfcomm_dlc *d)); | 256 | extern void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d); |
257 | 257 | ||
258 | static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d) | 258 | static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d) |
259 | { | 259 | { |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index d30960e1755c..bcc480b8892a 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -49,6 +49,120 @@ extern int ieee80211_radiotap_iterator_next( | |||
49 | struct ieee80211_radiotap_iterator *iterator); | 49 | struct ieee80211_radiotap_iterator *iterator); |
50 | 50 | ||
51 | 51 | ||
52 | /** | ||
53 | * struct key_params - key information | ||
54 | * | ||
55 | * Information about a key | ||
56 | * | ||
57 | * @key: key material | ||
58 | * @key_len: length of key material | ||
59 | * @cipher: cipher suite selector | ||
60 | * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used | ||
61 | * with the get_key() callback, must be in little endian, | ||
62 | * length given by @seq_len. | ||
63 | */ | ||
64 | struct key_params { | ||
65 | u8 *key; | ||
66 | u8 *seq; | ||
67 | int key_len; | ||
68 | int seq_len; | ||
69 | u32 cipher; | ||
70 | }; | ||
71 | |||
72 | /** | ||
73 | * struct beacon_parameters - beacon parameters | ||
74 | * | ||
75 | * Used to configure the beacon for an interface. | ||
76 | * | ||
77 | * @head: head portion of beacon (before TIM IE) | ||
78 | * or %NULL if not changed | ||
79 | * @tail: tail portion of beacon (after TIM IE) | ||
80 | * or %NULL if not changed | ||
81 | * @interval: beacon interval or zero if not changed | ||
82 | * @dtim_period: DTIM period or zero if not changed | ||
83 | * @head_len: length of @head | ||
84 | * @tail_len: length of @tail | ||
85 | */ | ||
86 | struct beacon_parameters { | ||
87 | u8 *head, *tail; | ||
88 | int interval, dtim_period; | ||
89 | int head_len, tail_len; | ||
90 | }; | ||
91 | |||
92 | /** | ||
93 | * enum station_flags - station flags | ||
94 | * | ||
95 | * Station capability flags. Note that these must be the bits | ||
96 | * according to the nl80211 flags. | ||
97 | * | ||
98 | * @STATION_FLAG_CHANGED: station flags were changed | ||
99 | * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X) | ||
100 | * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames | ||
101 | * with short preambles | ||
102 | * @STATION_FLAG_WME: station is WME/QoS capable | ||
103 | */ | ||
104 | enum station_flags { | ||
105 | STATION_FLAG_CHANGED = 1<<0, | ||
106 | STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED, | ||
107 | STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE, | ||
108 | STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME, | ||
109 | }; | ||
110 | |||
111 | /** | ||
112 | * struct station_parameters - station parameters | ||
113 | * | ||
114 | * Used to change and create a new station. | ||
115 | * | ||
116 | * @vlan: vlan interface station should belong to | ||
117 | * @supported_rates: supported rates in IEEE 802.11 format | ||
118 | * (or NULL for no change) | ||
119 | * @supported_rates_len: number of supported rates | ||
120 | * @station_flags: station flags (see &enum station_flags) | ||
121 | * @listen_interval: listen interval or -1 for no change | ||
122 | * @aid: AID or zero for no change | ||
123 | */ | ||
124 | struct station_parameters { | ||
125 | u8 *supported_rates; | ||
126 | struct net_device *vlan; | ||
127 | u32 station_flags; | ||
128 | int listen_interval; | ||
129 | u16 aid; | ||
130 | u8 supported_rates_len; | ||
131 | }; | ||
132 | |||
133 | /** | ||
134 | * enum station_stats_flags - station statistics flags | ||
135 | * | ||
136 | * Used by the driver to indicate which info in &struct station_stats | ||
137 | * it has filled in during get_station(). | ||
138 | * | ||
139 | * @STATION_STAT_INACTIVE_TIME: @inactive_time filled | ||
140 | * @STATION_STAT_RX_BYTES: @rx_bytes filled | ||
141 | * @STATION_STAT_TX_BYTES: @tx_bytes filled | ||
142 | */ | ||
143 | enum station_stats_flags { | ||
144 | STATION_STAT_INACTIVE_TIME = 1<<0, | ||
145 | STATION_STAT_RX_BYTES = 1<<1, | ||
146 | STATION_STAT_TX_BYTES = 1<<2, | ||
147 | }; | ||
148 | |||
149 | /** | ||
150 | * struct station_stats - station statistics | ||
151 | * | ||
152 | * Station information filled by driver for get_station(). | ||
153 | * | ||
154 | * @filled: bitflag of flags from &enum station_stats_flags | ||
155 | * @inactive_time: time since last station activity (tx/rx) in milliseconds | ||
156 | * @rx_bytes: bytes received from this station | ||
157 | * @tx_bytes: bytes transmitted to this station | ||
158 | */ | ||
159 | struct station_stats { | ||
160 | u32 filled; | ||
161 | u32 inactive_time; | ||
162 | u32 rx_bytes; | ||
163 | u32 tx_bytes; | ||
164 | }; | ||
165 | |||
52 | /* from net/wireless.h */ | 166 | /* from net/wireless.h */ |
53 | struct wiphy; | 167 | struct wiphy; |
54 | 168 | ||
@@ -71,6 +185,31 @@ struct wiphy; | |||
71 | * | 185 | * |
72 | * @change_virtual_intf: change type of virtual interface | 186 | * @change_virtual_intf: change type of virtual interface |
73 | * | 187 | * |
188 | * @add_key: add a key with the given parameters. @mac_addr will be %NULL | ||
189 | * when adding a group key. | ||
190 | * | ||
191 | * @get_key: get information about the key with the given parameters. | ||
192 | * @mac_addr will be %NULL when requesting information for a group | ||
193 | * key. All pointers given to the @callback function need not be valid | ||
194 | * after it returns. | ||
195 | * | ||
196 | * @del_key: remove a key given the @mac_addr (%NULL for a group key) | ||
197 | * and @key_index | ||
198 | * | ||
199 | * @set_default_key: set the default key on an interface | ||
200 | * | ||
201 | * @add_beacon: Add a beacon with given parameters, @head, @interval | ||
202 | * and @dtim_period will be valid, @tail is optional. | ||
203 | * @set_beacon: Change the beacon parameters for an access point mode | ||
204 | * interface. This should reject the call when no beacon has been | ||
205 | * configured. | ||
206 | * @del_beacon: Remove beacon configuration and stop sending the beacon. | ||
207 | * | ||
208 | * @add_station: Add a new station. | ||
209 | * | ||
210 | * @del_station: Remove a station; @mac may be NULL to remove all stations. | ||
211 | * | ||
212 | * @change_station: Modify a given station. | ||
74 | */ | 213 | */ |
75 | struct cfg80211_ops { | 214 | struct cfg80211_ops { |
76 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, | 215 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, |
@@ -78,6 +217,34 @@ struct cfg80211_ops { | |||
78 | int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); | 217 | int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); |
79 | int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, | 218 | int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, |
80 | enum nl80211_iftype type); | 219 | enum nl80211_iftype type); |
220 | |||
221 | int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, | ||
222 | u8 key_index, u8 *mac_addr, | ||
223 | struct key_params *params); | ||
224 | int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, | ||
225 | u8 key_index, u8 *mac_addr, void *cookie, | ||
226 | void (*callback)(void *cookie, struct key_params*)); | ||
227 | int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, | ||
228 | u8 key_index, u8 *mac_addr); | ||
229 | int (*set_default_key)(struct wiphy *wiphy, | ||
230 | struct net_device *netdev, | ||
231 | u8 key_index); | ||
232 | |||
233 | int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, | ||
234 | struct beacon_parameters *info); | ||
235 | int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, | ||
236 | struct beacon_parameters *info); | ||
237 | int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); | ||
238 | |||
239 | |||
240 | int (*add_station)(struct wiphy *wiphy, struct net_device *dev, | ||
241 | u8 *mac, struct station_parameters *params); | ||
242 | int (*del_station)(struct wiphy *wiphy, struct net_device *dev, | ||
243 | u8 *mac); | ||
244 | int (*change_station)(struct wiphy *wiphy, struct net_device *dev, | ||
245 | u8 *mac, struct station_parameters *params); | ||
246 | int (*get_station)(struct wiphy *wiphy, struct net_device *dev, | ||
247 | u8 *mac, struct station_stats *stats); | ||
81 | }; | 248 | }; |
82 | 249 | ||
83 | #endif /* __NET_CFG80211_H */ | 250 | #endif /* __NET_CFG80211_H */ |
diff --git a/include/net/checksum.h b/include/net/checksum.h index 124246172a88..07602b7fa218 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h | |||
@@ -93,4 +93,29 @@ static inline __wsum csum_unfold(__sum16 n) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | #define CSUM_MANGLED_0 ((__force __sum16)0xffff) | 95 | #define CSUM_MANGLED_0 ((__force __sum16)0xffff) |
96 | |||
97 | static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) | ||
98 | { | ||
99 | __be32 diff[] = { ~from, to }; | ||
100 | |||
101 | *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); | ||
102 | } | ||
103 | |||
104 | static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) | ||
105 | { | ||
106 | csum_replace4(sum, (__force __be32)from, (__force __be32)to); | ||
107 | } | ||
108 | |||
109 | struct sk_buff; | ||
110 | extern void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, | ||
111 | __be32 from, __be32 to, int pseudohdr); | ||
112 | |||
113 | static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, | ||
114 | __be16 from, __be16 to, | ||
115 | int pseudohdr) | ||
116 | { | ||
117 | inet_proto_csum_replace4(sum, skb, (__force __be32)from, | ||
118 | (__force __be32)to, pseudohdr); | ||
119 | } | ||
120 | |||
96 | #endif | 121 | #endif |
diff --git a/include/net/dsfield.h b/include/net/dsfield.h index eb65bf2e2502..8a8d4e06900d 100644 --- a/include/net/dsfield.h +++ b/include/net/dsfield.h | |||
@@ -12,15 +12,15 @@ | |||
12 | #include <asm/byteorder.h> | 12 | #include <asm/byteorder.h> |
13 | 13 | ||
14 | 14 | ||
15 | static inline __u8 ipv4_get_dsfield(struct iphdr *iph) | 15 | static inline __u8 ipv4_get_dsfield(const struct iphdr *iph) |
16 | { | 16 | { |
17 | return iph->tos; | 17 | return iph->tos; |
18 | } | 18 | } |
19 | 19 | ||
20 | 20 | ||
21 | static inline __u8 ipv6_get_dsfield(struct ipv6hdr *ipv6h) | 21 | static inline __u8 ipv6_get_dsfield(const struct ipv6hdr *ipv6h) |
22 | { | 22 | { |
23 | return ntohs(*(__be16 *) ipv6h) >> 4; | 23 | return ntohs(*(const __be16 *)ipv6h) >> 4; |
24 | } | 24 | } |
25 | 25 | ||
26 | 26 | ||
diff --git a/include/net/dst.h b/include/net/dst.h index 2f65e894b829..e3ac7d0fc4e1 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -50,14 +50,17 @@ struct dst_entry | |||
50 | unsigned long expires; | 50 | unsigned long expires; |
51 | 51 | ||
52 | unsigned short header_len; /* more space at head required */ | 52 | unsigned short header_len; /* more space at head required */ |
53 | unsigned short nfheader_len; /* more non-fragment space at head required */ | ||
54 | unsigned short trailer_len; /* space to reserve at tail */ | 53 | unsigned short trailer_len; /* space to reserve at tail */ |
55 | 54 | ||
56 | u32 metrics[RTAX_MAX]; | 55 | u32 metrics[RTAX_MAX]; |
57 | struct dst_entry *path; | 56 | struct dst_entry *path; |
58 | 57 | ||
59 | unsigned long rate_last; /* rate limiting for ICMP */ | 58 | unsigned long rate_last; /* rate limiting for ICMP */ |
60 | unsigned long rate_tokens; | 59 | unsigned int rate_tokens; |
60 | |||
61 | #ifdef CONFIG_NET_CLS_ROUTE | ||
62 | __u32 tclassid; | ||
63 | #endif | ||
61 | 64 | ||
62 | struct neighbour *neighbour; | 65 | struct neighbour *neighbour; |
63 | struct hh_cache *hh; | 66 | struct hh_cache *hh; |
@@ -66,10 +69,6 @@ struct dst_entry | |||
66 | int (*input)(struct sk_buff*); | 69 | int (*input)(struct sk_buff*); |
67 | int (*output)(struct sk_buff*); | 70 | int (*output)(struct sk_buff*); |
68 | 71 | ||
69 | #ifdef CONFIG_NET_CLS_ROUTE | ||
70 | __u32 tclassid; | ||
71 | #endif | ||
72 | |||
73 | struct dst_ops *ops; | 72 | struct dst_ops *ops; |
74 | 73 | ||
75 | unsigned long lastuse; | 74 | unsigned long lastuse; |
@@ -81,7 +80,6 @@ struct dst_entry | |||
81 | struct rt6_info *rt6_next; | 80 | struct rt6_info *rt6_next; |
82 | struct dn_route *dn_next; | 81 | struct dn_route *dn_next; |
83 | }; | 82 | }; |
84 | char info[0]; | ||
85 | }; | 83 | }; |
86 | 84 | ||
87 | 85 | ||
@@ -91,7 +89,7 @@ struct dst_ops | |||
91 | __be16 protocol; | 89 | __be16 protocol; |
92 | unsigned gc_thresh; | 90 | unsigned gc_thresh; |
93 | 91 | ||
94 | int (*gc)(void); | 92 | int (*gc)(struct dst_ops *ops); |
95 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); | 93 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); |
96 | void (*destroy)(struct dst_entry *); | 94 | void (*destroy)(struct dst_entry *); |
97 | void (*ifdown)(struct dst_entry *, | 95 | void (*ifdown)(struct dst_entry *, |
@@ -99,10 +97,12 @@ struct dst_ops | |||
99 | struct dst_entry * (*negative_advice)(struct dst_entry *); | 97 | struct dst_entry * (*negative_advice)(struct dst_entry *); |
100 | void (*link_failure)(struct sk_buff *); | 98 | void (*link_failure)(struct sk_buff *); |
101 | void (*update_pmtu)(struct dst_entry *dst, u32 mtu); | 99 | void (*update_pmtu)(struct dst_entry *dst, u32 mtu); |
100 | int (*local_out)(struct sk_buff *skb); | ||
102 | int entry_size; | 101 | int entry_size; |
103 | 102 | ||
104 | atomic_t entries; | 103 | atomic_t entries; |
105 | struct kmem_cache *kmem_cachep; | 104 | struct kmem_cache *kmem_cachep; |
105 | struct net *dst_net; | ||
106 | }; | 106 | }; |
107 | 107 | ||
108 | #ifdef __KERNEL__ | 108 | #ifdef __KERNEL__ |
@@ -180,6 +180,7 @@ static inline struct dst_entry *dst_pop(struct dst_entry *dst) | |||
180 | return child; | 180 | return child; |
181 | } | 181 | } |
182 | 182 | ||
183 | extern int dst_discard(struct sk_buff *skb); | ||
183 | extern void * dst_alloc(struct dst_ops * ops); | 184 | extern void * dst_alloc(struct dst_ops * ops); |
184 | extern void __dst_free(struct dst_entry * dst); | 185 | extern void __dst_free(struct dst_entry * dst); |
185 | extern struct dst_entry *dst_destroy(struct dst_entry * dst); | 186 | extern struct dst_entry *dst_destroy(struct dst_entry * dst); |
@@ -264,6 +265,12 @@ static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie) | |||
264 | 265 | ||
265 | extern void dst_init(void); | 266 | extern void dst_init(void); |
266 | 267 | ||
268 | /* Flags for xfrm_lookup flags argument. */ | ||
269 | enum { | ||
270 | XFRM_LOOKUP_WAIT = 1 << 0, | ||
271 | XFRM_LOOKUP_ICMP = 1 << 1, | ||
272 | }; | ||
273 | |||
267 | struct flowi; | 274 | struct flowi; |
268 | #ifndef CONFIG_XFRM | 275 | #ifndef CONFIG_XFRM |
269 | static inline int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, | 276 | static inline int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 41a301e38643..34349f9f4331 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
@@ -22,6 +22,7 @@ struct fib_rule | |||
22 | u32 target; | 22 | u32 target; |
23 | struct fib_rule * ctarget; | 23 | struct fib_rule * ctarget; |
24 | struct rcu_head rcu; | 24 | struct rcu_head rcu; |
25 | struct net * fr_net; | ||
25 | }; | 26 | }; |
26 | 27 | ||
27 | struct fib_lookup_arg | 28 | struct fib_lookup_arg |
@@ -56,7 +57,7 @@ struct fib_rules_ops | |||
56 | int (*fill)(struct fib_rule *, struct sk_buff *, | 57 | int (*fill)(struct fib_rule *, struct sk_buff *, |
57 | struct nlmsghdr *, | 58 | struct nlmsghdr *, |
58 | struct fib_rule_hdr *); | 59 | struct fib_rule_hdr *); |
59 | u32 (*default_pref)(void); | 60 | u32 (*default_pref)(struct fib_rules_ops *ops); |
60 | size_t (*nlmsg_payload)(struct fib_rule *); | 61 | size_t (*nlmsg_payload)(struct fib_rule *); |
61 | 62 | ||
62 | /* Called after modifications to the rules set, must flush | 63 | /* Called after modifications to the rules set, must flush |
@@ -67,6 +68,7 @@ struct fib_rules_ops | |||
67 | const struct nla_policy *policy; | 68 | const struct nla_policy *policy; |
68 | struct list_head rules_list; | 69 | struct list_head rules_list; |
69 | struct module *owner; | 70 | struct module *owner; |
71 | struct net *fro_net; | ||
70 | }; | 72 | }; |
71 | 73 | ||
72 | #define FRA_GENERIC_POLICY \ | 74 | #define FRA_GENERIC_POLICY \ |
@@ -101,8 +103,9 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) | |||
101 | return frh->table; | 103 | return frh->table; |
102 | } | 104 | } |
103 | 105 | ||
104 | extern int fib_rules_register(struct fib_rules_ops *); | 106 | extern int fib_rules_register(struct fib_rules_ops *); |
105 | extern int fib_rules_unregister(struct fib_rules_ops *); | 107 | extern void fib_rules_unregister(struct fib_rules_ops *); |
108 | extern void fib_rules_cleanup_ops(struct fib_rules_ops *); | ||
106 | 109 | ||
107 | extern int fib_rules_lookup(struct fib_rules_ops *, | 110 | extern int fib_rules_lookup(struct fib_rules_ops *, |
108 | struct flowi *, int flags, | 111 | struct flowi *, int flags, |
diff --git a/include/net/flow.h b/include/net/flow.h index af59fa5cc1f8..ad16e0076c89 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -48,7 +48,6 @@ struct flowi { | |||
48 | 48 | ||
49 | __u8 proto; | 49 | __u8 proto; |
50 | __u8 flags; | 50 | __u8 flags; |
51 | #define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01 | ||
52 | union { | 51 | union { |
53 | struct { | 52 | struct { |
54 | __be16 sport; | 53 | __be16 sport; |
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h index 0b95cf031d6e..8cd8185fa2ed 100644 --- a/include/net/gen_stats.h +++ b/include/net/gen_stats.h | |||
@@ -10,7 +10,7 @@ struct gnet_dump | |||
10 | { | 10 | { |
11 | spinlock_t * lock; | 11 | spinlock_t * lock; |
12 | struct sk_buff * skb; | 12 | struct sk_buff * skb; |
13 | struct rtattr * tail; | 13 | struct nlattr * tail; |
14 | 14 | ||
15 | /* Backward compatability */ | 15 | /* Backward compatability */ |
16 | int compat_tc_stats; | 16 | int compat_tc_stats; |
@@ -39,11 +39,11 @@ extern int gnet_stats_finish_copy(struct gnet_dump *d); | |||
39 | 39 | ||
40 | extern int gen_new_estimator(struct gnet_stats_basic *bstats, | 40 | extern int gen_new_estimator(struct gnet_stats_basic *bstats, |
41 | struct gnet_stats_rate_est *rate_est, | 41 | struct gnet_stats_rate_est *rate_est, |
42 | spinlock_t *stats_lock, struct rtattr *opt); | 42 | spinlock_t *stats_lock, struct nlattr *opt); |
43 | extern void gen_kill_estimator(struct gnet_stats_basic *bstats, | 43 | extern void gen_kill_estimator(struct gnet_stats_basic *bstats, |
44 | struct gnet_stats_rate_est *rate_est); | 44 | struct gnet_stats_rate_est *rate_est); |
45 | extern int gen_replace_estimator(struct gnet_stats_basic *bstats, | 45 | extern int gen_replace_estimator(struct gnet_stats_basic *bstats, |
46 | struct gnet_stats_rate_est *rate_est, | 46 | struct gnet_stats_rate_est *rate_est, |
47 | spinlock_t *stats_lock, struct rtattr *opt); | 47 | spinlock_t *stats_lock, struct nlattr *opt); |
48 | 48 | ||
49 | #endif | 49 | #endif |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index d8ae48439f12..285b2adfa648 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -677,7 +677,7 @@ struct ieee80211_probe_request { | |||
677 | 677 | ||
678 | struct ieee80211_probe_response { | 678 | struct ieee80211_probe_response { |
679 | struct ieee80211_hdr_3addr header; | 679 | struct ieee80211_hdr_3addr header; |
680 | u32 time_stamp[2]; | 680 | __le32 time_stamp[2]; |
681 | __le16 beacon_interval; | 681 | __le16 beacon_interval; |
682 | __le16 capability; | 682 | __le16 capability; |
683 | /* SSID, supported rates, FH params, DS params, | 683 | /* SSID, supported rates, FH params, DS params, |
@@ -718,8 +718,8 @@ struct ieee80211_txb { | |||
718 | u8 encrypted; | 718 | u8 encrypted; |
719 | u8 rts_included; | 719 | u8 rts_included; |
720 | u8 reserved; | 720 | u8 reserved; |
721 | __le16 frag_size; | 721 | u16 frag_size; |
722 | __le16 payload_size; | 722 | u16 payload_size; |
723 | struct sk_buff *fragments[0]; | 723 | struct sk_buff *fragments[0]; |
724 | }; | 724 | }; |
725 | 725 | ||
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index de8399a79774..ba33db053854 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h | |||
@@ -83,9 +83,9 @@ static inline void IP_ECN_clear(struct iphdr *iph) | |||
83 | iph->tos &= ~INET_ECN_MASK; | 83 | iph->tos &= ~INET_ECN_MASK; |
84 | } | 84 | } |
85 | 85 | ||
86 | static inline void ipv4_copy_dscp(struct iphdr *outer, struct iphdr *inner) | 86 | static inline void ipv4_copy_dscp(unsigned int dscp, struct iphdr *inner) |
87 | { | 87 | { |
88 | u32 dscp = ipv4_get_dsfield(outer) & ~INET_ECN_MASK; | 88 | dscp &= ~INET_ECN_MASK; |
89 | ipv4_change_dsfield(inner, INET_ECN_MASK, dscp); | 89 | ipv4_change_dsfield(inner, INET_ECN_MASK, dscp); |
90 | } | 90 | } |
91 | 91 | ||
@@ -104,9 +104,9 @@ static inline void IP6_ECN_clear(struct ipv6hdr *iph) | |||
104 | *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20); | 104 | *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20); |
105 | } | 105 | } |
106 | 106 | ||
107 | static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner) | 107 | static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner) |
108 | { | 108 | { |
109 | u32 dscp = ipv6_get_dsfield(outer) & ~INET_ECN_MASK; | 109 | dscp &= ~INET_ECN_MASK; |
110 | ipv6_change_dsfield(inner, INET_ECN_MASK, dscp); | 110 | ipv6_change_dsfield(inner, INET_ECN_MASK, dscp); |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 954def408975..7374251b9787 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
@@ -1,8 +1,20 @@ | |||
1 | #ifndef __NET_FRAG_H__ | 1 | #ifndef __NET_FRAG_H__ |
2 | #define __NET_FRAG_H__ | 2 | #define __NET_FRAG_H__ |
3 | 3 | ||
4 | struct netns_frags { | ||
5 | int nqueues; | ||
6 | atomic_t mem; | ||
7 | struct list_head lru_list; | ||
8 | |||
9 | /* sysctls */ | ||
10 | int timeout; | ||
11 | int high_thresh; | ||
12 | int low_thresh; | ||
13 | }; | ||
14 | |||
4 | struct inet_frag_queue { | 15 | struct inet_frag_queue { |
5 | struct hlist_node list; | 16 | struct hlist_node list; |
17 | struct netns_frags *net; | ||
6 | struct list_head lru_list; /* lru list member */ | 18 | struct list_head lru_list; /* lru list member */ |
7 | spinlock_t lock; | 19 | spinlock_t lock; |
8 | atomic_t refcnt; | 20 | atomic_t refcnt; |
@@ -20,23 +32,13 @@ struct inet_frag_queue { | |||
20 | 32 | ||
21 | #define INETFRAGS_HASHSZ 64 | 33 | #define INETFRAGS_HASHSZ 64 |
22 | 34 | ||
23 | struct inet_frags_ctl { | ||
24 | int high_thresh; | ||
25 | int low_thresh; | ||
26 | int timeout; | ||
27 | int secret_interval; | ||
28 | }; | ||
29 | |||
30 | struct inet_frags { | 35 | struct inet_frags { |
31 | struct list_head lru_list; | ||
32 | struct hlist_head hash[INETFRAGS_HASHSZ]; | 36 | struct hlist_head hash[INETFRAGS_HASHSZ]; |
33 | rwlock_t lock; | 37 | rwlock_t lock; |
34 | u32 rnd; | 38 | u32 rnd; |
35 | int nqueues; | ||
36 | int qsize; | 39 | int qsize; |
37 | atomic_t mem; | 40 | int secret_interval; |
38 | struct timer_list secret_timer; | 41 | struct timer_list secret_timer; |
39 | struct inet_frags_ctl *ctl; | ||
40 | 42 | ||
41 | unsigned int (*hashfn)(struct inet_frag_queue *); | 43 | unsigned int (*hashfn)(struct inet_frag_queue *); |
42 | void (*constructor)(struct inet_frag_queue *q, | 44 | void (*constructor)(struct inet_frag_queue *q, |
@@ -51,12 +53,15 @@ struct inet_frags { | |||
51 | void inet_frags_init(struct inet_frags *); | 53 | void inet_frags_init(struct inet_frags *); |
52 | void inet_frags_fini(struct inet_frags *); | 54 | void inet_frags_fini(struct inet_frags *); |
53 | 55 | ||
56 | void inet_frags_init_net(struct netns_frags *nf); | ||
57 | void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f); | ||
58 | |||
54 | void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); | 59 | void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); |
55 | void inet_frag_destroy(struct inet_frag_queue *q, | 60 | void inet_frag_destroy(struct inet_frag_queue *q, |
56 | struct inet_frags *f, int *work); | 61 | struct inet_frags *f, int *work); |
57 | int inet_frag_evictor(struct inet_frags *f); | 62 | int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f); |
58 | struct inet_frag_queue *inet_frag_find(struct inet_frags *f, void *key, | 63 | struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
59 | unsigned int hash); | 64 | struct inet_frags *f, void *key, unsigned int hash); |
60 | 65 | ||
61 | static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) | 66 | static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) |
62 | { | 67 | { |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 37f6cb112127..761bdc01425d 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -264,37 +264,14 @@ static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo) | |||
264 | wake_up(&hashinfo->lhash_wait); | 264 | wake_up(&hashinfo->lhash_wait); |
265 | } | 265 | } |
266 | 266 | ||
267 | static inline void __inet_hash(struct inet_hashinfo *hashinfo, | 267 | extern void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk); |
268 | struct sock *sk, const int listen_possible) | 268 | extern void __inet_hash_nolisten(struct inet_hashinfo *hinfo, struct sock *sk); |
269 | { | ||
270 | struct hlist_head *list; | ||
271 | rwlock_t *lock; | ||
272 | |||
273 | BUG_TRAP(sk_unhashed(sk)); | ||
274 | if (listen_possible && sk->sk_state == TCP_LISTEN) { | ||
275 | list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; | ||
276 | lock = &hashinfo->lhash_lock; | ||
277 | inet_listen_wlock(hashinfo); | ||
278 | } else { | ||
279 | struct inet_ehash_bucket *head; | ||
280 | sk->sk_hash = inet_sk_ehashfn(sk); | ||
281 | head = inet_ehash_bucket(hashinfo, sk->sk_hash); | ||
282 | list = &head->chain; | ||
283 | lock = inet_ehash_lockp(hashinfo, sk->sk_hash); | ||
284 | write_lock(lock); | ||
285 | } | ||
286 | __sk_add_node(sk, list); | ||
287 | sock_prot_inc_use(sk->sk_prot); | ||
288 | write_unlock(lock); | ||
289 | if (listen_possible && sk->sk_state == TCP_LISTEN) | ||
290 | wake_up(&hashinfo->lhash_wait); | ||
291 | } | ||
292 | 269 | ||
293 | static inline void inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk) | 270 | static inline void inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk) |
294 | { | 271 | { |
295 | if (sk->sk_state != TCP_CLOSE) { | 272 | if (sk->sk_state != TCP_CLOSE) { |
296 | local_bh_disable(); | 273 | local_bh_disable(); |
297 | __inet_hash(hashinfo, sk, 1); | 274 | __inet_hash(hashinfo, sk); |
298 | local_bh_enable(); | 275 | local_bh_enable(); |
299 | } | 276 | } |
300 | } | 277 | } |
@@ -316,7 +293,7 @@ static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk) | |||
316 | } | 293 | } |
317 | 294 | ||
318 | if (__sk_del_node_init(sk)) | 295 | if (__sk_del_node_init(sk)) |
319 | sock_prot_dec_use(sk->sk_prot); | 296 | sock_prot_inuse_add(sk->sk_prot, -1); |
320 | write_unlock_bh(lock); | 297 | write_unlock_bh(lock); |
321 | out: | 298 | out: |
322 | if (sk->sk_state == TCP_LISTEN) | 299 | if (sk->sk_state == TCP_LISTEN) |
@@ -397,43 +374,9 @@ typedef __u64 __bitwise __addrpair; | |||
397 | * | 374 | * |
398 | * Local BH must be disabled here. | 375 | * Local BH must be disabled here. |
399 | */ | 376 | */ |
400 | static inline struct sock * | 377 | extern struct sock * __inet_lookup_established(struct inet_hashinfo *hashinfo, |
401 | __inet_lookup_established(struct inet_hashinfo *hashinfo, | 378 | const __be32 saddr, const __be16 sport, |
402 | const __be32 saddr, const __be16 sport, | 379 | const __be32 daddr, const u16 hnum, const int dif); |
403 | const __be32 daddr, const u16 hnum, | ||
404 | const int dif) | ||
405 | { | ||
406 | INET_ADDR_COOKIE(acookie, saddr, daddr) | ||
407 | const __portpair ports = INET_COMBINED_PORTS(sport, hnum); | ||
408 | struct sock *sk; | ||
409 | const struct hlist_node *node; | ||
410 | /* Optimize here for direct hit, only listening connections can | ||
411 | * have wildcards anyways. | ||
412 | */ | ||
413 | unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport); | ||
414 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); | ||
415 | rwlock_t *lock = inet_ehash_lockp(hashinfo, hash); | ||
416 | |||
417 | prefetch(head->chain.first); | ||
418 | read_lock(lock); | ||
419 | sk_for_each(sk, node, &head->chain) { | ||
420 | if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) | ||
421 | goto hit; /* You sunk my battleship! */ | ||
422 | } | ||
423 | |||
424 | /* Must check for a TIME_WAIT'er before going to listener hash. */ | ||
425 | sk_for_each(sk, node, &head->twchain) { | ||
426 | if (INET_TW_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) | ||
427 | goto hit; | ||
428 | } | ||
429 | sk = NULL; | ||
430 | out: | ||
431 | read_unlock(lock); | ||
432 | return sk; | ||
433 | hit: | ||
434 | sock_hold(sk); | ||
435 | goto out; | ||
436 | } | ||
437 | 380 | ||
438 | static inline struct sock * | 381 | static inline struct sock * |
439 | inet_lookup_established(struct inet_hashinfo *hashinfo, | 382 | inet_lookup_established(struct inet_hashinfo *hashinfo, |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index abaff0597270..67e925065aae 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -193,19 +193,7 @@ static inline __be32 inet_rcv_saddr(const struct sock *sk) | |||
193 | inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; | 193 | inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; |
194 | } | 194 | } |
195 | 195 | ||
196 | static inline void inet_twsk_put(struct inet_timewait_sock *tw) | 196 | extern void inet_twsk_put(struct inet_timewait_sock *tw); |
197 | { | ||
198 | if (atomic_dec_and_test(&tw->tw_refcnt)) { | ||
199 | struct module *owner = tw->tw_prot->owner; | ||
200 | twsk_destructor((struct sock *)tw); | ||
201 | #ifdef SOCK_REFCNT_DEBUG | ||
202 | printk(KERN_DEBUG "%s timewait_sock %p released\n", | ||
203 | tw->tw_prot->name, tw); | ||
204 | #endif | ||
205 | kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw); | ||
206 | module_put(owner); | ||
207 | } | ||
208 | } | ||
209 | 197 | ||
210 | extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, | 198 | extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, |
211 | const int state); | 199 | const int state); |
diff --git a/include/net/ip.h b/include/net/ip.h index 50c8889b1b8d..9f50d4f1f157 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -82,8 +82,6 @@ struct packet_type; | |||
82 | struct rtable; | 82 | struct rtable; |
83 | struct sockaddr; | 83 | struct sockaddr; |
84 | 84 | ||
85 | extern void ip_mc_dropsocket(struct sock *); | ||
86 | extern void ip_mc_dropdevice(struct net_device *dev); | ||
87 | extern int igmp_mc_proc_init(void); | 85 | extern int igmp_mc_proc_init(void); |
88 | 86 | ||
89 | /* | 87 | /* |
@@ -102,6 +100,8 @@ extern int ip_mc_output(struct sk_buff *skb); | |||
102 | extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); | 100 | extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); |
103 | extern int ip_do_nat(struct sk_buff *skb); | 101 | extern int ip_do_nat(struct sk_buff *skb); |
104 | extern void ip_send_check(struct iphdr *ip); | 102 | extern void ip_send_check(struct iphdr *ip); |
103 | extern int __ip_local_out(struct sk_buff *skb); | ||
104 | extern int ip_local_out(struct sk_buff *skb); | ||
105 | extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); | 105 | extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); |
106 | extern void ip_init(void); | 106 | extern void ip_init(void); |
107 | extern int ip_append_data(struct sock *sk, | 107 | extern int ip_append_data(struct sock *sk, |
@@ -169,7 +169,7 @@ DECLARE_SNMP_STAT(struct linux_mib, net_statistics); | |||
169 | #define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd) | 169 | #define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd) |
170 | 170 | ||
171 | extern unsigned long snmp_fold_field(void *mib[], int offt); | 171 | extern unsigned long snmp_fold_field(void *mib[], int offt); |
172 | extern int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign); | 172 | extern int snmp_mib_init(void *ptr[2], size_t mibsize); |
173 | extern void snmp_mib_free(void *ptr[2]); | 173 | extern void snmp_mib_free(void *ptr[2]); |
174 | 174 | ||
175 | extern void inet_get_local_port_range(int *low, int *high); | 175 | extern void inet_get_local_port_range(int *low, int *high); |
@@ -177,10 +177,7 @@ extern void inet_get_local_port_range(int *low, int *high); | |||
177 | extern int sysctl_ip_default_ttl; | 177 | extern int sysctl_ip_default_ttl; |
178 | extern int sysctl_ip_nonlocal_bind; | 178 | extern int sysctl_ip_nonlocal_bind; |
179 | 179 | ||
180 | /* From ip_fragment.c */ | 180 | extern struct ctl_path net_ipv4_ctl_path[]; |
181 | struct inet_frags_ctl; | ||
182 | extern struct inet_frags_ctl ip4_frags_ctl; | ||
183 | extern int sysctl_ipfrag_max_dist; | ||
184 | 181 | ||
185 | /* From inetpeer.c */ | 182 | /* From inetpeer.c */ |
186 | extern int inet_peer_threshold; | 183 | extern int inet_peer_threshold; |
@@ -319,7 +316,7 @@ static __inline__ void inet_reset_saddr(struct sock *sk) | |||
319 | extern int ip_call_ra_chain(struct sk_buff *skb); | 316 | extern int ip_call_ra_chain(struct sk_buff *skb); |
320 | 317 | ||
321 | /* | 318 | /* |
322 | * Functions provided by ip_fragment.o | 319 | * Functions provided by ip_fragment.c |
323 | */ | 320 | */ |
324 | 321 | ||
325 | enum ip_defrag_users | 322 | enum ip_defrag_users |
@@ -334,15 +331,14 @@ enum ip_defrag_users | |||
334 | }; | 331 | }; |
335 | 332 | ||
336 | int ip_defrag(struct sk_buff *skb, u32 user); | 333 | int ip_defrag(struct sk_buff *skb, u32 user); |
337 | int ip_frag_mem(void); | 334 | int ip_frag_mem(struct net *net); |
338 | int ip_frag_nqueues(void); | 335 | int ip_frag_nqueues(struct net *net); |
339 | 336 | ||
340 | /* | 337 | /* |
341 | * Functions provided by ip_forward.c | 338 | * Functions provided by ip_forward.c |
342 | */ | 339 | */ |
343 | 340 | ||
344 | extern int ip_forward(struct sk_buff *skb); | 341 | extern int ip_forward(struct sk_buff *skb); |
345 | extern int ip_net_unreachable(struct sk_buff *skb); | ||
346 | 342 | ||
347 | /* | 343 | /* |
348 | * Functions provided by ip_options.c | 344 | * Functions provided by ip_options.c |
@@ -393,6 +389,4 @@ int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen, | |||
393 | extern int ip_misc_proc_init(void); | 389 | extern int ip_misc_proc_init(void); |
394 | #endif | 390 | #endif |
395 | 391 | ||
396 | extern struct ctl_table ipv4_table[]; | ||
397 | |||
398 | #endif /* _IP_H */ | 392 | #endif /* _IP_H */ |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 857821360bb6..d8d85b13364d 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -99,16 +99,21 @@ struct rt6_info | |||
99 | u32 rt6i_flags; | 99 | u32 rt6i_flags; |
100 | u32 rt6i_metric; | 100 | u32 rt6i_metric; |
101 | atomic_t rt6i_ref; | 101 | atomic_t rt6i_ref; |
102 | struct fib6_table *rt6i_table; | ||
103 | 102 | ||
104 | struct rt6key rt6i_dst; | 103 | /* more non-fragment space at head required */ |
105 | struct rt6key rt6i_src; | 104 | unsigned short rt6i_nfheader_len; |
106 | 105 | ||
107 | u8 rt6i_protocol; | 106 | u8 rt6i_protocol; |
108 | 107 | ||
108 | struct fib6_table *rt6i_table; | ||
109 | |||
110 | struct rt6key rt6i_dst; | ||
111 | |||
109 | #ifdef CONFIG_XFRM | 112 | #ifdef CONFIG_XFRM |
110 | u32 rt6i_flow_cache_genid; | 113 | u32 rt6i_flow_cache_genid; |
111 | #endif | 114 | #endif |
115 | |||
116 | struct rt6key rt6i_src; | ||
112 | }; | 117 | }; |
113 | 118 | ||
114 | static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) | 119 | static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) |
@@ -219,10 +224,20 @@ extern void fib6_run_gc(unsigned long dummy); | |||
219 | 224 | ||
220 | extern void fib6_gc_cleanup(void); | 225 | extern void fib6_gc_cleanup(void); |
221 | 226 | ||
222 | extern void fib6_init(void); | 227 | extern int fib6_init(void); |
223 | 228 | ||
224 | extern void fib6_rules_init(void); | 229 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
230 | extern int fib6_rules_init(void); | ||
225 | extern void fib6_rules_cleanup(void); | 231 | extern void fib6_rules_cleanup(void); |
226 | 232 | #else | |
233 | static inline int fib6_rules_init(void) | ||
234 | { | ||
235 | return 0; | ||
236 | } | ||
237 | static inline void fib6_rules_cleanup(void) | ||
238 | { | ||
239 | return ; | ||
240 | } | ||
241 | #endif | ||
227 | #endif | 242 | #endif |
228 | #endif | 243 | #endif |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 5456fdd6d047..faac0eee1ef3 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -43,14 +43,12 @@ extern struct rt6_info ip6_prohibit_entry; | |||
43 | extern struct rt6_info ip6_blk_hole_entry; | 43 | extern struct rt6_info ip6_blk_hole_entry; |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | extern int ip6_rt_gc_interval; | ||
47 | |||
48 | extern void ip6_route_input(struct sk_buff *skb); | 46 | extern void ip6_route_input(struct sk_buff *skb); |
49 | 47 | ||
50 | extern struct dst_entry * ip6_route_output(struct sock *sk, | 48 | extern struct dst_entry * ip6_route_output(struct sock *sk, |
51 | struct flowi *fl); | 49 | struct flowi *fl); |
52 | 50 | ||
53 | extern void ip6_route_init(void); | 51 | extern int ip6_route_init(void); |
54 | extern void ip6_route_cleanup(void); | 52 | extern void ip6_route_cleanup(void); |
55 | 53 | ||
56 | extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); | 54 | extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index ed514bfb61ba..9daa60b544ba 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -125,11 +125,15 @@ struct fib_result_nl { | |||
125 | #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) | 125 | #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) |
126 | #define FIB_RES_RESET(res) ((res).nh_sel = 0) | 126 | #define FIB_RES_RESET(res) ((res).nh_sel = 0) |
127 | 127 | ||
128 | #define FIB_TABLE_HASHSZ 2 | ||
129 | |||
128 | #else /* CONFIG_IP_ROUTE_MULTIPATH */ | 130 | #else /* CONFIG_IP_ROUTE_MULTIPATH */ |
129 | 131 | ||
130 | #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) | 132 | #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) |
131 | #define FIB_RES_RESET(res) | 133 | #define FIB_RES_RESET(res) |
132 | 134 | ||
135 | #define FIB_TABLE_HASHSZ 256 | ||
136 | |||
133 | #endif /* CONFIG_IP_ROUTE_MULTIPATH */ | 137 | #endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
134 | 138 | ||
135 | #define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __fib_res_prefsrc(&res)) | 139 | #define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __fib_res_prefsrc(&res)) |
@@ -141,6 +145,7 @@ struct fib_table { | |||
141 | struct hlist_node tb_hlist; | 145 | struct hlist_node tb_hlist; |
142 | u32 tb_id; | 146 | u32 tb_id; |
143 | unsigned tb_stamp; | 147 | unsigned tb_stamp; |
148 | int tb_default; | ||
144 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); | 149 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); |
145 | int (*tb_insert)(struct fib_table *, struct fib_config *); | 150 | int (*tb_insert)(struct fib_table *, struct fib_config *); |
146 | int (*tb_delete)(struct fib_table *, struct fib_config *); | 151 | int (*tb_delete)(struct fib_table *, struct fib_config *); |
@@ -155,50 +160,51 @@ struct fib_table { | |||
155 | 160 | ||
156 | #ifndef CONFIG_IP_MULTIPLE_TABLES | 161 | #ifndef CONFIG_IP_MULTIPLE_TABLES |
157 | 162 | ||
158 | extern struct fib_table *ip_fib_local_table; | 163 | #define TABLE_LOCAL_INDEX 0 |
159 | extern struct fib_table *ip_fib_main_table; | 164 | #define TABLE_MAIN_INDEX 1 |
160 | 165 | ||
161 | static inline struct fib_table *fib_get_table(u32 id) | 166 | static inline struct fib_table *fib_get_table(struct net *net, u32 id) |
162 | { | 167 | { |
163 | if (id != RT_TABLE_LOCAL) | 168 | struct hlist_head *ptr; |
164 | return ip_fib_main_table; | ||
165 | return ip_fib_local_table; | ||
166 | } | ||
167 | 169 | ||
168 | static inline struct fib_table *fib_new_table(u32 id) | 170 | ptr = id == RT_TABLE_LOCAL ? |
169 | { | 171 | &net->ipv4.fib_table_hash[TABLE_LOCAL_INDEX] : |
170 | return fib_get_table(id); | 172 | &net->ipv4.fib_table_hash[TABLE_MAIN_INDEX]; |
173 | return hlist_entry(ptr->first, struct fib_table, tb_hlist); | ||
171 | } | 174 | } |
172 | 175 | ||
173 | static inline int fib_lookup(const struct flowi *flp, struct fib_result *res) | 176 | static inline struct fib_table *fib_new_table(struct net *net, u32 id) |
174 | { | 177 | { |
175 | if (ip_fib_local_table->tb_lookup(ip_fib_local_table, flp, res) && | 178 | return fib_get_table(net, id); |
176 | ip_fib_main_table->tb_lookup(ip_fib_main_table, flp, res)) | ||
177 | return -ENETUNREACH; | ||
178 | return 0; | ||
179 | } | 179 | } |
180 | 180 | ||
181 | static inline void fib_select_default(const struct flowi *flp, struct fib_result *res) | 181 | static inline int fib_lookup(struct net *net, const struct flowi *flp, |
182 | struct fib_result *res) | ||
182 | { | 183 | { |
183 | if (FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) | 184 | struct fib_table *table; |
184 | ip_fib_main_table->tb_select_default(ip_fib_main_table, flp, res); | 185 | |
186 | table = fib_get_table(net, RT_TABLE_LOCAL); | ||
187 | if (!table->tb_lookup(table, flp, res)) | ||
188 | return 0; | ||
189 | |||
190 | table = fib_get_table(net, RT_TABLE_MAIN); | ||
191 | if (!table->tb_lookup(table, flp, res)) | ||
192 | return 0; | ||
193 | return -ENETUNREACH; | ||
185 | } | 194 | } |
186 | 195 | ||
187 | #else /* CONFIG_IP_MULTIPLE_TABLES */ | 196 | #else /* CONFIG_IP_MULTIPLE_TABLES */ |
188 | extern void __init fib4_rules_init(void); | 197 | extern int __net_init fib4_rules_init(struct net *net); |
198 | extern void __net_exit fib4_rules_exit(struct net *net); | ||
189 | 199 | ||
190 | #ifdef CONFIG_NET_CLS_ROUTE | 200 | #ifdef CONFIG_NET_CLS_ROUTE |
191 | extern u32 fib_rules_tclass(struct fib_result *res); | 201 | extern u32 fib_rules_tclass(struct fib_result *res); |
192 | #endif | 202 | #endif |
193 | 203 | ||
194 | #define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) | 204 | extern int fib_lookup(struct net *n, struct flowi *flp, struct fib_result *res); |
195 | #define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) | ||
196 | |||
197 | extern int fib_lookup(struct flowi *flp, struct fib_result *res); | ||
198 | 205 | ||
199 | extern struct fib_table *fib_new_table(u32 id); | 206 | extern struct fib_table *fib_new_table(struct net *net, u32 id); |
200 | extern struct fib_table *fib_get_table(u32 id); | 207 | extern struct fib_table *fib_get_table(struct net *net, u32 id); |
201 | extern void fib_select_default(const struct flowi *flp, struct fib_result *res); | ||
202 | 208 | ||
203 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ | 209 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ |
204 | 210 | ||
@@ -207,18 +213,19 @@ extern const struct nla_policy rtm_ipv4_policy[]; | |||
207 | extern void ip_fib_init(void); | 213 | extern void ip_fib_init(void); |
208 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | 214 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, |
209 | struct net_device *dev, __be32 *spec_dst, u32 *itag); | 215 | struct net_device *dev, __be32 *spec_dst, u32 *itag); |
210 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); | 216 | extern void fib_select_default(struct net *net, const struct flowi *flp, |
211 | 217 | struct fib_result *res); | |
212 | struct rtentry; | ||
213 | 218 | ||
214 | /* Exported by fib_semantics.c */ | 219 | /* Exported by fib_semantics.c */ |
215 | extern int ip_fib_check_default(__be32 gw, struct net_device *dev); | 220 | extern int ip_fib_check_default(__be32 gw, struct net_device *dev); |
216 | extern int fib_sync_down(__be32 local, struct net_device *dev, int force); | 221 | extern int fib_sync_down(__be32 local, struct net_device *dev, int force); |
217 | extern int fib_sync_up(struct net_device *dev); | 222 | extern int fib_sync_up(struct net_device *dev); |
218 | extern __be32 __fib_res_prefsrc(struct fib_result *res); | 223 | extern __be32 __fib_res_prefsrc(struct fib_result *res); |
224 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); | ||
219 | 225 | ||
220 | /* Exported by fib_hash.c */ | 226 | /* Exported by fib_{hash|trie}.c */ |
221 | extern struct fib_table *fib_hash_init(u32 id); | 227 | extern void fib_hash_init(void); |
228 | extern struct fib_table *fib_hash_table(u32 id); | ||
222 | 229 | ||
223 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) | 230 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) |
224 | { | 231 | { |
@@ -255,8 +262,8 @@ static inline void fib_res_put(struct fib_result *res) | |||
255 | } | 262 | } |
256 | 263 | ||
257 | #ifdef CONFIG_PROC_FS | 264 | #ifdef CONFIG_PROC_FS |
258 | extern int fib_proc_init(void); | 265 | extern int __net_init fib_proc_init(struct net *net); |
259 | extern void fib_proc_exit(void); | 266 | extern void __net_exit fib_proc_exit(struct net *net); |
260 | #endif | 267 | #endif |
261 | 268 | ||
262 | #endif /* _NET_FIB_H */ | 269 | #endif /* _NET_FIB_H */ |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 8a7d59be8a0d..56f3c94ae620 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #include <asm/types.h> /* For __uXX types */ | 9 | #include <asm/types.h> /* For __uXX types */ |
10 | #include <linux/types.h> /* For __beXX types in userland */ | 10 | #include <linux/types.h> /* For __beXX types in userland */ |
11 | 11 | ||
12 | #include <linux/sysctl.h> /* For ctl_path */ | ||
13 | |||
12 | #define IP_VS_VERSION_CODE 0x010201 | 14 | #define IP_VS_VERSION_CODE 0x010201 |
13 | #define NVERSION(version) \ | 15 | #define NVERSION(version) \ |
14 | (version >> 16) & 0xFF, \ | 16 | (version >> 16) & 0xFF, \ |
@@ -676,7 +678,6 @@ extern const char *ip_vs_proto_name(unsigned proto); | |||
676 | extern void ip_vs_init_hash_table(struct list_head *table, int rows); | 678 | extern void ip_vs_init_hash_table(struct list_head *table, int rows); |
677 | #define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table(t, sizeof(t)/sizeof(t[0])) | 679 | #define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table(t, sizeof(t)/sizeof(t[0])) |
678 | 680 | ||
679 | #define IP_VS_APP_TYPE_UNSPEC 0 | ||
680 | #define IP_VS_APP_TYPE_FTP 1 | 681 | #define IP_VS_APP_TYPE_FTP 1 |
681 | 682 | ||
682 | /* | 683 | /* |
@@ -735,7 +736,6 @@ extern const char * ip_vs_state_name(__u16 proto, int state); | |||
735 | 736 | ||
736 | extern void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp); | 737 | extern void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp); |
737 | extern int ip_vs_check_template(struct ip_vs_conn *ct); | 738 | extern int ip_vs_check_template(struct ip_vs_conn *ct); |
738 | extern void ip_vs_secure_tcp_set(int on); | ||
739 | extern void ip_vs_random_dropentry(void); | 739 | extern void ip_vs_random_dropentry(void); |
740 | extern int ip_vs_conn_init(void); | 740 | extern int ip_vs_conn_init(void); |
741 | extern void ip_vs_conn_cleanup(void); | 741 | extern void ip_vs_conn_cleanup(void); |
@@ -856,6 +856,7 @@ extern int sysctl_ip_vs_expire_quiescent_template; | |||
856 | extern int sysctl_ip_vs_sync_threshold[2]; | 856 | extern int sysctl_ip_vs_sync_threshold[2]; |
857 | extern int sysctl_ip_vs_nat_icmp_send; | 857 | extern int sysctl_ip_vs_nat_icmp_send; |
858 | extern struct ip_vs_stats ip_vs_stats; | 858 | extern struct ip_vs_stats ip_vs_stats; |
859 | extern struct ctl_path net_vs_ctl_path[]; | ||
859 | 860 | ||
860 | extern struct ip_vs_service * | 861 | extern struct ip_vs_service * |
861 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); | 862 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); |
diff --git a/include/net/ipip.h b/include/net/ipip.h index 7cdc914322f0..549e132bca9c 100644 --- a/include/net/ipip.h +++ b/include/net/ipip.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __NET_IPIP_H 1 | 2 | #define __NET_IPIP_H 1 |
3 | 3 | ||
4 | #include <linux/if_tunnel.h> | 4 | #include <linux/if_tunnel.h> |
5 | #include <net/ip.h> | ||
5 | 6 | ||
6 | /* Keep error state on tunnel for 30 sec */ | 7 | /* Keep error state on tunnel for 30 sec */ |
7 | #define IPTUNNEL_ERR_TIMEO (30*HZ) | 8 | #define IPTUNNEL_ERR_TIMEO (30*HZ) |
@@ -30,11 +31,9 @@ struct ip_tunnel | |||
30 | int pkt_len = skb->len; \ | 31 | int pkt_len = skb->len; \ |
31 | \ | 32 | \ |
32 | skb->ip_summed = CHECKSUM_NONE; \ | 33 | skb->ip_summed = CHECKSUM_NONE; \ |
33 | iph->tot_len = htons(skb->len); \ | ||
34 | ip_select_ident(iph, &rt->u.dst, NULL); \ | 34 | ip_select_ident(iph, &rt->u.dst, NULL); \ |
35 | ip_send_check(iph); \ | ||
36 | \ | 35 | \ |
37 | err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev, dst_output);\ | 36 | err = ip_local_out(skb); \ |
38 | if (net_xmit_eval(err) == 0) { \ | 37 | if (net_xmit_eval(err) == 0) { \ |
39 | stats->tx_bytes += pkt_len; \ | 38 | stats->tx_bytes += pkt_len; \ |
40 | stats->tx_packets++; \ | 39 | stats->tx_packets++; \ |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index ae328b680ff2..fa80ea48639d 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -109,9 +109,10 @@ struct frag_hdr { | |||
109 | #include <net/sock.h> | 109 | #include <net/sock.h> |
110 | 110 | ||
111 | /* sysctls */ | 111 | /* sysctls */ |
112 | extern int sysctl_ipv6_bindv6only; | ||
113 | extern int sysctl_mld_max_msf; | 112 | extern int sysctl_mld_max_msf; |
114 | 113 | ||
114 | extern struct ctl_path net_ipv6_ctl_path[]; | ||
115 | |||
115 | #define _DEVINC(statname, modifier, idev, field) \ | 116 | #define _DEVINC(statname, modifier, idev, field) \ |
116 | ({ \ | 117 | ({ \ |
117 | struct inet6_dev *_idev = (idev); \ | 118 | struct inet6_dev *_idev = (idev); \ |
@@ -143,14 +144,6 @@ DECLARE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); | |||
143 | #define ICMP6_INC_STATS_BH(idev, field) _DEVINC(icmpv6, _BH, idev, field) | 144 | #define ICMP6_INC_STATS_BH(idev, field) _DEVINC(icmpv6, _BH, idev, field) |
144 | #define ICMP6_INC_STATS_USER(idev, field) _DEVINC(icmpv6, _USER, idev, field) | 145 | #define ICMP6_INC_STATS_USER(idev, field) _DEVINC(icmpv6, _USER, idev, field) |
145 | 146 | ||
146 | #define ICMP6_INC_STATS_OFFSET_BH(idev, field, offset) ({ \ | ||
147 | struct inet6_dev *_idev = idev; \ | ||
148 | __typeof__(offset) _offset = (offset); \ | ||
149 | if (likely(_idev != NULL)) \ | ||
150 | SNMP_INC_STATS_OFFSET_BH(_idev->stats.icmpv6, field, _offset); \ | ||
151 | SNMP_INC_STATS_OFFSET_BH(icmpv6_statistics, field, _offset); \ | ||
152 | }) | ||
153 | |||
154 | #define ICMP6MSGOUT_INC_STATS(idev, field) \ | 147 | #define ICMP6MSGOUT_INC_STATS(idev, field) \ |
155 | _DEVINC(icmpv6msg, , idev, field +256) | 148 | _DEVINC(icmpv6msg, , idev, field +256) |
156 | #define ICMP6MSGOUT_INC_STATS_BH(idev, field) \ | 149 | #define ICMP6MSGOUT_INC_STATS_BH(idev, field) \ |
@@ -164,15 +157,6 @@ DECLARE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); | |||
164 | #define ICMP6MSGIN_INC_STATS_USER(idev, field) \ | 157 | #define ICMP6MSGIN_INC_STATS_USER(idev, field) \ |
165 | _DEVINC(icmpv6msg, _USER, idev, field) | 158 | _DEVINC(icmpv6msg, _USER, idev, field) |
166 | 159 | ||
167 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); | ||
168 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | ||
169 | #define UDP6_INC_STATS_BH(field, is_udplite) do { \ | ||
170 | if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ | ||
171 | else SNMP_INC_STATS_BH(udp_stats_in6, field); } while(0) | ||
172 | #define UDP6_INC_STATS_USER(field, is_udplite) do { \ | ||
173 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ | ||
174 | else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) | ||
175 | |||
176 | struct ip6_ra_chain | 160 | struct ip6_ra_chain |
177 | { | 161 | { |
178 | struct ip6_ra_chain *next; | 162 | struct ip6_ra_chain *next; |
@@ -236,7 +220,7 @@ extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_spac | |||
236 | struct ipv6_txoptions * fopt); | 220 | struct ipv6_txoptions * fopt); |
237 | extern void fl6_free_socklist(struct sock *sk); | 221 | extern void fl6_free_socklist(struct sock *sk); |
238 | extern int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); | 222 | extern int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); |
239 | extern void ip6_flowlabel_init(void); | 223 | extern int ip6_flowlabel_init(void); |
240 | extern void ip6_flowlabel_cleanup(void); | 224 | extern void ip6_flowlabel_cleanup(void); |
241 | 225 | ||
242 | static inline void fl6_sock_release(struct ip6_flowlabel *fl) | 226 | static inline void fl6_sock_release(struct ip6_flowlabel *fl) |
@@ -261,8 +245,8 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, | |||
261 | 245 | ||
262 | extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); | 246 | extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); |
263 | 247 | ||
264 | int ip6_frag_nqueues(void); | 248 | int ip6_frag_nqueues(struct net *net); |
265 | int ip6_frag_mem(void); | 249 | int ip6_frag_mem(struct net *net); |
266 | 250 | ||
267 | #define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ | 251 | #define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ |
268 | 252 | ||
@@ -509,6 +493,9 @@ extern int ip6_forward(struct sk_buff *skb); | |||
509 | extern int ip6_input(struct sk_buff *skb); | 493 | extern int ip6_input(struct sk_buff *skb); |
510 | extern int ip6_mc_input(struct sk_buff *skb); | 494 | extern int ip6_mc_input(struct sk_buff *skb); |
511 | 495 | ||
496 | extern int __ip6_local_out(struct sk_buff *skb); | ||
497 | extern int ip6_local_out(struct sk_buff *skb); | ||
498 | |||
512 | /* | 499 | /* |
513 | * Extension header (options) processing | 500 | * Extension header (options) processing |
514 | */ | 501 | */ |
@@ -559,7 +546,7 @@ extern int compat_ipv6_getsockopt(struct sock *sk, | |||
559 | char __user *optval, | 546 | char __user *optval, |
560 | int __user *optlen); | 547 | int __user *optlen); |
561 | 548 | ||
562 | extern void ipv6_packet_init(void); | 549 | extern int ipv6_packet_init(void); |
563 | 550 | ||
564 | extern void ipv6_packet_cleanup(void); | 551 | extern void ipv6_packet_cleanup(void); |
565 | 552 | ||
@@ -585,9 +572,6 @@ extern int inet6_hash_connect(struct inet_timewait_death_row *death_row, | |||
585 | /* | 572 | /* |
586 | * reassembly.c | 573 | * reassembly.c |
587 | */ | 574 | */ |
588 | struct inet_frags_ctl; | ||
589 | extern struct inet_frags_ctl ip6_frags_ctl; | ||
590 | |||
591 | extern const struct proto_ops inet6_stream_ops; | 575 | extern const struct proto_ops inet6_stream_ops; |
592 | extern const struct proto_ops inet6_dgram_ops; | 576 | extern const struct proto_ops inet6_dgram_ops; |
593 | 577 | ||
@@ -602,6 +586,9 @@ extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, | |||
602 | int __user *optlen); | 586 | int __user *optlen); |
603 | 587 | ||
604 | #ifdef CONFIG_PROC_FS | 588 | #ifdef CONFIG_PROC_FS |
589 | extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net); | ||
590 | extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); | ||
591 | |||
605 | extern int ac6_proc_init(void); | 592 | extern int ac6_proc_init(void); |
606 | extern void ac6_proc_exit(void); | 593 | extern void ac6_proc_exit(void); |
607 | extern int raw6_proc_init(void); | 594 | extern int raw6_proc_init(void); |
@@ -631,10 +618,10 @@ static inline int snmp6_unregister_dev(struct inet6_dev *idev) | |||
631 | #endif | 618 | #endif |
632 | 619 | ||
633 | #ifdef CONFIG_SYSCTL | 620 | #ifdef CONFIG_SYSCTL |
634 | extern ctl_table ipv6_route_table[]; | 621 | extern ctl_table ipv6_route_table_template[]; |
635 | extern ctl_table ipv6_icmp_table[]; | 622 | extern ctl_table ipv6_icmp_table_template[]; |
636 | 623 | ||
637 | extern void ipv6_sysctl_register(void); | 624 | extern int ipv6_sysctl_register(void); |
638 | extern void ipv6_sysctl_unregister(void); | 625 | extern void ipv6_sysctl_unregister(void); |
639 | #endif | 626 | #endif |
640 | 627 | ||
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h index bca19ca7bdd4..f70e9b39ebaf 100644 --- a/include/net/irda/irda_device.h +++ b/include/net/irda/irda_device.h | |||
@@ -228,21 +228,8 @@ static inline int irda_device_txqueue_empty(const struct net_device *dev) | |||
228 | int irda_device_set_raw_mode(struct net_device* self, int status); | 228 | int irda_device_set_raw_mode(struct net_device* self, int status); |
229 | struct net_device *alloc_irdadev(int sizeof_priv); | 229 | struct net_device *alloc_irdadev(int sizeof_priv); |
230 | 230 | ||
231 | /* Dongle interface */ | ||
232 | void irda_device_unregister_dongle(struct dongle_reg *dongle); | ||
233 | int irda_device_register_dongle(struct dongle_reg *dongle); | ||
234 | dongle_t *irda_device_dongle_init(struct net_device *dev, int type); | ||
235 | int irda_device_dongle_cleanup(dongle_t *dongle); | ||
236 | |||
237 | void irda_setup_dma(int channel, dma_addr_t buffer, int count, int mode); | 231 | void irda_setup_dma(int channel, dma_addr_t buffer, int count, int mode); |
238 | 232 | ||
239 | void irda_task_delete(struct irda_task *task); | ||
240 | struct irda_task *irda_task_execute(void *instance, | ||
241 | IRDA_TASK_CALLBACK function, | ||
242 | IRDA_TASK_CALLBACK finished, | ||
243 | struct irda_task *parent, void *param); | ||
244 | void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state); | ||
245 | |||
246 | /* | 233 | /* |
247 | * Function irda_get_mtt (skb) | 234 | * Function irda_get_mtt (skb) |
248 | * | 235 | * |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 17b60391fcd6..9083bafb63ca 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -139,17 +139,54 @@ enum ieee80211_phymode { | |||
139 | }; | 139 | }; |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * struct ieee80211_ht_info - describing STA's HT capabilities | ||
143 | * | ||
144 | * This structure describes most essential parameters needed | ||
145 | * to describe 802.11n HT capabilities for an STA. | ||
146 | * | ||
147 | * @ht_supported: is HT supported by STA, 0: no, 1: yes | ||
148 | * @cap: HT capabilities map as described in 802.11n spec | ||
149 | * @ampdu_factor: Maximum A-MPDU length factor | ||
150 | * @ampdu_density: Minimum A-MPDU spacing | ||
151 | * @supp_mcs_set: Supported MCS set as described in 802.11n spec | ||
152 | */ | ||
153 | struct ieee80211_ht_info { | ||
154 | u8 ht_supported; | ||
155 | u16 cap; /* use IEEE80211_HT_CAP_ */ | ||
156 | u8 ampdu_factor; | ||
157 | u8 ampdu_density; | ||
158 | u8 supp_mcs_set[16]; | ||
159 | }; | ||
160 | |||
161 | /** | ||
162 | * struct ieee80211_ht_bss_info - describing BSS's HT characteristics | ||
163 | * | ||
164 | * This structure describes most essential parameters needed | ||
165 | * to describe 802.11n HT characteristics in a BSS | ||
166 | * | ||
167 | * @primary_channel: channel number of primery channel | ||
168 | * @bss_cap: 802.11n's general BSS capabilities (e.g. channel width) | ||
169 | * @bss_op_mode: 802.11n's BSS operation modes (e.g. HT protection) | ||
170 | */ | ||
171 | struct ieee80211_ht_bss_info { | ||
172 | u8 primary_channel; | ||
173 | u8 bss_cap; /* use IEEE80211_HT_IE_CHA_ */ | ||
174 | u8 bss_op_mode; /* use IEEE80211_HT_IE_ */ | ||
175 | }; | ||
176 | |||
177 | /** | ||
142 | * struct ieee80211_hw_mode - PHY mode definition | 178 | * struct ieee80211_hw_mode - PHY mode definition |
143 | * | 179 | * |
144 | * This structure describes the capabilities supported by the device | 180 | * This structure describes the capabilities supported by the device |
145 | * in a single PHY mode. | 181 | * in a single PHY mode. |
146 | * | 182 | * |
183 | * @list: internal | ||
184 | * @channels: pointer to array of supported channels | ||
185 | * @rates: pointer to array of supported bitrates | ||
147 | * @mode: the PHY mode for this definition | 186 | * @mode: the PHY mode for this definition |
148 | * @num_channels: number of supported channels | 187 | * @num_channels: number of supported channels |
149 | * @channels: pointer to array of supported channels | ||
150 | * @num_rates: number of supported bitrates | 188 | * @num_rates: number of supported bitrates |
151 | * @rates: pointer to array of supported bitrates | 189 | * @ht_info: PHY's 802.11n HT abilities for this mode |
152 | * @list: internal | ||
153 | */ | 190 | */ |
154 | struct ieee80211_hw_mode { | 191 | struct ieee80211_hw_mode { |
155 | struct list_head list; | 192 | struct list_head list; |
@@ -158,6 +195,7 @@ struct ieee80211_hw_mode { | |||
158 | enum ieee80211_phymode mode; | 195 | enum ieee80211_phymode mode; |
159 | int num_channels; | 196 | int num_channels; |
160 | int num_rates; | 197 | int num_rates; |
198 | struct ieee80211_ht_info ht_info; | ||
161 | }; | 199 | }; |
162 | 200 | ||
163 | /** | 201 | /** |
@@ -237,11 +275,49 @@ struct ieee80211_low_level_stats { | |||
237 | unsigned int dot11RTSSuccessCount; | 275 | unsigned int dot11RTSSuccessCount; |
238 | }; | 276 | }; |
239 | 277 | ||
278 | /** | ||
279 | * enum ieee80211_bss_change - BSS change notification flags | ||
280 | * | ||
281 | * These flags are used with the bss_info_changed() callback | ||
282 | * to indicate which BSS parameter changed. | ||
283 | * | ||
284 | * @BSS_CHANGED_ASSOC: association status changed (associated/disassociated), | ||
285 | * also implies a change in the AID. | ||
286 | * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed | ||
287 | * @BSS_CHANGED_ERP_PREAMBLE: preamble changed | ||
288 | */ | ||
289 | enum ieee80211_bss_change { | ||
290 | BSS_CHANGED_ASSOC = 1<<0, | ||
291 | BSS_CHANGED_ERP_CTS_PROT = 1<<1, | ||
292 | BSS_CHANGED_ERP_PREAMBLE = 1<<2, | ||
293 | }; | ||
294 | |||
295 | /** | ||
296 | * struct ieee80211_bss_conf - holds the BSS's changing parameters | ||
297 | * | ||
298 | * This structure keeps information about a BSS (and an association | ||
299 | * to that BSS) that can change during the lifetime of the BSS. | ||
300 | * | ||
301 | * @assoc: association status | ||
302 | * @aid: association ID number, valid only when @assoc is true | ||
303 | * @use_cts_prot: use CTS protection | ||
304 | * @use_short_preamble: use 802.11b short preamble | ||
305 | */ | ||
306 | struct ieee80211_bss_conf { | ||
307 | /* association related data */ | ||
308 | bool assoc; | ||
309 | u16 aid; | ||
310 | /* erp related data */ | ||
311 | bool use_cts_prot; | ||
312 | bool use_short_preamble; | ||
313 | }; | ||
314 | |||
240 | /* Transmit control fields. This data structure is passed to low-level driver | 315 | /* Transmit control fields. This data structure is passed to low-level driver |
241 | * with each TX frame. The low-level driver is responsible for configuring | 316 | * with each TX frame. The low-level driver is responsible for configuring |
242 | * the hardware to use given values (depending on what is supported). */ | 317 | * the hardware to use given values (depending on what is supported). */ |
243 | 318 | ||
244 | struct ieee80211_tx_control { | 319 | struct ieee80211_tx_control { |
320 | struct ieee80211_vif *vif; | ||
245 | int tx_rate; /* Transmit rate, given as the hw specific value for the | 321 | int tx_rate; /* Transmit rate, given as the hw specific value for the |
246 | * rate (from struct ieee80211_rate) */ | 322 | * rate (from struct ieee80211_rate) */ |
247 | int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw | 323 | int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw |
@@ -269,6 +345,9 @@ struct ieee80211_tx_control { | |||
269 | * using the through | 345 | * using the through |
270 | * set_retry_limit configured | 346 | * set_retry_limit configured |
271 | * long retry value */ | 347 | * long retry value */ |
348 | #define IEEE80211_TXCTL_EAPOL_FRAME (1<<11) /* internal to mac80211 */ | ||
349 | #define IEEE80211_TXCTL_SEND_AFTER_DTIM (1<<12) /* send this frame after DTIM | ||
350 | * beacon */ | ||
272 | u32 flags; /* tx control flags defined | 351 | u32 flags; /* tx control flags defined |
273 | * above */ | 352 | * above */ |
274 | u8 key_idx; /* keyidx from hw->set_key(), undefined if | 353 | u8 key_idx; /* keyidx from hw->set_key(), undefined if |
@@ -291,7 +370,6 @@ struct ieee80211_tx_control { | |||
291 | * packet dropping when probing higher rates, if hw | 370 | * packet dropping when probing higher rates, if hw |
292 | * supports multiple retry rates. -1 = not used */ | 371 | * supports multiple retry rates. -1 = not used */ |
293 | int type; /* internal */ | 372 | int type; /* internal */ |
294 | int ifindex; /* internal */ | ||
295 | }; | 373 | }; |
296 | 374 | ||
297 | 375 | ||
@@ -312,6 +390,8 @@ struct ieee80211_tx_control { | |||
312 | * the frame. | 390 | * the frame. |
313 | * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on | 391 | * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on |
314 | * the frame. | 392 | * the frame. |
393 | * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field) | ||
394 | * is valid. | ||
315 | */ | 395 | */ |
316 | enum mac80211_rx_flags { | 396 | enum mac80211_rx_flags { |
317 | RX_FLAG_MMIC_ERROR = 1<<0, | 397 | RX_FLAG_MMIC_ERROR = 1<<0, |
@@ -321,6 +401,7 @@ enum mac80211_rx_flags { | |||
321 | RX_FLAG_IV_STRIPPED = 1<<4, | 401 | RX_FLAG_IV_STRIPPED = 1<<4, |
322 | RX_FLAG_FAILED_FCS_CRC = 1<<5, | 402 | RX_FLAG_FAILED_FCS_CRC = 1<<5, |
323 | RX_FLAG_FAILED_PLCP_CRC = 1<<6, | 403 | RX_FLAG_FAILED_PLCP_CRC = 1<<6, |
404 | RX_FLAG_TSFT = 1<<7, | ||
324 | }; | 405 | }; |
325 | 406 | ||
326 | /** | 407 | /** |
@@ -406,11 +487,12 @@ struct ieee80211_tx_status { | |||
406 | * | 487 | * |
407 | * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time | 488 | * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time |
408 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) | 489 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) |
409 | * | 490 | * @IEEE80211_CONF_SUPPORT_HT_MODE: use 802.11n HT capabilities (if supported) |
410 | */ | 491 | */ |
411 | enum ieee80211_conf_flags { | 492 | enum ieee80211_conf_flags { |
412 | IEEE80211_CONF_SHORT_SLOT_TIME = 1<<0, | 493 | IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), |
413 | IEEE80211_CONF_RADIOTAP = 1<<1, | 494 | IEEE80211_CONF_RADIOTAP = (1<<1), |
495 | IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), | ||
414 | }; | 496 | }; |
415 | 497 | ||
416 | /** | 498 | /** |
@@ -434,6 +516,8 @@ enum ieee80211_conf_flags { | |||
434 | * @antenna_sel_tx: transmit antenna selection, 0: default/diversity, | 516 | * @antenna_sel_tx: transmit antenna selection, 0: default/diversity, |
435 | * 1/2: antenna 0/1 | 517 | * 1/2: antenna 0/1 |
436 | * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx | 518 | * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx |
519 | * @ht_conf: describes current self configuration of 802.11n HT capabilies | ||
520 | * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters | ||
437 | */ | 521 | */ |
438 | struct ieee80211_conf { | 522 | struct ieee80211_conf { |
439 | int channel; /* IEEE 802.11 channel number */ | 523 | int channel; /* IEEE 802.11 channel number */ |
@@ -452,6 +536,9 @@ struct ieee80211_conf { | |||
452 | u8 antenna_max; | 536 | u8 antenna_max; |
453 | u8 antenna_sel_tx; | 537 | u8 antenna_sel_tx; |
454 | u8 antenna_sel_rx; | 538 | u8 antenna_sel_rx; |
539 | |||
540 | struct ieee80211_ht_info ht_conf; | ||
541 | struct ieee80211_ht_bss_info ht_bss_conf; | ||
455 | }; | 542 | }; |
456 | 543 | ||
457 | /** | 544 | /** |
@@ -480,13 +567,27 @@ enum ieee80211_if_types { | |||
480 | }; | 567 | }; |
481 | 568 | ||
482 | /** | 569 | /** |
570 | * struct ieee80211_vif - per-interface data | ||
571 | * | ||
572 | * Data in this structure is continually present for driver | ||
573 | * use during the life of a virtual interface. | ||
574 | * | ||
575 | * @type: type of this virtual interface | ||
576 | * @drv_priv: data area for driver use, will always be aligned to | ||
577 | * sizeof(void *). | ||
578 | */ | ||
579 | struct ieee80211_vif { | ||
580 | enum ieee80211_if_types type; | ||
581 | /* must be last */ | ||
582 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | ||
583 | }; | ||
584 | |||
585 | /** | ||
483 | * struct ieee80211_if_init_conf - initial configuration of an interface | 586 | * struct ieee80211_if_init_conf - initial configuration of an interface |
484 | * | 587 | * |
485 | * @if_id: internal interface ID. This number has no particular meaning to | 588 | * @vif: pointer to a driver-use per-interface structure. The pointer |
486 | * drivers and the only allowed usage is to pass it to | 589 | * itself is also used for various functions including |
487 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc() functions. | 590 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). |
488 | * This field is not valid for monitor interfaces | ||
489 | * (interfaces of %IEEE80211_IF_TYPE_MNTR type). | ||
490 | * @type: one of &enum ieee80211_if_types constants. Determines the type of | 591 | * @type: one of &enum ieee80211_if_types constants. Determines the type of |
491 | * added/removed interface. | 592 | * added/removed interface. |
492 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid | 593 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid |
@@ -503,8 +604,8 @@ enum ieee80211_if_types { | |||
503 | * in pure monitor mode. | 604 | * in pure monitor mode. |
504 | */ | 605 | */ |
505 | struct ieee80211_if_init_conf { | 606 | struct ieee80211_if_init_conf { |
506 | int if_id; | ||
507 | enum ieee80211_if_types type; | 607 | enum ieee80211_if_types type; |
608 | struct ieee80211_vif *vif; | ||
508 | void *mac_addr; | 609 | void *mac_addr; |
509 | }; | 610 | }; |
510 | 611 | ||
@@ -597,9 +698,6 @@ struct ieee80211_key_conf { | |||
597 | u8 key[0]; | 698 | u8 key[0]; |
598 | }; | 699 | }; |
599 | 700 | ||
600 | #define IEEE80211_SEQ_COUNTER_RX 0 | ||
601 | #define IEEE80211_SEQ_COUNTER_TX 1 | ||
602 | |||
603 | /** | 701 | /** |
604 | * enum set_key_cmd - key command | 702 | * enum set_key_cmd - key command |
605 | * | 703 | * |
@@ -710,6 +808,9 @@ enum ieee80211_hw_flags { | |||
710 | * @rate_control_algorithm: rate control algorithm for this hardware. | 808 | * @rate_control_algorithm: rate control algorithm for this hardware. |
711 | * If unset (NULL), the default algorithm will be used. Must be | 809 | * If unset (NULL), the default algorithm will be used. Must be |
712 | * set before calling ieee80211_register_hw(). | 810 | * set before calling ieee80211_register_hw(). |
811 | * | ||
812 | * @vif_data_size: size (in bytes) of the drv_priv data area | ||
813 | * within &struct ieee80211_vif. | ||
713 | */ | 814 | */ |
714 | struct ieee80211_hw { | 815 | struct ieee80211_hw { |
715 | struct ieee80211_conf conf; | 816 | struct ieee80211_conf conf; |
@@ -720,6 +821,7 @@ struct ieee80211_hw { | |||
720 | u32 flags; | 821 | u32 flags; |
721 | unsigned int extra_tx_headroom; | 822 | unsigned int extra_tx_headroom; |
722 | int channel_change_time; | 823 | int channel_change_time; |
824 | int vif_data_size; | ||
723 | u8 queues; | 825 | u8 queues; |
724 | s8 max_rssi; | 826 | s8 max_rssi; |
725 | s8 max_signal; | 827 | s8 max_signal; |
@@ -859,19 +961,18 @@ enum ieee80211_filter_flags { | |||
859 | }; | 961 | }; |
860 | 962 | ||
861 | /** | 963 | /** |
862 | * enum ieee80211_erp_change_flags - erp change flags | 964 | * enum ieee80211_ampdu_mlme_action - A-MPDU actions |
863 | * | 965 | * |
864 | * These flags are used with the erp_ie_changed() callback in | 966 | * These flags are used with the ampdu_action() callback in |
865 | * &struct ieee80211_ops to indicate which parameter(s) changed. | 967 | * &struct ieee80211_ops to indicate which action is needed. |
866 | * @IEEE80211_ERP_CHANGE_PROTECTION: protection changed | 968 | * @IEEE80211_AMPDU_RX_START: start Rx aggregation |
867 | * @IEEE80211_ERP_CHANGE_PREAMBLE: barker preamble mode changed | 969 | * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation |
868 | */ | 970 | */ |
869 | enum ieee80211_erp_change_flags { | 971 | enum ieee80211_ampdu_mlme_action { |
870 | IEEE80211_ERP_CHANGE_PROTECTION = 1<<0, | 972 | IEEE80211_AMPDU_RX_START, |
871 | IEEE80211_ERP_CHANGE_PREAMBLE = 1<<1, | 973 | IEEE80211_AMPDU_RX_STOP, |
872 | }; | 974 | }; |
873 | 975 | ||
874 | |||
875 | /** | 976 | /** |
876 | * struct ieee80211_ops - callbacks from mac80211 to the driver | 977 | * struct ieee80211_ops - callbacks from mac80211 to the driver |
877 | * | 978 | * |
@@ -927,6 +1028,14 @@ enum ieee80211_erp_change_flags { | |||
927 | * @config_interface: Handler for configuration requests related to interfaces | 1028 | * @config_interface: Handler for configuration requests related to interfaces |
928 | * (e.g. BSSID changes.) | 1029 | * (e.g. BSSID changes.) |
929 | * | 1030 | * |
1031 | * @bss_info_changed: Handler for configuration requests related to BSS | ||
1032 | * parameters that may vary during BSS's lifespan, and may affect low | ||
1033 | * level driver (e.g. assoc/disassoc status, erp parameters). | ||
1034 | * This function should not be used if no BSS has been set, unless | ||
1035 | * for association indication. The @changed parameter indicates which | ||
1036 | * of the bss parameters has changed when a call is made. This callback | ||
1037 | * has to be atomic. | ||
1038 | * | ||
930 | * @configure_filter: Configure the device's RX filter. | 1039 | * @configure_filter: Configure the device's RX filter. |
931 | * See the section "Frame filtering" for more information. | 1040 | * See the section "Frame filtering" for more information. |
932 | * This callback must be implemented and atomic. | 1041 | * This callback must be implemented and atomic. |
@@ -946,9 +1055,9 @@ enum ieee80211_erp_change_flags { | |||
946 | * | 1055 | * |
947 | * @get_stats: return low-level statistics | 1056 | * @get_stats: return low-level statistics |
948 | * | 1057 | * |
949 | * @get_sequence_counter: For devices that have internal sequence counters this | 1058 | * @get_tkip_seq: If your device implements TKIP encryption in hardware this |
950 | * callback allows mac80211 to access the current value of a counter. | 1059 | * callback should be provided to read the TKIP transmit IVs (both IV32 |
951 | * This callback seems not well-defined, tell us if you need it. | 1060 | * and IV16) for the given key from hardware. |
952 | * | 1061 | * |
953 | * @set_rts_threshold: Configuration of RTS threshold (if device needs it) | 1062 | * @set_rts_threshold: Configuration of RTS threshold (if device needs it) |
954 | * | 1063 | * |
@@ -961,8 +1070,6 @@ enum ieee80211_erp_change_flags { | |||
961 | * @sta_notify: Notifies low level driver about addition or removal | 1070 | * @sta_notify: Notifies low level driver about addition or removal |
962 | * of assocaited station or AP. | 1071 | * of assocaited station or AP. |
963 | * | 1072 | * |
964 | * @erp_ie_changed: Handle ERP IE change notifications. Must be atomic. | ||
965 | * | ||
966 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | 1073 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), |
967 | * bursting) for a hardware TX queue. The @queue parameter uses the | 1074 | * bursting) for a hardware TX queue. The @queue parameter uses the |
968 | * %IEEE80211_TX_QUEUE_* constants. Must be atomic. | 1075 | * %IEEE80211_TX_QUEUE_* constants. Must be atomic. |
@@ -997,6 +1104,14 @@ enum ieee80211_erp_change_flags { | |||
997 | * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. | 1104 | * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. |
998 | * This is needed only for IBSS mode and the result of this function is | 1105 | * This is needed only for IBSS mode and the result of this function is |
999 | * used to determine whether to reply to Probe Requests. | 1106 | * used to determine whether to reply to Probe Requests. |
1107 | * | ||
1108 | * @conf_ht: Configures low level driver with 802.11n HT data. Must be atomic. | ||
1109 | * | ||
1110 | * @ampdu_action: Perform a certain A-MPDU action | ||
1111 | * The RA/TID combination determines the destination and TID we want | ||
1112 | * the ampdu action to be performed for. The action is defined through | ||
1113 | * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) | ||
1114 | * is the first frame we expect to perform the action on. | ||
1000 | */ | 1115 | */ |
1001 | struct ieee80211_ops { | 1116 | struct ieee80211_ops { |
1002 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, | 1117 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, |
@@ -1009,7 +1124,12 @@ struct ieee80211_ops { | |||
1009 | struct ieee80211_if_init_conf *conf); | 1124 | struct ieee80211_if_init_conf *conf); |
1010 | int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | 1125 | int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); |
1011 | int (*config_interface)(struct ieee80211_hw *hw, | 1126 | int (*config_interface)(struct ieee80211_hw *hw, |
1012 | int if_id, struct ieee80211_if_conf *conf); | 1127 | struct ieee80211_vif *vif, |
1128 | struct ieee80211_if_conf *conf); | ||
1129 | void (*bss_info_changed)(struct ieee80211_hw *hw, | ||
1130 | struct ieee80211_vif *vif, | ||
1131 | struct ieee80211_bss_conf *info, | ||
1132 | u32 changed); | ||
1013 | void (*configure_filter)(struct ieee80211_hw *hw, | 1133 | void (*configure_filter)(struct ieee80211_hw *hw, |
1014 | unsigned int changed_flags, | 1134 | unsigned int changed_flags, |
1015 | unsigned int *total_flags, | 1135 | unsigned int *total_flags, |
@@ -1021,17 +1141,14 @@ struct ieee80211_ops { | |||
1021 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); | 1141 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); |
1022 | int (*get_stats)(struct ieee80211_hw *hw, | 1142 | int (*get_stats)(struct ieee80211_hw *hw, |
1023 | struct ieee80211_low_level_stats *stats); | 1143 | struct ieee80211_low_level_stats *stats); |
1024 | int (*get_sequence_counter)(struct ieee80211_hw *hw, | 1144 | void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, |
1025 | u8* addr, u8 keyidx, u8 txrx, | 1145 | u32 *iv32, u16 *iv16); |
1026 | u32* iv32, u16* iv16); | ||
1027 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); | 1146 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); |
1028 | int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); | 1147 | int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); |
1029 | int (*set_retry_limit)(struct ieee80211_hw *hw, | 1148 | int (*set_retry_limit)(struct ieee80211_hw *hw, |
1030 | u32 short_retry, u32 long_retr); | 1149 | u32 short_retry, u32 long_retr); |
1031 | void (*sta_notify)(struct ieee80211_hw *hw, int if_id, | 1150 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1032 | enum sta_notify_cmd, const u8 *addr); | 1151 | enum sta_notify_cmd, const u8 *addr); |
1033 | void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes, | ||
1034 | int cts_protection, int preamble); | ||
1035 | int (*conf_tx)(struct ieee80211_hw *hw, int queue, | 1152 | int (*conf_tx)(struct ieee80211_hw *hw, int queue, |
1036 | const struct ieee80211_tx_queue_params *params); | 1153 | const struct ieee80211_tx_queue_params *params); |
1037 | int (*get_tx_stats)(struct ieee80211_hw *hw, | 1154 | int (*get_tx_stats)(struct ieee80211_hw *hw, |
@@ -1042,6 +1159,10 @@ struct ieee80211_ops { | |||
1042 | struct sk_buff *skb, | 1159 | struct sk_buff *skb, |
1043 | struct ieee80211_tx_control *control); | 1160 | struct ieee80211_tx_control *control); |
1044 | int (*tx_last_beacon)(struct ieee80211_hw *hw); | 1161 | int (*tx_last_beacon)(struct ieee80211_hw *hw); |
1162 | int (*conf_ht)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | ||
1163 | int (*ampdu_action)(struct ieee80211_hw *hw, | ||
1164 | enum ieee80211_ampdu_mlme_action action, | ||
1165 | const u8 *ra, u16 tid, u16 ssn); | ||
1045 | }; | 1166 | }; |
1046 | 1167 | ||
1047 | /** | 1168 | /** |
@@ -1073,6 +1194,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw); | |||
1073 | extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); | 1194 | extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); |
1074 | extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); | 1195 | extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); |
1075 | extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw); | 1196 | extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw); |
1197 | extern char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw); | ||
1076 | #endif | 1198 | #endif |
1077 | /** | 1199 | /** |
1078 | * ieee80211_get_tx_led_name - get name of TX LED | 1200 | * ieee80211_get_tx_led_name - get name of TX LED |
@@ -1112,6 +1234,16 @@ static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw) | |||
1112 | #endif | 1234 | #endif |
1113 | } | 1235 | } |
1114 | 1236 | ||
1237 | /** | ||
1238 | * ieee80211_get_assoc_led_name - get name of association LED | ||
1239 | * | ||
1240 | * mac80211 creates a association LED trigger for each wireless hardware | ||
1241 | * that can be used to drive LEDs if your driver registers a LED device. | ||
1242 | * This function returns the name (or %NULL if not configured for LEDs) | ||
1243 | * of the trigger so you can automatically link the LED device. | ||
1244 | * | ||
1245 | * @hw: the hardware to get the LED trigger name for | ||
1246 | */ | ||
1115 | static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) | 1247 | static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) |
1116 | { | 1248 | { |
1117 | #ifdef CONFIG_MAC80211_LEDS | 1249 | #ifdef CONFIG_MAC80211_LEDS |
@@ -1121,6 +1253,24 @@ static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) | |||
1121 | #endif | 1253 | #endif |
1122 | } | 1254 | } |
1123 | 1255 | ||
1256 | /** | ||
1257 | * ieee80211_get_radio_led_name - get name of radio LED | ||
1258 | * | ||
1259 | * mac80211 creates a radio change LED trigger for each wireless hardware | ||
1260 | * that can be used to drive LEDs if your driver registers a LED device. | ||
1261 | * This function returns the name (or %NULL if not configured for LEDs) | ||
1262 | * of the trigger so you can automatically link the LED device. | ||
1263 | * | ||
1264 | * @hw: the hardware to get the LED trigger name for | ||
1265 | */ | ||
1266 | static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw) | ||
1267 | { | ||
1268 | #ifdef CONFIG_MAC80211_LEDS | ||
1269 | return __ieee80211_get_radio_led_name(hw); | ||
1270 | #else | ||
1271 | return NULL; | ||
1272 | #endif | ||
1273 | } | ||
1124 | 1274 | ||
1125 | /* Register a new hardware PHYMODE capability to the stack. */ | 1275 | /* Register a new hardware PHYMODE capability to the stack. */ |
1126 | int ieee80211_register_hwmode(struct ieee80211_hw *hw, | 1276 | int ieee80211_register_hwmode(struct ieee80211_hw *hw, |
@@ -1210,7 +1360,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, | |||
1210 | /** | 1360 | /** |
1211 | * ieee80211_beacon_get - beacon generation function | 1361 | * ieee80211_beacon_get - beacon generation function |
1212 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1362 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1213 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1363 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1214 | * @control: will be filled with information needed to send this beacon. | 1364 | * @control: will be filled with information needed to send this beacon. |
1215 | * | 1365 | * |
1216 | * If the beacon frames are generated by the host system (i.e., not in | 1366 | * If the beacon frames are generated by the host system (i.e., not in |
@@ -1221,13 +1371,13 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, | |||
1221 | * is responsible of freeing it. | 1371 | * is responsible of freeing it. |
1222 | */ | 1372 | */ |
1223 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | 1373 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, |
1224 | int if_id, | 1374 | struct ieee80211_vif *vif, |
1225 | struct ieee80211_tx_control *control); | 1375 | struct ieee80211_tx_control *control); |
1226 | 1376 | ||
1227 | /** | 1377 | /** |
1228 | * ieee80211_rts_get - RTS frame generation function | 1378 | * ieee80211_rts_get - RTS frame generation function |
1229 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1379 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1230 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1380 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1231 | * @frame: pointer to the frame that is going to be protected by the RTS. | 1381 | * @frame: pointer to the frame that is going to be protected by the RTS. |
1232 | * @frame_len: the frame length (in octets). | 1382 | * @frame_len: the frame length (in octets). |
1233 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1383 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
@@ -1238,7 +1388,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1238 | * the next RTS frame from the 802.11 code. The low-level is responsible | 1388 | * the next RTS frame from the 802.11 code. The low-level is responsible |
1239 | * for calling this function before and RTS frame is needed. | 1389 | * for calling this function before and RTS frame is needed. |
1240 | */ | 1390 | */ |
1241 | void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, | 1391 | void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1242 | const void *frame, size_t frame_len, | 1392 | const void *frame, size_t frame_len, |
1243 | const struct ieee80211_tx_control *frame_txctl, | 1393 | const struct ieee80211_tx_control *frame_txctl, |
1244 | struct ieee80211_rts *rts); | 1394 | struct ieee80211_rts *rts); |
@@ -1246,7 +1396,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, | |||
1246 | /** | 1396 | /** |
1247 | * ieee80211_rts_duration - Get the duration field for an RTS frame | 1397 | * ieee80211_rts_duration - Get the duration field for an RTS frame |
1248 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1398 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1249 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1399 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1250 | * @frame_len: the length of the frame that is going to be protected by the RTS. | 1400 | * @frame_len: the length of the frame that is going to be protected by the RTS. |
1251 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1401 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
1252 | * | 1402 | * |
@@ -1254,14 +1404,14 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, | |||
1254 | * the duration field, the low-level driver uses this function to receive | 1404 | * the duration field, the low-level driver uses this function to receive |
1255 | * the duration field value in little-endian byteorder. | 1405 | * the duration field value in little-endian byteorder. |
1256 | */ | 1406 | */ |
1257 | __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, | 1407 | __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, |
1258 | size_t frame_len, | 1408 | struct ieee80211_vif *vif, size_t frame_len, |
1259 | const struct ieee80211_tx_control *frame_txctl); | 1409 | const struct ieee80211_tx_control *frame_txctl); |
1260 | 1410 | ||
1261 | /** | 1411 | /** |
1262 | * ieee80211_ctstoself_get - CTS-to-self frame generation function | 1412 | * ieee80211_ctstoself_get - CTS-to-self frame generation function |
1263 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1413 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1264 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1414 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1265 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. | 1415 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. |
1266 | * @frame_len: the frame length (in octets). | 1416 | * @frame_len: the frame length (in octets). |
1267 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1417 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
@@ -1272,7 +1422,8 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, | |||
1272 | * the next CTS-to-self frame from the 802.11 code. The low-level is responsible | 1422 | * the next CTS-to-self frame from the 802.11 code. The low-level is responsible |
1273 | * for calling this function before and CTS-to-self frame is needed. | 1423 | * for calling this function before and CTS-to-self frame is needed. |
1274 | */ | 1424 | */ |
1275 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, | 1425 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, |
1426 | struct ieee80211_vif *vif, | ||
1276 | const void *frame, size_t frame_len, | 1427 | const void *frame, size_t frame_len, |
1277 | const struct ieee80211_tx_control *frame_txctl, | 1428 | const struct ieee80211_tx_control *frame_txctl, |
1278 | struct ieee80211_cts *cts); | 1429 | struct ieee80211_cts *cts); |
@@ -1280,7 +1431,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, | |||
1280 | /** | 1431 | /** |
1281 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame | 1432 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame |
1282 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1433 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1283 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1434 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1284 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. | 1435 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. |
1285 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1436 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
1286 | * | 1437 | * |
@@ -1288,28 +1439,30 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, | |||
1288 | * the duration field, the low-level driver uses this function to receive | 1439 | * the duration field, the low-level driver uses this function to receive |
1289 | * the duration field value in little-endian byteorder. | 1440 | * the duration field value in little-endian byteorder. |
1290 | */ | 1441 | */ |
1291 | __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, | 1442 | __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, |
1443 | struct ieee80211_vif *vif, | ||
1292 | size_t frame_len, | 1444 | size_t frame_len, |
1293 | const struct ieee80211_tx_control *frame_txctl); | 1445 | const struct ieee80211_tx_control *frame_txctl); |
1294 | 1446 | ||
1295 | /** | 1447 | /** |
1296 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame | 1448 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame |
1297 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1449 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1298 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1450 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1299 | * @frame_len: the length of the frame. | 1451 | * @frame_len: the length of the frame. |
1300 | * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. | 1452 | * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. |
1301 | * | 1453 | * |
1302 | * Calculate the duration field of some generic frame, given its | 1454 | * Calculate the duration field of some generic frame, given its |
1303 | * length and transmission rate (in 100kbps). | 1455 | * length and transmission rate (in 100kbps). |
1304 | */ | 1456 | */ |
1305 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, | 1457 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, |
1458 | struct ieee80211_vif *vif, | ||
1306 | size_t frame_len, | 1459 | size_t frame_len, |
1307 | int rate); | 1460 | int rate); |
1308 | 1461 | ||
1309 | /** | 1462 | /** |
1310 | * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames | 1463 | * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames |
1311 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 1464 | * @hw: pointer as obtained from ieee80211_alloc_hw(). |
1312 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1465 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1313 | * @control: will be filled with information needed to send returned frame. | 1466 | * @control: will be filled with information needed to send returned frame. |
1314 | * | 1467 | * |
1315 | * Function for accessing buffered broadcast and multicast frames. If | 1468 | * Function for accessing buffered broadcast and multicast frames. If |
@@ -1328,7 +1481,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, | |||
1328 | * use common code for all beacons. | 1481 | * use common code for all beacons. |
1329 | */ | 1482 | */ |
1330 | struct sk_buff * | 1483 | struct sk_buff * |
1331 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, | 1484 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1332 | struct ieee80211_tx_control *control); | 1485 | struct ieee80211_tx_control *control); |
1333 | 1486 | ||
1334 | /** | 1487 | /** |
@@ -1406,4 +1559,19 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw); | |||
1406 | */ | 1559 | */ |
1407 | void ieee80211_scan_completed(struct ieee80211_hw *hw); | 1560 | void ieee80211_scan_completed(struct ieee80211_hw *hw); |
1408 | 1561 | ||
1562 | /** | ||
1563 | * ieee80211_iterate_active_interfaces - iterate active interfaces | ||
1564 | * | ||
1565 | * This function iterates over the interfaces associated with a given | ||
1566 | * hardware that are currently active and calls the callback for them. | ||
1567 | * | ||
1568 | * @hw: the hardware struct of which the interfaces should be iterated over | ||
1569 | * @iterator: the iterator function to call, cannot sleep | ||
1570 | * @data: first argument of the iterator function | ||
1571 | */ | ||
1572 | void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, | ||
1573 | void (*iterator)(void *data, u8 *mac, | ||
1574 | struct ieee80211_vif *vif), | ||
1575 | void *data); | ||
1576 | |||
1409 | #endif /* MAC80211_H */ | 1577 | #endif /* MAC80211_H */ |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index a4f26187fc1a..ebbfb509822e 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -26,6 +26,10 @@ | |||
26 | #include <linux/sysctl.h> | 26 | #include <linux/sysctl.h> |
27 | #include <net/rtnetlink.h> | 27 | #include <net/rtnetlink.h> |
28 | 28 | ||
29 | /* | ||
30 | * NUD stands for "neighbor unreachability detection" | ||
31 | */ | ||
32 | |||
29 | #define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) | 33 | #define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) |
30 | #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) | 34 | #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) |
31 | #define NUD_CONNECTED (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE) | 35 | #define NUD_CONNECTED (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE) |
@@ -34,6 +38,7 @@ struct neighbour; | |||
34 | 38 | ||
35 | struct neigh_parms | 39 | struct neigh_parms |
36 | { | 40 | { |
41 | struct net *net; | ||
37 | struct net_device *dev; | 42 | struct net_device *dev; |
38 | struct neigh_parms *next; | 43 | struct neigh_parms *next; |
39 | int (*neigh_setup)(struct neighbour *); | 44 | int (*neigh_setup)(struct neighbour *); |
@@ -126,7 +131,8 @@ struct neigh_ops | |||
126 | struct pneigh_entry | 131 | struct pneigh_entry |
127 | { | 132 | { |
128 | struct pneigh_entry *next; | 133 | struct pneigh_entry *next; |
129 | struct net_device *dev; | 134 | struct net *net; |
135 | struct net_device *dev; | ||
130 | u8 flags; | 136 | u8 flags; |
131 | u8 key[0]; | 137 | u8 key[0]; |
132 | }; | 138 | }; |
@@ -187,6 +193,7 @@ extern struct neighbour * neigh_lookup(struct neigh_table *tbl, | |||
187 | const void *pkey, | 193 | const void *pkey, |
188 | struct net_device *dev); | 194 | struct net_device *dev); |
189 | extern struct neighbour * neigh_lookup_nodev(struct neigh_table *tbl, | 195 | extern struct neighbour * neigh_lookup_nodev(struct neigh_table *tbl, |
196 | struct net *net, | ||
190 | const void *pkey); | 197 | const void *pkey); |
191 | extern struct neighbour * neigh_create(struct neigh_table *tbl, | 198 | extern struct neighbour * neigh_create(struct neigh_table *tbl, |
192 | const void *pkey, | 199 | const void *pkey, |
@@ -206,13 +213,12 @@ extern struct neighbour *neigh_event_ns(struct neigh_table *tbl, | |||
206 | 213 | ||
207 | extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); | 214 | extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); |
208 | extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); | 215 | extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); |
209 | extern void neigh_parms_destroy(struct neigh_parms *parms); | ||
210 | extern unsigned long neigh_rand_reach_time(unsigned long base); | 216 | extern unsigned long neigh_rand_reach_time(unsigned long base); |
211 | 217 | ||
212 | extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, | 218 | extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, |
213 | struct sk_buff *skb); | 219 | struct sk_buff *skb); |
214 | extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat); | 220 | extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev, int creat); |
215 | extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev); | 221 | extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev); |
216 | 222 | ||
217 | extern void neigh_app_ns(struct neighbour *n); | 223 | extern void neigh_app_ns(struct neighbour *n); |
218 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); | 224 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); |
@@ -220,6 +226,7 @@ extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct n | |||
220 | extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); | 226 | extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); |
221 | 227 | ||
222 | struct neigh_seq_state { | 228 | struct neigh_seq_state { |
229 | struct seq_net_private p; | ||
223 | struct neigh_table *tbl; | 230 | struct neigh_table *tbl; |
224 | void *(*neigh_sub_iter)(struct neigh_seq_state *state, | 231 | void *(*neigh_sub_iter)(struct neigh_seq_state *state, |
225 | struct neighbour *n, loff_t *pos); | 232 | struct neighbour *n, loff_t *pos); |
@@ -246,12 +253,6 @@ static inline void __neigh_parms_put(struct neigh_parms *parms) | |||
246 | atomic_dec(&parms->refcnt); | 253 | atomic_dec(&parms->refcnt); |
247 | } | 254 | } |
248 | 255 | ||
249 | static inline void neigh_parms_put(struct neigh_parms *parms) | ||
250 | { | ||
251 | if (atomic_dec_and_test(&parms->refcnt)) | ||
252 | neigh_parms_destroy(parms); | ||
253 | } | ||
254 | |||
255 | static inline struct neigh_parms *neigh_parms_clone(struct neigh_parms *parms) | 256 | static inline struct neigh_parms *neigh_parms_clone(struct neigh_parms *parms) |
256 | { | 257 | { |
257 | atomic_inc(&parms->refcnt); | 258 | atomic_inc(&parms->refcnt); |
@@ -288,10 +289,6 @@ static inline int neigh_is_connected(struct neighbour *neigh) | |||
288 | return neigh->nud_state&NUD_CONNECTED; | 289 | return neigh->nud_state&NUD_CONNECTED; |
289 | } | 290 | } |
290 | 291 | ||
291 | static inline int neigh_is_valid(struct neighbour *neigh) | ||
292 | { | ||
293 | return neigh->nud_state&NUD_VALID; | ||
294 | } | ||
295 | 292 | ||
296 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | 293 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) |
297 | { | 294 | { |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 5dd6d90b37eb..b8c1d60ba9e4 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -8,8 +8,16 @@ | |||
8 | #include <linux/workqueue.h> | 8 | #include <linux/workqueue.h> |
9 | #include <linux/list.h> | 9 | #include <linux/list.h> |
10 | 10 | ||
11 | #include <net/netns/unix.h> | ||
12 | #include <net/netns/packet.h> | ||
13 | #include <net/netns/ipv4.h> | ||
14 | #include <net/netns/ipv6.h> | ||
15 | |||
11 | struct proc_dir_entry; | 16 | struct proc_dir_entry; |
12 | struct net_device; | 17 | struct net_device; |
18 | struct sock; | ||
19 | struct ctl_table_header; | ||
20 | |||
13 | struct net { | 21 | struct net { |
14 | atomic_t count; /* To decided when the network | 22 | atomic_t count; /* To decided when the network |
15 | * namespace should be freed. | 23 | * namespace should be freed. |
@@ -24,11 +32,30 @@ struct net { | |||
24 | struct proc_dir_entry *proc_net_stat; | 32 | struct proc_dir_entry *proc_net_stat; |
25 | struct proc_dir_entry *proc_net_root; | 33 | struct proc_dir_entry *proc_net_root; |
26 | 34 | ||
35 | struct list_head sysctl_table_headers; | ||
36 | |||
27 | struct net_device *loopback_dev; /* The loopback */ | 37 | struct net_device *loopback_dev; /* The loopback */ |
28 | 38 | ||
29 | struct list_head dev_base_head; | 39 | struct list_head dev_base_head; |
30 | struct hlist_head *dev_name_head; | 40 | struct hlist_head *dev_name_head; |
31 | struct hlist_head *dev_index_head; | 41 | struct hlist_head *dev_index_head; |
42 | |||
43 | /* core fib_rules */ | ||
44 | struct list_head rules_ops; | ||
45 | spinlock_t rules_mod_lock; | ||
46 | |||
47 | struct sock *rtnl; /* rtnetlink socket */ | ||
48 | |||
49 | /* core sysctls */ | ||
50 | struct ctl_table_header *sysctl_core_hdr; | ||
51 | int sysctl_somaxconn; | ||
52 | |||
53 | struct netns_packet packet; | ||
54 | struct netns_unix unx; | ||
55 | struct netns_ipv4 ipv4; | ||
56 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
57 | struct netns_ipv6 ipv6; | ||
58 | #endif | ||
32 | }; | 59 | }; |
33 | 60 | ||
34 | #ifdef CONFIG_NET | 61 | #ifdef CONFIG_NET |
@@ -137,4 +164,11 @@ extern void unregister_pernet_subsys(struct pernet_operations *); | |||
137 | extern int register_pernet_device(struct pernet_operations *); | 164 | extern int register_pernet_device(struct pernet_operations *); |
138 | extern void unregister_pernet_device(struct pernet_operations *); | 165 | extern void unregister_pernet_device(struct pernet_operations *); |
139 | 166 | ||
167 | struct ctl_path; | ||
168 | struct ctl_table; | ||
169 | struct ctl_table_header; | ||
170 | extern struct ctl_table_header *register_net_sysctl_table(struct net *net, | ||
171 | const struct ctl_path *path, struct ctl_table *table); | ||
172 | extern void unregister_net_sysctl_table(struct ctl_table_header *header); | ||
173 | |||
140 | #endif /* __NET_NET_NAMESPACE_H */ | 174 | #endif /* __NET_NET_NAMESPACE_H */ |
diff --git a/include/net/netevent.h b/include/net/netevent.h index e5d216241423..e82b7bab3ff3 100644 --- a/include/net/netevent.h +++ b/include/net/netevent.h | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | #ifdef __KERNEL__ | 13 | #ifdef __KERNEL__ |
14 | 14 | ||
15 | #include <net/dst.h> | 15 | struct dst_entry; |
16 | 16 | ||
17 | struct netevent_redirect { | 17 | struct netevent_redirect { |
18 | struct dst_entry *old; | 18 | struct dst_entry *old; |
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h index f703533fb4db..abc55ad75c2b 100644 --- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h +++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h | |||
@@ -16,6 +16,8 @@ extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb, | |||
16 | int (*okfn)(struct sk_buff *)); | 16 | int (*okfn)(struct sk_buff *)); |
17 | 17 | ||
18 | struct inet_frags_ctl; | 18 | struct inet_frags_ctl; |
19 | extern struct inet_frags_ctl nf_frags_ctl; | 19 | |
20 | #include <linux/sysctl.h> | ||
21 | extern struct ctl_table nf_ct_ipv6_sysctl_table[]; | ||
20 | 22 | ||
21 | #endif /* _NF_CONNTRACK_IPV6_H*/ | 23 | #endif /* _NF_CONNTRACK_IPV6_H*/ |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 4ac5ab187c2a..857d89951790 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -223,8 +223,6 @@ extern void nf_conntrack_tcp_update(struct sk_buff *skb, | |||
223 | /* Fake conntrack entry for untracked connections */ | 223 | /* Fake conntrack entry for untracked connections */ |
224 | extern struct nf_conn nf_conntrack_untracked; | 224 | extern struct nf_conn nf_conntrack_untracked; |
225 | 225 | ||
226 | extern int nf_ct_no_defrag; | ||
227 | |||
228 | /* Iterate over all conntracks: if iter returns true, it's deleted. */ | 226 | /* Iterate over all conntracks: if iter returns true, it's deleted. */ |
229 | extern void | 227 | extern void |
230 | nf_ct_iterate_cleanup(int (*iter)(struct nf_conn *i, void *data), void *data); | 228 | nf_ct_iterate_cleanup(int (*iter)(struct nf_conn *i, void *data), void *data); |
@@ -264,10 +262,5 @@ do { \ | |||
264 | local_bh_enable(); \ | 262 | local_bh_enable(); \ |
265 | } while (0) | 263 | } while (0) |
266 | 264 | ||
267 | extern int | ||
268 | nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size); | ||
269 | extern void | ||
270 | nf_conntrack_unregister_cache(u_int32_t features); | ||
271 | |||
272 | #endif /* __KERNEL__ */ | 265 | #endif /* __KERNEL__ */ |
273 | #endif /* _NF_CONNTRACK_H */ | 266 | #endif /* _NF_CONNTRACK_H */ |
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index a532e7b5ed6a..7ad0828f05cf 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -30,16 +30,6 @@ extern void nf_conntrack_cleanup(void); | |||
30 | extern int nf_conntrack_proto_init(void); | 30 | extern int nf_conntrack_proto_init(void); |
31 | extern void nf_conntrack_proto_fini(void); | 31 | extern void nf_conntrack_proto_fini(void); |
32 | 32 | ||
33 | extern int nf_conntrack_helper_init(void); | ||
34 | extern void nf_conntrack_helper_fini(void); | ||
35 | |||
36 | struct nf_conntrack_l3proto; | ||
37 | extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); | ||
38 | /* Like above, but you already have conntrack read lock. */ | ||
39 | extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto); | ||
40 | |||
41 | struct nf_conntrack_l4proto; | ||
42 | |||
43 | extern int | 33 | extern int |
44 | nf_ct_get_tuple(const struct sk_buff *skb, | 34 | nf_ct_get_tuple(const struct sk_buff *skb, |
45 | unsigned int nhoff, | 35 | unsigned int nhoff, |
@@ -76,8 +66,6 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb) | |||
76 | return ret; | 66 | return ret; |
77 | } | 67 | } |
78 | 68 | ||
79 | extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb); | ||
80 | |||
81 | int | 69 | int |
82 | print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, | 70 | print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, |
83 | struct nf_conntrack_l3proto *l3proto, | 71 | struct nf_conntrack_l3proto *l3proto, |
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index b47c04f12dbe..6c3fd254c28e 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h | |||
@@ -73,8 +73,8 @@ void nf_ct_unexpect_related(struct nf_conntrack_expect *exp); | |||
73 | nf_ct_expect_related. You will have to call put afterwards. */ | 73 | nf_ct_expect_related. You will have to call put afterwards. */ |
74 | struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); | 74 | struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); |
75 | void nf_ct_expect_init(struct nf_conntrack_expect *, int, | 75 | void nf_ct_expect_init(struct nf_conntrack_expect *, int, |
76 | union nf_conntrack_address *, | 76 | union nf_inet_addr *, |
77 | union nf_conntrack_address *, | 77 | union nf_inet_addr *, |
78 | u_int8_t, __be16 *, __be16 *); | 78 | u_int8_t, __be16 *, __be16 *); |
79 | void nf_ct_expect_put(struct nf_conntrack_expect *exp); | 79 | void nf_ct_expect_put(struct nf_conntrack_expect *exp); |
80 | int nf_ct_expect_related(struct nf_conntrack_expect *expect); | 80 | int nf_ct_expect_related(struct nf_conntrack_expect *expect); |
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index d7b2d5483a71..2f3af00643cf 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h | |||
@@ -58,4 +58,8 @@ static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) | |||
58 | { | 58 | { |
59 | return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); | 59 | return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); |
60 | } | 60 | } |
61 | |||
62 | extern int nf_conntrack_helper_init(void); | ||
63 | extern void nf_conntrack_helper_fini(void); | ||
64 | |||
61 | #endif /*_NF_CONNTRACK_HELPER_H*/ | 65 | #endif /*_NF_CONNTRACK_HELPER_H*/ |
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index 15888fc7b72d..d5526bcce147 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
@@ -42,9 +42,6 @@ struct nf_conntrack_l3proto | |||
42 | int (*print_tuple)(struct seq_file *s, | 42 | int (*print_tuple)(struct seq_file *s, |
43 | const struct nf_conntrack_tuple *); | 43 | const struct nf_conntrack_tuple *); |
44 | 44 | ||
45 | /* Print out the private part of the conntrack. */ | ||
46 | int (*print_conntrack)(struct seq_file *s, const struct nf_conn *); | ||
47 | |||
48 | /* Returns verdict for packet, or -1 for invalid. */ | 45 | /* Returns verdict for packet, or -1 for invalid. */ |
49 | int (*packet)(struct nf_conn *conntrack, | 46 | int (*packet)(struct nf_conn *conntrack, |
50 | const struct sk_buff *skb, | 47 | const struct sk_buff *skb, |
@@ -73,7 +70,7 @@ struct nf_conntrack_l3proto | |||
73 | 70 | ||
74 | #ifdef CONFIG_SYSCTL | 71 | #ifdef CONFIG_SYSCTL |
75 | struct ctl_table_header *ctl_table_header; | 72 | struct ctl_table_header *ctl_table_header; |
76 | struct ctl_table *ctl_table_path; | 73 | struct ctl_path *ctl_table_path; |
77 | struct ctl_table *ctl_table; | 74 | struct ctl_table *ctl_table; |
78 | #endif /* CONFIG_SYSCTL */ | 75 | #endif /* CONFIG_SYSCTL */ |
79 | 76 | ||
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index c48e390f4b0f..45cb17cdcfd0 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #ifndef _NF_CONNTRACK_TUPLE_H | 10 | #ifndef _NF_CONNTRACK_TUPLE_H |
11 | #define _NF_CONNTRACK_TUPLE_H | 11 | #define _NF_CONNTRACK_TUPLE_H |
12 | 12 | ||
13 | #include <linux/netfilter/x_tables.h> | ||
13 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | 14 | #include <linux/netfilter/nf_conntrack_tuple_common.h> |
14 | 15 | ||
15 | /* A `tuple' is a structure containing the information to uniquely | 16 | /* A `tuple' is a structure containing the information to uniquely |
@@ -20,15 +21,7 @@ | |||
20 | "non-manipulatable" lines, for the benefit of the NAT code. | 21 | "non-manipulatable" lines, for the benefit of the NAT code. |
21 | */ | 22 | */ |
22 | 23 | ||
23 | #define NF_CT_TUPLE_L3SIZE 4 | 24 | #define NF_CT_TUPLE_L3SIZE ARRAY_SIZE(((union nf_inet_addr *)NULL)->all) |
24 | |||
25 | /* The l3 protocol-specific manipulable parts of the tuple: always in | ||
26 | network order! */ | ||
27 | union nf_conntrack_address { | ||
28 | u_int32_t all[NF_CT_TUPLE_L3SIZE]; | ||
29 | __be32 ip; | ||
30 | __be32 ip6[4]; | ||
31 | }; | ||
32 | 25 | ||
33 | /* The protocol-specific manipulable parts of the tuple: always in | 26 | /* The protocol-specific manipulable parts of the tuple: always in |
34 | network order! */ | 27 | network order! */ |
@@ -57,7 +50,7 @@ union nf_conntrack_man_proto | |||
57 | /* The manipulable part of the tuple. */ | 50 | /* The manipulable part of the tuple. */ |
58 | struct nf_conntrack_man | 51 | struct nf_conntrack_man |
59 | { | 52 | { |
60 | union nf_conntrack_address u3; | 53 | union nf_inet_addr u3; |
61 | union nf_conntrack_man_proto u; | 54 | union nf_conntrack_man_proto u; |
62 | /* Layer 3 protocol */ | 55 | /* Layer 3 protocol */ |
63 | u_int16_t l3num; | 56 | u_int16_t l3num; |
@@ -70,7 +63,7 @@ struct nf_conntrack_tuple | |||
70 | 63 | ||
71 | /* These are the parts of the tuple which are fixed. */ | 64 | /* These are the parts of the tuple which are fixed. */ |
72 | struct { | 65 | struct { |
73 | union nf_conntrack_address u3; | 66 | union nf_inet_addr u3; |
74 | union { | 67 | union { |
75 | /* Add other protocols here. */ | 68 | /* Add other protocols here. */ |
76 | __be16 all; | 69 | __be16 all; |
@@ -103,7 +96,7 @@ struct nf_conntrack_tuple | |||
103 | struct nf_conntrack_tuple_mask | 96 | struct nf_conntrack_tuple_mask |
104 | { | 97 | { |
105 | struct { | 98 | struct { |
106 | union nf_conntrack_address u3; | 99 | union nf_inet_addr u3; |
107 | union nf_conntrack_man_proto u; | 100 | union nf_conntrack_man_proto u; |
108 | } src; | 101 | } src; |
109 | }; | 102 | }; |
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h new file mode 100644 index 000000000000..037e82403f91 --- /dev/null +++ b/include/net/netfilter/nf_log.h | |||
@@ -0,0 +1,59 @@ | |||
1 | #ifndef _NF_LOG_H | ||
2 | #define _NF_LOG_H | ||
3 | |||
4 | /* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will | ||
5 | * disappear once iptables is replaced with pkttables. Please DO NOT use them | ||
6 | * for any new code! */ | ||
7 | #define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | ||
8 | #define NF_LOG_TCPOPT 0x02 /* Log TCP options */ | ||
9 | #define NF_LOG_IPOPT 0x04 /* Log IP options */ | ||
10 | #define NF_LOG_UID 0x08 /* Log UID owning local socket */ | ||
11 | #define NF_LOG_MASK 0x0f | ||
12 | |||
13 | #define NF_LOG_TYPE_LOG 0x01 | ||
14 | #define NF_LOG_TYPE_ULOG 0x02 | ||
15 | |||
16 | struct nf_loginfo { | ||
17 | u_int8_t type; | ||
18 | union { | ||
19 | struct { | ||
20 | u_int32_t copy_len; | ||
21 | u_int16_t group; | ||
22 | u_int16_t qthreshold; | ||
23 | } ulog; | ||
24 | struct { | ||
25 | u_int8_t level; | ||
26 | u_int8_t logflags; | ||
27 | } log; | ||
28 | } u; | ||
29 | }; | ||
30 | |||
31 | typedef void nf_logfn(unsigned int pf, | ||
32 | unsigned int hooknum, | ||
33 | const struct sk_buff *skb, | ||
34 | const struct net_device *in, | ||
35 | const struct net_device *out, | ||
36 | const struct nf_loginfo *li, | ||
37 | const char *prefix); | ||
38 | |||
39 | struct nf_logger { | ||
40 | struct module *me; | ||
41 | nf_logfn *logfn; | ||
42 | char *name; | ||
43 | }; | ||
44 | |||
45 | /* Function to register/unregister log function. */ | ||
46 | int nf_log_register(int pf, const struct nf_logger *logger); | ||
47 | void nf_log_unregister(const struct nf_logger *logger); | ||
48 | void nf_log_unregister_pf(int pf); | ||
49 | |||
50 | /* Calls the registered backend logging function */ | ||
51 | void nf_log_packet(int pf, | ||
52 | unsigned int hooknum, | ||
53 | const struct sk_buff *skb, | ||
54 | const struct net_device *in, | ||
55 | const struct net_device *out, | ||
56 | const struct nf_loginfo *li, | ||
57 | const char *fmt, ...); | ||
58 | |||
59 | #endif /* _NF_LOG_H */ | ||
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h index 6ae52f7c9f55..9dc1039ff78b 100644 --- a/include/net/netfilter/nf_nat.h +++ b/include/net/netfilter/nf_nat.h | |||
@@ -12,7 +12,8 @@ enum nf_nat_manip_type | |||
12 | }; | 12 | }; |
13 | 13 | ||
14 | /* SRC manip occurs POST_ROUTING or LOCAL_IN */ | 14 | /* SRC manip occurs POST_ROUTING or LOCAL_IN */ |
15 | #define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING && (hooknum) != NF_IP_LOCAL_IN) | 15 | #define HOOK2MANIP(hooknum) ((hooknum) != NF_INET_POST_ROUTING && \ |
16 | (hooknum) != NF_INET_LOCAL_IN) | ||
16 | 17 | ||
17 | #define IP_NAT_RANGE_MAP_IPS 1 | 18 | #define IP_NAT_RANGE_MAP_IPS 1 |
18 | #define IP_NAT_RANGE_PROTO_SPECIFIED 2 | 19 | #define IP_NAT_RANGE_PROTO_SPECIFIED 2 |
@@ -79,7 +80,7 @@ struct nf_conn_nat | |||
79 | /* Set up the info structure to map into this range. */ | 80 | /* Set up the info structure to map into this range. */ |
80 | extern unsigned int nf_nat_setup_info(struct nf_conn *ct, | 81 | extern unsigned int nf_nat_setup_info(struct nf_conn *ct, |
81 | const struct nf_nat_range *range, | 82 | const struct nf_nat_range *range, |
82 | unsigned int hooknum); | 83 | enum nf_nat_manip_type maniptype); |
83 | 84 | ||
84 | /* Is this tuple already taken? (not by us)*/ | 85 | /* Is this tuple already taken? (not by us)*/ |
85 | extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, | 86 | extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, |
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h index 04578bfe23e1..4aa0edbb5b96 100644 --- a/include/net/netfilter/nf_nat_protocol.h +++ b/include/net/netfilter/nf_nat_protocol.h | |||
@@ -46,21 +46,21 @@ struct nf_nat_protocol | |||
46 | }; | 46 | }; |
47 | 47 | ||
48 | /* Protocol registration. */ | 48 | /* Protocol registration. */ |
49 | extern int nf_nat_protocol_register(struct nf_nat_protocol *proto); | 49 | extern int nf_nat_protocol_register(const struct nf_nat_protocol *proto); |
50 | extern void nf_nat_protocol_unregister(struct nf_nat_protocol *proto); | 50 | extern void nf_nat_protocol_unregister(const struct nf_nat_protocol *proto); |
51 | 51 | ||
52 | extern struct nf_nat_protocol *nf_nat_proto_find_get(u_int8_t protocol); | 52 | extern const struct nf_nat_protocol *nf_nat_proto_find_get(u_int8_t protocol); |
53 | extern void nf_nat_proto_put(struct nf_nat_protocol *proto); | 53 | extern void nf_nat_proto_put(const struct nf_nat_protocol *proto); |
54 | 54 | ||
55 | /* Built-in protocols. */ | 55 | /* Built-in protocols. */ |
56 | extern struct nf_nat_protocol nf_nat_protocol_tcp; | 56 | extern const struct nf_nat_protocol nf_nat_protocol_tcp; |
57 | extern struct nf_nat_protocol nf_nat_protocol_udp; | 57 | extern const struct nf_nat_protocol nf_nat_protocol_udp; |
58 | extern struct nf_nat_protocol nf_nat_protocol_icmp; | 58 | extern const struct nf_nat_protocol nf_nat_protocol_icmp; |
59 | extern struct nf_nat_protocol nf_nat_unknown_protocol; | 59 | extern const struct nf_nat_protocol nf_nat_unknown_protocol; |
60 | 60 | ||
61 | extern int init_protocols(void) __init; | 61 | extern int init_protocols(void) __init; |
62 | extern void cleanup_protocols(void); | 62 | extern void cleanup_protocols(void); |
63 | extern struct nf_nat_protocol *find_nat_proto(u_int16_t protonum); | 63 | extern const struct nf_nat_protocol *find_nat_proto(u_int16_t protonum); |
64 | 64 | ||
65 | extern int nf_nat_port_range_to_nlattr(struct sk_buff *skb, | 65 | extern int nf_nat_port_range_to_nlattr(struct sk_buff *skb, |
66 | const struct nf_nat_range *range); | 66 | const struct nf_nat_range *range); |
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h new file mode 100644 index 000000000000..d030044e9235 --- /dev/null +++ b/include/net/netfilter/nf_queue.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef _NF_QUEUE_H | ||
2 | #define _NF_QUEUE_H | ||
3 | |||
4 | /* Each queued (to userspace) skbuff has one of these. */ | ||
5 | struct nf_queue_entry { | ||
6 | struct list_head list; | ||
7 | struct sk_buff *skb; | ||
8 | unsigned int id; | ||
9 | |||
10 | struct nf_hook_ops *elem; | ||
11 | int pf; | ||
12 | unsigned int hook; | ||
13 | struct net_device *indev; | ||
14 | struct net_device *outdev; | ||
15 | int (*okfn)(struct sk_buff *); | ||
16 | }; | ||
17 | |||
18 | #define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry)) | ||
19 | |||
20 | /* Packet queuing */ | ||
21 | struct nf_queue_handler { | ||
22 | int (*outfn)(struct nf_queue_entry *entry, | ||
23 | unsigned int queuenum); | ||
24 | char *name; | ||
25 | }; | ||
26 | |||
27 | extern int nf_register_queue_handler(int pf, | ||
28 | const struct nf_queue_handler *qh); | ||
29 | extern int nf_unregister_queue_handler(int pf, | ||
30 | const struct nf_queue_handler *qh); | ||
31 | extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh); | ||
32 | extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); | ||
33 | |||
34 | #endif /* _NF_QUEUE_H */ | ||
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h new file mode 100644 index 000000000000..65d594dffbff --- /dev/null +++ b/include/net/netfilter/xt_rateest.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _XT_RATEEST_H | ||
2 | #define _XT_RATEEST_H | ||
3 | |||
4 | struct xt_rateest { | ||
5 | struct hlist_node list; | ||
6 | char name[IFNAMSIZ]; | ||
7 | unsigned int refcnt; | ||
8 | spinlock_t lock; | ||
9 | struct gnet_estimator params; | ||
10 | struct gnet_stats_rate_est rstats; | ||
11 | struct gnet_stats_basic bstats; | ||
12 | }; | ||
13 | |||
14 | extern struct xt_rateest *xt_rateest_lookup(const char *name); | ||
15 | extern void xt_rateest_put(struct xt_rateest *est); | ||
16 | |||
17 | #endif /* _XT_RATEEST_H */ | ||
diff --git a/include/net/netlink.h b/include/net/netlink.h index 9298218c07f9..a5506c42f03c 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -91,6 +91,7 @@ | |||
91 | * nla_reserve_nohdr(skb, len) reserve room for an attribute w/o hdr | 91 | * nla_reserve_nohdr(skb, len) reserve room for an attribute w/o hdr |
92 | * nla_put(skb, type, len, data) add attribute to skb | 92 | * nla_put(skb, type, len, data) add attribute to skb |
93 | * nla_put_nohdr(skb, len, data) add attribute w/o hdr | 93 | * nla_put_nohdr(skb, len, data) add attribute w/o hdr |
94 | * nla_append(skb, len, data) append data to skb | ||
94 | * | 95 | * |
95 | * Attribute Construction for Basic Types: | 96 | * Attribute Construction for Basic Types: |
96 | * nla_put_u8(skb, type, value) add u8 attribute to skb | 97 | * nla_put_u8(skb, type, value) add u8 attribute to skb |
@@ -217,6 +218,7 @@ struct nla_policy { | |||
217 | */ | 218 | */ |
218 | struct nl_info { | 219 | struct nl_info { |
219 | struct nlmsghdr *nlh; | 220 | struct nlmsghdr *nlh; |
221 | struct net *nl_net; | ||
220 | u32 pid; | 222 | u32 pid; |
221 | }; | 223 | }; |
222 | 224 | ||
@@ -253,6 +255,8 @@ extern int nla_put(struct sk_buff *skb, int attrtype, | |||
253 | int attrlen, const void *data); | 255 | int attrlen, const void *data); |
254 | extern int nla_put_nohdr(struct sk_buff *skb, int attrlen, | 256 | extern int nla_put_nohdr(struct sk_buff *skb, int attrlen, |
255 | const void *data); | 257 | const void *data); |
258 | extern int nla_append(struct sk_buff *skb, int attrlen, | ||
259 | const void *data); | ||
256 | 260 | ||
257 | /************************************************************************** | 261 | /************************************************************************** |
258 | * Netlink Messages | 262 | * Netlink Messages |
@@ -862,7 +866,7 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, | |||
862 | 866 | ||
863 | #define NLA_PUT(skb, attrtype, attrlen, data) \ | 867 | #define NLA_PUT(skb, attrtype, attrlen, data) \ |
864 | do { \ | 868 | do { \ |
865 | if (nla_put(skb, attrtype, attrlen, data) < 0) \ | 869 | if (unlikely(nla_put(skb, attrtype, attrlen, data) < 0)) \ |
866 | goto nla_put_failure; \ | 870 | goto nla_put_failure; \ |
867 | } while(0) | 871 | } while(0) |
868 | 872 | ||
@@ -881,6 +885,9 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, | |||
881 | #define NLA_PUT_LE16(skb, attrtype, value) \ | 885 | #define NLA_PUT_LE16(skb, attrtype, value) \ |
882 | NLA_PUT_TYPE(skb, __le16, attrtype, value) | 886 | NLA_PUT_TYPE(skb, __le16, attrtype, value) |
883 | 887 | ||
888 | #define NLA_PUT_BE16(skb, attrtype, value) \ | ||
889 | NLA_PUT_TYPE(skb, __be16, attrtype, value) | ||
890 | |||
884 | #define NLA_PUT_U32(skb, attrtype, value) \ | 891 | #define NLA_PUT_U32(skb, attrtype, value) \ |
885 | NLA_PUT_TYPE(skb, u32, attrtype, value) | 892 | NLA_PUT_TYPE(skb, u32, attrtype, value) |
886 | 893 | ||
@@ -927,6 +934,15 @@ static inline u16 nla_get_u16(struct nlattr *nla) | |||
927 | } | 934 | } |
928 | 935 | ||
929 | /** | 936 | /** |
937 | * nla_get_be16 - return payload of __be16 attribute | ||
938 | * @nla: __be16 netlink attribute | ||
939 | */ | ||
940 | static inline __be16 nla_get_be16(struct nlattr *nla) | ||
941 | { | ||
942 | return *(__be16 *) nla_data(nla); | ||
943 | } | ||
944 | |||
945 | /** | ||
930 | * nla_get_le16 - return payload of __le16 attribute | 946 | * nla_get_le16 - return payload of __le16 attribute |
931 | * @nla: __le16 netlink attribute | 947 | * @nla: __le16 netlink attribute |
932 | */ | 948 | */ |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h new file mode 100644 index 000000000000..15a0b052df22 --- /dev/null +++ b/include/net/netns/ipv4.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * ipv4 in net namespaces | ||
3 | */ | ||
4 | |||
5 | #ifndef __NETNS_IPV4_H__ | ||
6 | #define __NETNS_IPV4_H__ | ||
7 | |||
8 | #include <net/inet_frag.h> | ||
9 | |||
10 | struct ctl_table_header; | ||
11 | struct ipv4_devconf; | ||
12 | struct fib_rules_ops; | ||
13 | struct hlist_head; | ||
14 | struct sock; | ||
15 | |||
16 | struct netns_ipv4 { | ||
17 | #ifdef CONFIG_SYSCTL | ||
18 | struct ctl_table_header *forw_hdr; | ||
19 | struct ctl_table_header *frags_hdr; | ||
20 | #endif | ||
21 | struct ipv4_devconf *devconf_all; | ||
22 | struct ipv4_devconf *devconf_dflt; | ||
23 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
24 | struct fib_rules_ops *rules_ops; | ||
25 | #endif | ||
26 | struct hlist_head *fib_table_hash; | ||
27 | struct sock *fibnl; | ||
28 | |||
29 | struct netns_frags frags; | ||
30 | }; | ||
31 | #endif | ||
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h new file mode 100644 index 000000000000..187c4248df22 --- /dev/null +++ b/include/net/netns/ipv6.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * ipv6 in net namespaces | ||
3 | */ | ||
4 | |||
5 | #include <net/inet_frag.h> | ||
6 | |||
7 | #ifndef __NETNS_IPV6_H__ | ||
8 | #define __NETNS_IPV6_H__ | ||
9 | |||
10 | struct ctl_table_header; | ||
11 | |||
12 | struct netns_sysctl_ipv6 { | ||
13 | #ifdef CONFIG_SYSCTL | ||
14 | struct ctl_table_header *table; | ||
15 | struct ctl_table_header *frags_hdr; | ||
16 | #endif | ||
17 | int bindv6only; | ||
18 | int flush_delay; | ||
19 | int ip6_rt_max_size; | ||
20 | int ip6_rt_gc_min_interval; | ||
21 | int ip6_rt_gc_timeout; | ||
22 | int ip6_rt_gc_interval; | ||
23 | int ip6_rt_gc_elasticity; | ||
24 | int ip6_rt_mtu_expires; | ||
25 | int ip6_rt_min_advmss; | ||
26 | int icmpv6_time; | ||
27 | }; | ||
28 | |||
29 | struct netns_ipv6 { | ||
30 | struct netns_sysctl_ipv6 sysctl; | ||
31 | struct ipv6_devconf *devconf_all; | ||
32 | struct ipv6_devconf *devconf_dflt; | ||
33 | struct netns_frags frags; | ||
34 | }; | ||
35 | #endif | ||
diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h new file mode 100644 index 000000000000..637daf698884 --- /dev/null +++ b/include/net/netns/packet.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* | ||
2 | * Packet network namespace | ||
3 | */ | ||
4 | #ifndef __NETNS_PACKET_H__ | ||
5 | #define __NETNS_PACKET_H__ | ||
6 | |||
7 | #include <linux/list.h> | ||
8 | #include <linux/spinlock.h> | ||
9 | |||
10 | struct netns_packet { | ||
11 | rwlock_t sklist_lock; | ||
12 | struct hlist_head sklist; | ||
13 | }; | ||
14 | |||
15 | #endif /* __NETNS_PACKET_H__ */ | ||
diff --git a/include/net/netns/unix.h b/include/net/netns/unix.h new file mode 100644 index 000000000000..284649d4dfb4 --- /dev/null +++ b/include/net/netns/unix.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* | ||
2 | * Unix network namespace | ||
3 | */ | ||
4 | #ifndef __NETNS_UNIX_H__ | ||
5 | #define __NETNS_UNIX_H__ | ||
6 | |||
7 | struct ctl_table_header; | ||
8 | struct netns_unix { | ||
9 | int sysctl_max_dgram_qlen; | ||
10 | struct ctl_table_header *ctl; | ||
11 | }; | ||
12 | |||
13 | #endif /* __NETNS_UNIX_H__ */ | ||
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index f285de69c615..8716eb757d51 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define __NET_PKT_CLS_H | 2 | #define __NET_PKT_CLS_H |
3 | 3 | ||
4 | #include <linux/pkt_cls.h> | 4 | #include <linux/pkt_cls.h> |
5 | #include <net/net_namespace.h> | ||
6 | #include <net/sch_generic.h> | 5 | #include <net/sch_generic.h> |
7 | #include <net/act_api.h> | 6 | #include <net/act_api.h> |
8 | 7 | ||
@@ -130,8 +129,8 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts, | |||
130 | return 0; | 129 | return 0; |
131 | } | 130 | } |
132 | 131 | ||
133 | extern int tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb, | 132 | extern int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb, |
134 | struct rtattr *rate_tlv, struct tcf_exts *exts, | 133 | struct nlattr *rate_tlv, struct tcf_exts *exts, |
135 | struct tcf_ext_map *map); | 134 | struct tcf_ext_map *map); |
136 | extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); | 135 | extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); |
137 | extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, | 136 | extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, |
@@ -248,7 +247,7 @@ struct tcf_ematch_ops | |||
248 | 247 | ||
249 | extern int tcf_em_register(struct tcf_ematch_ops *); | 248 | extern int tcf_em_register(struct tcf_ematch_ops *); |
250 | extern int tcf_em_unregister(struct tcf_ematch_ops *); | 249 | extern int tcf_em_unregister(struct tcf_ematch_ops *); |
251 | extern int tcf_em_tree_validate(struct tcf_proto *, struct rtattr *, | 250 | extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *, |
252 | struct tcf_ematch_tree *); | 251 | struct tcf_ematch_tree *); |
253 | extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); | 252 | extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); |
254 | extern int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int); | 253 | extern int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int); |
@@ -336,10 +335,12 @@ static inline int tcf_valid_offset(const struct sk_buff *skb, | |||
336 | } | 335 | } |
337 | 336 | ||
338 | #ifdef CONFIG_NET_CLS_IND | 337 | #ifdef CONFIG_NET_CLS_IND |
338 | #include <net/net_namespace.h> | ||
339 | |||
339 | static inline int | 340 | static inline int |
340 | tcf_change_indev(struct tcf_proto *tp, char *indev, struct rtattr *indev_tlv) | 341 | tcf_change_indev(struct tcf_proto *tp, char *indev, struct nlattr *indev_tlv) |
341 | { | 342 | { |
342 | if (rtattr_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) | 343 | if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) |
343 | return -EINVAL; | 344 | return -EINVAL; |
344 | return 0; | 345 | return 0; |
345 | } | 346 | } |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index ab61809a9616..46fb4d80c74a 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -77,7 +77,7 @@ extern int unregister_qdisc(struct Qdisc_ops *qops); | |||
77 | extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle); | 77 | extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle); |
78 | extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle); | 78 | extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle); |
79 | extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, | 79 | extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, |
80 | struct rtattr *tab); | 80 | struct nlattr *tab); |
81 | extern void qdisc_put_rtab(struct qdisc_rate_table *tab); | 81 | extern void qdisc_put_rtab(struct qdisc_rate_table *tab); |
82 | 82 | ||
83 | extern void __qdisc_run(struct net_device *dev); | 83 | extern void __qdisc_run(struct net_device *dev); |
diff --git a/include/net/protocol.h b/include/net/protocol.h index 1166ffb4b3ec..ad8c584233a6 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
@@ -102,7 +102,7 @@ extern void inet_unregister_protosw(struct inet_protosw *p); | |||
102 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 102 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
103 | extern int inet6_add_protocol(struct inet6_protocol *prot, unsigned char num); | 103 | extern int inet6_add_protocol(struct inet6_protocol *prot, unsigned char num); |
104 | extern int inet6_del_protocol(struct inet6_protocol *prot, unsigned char num); | 104 | extern int inet6_del_protocol(struct inet6_protocol *prot, unsigned char num); |
105 | extern void inet6_register_protosw(struct inet_protosw *p); | 105 | extern int inet6_register_protosw(struct inet_protosw *p); |
106 | extern void inet6_unregister_protosw(struct inet_protosw *p); | 106 | extern void inet6_unregister_protosw(struct inet_protosw *p); |
107 | #endif | 107 | #endif |
108 | 108 | ||
diff --git a/include/net/raw.h b/include/net/raw.h index e4af59781949..cca81d8b2d8b 100644 --- a/include/net/raw.h +++ b/include/net/raw.h | |||
@@ -22,27 +22,39 @@ | |||
22 | 22 | ||
23 | extern struct proto raw_prot; | 23 | extern struct proto raw_prot; |
24 | 24 | ||
25 | extern void raw_err(struct sock *, struct sk_buff *, u32 info); | 25 | void raw_icmp_error(struct sk_buff *, int, u32); |
26 | extern int raw_rcv(struct sock *, struct sk_buff *); | 26 | int raw_local_deliver(struct sk_buff *, int); |
27 | |||
28 | /* Note: v4 ICMP wants to get at this stuff, if you change the | ||
29 | * hashing mechanism, make sure you update icmp.c as well. | ||
30 | */ | ||
31 | #define RAWV4_HTABLE_SIZE MAX_INET_PROTOS | ||
32 | extern struct hlist_head raw_v4_htable[RAWV4_HTABLE_SIZE]; | ||
33 | |||
34 | extern rwlock_t raw_v4_lock; | ||
35 | 27 | ||
28 | extern int raw_rcv(struct sock *, struct sk_buff *); | ||
36 | 29 | ||
37 | extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num, | 30 | #define RAW_HTABLE_SIZE MAX_INET_PROTOS |
38 | __be32 raddr, __be32 laddr, | ||
39 | int dif); | ||
40 | 31 | ||
41 | extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash); | 32 | struct raw_hashinfo { |
33 | rwlock_t lock; | ||
34 | struct hlist_head ht[RAW_HTABLE_SIZE]; | ||
35 | }; | ||
42 | 36 | ||
43 | #ifdef CONFIG_PROC_FS | 37 | #ifdef CONFIG_PROC_FS |
44 | extern int raw_proc_init(void); | 38 | extern int raw_proc_init(void); |
45 | extern void raw_proc_exit(void); | 39 | extern void raw_proc_exit(void); |
40 | |||
41 | struct raw_iter_state { | ||
42 | struct seq_net_private p; | ||
43 | int bucket; | ||
44 | unsigned short family; | ||
45 | struct raw_hashinfo *h; | ||
46 | }; | ||
47 | |||
48 | #define raw_seq_private(seq) ((struct raw_iter_state *)(seq)->private) | ||
49 | void *raw_seq_start(struct seq_file *seq, loff_t *pos); | ||
50 | void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos); | ||
51 | void raw_seq_stop(struct seq_file *seq, void *v); | ||
52 | int raw_seq_open(struct inode *ino, struct file *file, struct raw_hashinfo *h, | ||
53 | unsigned short family); | ||
54 | |||
46 | #endif | 55 | #endif |
47 | 56 | ||
57 | void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h); | ||
58 | void raw_unhash_sk(struct sock *sk, struct raw_hashinfo *h); | ||
59 | |||
48 | #endif /* _RAW_H */ | 60 | #endif /* _RAW_H */ |
diff --git a/include/net/rawv6.h b/include/net/rawv6.h index a5819891d525..8a22599f26ba 100644 --- a/include/net/rawv6.h +++ b/include/net/rawv6.h | |||
@@ -5,26 +5,13 @@ | |||
5 | 5 | ||
6 | #include <net/protocol.h> | 6 | #include <net/protocol.h> |
7 | 7 | ||
8 | #define RAWV6_HTABLE_SIZE MAX_INET_PROTOS | 8 | void raw6_icmp_error(struct sk_buff *, int nexthdr, |
9 | extern struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE]; | 9 | int type, int code, int inner_offset, __be32); |
10 | extern rwlock_t raw_v6_lock; | 10 | int raw6_local_deliver(struct sk_buff *, int); |
11 | |||
12 | extern int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr); | ||
13 | |||
14 | extern struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num, | ||
15 | struct in6_addr *loc_addr, struct in6_addr *rmt_addr, | ||
16 | int dif); | ||
17 | 11 | ||
18 | extern int rawv6_rcv(struct sock *sk, | 12 | extern int rawv6_rcv(struct sock *sk, |
19 | struct sk_buff *skb); | 13 | struct sk_buff *skb); |
20 | 14 | ||
21 | |||
22 | extern void rawv6_err(struct sock *sk, | ||
23 | struct sk_buff *skb, | ||
24 | struct inet6_skb_parm *opt, | ||
25 | int type, int code, | ||
26 | int offset, __be32 info); | ||
27 | |||
28 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 15 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
29 | int rawv6_mh_filter_register(int (*filter)(struct sock *sock, | 16 | int rawv6_mh_filter_register(int (*filter)(struct sock *sock, |
30 | struct sk_buff *skb)); | 17 | struct sk_buff *skb)); |
diff --git a/include/net/route.h b/include/net/route.h index 59b0b19205a2..4eabf008413b 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/ip.h> | 33 | #include <linux/ip.h> |
34 | #include <linux/cache.h> | 34 | #include <linux/cache.h> |
35 | #include <linux/security.h> | 35 | #include <linux/security.h> |
36 | #include <net/sock.h> | ||
36 | 37 | ||
37 | #ifndef __KERNEL__ | 38 | #ifndef __KERNEL__ |
38 | #warning This file is not supposed to be used outside of kernel. | 39 | #warning This file is not supposed to be used outside of kernel. |
@@ -110,16 +111,17 @@ extern int ip_rt_init(void); | |||
110 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, | 111 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, |
111 | __be32 src, struct net_device *dev); | 112 | __be32 src, struct net_device *dev); |
112 | extern void rt_cache_flush(int how); | 113 | extern void rt_cache_flush(int how); |
113 | extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); | 114 | extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); |
114 | extern int ip_route_output_key(struct rtable **, struct flowi *flp); | 115 | extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); |
115 | extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); | 116 | extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); |
116 | extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); | 117 | extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); |
117 | extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); | 118 | extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu); |
118 | extern void ip_rt_send_redirect(struct sk_buff *skb); | 119 | extern void ip_rt_send_redirect(struct sk_buff *skb); |
119 | 120 | ||
120 | extern unsigned inet_addr_type(__be32 addr); | 121 | extern unsigned inet_addr_type(struct net *net, __be32 addr); |
122 | extern unsigned inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); | ||
121 | extern void ip_rt_multicast_event(struct in_device *); | 123 | extern void ip_rt_multicast_event(struct in_device *); |
122 | extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); | 124 | extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); |
123 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); | 125 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); |
124 | extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); | 126 | extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); |
125 | 127 | ||
@@ -156,8 +158,9 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
156 | .dport = dport } } }; | 158 | .dport = dport } } }; |
157 | 159 | ||
158 | int err; | 160 | int err; |
161 | struct net *net = sk->sk_net; | ||
159 | if (!dst || !src) { | 162 | if (!dst || !src) { |
160 | err = __ip_route_output_key(rp, &fl); | 163 | err = __ip_route_output_key(net, rp, &fl); |
161 | if (err) | 164 | if (err) |
162 | return err; | 165 | return err; |
163 | fl.fl4_dst = (*rp)->rt_dst; | 166 | fl.fl4_dst = (*rp)->rt_dst; |
@@ -166,7 +169,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
166 | *rp = NULL; | 169 | *rp = NULL; |
167 | } | 170 | } |
168 | security_sk_classify_flow(sk, &fl); | 171 | security_sk_classify_flow(sk, &fl); |
169 | return ip_route_output_flow(rp, &fl, sk, flags); | 172 | return ip_route_output_flow(net, rp, &fl, sk, flags); |
170 | } | 173 | } |
171 | 174 | ||
172 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, | 175 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, |
@@ -183,7 +186,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, | |||
183 | ip_rt_put(*rp); | 186 | ip_rt_put(*rp); |
184 | *rp = NULL; | 187 | *rp = NULL; |
185 | security_sk_classify_flow(sk, &fl); | 188 | security_sk_classify_flow(sk, &fl); |
186 | return ip_route_output_flow(rp, &fl, sk, 0); | 189 | return ip_route_output_flow(sk->sk_net, rp, &fl, sk, 0); |
187 | } | 190 | } |
188 | return 0; | 191 | return 0; |
189 | } | 192 | } |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 4c3b35153c37..ab502ec1c61c 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -66,7 +66,7 @@ struct Qdisc_class_ops | |||
66 | unsigned long (*get)(struct Qdisc *, u32 classid); | 66 | unsigned long (*get)(struct Qdisc *, u32 classid); |
67 | void (*put)(struct Qdisc *, unsigned long); | 67 | void (*put)(struct Qdisc *, unsigned long); |
68 | int (*change)(struct Qdisc *, u32, u32, | 68 | int (*change)(struct Qdisc *, u32, u32, |
69 | struct rtattr **, unsigned long *); | 69 | struct nlattr **, unsigned long *); |
70 | int (*delete)(struct Qdisc *, unsigned long); | 70 | int (*delete)(struct Qdisc *, unsigned long); |
71 | void (*walk)(struct Qdisc *, struct qdisc_walker * arg); | 71 | void (*walk)(struct Qdisc *, struct qdisc_walker * arg); |
72 | 72 | ||
@@ -86,7 +86,7 @@ struct Qdisc_class_ops | |||
86 | struct Qdisc_ops | 86 | struct Qdisc_ops |
87 | { | 87 | { |
88 | struct Qdisc_ops *next; | 88 | struct Qdisc_ops *next; |
89 | struct Qdisc_class_ops *cl_ops; | 89 | const struct Qdisc_class_ops *cl_ops; |
90 | char id[IFNAMSIZ]; | 90 | char id[IFNAMSIZ]; |
91 | int priv_size; | 91 | int priv_size; |
92 | 92 | ||
@@ -95,10 +95,10 @@ struct Qdisc_ops | |||
95 | int (*requeue)(struct sk_buff *, struct Qdisc *); | 95 | int (*requeue)(struct sk_buff *, struct Qdisc *); |
96 | unsigned int (*drop)(struct Qdisc *); | 96 | unsigned int (*drop)(struct Qdisc *); |
97 | 97 | ||
98 | int (*init)(struct Qdisc *, struct rtattr *arg); | 98 | int (*init)(struct Qdisc *, struct nlattr *arg); |
99 | void (*reset)(struct Qdisc *); | 99 | void (*reset)(struct Qdisc *); |
100 | void (*destroy)(struct Qdisc *); | 100 | void (*destroy)(struct Qdisc *); |
101 | int (*change)(struct Qdisc *, struct rtattr *arg); | 101 | int (*change)(struct Qdisc *, struct nlattr *arg); |
102 | 102 | ||
103 | int (*dump)(struct Qdisc *, struct sk_buff *); | 103 | int (*dump)(struct Qdisc *, struct sk_buff *); |
104 | int (*dump_stats)(struct Qdisc *, struct gnet_dump *); | 104 | int (*dump_stats)(struct Qdisc *, struct gnet_dump *); |
@@ -126,7 +126,7 @@ struct tcf_proto_ops | |||
126 | unsigned long (*get)(struct tcf_proto*, u32 handle); | 126 | unsigned long (*get)(struct tcf_proto*, u32 handle); |
127 | void (*put)(struct tcf_proto*, unsigned long); | 127 | void (*put)(struct tcf_proto*, unsigned long); |
128 | int (*change)(struct tcf_proto*, unsigned long, | 128 | int (*change)(struct tcf_proto*, unsigned long, |
129 | u32 handle, struct rtattr **, | 129 | u32 handle, struct nlattr **, |
130 | unsigned long *); | 130 | unsigned long *); |
131 | int (*delete)(struct tcf_proto*, unsigned long); | 131 | int (*delete)(struct tcf_proto*, unsigned long); |
132 | void (*walk)(struct tcf_proto*, struct tcf_walker *arg); | 132 | void (*walk)(struct tcf_proto*, struct tcf_walker *arg); |
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h new file mode 100644 index 000000000000..ba75c67cb992 --- /dev/null +++ b/include/net/sctp/checksum.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* SCTP kernel reference Implementation | ||
2 | * Copyright (c) 1999-2001 Motorola, Inc. | ||
3 | * Copyright (c) 2001-2003 International Business Machines, Corp. | ||
4 | * | ||
5 | * This file is part of the SCTP kernel reference Implementation | ||
6 | * | ||
7 | * SCTP Checksum functions | ||
8 | * | ||
9 | * The SCTP reference implementation is free software; | ||
10 | * you can redistribute it and/or modify it under the terms of | ||
11 | * the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2, or (at your option) | ||
13 | * any later version. | ||
14 | * | ||
15 | * The SCTP reference implementation is distributed in the hope that it | ||
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | * ************************ | ||
18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
19 | * See the GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with GNU CC; see the file COPYING. If not, write to | ||
23 | * the Free Software Foundation, 59 Temple Place - Suite 330, | ||
24 | * Boston, MA 02111-1307, USA. | ||
25 | * | ||
26 | * Please send any bug reports or fixes you make to the | ||
27 | * email address(es): | ||
28 | * lksctp developers <lksctp-developers@lists.sourceforge.net> | ||
29 | * | ||
30 | * Or submit a bug report through the following website: | ||
31 | * http://www.sf.net/projects/lksctp | ||
32 | * | ||
33 | * Written or modified by: | ||
34 | * Dinakaran Joseph | ||
35 | * Jon Grimm <jgrimm@us.ibm.com> | ||
36 | * Sridhar Samudrala <sri@us.ibm.com> | ||
37 | * | ||
38 | * Rewritten to use libcrc32c by: | ||
39 | * Vlad Yasevich <vladislav.yasevich@hp.com> | ||
40 | * | ||
41 | * Any bugs reported given to us we will try to fix... any fixes shared will | ||
42 | * be incorporated into the next SCTP release. | ||
43 | */ | ||
44 | |||
45 | #include <linux/types.h> | ||
46 | #include <net/sctp/sctp.h> | ||
47 | #include <linux/crc32c.h> | ||
48 | |||
49 | static inline __u32 sctp_start_cksum(__u8 *buffer, __u16 length) | ||
50 | { | ||
51 | __u32 crc = ~(__u32) 0; | ||
52 | __u8 zero[sizeof(__u32)] = {0}; | ||
53 | |||
54 | /* Optimize this routine to be SCTP specific, knowing how | ||
55 | * to skip the checksum field of the SCTP header. | ||
56 | */ | ||
57 | |||
58 | /* Calculate CRC up to the checksum. */ | ||
59 | crc = crc32c(crc, buffer, sizeof(struct sctphdr) - sizeof(__u32)); | ||
60 | |||
61 | /* Skip checksum field of the header. */ | ||
62 | crc = crc32c(crc, zero, sizeof(__u32)); | ||
63 | |||
64 | /* Calculate the rest of the CRC. */ | ||
65 | crc = crc32c(crc, &buffer[sizeof(struct sctphdr)], | ||
66 | length - sizeof(struct sctphdr)); | ||
67 | return crc; | ||
68 | } | ||
69 | |||
70 | static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32) | ||
71 | { | ||
72 | return crc32c(crc32, buffer, length); | ||
73 | } | ||
74 | |||
75 | static inline __u32 sctp_end_cksum(__u32 crc32) | ||
76 | { | ||
77 | return ntohl(~crc32); | ||
78 | } | ||
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index 05f22a6afbcd..fefcba67bd1e 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -365,36 +365,12 @@ typedef enum { | |||
365 | * Also, RFC 8.4, non-unicast addresses are not considered valid SCTP | 365 | * Also, RFC 8.4, non-unicast addresses are not considered valid SCTP |
366 | * addresses. | 366 | * addresses. |
367 | */ | 367 | */ |
368 | #define IS_IPV4_UNUSABLE_ADDRESS(a) \ | 368 | #define IS_IPV4_UNUSABLE_ADDRESS(a) \ |
369 | ((htonl(INADDR_BROADCAST) == *a) || \ | 369 | ((htonl(INADDR_BROADCAST) == a) || \ |
370 | (MULTICAST(*a)) || \ | 370 | ipv4_is_multicast(a) || \ |
371 | (((unsigned char *)(a))[0] == 0) || \ | 371 | ipv4_is_zeronet(a) || \ |
372 | ((((unsigned char *)(a))[0] == 198) && \ | 372 | ipv4_is_test_198(a) || \ |
373 | (((unsigned char *)(a))[1] == 18) && \ | 373 | ipv4_is_anycast_6to4(a)) |
374 | (((unsigned char *)(a))[2] == 0)) || \ | ||
375 | ((((unsigned char *)(a))[0] == 192) && \ | ||
376 | (((unsigned char *)(a))[1] == 88) && \ | ||
377 | (((unsigned char *)(a))[2] == 99))) | ||
378 | |||
379 | /* IPv4 Link-local addresses: 169.254.0.0/16. */ | ||
380 | #define IS_IPV4_LINK_ADDRESS(a) \ | ||
381 | ((((unsigned char *)(a))[0] == 169) && \ | ||
382 | (((unsigned char *)(a))[1] == 254)) | ||
383 | |||
384 | /* RFC 1918 "Address Allocation for Private Internets" defines the IPv4 | ||
385 | * private address space as the following: | ||
386 | * | ||
387 | * 10.0.0.0 - 10.255.255.255 (10/8 prefix) | ||
388 | * 172.16.0.0.0 - 172.31.255.255 (172.16/12 prefix) | ||
389 | * 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) | ||
390 | */ | ||
391 | #define IS_IPV4_PRIVATE_ADDRESS(a) \ | ||
392 | ((((unsigned char *)(a))[0] == 10) || \ | ||
393 | ((((unsigned char *)(a))[0] == 172) && \ | ||
394 | (((unsigned char *)(a))[1] >= 16) && \ | ||
395 | (((unsigned char *)(a))[1] < 32)) || \ | ||
396 | ((((unsigned char *)(a))[0] == 192) && \ | ||
397 | (((unsigned char *)(a))[1] == 168))) | ||
398 | 374 | ||
399 | /* Flags used for the bind address copy functions. */ | 375 | /* Flags used for the bind address copy functions. */ |
400 | #define SCTP_ADDR6_ALLOWED 0x00000001 /* IPv6 address is allowed by | 376 | #define SCTP_ADDR6_ALLOWED 0x00000001 /* IPv6 address is allowed by |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 34318a33a94c..4977b0a81535 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -150,13 +150,6 @@ int sctp_primitive_REQUESTHEARTBEAT(struct sctp_association *, void *arg); | |||
150 | int sctp_primitive_ASCONF(struct sctp_association *, void *arg); | 150 | int sctp_primitive_ASCONF(struct sctp_association *, void *arg); |
151 | 151 | ||
152 | /* | 152 | /* |
153 | * sctp/crc32c.c | ||
154 | */ | ||
155 | __u32 sctp_start_cksum(__u8 *ptr, __u16 count); | ||
156 | __u32 sctp_update_cksum(__u8 *ptr, __u16 count, __u32 cksum); | ||
157 | __u32 sctp_end_cksum(__u32 cksum); | ||
158 | |||
159 | /* | ||
160 | * sctp/input.c | 153 | * sctp/input.c |
161 | */ | 154 | */ |
162 | int sctp_rcv(struct sk_buff *skb); | 155 | int sctp_rcv(struct sk_buff *skb); |
@@ -470,8 +463,7 @@ static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk) | |||
470 | skb->destructor = sctp_sock_rfree; | 463 | skb->destructor = sctp_sock_rfree; |
471 | atomic_add(event->rmem_len, &sk->sk_rmem_alloc); | 464 | atomic_add(event->rmem_len, &sk->sk_rmem_alloc); |
472 | /* | 465 | /* |
473 | * This mimics the behavior of | 466 | * This mimics the behavior of skb_set_owner_r |
474 | * sk_stream_set_owner_r | ||
475 | */ | 467 | */ |
476 | sk->sk_forward_alloc -= event->rmem_len; | 468 | sk->sk_forward_alloc -= event->rmem_len; |
477 | } | 469 | } |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index bb965742b64e..4d591bfce452 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -451,6 +451,7 @@ union sctp_params { | |||
451 | struct sctp_random_param *random; | 451 | struct sctp_random_param *random; |
452 | struct sctp_chunks_param *chunks; | 452 | struct sctp_chunks_param *chunks; |
453 | struct sctp_hmac_algo_param *hmac_algo; | 453 | struct sctp_hmac_algo_param *hmac_algo; |
454 | struct sctp_addip_param *addip; | ||
454 | }; | 455 | }; |
455 | 456 | ||
456 | /* RFC 2960. Section 3.3.5 Heartbeat. | 457 | /* RFC 2960. Section 3.3.5 Heartbeat. |
@@ -743,6 +744,7 @@ struct sctp_chunk { | |||
743 | __u8 tsn_missing_report; /* Data chunk missing counter. */ | 744 | __u8 tsn_missing_report; /* Data chunk missing counter. */ |
744 | __u8 data_accepted; /* At least 1 chunk in this packet accepted */ | 745 | __u8 data_accepted; /* At least 1 chunk in this packet accepted */ |
745 | __u8 auth; /* IN: was auth'ed | OUT: needs auth */ | 746 | __u8 auth; /* IN: was auth'ed | OUT: needs auth */ |
747 | __u8 has_asconf; /* IN: have seen an asconf before */ | ||
746 | }; | 748 | }; |
747 | 749 | ||
748 | void sctp_chunk_hold(struct sctp_chunk *); | 750 | void sctp_chunk_hold(struct sctp_chunk *); |
@@ -758,12 +760,18 @@ void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *, | |||
758 | union sctp_addr *); | 760 | union sctp_addr *); |
759 | const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); | 761 | const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); |
760 | 762 | ||
763 | enum { | ||
764 | SCTP_ADDR_NEW, /* new address added to assoc/ep */ | ||
765 | SCTP_ADDR_SRC, /* address can be used as source */ | ||
766 | SCTP_ADDR_DEL, /* address about to be deleted */ | ||
767 | }; | ||
768 | |||
761 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ | 769 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ |
762 | struct sctp_sockaddr_entry { | 770 | struct sctp_sockaddr_entry { |
763 | struct list_head list; | 771 | struct list_head list; |
764 | struct rcu_head rcu; | 772 | struct rcu_head rcu; |
765 | union sctp_addr a; | 773 | union sctp_addr a; |
766 | __u8 use_as_src; | 774 | __u8 state; |
767 | __u8 valid; | 775 | __u8 valid; |
768 | }; | 776 | }; |
769 | 777 | ||
@@ -1188,10 +1196,12 @@ int sctp_bind_addr_dup(struct sctp_bind_addr *dest, | |||
1188 | const struct sctp_bind_addr *src, | 1196 | const struct sctp_bind_addr *src, |
1189 | gfp_t gfp); | 1197 | gfp_t gfp); |
1190 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, | 1198 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, |
1191 | __u8 use_as_src, gfp_t gfp); | 1199 | __u8 addr_state, gfp_t gfp); |
1192 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); | 1200 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); |
1193 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, | 1201 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, |
1194 | struct sctp_sock *); | 1202 | struct sctp_sock *); |
1203 | int sctp_bind_addr_state(const struct sctp_bind_addr *bp, | ||
1204 | const union sctp_addr *addr); | ||
1195 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, | 1205 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, |
1196 | const union sctp_addr *addrs, | 1206 | const union sctp_addr *addrs, |
1197 | int addrcnt, | 1207 | int addrcnt, |
@@ -1784,20 +1794,16 @@ struct sctp_association { | |||
1784 | */ | 1794 | */ |
1785 | struct sctp_chunk *addip_last_asconf; | 1795 | struct sctp_chunk *addip_last_asconf; |
1786 | 1796 | ||
1787 | /* ADDIP Section 4.2 Upon reception of an ASCONF Chunk. | 1797 | /* ADDIP Section 5.2 Upon reception of an ASCONF Chunk. |
1788 | * | 1798 | * |
1789 | * IMPLEMENTATION NOTE: As an optimization a receiver may wish | 1799 | * This is needed to implement itmes E1 - E4 of the updated |
1790 | * to save the last ASCONF-ACK for some predetermined period | 1800 | * spec. Here is the justification: |
1791 | * of time and instead of re-processing the ASCONF (with the | ||
1792 | * same serial number) it may just re-transmit the | ||
1793 | * ASCONF-ACK. It may wish to use the arrival of a new serial | ||
1794 | * number to discard the previously saved ASCONF-ACK or any | ||
1795 | * other means it may choose to expire the saved ASCONF-ACK. | ||
1796 | * | 1801 | * |
1797 | * [This is our saved ASCONF-ACK. We invalidate it when a new | 1802 | * Since the peer may bundle multiple ASCONF chunks toward us, |
1798 | * ASCONF serial number arrives.] | 1803 | * we now need the ability to cache multiple ACKs. The section |
1804 | * describes in detail how they are cached and cleaned up. | ||
1799 | */ | 1805 | */ |
1800 | struct sctp_chunk *addip_last_asconf_ack; | 1806 | struct list_head asconf_ack_list; |
1801 | 1807 | ||
1802 | /* These ASCONF chunks are waiting to be sent. | 1808 | /* These ASCONF chunks are waiting to be sent. |
1803 | * | 1809 | * |
@@ -1938,12 +1944,19 @@ void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned); | |||
1938 | void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned); | 1944 | void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned); |
1939 | void sctp_assoc_set_primary(struct sctp_association *, | 1945 | void sctp_assoc_set_primary(struct sctp_association *, |
1940 | struct sctp_transport *); | 1946 | struct sctp_transport *); |
1947 | void sctp_assoc_del_nonprimary_peers(struct sctp_association *, | ||
1948 | struct sctp_transport *); | ||
1941 | int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, | 1949 | int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, |
1942 | gfp_t); | 1950 | gfp_t); |
1943 | int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, | 1951 | int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, |
1944 | struct sctp_cookie*, | 1952 | struct sctp_cookie*, |
1945 | gfp_t gfp); | 1953 | gfp_t gfp); |
1946 | int sctp_assoc_set_id(struct sctp_association *, gfp_t); | 1954 | int sctp_assoc_set_id(struct sctp_association *, gfp_t); |
1955 | void sctp_assoc_clean_asconf_ack_cache(const struct sctp_association *asoc); | ||
1956 | struct sctp_chunk *sctp_assoc_lookup_asconf_ack( | ||
1957 | const struct sctp_association *asoc, | ||
1958 | __be32 serial); | ||
1959 | |||
1947 | 1960 | ||
1948 | int sctp_cmp_addr_exact(const union sctp_addr *ss1, | 1961 | int sctp_cmp_addr_exact(const union sctp_addr *ss1, |
1949 | const union sctp_addr *ss2); | 1962 | const union sctp_addr *ss2); |
diff --git a/include/net/snmp.h b/include/net/snmp.h index ea206bff0dc4..ce2f48507510 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <linux/cache.h> | 24 | #include <linux/cache.h> |
25 | #include <linux/snmp.h> | 25 | #include <linux/snmp.h> |
26 | #include <linux/smp.h> | ||
26 | 27 | ||
27 | /* | 28 | /* |
28 | * Mibs are stored in array of unsigned long. | 29 | * Mibs are stored in array of unsigned long. |
@@ -117,6 +118,11 @@ struct linux_mib { | |||
117 | unsigned long mibs[LINUX_MIB_MAX]; | 118 | unsigned long mibs[LINUX_MIB_MAX]; |
118 | }; | 119 | }; |
119 | 120 | ||
121 | /* Linux Xfrm */ | ||
122 | #define LINUX_MIB_XFRMMAX __LINUX_MIB_XFRMMAX | ||
123 | struct linux_xfrm_mib { | ||
124 | unsigned long mibs[LINUX_MIB_XFRMMAX]; | ||
125 | }; | ||
120 | 126 | ||
121 | /* | 127 | /* |
122 | * FIXME: On x86 and some other CPUs the split into user and softirq parts | 128 | * FIXME: On x86 and some other CPUs the split into user and softirq parts |
@@ -134,17 +140,27 @@ struct linux_mib { | |||
134 | 140 | ||
135 | #define SNMP_INC_STATS_BH(mib, field) \ | 141 | #define SNMP_INC_STATS_BH(mib, field) \ |
136 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) | 142 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) |
137 | #define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \ | ||
138 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field + (offset)]++) | ||
139 | #define SNMP_INC_STATS_USER(mib, field) \ | 143 | #define SNMP_INC_STATS_USER(mib, field) \ |
140 | (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field]++) | 144 | do { \ |
145 | per_cpu_ptr(mib[1], get_cpu())->mibs[field]++; \ | ||
146 | put_cpu(); \ | ||
147 | } while (0) | ||
141 | #define SNMP_INC_STATS(mib, field) \ | 148 | #define SNMP_INC_STATS(mib, field) \ |
142 | (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]++) | 149 | do { \ |
150 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]++; \ | ||
151 | put_cpu(); \ | ||
152 | } while (0) | ||
143 | #define SNMP_DEC_STATS(mib, field) \ | 153 | #define SNMP_DEC_STATS(mib, field) \ |
144 | (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]--) | 154 | do { \ |
155 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ | ||
156 | put_cpu(); \ | ||
157 | } while (0) | ||
145 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ | 158 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
146 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) | 159 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) |
147 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | 160 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
148 | (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field] += addend) | 161 | do { \ |
162 | per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ | ||
163 | put_cpu(); \ | ||
164 | } while (0) | ||
149 | 165 | ||
150 | #endif | 166 | #endif |
diff --git a/include/net/sock.h b/include/net/sock.h index 6e1542da33a1..902324488d0f 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/module.h> | 47 | #include <linux/module.h> |
48 | #include <linux/lockdep.h> | 48 | #include <linux/lockdep.h> |
49 | #include <linux/netdevice.h> | 49 | #include <linux/netdevice.h> |
50 | #include <linux/pcounter.h> | ||
50 | #include <linux/skbuff.h> /* struct sk_buff */ | 51 | #include <linux/skbuff.h> /* struct sk_buff */ |
51 | #include <linux/mm.h> | 52 | #include <linux/mm.h> |
52 | #include <linux/security.h> | 53 | #include <linux/security.h> |
@@ -56,7 +57,6 @@ | |||
56 | #include <asm/atomic.h> | 57 | #include <asm/atomic.h> |
57 | #include <net/dst.h> | 58 | #include <net/dst.h> |
58 | #include <net/checksum.h> | 59 | #include <net/checksum.h> |
59 | #include <net/net_namespace.h> | ||
60 | 60 | ||
61 | /* | 61 | /* |
62 | * This structure really needs to be cleaned up. | 62 | * This structure really needs to be cleaned up. |
@@ -94,6 +94,7 @@ typedef struct { | |||
94 | 94 | ||
95 | struct sock; | 95 | struct sock; |
96 | struct proto; | 96 | struct proto; |
97 | struct net; | ||
97 | 98 | ||
98 | /** | 99 | /** |
99 | * struct sock_common - minimal network layer representation of sockets | 100 | * struct sock_common - minimal network layer representation of sockets |
@@ -145,7 +146,8 @@ struct sock_common { | |||
145 | * @sk_forward_alloc: space allocated forward | 146 | * @sk_forward_alloc: space allocated forward |
146 | * @sk_allocation: allocation mode | 147 | * @sk_allocation: allocation mode |
147 | * @sk_sndbuf: size of send buffer in bytes | 148 | * @sk_sndbuf: size of send buffer in bytes |
148 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, %SO_OOBINLINE settings | 149 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, |
150 | * %SO_OOBINLINE settings | ||
149 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets | 151 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets |
150 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) | 152 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) |
151 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) | 153 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) |
@@ -153,9 +155,12 @@ struct sock_common { | |||
153 | * @sk_backlog: always used with the per-socket spinlock held | 155 | * @sk_backlog: always used with the per-socket spinlock held |
154 | * @sk_callback_lock: used with the callbacks in the end of this struct | 156 | * @sk_callback_lock: used with the callbacks in the end of this struct |
155 | * @sk_error_queue: rarely used | 157 | * @sk_error_queue: rarely used |
156 | * @sk_prot_creator: sk_prot of original sock creator (see ipv6_setsockopt, IPV6_ADDRFORM for instance) | 158 | * @sk_prot_creator: sk_prot of original sock creator (see ipv6_setsockopt, |
159 | * IPV6_ADDRFORM for instance) | ||
157 | * @sk_err: last error | 160 | * @sk_err: last error |
158 | * @sk_err_soft: errors that don't cause failure but are the cause of a persistent failure not just 'timed out' | 161 | * @sk_err_soft: errors that don't cause failure but are the cause of a |
162 | * persistent failure not just 'timed out' | ||
163 | * @sk_drops: raw drops counter | ||
159 | * @sk_ack_backlog: current listen backlog | 164 | * @sk_ack_backlog: current listen backlog |
160 | * @sk_max_ack_backlog: listen backlog set in listen() | 165 | * @sk_max_ack_backlog: listen backlog set in listen() |
161 | * @sk_priority: %SO_PRIORITY setting | 166 | * @sk_priority: %SO_PRIORITY setting |
@@ -239,6 +244,7 @@ struct sock { | |||
239 | rwlock_t sk_callback_lock; | 244 | rwlock_t sk_callback_lock; |
240 | int sk_err, | 245 | int sk_err, |
241 | sk_err_soft; | 246 | sk_err_soft; |
247 | atomic_t sk_drops; | ||
242 | unsigned short sk_ack_backlog; | 248 | unsigned short sk_ack_backlog; |
243 | unsigned short sk_max_ack_backlog; | 249 | unsigned short sk_max_ack_backlog; |
244 | __u32 sk_priority; | 250 | __u32 sk_priority; |
@@ -439,7 +445,7 @@ static inline int sk_acceptq_is_full(struct sock *sk) | |||
439 | */ | 445 | */ |
440 | static inline int sk_stream_min_wspace(struct sock *sk) | 446 | static inline int sk_stream_min_wspace(struct sock *sk) |
441 | { | 447 | { |
442 | return sk->sk_wmem_queued / 2; | 448 | return sk->sk_wmem_queued >> 1; |
443 | } | 449 | } |
444 | 450 | ||
445 | static inline int sk_stream_wspace(struct sock *sk) | 451 | static inline int sk_stream_wspace(struct sock *sk) |
@@ -454,25 +460,6 @@ static inline int sk_stream_memory_free(struct sock *sk) | |||
454 | return sk->sk_wmem_queued < sk->sk_sndbuf; | 460 | return sk->sk_wmem_queued < sk->sk_sndbuf; |
455 | } | 461 | } |
456 | 462 | ||
457 | extern void sk_stream_rfree(struct sk_buff *skb); | ||
458 | |||
459 | static inline void sk_stream_set_owner_r(struct sk_buff *skb, struct sock *sk) | ||
460 | { | ||
461 | skb->sk = sk; | ||
462 | skb->destructor = sk_stream_rfree; | ||
463 | atomic_add(skb->truesize, &sk->sk_rmem_alloc); | ||
464 | sk->sk_forward_alloc -= skb->truesize; | ||
465 | } | ||
466 | |||
467 | static inline void sk_stream_free_skb(struct sock *sk, struct sk_buff *skb) | ||
468 | { | ||
469 | skb_truesize_check(skb); | ||
470 | sock_set_flag(sk, SOCK_QUEUE_SHRUNK); | ||
471 | sk->sk_wmem_queued -= skb->truesize; | ||
472 | sk->sk_forward_alloc += skb->truesize; | ||
473 | __kfree_skb(skb); | ||
474 | } | ||
475 | |||
476 | /* The per-socket spinlock must be held here. */ | 463 | /* The per-socket spinlock must be held here. */ |
477 | static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) | 464 | static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) |
478 | { | 465 | { |
@@ -560,14 +547,11 @@ struct proto { | |||
560 | void (*unhash)(struct sock *sk); | 547 | void (*unhash)(struct sock *sk); |
561 | int (*get_port)(struct sock *sk, unsigned short snum); | 548 | int (*get_port)(struct sock *sk, unsigned short snum); |
562 | 549 | ||
563 | #ifdef CONFIG_SMP | ||
564 | /* Keeping track of sockets in use */ | 550 | /* Keeping track of sockets in use */ |
565 | void (*inuse_add)(struct proto *prot, int inc); | 551 | #ifdef CONFIG_PROC_FS |
566 | int (*inuse_getval)(const struct proto *prot); | 552 | struct pcounter inuse; |
567 | int *inuse_ptr; | ||
568 | #else | ||
569 | int inuse; | ||
570 | #endif | 553 | #endif |
554 | |||
571 | /* Memory pressure */ | 555 | /* Memory pressure */ |
572 | void (*enter_memory_pressure)(void); | 556 | void (*enter_memory_pressure)(void); |
573 | atomic_t *memory_allocated; /* Current allocated memory. */ | 557 | atomic_t *memory_allocated; /* Current allocated memory. */ |
@@ -575,7 +559,7 @@ struct proto { | |||
575 | /* | 559 | /* |
576 | * Pressure flag: try to collapse. | 560 | * Pressure flag: try to collapse. |
577 | * Technical note: it is used by multiple contexts non atomically. | 561 | * Technical note: it is used by multiple contexts non atomically. |
578 | * All the sk_stream_mem_schedule() is of this nature: accounting | 562 | * All the __sk_mem_schedule() is of this nature: accounting |
579 | * is strict, actions are advisory and have some latency. | 563 | * is strict, actions are advisory and have some latency. |
580 | */ | 564 | */ |
581 | int *memory_pressure; | 565 | int *memory_pressure; |
@@ -602,36 +586,6 @@ struct proto { | |||
602 | #endif | 586 | #endif |
603 | }; | 587 | }; |
604 | 588 | ||
605 | /* | ||
606 | * Special macros to let protos use a fast version of inuse{get|add} | ||
607 | * using a static percpu variable per proto instead of an allocated one, | ||
608 | * saving one dereference. | ||
609 | * This might be changed if/when dynamic percpu vars become fast. | ||
610 | */ | ||
611 | #ifdef CONFIG_SMP | ||
612 | # define DEFINE_PROTO_INUSE(NAME) \ | ||
613 | static DEFINE_PER_CPU(int, NAME##_inuse); \ | ||
614 | static void NAME##_inuse_add(struct proto *prot, int inc) \ | ||
615 | { \ | ||
616 | __get_cpu_var(NAME##_inuse) += inc; \ | ||
617 | } \ | ||
618 | \ | ||
619 | static int NAME##_inuse_getval(const struct proto *prot)\ | ||
620 | { \ | ||
621 | int res = 0, cpu; \ | ||
622 | \ | ||
623 | for_each_possible_cpu(cpu) \ | ||
624 | res += per_cpu(NAME##_inuse, cpu); \ | ||
625 | return res; \ | ||
626 | } | ||
627 | # define REF_PROTO_INUSE(NAME) \ | ||
628 | .inuse_add = NAME##_inuse_add, \ | ||
629 | .inuse_getval = NAME##_inuse_getval, | ||
630 | #else | ||
631 | # define DEFINE_PROTO_INUSE(NAME) | ||
632 | # define REF_PROTO_INUSE(NAME) | ||
633 | #endif | ||
634 | |||
635 | extern int proto_register(struct proto *prot, int alloc_slab); | 589 | extern int proto_register(struct proto *prot, int alloc_slab); |
636 | extern void proto_unregister(struct proto *prot); | 590 | extern void proto_unregister(struct proto *prot); |
637 | 591 | ||
@@ -660,33 +614,42 @@ static inline void sk_refcnt_debug_release(const struct sock *sk) | |||
660 | #define sk_refcnt_debug_release(sk) do { } while (0) | 614 | #define sk_refcnt_debug_release(sk) do { } while (0) |
661 | #endif /* SOCK_REFCNT_DEBUG */ | 615 | #endif /* SOCK_REFCNT_DEBUG */ |
662 | 616 | ||
617 | |||
618 | #ifdef CONFIG_PROC_FS | ||
619 | # define DEFINE_PROTO_INUSE(NAME) DEFINE_PCOUNTER(NAME) | ||
620 | # define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse) | ||
663 | /* Called with local bh disabled */ | 621 | /* Called with local bh disabled */ |
664 | static __inline__ void sock_prot_inc_use(struct proto *prot) | 622 | static inline void sock_prot_inuse_add(struct proto *prot, int inc) |
665 | { | 623 | { |
666 | #ifdef CONFIG_SMP | 624 | pcounter_add(&prot->inuse, inc); |
667 | prot->inuse_add(prot, 1); | ||
668 | #else | ||
669 | prot->inuse++; | ||
670 | #endif | ||
671 | } | 625 | } |
672 | 626 | static inline int sock_prot_inuse_init(struct proto *proto) | |
673 | static __inline__ void sock_prot_dec_use(struct proto *prot) | ||
674 | { | 627 | { |
675 | #ifdef CONFIG_SMP | 628 | return pcounter_alloc(&proto->inuse); |
676 | prot->inuse_add(prot, -1); | ||
677 | #else | ||
678 | prot->inuse--; | ||
679 | #endif | ||
680 | } | 629 | } |
681 | 630 | static inline int sock_prot_inuse_get(struct proto *proto) | |
682 | static __inline__ int sock_prot_inuse(struct proto *proto) | ||
683 | { | 631 | { |
684 | #ifdef CONFIG_SMP | 632 | return pcounter_getval(&proto->inuse); |
685 | return proto->inuse_getval(proto); | 633 | } |
634 | static inline void sock_prot_inuse_free(struct proto *proto) | ||
635 | { | ||
636 | pcounter_free(&proto->inuse); | ||
637 | } | ||
686 | #else | 638 | #else |
687 | return proto->inuse; | 639 | # define DEFINE_PROTO_INUSE(NAME) |
688 | #endif | 640 | # define REF_PROTO_INUSE(NAME) |
641 | static void inline sock_prot_inuse_add(struct proto *prot, int inc) | ||
642 | { | ||
643 | } | ||
644 | static int inline sock_prot_inuse_init(struct proto *proto) | ||
645 | { | ||
646 | return 0; | ||
689 | } | 647 | } |
648 | static void inline sock_prot_inuse_free(struct proto *proto) | ||
649 | { | ||
650 | } | ||
651 | #endif | ||
652 | |||
690 | 653 | ||
691 | /* With per-bucket locks this operation is not-atomic, so that | 654 | /* With per-bucket locks this operation is not-atomic, so that |
692 | * this version is not worse. | 655 | * this version is not worse. |
@@ -750,32 +713,81 @@ static inline struct inode *SOCK_INODE(struct socket *socket) | |||
750 | return &container_of(socket, struct socket_alloc, socket)->vfs_inode; | 713 | return &container_of(socket, struct socket_alloc, socket)->vfs_inode; |
751 | } | 714 | } |
752 | 715 | ||
753 | extern void __sk_stream_mem_reclaim(struct sock *sk); | 716 | /* |
754 | extern int sk_stream_mem_schedule(struct sock *sk, int size, int kind); | 717 | * Functions for memory accounting |
718 | */ | ||
719 | extern int __sk_mem_schedule(struct sock *sk, int size, int kind); | ||
720 | extern void __sk_mem_reclaim(struct sock *sk); | ||
755 | 721 | ||
756 | #define SK_STREAM_MEM_QUANTUM ((int)PAGE_SIZE) | 722 | #define SK_MEM_QUANTUM ((int)PAGE_SIZE) |
723 | #define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM) | ||
724 | #define SK_MEM_SEND 0 | ||
725 | #define SK_MEM_RECV 1 | ||
757 | 726 | ||
758 | static inline int sk_stream_pages(int amt) | 727 | static inline int sk_mem_pages(int amt) |
759 | { | 728 | { |
760 | return DIV_ROUND_UP(amt, SK_STREAM_MEM_QUANTUM); | 729 | return (amt + SK_MEM_QUANTUM - 1) >> SK_MEM_QUANTUM_SHIFT; |
761 | } | 730 | } |
762 | 731 | ||
763 | static inline void sk_stream_mem_reclaim(struct sock *sk) | 732 | static inline int sk_has_account(struct sock *sk) |
764 | { | 733 | { |
765 | if (sk->sk_forward_alloc >= SK_STREAM_MEM_QUANTUM) | 734 | /* return true if protocol supports memory accounting */ |
766 | __sk_stream_mem_reclaim(sk); | 735 | return !!sk->sk_prot->memory_allocated; |
767 | } | 736 | } |
768 | 737 | ||
769 | static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb) | 738 | static inline int sk_wmem_schedule(struct sock *sk, int size) |
770 | { | 739 | { |
771 | return (int)skb->truesize <= sk->sk_forward_alloc || | 740 | if (!sk_has_account(sk)) |
772 | sk_stream_mem_schedule(sk, skb->truesize, 1); | 741 | return 1; |
742 | return size <= sk->sk_forward_alloc || | ||
743 | __sk_mem_schedule(sk, size, SK_MEM_SEND); | ||
773 | } | 744 | } |
774 | 745 | ||
775 | static inline int sk_stream_wmem_schedule(struct sock *sk, int size) | 746 | static inline int sk_rmem_schedule(struct sock *sk, int size) |
776 | { | 747 | { |
748 | if (!sk_has_account(sk)) | ||
749 | return 1; | ||
777 | return size <= sk->sk_forward_alloc || | 750 | return size <= sk->sk_forward_alloc || |
778 | sk_stream_mem_schedule(sk, size, 0); | 751 | __sk_mem_schedule(sk, size, SK_MEM_RECV); |
752 | } | ||
753 | |||
754 | static inline void sk_mem_reclaim(struct sock *sk) | ||
755 | { | ||
756 | if (!sk_has_account(sk)) | ||
757 | return; | ||
758 | if (sk->sk_forward_alloc >= SK_MEM_QUANTUM) | ||
759 | __sk_mem_reclaim(sk); | ||
760 | } | ||
761 | |||
762 | static inline void sk_mem_reclaim_partial(struct sock *sk) | ||
763 | { | ||
764 | if (!sk_has_account(sk)) | ||
765 | return; | ||
766 | if (sk->sk_forward_alloc > SK_MEM_QUANTUM) | ||
767 | __sk_mem_reclaim(sk); | ||
768 | } | ||
769 | |||
770 | static inline void sk_mem_charge(struct sock *sk, int size) | ||
771 | { | ||
772 | if (!sk_has_account(sk)) | ||
773 | return; | ||
774 | sk->sk_forward_alloc -= size; | ||
775 | } | ||
776 | |||
777 | static inline void sk_mem_uncharge(struct sock *sk, int size) | ||
778 | { | ||
779 | if (!sk_has_account(sk)) | ||
780 | return; | ||
781 | sk->sk_forward_alloc += size; | ||
782 | } | ||
783 | |||
784 | static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) | ||
785 | { | ||
786 | skb_truesize_check(skb); | ||
787 | sock_set_flag(sk, SOCK_QUEUE_SHRUNK); | ||
788 | sk->sk_wmem_queued -= skb->truesize; | ||
789 | sk_mem_uncharge(sk, skb->truesize); | ||
790 | __kfree_skb(skb); | ||
779 | } | 791 | } |
780 | 792 | ||
781 | /* Used by processes to "lock" a socket state, so that | 793 | /* Used by processes to "lock" a socket state, so that |
@@ -812,14 +824,14 @@ do { \ | |||
812 | lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ | 824 | lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ |
813 | } while (0) | 825 | } while (0) |
814 | 826 | ||
815 | extern void FASTCALL(lock_sock_nested(struct sock *sk, int subclass)); | 827 | extern void lock_sock_nested(struct sock *sk, int subclass); |
816 | 828 | ||
817 | static inline void lock_sock(struct sock *sk) | 829 | static inline void lock_sock(struct sock *sk) |
818 | { | 830 | { |
819 | lock_sock_nested(sk, 0); | 831 | lock_sock_nested(sk, 0); |
820 | } | 832 | } |
821 | 833 | ||
822 | extern void FASTCALL(release_sock(struct sock *sk)); | 834 | extern void release_sock(struct sock *sk); |
823 | 835 | ||
824 | /* BH context may only use the following locking interface. */ | 836 | /* BH context may only use the following locking interface. */ |
825 | #define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) | 837 | #define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) |
@@ -1113,12 +1125,6 @@ static inline int sk_can_gso(const struct sock *sk) | |||
1113 | 1125 | ||
1114 | extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); | 1126 | extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); |
1115 | 1127 | ||
1116 | static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) | ||
1117 | { | ||
1118 | sk->sk_wmem_queued += skb->truesize; | ||
1119 | sk->sk_forward_alloc -= skb->truesize; | ||
1120 | } | ||
1121 | |||
1122 | static inline int skb_copy_to_page(struct sock *sk, char __user *from, | 1128 | static inline int skb_copy_to_page(struct sock *sk, char __user *from, |
1123 | struct sk_buff *skb, struct page *page, | 1129 | struct sk_buff *skb, struct page *page, |
1124 | int off, int copy) | 1130 | int off, int copy) |
@@ -1138,7 +1144,7 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from, | |||
1138 | skb->data_len += copy; | 1144 | skb->data_len += copy; |
1139 | skb->truesize += copy; | 1145 | skb->truesize += copy; |
1140 | sk->sk_wmem_queued += copy; | 1146 | sk->sk_wmem_queued += copy; |
1141 | sk->sk_forward_alloc -= copy; | 1147 | sk_mem_charge(sk, copy); |
1142 | return 0; | 1148 | return 0; |
1143 | } | 1149 | } |
1144 | 1150 | ||
@@ -1164,6 +1170,7 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) | |||
1164 | skb->sk = sk; | 1170 | skb->sk = sk; |
1165 | skb->destructor = sock_rfree; | 1171 | skb->destructor = sock_rfree; |
1166 | atomic_add(skb->truesize, &sk->sk_rmem_alloc); | 1172 | atomic_add(skb->truesize, &sk->sk_rmem_alloc); |
1173 | sk_mem_charge(sk, skb->truesize); | ||
1167 | } | 1174 | } |
1168 | 1175 | ||
1169 | extern void sk_reset_timer(struct sock *sk, struct timer_list* timer, | 1176 | extern void sk_reset_timer(struct sock *sk, struct timer_list* timer, |
@@ -1225,45 +1232,12 @@ static inline void sk_wake_async(struct sock *sk, int how, int band) | |||
1225 | static inline void sk_stream_moderate_sndbuf(struct sock *sk) | 1232 | static inline void sk_stream_moderate_sndbuf(struct sock *sk) |
1226 | { | 1233 | { |
1227 | if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) { | 1234 | if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) { |
1228 | sk->sk_sndbuf = min(sk->sk_sndbuf, sk->sk_wmem_queued / 2); | 1235 | sk->sk_sndbuf = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1); |
1229 | sk->sk_sndbuf = max(sk->sk_sndbuf, SOCK_MIN_SNDBUF); | 1236 | sk->sk_sndbuf = max(sk->sk_sndbuf, SOCK_MIN_SNDBUF); |
1230 | } | 1237 | } |
1231 | } | 1238 | } |
1232 | 1239 | ||
1233 | static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, | 1240 | struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp); |
1234 | int size, int mem, | ||
1235 | gfp_t gfp) | ||
1236 | { | ||
1237 | struct sk_buff *skb; | ||
1238 | |||
1239 | /* The TCP header must be at least 32-bit aligned. */ | ||
1240 | size = ALIGN(size, 4); | ||
1241 | |||
1242 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); | ||
1243 | if (skb) { | ||
1244 | skb->truesize += mem; | ||
1245 | if (sk_stream_wmem_schedule(sk, skb->truesize)) { | ||
1246 | /* | ||
1247 | * Make sure that we have exactly size bytes | ||
1248 | * available to the caller, no more, no less. | ||
1249 | */ | ||
1250 | skb_reserve(skb, skb_tailroom(skb) - size); | ||
1251 | return skb; | ||
1252 | } | ||
1253 | __kfree_skb(skb); | ||
1254 | } else { | ||
1255 | sk->sk_prot->enter_memory_pressure(); | ||
1256 | sk_stream_moderate_sndbuf(sk); | ||
1257 | } | ||
1258 | return NULL; | ||
1259 | } | ||
1260 | |||
1261 | static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk, | ||
1262 | int size, | ||
1263 | gfp_t gfp) | ||
1264 | { | ||
1265 | return sk_stream_alloc_pskb(sk, size, 0, gfp); | ||
1266 | } | ||
1267 | 1241 | ||
1268 | static inline struct page *sk_stream_alloc_page(struct sock *sk) | 1242 | static inline struct page *sk_stream_alloc_page(struct sock *sk) |
1269 | { | 1243 | { |
@@ -1282,7 +1256,7 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk) | |||
1282 | */ | 1256 | */ |
1283 | static inline int sock_writeable(const struct sock *sk) | 1257 | static inline int sock_writeable(const struct sock *sk) |
1284 | { | 1258 | { |
1285 | return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2); | 1259 | return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf >> 1); |
1286 | } | 1260 | } |
1287 | 1261 | ||
1288 | static inline gfp_t gfp_any(void) | 1262 | static inline gfp_t gfp_any(void) |
@@ -1391,23 +1365,11 @@ extern int net_msg_warn; | |||
1391 | lock_sock(sk); \ | 1365 | lock_sock(sk); \ |
1392 | } | 1366 | } |
1393 | 1367 | ||
1394 | static inline void sock_valbool_flag(struct sock *sk, int bit, int valbool) | ||
1395 | { | ||
1396 | if (valbool) | ||
1397 | sock_set_flag(sk, bit); | ||
1398 | else | ||
1399 | sock_reset_flag(sk, bit); | ||
1400 | } | ||
1401 | |||
1402 | extern __u32 sysctl_wmem_max; | 1368 | extern __u32 sysctl_wmem_max; |
1403 | extern __u32 sysctl_rmem_max; | 1369 | extern __u32 sysctl_rmem_max; |
1404 | 1370 | ||
1405 | extern void sk_init(void); | 1371 | extern void sk_init(void); |
1406 | 1372 | ||
1407 | #ifdef CONFIG_SYSCTL | ||
1408 | extern struct ctl_table core_table[]; | ||
1409 | #endif | ||
1410 | |||
1411 | extern int sysctl_optmem_max; | 1373 | extern int sysctl_optmem_max; |
1412 | 1374 | ||
1413 | extern __u32 sysctl_wmem_default; | 1375 | extern __u32 sysctl_wmem_default; |
diff --git a/include/net/tcp.h b/include/net/tcp.h index cb5b033e0e59..7de4ea3a04d9 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -309,6 +309,9 @@ extern int tcp_twsk_unique(struct sock *sk, | |||
309 | 309 | ||
310 | extern void tcp_twsk_destructor(struct sock *sk); | 310 | extern void tcp_twsk_destructor(struct sock *sk); |
311 | 311 | ||
312 | extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, | ||
313 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); | ||
314 | |||
312 | static inline void tcp_dec_quickack_mode(struct sock *sk, | 315 | static inline void tcp_dec_quickack_mode(struct sock *sk, |
313 | const unsigned int pkts) | 316 | const unsigned int pkts) |
314 | { | 317 | { |
@@ -575,10 +578,6 @@ struct tcp_skb_cb { | |||
575 | #define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ | 578 | #define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ |
576 | #define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) | 579 | #define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) |
577 | 580 | ||
578 | #define TCPCB_URG 0x20 /* Urgent pointer advanced here */ | ||
579 | |||
580 | #define TCPCB_AT_TAIL (TCPCB_URG) | ||
581 | |||
582 | __u16 urg_ptr; /* Valid w/URG flags is set. */ | 581 | __u16 urg_ptr; /* Valid w/URG flags is set. */ |
583 | __u32 ack_seq; /* Sequence number ACK'd */ | 582 | __u32 ack_seq; /* Sequence number ACK'd */ |
584 | }; | 583 | }; |
@@ -649,7 +648,7 @@ struct tcp_congestion_ops { | |||
649 | /* lower bound for congestion window (optional) */ | 648 | /* lower bound for congestion window (optional) */ |
650 | u32 (*min_cwnd)(const struct sock *sk); | 649 | u32 (*min_cwnd)(const struct sock *sk); |
651 | /* do new cwnd calculation (required) */ | 650 | /* do new cwnd calculation (required) */ |
652 | void (*cong_avoid)(struct sock *sk, u32 ack, u32 in_flight, int good_ack); | 651 | void (*cong_avoid)(struct sock *sk, u32 ack, u32 in_flight); |
653 | /* call before changing ca_state (optional) */ | 652 | /* call before changing ca_state (optional) */ |
654 | void (*set_state)(struct sock *sk, u8 new_state); | 653 | void (*set_state)(struct sock *sk, u8 new_state); |
655 | /* call when cwnd event occurs (optional) */ | 654 | /* call when cwnd event occurs (optional) */ |
@@ -680,7 +679,7 @@ extern void tcp_slow_start(struct tcp_sock *tp); | |||
680 | 679 | ||
681 | extern struct tcp_congestion_ops tcp_init_congestion_ops; | 680 | extern struct tcp_congestion_ops tcp_init_congestion_ops; |
682 | extern u32 tcp_reno_ssthresh(struct sock *sk); | 681 | extern u32 tcp_reno_ssthresh(struct sock *sk); |
683 | extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight, int flag); | 682 | extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight); |
684 | extern u32 tcp_reno_min_cwnd(const struct sock *sk); | 683 | extern u32 tcp_reno_min_cwnd(const struct sock *sk); |
685 | extern struct tcp_congestion_ops tcp_reno; | 684 | extern struct tcp_congestion_ops tcp_reno; |
686 | 685 | ||
@@ -782,26 +781,12 @@ static __inline__ __u32 tcp_max_burst(const struct tcp_sock *tp) | |||
782 | return 3; | 781 | return 3; |
783 | } | 782 | } |
784 | 783 | ||
785 | /* RFC2861 Check whether we are limited by application or congestion window | 784 | /* Returns end sequence number of the receiver's advertised window */ |
786 | * This is the inverse of cwnd check in tcp_tso_should_defer | 785 | static inline u32 tcp_wnd_end(const struct tcp_sock *tp) |
787 | */ | ||
788 | static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight) | ||
789 | { | 786 | { |
790 | const struct tcp_sock *tp = tcp_sk(sk); | 787 | return tp->snd_una + tp->snd_wnd; |
791 | u32 left; | ||
792 | |||
793 | if (in_flight >= tp->snd_cwnd) | ||
794 | return 1; | ||
795 | |||
796 | if (!sk_can_gso(sk)) | ||
797 | return 0; | ||
798 | |||
799 | left = tp->snd_cwnd - in_flight; | ||
800 | if (sysctl_tcp_tso_win_divisor) | ||
801 | return left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd; | ||
802 | else | ||
803 | return left <= tcp_max_burst(tp); | ||
804 | } | 788 | } |
789 | extern int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); | ||
805 | 790 | ||
806 | static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, | 791 | static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, |
807 | const struct sk_buff *skb) | 792 | const struct sk_buff *skb) |
@@ -921,40 +906,7 @@ static const char *statename[]={ | |||
921 | "Close Wait","Last ACK","Listen","Closing" | 906 | "Close Wait","Last ACK","Listen","Closing" |
922 | }; | 907 | }; |
923 | #endif | 908 | #endif |
924 | 909 | extern void tcp_set_state(struct sock *sk, int state); | |
925 | static inline void tcp_set_state(struct sock *sk, int state) | ||
926 | { | ||
927 | int oldstate = sk->sk_state; | ||
928 | |||
929 | switch (state) { | ||
930 | case TCP_ESTABLISHED: | ||
931 | if (oldstate != TCP_ESTABLISHED) | ||
932 | TCP_INC_STATS(TCP_MIB_CURRESTAB); | ||
933 | break; | ||
934 | |||
935 | case TCP_CLOSE: | ||
936 | if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED) | ||
937 | TCP_INC_STATS(TCP_MIB_ESTABRESETS); | ||
938 | |||
939 | sk->sk_prot->unhash(sk); | ||
940 | if (inet_csk(sk)->icsk_bind_hash && | ||
941 | !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) | ||
942 | inet_put_port(&tcp_hashinfo, sk); | ||
943 | /* fall through */ | ||
944 | default: | ||
945 | if (oldstate==TCP_ESTABLISHED) | ||
946 | TCP_DEC_STATS(TCP_MIB_CURRESTAB); | ||
947 | } | ||
948 | |||
949 | /* Change state AFTER socket is unhashed to avoid closed | ||
950 | * socket sitting in hash tables. | ||
951 | */ | ||
952 | sk->sk_state = state; | ||
953 | |||
954 | #ifdef STATE_TRACE | ||
955 | SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]); | ||
956 | #endif | ||
957 | } | ||
958 | 910 | ||
959 | extern void tcp_done(struct sock *sk); | 911 | extern void tcp_done(struct sock *sk); |
960 | 912 | ||
@@ -1078,7 +1030,6 @@ static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp) | |||
1078 | static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) | 1030 | static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) |
1079 | { | 1031 | { |
1080 | tcp_clear_retrans_hints_partial(tp); | 1032 | tcp_clear_retrans_hints_partial(tp); |
1081 | tp->fastpath_skb_hint = NULL; | ||
1082 | } | 1033 | } |
1083 | 1034 | ||
1084 | /* MD5 Signature */ | 1035 | /* MD5 Signature */ |
@@ -1153,7 +1104,8 @@ extern int tcp_v4_calc_md5_hash(char *md5_hash, | |||
1153 | struct dst_entry *dst, | 1104 | struct dst_entry *dst, |
1154 | struct request_sock *req, | 1105 | struct request_sock *req, |
1155 | struct tcphdr *th, | 1106 | struct tcphdr *th, |
1156 | int protocol, int tcplen); | 1107 | int protocol, |
1108 | unsigned int tcplen); | ||
1157 | extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, | 1109 | extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, |
1158 | struct sock *addr_sk); | 1110 | struct sock *addr_sk); |
1159 | 1111 | ||
@@ -1193,8 +1145,8 @@ static inline void tcp_write_queue_purge(struct sock *sk) | |||
1193 | struct sk_buff *skb; | 1145 | struct sk_buff *skb; |
1194 | 1146 | ||
1195 | while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) | 1147 | while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) |
1196 | sk_stream_free_skb(sk, skb); | 1148 | sk_wmem_free_skb(sk, skb); |
1197 | sk_stream_mem_reclaim(sk); | 1149 | sk_mem_reclaim(sk); |
1198 | } | 1150 | } |
1199 | 1151 | ||
1200 | static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) | 1152 | static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) |
@@ -1227,6 +1179,11 @@ static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_bu | |||
1227 | for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\ | 1179 | for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\ |
1228 | skb = skb->next) | 1180 | skb = skb->next) |
1229 | 1181 | ||
1182 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ | ||
1183 | for (tmp = skb->next; \ | ||
1184 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ | ||
1185 | skb = tmp, tmp = skb->next) | ||
1186 | |||
1230 | static inline struct sk_buff *tcp_send_head(struct sock *sk) | 1187 | static inline struct sk_buff *tcp_send_head(struct sock *sk) |
1231 | { | 1188 | { |
1232 | return sk->sk_send_head; | 1189 | return sk->sk_send_head; |
@@ -1234,14 +1191,9 @@ static inline struct sk_buff *tcp_send_head(struct sock *sk) | |||
1234 | 1191 | ||
1235 | static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb) | 1192 | static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb) |
1236 | { | 1193 | { |
1237 | struct tcp_sock *tp = tcp_sk(sk); | ||
1238 | |||
1239 | sk->sk_send_head = skb->next; | 1194 | sk->sk_send_head = skb->next; |
1240 | if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue) | 1195 | if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue) |
1241 | sk->sk_send_head = NULL; | 1196 | sk->sk_send_head = NULL; |
1242 | /* Don't override Nagle indefinately with F-RTO */ | ||
1243 | if (tp->frto_counter == 2) | ||
1244 | tp->frto_counter = 3; | ||
1245 | } | 1197 | } |
1246 | 1198 | ||
1247 | static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked) | 1199 | static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked) |
@@ -1265,8 +1217,12 @@ static inline void tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb | |||
1265 | __tcp_add_write_queue_tail(sk, skb); | 1217 | __tcp_add_write_queue_tail(sk, skb); |
1266 | 1218 | ||
1267 | /* Queue it, remembering where we must start sending. */ | 1219 | /* Queue it, remembering where we must start sending. */ |
1268 | if (sk->sk_send_head == NULL) | 1220 | if (sk->sk_send_head == NULL) { |
1269 | sk->sk_send_head = skb; | 1221 | sk->sk_send_head = skb; |
1222 | |||
1223 | if (tcp_sk(sk)->highest_sack == NULL) | ||
1224 | tcp_sk(sk)->highest_sack = skb; | ||
1225 | } | ||
1270 | } | 1226 | } |
1271 | 1227 | ||
1272 | static inline void __tcp_add_write_queue_head(struct sock *sk, struct sk_buff *skb) | 1228 | static inline void __tcp_add_write_queue_head(struct sock *sk, struct sk_buff *skb) |
@@ -1309,6 +1265,45 @@ static inline int tcp_write_queue_empty(struct sock *sk) | |||
1309 | return skb_queue_empty(&sk->sk_write_queue); | 1265 | return skb_queue_empty(&sk->sk_write_queue); |
1310 | } | 1266 | } |
1311 | 1267 | ||
1268 | /* Start sequence of the highest skb with SACKed bit, valid only if | ||
1269 | * sacked > 0 or when the caller has ensured validity by itself. | ||
1270 | */ | ||
1271 | static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp) | ||
1272 | { | ||
1273 | if (!tp->sacked_out) | ||
1274 | return tp->snd_una; | ||
1275 | |||
1276 | if (tp->highest_sack == NULL) | ||
1277 | return tp->snd_nxt; | ||
1278 | |||
1279 | return TCP_SKB_CB(tp->highest_sack)->seq; | ||
1280 | } | ||
1281 | |||
1282 | static inline void tcp_advance_highest_sack(struct sock *sk, struct sk_buff *skb) | ||
1283 | { | ||
1284 | tcp_sk(sk)->highest_sack = tcp_skb_is_last(sk, skb) ? NULL : | ||
1285 | tcp_write_queue_next(sk, skb); | ||
1286 | } | ||
1287 | |||
1288 | static inline struct sk_buff *tcp_highest_sack(struct sock *sk) | ||
1289 | { | ||
1290 | return tcp_sk(sk)->highest_sack; | ||
1291 | } | ||
1292 | |||
1293 | static inline void tcp_highest_sack_reset(struct sock *sk) | ||
1294 | { | ||
1295 | tcp_sk(sk)->highest_sack = tcp_write_queue_head(sk); | ||
1296 | } | ||
1297 | |||
1298 | /* Called when old skb is about to be deleted (to be combined with new skb) */ | ||
1299 | static inline void tcp_highest_sack_combine(struct sock *sk, | ||
1300 | struct sk_buff *old, | ||
1301 | struct sk_buff *new) | ||
1302 | { | ||
1303 | if (tcp_sk(sk)->sacked_out && (old == tcp_sk(sk)->highest_sack)) | ||
1304 | tcp_sk(sk)->highest_sack = new; | ||
1305 | } | ||
1306 | |||
1312 | /* /proc */ | 1307 | /* /proc */ |
1313 | enum tcp_seq_states { | 1308 | enum tcp_seq_states { |
1314 | TCP_SEQ_STATE_LISTENING, | 1309 | TCP_SEQ_STATE_LISTENING, |
@@ -1359,7 +1354,8 @@ struct tcp_sock_af_ops { | |||
1359 | struct dst_entry *dst, | 1354 | struct dst_entry *dst, |
1360 | struct request_sock *req, | 1355 | struct request_sock *req, |
1361 | struct tcphdr *th, | 1356 | struct tcphdr *th, |
1362 | int protocol, int len); | 1357 | int protocol, |
1358 | unsigned int len); | ||
1363 | int (*md5_add) (struct sock *sk, | 1359 | int (*md5_add) (struct sock *sk, |
1364 | struct sock *addr_sk, | 1360 | struct sock *addr_sk, |
1365 | u8 *newkey, | 1361 | u8 *newkey, |
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 409da3a9a455..27394e0447d8 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h | |||
@@ -17,16 +17,20 @@ extern struct proto tcpv6_prot; | |||
17 | struct flowi; | 17 | struct flowi; |
18 | 18 | ||
19 | /* extention headers */ | 19 | /* extention headers */ |
20 | extern void ipv6_rthdr_init(void); | 20 | extern int ipv6_exthdrs_init(void); |
21 | extern void ipv6_frag_init(void); | 21 | extern void ipv6_exthdrs_exit(void); |
22 | extern void ipv6_nodata_init(void); | 22 | extern int ipv6_frag_init(void); |
23 | extern void ipv6_destopt_init(void); | 23 | extern void ipv6_frag_exit(void); |
24 | 24 | ||
25 | /* transport protocols */ | 25 | /* transport protocols */ |
26 | extern void rawv6_init(void); | 26 | extern int rawv6_init(void); |
27 | extern void udpv6_init(void); | 27 | extern void rawv6_exit(void); |
28 | extern void udplitev6_init(void); | 28 | extern int udpv6_init(void); |
29 | extern void tcpv6_init(void); | 29 | extern void udpv6_exit(void); |
30 | extern int udplitev6_init(void); | ||
31 | extern void udplitev6_exit(void); | ||
32 | extern int tcpv6_init(void); | ||
33 | extern void tcpv6_exit(void); | ||
30 | 34 | ||
31 | extern int udpv6_connect(struct sock *sk, | 35 | extern int udpv6_connect(struct sock *sk, |
32 | struct sockaddr *uaddr, | 36 | struct sockaddr *uaddr, |
diff --git a/include/net/udp.h b/include/net/udp.h index 98755ebaf163..c6669c0a74c7 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -65,6 +65,13 @@ extern rwlock_t udp_hash_lock; | |||
65 | 65 | ||
66 | extern struct proto udp_prot; | 66 | extern struct proto udp_prot; |
67 | 67 | ||
68 | extern atomic_t udp_memory_allocated; | ||
69 | |||
70 | /* sysctl variables for udp */ | ||
71 | extern int sysctl_udp_mem[3]; | ||
72 | extern int sysctl_udp_rmem_min; | ||
73 | extern int sysctl_udp_wmem_min; | ||
74 | |||
68 | struct sk_buff; | 75 | struct sk_buff; |
69 | 76 | ||
70 | /* | 77 | /* |
@@ -108,7 +115,7 @@ static inline void udp_lib_unhash(struct sock *sk) | |||
108 | write_lock_bh(&udp_hash_lock); | 115 | write_lock_bh(&udp_hash_lock); |
109 | if (sk_del_node_init(sk)) { | 116 | if (sk_del_node_init(sk)) { |
110 | inet_sk(sk)->num = 0; | 117 | inet_sk(sk)->num = 0; |
111 | sock_prot_dec_use(sk->sk_prot); | 118 | sock_prot_inuse_add(sk->sk_prot, -1); |
112 | } | 119 | } |
113 | write_unlock_bh(&udp_hash_lock); | 120 | write_unlock_bh(&udp_hash_lock); |
114 | } | 121 | } |
@@ -139,6 +146,12 @@ extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, | |||
139 | int (*push_pending_frames)(struct sock *)); | 146 | int (*push_pending_frames)(struct sock *)); |
140 | 147 | ||
141 | DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); | 148 | DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); |
149 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); | ||
150 | |||
151 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ | ||
152 | DECLARE_SNMP_STAT(struct udp_mib, udplite_statistics); | ||
153 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | ||
154 | |||
142 | /* | 155 | /* |
143 | * SNMP statistics for UDP and UDP-Lite | 156 | * SNMP statistics for UDP and UDP-Lite |
144 | */ | 157 | */ |
@@ -149,6 +162,25 @@ DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); | |||
149 | if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \ | 162 | if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \ |
150 | else SNMP_INC_STATS_BH(udp_statistics, field); } while(0) | 163 | else SNMP_INC_STATS_BH(udp_statistics, field); } while(0) |
151 | 164 | ||
165 | #define UDP6_INC_STATS_BH(field, is_udplite) do { \ | ||
166 | if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ | ||
167 | else SNMP_INC_STATS_BH(udp_stats_in6, field); } while(0) | ||
168 | #define UDP6_INC_STATS_USER(field, is_udplite) do { \ | ||
169 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ | ||
170 | else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) | ||
171 | |||
172 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
173 | #define UDPX_INC_STATS_BH(sk, field) \ | ||
174 | do { \ | ||
175 | if ((sk)->sk_family == AF_INET) \ | ||
176 | UDP_INC_STATS_BH(field, 0); \ | ||
177 | else \ | ||
178 | UDP6_INC_STATS_BH(field, 0); \ | ||
179 | } while (0); | ||
180 | #else | ||
181 | #define UDPX_INC_STATS_BH(sk, field) UDP_INC_STATS_BH(field, 0) | ||
182 | #endif | ||
183 | |||
152 | /* /proc */ | 184 | /* /proc */ |
153 | struct udp_seq_afinfo { | 185 | struct udp_seq_afinfo { |
154 | struct module *owner; | 186 | struct module *owner; |
@@ -173,4 +205,6 @@ extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo); | |||
173 | extern int udp4_proc_init(void); | 205 | extern int udp4_proc_init(void); |
174 | extern void udp4_proc_exit(void); | 206 | extern void udp4_proc_exit(void); |
175 | #endif | 207 | #endif |
208 | |||
209 | extern void udp_init(void); | ||
176 | #endif /* _UDP_H */ | 210 | #endif /* _UDP_H */ |
diff --git a/include/net/udplite.h b/include/net/udplite.h index 635b0eafca95..b76b2e377af4 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h | |||
@@ -13,9 +13,6 @@ | |||
13 | extern struct proto udplite_prot; | 13 | extern struct proto udplite_prot; |
14 | extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; | 14 | extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; |
15 | 15 | ||
16 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ | ||
17 | DECLARE_SNMP_STAT(struct udp_mib, udplite_statistics); | ||
18 | |||
19 | /* | 16 | /* |
20 | * Checksum computation is all in software, hence simpler getfrag. | 17 | * Checksum computation is all in software, hence simpler getfrag. |
21 | */ | 18 | */ |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 1dd20cf17982..5ebb9ba479b1 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -19,6 +19,9 @@ | |||
19 | #include <net/route.h> | 19 | #include <net/route.h> |
20 | #include <net/ipv6.h> | 20 | #include <net/ipv6.h> |
21 | #include <net/ip6_fib.h> | 21 | #include <net/ip6_fib.h> |
22 | #ifdef CONFIG_XFRM_STATISTICS | ||
23 | #include <net/snmp.h> | ||
24 | #endif | ||
22 | 25 | ||
23 | #define XFRM_PROTO_ESP 50 | 26 | #define XFRM_PROTO_ESP 50 |
24 | #define XFRM_PROTO_AH 51 | 27 | #define XFRM_PROTO_AH 51 |
@@ -34,6 +37,17 @@ | |||
34 | #define MODULE_ALIAS_XFRM_TYPE(family, proto) \ | 37 | #define MODULE_ALIAS_XFRM_TYPE(family, proto) \ |
35 | MODULE_ALIAS("xfrm-type-" __stringify(family) "-" __stringify(proto)) | 38 | MODULE_ALIAS("xfrm-type-" __stringify(family) "-" __stringify(proto)) |
36 | 39 | ||
40 | #ifdef CONFIG_XFRM_STATISTICS | ||
41 | DECLARE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics); | ||
42 | #define XFRM_INC_STATS(field) SNMP_INC_STATS(xfrm_statistics, field) | ||
43 | #define XFRM_INC_STATS_BH(field) SNMP_INC_STATS_BH(xfrm_statistics, field) | ||
44 | #define XFRM_INC_STATS_USER(field) SNMP_INC_STATS_USER(xfrm_statistics, field) | ||
45 | #else | ||
46 | #define XFRM_INC_STATS(field) | ||
47 | #define XFRM_INC_STATS_BH(field) | ||
48 | #define XFRM_INC_STATS_USER(field) | ||
49 | #endif | ||
50 | |||
37 | extern struct sock *xfrm_nl; | 51 | extern struct sock *xfrm_nl; |
38 | extern u32 sysctl_xfrm_aevent_etime; | 52 | extern u32 sysctl_xfrm_aevent_etime; |
39 | extern u32 sysctl_xfrm_aevent_rseqth; | 53 | extern u32 sysctl_xfrm_aevent_rseqth; |
@@ -183,7 +197,7 @@ struct xfrm_state | |||
183 | struct timer_list timer; | 197 | struct timer_list timer; |
184 | 198 | ||
185 | /* Last used time */ | 199 | /* Last used time */ |
186 | u64 lastused; | 200 | unsigned long lastused; |
187 | 201 | ||
188 | /* Reference to data common to all the instances of this | 202 | /* Reference to data common to all the instances of this |
189 | * transformer. */ | 203 | * transformer. */ |
@@ -227,22 +241,26 @@ struct km_event | |||
227 | u32 event; | 241 | u32 event; |
228 | }; | 242 | }; |
229 | 243 | ||
244 | struct net_device; | ||
230 | struct xfrm_type; | 245 | struct xfrm_type; |
231 | struct xfrm_dst; | 246 | struct xfrm_dst; |
232 | struct xfrm_policy_afinfo { | 247 | struct xfrm_policy_afinfo { |
233 | unsigned short family; | 248 | unsigned short family; |
234 | struct dst_ops *dst_ops; | 249 | struct dst_ops *dst_ops; |
235 | void (*garbage_collect)(void); | 250 | void (*garbage_collect)(void); |
236 | int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); | 251 | struct dst_entry *(*dst_lookup)(int tos, xfrm_address_t *saddr, |
252 | xfrm_address_t *daddr); | ||
237 | int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); | 253 | int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); |
238 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); | 254 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); |
239 | int (*bundle_create)(struct xfrm_policy *policy, | ||
240 | struct xfrm_state **xfrm, | ||
241 | int nx, | ||
242 | struct flowi *fl, | ||
243 | struct dst_entry **dst_p); | ||
244 | void (*decode_session)(struct sk_buff *skb, | 255 | void (*decode_session)(struct sk_buff *skb, |
245 | struct flowi *fl); | 256 | struct flowi *fl, |
257 | int reverse); | ||
258 | int (*get_tos)(struct flowi *fl); | ||
259 | int (*init_path)(struct xfrm_dst *path, | ||
260 | struct dst_entry *dst, | ||
261 | int nfheader_len); | ||
262 | int (*fill_dst)(struct xfrm_dst *xdst, | ||
263 | struct net_device *dev); | ||
246 | }; | 264 | }; |
247 | 265 | ||
248 | extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); | 266 | extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); |
@@ -257,6 +275,8 @@ extern int __xfrm_state_delete(struct xfrm_state *x); | |||
257 | 275 | ||
258 | struct xfrm_state_afinfo { | 276 | struct xfrm_state_afinfo { |
259 | unsigned int family; | 277 | unsigned int family; |
278 | unsigned int proto; | ||
279 | unsigned int eth_proto; | ||
260 | struct module *owner; | 280 | struct module *owner; |
261 | struct xfrm_type *type_map[IPPROTO_MAX]; | 281 | struct xfrm_type *type_map[IPPROTO_MAX]; |
262 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; | 282 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; |
@@ -267,6 +287,12 @@ struct xfrm_state_afinfo { | |||
267 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); | 287 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); |
268 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); | 288 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); |
269 | int (*output)(struct sk_buff *skb); | 289 | int (*output)(struct sk_buff *skb); |
290 | int (*extract_input)(struct xfrm_state *x, | ||
291 | struct sk_buff *skb); | ||
292 | int (*extract_output)(struct xfrm_state *x, | ||
293 | struct sk_buff *skb); | ||
294 | int (*transport_finish)(struct sk_buff *skb, | ||
295 | int async); | ||
270 | }; | 296 | }; |
271 | 297 | ||
272 | extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); | 298 | extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); |
@@ -282,6 +308,8 @@ struct xfrm_type | |||
282 | __u8 flags; | 308 | __u8 flags; |
283 | #define XFRM_TYPE_NON_FRAGMENT 1 | 309 | #define XFRM_TYPE_NON_FRAGMENT 1 |
284 | #define XFRM_TYPE_REPLAY_PROT 2 | 310 | #define XFRM_TYPE_REPLAY_PROT 2 |
311 | #define XFRM_TYPE_LOCAL_COADDR 4 | ||
312 | #define XFRM_TYPE_REMOTE_COADDR 8 | ||
285 | 313 | ||
286 | int (*init_state)(struct xfrm_state *x); | 314 | int (*init_state)(struct xfrm_state *x); |
287 | void (*destructor)(struct xfrm_state *); | 315 | void (*destructor)(struct xfrm_state *); |
@@ -289,8 +317,6 @@ struct xfrm_type | |||
289 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); | 317 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); |
290 | int (*reject)(struct xfrm_state *, struct sk_buff *, struct flowi *); | 318 | int (*reject)(struct xfrm_state *, struct sk_buff *, struct flowi *); |
291 | int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); | 319 | int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); |
292 | xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *); | ||
293 | xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *); | ||
294 | /* Estimate maximal size of result of transformation of a dgram */ | 320 | /* Estimate maximal size of result of transformation of a dgram */ |
295 | u32 (*get_mtu)(struct xfrm_state *, int size); | 321 | u32 (*get_mtu)(struct xfrm_state *, int size); |
296 | }; | 322 | }; |
@@ -299,6 +325,27 @@ extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); | |||
299 | extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); | 325 | extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); |
300 | 326 | ||
301 | struct xfrm_mode { | 327 | struct xfrm_mode { |
328 | /* | ||
329 | * Remove encapsulation header. | ||
330 | * | ||
331 | * The IP header will be moved over the top of the encapsulation | ||
332 | * header. | ||
333 | * | ||
334 | * On entry, the transport header shall point to where the IP header | ||
335 | * should be and the network header shall be set to where the IP | ||
336 | * header currently is. skb->data shall point to the start of the | ||
337 | * payload. | ||
338 | */ | ||
339 | int (*input2)(struct xfrm_state *x, struct sk_buff *skb); | ||
340 | |||
341 | /* | ||
342 | * This is the actual input entry point. | ||
343 | * | ||
344 | * For transport mode and equivalent this would be identical to | ||
345 | * input2 (which does not need to be set). While tunnel mode | ||
346 | * and equivalent would set this to the tunnel encapsulation function | ||
347 | * xfrm4_prepare_input that would in turn call input2. | ||
348 | */ | ||
302 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); | 349 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); |
303 | 350 | ||
304 | /* | 351 | /* |
@@ -312,7 +359,18 @@ struct xfrm_mode { | |||
312 | * header. The value of the network header will always point | 359 | * header. The value of the network header will always point |
313 | * to the top IP header while skb->data will point to the payload. | 360 | * to the top IP header while skb->data will point to the payload. |
314 | */ | 361 | */ |
315 | int (*output)(struct xfrm_state *x,struct sk_buff *skb); | 362 | int (*output2)(struct xfrm_state *x,struct sk_buff *skb); |
363 | |||
364 | /* | ||
365 | * This is the actual output entry point. | ||
366 | * | ||
367 | * For transport mode and equivalent this would be identical to | ||
368 | * output2 (which does not need to be set). While tunnel mode | ||
369 | * and equivalent would set this to a tunnel encapsulation function | ||
370 | * (xfrm4_prepare_output or xfrm6_prepare_output) that would in turn | ||
371 | * call output2. | ||
372 | */ | ||
373 | int (*output)(struct xfrm_state *x, struct sk_buff *skb); | ||
316 | 374 | ||
317 | struct xfrm_state_afinfo *afinfo; | 375 | struct xfrm_state_afinfo *afinfo; |
318 | struct module *owner; | 376 | struct module *owner; |
@@ -454,6 +512,51 @@ struct xfrm_skb_cb { | |||
454 | 512 | ||
455 | #define XFRM_SKB_CB(__skb) ((struct xfrm_skb_cb *)&((__skb)->cb[0])) | 513 | #define XFRM_SKB_CB(__skb) ((struct xfrm_skb_cb *)&((__skb)->cb[0])) |
456 | 514 | ||
515 | /* | ||
516 | * This structure is used by the afinfo prepare_input/prepare_output functions | ||
517 | * to transmit header information to the mode input/output functions. | ||
518 | */ | ||
519 | struct xfrm_mode_skb_cb { | ||
520 | union { | ||
521 | struct inet_skb_parm h4; | ||
522 | struct inet6_skb_parm h6; | ||
523 | } header; | ||
524 | |||
525 | /* Copied from header for IPv4, always set to zero and DF for IPv6. */ | ||
526 | __be16 id; | ||
527 | __be16 frag_off; | ||
528 | |||
529 | /* TOS for IPv4, class for IPv6. */ | ||
530 | u8 tos; | ||
531 | |||
532 | /* TTL for IPv4, hop limitfor IPv6. */ | ||
533 | u8 ttl; | ||
534 | |||
535 | /* Protocol for IPv4, NH for IPv6. */ | ||
536 | u8 protocol; | ||
537 | |||
538 | /* Used by IPv6 only, zero for IPv4. */ | ||
539 | u8 flow_lbl[3]; | ||
540 | }; | ||
541 | |||
542 | #define XFRM_MODE_SKB_CB(__skb) ((struct xfrm_mode_skb_cb *)&((__skb)->cb[0])) | ||
543 | |||
544 | /* | ||
545 | * This structure is used by the input processing to locate the SPI and | ||
546 | * related information. | ||
547 | */ | ||
548 | struct xfrm_spi_skb_cb { | ||
549 | union { | ||
550 | struct inet_skb_parm h4; | ||
551 | struct inet6_skb_parm h6; | ||
552 | } header; | ||
553 | |||
554 | unsigned int daddroff; | ||
555 | unsigned int family; | ||
556 | }; | ||
557 | |||
558 | #define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0])) | ||
559 | |||
457 | /* Audit Information */ | 560 | /* Audit Information */ |
458 | struct xfrm_audit | 561 | struct xfrm_audit |
459 | { | 562 | { |
@@ -462,41 +565,59 @@ struct xfrm_audit | |||
462 | }; | 565 | }; |
463 | 566 | ||
464 | #ifdef CONFIG_AUDITSYSCALL | 567 | #ifdef CONFIG_AUDITSYSCALL |
465 | static inline struct audit_buffer *xfrm_audit_start(u32 auid, u32 sid) | 568 | static inline struct audit_buffer *xfrm_audit_start(const char *op) |
466 | { | 569 | { |
467 | struct audit_buffer *audit_buf = NULL; | 570 | struct audit_buffer *audit_buf = NULL; |
468 | char *secctx; | ||
469 | u32 secctx_len; | ||
470 | 571 | ||
572 | if (audit_enabled == 0) | ||
573 | return NULL; | ||
471 | audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, | 574 | audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, |
472 | AUDIT_MAC_IPSEC_EVENT); | 575 | AUDIT_MAC_IPSEC_EVENT); |
473 | if (audit_buf == NULL) | 576 | if (audit_buf == NULL) |
474 | return NULL; | 577 | return NULL; |
578 | audit_log_format(audit_buf, "op=%s", op); | ||
579 | return audit_buf; | ||
580 | } | ||
475 | 581 | ||
476 | audit_log_format(audit_buf, "auid=%u", auid); | 582 | static inline void xfrm_audit_helper_usrinfo(u32 auid, u32 secid, |
583 | struct audit_buffer *audit_buf) | ||
584 | { | ||
585 | char *secctx; | ||
586 | u32 secctx_len; | ||
477 | 587 | ||
478 | if (sid != 0 && | 588 | audit_log_format(audit_buf, " auid=%u", auid); |
479 | security_secid_to_secctx(sid, &secctx, &secctx_len) == 0) { | 589 | if (secid != 0 && |
590 | security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) { | ||
480 | audit_log_format(audit_buf, " subj=%s", secctx); | 591 | audit_log_format(audit_buf, " subj=%s", secctx); |
481 | security_release_secctx(secctx, secctx_len); | 592 | security_release_secctx(secctx, secctx_len); |
482 | } else | 593 | } else |
483 | audit_log_task_context(audit_buf); | 594 | audit_log_task_context(audit_buf); |
484 | return audit_buf; | ||
485 | } | 595 | } |
486 | 596 | ||
487 | extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, | 597 | extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, |
488 | u32 auid, u32 sid); | 598 | u32 auid, u32 secid); |
489 | extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, | 599 | extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, |
490 | u32 auid, u32 sid); | 600 | u32 auid, u32 secid); |
491 | extern void xfrm_audit_state_add(struct xfrm_state *x, int result, | 601 | extern void xfrm_audit_state_add(struct xfrm_state *x, int result, |
492 | u32 auid, u32 sid); | 602 | u32 auid, u32 secid); |
493 | extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, | 603 | extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, |
494 | u32 auid, u32 sid); | 604 | u32 auid, u32 secid); |
605 | extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, | ||
606 | struct sk_buff *skb); | ||
607 | extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family); | ||
608 | extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, | ||
609 | __be32 net_spi, __be32 net_seq); | ||
610 | extern void xfrm_audit_state_icvfail(struct xfrm_state *x, | ||
611 | struct sk_buff *skb, u8 proto); | ||
495 | #else | 612 | #else |
496 | #define xfrm_audit_policy_add(x, r, a, s) do { ; } while (0) | 613 | #define xfrm_audit_policy_add(x, r, a, s) do { ; } while (0) |
497 | #define xfrm_audit_policy_delete(x, r, a, s) do { ; } while (0) | 614 | #define xfrm_audit_policy_delete(x, r, a, s) do { ; } while (0) |
498 | #define xfrm_audit_state_add(x, r, a, s) do { ; } while (0) | 615 | #define xfrm_audit_state_add(x, r, a, s) do { ; } while (0) |
499 | #define xfrm_audit_state_delete(x, r, a, s) do { ; } while (0) | 616 | #define xfrm_audit_state_delete(x, r, a, s) do { ; } while (0) |
617 | #define xfrm_audit_state_replay_overflow(x, s) do { ; } while (0) | ||
618 | #define xfrm_audit_state_notfound_simple(s, f) do { ; } while (0) | ||
619 | #define xfrm_audit_state_notfound(s, f, sp, sq) do { ; } while (0) | ||
620 | #define xfrm_audit_state_icvfail(x, s, p) do { ; } while (0) | ||
500 | #endif /* CONFIG_AUDITSYSCALL */ | 621 | #endif /* CONFIG_AUDITSYSCALL */ |
501 | 622 | ||
502 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) | 623 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) |
@@ -505,12 +626,12 @@ static inline void xfrm_pol_hold(struct xfrm_policy *policy) | |||
505 | atomic_inc(&policy->refcnt); | 626 | atomic_inc(&policy->refcnt); |
506 | } | 627 | } |
507 | 628 | ||
508 | extern void __xfrm_policy_destroy(struct xfrm_policy *policy); | 629 | extern void xfrm_policy_destroy(struct xfrm_policy *policy); |
509 | 630 | ||
510 | static inline void xfrm_pol_put(struct xfrm_policy *policy) | 631 | static inline void xfrm_pol_put(struct xfrm_policy *policy) |
511 | { | 632 | { |
512 | if (atomic_dec_and_test(&policy->refcnt)) | 633 | if (atomic_dec_and_test(&policy->refcnt)) |
513 | __xfrm_policy_destroy(policy); | 634 | xfrm_policy_destroy(policy); |
514 | } | 635 | } |
515 | 636 | ||
516 | #ifdef CONFIG_XFRM_SUB_POLICY | 637 | #ifdef CONFIG_XFRM_SUB_POLICY |
@@ -757,17 +878,25 @@ xfrm_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x, unsigned short | |||
757 | } | 878 | } |
758 | 879 | ||
759 | #ifdef CONFIG_XFRM | 880 | #ifdef CONFIG_XFRM |
760 | |||
761 | extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family); | 881 | extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family); |
762 | 882 | ||
763 | static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family) | 883 | static inline int __xfrm_policy_check2(struct sock *sk, int dir, |
884 | struct sk_buff *skb, | ||
885 | unsigned int family, int reverse) | ||
764 | { | 886 | { |
887 | int ndir = dir | (reverse ? XFRM_POLICY_MASK + 1 : 0); | ||
888 | |||
765 | if (sk && sk->sk_policy[XFRM_POLICY_IN]) | 889 | if (sk && sk->sk_policy[XFRM_POLICY_IN]) |
766 | return __xfrm_policy_check(sk, dir, skb, family); | 890 | return __xfrm_policy_check(sk, ndir, skb, family); |
767 | 891 | ||
768 | return (!xfrm_policy_count[dir] && !skb->sp) || | 892 | return (!xfrm_policy_count[dir] && !skb->sp) || |
769 | (skb->dst->flags & DST_NOPOLICY) || | 893 | (skb->dst->flags & DST_NOPOLICY) || |
770 | __xfrm_policy_check(sk, dir, skb, family); | 894 | __xfrm_policy_check(sk, ndir, skb, family); |
895 | } | ||
896 | |||
897 | static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family) | ||
898 | { | ||
899 | return __xfrm_policy_check2(sk, dir, skb, family, 0); | ||
771 | } | 900 | } |
772 | 901 | ||
773 | static inline int xfrm4_policy_check(struct sock *sk, int dir, struct sk_buff *skb) | 902 | static inline int xfrm4_policy_check(struct sock *sk, int dir, struct sk_buff *skb) |
@@ -780,7 +909,34 @@ static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff *s | |||
780 | return xfrm_policy_check(sk, dir, skb, AF_INET6); | 909 | return xfrm_policy_check(sk, dir, skb, AF_INET6); |
781 | } | 910 | } |
782 | 911 | ||
783 | extern int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, unsigned short family); | 912 | static inline int xfrm4_policy_check_reverse(struct sock *sk, int dir, |
913 | struct sk_buff *skb) | ||
914 | { | ||
915 | return __xfrm_policy_check2(sk, dir, skb, AF_INET, 1); | ||
916 | } | ||
917 | |||
918 | static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir, | ||
919 | struct sk_buff *skb) | ||
920 | { | ||
921 | return __xfrm_policy_check2(sk, dir, skb, AF_INET6, 1); | ||
922 | } | ||
923 | |||
924 | extern int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, | ||
925 | unsigned int family, int reverse); | ||
926 | |||
927 | static inline int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, | ||
928 | unsigned int family) | ||
929 | { | ||
930 | return __xfrm_decode_session(skb, fl, family, 0); | ||
931 | } | ||
932 | |||
933 | static inline int xfrm_decode_session_reverse(struct sk_buff *skb, | ||
934 | struct flowi *fl, | ||
935 | unsigned int family) | ||
936 | { | ||
937 | return __xfrm_decode_session(skb, fl, family, 1); | ||
938 | } | ||
939 | |||
784 | extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); | 940 | extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); |
785 | 941 | ||
786 | static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) | 942 | static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) |
@@ -841,6 +997,22 @@ static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *sk | |||
841 | { | 997 | { |
842 | return 1; | 998 | return 1; |
843 | } | 999 | } |
1000 | static inline int xfrm_decode_session_reverse(struct sk_buff *skb, | ||
1001 | struct flowi *fl, | ||
1002 | unsigned int family) | ||
1003 | { | ||
1004 | return -ENOSYS; | ||
1005 | } | ||
1006 | static inline int xfrm4_policy_check_reverse(struct sock *sk, int dir, | ||
1007 | struct sk_buff *skb) | ||
1008 | { | ||
1009 | return 1; | ||
1010 | } | ||
1011 | static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir, | ||
1012 | struct sk_buff *skb) | ||
1013 | { | ||
1014 | return 1; | ||
1015 | } | ||
844 | #endif | 1016 | #endif |
845 | 1017 | ||
846 | static __inline__ | 1018 | static __inline__ |
@@ -981,12 +1153,27 @@ struct xfrm6_tunnel { | |||
981 | 1153 | ||
982 | extern void xfrm_init(void); | 1154 | extern void xfrm_init(void); |
983 | extern void xfrm4_init(void); | 1155 | extern void xfrm4_init(void); |
984 | extern void xfrm6_init(void); | ||
985 | extern void xfrm6_fini(void); | ||
986 | extern void xfrm_state_init(void); | 1156 | extern void xfrm_state_init(void); |
987 | extern void xfrm4_state_init(void); | 1157 | extern void xfrm4_state_init(void); |
988 | extern void xfrm6_state_init(void); | 1158 | #ifdef CONFIG_XFRM |
1159 | extern int xfrm6_init(void); | ||
1160 | extern void xfrm6_fini(void); | ||
1161 | extern int xfrm6_state_init(void); | ||
989 | extern void xfrm6_state_fini(void); | 1162 | extern void xfrm6_state_fini(void); |
1163 | #else | ||
1164 | static inline int xfrm6_init(void) | ||
1165 | { | ||
1166 | return 0; | ||
1167 | } | ||
1168 | static inline void xfrm6_fini(void) | ||
1169 | { | ||
1170 | ; | ||
1171 | } | ||
1172 | #endif | ||
1173 | |||
1174 | #ifdef CONFIG_XFRM_STATISTICS | ||
1175 | extern int xfrm_proc_init(void); | ||
1176 | #endif | ||
990 | 1177 | ||
991 | extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *); | 1178 | extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *); |
992 | extern struct xfrm_state *xfrm_state_alloc(void); | 1179 | extern struct xfrm_state *xfrm_state_alloc(void); |
@@ -1045,14 +1232,23 @@ extern int xfrm_state_delete(struct xfrm_state *x); | |||
1045 | extern int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); | 1232 | extern int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); |
1046 | extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); | 1233 | extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); |
1047 | extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); | 1234 | extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); |
1048 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); | 1235 | extern int xfrm_replay_check(struct xfrm_state *x, |
1236 | struct sk_buff *skb, __be32 seq); | ||
1049 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); | 1237 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); |
1050 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); | 1238 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); |
1051 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); | 1239 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); |
1052 | extern int xfrm_init_state(struct xfrm_state *x); | 1240 | extern int xfrm_init_state(struct xfrm_state *x); |
1241 | extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); | ||
1242 | extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, | ||
1243 | int encap_type); | ||
1244 | extern int xfrm_input_resume(struct sk_buff *skb, int nexthdr); | ||
1245 | extern int xfrm_output_resume(struct sk_buff *skb, int err); | ||
1053 | extern int xfrm_output(struct sk_buff *skb); | 1246 | extern int xfrm_output(struct sk_buff *skb); |
1247 | extern int xfrm4_extract_header(struct sk_buff *skb); | ||
1248 | extern int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb); | ||
1054 | extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, | 1249 | extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, |
1055 | int encap_type); | 1250 | int encap_type); |
1251 | extern int xfrm4_transport_finish(struct sk_buff *skb, int async); | ||
1056 | extern int xfrm4_rcv(struct sk_buff *skb); | 1252 | extern int xfrm4_rcv(struct sk_buff *skb); |
1057 | 1253 | ||
1058 | static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) | 1254 | static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) |
@@ -1060,10 +1256,15 @@ static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) | |||
1060 | return xfrm4_rcv_encap(skb, nexthdr, spi, 0); | 1256 | return xfrm4_rcv_encap(skb, nexthdr, spi, 0); |
1061 | } | 1257 | } |
1062 | 1258 | ||
1259 | extern int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); | ||
1260 | extern int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | ||
1063 | extern int xfrm4_output(struct sk_buff *skb); | 1261 | extern int xfrm4_output(struct sk_buff *skb); |
1064 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); | 1262 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); |
1065 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); | 1263 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); |
1264 | extern int xfrm6_extract_header(struct sk_buff *skb); | ||
1265 | extern int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); | ||
1066 | extern int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); | 1266 | extern int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); |
1267 | extern int xfrm6_transport_finish(struct sk_buff *skb, int async); | ||
1067 | extern int xfrm6_rcv(struct sk_buff *skb); | 1268 | extern int xfrm6_rcv(struct sk_buff *skb); |
1068 | extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | 1269 | extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, |
1069 | xfrm_address_t *saddr, u8 proto); | 1270 | xfrm_address_t *saddr, u8 proto); |
@@ -1072,6 +1273,8 @@ extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short | |||
1072 | extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); | 1273 | extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); |
1073 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); | 1274 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); |
1074 | extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); | 1275 | extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); |
1276 | extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); | ||
1277 | extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | ||
1075 | extern int xfrm6_output(struct sk_buff *skb); | 1278 | extern int xfrm6_output(struct sk_buff *skb); |
1076 | extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, | 1279 | extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, |
1077 | u8 **prevhdr); | 1280 | u8 **prevhdr); |
@@ -1079,7 +1282,6 @@ extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, | |||
1079 | #ifdef CONFIG_XFRM | 1282 | #ifdef CONFIG_XFRM |
1080 | extern int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb); | 1283 | extern int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb); |
1081 | extern int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen); | 1284 | extern int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen); |
1082 | extern int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsigned short family); | ||
1083 | #else | 1285 | #else |
1084 | static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen) | 1286 | static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen) |
1085 | { | 1287 | { |
@@ -1092,11 +1294,6 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) | |||
1092 | kfree_skb(skb); | 1294 | kfree_skb(skb); |
1093 | return 0; | 1295 | return 0; |
1094 | } | 1296 | } |
1095 | |||
1096 | static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsigned short family) | ||
1097 | { | ||
1098 | return -EINVAL; | ||
1099 | } | ||
1100 | #endif | 1297 | #endif |
1101 | 1298 | ||
1102 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); | 1299 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); |
@@ -1113,11 +1310,9 @@ extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); | |||
1113 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, | 1310 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, |
1114 | xfrm_address_t *daddr, xfrm_address_t *saddr, | 1311 | xfrm_address_t *daddr, xfrm_address_t *saddr, |
1115 | int create, unsigned short family); | 1312 | int create, unsigned short family); |
1116 | extern int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); | ||
1117 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); | 1313 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); |
1118 | extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, | 1314 | extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, |
1119 | struct flowi *fl, int family, int strict); | 1315 | struct flowi *fl, int family, int strict); |
1120 | extern void xfrm_init_pmtu(struct dst_entry *dst); | ||
1121 | 1316 | ||
1122 | #ifdef CONFIG_XFRM_MIGRATE | 1317 | #ifdef CONFIG_XFRM_MIGRATE |
1123 | extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | 1318 | extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, |
@@ -1214,4 +1409,9 @@ static inline void xfrm_states_delete(struct xfrm_state **states, int n) | |||
1214 | } | 1409 | } |
1215 | #endif | 1410 | #endif |
1216 | 1411 | ||
1412 | static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb) | ||
1413 | { | ||
1414 | return skb->sp->xvec[skb->sp->len - 1]; | ||
1415 | } | ||
1416 | |||
1217 | #endif /* _NET_XFRM_H */ | 1417 | #endif /* _NET_XFRM_H */ |