aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-04-18 21:02:35 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-18 21:02:35 -0400
commit334d094504c2fe1c44211ecb49146ae6bca8c321 (patch)
treed3c0f68e4b9f8e3d2ccc39e7dfe5de0534a5fad9 /include
parentd1a4be630fb068f251d64b62919f143c49ca8057 (diff)
parentd1643d24c61b725bef399cc1cf2944b4c9c23177 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.26
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.26: (1090 commits) [NET]: Fix and allocate less memory for ->priv'less netdevices [IPV6]: Fix dangling references on error in fib6_add(). [NETLABEL]: Fix NULL deref in netlbl_unlabel_staticlist_gen() if ifindex not found [PKT_SCHED]: Fix datalen check in tcf_simp_init(). [INET]: Uninline the __inet_inherit_port call. [INET]: Drop the inet_inherit_port() call. SCTP: Initialize partial_bytes_acked to 0, when all of the data is acked. [netdrvr] forcedeth: internal simplifications; changelog removal phylib: factor out get_phy_id from within get_phy_device PHY: add BCM5464 support to broadcom PHY driver cxgb3: Fix __must_check warning with dev_dbg. tc35815: Statistics cleanup natsemi: fix MMIO for PPC 44x platforms [TIPC]: Cleanup of TIPC reference table code [TIPC]: Optimized initialization of TIPC reference table [TIPC]: Remove inlining of reference table locking routines e1000: convert uint16_t style integers to u16 ixgb: convert uint16_t style integers to u16 sb1000.c: make const arrays static sb1000.c: stop inlining largish static functions ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/Kbuild3
-rw-r--r--include/linux/arcdevice.h4
-rw-r--r--include/linux/atalk.h2
-rw-r--r--include/linux/filter.h35
-rw-r--r--include/linux/fsl_devices.h2
-rw-r--r--include/linux/icmpv6.h11
-rw-r--r--include/linux/ieee80211.h35
-rw-r--r--include/linux/if_arp.h6
-rw-r--r--include/linux/if_tunnel.h22
-rw-r--r--include/linux/if_vlan.h6
-rw-r--r--include/linux/if_wanpipe.h124
-rw-r--r--include/linux/igmp.h38
-rw-r--r--include/linux/in6.h34
-rw-r--r--include/linux/inetdevice.h8
-rw-r--r--include/linux/ipv6.h48
-rw-r--r--include/linux/isdn.h6
-rw-r--r--include/linux/mroute.h25
-rw-r--r--include/linux/mroute6.h228
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdevice.h36
-rw-r--r--include/linux/netfilter.h85
-rw-r--r--include/linux/netfilter/nf_conntrack_dccp.h40
-rw-r--r--include/linux/netfilter/nf_conntrack_sip.h185
-rw-r--r--include/linux/netfilter/nfnetlink_conntrack.h8
-rw-r--r--include/linux/netfilter/x_tables.h4
-rw-r--r--include/linux/netfilter/xt_sctp.h84
-rw-r--r--include/linux/netfilter_arp/arp_tables.h17
-rw-r--r--include/linux/netfilter_bridge/ebt_nflog.h21
-rw-r--r--include/linux/netfilter_ipv4.h2
-rw-r--r--include/linux/nl80211.h218
-rw-r--r--include/linux/pcounter.h74
-rw-r--r--include/linux/phy.h61
-rw-r--r--include/linux/pim.h45
-rw-r--r--include/linux/security.h48
-rw-r--r--include/linux/seq_file.h13
-rw-r--r--include/linux/seq_file_net.h27
-rw-r--r--include/linux/skbuff.h206
-rw-r--r--include/linux/smc91x.h13
-rw-r--r--include/linux/ssb/ssb.h50
-rw-r--r--include/linux/ssb/ssb_driver_chipcommon.h7
-rw-r--r--include/linux/ssb/ssb_driver_gige.h174
-rw-r--r--include/linux/ssb/ssb_driver_pci.h19
-rw-r--r--include/linux/tcp.h7
-rw-r--r--include/linux/udp.h19
-rw-r--r--include/linux/wireless.h1
-rw-r--r--include/linux/xfrm.h3
-rw-r--r--include/net/addrconf.h122
-rw-r--r--include/net/cfg80211.h159
-rw-r--r--include/net/dst.h10
-rw-r--r--include/net/fib_rules.h1
-rw-r--r--include/net/icmp.h9
-rw-r--r--include/net/ieee80211.h1
-rw-r--r--include/net/ieee80211softmac.h373
-rw-r--r--include/net/ieee80211softmac_wx.h99
-rw-r--r--include/net/inet_common.h11
-rw-r--r--include/net/inet_connection_sock.h5
-rw-r--r--include/net/inet_frag.h6
-rw-r--r--include/net/inet_hashtables.h29
-rw-r--r--include/net/inet_sock.h7
-rw-r--r--include/net/inet_timewait_sock.h18
-rw-r--r--include/net/ip.h10
-rw-r--r--include/net/ip6_fib.h18
-rw-r--r--include/net/ip6_route.h56
-rw-r--r--include/net/ipip.h10
-rw-r--r--include/net/ipv6.h84
-rw-r--r--include/net/irda/irlan_eth.h1
-rw-r--r--include/net/llc_if.h5
-rw-r--r--include/net/mac80211.h560
-rw-r--r--include/net/mip6.h3
-rw-r--r--include/net/ndisc.h31
-rw-r--r--include/net/neighbour.h31
-rw-r--r--include/net/net_namespace.h75
-rw-r--r--include/net/netfilter/nf_conntrack.h39
-rw-r--r--include/net/netfilter/nf_conntrack_core.h4
-rw-r--r--include/net/netfilter/nf_conntrack_expect.h22
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h5
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h19
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h13
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h96
-rw-r--r--include/net/netfilter/nf_nat_helper.h3
-rw-r--r--include/net/netfilter/nf_nat_protocol.h46
-rw-r--r--include/net/netfilter/nf_nat_rule.h3
-rw-r--r--include/net/netlabel.h14
-rw-r--r--include/net/netns/core.h16
-rw-r--r--include/net/netns/dccp.h11
-rw-r--r--include/net/netns/generic.h49
-rw-r--r--include/net/netns/ipv4.h11
-rw-r--r--include/net/netns/ipv6.h18
-rw-r--r--include/net/pkt_cls.h2
-rw-r--r--include/net/protocol.h3
-rw-r--r--include/net/raw.h4
-rw-r--r--include/net/request_sock.h9
-rw-r--r--include/net/route.h5
-rw-r--r--include/net/rtnetlink.h1
-rw-r--r--include/net/sctp/command.h3
-rw-r--r--include/net/sctp/sctp.h5
-rw-r--r--include/net/sctp/sm.h8
-rw-r--r--include/net/sctp/structs.h10
-rw-r--r--include/net/sock.h118
-rw-r--r--include/net/tcp.h35
-rw-r--r--include/net/tipc/tipc_bearer.h9
-rw-r--r--include/net/tipc/tipc_port.h13
-rw-r--r--include/net/udp.h15
-rw-r--r--include/net/wireless.h186
-rw-r--r--include/net/xfrm.h69
105 files changed, 2852 insertions, 1853 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index cedbbd806bf6..b3d9ccde0c27 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -231,7 +231,6 @@ unifdef-y += if_pppol2tp.h
231unifdef-y += if_pppox.h 231unifdef-y += if_pppox.h
232unifdef-y += if_tr.h 232unifdef-y += if_tr.h
233unifdef-y += if_vlan.h 233unifdef-y += if_vlan.h
234unifdef-y += if_wanpipe.h
235unifdef-y += igmp.h 234unifdef-y += igmp.h
236unifdef-y += inet_diag.h 235unifdef-y += inet_diag.h
237unifdef-y += in.h 236unifdef-y += in.h
@@ -261,6 +260,7 @@ unifdef-y += mempolicy.h
261unifdef-y += mii.h 260unifdef-y += mii.h
262unifdef-y += mman.h 261unifdef-y += mman.h
263unifdef-y += mroute.h 262unifdef-y += mroute.h
263unifdef-y += mroute6.h
264unifdef-y += msdos_fs.h 264unifdef-y += msdos_fs.h
265unifdef-y += msg.h 265unifdef-y += msg.h
266unifdef-y += nbd.h 266unifdef-y += nbd.h
@@ -289,6 +289,7 @@ unifdef-y += parport.h
289unifdef-y += patchkey.h 289unifdef-y += patchkey.h
290unifdef-y += pci.h 290unifdef-y += pci.h
291unifdef-y += personality.h 291unifdef-y += personality.h
292unifdef-y += pim.h
292unifdef-y += pktcdvd.h 293unifdef-y += pktcdvd.h
293unifdef-y += pmu.h 294unifdef-y += pmu.h
294unifdef-y += poll.h 295unifdef-y += poll.h
diff --git a/include/linux/arcdevice.h b/include/linux/arcdevice.h
index fde675872c56..a1916078fd08 100644
--- a/include/linux/arcdevice.h
+++ b/include/linux/arcdevice.h
@@ -283,8 +283,8 @@ struct arcnet_local {
283 int next_buf, first_free_buf; 283 int next_buf, first_free_buf;
284 284
285 /* network "reconfiguration" handling */ 285 /* network "reconfiguration" handling */
286 time_t first_recon, /* time of "first" RECON message to count */ 286 unsigned long first_recon; /* time of "first" RECON message to count */
287 last_recon; /* time of most recent RECON */ 287 unsigned long last_recon; /* time of most recent RECON */
288 int num_recons; /* number of RECONs between first and last. */ 288 int num_recons; /* number of RECONs between first and last. */
289 bool network_down; /* do we think the network is down? */ 289 bool network_down; /* do we think the network is down? */
290 290
diff --git a/include/linux/atalk.h b/include/linux/atalk.h
index ced8a1ed080c..e9ebac2e2ecc 100644
--- a/include/linux/atalk.h
+++ b/include/linux/atalk.h
@@ -85,8 +85,6 @@ static inline struct atalk_sock *at_sk(struct sock *sk)
85 return (struct atalk_sock *)sk; 85 return (struct atalk_sock *)sk;
86} 86}
87 87
88#include <asm/byteorder.h>
89
90struct ddpehdr { 88struct ddpehdr {
91 __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */ 89 __be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */
92 __be16 deh_sum; 90 __be16 deh_sum;
diff --git a/include/linux/filter.h b/include/linux/filter.h
index ddfa0372a3b7..b6ea9aa9e853 100644
--- a/include/linux/filter.h
+++ b/include/linux/filter.h
@@ -37,21 +37,6 @@ struct sock_fprog /* Required for SO_ATTACH_FILTER. */
37 struct sock_filter __user *filter; 37 struct sock_filter __user *filter;
38}; 38};
39 39
40#ifdef __KERNEL__
41struct sk_filter
42{
43 atomic_t refcnt;
44 unsigned int len; /* Number of filter blocks */
45 struct rcu_head rcu;
46 struct sock_filter insns[0];
47};
48
49static inline unsigned int sk_filter_len(struct sk_filter *fp)
50{
51 return fp->len*sizeof(struct sock_filter) + sizeof(*fp);
52}
53#endif
54
55/* 40/*
56 * Instruction classes 41 * Instruction classes
57 */ 42 */
@@ -136,15 +121,31 @@ static inline unsigned int sk_filter_len(struct sk_filter *fp)
136#define SKF_AD_PROTOCOL 0 121#define SKF_AD_PROTOCOL 0
137#define SKF_AD_PKTTYPE 4 122#define SKF_AD_PKTTYPE 4
138#define SKF_AD_IFINDEX 8 123#define SKF_AD_IFINDEX 8
139#define SKF_AD_MAX 12 124#define SKF_AD_NLATTR 12
125#define SKF_AD_MAX 16
140#define SKF_NET_OFF (-0x100000) 126#define SKF_NET_OFF (-0x100000)
141#define SKF_LL_OFF (-0x200000) 127#define SKF_LL_OFF (-0x200000)
142 128
143#ifdef __KERNEL__ 129#ifdef __KERNEL__
130struct sk_filter
131{
132 atomic_t refcnt;
133 unsigned int len; /* Number of filter blocks */
134 struct rcu_head rcu;
135 struct sock_filter insns[0];
136};
137
138static inline unsigned int sk_filter_len(const struct sk_filter *fp)
139{
140 return fp->len * sizeof(struct sock_filter) + sizeof(*fp);
141}
142
144struct sk_buff; 143struct sk_buff;
145struct sock; 144struct sock;
146 145
147extern unsigned int sk_run_filter(struct sk_buff *skb, struct sock_filter *filter, int flen); 146extern int sk_filter(struct sock *sk, struct sk_buff *skb);
147extern unsigned int sk_run_filter(struct sk_buff *skb,
148 struct sock_filter *filter, int flen);
148extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk); 149extern int sk_attach_filter(struct sock_fprog *fprog, struct sock *sk);
149extern int sk_detach_filter(struct sock *sk); 150extern int sk_detach_filter(struct sock *sk);
150extern int sk_chk_filter(struct sock_filter *filter, int flen); 151extern int sk_chk_filter(struct sock_filter *filter, int flen);
diff --git a/include/linux/fsl_devices.h b/include/linux/fsl_devices.h
index 1831b196c70a..2cad5c67397e 100644
--- a/include/linux/fsl_devices.h
+++ b/include/linux/fsl_devices.h
@@ -50,7 +50,7 @@ struct gianfar_platform_data {
50 u32 device_flags; 50 u32 device_flags;
51 /* board specific information */ 51 /* board specific information */
52 u32 board_flags; 52 u32 board_flags;
53 u32 bus_id; 53 char bus_id[MII_BUS_ID_SIZE];
54 u32 phy_id; 54 u32 phy_id;
55 u8 mac_addr[6]; 55 u8 mac_addr[6];
56 phy_interface_t interface; 56 phy_interface_t interface;
diff --git a/include/linux/icmpv6.h b/include/linux/icmpv6.h
index 7c5e9817e998..03067443198a 100644
--- a/include/linux/icmpv6.h
+++ b/include/linux/icmpv6.h
@@ -176,12 +176,21 @@ extern void icmpv6_send(struct sk_buff *skb,
176 __u32 info, 176 __u32 info,
177 struct net_device *dev); 177 struct net_device *dev);
178 178
179extern int icmpv6_init(struct net_proto_family *ops); 179extern int icmpv6_init(void);
180extern int icmpv6_err_convert(int type, int code, 180extern int icmpv6_err_convert(int type, int code,
181 int *err); 181 int *err);
182extern void icmpv6_cleanup(void); 182extern void icmpv6_cleanup(void);
183extern void icmpv6_param_prob(struct sk_buff *skb, 183extern void icmpv6_param_prob(struct sk_buff *skb,
184 int code, int pos); 184 int code, int pos);
185
186struct flowi;
187struct in6_addr;
188extern void icmpv6_flow_init(struct sock *sk,
189 struct flowi *fl,
190 u8 type,
191 const struct in6_addr *saddr,
192 const struct in6_addr *daddr,
193 int oif);
185#endif 194#endif
186 195
187#endif 196#endif
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index f577c8f1c66d..f27d11ab418b 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -97,6 +97,7 @@
97#define IEEE80211_MAX_FRAME_LEN 2352 97#define IEEE80211_MAX_FRAME_LEN 2352
98 98
99#define IEEE80211_MAX_SSID_LEN 32 99#define IEEE80211_MAX_SSID_LEN 32
100#define IEEE80211_MAX_MESH_ID_LEN 32
100 101
101struct ieee80211_hdr { 102struct ieee80211_hdr {
102 __le16 frame_control; 103 __le16 frame_control;
@@ -109,6 +110,16 @@ struct ieee80211_hdr {
109} __attribute__ ((packed)); 110} __attribute__ ((packed));
110 111
111 112
113struct ieee80211s_hdr {
114 u8 flags;
115 u8 ttl;
116 u8 seqnum[3];
117 u8 eaddr1[6];
118 u8 eaddr2[6];
119 u8 eaddr3[6];
120} __attribute__ ((packed));
121
122
112struct ieee80211_mgmt { 123struct ieee80211_mgmt {
113 __le16 frame_control; 124 __le16 frame_control;
114 __le16 duration; 125 __le16 duration;
@@ -206,6 +217,23 @@ struct ieee80211_mgmt {
206 __le16 params; 217 __le16 params;
207 __le16 reason_code; 218 __le16 reason_code;
208 } __attribute__((packed)) delba; 219 } __attribute__((packed)) delba;
220 struct{
221 u8 action_code;
222 /* capab_info for open and confirm,
223 * reason for close
224 */
225 __le16 aux;
226 /* Followed in plink_confirm by status
227 * code, AID and supported rates,
228 * and directly by supported rates in
229 * plink_open and plink_close
230 */
231 u8 variable[0];
232 } __attribute__((packed)) plink_action;
233 struct{
234 u8 action_code;
235 u8 variable[0];
236 } __attribute__((packed)) mesh_action;
209 } u; 237 } u;
210 } __attribute__ ((packed)) action; 238 } __attribute__ ((packed)) action;
211 } u; 239 } u;
@@ -437,6 +465,13 @@ enum ieee80211_eid {
437 WLAN_EID_TS_DELAY = 43, 465 WLAN_EID_TS_DELAY = 43,
438 WLAN_EID_TCLAS_PROCESSING = 44, 466 WLAN_EID_TCLAS_PROCESSING = 44,
439 WLAN_EID_QOS_CAPA = 46, 467 WLAN_EID_QOS_CAPA = 46,
468 /* 802.11s */
469 WLAN_EID_MESH_CONFIG = 36, /* Pending IEEE 802.11 ANA approval */
470 WLAN_EID_MESH_ID = 37, /* Pending IEEE 802.11 ANA approval */
471 WLAN_EID_PEER_LINK = 40, /* Pending IEEE 802.11 ANA approval */
472 WLAN_EID_PREQ = 53, /* Pending IEEE 802.11 ANA approval */
473 WLAN_EID_PREP = 54, /* Pending IEEE 802.11 ANA approval */
474 WLAN_EID_PERR = 55, /* Pending IEEE 802.11 ANA approval */
440 /* 802.11h */ 475 /* 802.11h */
441 WLAN_EID_PWR_CONSTRAINT = 32, 476 WLAN_EID_PWR_CONSTRAINT = 32,
442 WLAN_EID_PWR_CAPABILITY = 33, 477 WLAN_EID_PWR_CAPABILITY = 33,
diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h
index 296e8e86e91d..4d3401812e6c 100644
--- a/include/linux/if_arp.h
+++ b/include/linux/if_arp.h
@@ -156,6 +156,12 @@ static inline struct arphdr *arp_hdr(const struct sk_buff *skb)
156{ 156{
157 return (struct arphdr *)skb_network_header(skb); 157 return (struct arphdr *)skb_network_header(skb);
158} 158}
159
160static inline int arp_hdr_len(struct net_device *dev)
161{
162 /* ARP header, plus 2 device addresses, plus 2 IP addresses. */
163 return sizeof(struct arphdr) + (dev->addr_len + sizeof(u32)) * 2;
164}
159#endif 165#endif
160 166
161#endif /* _LINUX_IF_ARP_H */ 167#endif /* _LINUX_IF_ARP_H */
diff --git a/include/linux/if_tunnel.h b/include/linux/if_tunnel.h
index 228eb4eb3129..f1fbe9c930d7 100644
--- a/include/linux/if_tunnel.h
+++ b/include/linux/if_tunnel.h
@@ -7,6 +7,10 @@
7#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) 7#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
8#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) 8#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2)
9#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) 9#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3)
10#define SIOCGETPRL (SIOCDEVPRIVATE + 4)
11#define SIOCADDPRL (SIOCDEVPRIVATE + 5)
12#define SIOCDELPRL (SIOCDEVPRIVATE + 6)
13#define SIOCCHGPRL (SIOCDEVPRIVATE + 7)
10 14
11#define GRE_CSUM __constant_htons(0x8000) 15#define GRE_CSUM __constant_htons(0x8000)
12#define GRE_ROUTING __constant_htons(0x4000) 16#define GRE_ROUTING __constant_htons(0x4000)
@@ -17,9 +21,6 @@
17#define GRE_FLAGS __constant_htons(0x00F8) 21#define GRE_FLAGS __constant_htons(0x00F8)
18#define GRE_VERSION __constant_htons(0x0007) 22#define GRE_VERSION __constant_htons(0x0007)
19 23
20/* i_flags values for SIT mode */
21#define SIT_ISATAP 0x0001
22
23struct ip_tunnel_parm 24struct ip_tunnel_parm
24{ 25{
25 char name[IFNAMSIZ]; 26 char name[IFNAMSIZ];
@@ -31,4 +32,19 @@ struct ip_tunnel_parm
31 struct iphdr iph; 32 struct iphdr iph;
32}; 33};
33 34
35/* SIT-mode i_flags */
36#define SIT_ISATAP 0x0001
37
38struct ip_tunnel_prl {
39 __be32 addr;
40 __u16 flags;
41 __u16 __reserved;
42 __u32 datalen;
43 __u32 __reserved2;
44 void __user *data;
45};
46
47/* PRL flags */
48#define PRL_DEFAULT 0x0001
49
34#endif /* _IF_TUNNEL_H_ */ 50#endif /* _IF_TUNNEL_H_ */
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h
index 79504b22a932..15ace02b7b24 100644
--- a/include/linux/if_vlan.h
+++ b/include/linux/if_vlan.h
@@ -81,7 +81,9 @@ extern void vlan_ioctl_set(int (*hook)(struct net *, void __user *));
81#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS) 81#define VLAN_GROUP_ARRAY_PART_LEN (VLAN_GROUP_ARRAY_LEN/VLAN_GROUP_ARRAY_SPLIT_PARTS)
82 82
83struct vlan_group { 83struct vlan_group {
84 int real_dev_ifindex; /* The ifindex of the ethernet(like) device the vlan is attached to. */ 84 struct net_device *real_dev; /* The ethernet(like) device
85 * the vlan is attached to.
86 */
85 unsigned int nr_vlans; 87 unsigned int nr_vlans;
86 struct hlist_node hlist; /* linked list */ 88 struct hlist_node hlist; /* linked list */
87 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS]; 89 struct net_device **vlan_devices_arrays[VLAN_GROUP_ARRAY_SPLIT_PARTS];
@@ -93,7 +95,7 @@ static inline struct net_device *vlan_group_get_device(struct vlan_group *vg,
93{ 95{
94 struct net_device **array; 96 struct net_device **array;
95 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; 97 array = vg->vlan_devices_arrays[vlan_id / VLAN_GROUP_ARRAY_PART_LEN];
96 return array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN]; 98 return array ? array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] : NULL;
97} 99}
98 100
99static inline void vlan_group_set_device(struct vlan_group *vg, 101static inline void vlan_group_set_device(struct vlan_group *vg,
diff --git a/include/linux/if_wanpipe.h b/include/linux/if_wanpipe.h
deleted file mode 100644
index e594ca6069e5..000000000000
--- a/include/linux/if_wanpipe.h
+++ /dev/null
@@ -1,124 +0,0 @@
1/*****************************************************************************
2* if_wanpipe.h Header file for the Sangoma AF_WANPIPE Socket
3*
4* Author: Nenad Corbic
5*
6* Copyright: (c) 2000 Sangoma Technologies Inc.
7*
8* This program is free software; you can redistribute it and/or
9* modify it under the terms of the GNU General Public License
10* as published by the Free Software Foundation; either version
11* 2 of the License, or (at your option) any later version.
12* ============================================================================
13*
14* Jan 28, 2000 Nenad Corbic Initial Version
15*
16*****************************************************************************/
17
18#ifndef __LINUX_IF_WAN_PACKET_H
19#define __LINUX_IF_WAN_PACKET_H
20
21struct wan_sockaddr_ll
22{
23 unsigned short sll_family;
24 unsigned short sll_protocol;
25 int sll_ifindex;
26 unsigned short sll_hatype;
27 unsigned char sll_pkttype;
28 unsigned char sll_halen;
29 unsigned char sll_addr[8];
30 unsigned char sll_device[14];
31 unsigned char sll_card[14];
32};
33
34typedef struct
35{
36 unsigned char free;
37 unsigned char state_sk;
38 int rcvbuf;
39 int sndbuf;
40 int rmem;
41 int wmem;
42 int sk_count;
43 unsigned char bound;
44 char name[14];
45 unsigned char d_state;
46 unsigned char svc;
47 unsigned short lcn;
48 unsigned char mbox;
49 unsigned char cmd_busy;
50 unsigned char command;
51 unsigned poll;
52 unsigned poll_cnt;
53 int rblock;
54} wan_debug_hdr_t;
55
56#define MAX_NUM_DEBUG 10
57#define X25_PROT 0x16
58#define PVC_PROT 0x17
59
60typedef struct
61{
62 wan_debug_hdr_t debug[MAX_NUM_DEBUG];
63}wan_debug_t;
64
65#define SIOC_WANPIPE_GET_CALL_DATA (SIOCPROTOPRIVATE + 0)
66#define SIOC_WANPIPE_SET_CALL_DATA (SIOCPROTOPRIVATE + 1)
67#define SIOC_WANPIPE_ACCEPT_CALL (SIOCPROTOPRIVATE + 2)
68#define SIOC_WANPIPE_CLEAR_CALL (SIOCPROTOPRIVATE + 3)
69#define SIOC_WANPIPE_RESET_CALL (SIOCPROTOPRIVATE + 4)
70#define SIOC_WANPIPE_DEBUG (SIOCPROTOPRIVATE + 5)
71#define SIOC_WANPIPE_SET_NONBLOCK (SIOCPROTOPRIVATE + 6)
72#define SIOC_WANPIPE_CHECK_TX (SIOCPROTOPRIVATE + 7)
73#define SIOC_WANPIPE_SOCK_STATE (SIOCPROTOPRIVATE + 8)
74
75/* Packet types */
76
77#define WAN_PACKET_HOST 0 /* To us */
78#define WAN_PACKET_BROADCAST 1 /* To all */
79#define WAN_PACKET_MULTICAST 2 /* To group */
80#define WAN_PACKET_OTHERHOST 3 /* To someone else */
81#define WAN_PACKET_OUTGOING 4 /* Outgoing of any type */
82/* These ones are invisible by user level */
83#define WAN_PACKET_LOOPBACK 5 /* MC/BRD frame looped back */
84#define WAN_PACKET_FASTROUTE 6 /* Fastrouted frame */
85
86
87/* X25 specific */
88#define WAN_PACKET_DATA 7
89#define WAN_PACKET_CMD 8
90#define WAN_PACKET_ASYNC 9
91#define WAN_PACKET_ERR 10
92
93/* Packet socket options */
94
95#define WAN_PACKET_ADD_MEMBERSHIP 1
96#define WAN_PACKET_DROP_MEMBERSHIP 2
97
98#define WAN_PACKET_MR_MULTICAST 0
99#define WAN_PACKET_MR_PROMISC 1
100#define WAN_PACKET_MR_ALLMULTI 2
101
102#ifdef __KERNEL__
103
104/* Private wanpipe socket structures. */
105struct wanpipe_opt
106{
107 void *mbox; /* Mail box */
108 void *card; /* Card bouded to */
109 struct net_device *dev; /* Bounded device */
110 unsigned short lcn; /* Binded LCN */
111 unsigned char svc; /* 0=pvc, 1=svc */
112 unsigned char timer; /* flag for delayed transmit*/
113 struct timer_list tx_timer;
114 unsigned poll_cnt;
115 unsigned char force; /* Used to force sock release */
116 atomic_t packet_sent;
117 unsigned short num;
118};
119
120#define wp_sk(__sk) ((struct wanpipe_opt *)(__sk)->sk_protinfo)
121
122#endif
123
124#endif
diff --git a/include/linux/igmp.h b/include/linux/igmp.h
index f510e7e382a8..f5a1a0db2e8e 100644
--- a/include/linux/igmp.h
+++ b/include/linux/igmp.h
@@ -80,27 +80,6 @@ struct igmpv3_query {
80 __be32 srcs[0]; 80 __be32 srcs[0];
81}; 81};
82 82
83#ifdef __KERNEL__
84#include <linux/skbuff.h>
85
86static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
87{
88 return (struct igmphdr *)skb_transport_header(skb);
89}
90
91static inline struct igmpv3_report *
92 igmpv3_report_hdr(const struct sk_buff *skb)
93{
94 return (struct igmpv3_report *)skb_transport_header(skb);
95}
96
97static inline struct igmpv3_query *
98 igmpv3_query_hdr(const struct sk_buff *skb)
99{
100 return (struct igmpv3_query *)skb_transport_header(skb);
101}
102#endif
103
104#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */ 83#define IGMP_HOST_MEMBERSHIP_QUERY 0x11 /* From RFC1112 */
105#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */ 84#define IGMP_HOST_MEMBERSHIP_REPORT 0x12 /* Ditto */
106#define IGMP_DVMRP 0x13 /* DVMRP routing */ 85#define IGMP_DVMRP 0x13 /* DVMRP routing */
@@ -151,6 +130,23 @@ static inline struct igmpv3_query *
151#include <linux/timer.h> 130#include <linux/timer.h>
152#include <linux/in.h> 131#include <linux/in.h>
153 132
133static inline struct igmphdr *igmp_hdr(const struct sk_buff *skb)
134{
135 return (struct igmphdr *)skb_transport_header(skb);
136}
137
138static inline struct igmpv3_report *
139 igmpv3_report_hdr(const struct sk_buff *skb)
140{
141 return (struct igmpv3_report *)skb_transport_header(skb);
142}
143
144static inline struct igmpv3_query *
145 igmpv3_query_hdr(const struct sk_buff *skb)
146{
147 return (struct igmpv3_query *)skb_transport_header(skb);
148}
149
154extern int sysctl_igmp_max_memberships; 150extern int sysctl_igmp_max_memberships;
155extern int sysctl_igmp_max_msf; 151extern int sysctl_igmp_max_msf;
156 152
diff --git a/include/linux/in6.h b/include/linux/in6.h
index 2a61c82af115..bc492048c349 100644
--- a/include/linux/in6.h
+++ b/include/linux/in6.h
@@ -48,6 +48,14 @@ extern const struct in6_addr in6addr_any;
48#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } } 48#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
49extern const struct in6_addr in6addr_loopback; 49extern const struct in6_addr in6addr_loopback;
50#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } } 50#define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
51#ifdef __KERNEL__
52extern const struct in6_addr in6addr_linklocal_allnodes;
53#define IN6ADDR_LINKLOCAL_ALLNODES_INIT \
54 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }
55extern const struct in6_addr in6addr_linklocal_allrouters;
56#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT \
57 { { { 0xff,2,0,0,0,0,0,0,0,0,0,0,0,0,0,2 } } }
58#endif
51 59
52struct sockaddr_in6 { 60struct sockaddr_in6 {
53 unsigned short int sin6_family; /* AF_INET6 */ 61 unsigned short int sin6_family; /* AF_INET6 */
@@ -249,4 +257,30 @@ struct in6_flowlabel_req
249 * IP6T_SO_GET_REVISION_TARGET 69 257 * IP6T_SO_GET_REVISION_TARGET 69
250 */ 258 */
251 259
260/* RFC5014: Source address selection */
261#define IPV6_ADDR_PREFERENCES 72
262
263#define IPV6_PREFER_SRC_TMP 0x0001
264#define IPV6_PREFER_SRC_PUBLIC 0x0002
265#define IPV6_PREFER_SRC_PUBTMP_DEFAULT 0x0100
266#define IPV6_PREFER_SRC_COA 0x0004
267#define IPV6_PREFER_SRC_HOME 0x0400
268#define IPV6_PREFER_SRC_CGA 0x0008
269#define IPV6_PREFER_SRC_NONCGA 0x0800
270
271/*
272 * Multicast Routing:
273 * see include/linux/mroute6.h.
274 *
275 * MRT6_INIT 200
276 * MRT6_DONE 201
277 * MRT6_ADD_MIF 202
278 * MRT6_DEL_MIF 203
279 * MRT6_ADD_MFC 204
280 * MRT6_DEL_MFC 205
281 * MRT6_VERSION 206
282 * MRT6_ASSERT 207
283 * MRT6_PIM 208
284 * (reserved) 209
285 */
252#endif 286#endif
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index fc4e3db649e8..7009b0cdd06f 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -70,13 +70,13 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
70 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val)) 70 ipv4_devconf_set((in_dev), NET_IPV4_CONF_ ## attr, (val))
71 71
72#define IN_DEV_ANDCONF(in_dev, attr) \ 72#define IN_DEV_ANDCONF(in_dev, attr) \
73 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) && \ 73 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) && \
74 IN_DEV_CONF_GET((in_dev), attr)) 74 IN_DEV_CONF_GET((in_dev), attr))
75#define IN_DEV_ORCONF(in_dev, attr) \ 75#define IN_DEV_ORCONF(in_dev, attr) \
76 (IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr) || \ 76 (IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr) || \
77 IN_DEV_CONF_GET((in_dev), attr)) 77 IN_DEV_CONF_GET((in_dev), attr))
78#define IN_DEV_MAXCONF(in_dev, attr) \ 78#define IN_DEV_MAXCONF(in_dev, attr) \
79 (max(IPV4_DEVCONF_ALL(in_dev->dev->nd_net, attr), \ 79 (max(IPV4_DEVCONF_ALL(dev_net(in_dev->dev), attr), \
80 IN_DEV_CONF_GET((in_dev), attr))) 80 IN_DEV_CONF_GET((in_dev), attr)))
81 81
82#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) 82#define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
@@ -129,7 +129,7 @@ extern int unregister_inetaddr_notifier(struct notifier_block *nb);
129 129
130extern struct net_device *ip_dev_find(struct net *net, __be32 addr); 130extern struct net_device *ip_dev_find(struct net *net, __be32 addr);
131extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b); 131extern int inet_addr_onlink(struct in_device *in_dev, __be32 a, __be32 b);
132extern int devinet_ioctl(unsigned int cmd, void __user *); 132extern int devinet_ioctl(struct net *net, unsigned int cmd, void __user *);
133extern void devinet_init(void); 133extern void devinet_init(void);
134extern struct in_device *inetdev_by_index(struct net *, int); 134extern struct in_device *inetdev_by_index(struct net *, int);
135extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope); 135extern __be32 inet_select_addr(const struct net_device *dev, __be32 dst, int scope);
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 134c8e5cf07c..10b666b61add 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -160,6 +160,9 @@ struct ipv6_devconf {
160#ifdef CONFIG_IPV6_OPTIMISTIC_DAD 160#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
161 __s32 optimistic_dad; 161 __s32 optimistic_dad;
162#endif 162#endif
163#ifdef CONFIG_IPV6_MROUTE
164 __s32 mc_forwarding;
165#endif
163 void *sysctl; 166 void *sysctl;
164}; 167};
165 168
@@ -190,6 +193,7 @@ enum {
190 DEVCONF_PROXY_NDP, 193 DEVCONF_PROXY_NDP,
191 DEVCONF_OPTIMISTIC_DAD, 194 DEVCONF_OPTIMISTIC_DAD,
192 DEVCONF_ACCEPT_SOURCE_ROUTE, 195 DEVCONF_ACCEPT_SOURCE_ROUTE,
196 DEVCONF_MC_FORWARDING,
193 DEVCONF_MAX 197 DEVCONF_MAX
194}; 198};
195 199
@@ -230,6 +234,7 @@ struct inet6_skb_parm {
230#endif 234#endif
231 235
232#define IP6SKB_XFRM_TRANSFORMED 1 236#define IP6SKB_XFRM_TRANSFORMED 1
237#define IP6SKB_FORWARDED 2
233}; 238};
234 239
235#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb)) 240#define IP6CB(skb) ((struct inet6_skb_parm*)((skb)->cb))
@@ -274,8 +279,29 @@ struct ipv6_pinfo {
274 279
275 __be32 flow_label; 280 __be32 flow_label;
276 __u32 frag_size; 281 __u32 frag_size;
277 __s16 hop_limit; 282
278 __s16 mcast_hops; 283 /*
284 * Packed in 16bits.
285 * Omit one shift by by putting the signed field at MSB.
286 */
287#if defined(__BIG_ENDIAN_BITFIELD)
288 __s16 hop_limit:9;
289 __u16 __unused_1:7;
290#else
291 __u16 __unused_1:7;
292 __s16 hop_limit:9;
293#endif
294
295#if defined(__BIG_ENDIAN_BITFIELD)
296 /* Packed in 16bits. */
297 __s16 mcast_hops:9;
298 __u16 __unused_2:6,
299 mc_loop:1;
300#else
301 __u16 mc_loop:1,
302 __unused_2:6;
303 __s16 mcast_hops:9;
304#endif
279 int mcast_oif; 305 int mcast_oif;
280 306
281 /* pktoption flags */ 307 /* pktoption flags */
@@ -298,11 +324,14 @@ struct ipv6_pinfo {
298 } rxopt; 324 } rxopt;
299 325
300 /* sockopt flags */ 326 /* sockopt flags */
301 __u8 mc_loop:1, 327 __u8 recverr:1,
302 recverr:1,
303 sndflow:1, 328 sndflow:1,
304 pmtudisc:2, 329 pmtudisc:2,
305 ipv6only:1; 330 ipv6only:1,
331 srcprefs:3; /* 001: prefer temporary address
332 * 010: prefer public address
333 * 100: prefer care-of address
334 */
306 __u8 tclass; 335 __u8 tclass;
307 336
308 __u32 dst_cookie; 337 __u32 dst_cookie;
@@ -315,9 +344,8 @@ struct ipv6_pinfo {
315 struct sk_buff *pktoptions; 344 struct sk_buff *pktoptions;
316 struct { 345 struct {
317 struct ipv6_txoptions *opt; 346 struct ipv6_txoptions *opt;
318 struct rt6_info *rt; 347 u8 hop_limit;
319 int hop_limit; 348 u8 tclass;
320 int tclass;
321 } cork; 349 } cork;
322}; 350};
323 351
@@ -458,7 +486,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
458#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ 486#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
459 487
460#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\ 488#define INET6_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif)\
461 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ 489 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
462 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 490 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
463 ((__sk)->sk_family == AF_INET6) && \ 491 ((__sk)->sk_family == AF_INET6) && \
464 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \ 492 ipv6_addr_equal(&inet6_sk(__sk)->daddr, (__saddr)) && \
@@ -466,7 +494,7 @@ static inline struct raw6_sock *raw6_sk(const struct sock *sk)
466 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 494 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
467 495
468#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \ 496#define INET6_TW_MATCH(__sk, __net, __hash, __saddr, __daddr, __ports, __dif) \
469 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ 497 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
470 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \ 498 (*((__portpair *)&(inet_twsk(__sk)->tw_dport)) == (__ports)) && \
471 ((__sk)->sk_family == PF_INET6) && \ 499 ((__sk)->sk_family == PF_INET6) && \
472 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \ 500 (ipv6_addr_equal(&inet6_twsk(__sk)->tw_v6_daddr, (__saddr))) && \
diff --git a/include/linux/isdn.h b/include/linux/isdn.h
index 9cb2855bb170..44cd663c53b6 100644
--- a/include/linux/isdn.h
+++ b/include/linux/isdn.h
@@ -16,14 +16,8 @@
16 16
17#include <linux/ioctl.h> 17#include <linux/ioctl.h>
18 18
19#ifdef CONFIG_COBALT_MICRO_SERVER
20/* Save memory */
21#define ISDN_MAX_DRIVERS 2
22#define ISDN_MAX_CHANNELS 8
23#else
24#define ISDN_MAX_DRIVERS 32 19#define ISDN_MAX_DRIVERS 32
25#define ISDN_MAX_CHANNELS 64 20#define ISDN_MAX_CHANNELS 64
26#endif
27 21
28/* New ioctl-codes */ 22/* New ioctl-codes */
29#define IIOCNETAIF _IO('I',1) 23#define IIOCNETAIF _IO('I',1)
diff --git a/include/linux/mroute.h b/include/linux/mroute.h
index 35a8277ec1bd..de4decfa1bfc 100644
--- a/include/linux/mroute.h
+++ b/include/linux/mroute.h
@@ -2,7 +2,11 @@
2#define __LINUX_MROUTE_H 2#define __LINUX_MROUTE_H
3 3
4#include <linux/sockios.h> 4#include <linux/sockios.h>
5#include <linux/types.h>
6#ifdef __KERNEL__
5#include <linux/in.h> 7#include <linux/in.h>
8#endif
9#include <linux/pim.h>
6 10
7/* 11/*
8 * Based on the MROUTING 3.5 defines primarily to keep 12 * Based on the MROUTING 3.5 defines primarily to keep
@@ -210,27 +214,6 @@ struct mfc_cache
210#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */ 214#define IGMPMSG_WHOLEPKT 3 /* For PIM Register processing */
211 215
212#ifdef __KERNEL__ 216#ifdef __KERNEL__
213
214#define PIM_V1_VERSION __constant_htonl(0x10000000)
215#define PIM_V1_REGISTER 1
216
217#define PIM_VERSION 2
218#define PIM_REGISTER 1
219
220#define PIM_NULL_REGISTER __constant_htonl(0x40000000)
221
222/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
223
224struct pimreghdr
225{
226 __u8 type;
227 __u8 reserved;
228 __be16 csum;
229 __be32 flags;
230};
231
232extern int pim_rcv_v1(struct sk_buff *);
233
234struct rtmsg; 217struct rtmsg;
235extern int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait); 218extern int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait);
236#endif 219#endif
diff --git a/include/linux/mroute6.h b/include/linux/mroute6.h
new file mode 100644
index 000000000000..e7989593142b
--- /dev/null
+++ b/include/linux/mroute6.h
@@ -0,0 +1,228 @@
1#ifndef __LINUX_MROUTE6_H
2#define __LINUX_MROUTE6_H
3
4#include <linux/types.h>
5#include <linux/sockios.h>
6
7/*
8 * Based on the MROUTING 3.5 defines primarily to keep
9 * source compatibility with BSD.
10 *
11 * See the pim6sd code for the original history.
12 *
13 * Protocol Independent Multicast (PIM) data structures included
14 * Carlos Picoto (cap@di.fc.ul.pt)
15 *
16 */
17
18#define MRT6_BASE 200
19#define MRT6_INIT (MRT6_BASE) /* Activate the kernel mroute code */
20#define MRT6_DONE (MRT6_BASE+1) /* Shutdown the kernel mroute */
21#define MRT6_ADD_MIF (MRT6_BASE+2) /* Add a virtual interface */
22#define MRT6_DEL_MIF (MRT6_BASE+3) /* Delete a virtual interface */
23#define MRT6_ADD_MFC (MRT6_BASE+4) /* Add a multicast forwarding entry */
24#define MRT6_DEL_MFC (MRT6_BASE+5) /* Delete a multicast forwarding entry */
25#define MRT6_VERSION (MRT6_BASE+6) /* Get the kernel multicast version */
26#define MRT6_ASSERT (MRT6_BASE+7) /* Activate PIM assert mode */
27#define MRT6_PIM (MRT6_BASE+8) /* enable PIM code */
28
29#define SIOCGETMIFCNT_IN6 SIOCPROTOPRIVATE /* IP protocol privates */
30#define SIOCGETSGCNT_IN6 (SIOCPROTOPRIVATE+1)
31#define SIOCGETRPF (SIOCPROTOPRIVATE+2)
32
33#define MAXMIFS 32
34typedef unsigned long mifbitmap_t; /* User mode code depends on this lot */
35typedef unsigned short mifi_t;
36#define ALL_MIFS ((mifi_t)(-1))
37
38#ifndef IF_SETSIZE
39#define IF_SETSIZE 256
40#endif
41
42typedef __u32 if_mask;
43#define NIFBITS (sizeof(if_mask) * 8) /* bits per mask */
44
45#if !defined(__KERNEL__) && !defined(DIV_ROUND_UP)
46#define DIV_ROUND_UP(x,y) (((x) + ((y) - 1)) / (y))
47#endif
48
49typedef struct if_set {
50 if_mask ifs_bits[DIV_ROUND_UP(IF_SETSIZE, NIFBITS)];
51} if_set;
52
53#define IF_SET(n, p) ((p)->ifs_bits[(n)/NIFBITS] |= (1 << ((n) % NIFBITS)))
54#define IF_CLR(n, p) ((p)->ifs_bits[(n)/NIFBITS] &= ~(1 << ((n) % NIFBITS)))
55#define IF_ISSET(n, p) ((p)->ifs_bits[(n)/NIFBITS] & (1 << ((n) % NIFBITS)))
56#define IF_COPY(f, t) bcopy(f, t, sizeof(*(f)))
57#define IF_ZERO(p) bzero(p, sizeof(*(p)))
58
59/*
60 * Passed by mrouted for an MRT_ADD_MIF - again we use the
61 * mrouted 3.6 structures for compatibility
62 */
63
64struct mif6ctl {
65 mifi_t mif6c_mifi; /* Index of MIF */
66 unsigned char mif6c_flags; /* MIFF_ flags */
67 unsigned char vifc_threshold; /* ttl limit */
68 u_short mif6c_pifi; /* the index of the physical IF */
69 unsigned int vifc_rate_limit; /* Rate limiter values (NI) */
70};
71
72#define MIFF_REGISTER 0x1 /* register vif */
73
74/*
75 * Cache manipulation structures for mrouted and PIMd
76 */
77
78struct mf6cctl
79{
80 struct sockaddr_in6 mf6cc_origin; /* Origin of mcast */
81 struct sockaddr_in6 mf6cc_mcastgrp; /* Group in question */
82 mifi_t mf6cc_parent; /* Where it arrived */
83 struct if_set mf6cc_ifset; /* Where it is going */
84};
85
86/*
87 * Group count retrieval for pim6sd
88 */
89
90struct sioc_sg_req6
91{
92 struct sockaddr_in6 src;
93 struct sockaddr_in6 grp;
94 unsigned long pktcnt;
95 unsigned long bytecnt;
96 unsigned long wrong_if;
97};
98
99/*
100 * To get vif packet counts
101 */
102
103struct sioc_mif_req6
104{
105 mifi_t mifi; /* Which iface */
106 unsigned long icount; /* In packets */
107 unsigned long ocount; /* Out packets */
108 unsigned long ibytes; /* In bytes */
109 unsigned long obytes; /* Out bytes */
110};
111
112/*
113 * That's all usermode folks
114 */
115
116#ifdef __KERNEL__
117
118#include <linux/skbuff.h> /* for struct sk_buff_head */
119
120#ifdef CONFIG_IPV6_MROUTE
121static inline int ip6_mroute_opt(int opt)
122{
123 return (opt >= MRT6_BASE) && (opt <= MRT6_BASE + 10);
124}
125#else
126static inline int ip6_mroute_opt(int opt)
127{
128 return 0;
129}
130#endif
131
132struct sock;
133
134extern int ip6_mroute_setsockopt(struct sock *, int, char __user *, int);
135extern int ip6_mroute_getsockopt(struct sock *, int, char __user *, int __user *);
136extern int ip6_mr_input(struct sk_buff *skb);
137extern int ip6mr_ioctl(struct sock *sk, int cmd, void __user *arg);
138extern void ip6_mr_init(void);
139
140struct mif_device
141{
142 struct net_device *dev; /* Device we are using */
143 unsigned long bytes_in,bytes_out;
144 unsigned long pkt_in,pkt_out; /* Statistics */
145 unsigned long rate_limit; /* Traffic shaping (NI) */
146 unsigned char threshold; /* TTL threshold */
147 unsigned short flags; /* Control flags */
148 int link; /* Physical interface index */
149};
150
151#define VIFF_STATIC 0x8000
152
153struct mfc6_cache
154{
155 struct mfc6_cache *next; /* Next entry on cache line */
156 struct in6_addr mf6c_mcastgrp; /* Group the entry belongs to */
157 struct in6_addr mf6c_origin; /* Source of packet */
158 mifi_t mf6c_parent; /* Source interface */
159 int mfc_flags; /* Flags on line */
160
161 union {
162 struct {
163 unsigned long expires;
164 struct sk_buff_head unresolved; /* Unresolved buffers */
165 } unres;
166 struct {
167 unsigned long last_assert;
168 int minvif;
169 int maxvif;
170 unsigned long bytes;
171 unsigned long pkt;
172 unsigned long wrong_if;
173 unsigned char ttls[MAXMIFS]; /* TTL thresholds */
174 } res;
175 } mfc_un;
176};
177
178#define MFC_STATIC 1
179#define MFC_NOTIFY 2
180
181#define MFC6_LINES 64
182
183#define MFC6_HASH(a, g) (((__force u32)(a)->s6_addr32[0] ^ \
184 (__force u32)(a)->s6_addr32[1] ^ \
185 (__force u32)(a)->s6_addr32[2] ^ \
186 (__force u32)(a)->s6_addr32[3] ^ \
187 (__force u32)(g)->s6_addr32[0] ^ \
188 (__force u32)(g)->s6_addr32[1] ^ \
189 (__force u32)(g)->s6_addr32[2] ^ \
190 (__force u32)(g)->s6_addr32[3]) % MFC6_LINES)
191
192#define MFC_ASSERT_THRESH (3*HZ) /* Maximal freq. of asserts */
193
194#endif
195
196#ifdef __KERNEL__
197struct rtmsg;
198extern int ip6mr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait);
199
200#ifdef CONFIG_IPV6_MROUTE
201extern struct sock *mroute6_socket;
202extern int ip6mr_sk_done(struct sock *sk);
203#else
204#define mroute6_socket NULL
205static inline int ip6mr_sk_done(struct sock *sk) { return 0; }
206#endif
207#endif
208
209/*
210 * Structure used to communicate from kernel to multicast router.
211 * We'll overlay the structure onto an MLD header (not an IPv6 heder like igmpmsg{}
212 * used for IPv4 implementation). This is because this structure will be passed via an
213 * IPv6 raw socket, on wich an application will only receiver the payload i.e the data after
214 * the IPv6 header and all the extension headers. (See section 3 of RFC 3542)
215 */
216
217struct mrt6msg {
218#define MRT6MSG_NOCACHE 1
219#define MRT6MSG_WRONGMIF 2
220#define MRT6MSG_WHOLEPKT 3 /* used for use level encap */
221 __u8 im6_mbz; /* must be zero */
222 __u8 im6_msgtype; /* what type of message */
223 __u16 im6_mif; /* mif rec'd on */
224 __u32 im6_pad; /* padding for 64 bit arch */
225 struct in6_addr im6_src, im6_dst;
226};
227
228#endif
diff --git a/include/linux/net.h b/include/linux/net.h
index c414d90e647b..71f7dd559285 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -19,6 +19,7 @@
19#define _LINUX_NET_H 19#define _LINUX_NET_H
20 20
21#include <linux/wait.h> 21#include <linux/wait.h>
22#include <linux/socket.h>
22#include <asm/socket.h> 23#include <asm/socket.h>
23 24
24struct poll_table_struct; 25struct poll_table_struct;
@@ -26,7 +27,7 @@ struct pipe_inode_info;
26struct inode; 27struct inode;
27struct net; 28struct net;
28 29
29#define NPROTO 34 /* should be enough for now.. */ 30#define NPROTO AF_MAX
30 31
31#define SYS_SOCKET 1 /* sys_socket(2) */ 32#define SYS_SOCKET 1 /* sys_socket(2) */
32#define SYS_BIND 2 /* sys_bind(2) */ 33#define SYS_BIND 2 /* sys_bind(2) */
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ee81906b5164..7c1d4466583b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -710,8 +710,10 @@ struct net_device
710 void (*poll_controller)(struct net_device *dev); 710 void (*poll_controller)(struct net_device *dev);
711#endif 711#endif
712 712
713#ifdef CONFIG_NET_NS
713 /* Network namespace this network device is inside */ 714 /* Network namespace this network device is inside */
714 struct net *nd_net; 715 struct net *nd_net;
716#endif
715 717
716 /* bridge stuff */ 718 /* bridge stuff */
717 struct net_bridge_port *br_port; 719 struct net_bridge_port *br_port;
@@ -726,6 +728,10 @@ struct net_device
726 /* rtnetlink link ops */ 728 /* rtnetlink link ops */
727 const struct rtnl_link_ops *rtnl_link_ops; 729 const struct rtnl_link_ops *rtnl_link_ops;
728 730
731 /* for setting kernel sock attribute on TCP connection setup */
732#define GSO_MAX_SIZE 65536
733 unsigned int gso_max_size;
734
729 /* The TX queue control structures */ 735 /* The TX queue control structures */
730 unsigned int egress_subqueue_count; 736 unsigned int egress_subqueue_count;
731 struct net_device_subqueue egress_subqueue[1]; 737 struct net_device_subqueue egress_subqueue[1];
@@ -735,6 +741,28 @@ struct net_device
735#define NETDEV_ALIGN 32 741#define NETDEV_ALIGN 32
736#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1) 742#define NETDEV_ALIGN_CONST (NETDEV_ALIGN - 1)
737 743
744/*
745 * Net namespace inlines
746 */
747static inline
748struct net *dev_net(const struct net_device *dev)
749{
750#ifdef CONFIG_NET_NS
751 return dev->nd_net;
752#else
753 return &init_net;
754#endif
755}
756
757static inline
758void dev_net_set(struct net_device *dev, struct net *net)
759{
760#ifdef CONFIG_NET_NS
761 release_net(dev->nd_net);
762 dev->nd_net = hold_net(net);
763#endif
764}
765
738/** 766/**
739 * netdev_priv - access network device private data 767 * netdev_priv - access network device private data
740 * @dev: network device 768 * @dev: network device
@@ -811,7 +839,7 @@ static inline struct net_device *next_net_device(struct net_device *dev)
811 struct list_head *lh; 839 struct list_head *lh;
812 struct net *net; 840 struct net *net;
813 841
814 net = dev->nd_net; 842 net = dev_net(dev);
815 lh = dev->dev_list.next; 843 lh = dev->dev_list.next;
816 return lh == &net->dev_base_head ? NULL : net_device_entry(lh); 844 return lh == &net->dev_base_head ? NULL : net_device_entry(lh);
817} 845}
@@ -1479,6 +1507,12 @@ static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
1479 unlikely(skb->ip_summed != CHECKSUM_PARTIAL)); 1507 unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
1480} 1508}
1481 1509
1510static inline void netif_set_gso_max_size(struct net_device *dev,
1511 unsigned int size)
1512{
1513 dev->gso_max_size = size;
1514}
1515
1482/* On bonding slaves other than the currently active slave, suppress 1516/* On bonding slaves other than the currently active slave, suppress
1483 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and 1517 * duplicates except for 802.3ad ETH_P_SLOW, alb non-mcast/bcast, and
1484 * ARP on active-backup slaves with arp_validate enabled. 1518 * ARP on active-backup slaves with arp_validate enabled.
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index f0680c2bee73..e4c66593b5c6 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -6,11 +6,13 @@
6#include <linux/types.h> 6#include <linux/types.h>
7#include <linux/skbuff.h> 7#include <linux/skbuff.h>
8#include <linux/net.h> 8#include <linux/net.h>
9#include <linux/netdevice.h>
9#include <linux/if.h> 10#include <linux/if.h>
10#include <linux/in.h> 11#include <linux/in.h>
11#include <linux/in6.h> 12#include <linux/in6.h>
12#include <linux/wait.h> 13#include <linux/wait.h>
13#include <linux/list.h> 14#include <linux/list.h>
15#include <net/net_namespace.h>
14#endif 16#endif
15#include <linux/compiler.h> 17#include <linux/compiler.h>
16 18
@@ -61,13 +63,21 @@ union nf_inet_addr {
61#ifdef __KERNEL__ 63#ifdef __KERNEL__
62#ifdef CONFIG_NETFILTER 64#ifdef CONFIG_NETFILTER
63 65
66static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1,
67 const union nf_inet_addr *a2)
68{
69 return a1->all[0] == a2->all[0] &&
70 a1->all[1] == a2->all[1] &&
71 a1->all[2] == a2->all[2] &&
72 a1->all[3] == a2->all[3];
73}
74
64extern void netfilter_init(void); 75extern void netfilter_init(void);
65 76
66/* Largest hook number + 1 */ 77/* Largest hook number + 1 */
67#define NF_MAX_HOOKS 8 78#define NF_MAX_HOOKS 8
68 79
69struct sk_buff; 80struct sk_buff;
70struct net_device;
71 81
72typedef unsigned int nf_hookfn(unsigned int hooknum, 82typedef unsigned int nf_hookfn(unsigned int hooknum,
73 struct sk_buff *skb, 83 struct sk_buff *skb,
@@ -224,6 +234,11 @@ struct nf_afinfo {
224 unsigned short family; 234 unsigned short family;
225 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook, 235 __sum16 (*checksum)(struct sk_buff *skb, unsigned int hook,
226 unsigned int dataoff, u_int8_t protocol); 236 unsigned int dataoff, u_int8_t protocol);
237 __sum16 (*checksum_partial)(struct sk_buff *skb,
238 unsigned int hook,
239 unsigned int dataoff,
240 unsigned int len,
241 u_int8_t protocol);
227 int (*route)(struct dst_entry **dst, struct flowi *fl); 242 int (*route)(struct dst_entry **dst, struct flowi *fl);
228 void (*saveroute)(const struct sk_buff *skb, 243 void (*saveroute)(const struct sk_buff *skb,
229 struct nf_queue_entry *entry); 244 struct nf_queue_entry *entry);
@@ -253,6 +268,23 @@ nf_checksum(struct sk_buff *skb, unsigned int hook, unsigned int dataoff,
253 return csum; 268 return csum;
254} 269}
255 270
271static inline __sum16
272nf_checksum_partial(struct sk_buff *skb, unsigned int hook,
273 unsigned int dataoff, unsigned int len,
274 u_int8_t protocol, unsigned short family)
275{
276 const struct nf_afinfo *afinfo;
277 __sum16 csum = 0;
278
279 rcu_read_lock();
280 afinfo = nf_get_afinfo(family);
281 if (afinfo)
282 csum = afinfo->checksum_partial(skb, hook, dataoff, len,
283 protocol);
284 rcu_read_unlock();
285 return csum;
286}
287
256extern int nf_register_afinfo(const struct nf_afinfo *afinfo); 288extern int nf_register_afinfo(const struct nf_afinfo *afinfo);
257extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo); 289extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
258 290
@@ -311,5 +343,56 @@ extern void (*nf_ct_destroy)(struct nf_conntrack *);
311static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {} 343static inline void nf_ct_attach(struct sk_buff *new, struct sk_buff *skb) {}
312#endif 344#endif
313 345
346static inline struct net *nf_pre_routing_net(const struct net_device *in,
347 const struct net_device *out)
348{
349#ifdef CONFIG_NET_NS
350 return in->nd_net;
351#else
352 return &init_net;
353#endif
354}
355
356static inline struct net *nf_local_in_net(const struct net_device *in,
357 const struct net_device *out)
358{
359#ifdef CONFIG_NET_NS
360 return in->nd_net;
361#else
362 return &init_net;
363#endif
364}
365
366static inline struct net *nf_forward_net(const struct net_device *in,
367 const struct net_device *out)
368{
369#ifdef CONFIG_NET_NS
370 BUG_ON(in->nd_net != out->nd_net);
371 return in->nd_net;
372#else
373 return &init_net;
374#endif
375}
376
377static inline struct net *nf_local_out_net(const struct net_device *in,
378 const struct net_device *out)
379{
380#ifdef CONFIG_NET_NS
381 return out->nd_net;
382#else
383 return &init_net;
384#endif
385}
386
387static inline struct net *nf_post_routing_net(const struct net_device *in,
388 const struct net_device *out)
389{
390#ifdef CONFIG_NET_NS
391 return out->nd_net;
392#else
393 return &init_net;
394#endif
395}
396
314#endif /*__KERNEL__*/ 397#endif /*__KERNEL__*/
315#endif /*__LINUX_NETFILTER_H*/ 398#endif /*__LINUX_NETFILTER_H*/
diff --git a/include/linux/netfilter/nf_conntrack_dccp.h b/include/linux/netfilter/nf_conntrack_dccp.h
new file mode 100644
index 000000000000..40dcc82058d1
--- /dev/null
+++ b/include/linux/netfilter/nf_conntrack_dccp.h
@@ -0,0 +1,40 @@
1#ifndef _NF_CONNTRACK_DCCP_H
2#define _NF_CONNTRACK_DCCP_H
3
4/* Exposed to userspace over nfnetlink */
5enum ct_dccp_states {
6 CT_DCCP_NONE,
7 CT_DCCP_REQUEST,
8 CT_DCCP_RESPOND,
9 CT_DCCP_PARTOPEN,
10 CT_DCCP_OPEN,
11 CT_DCCP_CLOSEREQ,
12 CT_DCCP_CLOSING,
13 CT_DCCP_TIMEWAIT,
14 CT_DCCP_IGNORE,
15 CT_DCCP_INVALID,
16 __CT_DCCP_MAX
17};
18#define CT_DCCP_MAX (__CT_DCCP_MAX - 1)
19
20enum ct_dccp_roles {
21 CT_DCCP_ROLE_CLIENT,
22 CT_DCCP_ROLE_SERVER,
23 __CT_DCCP_ROLE_MAX
24};
25#define CT_DCCP_ROLE_MAX (__CT_DCCP_ROLE_MAX - 1)
26
27#ifdef __KERNEL__
28#include <net/netfilter/nf_conntrack_tuple.h>
29
30struct nf_ct_dccp {
31 u_int8_t role[IP_CT_DIR_MAX];
32 u_int8_t state;
33 u_int8_t last_pkt;
34 u_int8_t last_dir;
35 u_int64_t handshake_seq;
36};
37
38#endif /* __KERNEL__ */
39
40#endif /* _NF_CONNTRACK_DCCP_H */
diff --git a/include/linux/netfilter/nf_conntrack_sip.h b/include/linux/netfilter/nf_conntrack_sip.h
index 8e5ce1ca7bfc..5da04e586a3f 100644
--- a/include/linux/netfilter/nf_conntrack_sip.h
+++ b/include/linux/netfilter/nf_conntrack_sip.h
@@ -5,37 +5,164 @@
5#define SIP_PORT 5060 5#define SIP_PORT 5060
6#define SIP_TIMEOUT 3600 6#define SIP_TIMEOUT 3600
7 7
8enum sip_header_pos { 8struct nf_ct_sip_master {
9 POS_REG_REQ_URI, 9 unsigned int register_cseq;
10 POS_REQ_URI, 10};
11 POS_FROM, 11
12 POS_TO, 12enum sip_expectation_classes {
13 POS_VIA, 13 SIP_EXPECT_SIGNALLING,
14 POS_CONTACT, 14 SIP_EXPECT_AUDIO,
15 POS_CONTENT, 15 SIP_EXPECT_VIDEO,
16 POS_MEDIA, 16 __SIP_EXPECT_MAX
17 POS_OWNER_IP4, 17};
18 POS_CONNECTION_IP4, 18#define SIP_EXPECT_MAX (__SIP_EXPECT_MAX - 1)
19 POS_OWNER_IP6, 19
20 POS_CONNECTION_IP6, 20struct sdp_media_type {
21 POS_SDP_HEADER, 21 const char *name;
22 unsigned int len;
23 enum sip_expectation_classes class;
24};
25
26#define SDP_MEDIA_TYPE(__name, __class) \
27{ \
28 .name = (__name), \
29 .len = sizeof(__name) - 1, \
30 .class = (__class), \
31}
32
33struct sip_handler {
34 const char *method;
35 unsigned int len;
36 int (*request)(struct sk_buff *skb,
37 const char **dptr, unsigned int *datalen,
38 unsigned int cseq);
39 int (*response)(struct sk_buff *skb,
40 const char **dptr, unsigned int *datalen,
41 unsigned int cseq, unsigned int code);
42};
43
44#define SIP_HANDLER(__method, __request, __response) \
45{ \
46 .method = (__method), \
47 .len = sizeof(__method) - 1, \
48 .request = (__request), \
49 .response = (__response), \
50}
51
52struct sip_header {
53 const char *name;
54 const char *cname;
55 const char *search;
56 unsigned int len;
57 unsigned int clen;
58 unsigned int slen;
59 int (*match_len)(const struct nf_conn *ct,
60 const char *dptr, const char *limit,
61 int *shift);
62};
63
64#define __SIP_HDR(__name, __cname, __search, __match) \
65{ \
66 .name = (__name), \
67 .len = sizeof(__name) - 1, \
68 .cname = (__cname), \
69 .clen = (__cname) ? sizeof(__cname) - 1 : 0, \
70 .search = (__search), \
71 .slen = (__search) ? sizeof(__search) - 1 : 0, \
72 .match_len = (__match), \
73}
74
75#define SIP_HDR(__name, __cname, __search, __match) \
76 __SIP_HDR(__name, __cname, __search, __match)
77
78#define SDP_HDR(__name, __search, __match) \
79 __SIP_HDR(__name, NULL, __search, __match)
80
81enum sip_header_types {
82 SIP_HDR_CSEQ,
83 SIP_HDR_FROM,
84 SIP_HDR_TO,
85 SIP_HDR_CONTACT,
86 SIP_HDR_VIA,
87 SIP_HDR_EXPIRES,
88 SIP_HDR_CONTENT_LENGTH,
89};
90
91enum sdp_header_types {
92 SDP_HDR_UNSPEC,
93 SDP_HDR_VERSION,
94 SDP_HDR_OWNER_IP4,
95 SDP_HDR_CONNECTION_IP4,
96 SDP_HDR_OWNER_IP6,
97 SDP_HDR_CONNECTION_IP6,
98 SDP_HDR_MEDIA,
22}; 99};
23 100
24extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb, 101extern unsigned int (*nf_nat_sip_hook)(struct sk_buff *skb,
25 enum ip_conntrack_info ctinfo, 102 const char **dptr,
26 struct nf_conn *ct, 103 unsigned int *datalen);
27 const char **dptr); 104extern unsigned int (*nf_nat_sip_expect_hook)(struct sk_buff *skb,
28extern unsigned int (*nf_nat_sdp_hook)(struct sk_buff *skb, 105 const char **dptr,
29 enum ip_conntrack_info ctinfo, 106 unsigned int *datalen,
30 struct nf_conntrack_expect *exp, 107 struct nf_conntrack_expect *exp,
31 const char *dptr); 108 unsigned int matchoff,
32 109 unsigned int matchlen);
33extern int ct_sip_get_info(const struct nf_conn *ct, const char *dptr, 110extern unsigned int (*nf_nat_sdp_addr_hook)(struct sk_buff *skb,
34 size_t dlen, unsigned int *matchoff, 111 const char **dptr,
35 unsigned int *matchlen, enum sip_header_pos pos); 112 unsigned int dataoff,
36extern int ct_sip_lnlen(const char *line, const char *limit); 113 unsigned int *datalen,
37extern const char *ct_sip_search(const char *needle, const char *haystack, 114 enum sdp_header_types type,
38 size_t needle_len, size_t haystack_len, 115 enum sdp_header_types term,
39 int case_sensitive); 116 const union nf_inet_addr *addr);
117extern unsigned int (*nf_nat_sdp_port_hook)(struct sk_buff *skb,
118 const char **dptr,
119 unsigned int *datalen,
120 unsigned int matchoff,
121 unsigned int matchlen,
122 u_int16_t port);
123extern unsigned int (*nf_nat_sdp_session_hook)(struct sk_buff *skb,
124 const char **dptr,
125 unsigned int dataoff,
126 unsigned int *datalen,
127 const union nf_inet_addr *addr);
128extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb,
129 const char **dptr,
130 unsigned int *datalen,
131 struct nf_conntrack_expect *rtp_exp,
132 struct nf_conntrack_expect *rtcp_exp,
133 unsigned int mediaoff,
134 unsigned int medialen,
135 union nf_inet_addr *rtp_addr);
136
137extern int ct_sip_parse_request(const struct nf_conn *ct,
138 const char *dptr, unsigned int datalen,
139 unsigned int *matchoff, unsigned int *matchlen,
140 union nf_inet_addr *addr, __be16 *port);
141extern int ct_sip_get_header(const struct nf_conn *ct, const char *dptr,
142 unsigned int dataoff, unsigned int datalen,
143 enum sip_header_types type,
144 unsigned int *matchoff, unsigned int *matchlen);
145extern int ct_sip_parse_header_uri(const struct nf_conn *ct, const char *dptr,
146 unsigned int *dataoff, unsigned int datalen,
147 enum sip_header_types type, int *in_header,
148 unsigned int *matchoff, unsigned int *matchlen,
149 union nf_inet_addr *addr, __be16 *port);
150extern int ct_sip_parse_address_param(const struct nf_conn *ct, const char *dptr,
151 unsigned int dataoff, unsigned int datalen,
152 const char *name,
153 unsigned int *matchoff, unsigned int *matchlen,
154 union nf_inet_addr *addr);
155extern int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr,
156 unsigned int off, unsigned int datalen,
157 const char *name,
158 unsigned int *matchoff, unsigned int *matchen,
159 unsigned int *val);
160
161extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr,
162 unsigned int dataoff, unsigned int datalen,
163 enum sdp_header_types type,
164 enum sdp_header_types term,
165 unsigned int *matchoff, unsigned int *matchlen);
166
40#endif /* __KERNEL__ */ 167#endif /* __KERNEL__ */
41#endif /* __NF_CONNTRACK_SIP_H__ */ 168#endif /* __NF_CONNTRACK_SIP_H__ */
diff --git a/include/linux/netfilter/nfnetlink_conntrack.h b/include/linux/netfilter/nfnetlink_conntrack.h
index e3e1533aba2d..0a383ac083cb 100644
--- a/include/linux/netfilter/nfnetlink_conntrack.h
+++ b/include/linux/netfilter/nfnetlink_conntrack.h
@@ -80,6 +80,7 @@ enum ctattr_l4proto {
80enum ctattr_protoinfo { 80enum ctattr_protoinfo {
81 CTA_PROTOINFO_UNSPEC, 81 CTA_PROTOINFO_UNSPEC,
82 CTA_PROTOINFO_TCP, 82 CTA_PROTOINFO_TCP,
83 CTA_PROTOINFO_DCCP,
83 __CTA_PROTOINFO_MAX 84 __CTA_PROTOINFO_MAX
84}; 85};
85#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1) 86#define CTA_PROTOINFO_MAX (__CTA_PROTOINFO_MAX - 1)
@@ -95,6 +96,13 @@ enum ctattr_protoinfo_tcp {
95}; 96};
96#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1) 97#define CTA_PROTOINFO_TCP_MAX (__CTA_PROTOINFO_TCP_MAX - 1)
97 98
99enum ctattr_protoinfo_dccp {
100 CTA_PROTOINFO_DCCP_UNSPEC,
101 CTA_PROTOINFO_DCCP_STATE,
102 __CTA_PROTOINFO_DCCP_MAX,
103};
104#define CTA_PROTOINFO_DCCP_MAX (__CTA_PROTOINFO_DCCP_MAX - 1)
105
98enum ctattr_counters { 106enum ctattr_counters {
99 CTA_COUNTERS_UNSPEC, 107 CTA_COUNTERS_UNSPEC,
100 CTA_COUNTERS_PACKETS, /* old 64bit counters */ 108 CTA_COUNTERS_PACKETS, /* old 64bit counters */
diff --git a/include/linux/netfilter/x_tables.h b/include/linux/netfilter/x_tables.h
index b2c62cc618f5..2326296b6f25 100644
--- a/include/linux/netfilter/x_tables.h
+++ b/include/linux/netfilter/x_tables.h
@@ -430,13 +430,13 @@ extern int xt_compat_add_offset(int af, unsigned int offset, short delta);
430extern void xt_compat_flush_offsets(int af); 430extern void xt_compat_flush_offsets(int af);
431extern short xt_compat_calc_jump(int af, unsigned int offset); 431extern short xt_compat_calc_jump(int af, unsigned int offset);
432 432
433extern int xt_compat_match_offset(struct xt_match *match); 433extern int xt_compat_match_offset(const struct xt_match *match);
434extern int xt_compat_match_from_user(struct xt_entry_match *m, 434extern int xt_compat_match_from_user(struct xt_entry_match *m,
435 void **dstptr, unsigned int *size); 435 void **dstptr, unsigned int *size);
436extern int xt_compat_match_to_user(struct xt_entry_match *m, 436extern int xt_compat_match_to_user(struct xt_entry_match *m,
437 void __user **dstptr, unsigned int *size); 437 void __user **dstptr, unsigned int *size);
438 438
439extern int xt_compat_target_offset(struct xt_target *target); 439extern int xt_compat_target_offset(const struct xt_target *target);
440extern void xt_compat_target_from_user(struct xt_entry_target *t, 440extern void xt_compat_target_from_user(struct xt_entry_target *t,
441 void **dstptr, unsigned int *size); 441 void **dstptr, unsigned int *size);
442extern int xt_compat_target_to_user(struct xt_entry_target *t, 442extern int xt_compat_target_to_user(struct xt_entry_target *t,
diff --git a/include/linux/netfilter/xt_sctp.h b/include/linux/netfilter/xt_sctp.h
index dd5a4fd4cfd3..32000ba6ecef 100644
--- a/include/linux/netfilter/xt_sctp.h
+++ b/include/linux/netfilter/xt_sctp.h
@@ -37,68 +37,54 @@ struct xt_sctp_info {
37 37
38#define SCTP_CHUNKMAP_SET(chunkmap, type) \ 38#define SCTP_CHUNKMAP_SET(chunkmap, type) \
39 do { \ 39 do { \
40 chunkmap[type / bytes(u_int32_t)] |= \ 40 (chunkmap)[type / bytes(u_int32_t)] |= \
41 1 << (type % bytes(u_int32_t)); \ 41 1 << (type % bytes(u_int32_t)); \
42 } while (0) 42 } while (0)
43 43
44#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \ 44#define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
45 do { \ 45 do { \
46 chunkmap[type / bytes(u_int32_t)] &= \ 46 (chunkmap)[type / bytes(u_int32_t)] &= \
47 ~(1 << (type % bytes(u_int32_t))); \ 47 ~(1 << (type % bytes(u_int32_t))); \
48 } while (0) 48 } while (0)
49 49
50#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \ 50#define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
51({ \ 51({ \
52 (chunkmap[type / bytes (u_int32_t)] & \ 52 ((chunkmap)[type / bytes (u_int32_t)] & \
53 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \ 53 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \
54}) 54})
55 55
56#define SCTP_CHUNKMAP_RESET(chunkmap) \ 56#define SCTP_CHUNKMAP_RESET(chunkmap) \
57 do { \ 57 memset((chunkmap), 0, sizeof(chunkmap))
58 int i; \ 58
59 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \ 59#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
60 chunkmap[i] = 0; \ 60 memset((chunkmap), ~0U, sizeof(chunkmap))
61 } while (0) 61
62 62#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
63#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \ 63 memcpy((destmap), (srcmap), sizeof(srcmap))
64 do { \ 64
65 int i; \ 65#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
66 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \ 66 __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
67 chunkmap[i] = ~0; \ 67static inline bool
68 } while (0) 68__sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned int n)
69 69{
70#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \ 70 unsigned int i;
71 do { \ 71 for (i = 0; i < n; ++i)
72 int i; \ 72 if (chunkmap[i])
73 for (i = 0; i < ARRAY_SIZE(srcmap); i++) \ 73 return false;
74 destmap[i] = srcmap[i]; \ 74 return true;
75 } while (0) 75}
76 76
77#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \ 77#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
78({ \ 78 __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
79 int i; \ 79static inline bool
80 int flag = 1; \ 80__sctp_chunkmap_is_all_set(const u_int32_t *chunkmap, unsigned int n)
81 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \ 81{
82 if (chunkmap[i]) { \ 82 unsigned int i;
83 flag = 0; \ 83 for (i = 0; i < n; ++i)
84 break; \ 84 if (chunkmap[i] != ~0U)
85 } \ 85 return false;
86 } \ 86 return true;
87 flag; \ 87}
88})
89
90#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
91({ \
92 int i; \
93 int flag = 1; \
94 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
95 if (chunkmap[i] != ~0) { \
96 flag = 0; \
97 break; \
98 } \
99 } \
100 flag; \
101})
102 88
103#endif /* _XT_SCTP_H_ */ 89#endif /* _XT_SCTP_H_ */
104 90
diff --git a/include/linux/netfilter_arp/arp_tables.h b/include/linux/netfilter_arp/arp_tables.h
index db223ca92c8b..dd9c97f2d436 100644
--- a/include/linux/netfilter_arp/arp_tables.h
+++ b/include/linux/netfilter_arp/arp_tables.h
@@ -23,8 +23,6 @@
23 23
24#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN 24#define ARPT_FUNCTION_MAXNAMELEN XT_FUNCTION_MAXNAMELEN
25#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN 25#define ARPT_TABLE_MAXNAMELEN XT_TABLE_MAXNAMELEN
26#define arpt_target xt_target
27#define arpt_table xt_table
28 26
29#define ARPT_DEV_ADDR_LEN_MAX 16 27#define ARPT_DEV_ADDR_LEN_MAX 16
30 28
@@ -266,20 +264,15 @@ struct arpt_error
266 .target.errorname = "ERROR", \ 264 .target.errorname = "ERROR", \
267} 265}
268 266
269#define arpt_register_target(tgt) \ 267extern struct xt_table *arpt_register_table(struct net *net,
270({ (tgt)->family = NF_ARP; \ 268 struct xt_table *table,
271 xt_register_target(tgt); }) 269 const struct arpt_replace *repl);
272#define arpt_unregister_target(tgt) xt_unregister_target(tgt) 270extern void arpt_unregister_table(struct xt_table *table);
273
274extern struct arpt_table *arpt_register_table(struct net *net,
275 struct arpt_table *table,
276 const struct arpt_replace *repl);
277extern void arpt_unregister_table(struct arpt_table *table);
278extern unsigned int arpt_do_table(struct sk_buff *skb, 271extern unsigned int arpt_do_table(struct sk_buff *skb,
279 unsigned int hook, 272 unsigned int hook,
280 const struct net_device *in, 273 const struct net_device *in,
281 const struct net_device *out, 274 const struct net_device *out,
282 struct arpt_table *table); 275 struct xt_table *table);
283 276
284#define ARPT_ALIGN(s) XT_ALIGN(s) 277#define ARPT_ALIGN(s) XT_ALIGN(s)
285 278
diff --git a/include/linux/netfilter_bridge/ebt_nflog.h b/include/linux/netfilter_bridge/ebt_nflog.h
new file mode 100644
index 000000000000..052817849b83
--- /dev/null
+++ b/include/linux/netfilter_bridge/ebt_nflog.h
@@ -0,0 +1,21 @@
1#ifndef __LINUX_BRIDGE_EBT_NFLOG_H
2#define __LINUX_BRIDGE_EBT_NFLOG_H
3
4#define EBT_NFLOG_MASK 0x0
5
6#define EBT_NFLOG_PREFIX_SIZE 64
7#define EBT_NFLOG_WATCHER "nflog"
8
9#define EBT_NFLOG_DEFAULT_GROUP 0x1
10#define EBT_NFLOG_DEFAULT_THRESHOLD 1
11
12struct ebt_nflog_info {
13 u_int32_t len;
14 u_int16_t group;
15 u_int16_t threshold;
16 u_int16_t flags;
17 u_int16_t pad;
18 char prefix[EBT_NFLOG_PREFIX_SIZE];
19};
20
21#endif /* __LINUX_BRIDGE_EBT_NFLOG_H */
diff --git a/include/linux/netfilter_ipv4.h b/include/linux/netfilter_ipv4.h
index 9a10092e358c..650318b0c405 100644
--- a/include/linux/netfilter_ipv4.h
+++ b/include/linux/netfilter_ipv4.h
@@ -62,8 +62,6 @@ enum nf_ip_hook_priorities {
62 NF_IP_PRI_FILTER = 0, 62 NF_IP_PRI_FILTER = 0,
63 NF_IP_PRI_NAT_SRC = 100, 63 NF_IP_PRI_NAT_SRC = 100,
64 NF_IP_PRI_SELINUX_LAST = 225, 64 NF_IP_PRI_SELINUX_LAST = 225,
65 NF_IP_PRI_CONNTRACK_HELPER = INT_MAX - 2,
66 NF_IP_PRI_NAT_SEQ_ADJUST = INT_MAX - 1,
67 NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX, 65 NF_IP_PRI_CONNTRACK_CONFIRM = INT_MAX,
68 NF_IP_PRI_LAST = INT_MAX, 66 NF_IP_PRI_LAST = INT_MAX,
69}; 67};
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index 9fecf902419c..ea6517e58b04 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -78,6 +78,18 @@
78 * or, if no MAC address given, all stations, on the interface identified 78 * or, if no MAC address given, all stations, on the interface identified
79 * by %NL80211_ATTR_IFINDEX. 79 * by %NL80211_ATTR_IFINDEX.
80 * 80 *
81 * @NL80211_CMD_GET_MPATH: Get mesh path attributes for mesh path to
82 * destination %NL80211_ATTR_MAC on the interface identified by
83 * %NL80211_ATTR_IFINDEX.
84 * @NL80211_CMD_SET_MPATH: Set mesh path attributes for mesh path to
85 * destination %NL80211_ATTR_MAC on the interface identified by
86 * %NL80211_ATTR_IFINDEX.
87 * @NL80211_CMD_NEW_PATH: Add a mesh path with given attributes to the
88 * the interface identified by %NL80211_ATTR_IFINDEX.
89 * @NL80211_CMD_DEL_PATH: Remove a mesh path identified by %NL80211_ATTR_MAC
90 * or, if no MAC address given, all mesh paths, on the interface identified
91 * by %NL80211_ATTR_IFINDEX.
92 *
81 * @NL80211_CMD_MAX: highest used command number 93 * @NL80211_CMD_MAX: highest used command number
82 * @__NL80211_CMD_AFTER_LAST: internal use 94 * @__NL80211_CMD_AFTER_LAST: internal use
83 */ 95 */
@@ -112,6 +124,11 @@ enum nl80211_commands {
112 124
113 /* add commands here */ 125 /* add commands here */
114 126
127 NL80211_CMD_GET_MPATH,
128 NL80211_CMD_SET_MPATH,
129 NL80211_CMD_NEW_MPATH,
130 NL80211_CMD_DEL_MPATH,
131
115 /* used to define NL80211_CMD_MAX below */ 132 /* used to define NL80211_CMD_MAX below */
116 __NL80211_CMD_AFTER_LAST, 133 __NL80211_CMD_AFTER_LAST,
117 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1 134 NL80211_CMD_MAX = __NL80211_CMD_AFTER_LAST - 1
@@ -157,9 +174,23 @@ enum nl80211_commands {
157 * restriction (at most %NL80211_MAX_SUPP_RATES). 174 * restriction (at most %NL80211_MAX_SUPP_RATES).
158 * @NL80211_ATTR_STA_VLAN: interface index of VLAN interface to move station 175 * @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. 176 * 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 177 * @NL80211_ATTR_STA_INFO: information about a station, part of station info
161 * given for %NL80211_CMD_GET_STATION, nested attribute containing 178 * given for %NL80211_CMD_GET_STATION, nested attribute containing
162 * info as possible, see &enum nl80211_sta_stats. 179 * info as possible, see &enum nl80211_sta_info.
180 *
181 * @NL80211_ATTR_WIPHY_BANDS: Information about an operating bands,
182 * consisting of a nested array.
183 *
184 * @NL80211_ATTR_MESH_ID: mesh id (1-32 bytes).
185 * @NL80211_ATTR_PLINK_ACTION: action to perform on the mesh peer link.
186 * @NL80211_ATTR_MPATH_NEXT_HOP: MAC address of the next hop for a mesh path.
187 * @NL80211_ATTR_MPATH_INFO: information about a mesh_path, part of mesh path
188 * info given for %NL80211_CMD_GET_MPATH, nested attribute described at
189 * &enum nl80211_mpath_info.
190 *
191 *
192 * @NL80211_ATTR_MNTR_FLAGS: flags, nested element with NLA_FLAG attributes of
193 * &enum nl80211_mntr_flags.
163 * 194 *
164 * @NL80211_ATTR_MAX: highest attribute number currently defined 195 * @NL80211_ATTR_MAX: highest attribute number currently defined
165 * @__NL80211_ATTR_AFTER_LAST: internal use 196 * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -193,10 +224,19 @@ enum nl80211_attrs {
193 NL80211_ATTR_STA_LISTEN_INTERVAL, 224 NL80211_ATTR_STA_LISTEN_INTERVAL,
194 NL80211_ATTR_STA_SUPPORTED_RATES, 225 NL80211_ATTR_STA_SUPPORTED_RATES,
195 NL80211_ATTR_STA_VLAN, 226 NL80211_ATTR_STA_VLAN,
196 NL80211_ATTR_STA_STATS, 227 NL80211_ATTR_STA_INFO,
228
229 NL80211_ATTR_WIPHY_BANDS,
230
231 NL80211_ATTR_MNTR_FLAGS,
197 232
198 /* add attributes here, update the policy in nl80211.c */ 233 /* add attributes here, update the policy in nl80211.c */
199 234
235 NL80211_ATTR_MESH_ID,
236 NL80211_ATTR_STA_PLINK_ACTION,
237 NL80211_ATTR_MPATH_NEXT_HOP,
238 NL80211_ATTR_MPATH_INFO,
239
200 __NL80211_ATTR_AFTER_LAST, 240 __NL80211_ATTR_AFTER_LAST,
201 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1 241 NL80211_ATTR_MAX = __NL80211_ATTR_AFTER_LAST - 1
202}; 242};
@@ -213,6 +253,7 @@ enum nl80211_attrs {
213 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points 253 * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
214 * @NL80211_IFTYPE_WDS: wireless distribution interface 254 * @NL80211_IFTYPE_WDS: wireless distribution interface
215 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames 255 * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
256 * @NL80211_IFTYPE_MESH_POINT: mesh point
216 * @NL80211_IFTYPE_MAX: highest interface type number currently defined 257 * @NL80211_IFTYPE_MAX: highest interface type number currently defined
217 * @__NL80211_IFTYPE_AFTER_LAST: internal use 258 * @__NL80211_IFTYPE_AFTER_LAST: internal use
218 * 259 *
@@ -228,6 +269,7 @@ enum nl80211_iftype {
228 NL80211_IFTYPE_AP_VLAN, 269 NL80211_IFTYPE_AP_VLAN,
229 NL80211_IFTYPE_WDS, 270 NL80211_IFTYPE_WDS,
230 NL80211_IFTYPE_MONITOR, 271 NL80211_IFTYPE_MONITOR,
272 NL80211_IFTYPE_MESH_POINT,
231 273
232 /* keep last */ 274 /* keep last */
233 __NL80211_IFTYPE_AFTER_LAST, 275 __NL80211_IFTYPE_AFTER_LAST,
@@ -257,27 +299,167 @@ enum nl80211_sta_flags {
257}; 299};
258 300
259/** 301/**
260 * enum nl80211_sta_stats - station statistics 302 * enum nl80211_sta_info - station information
261 * 303 *
262 * These attribute types are used with %NL80211_ATTR_STA_STATS 304 * These attribute types are used with %NL80211_ATTR_STA_INFO
263 * when getting information about a station. 305 * when getting information about a station.
264 * 306 *
265 * @__NL80211_STA_STAT_INVALID: attribute number 0 is reserved 307 * @__NL80211_STA_INFO_INVALID: attribute number 0 is reserved
266 * @NL80211_STA_STAT_INACTIVE_TIME: time since last activity (u32, msecs) 308 * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs)
267 * @NL80211_STA_STAT_RX_BYTES: total received bytes (u32, from this station) 309 * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station)
268 * @NL80211_STA_STAT_TX_BYTES: total transmitted bytes (u32, to this station) 310 * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station)
269 * @__NL80211_STA_STAT_AFTER_LAST: internal 311 * @__NL80211_STA_INFO_AFTER_LAST: internal
270 * @NL80211_STA_STAT_MAX: highest possible station stats attribute 312 * @NL80211_STA_INFO_MAX: highest possible station info attribute
313 */
314enum nl80211_sta_info {
315 __NL80211_STA_INFO_INVALID,
316 NL80211_STA_INFO_INACTIVE_TIME,
317 NL80211_STA_INFO_RX_BYTES,
318 NL80211_STA_INFO_TX_BYTES,
319 NL80211_STA_INFO_LLID,
320 NL80211_STA_INFO_PLID,
321 NL80211_STA_INFO_PLINK_STATE,
322
323 /* keep last */
324 __NL80211_STA_INFO_AFTER_LAST,
325 NL80211_STA_INFO_MAX = __NL80211_STA_INFO_AFTER_LAST - 1
326};
327
328/**
329 * enum nl80211_mpath_flags - nl80211 mesh path flags
330 *
331 * @NL80211_MPATH_FLAG_ACTIVE: the mesh path is active
332 * @NL80211_MPATH_FLAG_RESOLVING: the mesh path discovery process is running
333 * @NL80211_MPATH_FLAG_DSN_VALID: the mesh path contains a valid DSN
334 * @NL80211_MPATH_FLAG_FIXED: the mesh path has been manually set
335 * @NL80211_MPATH_FLAG_RESOLVED: the mesh path discovery process succeeded
336 */
337enum nl80211_mpath_flags {
338 NL80211_MPATH_FLAG_ACTIVE = 1<<0,
339 NL80211_MPATH_FLAG_RESOLVING = 1<<1,
340 NL80211_MPATH_FLAG_DSN_VALID = 1<<2,
341 NL80211_MPATH_FLAG_FIXED = 1<<3,
342 NL80211_MPATH_FLAG_RESOLVED = 1<<4,
343};
344
345/**
346 * enum nl80211_mpath_info - mesh path information
347 *
348 * These attribute types are used with %NL80211_ATTR_MPATH_INFO when getting
349 * information about a mesh path.
350 *
351 * @__NL80211_MPATH_INFO_INVALID: attribute number 0 is reserved
352 * @NL80211_ATTR_MPATH_FRAME_QLEN: number of queued frames for this destination
353 * @NL80211_ATTR_MPATH_DSN: destination sequence number
354 * @NL80211_ATTR_MPATH_METRIC: metric (cost) of this mesh path
355 * @NL80211_ATTR_MPATH_EXPTIME: expiration time for the path, in msec from now
356 * @NL80211_ATTR_MPATH_FLAGS: mesh path flags, enumerated in
357 * &enum nl80211_mpath_flags;
358 * @NL80211_ATTR_MPATH_DISCOVERY_TIMEOUT: total path discovery timeout, in msec
359 * @NL80211_ATTR_MPATH_DISCOVERY_RETRIES: mesh path discovery retries
360 */
361enum nl80211_mpath_info {
362 __NL80211_MPATH_INFO_INVALID,
363 NL80211_MPATH_INFO_FRAME_QLEN,
364 NL80211_MPATH_INFO_DSN,
365 NL80211_MPATH_INFO_METRIC,
366 NL80211_MPATH_INFO_EXPTIME,
367 NL80211_MPATH_INFO_FLAGS,
368 NL80211_MPATH_INFO_DISCOVERY_TIMEOUT,
369 NL80211_MPATH_INFO_DISCOVERY_RETRIES,
370
371 /* keep last */
372 __NL80211_MPATH_INFO_AFTER_LAST,
373 NL80211_MPATH_INFO_MAX = __NL80211_MPATH_INFO_AFTER_LAST - 1
374};
375
376/**
377 * enum nl80211_band_attr - band attributes
378 * @__NL80211_BAND_ATTR_INVALID: attribute number 0 is reserved
379 * @NL80211_BAND_ATTR_FREQS: supported frequencies in this band,
380 * an array of nested frequency attributes
381 * @NL80211_BAND_ATTR_RATES: supported bitrates in this band,
382 * an array of nested bitrate attributes
383 */
384enum nl80211_band_attr {
385 __NL80211_BAND_ATTR_INVALID,
386 NL80211_BAND_ATTR_FREQS,
387 NL80211_BAND_ATTR_RATES,
388
389 /* keep last */
390 __NL80211_BAND_ATTR_AFTER_LAST,
391 NL80211_BAND_ATTR_MAX = __NL80211_BAND_ATTR_AFTER_LAST - 1
392};
393
394/**
395 * enum nl80211_frequency_attr - frequency attributes
396 * @NL80211_FREQUENCY_ATTR_FREQ: Frequency in MHz
397 * @NL80211_FREQUENCY_ATTR_DISABLED: Channel is disabled in current
398 * regulatory domain.
399 * @NL80211_FREQUENCY_ATTR_PASSIVE_SCAN: Only passive scanning is
400 * permitted on this channel in current regulatory domain.
401 * @NL80211_FREQUENCY_ATTR_NO_IBSS: IBSS networks are not permitted
402 * on this channel in current regulatory domain.
403 * @NL80211_FREQUENCY_ATTR_RADAR: Radar detection is mandatory
404 * on this channel in current regulatory domain.
405 */
406enum nl80211_frequency_attr {
407 __NL80211_FREQUENCY_ATTR_INVALID,
408 NL80211_FREQUENCY_ATTR_FREQ,
409 NL80211_FREQUENCY_ATTR_DISABLED,
410 NL80211_FREQUENCY_ATTR_PASSIVE_SCAN,
411 NL80211_FREQUENCY_ATTR_NO_IBSS,
412 NL80211_FREQUENCY_ATTR_RADAR,
413
414 /* keep last */
415 __NL80211_FREQUENCY_ATTR_AFTER_LAST,
416 NL80211_FREQUENCY_ATTR_MAX = __NL80211_FREQUENCY_ATTR_AFTER_LAST - 1
417};
418
419/**
420 * enum nl80211_bitrate_attr - bitrate attributes
421 * @NL80211_BITRATE_ATTR_RATE: Bitrate in units of 100 kbps
422 * @NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE: Short preamble supported
423 * in 2.4 GHz band.
424 */
425enum nl80211_bitrate_attr {
426 __NL80211_BITRATE_ATTR_INVALID,
427 NL80211_BITRATE_ATTR_RATE,
428 NL80211_BITRATE_ATTR_2GHZ_SHORTPREAMBLE,
429
430 /* keep last */
431 __NL80211_BITRATE_ATTR_AFTER_LAST,
432 NL80211_BITRATE_ATTR_MAX = __NL80211_BITRATE_ATTR_AFTER_LAST - 1
433};
434
435/**
436 * enum nl80211_mntr_flags - monitor configuration flags
437 *
438 * Monitor configuration flags.
439 *
440 * @__NL80211_MNTR_FLAG_INVALID: reserved
441 *
442 * @NL80211_MNTR_FLAG_FCSFAIL: pass frames with bad FCS
443 * @NL80211_MNTR_FLAG_PLCPFAIL: pass frames with bad PLCP
444 * @NL80211_MNTR_FLAG_CONTROL: pass control frames
445 * @NL80211_MNTR_FLAG_OTHER_BSS: disable BSSID filtering
446 * @NL80211_MNTR_FLAG_COOK_FRAMES: report frames after processing.
447 * overrides all other flags.
448 *
449 * @__NL80211_MNTR_FLAG_AFTER_LAST: internal use
450 * @NL80211_MNTR_FLAG_MAX: highest possible monitor flag
271 */ 451 */
272enum nl80211_sta_stats { 452enum nl80211_mntr_flags {
273 __NL80211_STA_STAT_INVALID, 453 __NL80211_MNTR_FLAG_INVALID,
274 NL80211_STA_STAT_INACTIVE_TIME, 454 NL80211_MNTR_FLAG_FCSFAIL,
275 NL80211_STA_STAT_RX_BYTES, 455 NL80211_MNTR_FLAG_PLCPFAIL,
276 NL80211_STA_STAT_TX_BYTES, 456 NL80211_MNTR_FLAG_CONTROL,
457 NL80211_MNTR_FLAG_OTHER_BSS,
458 NL80211_MNTR_FLAG_COOK_FRAMES,
277 459
278 /* keep last */ 460 /* keep last */
279 __NL80211_STA_STAT_AFTER_LAST, 461 __NL80211_MNTR_FLAG_AFTER_LAST,
280 NL80211_STA_STAT_MAX = __NL80211_STA_STAT_AFTER_LAST - 1 462 NL80211_MNTR_FLAG_MAX = __NL80211_MNTR_FLAG_AFTER_LAST - 1
281}; 463};
282 464
283#endif /* __LINUX_NL80211_H */ 465#endif /* __LINUX_NL80211_H */
diff --git a/include/linux/pcounter.h b/include/linux/pcounter.h
deleted file mode 100644
index a82d9f2628ca..000000000000
--- a/include/linux/pcounter.h
+++ /dev/null
@@ -1,74 +0,0 @@
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 */
14struct 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) \
28static DEFINE_PER_CPU(int, NAME##_pcounter_values); \
29static void NAME##_pcounter_add(struct pcounter *self, int val) \
30{ \
31 __get_cpu_var(NAME##_pcounter_values) += val; \
32} \
33static 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
45static inline void pcounter_add(struct pcounter *self, int inc)
46{
47 self->add(self, inc);
48}
49
50extern int pcounter_getval(const struct pcounter *self);
51extern int pcounter_alloc(struct pcounter *self);
52extern void pcounter_free(struct pcounter *self);
53
54
55#else /* CONFIG_SMP */
56
57static inline void pcounter_add(struct pcounter *self, int inc)
58{
59 self->val += inc;
60}
61
62static 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/phy.h b/include/linux/phy.h
index 5e43ae751412..779cbcd65f62 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -39,7 +39,8 @@
39 SUPPORTED_1000baseT_Half | \ 39 SUPPORTED_1000baseT_Half | \
40 SUPPORTED_1000baseT_Full) 40 SUPPORTED_1000baseT_Full)
41 41
42/* Set phydev->irq to PHY_POLL if interrupts are not supported, 42/*
43 * Set phydev->irq to PHY_POLL if interrupts are not supported,
43 * or not desired for this PHY. Set to PHY_IGNORE_INTERRUPT if 44 * or not desired for this PHY. Set to PHY_IGNORE_INTERRUPT if
44 * the attached driver handles the interrupt 45 * the attached driver handles the interrupt
45 */ 46 */
@@ -63,8 +64,6 @@ typedef enum {
63 PHY_INTERFACE_MODE_RTBI 64 PHY_INTERFACE_MODE_RTBI
64} phy_interface_t; 65} phy_interface_t;
65 66
66#define MII_BUS_MAX 4
67
68 67
69#define PHY_INIT_TIMEOUT 100000 68#define PHY_INIT_TIMEOUT 100000
70#define PHY_STATE_TIME 1 69#define PHY_STATE_TIME 1
@@ -74,20 +73,30 @@ typedef enum {
74#define PHY_MAX_ADDR 32 73#define PHY_MAX_ADDR 32
75 74
76/* Used when trying to connect to a specific phy (mii bus id:phy device id) */ 75/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
77#define PHY_ID_FMT "%x:%02x" 76#define PHY_ID_FMT "%s:%02x"
78 77
79/* The Bus class for PHYs. Devices which provide access to 78/*
80 * PHYs should register using this structure */ 79 * Need to be a little smaller than phydev->dev.bus_id to leave room
80 * for the ":%02x"
81 */
82#define MII_BUS_ID_SIZE (BUS_ID_SIZE - 3)
83
84/*
85 * The Bus class for PHYs. Devices which provide access to
86 * PHYs should register using this structure
87 */
81struct mii_bus { 88struct mii_bus {
82 const char *name; 89 const char *name;
83 int id; 90 char id[MII_BUS_ID_SIZE];
84 void *priv; 91 void *priv;
85 int (*read)(struct mii_bus *bus, int phy_id, int regnum); 92 int (*read)(struct mii_bus *bus, int phy_id, int regnum);
86 int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val); 93 int (*write)(struct mii_bus *bus, int phy_id, int regnum, u16 val);
87 int (*reset)(struct mii_bus *bus); 94 int (*reset)(struct mii_bus *bus);
88 95
89 /* A lock to ensure that only one thing can read/write 96 /*
90 * the MDIO bus at a time */ 97 * A lock to ensure that only one thing can read/write
98 * the MDIO bus at a time
99 */
91 struct mutex mdio_lock; 100 struct mutex mdio_lock;
92 101
93 struct device *dev; 102 struct device *dev;
@@ -98,8 +107,10 @@ struct mii_bus {
98 /* Phy addresses to be ignored when probing */ 107 /* Phy addresses to be ignored when probing */
99 u32 phy_mask; 108 u32 phy_mask;
100 109
101 /* Pointer to an array of interrupts, each PHY's 110 /*
102 * interrupt at the index matching its address */ 111 * Pointer to an array of interrupts, each PHY's
112 * interrupt at the index matching its address
113 */
103 int *irq; 114 int *irq;
104}; 115};
105 116
@@ -251,7 +262,8 @@ struct phy_device {
251 /* Bus address of the PHY (0-32) */ 262 /* Bus address of the PHY (0-32) */
252 int addr; 263 int addr;
253 264
254 /* forced speed & duplex (no autoneg) 265 /*
266 * forced speed & duplex (no autoneg)
255 * partner speed & duplex & pause (autoneg) 267 * partner speed & duplex & pause (autoneg)
256 */ 268 */
257 int speed; 269 int speed;
@@ -274,8 +286,10 @@ struct phy_device {
274 286
275 int link_timeout; 287 int link_timeout;
276 288
277 /* Interrupt number for this PHY 289 /*
278 * -1 means no interrupt */ 290 * Interrupt number for this PHY
291 * -1 means no interrupt
292 */
279 int irq; 293 int irq;
280 294
281 /* private data pointer */ 295 /* private data pointer */
@@ -325,22 +339,28 @@ struct phy_driver {
325 u32 features; 339 u32 features;
326 u32 flags; 340 u32 flags;
327 341
328 /* Called to initialize the PHY, 342 /*
329 * including after a reset */ 343 * Called to initialize the PHY,
344 * including after a reset
345 */
330 int (*config_init)(struct phy_device *phydev); 346 int (*config_init)(struct phy_device *phydev);
331 347
332 /* Called during discovery. Used to set 348 /*
333 * up device-specific structures, if any */ 349 * Called during discovery. Used to set
350 * up device-specific structures, if any
351 */
334 int (*probe)(struct phy_device *phydev); 352 int (*probe)(struct phy_device *phydev);
335 353
336 /* PHY Power Management */ 354 /* PHY Power Management */
337 int (*suspend)(struct phy_device *phydev); 355 int (*suspend)(struct phy_device *phydev);
338 int (*resume)(struct phy_device *phydev); 356 int (*resume)(struct phy_device *phydev);
339 357
340 /* Configures the advertisement and resets 358 /*
359 * Configures the advertisement and resets
341 * autonegotiation if phydev->autoneg is on, 360 * autonegotiation if phydev->autoneg is on,
342 * forces the speed to the current settings in phydev 361 * forces the speed to the current settings in phydev
343 * if phydev->autoneg is off */ 362 * if phydev->autoneg is off
363 */
344 int (*config_aneg)(struct phy_device *phydev); 364 int (*config_aneg)(struct phy_device *phydev);
345 365
346 /* Determines the negotiated speed and duplex */ 366 /* Determines the negotiated speed and duplex */
@@ -361,6 +381,7 @@ struct phy_driver {
361 381
362int phy_read(struct phy_device *phydev, u16 regnum); 382int phy_read(struct phy_device *phydev, u16 regnum);
363int phy_write(struct phy_device *phydev, u16 regnum, u16 val); 383int phy_write(struct phy_device *phydev, u16 regnum, u16 val);
384int get_phy_id(struct mii_bus *bus, int addr, u32 *phy_id);
364struct phy_device* get_phy_device(struct mii_bus *bus, int addr); 385struct phy_device* get_phy_device(struct mii_bus *bus, int addr);
365int phy_clear_interrupt(struct phy_device *phydev); 386int phy_clear_interrupt(struct phy_device *phydev);
366int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); 387int phy_config_interrupt(struct phy_device *phydev, u32 interrupts);
diff --git a/include/linux/pim.h b/include/linux/pim.h
new file mode 100644
index 000000000000..236ffd317394
--- /dev/null
+++ b/include/linux/pim.h
@@ -0,0 +1,45 @@
1#ifndef __LINUX_PIM_H
2#define __LINUX_PIM_H
3
4#include <asm/byteorder.h>
5
6#ifndef __KERNEL__
7struct pim {
8#if defined(__LITTLE_ENDIAN_BITFIELD)
9 __u8 pim_type:4, /* PIM message type */
10 pim_ver:4; /* PIM version */
11#elif defined(__BIG_ENDIAN_BITFIELD)
12 __u8 pim_ver:4; /* PIM version */
13 pim_type:4; /* PIM message type */
14#endif
15 __u8 pim_rsv; /* Reserved */
16 __be16 pim_cksum; /* Checksum */
17};
18
19#define PIM_MINLEN 8
20#endif
21
22/* Message types - V1 */
23#define PIM_V1_VERSION __constant_htonl(0x10000000)
24#define PIM_V1_REGISTER 1
25
26/* Message types - V2 */
27#define PIM_VERSION 2
28#define PIM_REGISTER 1
29
30#if defined(__KERNEL__)
31#define PIM_NULL_REGISTER __constant_htonl(0x40000000)
32
33/* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
34struct pimreghdr
35{
36 __u8 type;
37 __u8 reserved;
38 __be16 csum;
39 __be32 flags;
40};
41
42struct sk_buff;
43extern int pim_rcv_v1(struct sk_buff *);
44#endif
45#endif
diff --git a/include/linux/security.h b/include/linux/security.h
index c673dfd4dffc..f5eb9ff47ac5 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -910,24 +910,24 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
910 * Security hooks for XFRM operations. 910 * Security hooks for XFRM operations.
911 * 911 *
912 * @xfrm_policy_alloc_security: 912 * @xfrm_policy_alloc_security:
913 * @xp contains the xfrm_policy being added to Security Policy Database 913 * @ctxp is a pointer to the xfrm_sec_ctx being added to Security Policy
914 * used by the XFRM system. 914 * Database used by the XFRM system.
915 * @sec_ctx contains the security context information being provided by 915 * @sec_ctx contains the security context information being provided by
916 * the user-level policy update program (e.g., setkey). 916 * the user-level policy update program (e.g., setkey).
917 * Allocate a security structure to the xp->security field; the security 917 * Allocate a security structure to the xp->security field; the security
918 * field is initialized to NULL when the xfrm_policy is allocated. 918 * field is initialized to NULL when the xfrm_policy is allocated.
919 * Return 0 if operation was successful (memory to allocate, legal context) 919 * Return 0 if operation was successful (memory to allocate, legal context)
920 * @xfrm_policy_clone_security: 920 * @xfrm_policy_clone_security:
921 * @old contains an existing xfrm_policy in the SPD. 921 * @old_ctx contains an existing xfrm_sec_ctx.
922 * @new contains a new xfrm_policy being cloned from old. 922 * @new_ctxp contains a new xfrm_sec_ctx being cloned from old.
923 * Allocate a security structure to the new->security field 923 * Allocate a security structure in new_ctxp that contains the
924 * that contains the information from the old->security field. 924 * information from the old_ctx structure.
925 * Return 0 if operation was successful (memory to allocate). 925 * Return 0 if operation was successful (memory to allocate).
926 * @xfrm_policy_free_security: 926 * @xfrm_policy_free_security:
927 * @xp contains the xfrm_policy 927 * @ctx contains the xfrm_sec_ctx
928 * Deallocate xp->security. 928 * Deallocate xp->security.
929 * @xfrm_policy_delete_security: 929 * @xfrm_policy_delete_security:
930 * @xp contains the xfrm_policy. 930 * @ctx contains the xfrm_sec_ctx.
931 * Authorize deletion of xp->security. 931 * Authorize deletion of xp->security.
932 * @xfrm_state_alloc_security: 932 * @xfrm_state_alloc_security:
933 * @x contains the xfrm_state being added to the Security Association 933 * @x contains the xfrm_state being added to the Security Association
@@ -947,7 +947,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
947 * @x contains the xfrm_state. 947 * @x contains the xfrm_state.
948 * Authorize deletion of x->security. 948 * Authorize deletion of x->security.
949 * @xfrm_policy_lookup: 949 * @xfrm_policy_lookup:
950 * @xp contains the xfrm_policy for which the access control is being 950 * @ctx contains the xfrm_sec_ctx for which the access control is being
951 * checked. 951 * checked.
952 * @fl_secid contains the flow security label that is used to authorize 952 * @fl_secid contains the flow security label that is used to authorize
953 * access to the policy xp. 953 * access to the policy xp.
@@ -1454,17 +1454,17 @@ struct security_operations {
1454#endif /* CONFIG_SECURITY_NETWORK */ 1454#endif /* CONFIG_SECURITY_NETWORK */
1455 1455
1456#ifdef CONFIG_SECURITY_NETWORK_XFRM 1456#ifdef CONFIG_SECURITY_NETWORK_XFRM
1457 int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, 1457 int (*xfrm_policy_alloc_security) (struct xfrm_sec_ctx **ctxp,
1458 struct xfrm_user_sec_ctx *sec_ctx); 1458 struct xfrm_user_sec_ctx *sec_ctx);
1459 int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); 1459 int (*xfrm_policy_clone_security) (struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctx);
1460 void (*xfrm_policy_free_security) (struct xfrm_policy *xp); 1460 void (*xfrm_policy_free_security) (struct xfrm_sec_ctx *ctx);
1461 int (*xfrm_policy_delete_security) (struct xfrm_policy *xp); 1461 int (*xfrm_policy_delete_security) (struct xfrm_sec_ctx *ctx);
1462 int (*xfrm_state_alloc_security) (struct xfrm_state *x, 1462 int (*xfrm_state_alloc_security) (struct xfrm_state *x,
1463 struct xfrm_user_sec_ctx *sec_ctx, 1463 struct xfrm_user_sec_ctx *sec_ctx,
1464 u32 secid); 1464 u32 secid);
1465 void (*xfrm_state_free_security) (struct xfrm_state *x); 1465 void (*xfrm_state_free_security) (struct xfrm_state *x);
1466 int (*xfrm_state_delete_security) (struct xfrm_state *x); 1466 int (*xfrm_state_delete_security) (struct xfrm_state *x);
1467 int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 fl_secid, u8 dir); 1467 int (*xfrm_policy_lookup)(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
1468 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x, 1468 int (*xfrm_state_pol_flow_match)(struct xfrm_state *x,
1469 struct xfrm_policy *xp, struct flowi *fl); 1469 struct xfrm_policy *xp, struct flowi *fl);
1470 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall); 1470 int (*xfrm_decode_session)(struct sk_buff *skb, u32 *secid, int ckall);
@@ -2562,16 +2562,16 @@ static inline void security_inet_conn_established(struct sock *sk,
2562 2562
2563#ifdef CONFIG_SECURITY_NETWORK_XFRM 2563#ifdef CONFIG_SECURITY_NETWORK_XFRM
2564 2564
2565int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); 2565int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx);
2566int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new); 2566int security_xfrm_policy_clone(struct xfrm_sec_ctx *old_ctx, struct xfrm_sec_ctx **new_ctxp);
2567void security_xfrm_policy_free(struct xfrm_policy *xp); 2567void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx);
2568int security_xfrm_policy_delete(struct xfrm_policy *xp); 2568int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx);
2569int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); 2569int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx);
2570int security_xfrm_state_alloc_acquire(struct xfrm_state *x, 2570int security_xfrm_state_alloc_acquire(struct xfrm_state *x,
2571 struct xfrm_sec_ctx *polsec, u32 secid); 2571 struct xfrm_sec_ctx *polsec, u32 secid);
2572int security_xfrm_state_delete(struct xfrm_state *x); 2572int security_xfrm_state_delete(struct xfrm_state *x);
2573void security_xfrm_state_free(struct xfrm_state *x); 2573void security_xfrm_state_free(struct xfrm_state *x);
2574int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir); 2574int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir);
2575int security_xfrm_state_pol_flow_match(struct xfrm_state *x, 2575int security_xfrm_state_pol_flow_match(struct xfrm_state *x,
2576 struct xfrm_policy *xp, struct flowi *fl); 2576 struct xfrm_policy *xp, struct flowi *fl);
2577int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid); 2577int security_xfrm_decode_session(struct sk_buff *skb, u32 *secid);
@@ -2579,21 +2579,21 @@ void security_skb_classify_flow(struct sk_buff *skb, struct flowi *fl);
2579 2579
2580#else /* CONFIG_SECURITY_NETWORK_XFRM */ 2580#else /* CONFIG_SECURITY_NETWORK_XFRM */
2581 2581
2582static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) 2582static inline int security_xfrm_policy_alloc(struct xfrm_sec_ctx **ctxp, struct xfrm_user_sec_ctx *sec_ctx)
2583{ 2583{
2584 return 0; 2584 return 0;
2585} 2585}
2586 2586
2587static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) 2587static inline int security_xfrm_policy_clone(struct xfrm_sec_ctx *old, struct xfrm_sec_ctx **new_ctxp)
2588{ 2588{
2589 return 0; 2589 return 0;
2590} 2590}
2591 2591
2592static inline void security_xfrm_policy_free(struct xfrm_policy *xp) 2592static inline void security_xfrm_policy_free(struct xfrm_sec_ctx *ctx)
2593{ 2593{
2594} 2594}
2595 2595
2596static inline int security_xfrm_policy_delete(struct xfrm_policy *xp) 2596static inline int security_xfrm_policy_delete(struct xfrm_sec_ctx *ctx)
2597{ 2597{
2598 return 0; 2598 return 0;
2599} 2599}
@@ -2619,7 +2619,7 @@ static inline int security_xfrm_state_delete(struct xfrm_state *x)
2619 return 0; 2619 return 0;
2620} 2620}
2621 2621
2622static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 fl_secid, u8 dir) 2622static inline int security_xfrm_policy_lookup(struct xfrm_sec_ctx *ctx, u32 fl_secid, u8 dir)
2623{ 2623{
2624 return 0; 2624 return 0;
2625} 2625}
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index 67c2563961f3..1da1e6208a0a 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -62,18 +62,5 @@ extern struct list_head *seq_list_start_head(struct list_head *head,
62extern struct list_head *seq_list_next(void *v, struct list_head *head, 62extern struct list_head *seq_list_next(void *v, struct list_head *head,
63 loff_t *ppos); 63 loff_t *ppos);
64 64
65struct net;
66struct seq_net_private {
67 struct net *net;
68};
69
70int seq_open_net(struct inode *, struct file *,
71 const struct seq_operations *, int);
72int seq_release_net(struct inode *, struct file *);
73static inline struct net *seq_file_net(struct seq_file *seq)
74{
75 return ((struct seq_net_private *)seq->private)->net;
76}
77
78#endif 65#endif
79#endif 66#endif
diff --git a/include/linux/seq_file_net.h b/include/linux/seq_file_net.h
new file mode 100644
index 000000000000..4ac52542a563
--- /dev/null
+++ b/include/linux/seq_file_net.h
@@ -0,0 +1,27 @@
1#ifndef __SEQ_FILE_NET_H__
2#define __SEQ_FILE_NET_H__
3
4#include <linux/seq_file.h>
5
6struct net;
7extern struct net init_net;
8
9struct seq_net_private {
10#ifdef CONFIG_NET_NS
11 struct net *net;
12#endif
13};
14
15int seq_open_net(struct inode *, struct file *,
16 const struct seq_operations *, int);
17int seq_release_net(struct inode *, struct file *);
18static inline struct net *seq_file_net(struct seq_file *seq)
19{
20#ifdef CONFIG_NET_NS
21 return ((struct seq_net_private *)seq->private)->net;
22#else
23 return &init_net;
24#endif
25}
26
27#endif
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index bbd8d0027e2f..11fd9f2c4093 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -256,7 +256,10 @@ struct sk_buff {
256 ktime_t tstamp; 256 ktime_t tstamp;
257 struct net_device *dev; 257 struct net_device *dev;
258 258
259 struct dst_entry *dst; 259 union {
260 struct dst_entry *dst;
261 struct rtable *rtable;
262 };
260 struct sec_path *sp; 263 struct sec_path *sp;
261 264
262 /* 265 /*
@@ -310,7 +313,10 @@ struct sk_buff {
310 __u16 tc_verd; /* traffic control verdict */ 313 __u16 tc_verd; /* traffic control verdict */
311#endif 314#endif
312#endif 315#endif
313 /* 2 byte hole */ 316#ifdef CONFIG_IPV6_NDISC_NODETYPE
317 __u8 ndisc_nodetype:2;
318#endif
319 /* 14 bit hole */
314 320
315#ifdef CONFIG_NET_DMA 321#ifdef CONFIG_NET_DMA
316 dma_cookie_t dma_cookie; 322 dma_cookie_t dma_cookie;
@@ -657,11 +663,21 @@ static inline void skb_queue_head_init_class(struct sk_buff_head *list,
657} 663}
658 664
659/* 665/*
660 * Insert an sk_buff at the start of a list. 666 * Insert an sk_buff on a list.
661 * 667 *
662 * The "__skb_xxxx()" functions are the non-atomic ones that 668 * The "__skb_xxxx()" functions are the non-atomic ones that
663 * can only be called with interrupts disabled. 669 * can only be called with interrupts disabled.
664 */ 670 */
671extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
672static inline void __skb_insert(struct sk_buff *newsk,
673 struct sk_buff *prev, struct sk_buff *next,
674 struct sk_buff_head *list)
675{
676 newsk->next = next;
677 newsk->prev = prev;
678 next->prev = prev->next = newsk;
679 list->qlen++;
680}
665 681
666/** 682/**
667 * __skb_queue_after - queue a buffer at the list head 683 * __skb_queue_after - queue a buffer at the list head
@@ -678,13 +694,17 @@ static inline void __skb_queue_after(struct sk_buff_head *list,
678 struct sk_buff *prev, 694 struct sk_buff *prev,
679 struct sk_buff *newsk) 695 struct sk_buff *newsk)
680{ 696{
681 struct sk_buff *next; 697 __skb_insert(newsk, prev, prev->next, list);
682 list->qlen++; 698}
683 699
684 next = prev->next; 700extern void skb_append(struct sk_buff *old, struct sk_buff *newsk,
685 newsk->next = next; 701 struct sk_buff_head *list);
686 newsk->prev = prev; 702
687 next->prev = prev->next = newsk; 703static inline void __skb_queue_before(struct sk_buff_head *list,
704 struct sk_buff *next,
705 struct sk_buff *newsk)
706{
707 __skb_insert(newsk, next->prev, next, list);
688} 708}
689 709
690/** 710/**
@@ -718,66 +738,7 @@ extern void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk);
718static inline void __skb_queue_tail(struct sk_buff_head *list, 738static inline void __skb_queue_tail(struct sk_buff_head *list,
719 struct sk_buff *newsk) 739 struct sk_buff *newsk)
720{ 740{
721 struct sk_buff *prev, *next; 741 __skb_queue_before(list, (struct sk_buff *)list, newsk);
722
723 list->qlen++;
724 next = (struct sk_buff *)list;
725 prev = next->prev;
726 newsk->next = next;
727 newsk->prev = prev;
728 next->prev = prev->next = newsk;
729}
730
731
732/**
733 * __skb_dequeue - remove from the head of the queue
734 * @list: list to dequeue from
735 *
736 * Remove the head of the list. This function does not take any locks
737 * so must be used with appropriate locks held only. The head item is
738 * returned or %NULL if the list is empty.
739 */
740extern struct sk_buff *skb_dequeue(struct sk_buff_head *list);
741static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
742{
743 struct sk_buff *next, *prev, *result;
744
745 prev = (struct sk_buff *) list;
746 next = prev->next;
747 result = NULL;
748 if (next != prev) {
749 result = next;
750 next = next->next;
751 list->qlen--;
752 next->prev = prev;
753 prev->next = next;
754 result->next = result->prev = NULL;
755 }
756 return result;
757}
758
759
760/*
761 * Insert a packet on a list.
762 */
763extern void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
764static inline void __skb_insert(struct sk_buff *newsk,
765 struct sk_buff *prev, struct sk_buff *next,
766 struct sk_buff_head *list)
767{
768 newsk->next = next;
769 newsk->prev = prev;
770 next->prev = prev->next = newsk;
771 list->qlen++;
772}
773
774/*
775 * Place a packet after a given packet in a list.
776 */
777extern void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list);
778static inline void __skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head *list)
779{
780 __skb_insert(newsk, old, old->next, list);
781} 742}
782 743
783/* 744/*
@@ -797,8 +758,22 @@ static inline void __skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
797 prev->next = next; 758 prev->next = next;
798} 759}
799 760
800 761/**
801/* XXX: more streamlined implementation */ 762 * __skb_dequeue - remove from the head of the queue
763 * @list: list to dequeue from
764 *
765 * Remove the head of the list. This function does not take any locks
766 * so must be used with appropriate locks held only. The head item is
767 * returned or %NULL if the list is empty.
768 */
769extern struct sk_buff *skb_dequeue(struct sk_buff_head *list);
770static inline struct sk_buff *__skb_dequeue(struct sk_buff_head *list)
771{
772 struct sk_buff *skb = skb_peek(list);
773 if (skb)
774 __skb_unlink(skb, list);
775 return skb;
776}
802 777
803/** 778/**
804 * __skb_dequeue_tail - remove from the tail of the queue 779 * __skb_dequeue_tail - remove from the tail of the queue
@@ -889,6 +864,7 @@ static inline void skb_set_tail_pointer(struct sk_buff *skb, const int offset)
889/* 864/*
890 * Add data to an sk_buff 865 * Add data to an sk_buff
891 */ 866 */
867extern unsigned char *skb_put(struct sk_buff *skb, unsigned int len);
892static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len) 868static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
893{ 869{
894 unsigned char *tmp = skb_tail_pointer(skb); 870 unsigned char *tmp = skb_tail_pointer(skb);
@@ -898,26 +874,7 @@ static inline unsigned char *__skb_put(struct sk_buff *skb, unsigned int len)
898 return tmp; 874 return tmp;
899} 875}
900 876
901/** 877extern unsigned char *skb_push(struct sk_buff *skb, unsigned int len);
902 * skb_put - add data to a buffer
903 * @skb: buffer to use
904 * @len: amount of data to add
905 *
906 * This function extends the used data area of the buffer. If this would
907 * exceed the total buffer size the kernel will panic. A pointer to the
908 * first byte of the extra data is returned.
909 */
910static inline unsigned char *skb_put(struct sk_buff *skb, unsigned int len)
911{
912 unsigned char *tmp = skb_tail_pointer(skb);
913 SKB_LINEAR_ASSERT(skb);
914 skb->tail += len;
915 skb->len += len;
916 if (unlikely(skb->tail > skb->end))
917 skb_over_panic(skb, len, current_text_addr());
918 return tmp;
919}
920
921static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len) 878static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
922{ 879{
923 skb->data -= len; 880 skb->data -= len;
@@ -925,24 +882,7 @@ static inline unsigned char *__skb_push(struct sk_buff *skb, unsigned int len)
925 return skb->data; 882 return skb->data;
926} 883}
927 884
928/** 885extern unsigned char *skb_pull(struct sk_buff *skb, unsigned int len);
929 * skb_push - add data to the start of a buffer
930 * @skb: buffer to use
931 * @len: amount of data to add
932 *
933 * This function extends the used data area of the buffer at the buffer
934 * start. If this would exceed the total buffer headroom the kernel will
935 * panic. A pointer to the first byte of the extra data is returned.
936 */
937static inline unsigned char *skb_push(struct sk_buff *skb, unsigned int len)
938{
939 skb->data -= len;
940 skb->len += len;
941 if (unlikely(skb->data<skb->head))
942 skb_under_panic(skb, len, current_text_addr());
943 return skb->data;
944}
945
946static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len) 886static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
947{ 887{
948 skb->len -= len; 888 skb->len -= len;
@@ -950,21 +890,6 @@ static inline unsigned char *__skb_pull(struct sk_buff *skb, unsigned int len)
950 return skb->data += len; 890 return skb->data += len;
951} 891}
952 892
953/**
954 * skb_pull - remove data from the start of a buffer
955 * @skb: buffer to use
956 * @len: amount of data to remove
957 *
958 * This function removes data from the start of a buffer, returning
959 * the memory to the headroom. A pointer to the next data in the buffer
960 * is returned. Once the data has been pulled future pushes will overwrite
961 * the old data.
962 */
963static inline unsigned char *skb_pull(struct sk_buff *skb, unsigned int len)
964{
965 return unlikely(len > skb->len) ? NULL : __skb_pull(skb, len);
966}
967
968extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta); 893extern unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta);
969 894
970static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len) 895static inline unsigned char *__pskb_pull(struct sk_buff *skb, unsigned int len)
@@ -1205,21 +1130,7 @@ static inline void __skb_trim(struct sk_buff *skb, unsigned int len)
1205 skb_set_tail_pointer(skb, len); 1130 skb_set_tail_pointer(skb, len);
1206} 1131}
1207 1132
1208/** 1133extern void skb_trim(struct sk_buff *skb, unsigned int len);
1209 * skb_trim - remove end from a buffer
1210 * @skb: buffer to alter
1211 * @len: new length
1212 *
1213 * Cut the length of a buffer down by removing data from the tail. If
1214 * the buffer is already under the length specified it is not modified.
1215 * The skb must be linear.
1216 */
1217static inline void skb_trim(struct sk_buff *skb, unsigned int len)
1218{
1219 if (skb->len > len)
1220 __skb_trim(skb, len);
1221}
1222
1223 1134
1224static inline int __pskb_trim(struct sk_buff *skb, unsigned int len) 1135static inline int __pskb_trim(struct sk_buff *skb, unsigned int len)
1225{ 1136{
@@ -1302,22 +1213,7 @@ static inline struct sk_buff *__dev_alloc_skb(unsigned int length,
1302 return skb; 1213 return skb;
1303} 1214}
1304 1215
1305/** 1216extern struct sk_buff *dev_alloc_skb(unsigned int length);
1306 * dev_alloc_skb - allocate an skbuff for receiving
1307 * @length: length to allocate
1308 *
1309 * Allocate a new &sk_buff and assign it a usage count of one. The
1310 * buffer has unspecified headroom built in. Users should allocate
1311 * the headroom they think they need without accounting for the
1312 * built in space. The built in space is used for optimisations.
1313 *
1314 * %NULL is returned if there is no free memory. Although this function
1315 * allocates memory it can be called from an interrupt.
1316 */
1317static inline struct sk_buff *dev_alloc_skb(unsigned int length)
1318{
1319 return __dev_alloc_skb(length, GFP_ATOMIC);
1320}
1321 1217
1322extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev, 1218extern struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
1323 unsigned int length, gfp_t gfp_mask); 1219 unsigned int length, gfp_t gfp_mask);
diff --git a/include/linux/smc91x.h b/include/linux/smc91x.h
new file mode 100644
index 000000000000..8e0556b8781c
--- /dev/null
+++ b/include/linux/smc91x.h
@@ -0,0 +1,13 @@
1#ifndef __SMC91X_H__
2#define __SMC91X_H__
3
4#define SMC91X_USE_8BIT (1 << 0)
5#define SMC91X_USE_16BIT (1 << 1)
6#define SMC91X_USE_32BIT (1 << 2)
7
8struct smc91x_platdata {
9 unsigned long flags;
10 unsigned long irq_flags; /* IRQF_... */
11};
12
13#endif /* __SMC91X_H__ */
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h
index db53defde5ee..50dfd0dc4093 100644
--- a/include/linux/ssb/ssb.h
+++ b/include/linux/ssb/ssb.h
@@ -72,10 +72,18 @@ struct ssb_device;
72/* Lowlevel read/write operations on the device MMIO. 72/* Lowlevel read/write operations on the device MMIO.
73 * Internal, don't use that outside of ssb. */ 73 * Internal, don't use that outside of ssb. */
74struct ssb_bus_ops { 74struct ssb_bus_ops {
75 u8 (*read8)(struct ssb_device *dev, u16 offset);
75 u16 (*read16)(struct ssb_device *dev, u16 offset); 76 u16 (*read16)(struct ssb_device *dev, u16 offset);
76 u32 (*read32)(struct ssb_device *dev, u16 offset); 77 u32 (*read32)(struct ssb_device *dev, u16 offset);
78 void (*write8)(struct ssb_device *dev, u16 offset, u8 value);
77 void (*write16)(struct ssb_device *dev, u16 offset, u16 value); 79 void (*write16)(struct ssb_device *dev, u16 offset, u16 value);
78 void (*write32)(struct ssb_device *dev, u16 offset, u32 value); 80 void (*write32)(struct ssb_device *dev, u16 offset, u32 value);
81#ifdef CONFIG_SSB_BLOCKIO
82 void (*block_read)(struct ssb_device *dev, void *buffer,
83 size_t count, u16 offset, u8 reg_width);
84 void (*block_write)(struct ssb_device *dev, const void *buffer,
85 size_t count, u16 offset, u8 reg_width);
86#endif
79}; 87};
80 88
81 89
@@ -247,9 +255,9 @@ struct ssb_bus {
247 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */ 255 /* Pointer to the PCMCIA device (only if bustype == SSB_BUSTYPE_PCMCIA). */
248 struct pcmcia_device *host_pcmcia; 256 struct pcmcia_device *host_pcmcia;
249 257
250#ifdef CONFIG_SSB_PCIHOST 258#ifdef CONFIG_SSB_SPROM
251 /* Mutex to protect the SPROM writing. */ 259 /* Mutex to protect the SPROM writing. */
252 struct mutex pci_sprom_mutex; 260 struct mutex sprom_mutex;
253#endif 261#endif
254 262
255 /* ID information about the Chip. */ 263 /* ID information about the Chip. */
@@ -262,9 +270,6 @@ struct ssb_bus {
262 struct ssb_device devices[SSB_MAX_NR_CORES]; 270 struct ssb_device devices[SSB_MAX_NR_CORES];
263 u8 nr_devices; 271 u8 nr_devices;
264 272
265 /* Reference count. Number of suspended devices. */
266 u8 suspend_cnt;
267
268 /* Software ID number for this bus. */ 273 /* Software ID number for this bus. */
269 unsigned int busnumber; 274 unsigned int busnumber;
270 275
@@ -336,6 +341,13 @@ extern int ssb_bus_pcmciabus_register(struct ssb_bus *bus,
336 341
337extern void ssb_bus_unregister(struct ssb_bus *bus); 342extern void ssb_bus_unregister(struct ssb_bus *bus);
338 343
344/* Suspend a SSB bus.
345 * Call this from the parent bus suspend routine. */
346extern int ssb_bus_suspend(struct ssb_bus *bus);
347/* Resume a SSB bus.
348 * Call this from the parent bus resume routine. */
349extern int ssb_bus_resume(struct ssb_bus *bus);
350
339extern u32 ssb_clockspeed(struct ssb_bus *bus); 351extern u32 ssb_clockspeed(struct ssb_bus *bus);
340 352
341/* Is the device enabled in hardware? */ 353/* Is the device enabled in hardware? */
@@ -348,6 +360,10 @@ void ssb_device_disable(struct ssb_device *dev, u32 core_specific_flags);
348 360
349 361
350/* Device MMIO register read/write functions. */ 362/* Device MMIO register read/write functions. */
363static inline u8 ssb_read8(struct ssb_device *dev, u16 offset)
364{
365 return dev->ops->read8(dev, offset);
366}
351static inline u16 ssb_read16(struct ssb_device *dev, u16 offset) 367static inline u16 ssb_read16(struct ssb_device *dev, u16 offset)
352{ 368{
353 return dev->ops->read16(dev, offset); 369 return dev->ops->read16(dev, offset);
@@ -356,6 +372,10 @@ static inline u32 ssb_read32(struct ssb_device *dev, u16 offset)
356{ 372{
357 return dev->ops->read32(dev, offset); 373 return dev->ops->read32(dev, offset);
358} 374}
375static inline void ssb_write8(struct ssb_device *dev, u16 offset, u8 value)
376{
377 dev->ops->write8(dev, offset, value);
378}
359static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value) 379static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value)
360{ 380{
361 dev->ops->write16(dev, offset, value); 381 dev->ops->write16(dev, offset, value);
@@ -364,6 +384,19 @@ static inline void ssb_write32(struct ssb_device *dev, u16 offset, u32 value)
364{ 384{
365 dev->ops->write32(dev, offset, value); 385 dev->ops->write32(dev, offset, value);
366} 386}
387#ifdef CONFIG_SSB_BLOCKIO
388static inline void ssb_block_read(struct ssb_device *dev, void *buffer,
389 size_t count, u16 offset, u8 reg_width)
390{
391 dev->ops->block_read(dev, buffer, count, offset, reg_width);
392}
393
394static inline void ssb_block_write(struct ssb_device *dev, const void *buffer,
395 size_t count, u16 offset, u8 reg_width)
396{
397 dev->ops->block_write(dev, buffer, count, offset, reg_width);
398}
399#endif /* CONFIG_SSB_BLOCKIO */
367 400
368 401
369/* Translation (routing) bits that need to be ORed to DMA 402/* Translation (routing) bits that need to be ORed to DMA
@@ -416,5 +449,12 @@ extern int ssb_bus_powerup(struct ssb_bus *bus, bool dynamic_pctl);
416extern u32 ssb_admatch_base(u32 adm); 449extern u32 ssb_admatch_base(u32 adm);
417extern u32 ssb_admatch_size(u32 adm); 450extern u32 ssb_admatch_size(u32 adm);
418 451
452/* PCI device mapping and fixup routines.
453 * Called from the architecture pcibios init code.
454 * These are only available on SSB_EMBEDDED configurations. */
455#ifdef CONFIG_SSB_EMBEDDED
456int ssb_pcibios_plat_dev_init(struct pci_dev *dev);
457int ssb_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
458#endif /* CONFIG_SSB_EMBEDDED */
419 459
420#endif /* LINUX_SSB_H_ */ 460#endif /* LINUX_SSB_H_ */
diff --git a/include/linux/ssb/ssb_driver_chipcommon.h b/include/linux/ssb/ssb_driver_chipcommon.h
index 536851b946f6..7d7e03dcf77c 100644
--- a/include/linux/ssb/ssb_driver_chipcommon.h
+++ b/include/linux/ssb/ssb_driver_chipcommon.h
@@ -367,8 +367,7 @@ static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
367 367
368extern void ssb_chipcommon_init(struct ssb_chipcommon *cc); 368extern void ssb_chipcommon_init(struct ssb_chipcommon *cc);
369 369
370#include <linux/pm.h> 370extern void ssb_chipco_suspend(struct ssb_chipcommon *cc);
371extern void ssb_chipco_suspend(struct ssb_chipcommon *cc, pm_message_t state);
372extern void ssb_chipco_resume(struct ssb_chipcommon *cc); 371extern void ssb_chipco_resume(struct ssb_chipcommon *cc);
373 372
374extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc, 373extern void ssb_chipco_get_clockcpu(struct ssb_chipcommon *cc,
@@ -390,6 +389,10 @@ extern void ssb_chipco_set_clockmode(struct ssb_chipcommon *cc,
390extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc, 389extern void ssb_chipco_watchdog_timer_set(struct ssb_chipcommon *cc,
391 u32 ticks); 390 u32 ticks);
392 391
392void ssb_chipco_irq_mask(struct ssb_chipcommon *cc, u32 mask, u32 value);
393
394u32 ssb_chipco_irq_status(struct ssb_chipcommon *cc, u32 mask);
395
393/* Chipcommon GPIO pin access. */ 396/* Chipcommon GPIO pin access. */
394u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask); 397u32 ssb_chipco_gpio_in(struct ssb_chipcommon *cc, u32 mask);
395u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value); 398u32 ssb_chipco_gpio_out(struct ssb_chipcommon *cc, u32 mask, u32 value);
diff --git a/include/linux/ssb/ssb_driver_gige.h b/include/linux/ssb/ssb_driver_gige.h
new file mode 100644
index 000000000000..01fbdf5fef22
--- /dev/null
+++ b/include/linux/ssb/ssb_driver_gige.h
@@ -0,0 +1,174 @@
1#ifndef LINUX_SSB_DRIVER_GIGE_H_
2#define LINUX_SSB_DRIVER_GIGE_H_
3
4#include <linux/ssb/ssb.h>
5#include <linux/pci.h>
6#include <linux/spinlock.h>
7
8
9#ifdef CONFIG_SSB_DRIVER_GIGE
10
11
12#define SSB_GIGE_PCIIO 0x0000 /* PCI I/O Registers (1024 bytes) */
13#define SSB_GIGE_RESERVED 0x0400 /* Reserved (1024 bytes) */
14#define SSB_GIGE_PCICFG 0x0800 /* PCI config space (256 bytes) */
15#define SSB_GIGE_SHIM_FLUSHSTAT 0x0C00 /* PCI to OCP: Flush status control (32bit) */
16#define SSB_GIGE_SHIM_FLUSHRDA 0x0C04 /* PCI to OCP: Flush read address (32bit) */
17#define SSB_GIGE_SHIM_FLUSHTO 0x0C08 /* PCI to OCP: Flush timeout counter (32bit) */
18#define SSB_GIGE_SHIM_BARRIER 0x0C0C /* PCI to OCP: Barrier register (32bit) */
19#define SSB_GIGE_SHIM_MAOCPSI 0x0C10 /* PCI to OCP: MaocpSI Control (32bit) */
20#define SSB_GIGE_SHIM_SIOCPMA 0x0C14 /* PCI to OCP: SiocpMa Control (32bit) */
21
22/* TM Status High flags */
23#define SSB_GIGE_TMSHIGH_RGMII 0x00010000 /* Have an RGMII PHY-bus */
24/* TM Status Low flags */
25#define SSB_GIGE_TMSLOW_TXBYPASS 0x00080000 /* TX bypass (no delay) */
26#define SSB_GIGE_TMSLOW_RXBYPASS 0x00100000 /* RX bypass (no delay) */
27#define SSB_GIGE_TMSLOW_DLLEN 0x01000000 /* Enable DLL controls */
28
29/* Boardflags (low) */
30#define SSB_GIGE_BFL_ROBOSWITCH 0x0010
31
32
33#define SSB_GIGE_MEM_RES_NAME "SSB Broadcom 47xx GigE memory"
34#define SSB_GIGE_IO_RES_NAME "SSB Broadcom 47xx GigE I/O"
35
36struct ssb_gige {
37 struct ssb_device *dev;
38
39 spinlock_t lock;
40
41 /* True, if the device has an RGMII bus.
42 * False, if the device has a GMII bus. */
43 bool has_rgmii;
44
45 /* The PCI controller device. */
46 struct pci_controller pci_controller;
47 struct pci_ops pci_ops;
48 struct resource mem_resource;
49 struct resource io_resource;
50};
51
52/* Check whether a PCI device is a SSB Gigabit Ethernet core. */
53extern bool pdev_is_ssb_gige_core(struct pci_dev *pdev);
54
55/* Convert a pci_dev pointer to a ssb_gige pointer. */
56static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev)
57{
58 if (!pdev_is_ssb_gige_core(pdev))
59 return NULL;
60 return container_of(pdev->bus->ops, struct ssb_gige, pci_ops);
61}
62
63/* Returns whether the PHY is connected by an RGMII bus. */
64static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev)
65{
66 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
67 return (dev ? dev->has_rgmii : 0);
68}
69
70/* Returns whether we have a Roboswitch. */
71static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev)
72{
73 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
74 if (dev)
75 return !!(dev->dev->bus->sprom.boardflags_lo &
76 SSB_GIGE_BFL_ROBOSWITCH);
77 return 0;
78}
79
80/* Returns whether we can only do one DMA at once. */
81static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev)
82{
83 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
84 if (dev)
85 return ((dev->dev->bus->chip_id == 0x4785) &&
86 (dev->dev->bus->chip_rev < 2));
87 return 0;
88}
89
90/* Returns whether we must flush posted writes. */
91static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
92{
93 struct ssb_gige *dev = pdev_to_ssb_gige(pdev);
94 if (dev)
95 return (dev->dev->bus->chip_id == 0x4785);
96 return 0;
97}
98
99extern char * nvram_get(const char *name);
100/* Get the device MAC address */
101static inline void ssb_gige_get_macaddr(struct pci_dev *pdev, u8 *macaddr)
102{
103#ifdef CONFIG_BCM947XX
104 char *res = nvram_get("et0macaddr");
105 if (res)
106 memcpy(macaddr, res, 6);
107#endif
108}
109
110extern int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
111 struct pci_dev *pdev);
112extern int ssb_gige_map_irq(struct ssb_device *sdev,
113 const struct pci_dev *pdev);
114
115/* The GigE driver is not a standalone module, because we don't have support
116 * for unregistering the driver. So we could not unload the module anyway. */
117extern int ssb_gige_init(void);
118static inline void ssb_gige_exit(void)
119{
120 /* Currently we can not unregister the GigE driver,
121 * because we can not unregister the PCI bridge. */
122 BUG();
123}
124
125
126#else /* CONFIG_SSB_DRIVER_GIGE */
127/* Gigabit Ethernet driver disabled */
128
129
130static inline int ssb_gige_pcibios_plat_dev_init(struct ssb_device *sdev,
131 struct pci_dev *pdev)
132{
133 return -ENOSYS;
134}
135static inline int ssb_gige_map_irq(struct ssb_device *sdev,
136 const struct pci_dev *pdev)
137{
138 return -ENOSYS;
139}
140static inline int ssb_gige_init(void)
141{
142 return 0;
143}
144static inline void ssb_gige_exit(void)
145{
146}
147
148static inline bool pdev_is_ssb_gige_core(struct pci_dev *pdev)
149{
150 return 0;
151}
152static inline struct ssb_gige * pdev_to_ssb_gige(struct pci_dev *pdev)
153{
154 return NULL;
155}
156static inline bool ssb_gige_is_rgmii(struct pci_dev *pdev)
157{
158 return 0;
159}
160static inline bool ssb_gige_have_roboswitch(struct pci_dev *pdev)
161{
162 return 0;
163}
164static inline bool ssb_gige_one_dma_at_once(struct pci_dev *pdev)
165{
166 return 0;
167}
168static inline bool ssb_gige_must_flush_posted_writes(struct pci_dev *pdev)
169{
170 return 0;
171}
172
173#endif /* CONFIG_SSB_DRIVER_GIGE */
174#endif /* LINUX_SSB_DRIVER_GIGE_H_ */
diff --git a/include/linux/ssb/ssb_driver_pci.h b/include/linux/ssb/ssb_driver_pci.h
index 5e25bac4ed31..41e330e51c2a 100644
--- a/include/linux/ssb/ssb_driver_pci.h
+++ b/include/linux/ssb/ssb_driver_pci.h
@@ -1,6 +1,11 @@
1#ifndef LINUX_SSB_PCICORE_H_ 1#ifndef LINUX_SSB_PCICORE_H_
2#define LINUX_SSB_PCICORE_H_ 2#define LINUX_SSB_PCICORE_H_
3 3
4#include <linux/types.h>
5
6struct pci_dev;
7
8
4#ifdef CONFIG_SSB_DRIVER_PCICORE 9#ifdef CONFIG_SSB_DRIVER_PCICORE
5 10
6/* PCI core registers. */ 11/* PCI core registers. */
@@ -88,6 +93,9 @@ extern void ssb_pcicore_init(struct ssb_pcicore *pc);
88extern int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc, 93extern int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
89 struct ssb_device *dev); 94 struct ssb_device *dev);
90 95
96int ssb_pcicore_plat_dev_init(struct pci_dev *d);
97int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
98
91 99
92#else /* CONFIG_SSB_DRIVER_PCICORE */ 100#else /* CONFIG_SSB_DRIVER_PCICORE */
93 101
@@ -107,5 +115,16 @@ int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
107 return 0; 115 return 0;
108} 116}
109 117
118static inline
119int ssb_pcicore_plat_dev_init(struct pci_dev *d)
120{
121 return -ENODEV;
122}
123static inline
124int ssb_pcicore_pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
125{
126 return -ENODEV;
127}
128
110#endif /* CONFIG_SSB_DRIVER_PCICORE */ 129#endif /* CONFIG_SSB_DRIVER_PCICORE */
111#endif /* LINUX_SSB_PCICORE_H_ */ 130#endif /* LINUX_SSB_PCICORE_H_ */
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 08027f1d7f31..d96d9b122304 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -239,6 +239,11 @@ static inline struct tcp_request_sock *tcp_rsk(const struct request_sock *req)
239 return (struct tcp_request_sock *)req; 239 return (struct tcp_request_sock *)req;
240} 240}
241 241
242struct tcp_deferred_accept_info {
243 struct sock *listen_sk;
244 struct request_sock *request;
245};
246
242struct tcp_sock { 247struct tcp_sock {
243 /* inet_connection_sock has to be the first member of tcp_sock */ 248 /* inet_connection_sock has to be the first member of tcp_sock */
244 struct inet_connection_sock inet_conn; 249 struct inet_connection_sock inet_conn;
@@ -374,6 +379,8 @@ struct tcp_sock {
374 unsigned int keepalive_intvl; /* time interval between keep alive probes */ 379 unsigned int keepalive_intvl; /* time interval between keep alive probes */
375 int linger2; 380 int linger2;
376 381
382 struct tcp_deferred_accept_info defer_tcp_accept;
383
377 unsigned long last_synq_overflow; 384 unsigned long last_synq_overflow;
378 385
379 u32 tso_deferred; 386 u32 tso_deferred;
diff --git a/include/linux/udp.h b/include/linux/udp.h
index 8ec703f462da..581ca2c14c52 100644
--- a/include/linux/udp.h
+++ b/include/linux/udp.h
@@ -26,15 +26,6 @@ struct udphdr {
26 __sum16 check; 26 __sum16 check;
27}; 27};
28 28
29#ifdef __KERNEL__
30#include <linux/skbuff.h>
31
32static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
33{
34 return (struct udphdr *)skb_transport_header(skb);
35}
36#endif
37
38/* UDP socket options */ 29/* UDP socket options */
39#define UDP_CORK 1 /* Never send partially complete segments */ 30#define UDP_CORK 1 /* Never send partially complete segments */
40#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */ 31#define UDP_ENCAP 100 /* Set the socket to accept encapsulated packets */
@@ -45,9 +36,14 @@ static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
45#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */ 36#define UDP_ENCAP_L2TPINUDP 3 /* rfc2661 */
46 37
47#ifdef __KERNEL__ 38#ifdef __KERNEL__
48#include <linux/types.h>
49
50#include <net/inet_sock.h> 39#include <net/inet_sock.h>
40#include <linux/skbuff.h>
41
42static inline struct udphdr *udp_hdr(const struct sk_buff *skb)
43{
44 return (struct udphdr *)skb_transport_header(skb);
45}
46
51#define UDP_HTABLE_SIZE 128 47#define UDP_HTABLE_SIZE 128
52 48
53struct udp_sock { 49struct udp_sock {
@@ -82,6 +78,7 @@ static inline struct udp_sock *udp_sk(const struct sock *sk)
82{ 78{
83 return (struct udp_sock *)sk; 79 return (struct udp_sock *)sk;
84} 80}
81
85#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag) 82#define IS_UDPLITE(__sk) (udp_sk(__sk)->pcflag)
86 83
87#endif 84#endif
diff --git a/include/linux/wireless.h b/include/linux/wireless.h
index 3160dfed73ca..2864b1699ecc 100644
--- a/include/linux/wireless.h
+++ b/include/linux/wireless.h
@@ -455,6 +455,7 @@
455#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */ 455#define IW_MODE_REPEAT 4 /* Wireless Repeater (forwarder) */
456#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */ 456#define IW_MODE_SECOND 5 /* Secondary master/repeater (backup) */
457#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */ 457#define IW_MODE_MONITOR 6 /* Passive monitor (listen only) */
458#define IW_MODE_MESH 7 /* Mesh (IEEE 802.11s) network */
458 459
459/* Statistics flags (bitmask in updated) */ 460/* Statistics flags (bitmask in updated) */
460#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */ 461#define IW_QUAL_QUAL_UPDATED 0x01 /* Value was updated since last read */
diff --git a/include/linux/xfrm.h b/include/linux/xfrm.h
index e31b8c84f2c9..0c82c80b277f 100644
--- a/include/linux/xfrm.h
+++ b/include/linux/xfrm.h
@@ -113,7 +113,8 @@ enum
113{ 113{
114 XFRM_POLICY_TYPE_MAIN = 0, 114 XFRM_POLICY_TYPE_MAIN = 0,
115 XFRM_POLICY_TYPE_SUB = 1, 115 XFRM_POLICY_TYPE_SUB = 1,
116 XFRM_POLICY_TYPE_MAX = 2 116 XFRM_POLICY_TYPE_MAX = 2,
117 XFRM_POLICY_TYPE_ANY = 255
117}; 118};
118 119
119enum 120enum
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 496503c03846..0a2f0372df31 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -55,9 +55,12 @@ struct prefix_info {
55extern int addrconf_init(void); 55extern int addrconf_init(void);
56extern void addrconf_cleanup(void); 56extern void addrconf_cleanup(void);
57 57
58extern int addrconf_add_ifaddr(void __user *arg); 58extern int addrconf_add_ifaddr(struct net *net,
59extern int addrconf_del_ifaddr(void __user *arg); 59 void __user *arg);
60extern int addrconf_set_dstaddr(void __user *arg); 60extern int addrconf_del_ifaddr(struct net *net,
61 void __user *arg);
62extern int addrconf_set_dstaddr(struct net *net,
63 void __user *arg);
61 64
62extern int ipv6_chk_addr(struct net *net, 65extern int ipv6_chk_addr(struct net *net,
63 struct in6_addr *addr, 66 struct in6_addr *addr,
@@ -68,16 +71,18 @@ extern int ipv6_chk_addr(struct net *net,
68extern int ipv6_chk_home_addr(struct net *net, 71extern int ipv6_chk_home_addr(struct net *net,
69 struct in6_addr *addr); 72 struct in6_addr *addr);
70#endif 73#endif
74
75extern int ipv6_chk_prefix(struct in6_addr *addr,
76 struct net_device *dev);
77
71extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, 78extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net,
72 struct in6_addr *addr, 79 const struct in6_addr *addr,
73 struct net_device *dev, 80 struct net_device *dev,
74 int strict); 81 int strict);
75 82
76extern int ipv6_get_saddr(struct dst_entry *dst,
77 struct in6_addr *daddr,
78 struct in6_addr *saddr);
79extern int ipv6_dev_get_saddr(struct net_device *dev, 83extern int ipv6_dev_get_saddr(struct net_device *dev,
80 struct in6_addr *daddr, 84 const struct in6_addr *daddr,
85 unsigned int srcprefs,
81 struct in6_addr *saddr); 86 struct in6_addr *saddr);
82extern int ipv6_get_lladdr(struct net_device *dev, 87extern int ipv6_get_lladdr(struct net_device *dev,
83 struct in6_addr *addr, 88 struct in6_addr *addr,
@@ -100,31 +105,31 @@ extern u32 ipv6_addr_label(const struct in6_addr *addr,
100/* 105/*
101 * multicast prototypes (mcast.c) 106 * multicast prototypes (mcast.c)
102 */ 107 */
103extern int ipv6_sock_mc_join(struct sock *sk, int ifindex, 108extern int ipv6_sock_mc_join(struct sock *sk, int ifindex,
104 struct in6_addr *addr); 109 const struct in6_addr *addr);
105extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex, 110extern int ipv6_sock_mc_drop(struct sock *sk, int ifindex,
106 struct in6_addr *addr); 111 const struct in6_addr *addr);
107extern void ipv6_sock_mc_close(struct sock *sk); 112extern void ipv6_sock_mc_close(struct sock *sk);
108extern int inet6_mc_check(struct sock *sk, struct in6_addr *mc_addr, 113extern int inet6_mc_check(struct sock *sk,
109 struct in6_addr *src_addr); 114 const struct in6_addr *mc_addr,
115 const struct in6_addr *src_addr);
110 116
111extern int ipv6_dev_mc_inc(struct net_device *dev, struct in6_addr *addr); 117extern int ipv6_dev_mc_inc(struct net_device *dev, const struct in6_addr *addr);
112extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, struct in6_addr *addr); 118extern int __ipv6_dev_mc_dec(struct inet6_dev *idev, const struct in6_addr *addr);
113extern int ipv6_dev_mc_dec(struct net_device *dev, struct in6_addr *addr); 119extern int ipv6_dev_mc_dec(struct net_device *dev, const struct in6_addr *addr);
114extern void ipv6_mc_up(struct inet6_dev *idev); 120extern void ipv6_mc_up(struct inet6_dev *idev);
115extern void ipv6_mc_down(struct inet6_dev *idev); 121extern void ipv6_mc_down(struct inet6_dev *idev);
116extern void ipv6_mc_init_dev(struct inet6_dev *idev); 122extern void ipv6_mc_init_dev(struct inet6_dev *idev);
117extern void ipv6_mc_destroy_dev(struct inet6_dev *idev); 123extern void ipv6_mc_destroy_dev(struct inet6_dev *idev);
118extern void addrconf_dad_failure(struct inet6_ifaddr *ifp); 124extern void addrconf_dad_failure(struct inet6_ifaddr *ifp);
119 125
120extern int ipv6_chk_mcast_addr(struct net_device *dev, struct in6_addr *group, 126extern int ipv6_chk_mcast_addr(struct net_device *dev,
121 struct in6_addr *src_addr); 127 const struct in6_addr *group,
128 const struct in6_addr *src_addr);
122extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr); 129extern int ipv6_is_mld(struct sk_buff *skb, int nexthdr);
123 130
124extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len); 131extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len);
125 132
126extern int ipv6_get_hoplimit(struct net_device *dev);
127
128/* 133/*
129 * anycast prototypes (anycast.c) 134 * anycast prototypes (anycast.c)
130 */ 135 */
@@ -135,7 +140,8 @@ extern int inet6_ac_check(struct sock *sk, struct in6_addr *addr, int ifindex);
135 140
136extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr); 141extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr);
137extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr); 142extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr);
138extern int ipv6_chk_acast_addr(struct net_device *dev, struct in6_addr *addr); 143extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
144 struct in6_addr *addr);
139 145
140 146
141/* Device notifier */ 147/* Device notifier */
@@ -185,26 +191,6 @@ static inline void in6_ifa_put(struct inet6_ifaddr *ifp)
185#define in6_ifa_hold(ifp) atomic_inc(&(ifp)->refcnt) 191#define in6_ifa_hold(ifp) atomic_inc(&(ifp)->refcnt)
186 192
187 193
188extern void addrconf_forwarding_on(void);
189/*
190 * Hash function taken from net_alias.c
191 */
192
193static __inline__ u8 ipv6_addr_hash(const struct in6_addr *addr)
194{
195 __u32 word;
196
197 /*
198 * We perform the hash function over the last 64 bits of the address
199 * This will include the IEEE address token on links that support it.
200 */
201
202 word = (__force u32)(addr->s6_addr32[2] ^ addr->s6_addr32[3]);
203 word ^= (word >> 16);
204 word ^= (word >> 8);
205
206 return ((word ^ (word >> 4)) & 0x0f);
207}
208 194
209/* 195/*
210 * compute link-local solicited-node multicast address 196 * compute link-local solicited-node multicast address
@@ -214,61 +200,31 @@ static inline void addrconf_addr_solict_mult(const struct in6_addr *addr,
214 struct in6_addr *solicited) 200 struct in6_addr *solicited)
215{ 201{
216 ipv6_addr_set(solicited, 202 ipv6_addr_set(solicited,
217 __constant_htonl(0xFF020000), 0, 203 htonl(0xFF020000), 0,
218 __constant_htonl(0x1), 204 htonl(0x1),
219 __constant_htonl(0xFF000000) | addr->s6_addr32[3]); 205 htonl(0xFF000000) | addr->s6_addr32[3]);
220}
221
222
223static inline void ipv6_addr_all_nodes(struct in6_addr *addr)
224{
225 ipv6_addr_set(addr,
226 __constant_htonl(0xFF020000), 0, 0,
227 __constant_htonl(0x1));
228}
229
230static inline void ipv6_addr_all_routers(struct in6_addr *addr)
231{
232 ipv6_addr_set(addr,
233 __constant_htonl(0xFF020000), 0, 0,
234 __constant_htonl(0x2));
235} 206}
236 207
237static inline int ipv6_addr_is_multicast(const struct in6_addr *addr) 208static inline int ipv6_addr_is_multicast(const struct in6_addr *addr)
238{ 209{
239 return (addr->s6_addr32[0] & __constant_htonl(0xFF000000)) == __constant_htonl(0xFF000000); 210 return (addr->s6_addr32[0] & htonl(0xFF000000)) == htonl(0xFF000000);
240} 211}
241 212
242static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) 213static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr)
243{ 214{
244 return (addr->s6_addr32[0] == htonl(0xff020000) && 215 return (((addr->s6_addr32[0] ^ htonl(0xff020000)) |
245 addr->s6_addr32[1] == 0 && 216 addr->s6_addr32[1] | addr->s6_addr32[2] |
246 addr->s6_addr32[2] == 0 && 217 (addr->s6_addr32[3] ^ htonl(0x00000001))) == 0);
247 addr->s6_addr32[3] == htonl(0x00000001));
248} 218}
249 219
250static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) 220static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr)
251{ 221{
252 return (addr->s6_addr32[0] == htonl(0xff020000) && 222 return (((addr->s6_addr32[0] ^ htonl(0xff020000)) |
253 addr->s6_addr32[1] == 0 && 223 addr->s6_addr32[1] | addr->s6_addr32[2] |
254 addr->s6_addr32[2] == 0 && 224 (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0);
255 addr->s6_addr32[3] == htonl(0x00000002));
256} 225}
257 226
258static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr) 227extern int __ipv6_isatap_ifid(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 228
273static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) 229static inline int ipv6_addr_is_isatap(const struct in6_addr *addr)
274{ 230{
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index bcc480b8892a..e00750836ba5 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -12,6 +12,16 @@
12 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 12 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
13 */ 13 */
14 14
15/**
16 * struct vif_params - describes virtual interface parameters
17 * @mesh_id: mesh ID to use
18 * @mesh_id_len: length of the mesh ID
19 */
20struct vif_params {
21 u8 *mesh_id;
22 int mesh_id_len;
23};
24
15/* Radiotap header iteration 25/* Radiotap header iteration
16 * implemented in net/wireless/radiotap.c 26 * implemented in net/wireless/radiotap.c
17 * docs in Documentation/networking/radiotap-headers.txt 27 * docs in Documentation/networking/radiotap-headers.txt
@@ -109,6 +119,19 @@ enum station_flags {
109}; 119};
110 120
111/** 121/**
122 * enum plink_action - actions to perform in mesh peers
123 *
124 * @PLINK_ACTION_INVALID: action 0 is reserved
125 * @PLINK_ACTION_OPEN: start mesh peer link establishment
126 * @PLINK_ACTION_BLOCL: block traffic from this mesh peer
127 */
128enum plink_actions {
129 PLINK_ACTION_INVALID,
130 PLINK_ACTION_OPEN,
131 PLINK_ACTION_BLOCK,
132};
133
134/**
112 * struct station_parameters - station parameters 135 * struct station_parameters - station parameters
113 * 136 *
114 * Used to change and create a new station. 137 * Used to change and create a new station.
@@ -128,41 +151,124 @@ struct station_parameters {
128 int listen_interval; 151 int listen_interval;
129 u16 aid; 152 u16 aid;
130 u8 supported_rates_len; 153 u8 supported_rates_len;
154 u8 plink_action;
131}; 155};
132 156
133/** 157/**
134 * enum station_stats_flags - station statistics flags 158 * enum station_info_flags - station information flags
135 * 159 *
136 * Used by the driver to indicate which info in &struct station_stats 160 * Used by the driver to indicate which info in &struct station_info
137 * it has filled in during get_station(). 161 * it has filled in during get_station() or dump_station().
138 * 162 *
139 * @STATION_STAT_INACTIVE_TIME: @inactive_time filled 163 * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
140 * @STATION_STAT_RX_BYTES: @rx_bytes filled 164 * @STATION_INFO_RX_BYTES: @rx_bytes filled
141 * @STATION_STAT_TX_BYTES: @tx_bytes filled 165 * @STATION_INFO_TX_BYTES: @tx_bytes filled
166 * @STATION_INFO_LLID: @llid filled
167 * @STATION_INFO_PLID: @plid filled
168 * @STATION_INFO_PLINK_STATE: @plink_state filled
142 */ 169 */
143enum station_stats_flags { 170enum station_info_flags {
144 STATION_STAT_INACTIVE_TIME = 1<<0, 171 STATION_INFO_INACTIVE_TIME = 1<<0,
145 STATION_STAT_RX_BYTES = 1<<1, 172 STATION_INFO_RX_BYTES = 1<<1,
146 STATION_STAT_TX_BYTES = 1<<2, 173 STATION_INFO_TX_BYTES = 1<<2,
174 STATION_INFO_LLID = 1<<3,
175 STATION_INFO_PLID = 1<<4,
176 STATION_INFO_PLINK_STATE = 1<<5,
147}; 177};
148 178
149/** 179/**
150 * struct station_stats - station statistics 180 * struct station_info - station information
151 * 181 *
152 * Station information filled by driver for get_station(). 182 * Station information filled by driver for get_station() and dump_station.
153 * 183 *
154 * @filled: bitflag of flags from &enum station_stats_flags 184 * @filled: bitflag of flags from &enum station_info_flags
155 * @inactive_time: time since last station activity (tx/rx) in milliseconds 185 * @inactive_time: time since last station activity (tx/rx) in milliseconds
156 * @rx_bytes: bytes received from this station 186 * @rx_bytes: bytes received from this station
157 * @tx_bytes: bytes transmitted to this station 187 * @tx_bytes: bytes transmitted to this station
188 * @llid: mesh local link id
189 * @plid: mesh peer link id
190 * @plink_state: mesh peer link state
158 */ 191 */
159struct station_stats { 192struct station_info {
160 u32 filled; 193 u32 filled;
161 u32 inactive_time; 194 u32 inactive_time;
162 u32 rx_bytes; 195 u32 rx_bytes;
163 u32 tx_bytes; 196 u32 tx_bytes;
197 u16 llid;
198 u16 plid;
199 u8 plink_state;
200};
201
202/**
203 * enum monitor_flags - monitor flags
204 *
205 * Monitor interface configuration flags. Note that these must be the bits
206 * according to the nl80211 flags.
207 *
208 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
209 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
210 * @MONITOR_FLAG_CONTROL: pass control frames
211 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
212 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
213 */
214enum monitor_flags {
215 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
216 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
217 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
218 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
219 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
164}; 220};
165 221
222/**
223 * enum mpath_info_flags - mesh path information flags
224 *
225 * Used by the driver to indicate which info in &struct mpath_info it has filled
226 * in during get_station() or dump_station().
227 *
228 * MPATH_INFO_FRAME_QLEN: @frame_qlen filled
229 * MPATH_INFO_DSN: @dsn filled
230 * MPATH_INFO_METRIC: @metric filled
231 * MPATH_INFO_EXPTIME: @exptime filled
232 * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
233 * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
234 * MPATH_INFO_FLAGS: @flags filled
235 */
236enum mpath_info_flags {
237 MPATH_INFO_FRAME_QLEN = BIT(0),
238 MPATH_INFO_DSN = BIT(1),
239 MPATH_INFO_METRIC = BIT(2),
240 MPATH_INFO_EXPTIME = BIT(3),
241 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
242 MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
243 MPATH_INFO_FLAGS = BIT(6),
244};
245
246/**
247 * struct mpath_info - mesh path information
248 *
249 * Mesh path information filled by driver for get_mpath() and dump_mpath().
250 *
251 * @filled: bitfield of flags from &enum mpath_info_flags
252 * @frame_qlen: number of queued frames for this destination
253 * @dsn: destination sequence number
254 * @metric: metric (cost) of this mesh path
255 * @exptime: expiration time for the mesh path from now, in msecs
256 * @flags: mesh path flags
257 * @discovery_timeout: total mesh path discovery timeout, in msecs
258 * @discovery_retries: mesh path discovery retries
259 */
260struct mpath_info {
261 u32 filled;
262 u32 frame_qlen;
263 u32 dsn;
264 u32 metric;
265 u32 exptime;
266 u32 discovery_timeout;
267 u8 discovery_retries;
268 u8 flags;
269};
270
271
166/* from net/wireless.h */ 272/* from net/wireless.h */
167struct wiphy; 273struct wiphy;
168 274
@@ -210,13 +316,17 @@ struct wiphy;
210 * @del_station: Remove a station; @mac may be NULL to remove all stations. 316 * @del_station: Remove a station; @mac may be NULL to remove all stations.
211 * 317 *
212 * @change_station: Modify a given station. 318 * @change_station: Modify a given station.
319 *
320 * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
213 */ 321 */
214struct cfg80211_ops { 322struct cfg80211_ops {
215 int (*add_virtual_intf)(struct wiphy *wiphy, char *name, 323 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
216 enum nl80211_iftype type); 324 enum nl80211_iftype type, u32 *flags,
325 struct vif_params *params);
217 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); 326 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
218 int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, 327 int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
219 enum nl80211_iftype type); 328 enum nl80211_iftype type, u32 *flags,
329 struct vif_params *params);
220 330
221 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 331 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
222 u8 key_index, u8 *mac_addr, 332 u8 key_index, u8 *mac_addr,
@@ -244,7 +354,22 @@ struct cfg80211_ops {
244 int (*change_station)(struct wiphy *wiphy, struct net_device *dev, 354 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
245 u8 *mac, struct station_parameters *params); 355 u8 *mac, struct station_parameters *params);
246 int (*get_station)(struct wiphy *wiphy, struct net_device *dev, 356 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
247 u8 *mac, struct station_stats *stats); 357 u8 *mac, struct station_info *sinfo);
358 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
359 int idx, u8 *mac, struct station_info *sinfo);
360
361 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
362 u8 *dst, u8 *next_hop);
363 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
364 u8 *dst);
365 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
366 u8 *dst, u8 *next_hop);
367 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
368 u8 *dst, u8 *next_hop,
369 struct mpath_info *pinfo);
370 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
371 int idx, u8 *dst, u8 *next_hop,
372 struct mpath_info *pinfo);
248}; 373};
249 374
250#endif /* __NET_CFG80211_H */ 375#endif /* __NET_CFG80211_H */
diff --git a/include/net/dst.h b/include/net/dst.h
index ae13370e8484..002500e631f5 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -163,15 +163,7 @@ struct dst_entry * dst_clone(struct dst_entry * dst)
163 return dst; 163 return dst;
164} 164}
165 165
166static inline 166extern void dst_release(struct dst_entry *dst);
167void dst_release(struct dst_entry * dst)
168{
169 if (dst) {
170 WARN_ON(atomic_read(&dst->__refcnt) < 1);
171 smp_mb__before_atomic_dec();
172 atomic_dec(&dst->__refcnt);
173 }
174}
175 167
176/* Children define the path of the packet through the 168/* Children define the path of the packet through the
177 * Linux networking. Thus, destinations are stackable. 169 * Linux networking. Thus, destinations are stackable.
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 34349f9f4331..a5c6ccc5bb19 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -87,6 +87,7 @@ static inline void fib_rule_get(struct fib_rule *rule)
87static inline void fib_rule_put_rcu(struct rcu_head *head) 87static inline void fib_rule_put_rcu(struct rcu_head *head)
88{ 88{
89 struct fib_rule *rule = container_of(head, struct fib_rule, rcu); 89 struct fib_rule *rule = container_of(head, struct fib_rule, rcu);
90 release_net(rule->fr_net);
90 kfree(rule); 91 kfree(rule);
91} 92}
92 93
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 9f7ef3c8baef..dddb839ff4b5 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -48,7 +48,7 @@ struct sk_buff;
48extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); 48extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
49extern int icmp_rcv(struct sk_buff *skb); 49extern int icmp_rcv(struct sk_buff *skb);
50extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); 50extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg);
51extern void icmp_init(struct net_proto_family *ops); 51extern int icmp_init(void);
52extern void icmp_out_count(unsigned char type); 52extern void icmp_out_count(unsigned char type);
53 53
54/* Move into dst.h ? */ 54/* Move into dst.h ? */
@@ -65,11 +65,4 @@ static inline struct raw_sock *raw_sk(const struct sock *sk)
65 return (struct raw_sock *)sk; 65 return (struct raw_sock *)sk;
66} 66}
67 67
68extern int sysctl_icmp_echo_ignore_all;
69extern int sysctl_icmp_echo_ignore_broadcasts;
70extern int sysctl_icmp_ignore_bogus_error_responses;
71extern int sysctl_icmp_errors_use_inbound_ifaddr;
72extern int sysctl_icmp_ratelimit;
73extern int sysctl_icmp_ratemask;
74
75#endif /* _ICMP_H */ 68#endif /* _ICMP_H */
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h
index 285b2adfa648..529816bfbc52 100644
--- a/include/net/ieee80211.h
+++ b/include/net/ieee80211.h
@@ -183,7 +183,6 @@ const char *escape_essid(const char *essid, u8 essid_len);
183#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a) 183#define IEEE80211_DEBUG_RX(f, a...) IEEE80211_DEBUG(IEEE80211_DL_RX, f, ## a)
184#define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a) 184#define IEEE80211_DEBUG_QOS(f, a...) IEEE80211_DEBUG(IEEE80211_DL_QOS, f, ## a)
185#include <linux/netdevice.h> 185#include <linux/netdevice.h>
186#include <linux/wireless.h>
187#include <linux/if_arp.h> /* ARPHRD_ETHER */ 186#include <linux/if_arp.h> /* ARPHRD_ETHER */
188 187
189#ifndef WIRELESS_SPY 188#ifndef WIRELESS_SPY
diff --git a/include/net/ieee80211softmac.h b/include/net/ieee80211softmac.h
deleted file mode 100644
index 1ef6282fdded..000000000000
--- a/include/net/ieee80211softmac.h
+++ /dev/null
@@ -1,373 +0,0 @@
1/*
2 * ieee80211softmac.h - public interface to the softmac
3 *
4 * Copyright (c) 2005 Johannes Berg <johannes@sipsolutions.net>
5 * Joseph Jezak <josejx@gentoo.org>
6 * Larry Finger <Larry.Finger@lwfinger.net>
7 * Danny van Dyk <kugelfang@gentoo.org>
8 * Michael Buesch <mbuesch@freenet.de>
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of version 2 of the GNU General Public License as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 * The full GNU General Public License is included in this distribution in the
24 * file called COPYING.
25 */
26
27#ifndef IEEE80211SOFTMAC_H_
28#define IEEE80211SOFTMAC_H_
29
30#include <linux/kernel.h>
31#include <linux/spinlock.h>
32#include <linux/workqueue.h>
33#include <linux/list.h>
34#include <net/ieee80211.h>
35
36/* Once the API is considered more or less stable,
37 * this should be incremented on API incompatible changes.
38 */
39#define IEEE80211SOFTMAC_API 0
40
41#define IEEE80211SOFTMAC_MAX_RATES_LEN 8
42#define IEEE80211SOFTMAC_MAX_EX_RATES_LEN 255
43
44struct ieee80211softmac_ratesinfo {
45 u8 count;
46 u8 rates[IEEE80211SOFTMAC_MAX_RATES_LEN + IEEE80211SOFTMAC_MAX_EX_RATES_LEN];
47};
48
49/* internal structures */
50struct ieee80211softmac_network;
51struct ieee80211softmac_scaninfo;
52
53struct ieee80211softmac_essid {
54 u8 len;
55 char data[IW_ESSID_MAX_SIZE+1];
56};
57
58struct ieee80211softmac_wpa {
59 char *IE;
60 int IElen;
61 int IEbuflen;
62};
63
64/*
65 * Information about association
66 */
67struct ieee80211softmac_assoc_info {
68
69 struct mutex mutex;
70
71 /*
72 * This is the requested ESSID. It is written
73 * only by the WX handlers.
74 *
75 */
76 struct ieee80211softmac_essid req_essid;
77 /*
78 * the ESSID of the network we're currently
79 * associated (or trying) to. This is
80 * updated to the network's actual ESSID
81 * even if the requested ESSID was 'ANY'
82 */
83 struct ieee80211softmac_essid associate_essid;
84
85 /* BSSID we're trying to associate to */
86 char bssid[ETH_ALEN];
87
88 /* some flags.
89 * static_essid is valid if the essid is constant,
90 * this is for use by the wx handlers only.
91 *
92 * associating is true, if the network has been
93 * auth'ed on and we are in the process of associating.
94 *
95 * bssvalid is true if we found a matching network
96 * and saved it's BSSID into the bssid above.
97 *
98 * bssfixed is used for SIOCSIWAP.
99 */
100 u8 static_essid;
101 u8 short_preamble_available;
102 u8 associating;
103 u8 associated;
104 u8 assoc_wait;
105 u8 bssvalid;
106 u8 bssfixed;
107
108 /* Scan retries remaining */
109 int scan_retry;
110
111 struct delayed_work work;
112 struct delayed_work timeout;
113};
114
115struct ieee80211softmac_bss_info {
116 /* Rates supported by the network */
117 struct ieee80211softmac_ratesinfo supported_rates;
118
119 /* This indicates whether frames can currently be transmitted with
120 * short preamble (only use this variable during TX at CCK rates) */
121 u8 short_preamble:1;
122
123 /* This indicates whether protection (e.g. self-CTS) should be used
124 * when transmitting with OFDM modulation */
125 u8 use_protection:1;
126};
127
128enum {
129 IEEE80211SOFTMAC_AUTH_OPEN_REQUEST = 1,
130 IEEE80211SOFTMAC_AUTH_OPEN_RESPONSE = 2,
131};
132
133enum {
134 IEEE80211SOFTMAC_AUTH_SHARED_REQUEST = 1,
135 IEEE80211SOFTMAC_AUTH_SHARED_CHALLENGE = 2,
136 IEEE80211SOFTMAC_AUTH_SHARED_RESPONSE = 3,
137 IEEE80211SOFTMAC_AUTH_SHARED_PASS = 4,
138};
139
140/* We should make these tunable
141 * AUTH_TIMEOUT seems really long, but that's what it is in BSD */
142#define IEEE80211SOFTMAC_AUTH_TIMEOUT (12 * HZ)
143#define IEEE80211SOFTMAC_AUTH_RETRY_LIMIT 5
144#define IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT 3
145
146struct ieee80211softmac_txrates {
147 /* The Bit-Rate to be used for multicast frames. */
148 u8 mcast_rate;
149
150 /* The Bit-Rate to be used for multicast management frames. */
151 u8 mgt_mcast_rate;
152
153 /* The Bit-Rate to be used for any other (normal) data packet. */
154 u8 default_rate;
155 /* The Bit-Rate to be used for default fallback
156 * (If the device supports fallback and hardware-retry)
157 */
158 u8 default_fallback;
159
160 /* This is the rate that the user asked for */
161 u8 user_rate;
162};
163
164/* Bits for txrates_change callback. */
165#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT (1 << 0) /* default_rate */
166#define IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK (1 << 1) /* default_fallback */
167#define IEEE80211SOFTMAC_TXRATECHG_MCAST (1 << 2) /* mcast_rate */
168#define IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST (1 << 3) /* mgt_mcast_rate */
169
170#define IEEE80211SOFTMAC_BSSINFOCHG_RATES (1 << 0) /* supported_rates */
171#define IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE (1 << 1) /* short_preamble */
172#define IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION (1 << 2) /* use_protection */
173
174struct ieee80211softmac_device {
175 /* 802.11 structure for data stuff */
176 struct ieee80211_device *ieee;
177 struct net_device *dev;
178
179 /* only valid if associated, then holds the Association ID */
180 u16 association_id;
181
182 /* the following methods are callbacks that the driver
183 * using this framework has to assign
184 */
185
186 /* always assign these */
187 void (*set_bssid_filter)(struct net_device *dev, const u8 *bssid);
188 void (*set_channel)(struct net_device *dev, u8 channel);
189
190 /* assign if you need it, informational only */
191 void (*link_change)(struct net_device *dev);
192
193 /* If the hardware can do scanning, assign _all_ three of these callbacks.
194 * When the scan finishes, call ieee80211softmac_scan_finished().
195 */
196
197 /* when called, start_scan is guaranteed to not be called again
198 * until you call ieee80211softmac_scan_finished.
199 * Return 0 if scanning could start, error otherwise.
200 * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_start_scan */
201 int (*start_scan)(struct net_device *dev);
202 /* this should block until after ieee80211softmac_scan_finished was called
203 * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_wait_for_scan */
204 void (*wait_for_scan)(struct net_device *dev);
205 /* stop_scan aborts a scan, but is asynchronous.
206 * if you want to wait for it too, use wait_for_scan
207 * SOFTMAC AUTHORS: don't call this, use ieee80211softmac_stop_scan */
208 void (*stop_scan)(struct net_device *dev);
209
210 /* we'll need something about beacons here too, for AP or ad-hoc modes */
211
212 /* Transmission rates to be used by the driver.
213 * The SoftMAC figures out the best possible rates.
214 * The driver just needs to read them.
215 */
216 struct ieee80211softmac_txrates txrates;
217
218 /* If the driver needs to do stuff on TX rate changes, assign this
219 * callback. See IEEE80211SOFTMAC_TXRATECHG for change flags. */
220 void (*txrates_change)(struct net_device *dev,
221 u32 changes);
222
223 /* If the driver needs to do stuff when BSS properties change, assign
224 * this callback. see IEEE80211SOFTMAC_BSSINFOCHG for change flags. */
225 void (*bssinfo_change)(struct net_device *dev,
226 u32 changes);
227
228 /* private stuff follows */
229 /* this lock protects this structure */
230 spinlock_t lock;
231
232 struct workqueue_struct *wq;
233
234 u8 running; /* SoftMAC started? */
235 u8 scanning;
236
237 struct ieee80211softmac_scaninfo *scaninfo;
238 struct ieee80211softmac_assoc_info associnfo;
239 struct ieee80211softmac_bss_info bssinfo;
240
241 struct list_head auth_queue;
242 struct list_head events;
243
244 struct ieee80211softmac_ratesinfo ratesinfo;
245 int txrate_badness;
246
247 /* WPA stuff */
248 struct ieee80211softmac_wpa wpa;
249
250 /* we need to keep a list of network structs we copied */
251 struct list_head network_list;
252
253 /* This must be the last item so that it points to the data
254 * allocated beyond this structure by alloc_ieee80211 */
255 u8 priv[0];
256};
257
258extern void ieee80211softmac_scan_finished(struct ieee80211softmac_device *sm);
259
260static inline void * ieee80211softmac_priv(struct net_device *dev)
261{
262 return ((struct ieee80211softmac_device *)ieee80211_priv(dev))->priv;
263}
264
265extern struct net_device * alloc_ieee80211softmac(int sizeof_priv);
266extern void free_ieee80211softmac(struct net_device *dev);
267
268/* Call this function if you detect a lost TX fragment.
269 * (If the device indicates failure of ACK RX, for example.)
270 * It is wise to call this function if you are able to detect lost packets,
271 * because it contributes to the TX Rates auto adjustment.
272 */
273extern void ieee80211softmac_fragment_lost(struct net_device *dev,
274 u16 wireless_sequence_number);
275/* Call this function before _start to tell the softmac what rates
276 * the hw supports. The rates parameter is copied, so you can
277 * free it right after calling this function.
278 * Note that the rates need to be sorted. */
279extern void ieee80211softmac_set_rates(struct net_device *dev, u8 count, u8 *rates);
280
281/* Finds the highest rate which is:
282 * 1. Present in ri (optionally a basic rate)
283 * 2. Supported by the device
284 * 3. Less than or equal to the user-defined rate
285 */
286extern u8 ieee80211softmac_highest_supported_rate(struct ieee80211softmac_device *mac,
287 struct ieee80211softmac_ratesinfo *ri, int basic_only);
288
289/* Helper function which advises you the rate at which a frame should be
290 * transmitted at. */
291static inline u8 ieee80211softmac_suggest_txrate(struct ieee80211softmac_device *mac,
292 int is_multicast,
293 int is_mgt)
294{
295 struct ieee80211softmac_txrates *txrates = &mac->txrates;
296
297 if (!mac->associnfo.associated)
298 return txrates->mgt_mcast_rate;
299
300 /* We are associated, sending unicast frame */
301 if (!is_multicast)
302 return txrates->default_rate;
303
304 /* We are associated, sending multicast frame */
305 if (is_mgt)
306 return txrates->mgt_mcast_rate;
307 else
308 return txrates->mcast_rate;
309}
310
311/* Helper function which advises you when it is safe to transmit with short
312 * preamble.
313 * You should only call this function when transmitting at CCK rates. */
314static inline int ieee80211softmac_short_preamble_ok(struct ieee80211softmac_device *mac,
315 int is_multicast,
316 int is_mgt)
317{
318 return (is_multicast && is_mgt) ? 0 : mac->bssinfo.short_preamble;
319}
320
321/* Helper function which advises you whether protection (e.g. self-CTS) is
322 * needed. 1 = protection needed, 0 = no protection needed
323 * Only use this function when transmitting with OFDM modulation. */
324static inline int ieee80211softmac_protection_needed(struct ieee80211softmac_device *mac)
325{
326 return mac->bssinfo.use_protection;
327}
328
329/* Start the SoftMAC. Call this after you initialized the device
330 * and it is ready to run.
331 */
332extern void ieee80211softmac_start(struct net_device *dev);
333/* Stop the SoftMAC. Call this before you shutdown the device. */
334extern void ieee80211softmac_stop(struct net_device *dev);
335
336/*
337 * Event system
338 */
339
340/* valid event types */
341#define IEEE80211SOFTMAC_EVENT_ANY -1 /*private use only*/
342#define IEEE80211SOFTMAC_EVENT_SCAN_FINISHED 0
343#define IEEE80211SOFTMAC_EVENT_ASSOCIATED 1
344#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_FAILED 2
345#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_TIMEOUT 3
346#define IEEE80211SOFTMAC_EVENT_AUTHENTICATED 4
347#define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5
348#define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6
349#define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7
350#define IEEE80211SOFTMAC_EVENT_DISASSOCIATED 8
351/* keep this updated! */
352#define IEEE80211SOFTMAC_EVENT_LAST 8
353/*
354 * If you want to be notified of certain events, you can call
355 * ieee80211softmac_notify[_atomic] with
356 * - event set to one of the constants below
357 * - fun set to a function pointer of the appropriate type
358 * - context set to the context data you want passed
359 * The return value is 0, or an error.
360 */
361typedef void (*notify_function_ptr)(struct net_device *dev, int event_type, void *context);
362
363#define ieee80211softmac_notify(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_KERNEL);
364#define ieee80211softmac_notify_atomic(dev, event, fun, context) ieee80211softmac_notify_gfp(dev, event, fun, context, GFP_ATOMIC);
365
366extern int ieee80211softmac_notify_gfp(struct net_device *dev,
367 int event, notify_function_ptr fun, void *context, gfp_t gfp_mask);
368
369/* To clear pending work (for ifconfig down, etc.) */
370extern void
371ieee80211softmac_clear_pending_work(struct ieee80211softmac_device *sm);
372
373#endif /* IEEE80211SOFTMAC_H_ */
diff --git a/include/net/ieee80211softmac_wx.h b/include/net/ieee80211softmac_wx.h
deleted file mode 100644
index 4ee3ad57283f..000000000000
--- a/include/net/ieee80211softmac_wx.h
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * This file contains the prototypes for the wireless extension
3 * handlers that the softmac API provides. Include this file to
4 * use the wx handlers, you can assign these directly.
5 *
6 * Copyright (c) 2005 Johannes Berg <johannes@sipsolutions.net>
7 * Joseph Jezak <josejx@gentoo.org>
8 * Larry Finger <Larry.Finger@lwfinger.net>
9 * Danny van Dyk <kugelfang@gentoo.org>
10 * Michael Buesch <mbuesch@freenet.de>
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of version 2 of the GNU General Public License as
14 * published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT
17 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 *
25 * The full GNU General Public License is included in this distribution in the
26 * file called COPYING.
27 */
28
29#ifndef _IEEE80211SOFTMAC_WX_H
30#define _IEEE80211SOFTMAC_WX_H
31
32#include <net/ieee80211softmac.h>
33#include <net/iw_handler.h>
34
35extern int
36ieee80211softmac_wx_trigger_scan(struct net_device *net_dev,
37 struct iw_request_info *info,
38 union iwreq_data *data,
39 char *extra);
40
41extern int
42ieee80211softmac_wx_get_scan_results(struct net_device *net_dev,
43 struct iw_request_info *info,
44 union iwreq_data *data,
45 char *extra);
46
47extern int
48ieee80211softmac_wx_set_essid(struct net_device *net_dev,
49 struct iw_request_info *info,
50 union iwreq_data *data,
51 char *extra);
52
53extern int
54ieee80211softmac_wx_get_essid(struct net_device *net_dev,
55 struct iw_request_info *info,
56 union iwreq_data *data,
57 char *extra);
58
59extern int
60ieee80211softmac_wx_set_rate(struct net_device *net_dev,
61 struct iw_request_info *info,
62 union iwreq_data *data,
63 char *extra);
64
65extern int
66ieee80211softmac_wx_get_rate(struct net_device *net_dev,
67 struct iw_request_info *info,
68 union iwreq_data *data,
69 char *extra);
70
71extern int
72ieee80211softmac_wx_get_wap(struct net_device *net_dev,
73 struct iw_request_info *info,
74 union iwreq_data *data,
75 char *extra);
76
77extern int
78ieee80211softmac_wx_set_wap(struct net_device *net_dev,
79 struct iw_request_info *info,
80 union iwreq_data *data,
81 char *extra);
82
83extern int
84ieee80211softmac_wx_set_genie(struct net_device *dev,
85 struct iw_request_info *info,
86 union iwreq_data *wrqu,
87 char *extra);
88
89extern int
90ieee80211softmac_wx_get_genie(struct net_device *dev,
91 struct iw_request_info *info,
92 union iwreq_data *wrqu,
93 char *extra);
94extern int
95ieee80211softmac_wx_set_mlme(struct net_device *dev,
96 struct iw_request_info *info,
97 union iwreq_data *wrqu,
98 char *extra);
99#endif /* _IEEE80211SOFTMAC_WX */
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 38d5a1e9980d..18c773286b91 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -39,6 +39,17 @@ extern int inet_getname(struct socket *sock,
39extern int inet_ioctl(struct socket *sock, 39extern int inet_ioctl(struct socket *sock,
40 unsigned int cmd, unsigned long arg); 40 unsigned int cmd, unsigned long arg);
41 41
42extern int inet_ctl_sock_create(struct sock **sk,
43 unsigned short family,
44 unsigned short type,
45 unsigned char protocol,
46 struct net *net);
47
48static inline void inet_ctl_sock_destroy(struct sock *sk)
49{
50 sk_release_kernel(sk);
51}
52
42#endif 53#endif
43 54
44 55
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index f00f0573627b..2ff545a56fb5 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -327,11 +327,6 @@ extern void inet_csk_listen_stop(struct sock *sk);
327 327
328extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 328extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
329 329
330extern int inet_csk_ctl_sock_create(struct socket **sock,
331 unsigned short family,
332 unsigned short type,
333 unsigned char protocol);
334
335extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, 330extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
336 char __user *optval, int __user *optlen); 331 char __user *optval, int __user *optlen);
337extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, 332extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index 7374251b9787..e081eefd6f47 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -25,9 +25,9 @@ struct inet_frag_queue {
25 int meat; 25 int meat;
26 __u8 last_in; /* first/last segment arrived? */ 26 __u8 last_in; /* first/last segment arrived? */
27 27
28#define COMPLETE 4 28#define INET_FRAG_COMPLETE 4
29#define FIRST_IN 2 29#define INET_FRAG_FIRST_IN 2
30#define LAST_IN 1 30#define INET_FRAG_LAST_IN 1
31}; 31};
32 32
33#define INETFRAGS_HASHSZ 64 33#define INETFRAGS_HASHSZ 64
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 97dc35ad09be..735b926a3497 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -221,26 +221,7 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk)
221} 221}
222 222
223/* Caller must disable local BH processing. */ 223/* Caller must disable local BH processing. */
224static inline void __inet_inherit_port(struct sock *sk, struct sock *child) 224extern void __inet_inherit_port(struct sock *sk, struct sock *child);
225{
226 struct inet_hashinfo *table = sk->sk_prot->hashinfo;
227 const int bhash = inet_bhashfn(inet_sk(child)->num, table->bhash_size);
228 struct inet_bind_hashbucket *head = &table->bhash[bhash];
229 struct inet_bind_bucket *tb;
230
231 spin_lock(&head->lock);
232 tb = inet_csk(sk)->icsk_bind_hash;
233 sk_add_bind_node(child, &tb->owners);
234 inet_csk(child)->icsk_bind_hash = tb;
235 spin_unlock(&head->lock);
236}
237
238static inline void inet_inherit_port(struct sock *sk, struct sock *child)
239{
240 local_bh_disable();
241 __inet_inherit_port(sk, child);
242 local_bh_enable();
243}
244 225
245extern void inet_put_port(struct sock *sk); 226extern void inet_put_port(struct sock *sk);
246 227
@@ -314,25 +295,25 @@ typedef __u64 __bitwise __addrpair;
314 ((__force __u64)(__be32)(__saddr))); 295 ((__force __u64)(__be32)(__saddr)));
315#endif /* __BIG_ENDIAN */ 296#endif /* __BIG_ENDIAN */
316#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 297#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
317 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ 298 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
318 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \ 299 ((*((__addrpair *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
319 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 300 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
320 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 301 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
321#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\ 302#define INET_TW_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif)\
322 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ 303 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
323 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \ 304 ((*((__addrpair *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
324 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 305 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
325 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 306 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
326#else /* 32-bit arch */ 307#else /* 32-bit arch */
327#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 308#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
328#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \ 309#define INET_MATCH(__sk, __net, __hash, __cookie, __saddr, __daddr, __ports, __dif) \
329 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ 310 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
330 (inet_sk(__sk)->daddr == (__saddr)) && \ 311 (inet_sk(__sk)->daddr == (__saddr)) && \
331 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \ 312 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
332 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \ 313 ((*((__portpair *)&(inet_sk(__sk)->dport))) == (__ports)) && \
333 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif)))) 314 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
334#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \ 315#define INET_TW_MATCH(__sk, __net, __hash,__cookie, __saddr, __daddr, __ports, __dif) \
335 (((__sk)->sk_hash == (__hash)) && ((__sk)->sk_net == (__net)) && \ 316 (((__sk)->sk_hash == (__hash)) && sock_net((__sk)) == (__net) && \
336 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \ 317 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
337 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \ 318 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
338 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \ 319 ((*((__portpair *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index 89cd011edb99..a42cd63d241a 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -43,8 +43,7 @@ struct ip_options {
43 unsigned char srr; 43 unsigned char srr;
44 unsigned char rr; 44 unsigned char rr;
45 unsigned char ts; 45 unsigned char ts;
46 unsigned char is_data:1, 46 unsigned char is_strictroute:1,
47 is_strictroute:1,
48 srr_is_hit:1, 47 srr_is_hit:1,
49 is_changed:1, 48 is_changed:1,
50 rr_needaddr:1, 49 rr_needaddr:1,
@@ -137,7 +136,7 @@ struct inet_sock {
137 unsigned int flags; 136 unsigned int flags;
138 unsigned int fragsize; 137 unsigned int fragsize;
139 struct ip_options *opt; 138 struct ip_options *opt;
140 struct rtable *rt; 139 struct dst_entry *dst;
141 int length; /* Total length of all frames */ 140 int length; /* Total length of all frames */
142 __be32 addr; 141 __be32 addr;
143 struct flowi fl; 142 struct flowi fl;
@@ -195,7 +194,7 @@ static inline int inet_sk_ehashfn(const struct sock *sk)
195 194
196static inline int inet_iif(const struct sk_buff *skb) 195static inline int inet_iif(const struct sk_buff *skb)
197{ 196{
198 return ((struct rtable *)skb->dst)->rt_iif; 197 return skb->rtable->rt_iif;
199} 198}
200 199
201#endif /* _INET_SOCK_H */ 200#endif /* _INET_SOCK_H */
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index 296547bfb0b7..95c660c9719b 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -207,4 +207,22 @@ extern void inet_twsk_schedule(struct inet_timewait_sock *tw,
207 const int timeo, const int timewait_len); 207 const int timeo, const int timewait_len);
208extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, 208extern void inet_twsk_deschedule(struct inet_timewait_sock *tw,
209 struct inet_timewait_death_row *twdr); 209 struct inet_timewait_death_row *twdr);
210
211static inline
212struct net *twsk_net(const struct inet_timewait_sock *twsk)
213{
214#ifdef CONFIG_NET_NS
215 return twsk->tw_net;
216#else
217 return &init_net;
218#endif
219}
220
221static inline
222void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net)
223{
224#ifdef CONFIG_NET_NS
225 twsk->tw_net = net;
226#endif
227}
210#endif /* _INET_TIMEWAIT_SOCK_ */ 228#endif /* _INET_TIMEWAIT_SOCK_ */
diff --git a/include/net/ip.h b/include/net/ip.h
index 9f50d4f1f157..6d7bcd5e62d4 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -347,10 +347,11 @@ extern int ip_forward(struct sk_buff *skb);
347extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag); 347extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag);
348extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); 348extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
349extern void ip_options_fragment(struct sk_buff *skb); 349extern void ip_options_fragment(struct sk_buff *skb);
350extern int ip_options_compile(struct ip_options *opt, struct sk_buff *skb); 350extern int ip_options_compile(struct net *net,
351extern int ip_options_get(struct ip_options **optp, 351 struct ip_options *opt, struct sk_buff *skb);
352extern int ip_options_get(struct net *net, struct ip_options **optp,
352 unsigned char *data, int optlen); 353 unsigned char *data, int optlen);
353extern int ip_options_get_from_user(struct ip_options **optp, 354extern int ip_options_get_from_user(struct net *net, struct ip_options **optp,
354 unsigned char __user *data, int optlen); 355 unsigned char __user *data, int optlen);
355extern void ip_options_undo(struct ip_options * opt); 356extern void ip_options_undo(struct ip_options * opt);
356extern void ip_forward_options(struct sk_buff *skb); 357extern void ip_forward_options(struct sk_buff *skb);
@@ -361,7 +362,8 @@ extern int ip_options_rcv_srr(struct sk_buff *skb);
361 */ 362 */
362 363
363extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 364extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
364extern int ip_cmsg_send(struct msghdr *msg, struct ipcm_cookie *ipc); 365extern int ip_cmsg_send(struct net *net,
366 struct msghdr *msg, struct ipcm_cookie *ipc);
365extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen); 367extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen);
366extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); 368extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen);
367extern int compat_ip_setsockopt(struct sock *sk, int level, 369extern int compat_ip_setsockopt(struct sock *sk, int level,
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 953d6040ff50..7c5c0f79168a 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -174,17 +174,19 @@ struct fib6_table {
174#define RT6_TABLE_LOCAL RT6_TABLE_MAIN 174#define RT6_TABLE_LOCAL RT6_TABLE_MAIN
175#endif 175#endif
176 176
177typedef struct rt6_info *(*pol_lookup_t)(struct fib6_table *, 177typedef struct rt6_info *(*pol_lookup_t)(struct net *,
178 struct fib6_table *,
178 struct flowi *, int); 179 struct flowi *, int);
179 180
180/* 181/*
181 * exported functions 182 * exported functions
182 */ 183 */
183 184
184extern struct fib6_table * fib6_get_table(u32 id); 185extern struct fib6_table *fib6_get_table(struct net *net, u32 id);
185extern struct fib6_table * fib6_new_table(u32 id); 186extern struct fib6_table *fib6_new_table(struct net *net, u32 id);
186extern struct dst_entry * fib6_rule_lookup(struct flowi *fl, int flags, 187extern struct dst_entry *fib6_rule_lookup(struct net *net,
187 pol_lookup_t lookup); 188 struct flowi *fl, int flags,
189 pol_lookup_t lookup);
188 190
189extern struct fib6_node *fib6_lookup(struct fib6_node *root, 191extern struct fib6_node *fib6_lookup(struct fib6_node *root,
190 struct in6_addr *daddr, 192 struct in6_addr *daddr,
@@ -194,7 +196,8 @@ struct fib6_node *fib6_locate(struct fib6_node *root,
194 struct in6_addr *daddr, int dst_len, 196 struct in6_addr *daddr, int dst_len,
195 struct in6_addr *saddr, int src_len); 197 struct in6_addr *saddr, int src_len);
196 198
197extern void fib6_clean_all(int (*func)(struct rt6_info *, void *arg), 199extern void fib6_clean_all(struct net *net,
200 int (*func)(struct rt6_info *, void *arg),
198 int prune, void *arg); 201 int prune, void *arg);
199 202
200extern int fib6_add(struct fib6_node *root, 203extern int fib6_add(struct fib6_node *root,
@@ -207,7 +210,8 @@ extern int fib6_del(struct rt6_info *rt,
207extern void inet6_rt_notify(int event, struct rt6_info *rt, 210extern void inet6_rt_notify(int event, struct rt6_info *rt,
208 struct nl_info *info); 211 struct nl_info *info);
209 212
210extern void fib6_run_gc(unsigned long dummy); 213extern void fib6_run_gc(unsigned long expires,
214 struct net *net);
211 215
212extern void fib6_gc_cleanup(void); 216extern void fib6_gc_cleanup(void);
213 217
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index f99e4f0f568f..9313491e3dad 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -30,60 +30,54 @@ struct route_info {
30#include <linux/ip.h> 30#include <linux/ip.h>
31#include <linux/ipv6.h> 31#include <linux/ipv6.h>
32 32
33#define RT6_LOOKUP_F_IFACE 0x1 33#define RT6_LOOKUP_F_IFACE 0x00000001
34#define RT6_LOOKUP_F_REACHABLE 0x2 34#define RT6_LOOKUP_F_REACHABLE 0x00000002
35#define RT6_LOOKUP_F_HAS_SADDR 0x4 35#define RT6_LOOKUP_F_HAS_SADDR 0x00000004
36#define RT6_LOOKUP_F_SRCPREF_TMP 0x00000008
37#define RT6_LOOKUP_F_SRCPREF_PUBLIC 0x00000010
38#define RT6_LOOKUP_F_SRCPREF_COA 0x00000020
36 39
37extern struct rt6_info ip6_null_entry;
38 40
39#ifdef CONFIG_IPV6_MULTIPLE_TABLES 41#ifdef CONFIG_IPV6_MULTIPLE_TABLES
40extern struct rt6_info ip6_prohibit_entry; 42extern struct rt6_info *ip6_prohibit_entry;
41extern struct rt6_info ip6_blk_hole_entry; 43extern struct rt6_info *ip6_blk_hole_entry;
42#endif 44#endif
43 45
44extern void ip6_route_input(struct sk_buff *skb); 46extern void ip6_route_input(struct sk_buff *skb);
45 47
46extern struct dst_entry * ip6_route_output(struct sock *sk, 48extern struct dst_entry * ip6_route_output(struct net *net,
49 struct sock *sk,
47 struct flowi *fl); 50 struct flowi *fl);
48 51
49extern int ip6_route_init(void); 52extern int ip6_route_init(void);
50extern void ip6_route_cleanup(void); 53extern void ip6_route_cleanup(void);
51 54
52extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); 55extern int ipv6_route_ioctl(struct net *net,
56 unsigned int cmd,
57 void __user *arg);
53 58
54extern int ip6_route_add(struct fib6_config *cfg); 59extern int ip6_route_add(struct fib6_config *cfg);
55extern int ip6_ins_rt(struct rt6_info *); 60extern int ip6_ins_rt(struct rt6_info *);
56extern int ip6_del_rt(struct rt6_info *); 61extern int ip6_del_rt(struct rt6_info *);
57 62
58extern int ip6_rt_addr_add(struct in6_addr *addr, 63extern struct rt6_info *rt6_lookup(struct net *net,
59 struct net_device *dev, 64 const struct in6_addr *daddr,
60 int anycast); 65 const struct in6_addr *saddr,
61
62extern int ip6_rt_addr_del(struct in6_addr *addr,
63 struct net_device *dev);
64
65extern void rt6_sndmsg(int type, struct in6_addr *dst,
66 struct in6_addr *src,
67 struct in6_addr *gw,
68 struct net_device *dev,
69 int dstlen, int srclen,
70 int metric, __u32 flags);
71
72extern struct rt6_info *rt6_lookup(struct in6_addr *daddr,
73 struct in6_addr *saddr,
74 int oif, int flags); 66 int oif, int flags);
75 67
76extern struct dst_entry *ndisc_dst_alloc(struct net_device *dev, 68extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
77 struct neighbour *neigh, 69 struct neighbour *neigh,
78 struct in6_addr *addr, 70 const struct in6_addr *addr);
79 int (*output)(struct sk_buff *)); 71extern int icmp6_dst_gc(int *more);
80extern int ndisc_dst_gc(int *more); 72
81extern void fib6_force_start_gc(void); 73extern void fib6_force_start_gc(struct net *net);
82 74
83extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, 75extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
84 const struct in6_addr *addr, 76 const struct in6_addr *addr,
85 int anycast); 77 int anycast);
86 78
79extern int ip6_dst_hoplimit(struct dst_entry *dst);
80
87/* 81/*
88 * support functions for ND 82 * support functions for ND
89 * 83 *
@@ -94,7 +88,7 @@ extern struct rt6_info * rt6_add_dflt_router(struct in6_addr *gwaddr,
94 struct net_device *dev, 88 struct net_device *dev,
95 unsigned int pref); 89 unsigned int pref);
96 90
97extern void rt6_purge_dflt_routers(void); 91extern void rt6_purge_dflt_routers(struct net *net);
98 92
99extern int rt6_route_rcv(struct net_device *dev, 93extern int rt6_route_rcv(struct net_device *dev,
100 u8 *opt, int len, 94 u8 *opt, int len,
@@ -121,7 +115,7 @@ struct rt6_rtnl_dump_arg
121}; 115};
122 116
123extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); 117extern int rt6_dump_route(struct rt6_info *rt, void *p_arg);
124extern void rt6_ifdown(struct net_device *dev); 118extern void rt6_ifdown(struct net *net, struct net_device *dev);
125extern void rt6_mtu_change(struct net_device *dev, unsigned mtu); 119extern void rt6_mtu_change(struct net_device *dev, unsigned mtu);
126 120
127extern rwlock_t rt6_lock; 121extern rwlock_t rt6_lock;
diff --git a/include/net/ipip.h b/include/net/ipip.h
index 549e132bca9c..633ed4def8e3 100644
--- a/include/net/ipip.h
+++ b/include/net/ipip.h
@@ -24,6 +24,16 @@ struct ip_tunnel
24 int mlink; 24 int mlink;
25 25
26 struct ip_tunnel_parm parms; 26 struct ip_tunnel_parm parms;
27
28 struct ip_tunnel_prl_entry *prl; /* potential router list */
29 unsigned int prl_count; /* # of entries in PRL */
30};
31
32struct ip_tunnel_prl_entry
33{
34 struct ip_tunnel_prl_entry *next;
35 __be32 addr;
36 u16 flags;
27}; 37};
28 38
29#define IPTUNNEL_XMIT() do { \ 39#define IPTUNNEL_XMIT() do { \
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index c0c019f72ba9..49c48983019f 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -202,6 +202,7 @@ struct ip6_flowlabel
202 u32 owner; 202 u32 owner;
203 unsigned long lastuse; 203 unsigned long lastuse;
204 unsigned long expires; 204 unsigned long expires;
205 struct net *fl_net;
205}; 206};
206 207
207#define IPV6_FLOWINFO_MASK __constant_htonl(0x0FFFFFFF) 208#define IPV6_FLOWINFO_MASK __constant_htonl(0x0FFFFFFF)
@@ -249,15 +250,6 @@ int ip6_frag_mem(struct net *net);
249 250
250#define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ 251#define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */
251 252
252/*
253 * Function prototype for build_xmit
254 */
255
256typedef int (*inet_getfrag_t) (const void *data,
257 struct in6_addr *addr,
258 char *,
259 unsigned int, unsigned int);
260
261extern int __ipv6_addr_type(const struct in6_addr *addr); 253extern int __ipv6_addr_type(const struct in6_addr *addr);
262static inline int ipv6_addr_type(const struct in6_addr *addr) 254static inline int ipv6_addr_type(const struct in6_addr *addr)
263{ 255{
@@ -288,12 +280,10 @@ static inline int
288ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m, 280ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m,
289 const struct in6_addr *a2) 281 const struct in6_addr *a2)
290{ 282{
291 unsigned int i; 283 return (!!(((a1->s6_addr32[0] ^ a2->s6_addr32[0]) & m->s6_addr32[0]) |
292 284 ((a1->s6_addr32[1] ^ a2->s6_addr32[1]) & m->s6_addr32[1]) |
293 for (i = 0; i < 4; i++) 285 ((a1->s6_addr32[2] ^ a2->s6_addr32[2]) & m->s6_addr32[2]) |
294 if ((a1->s6_addr32[i] ^ a2->s6_addr32[i]) & m->s6_addr32[i]) 286 ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3])));
295 return 1;
296 return 0;
297} 287}
298 288
299static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2) 289static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2)
@@ -328,10 +318,10 @@ static inline void ipv6_addr_set(struct in6_addr *addr,
328static inline int ipv6_addr_equal(const struct in6_addr *a1, 318static inline int ipv6_addr_equal(const struct in6_addr *a1,
329 const struct in6_addr *a2) 319 const struct in6_addr *a2)
330{ 320{
331 return (a1->s6_addr32[0] == a2->s6_addr32[0] && 321 return (((a1->s6_addr32[0] ^ a2->s6_addr32[0]) |
332 a1->s6_addr32[1] == a2->s6_addr32[1] && 322 (a1->s6_addr32[1] ^ a2->s6_addr32[1]) |
333 a1->s6_addr32[2] == a2->s6_addr32[2] && 323 (a1->s6_addr32[2] ^ a2->s6_addr32[2]) |
334 a1->s6_addr32[3] == a2->s6_addr32[3]); 324 (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0);
335} 325}
336 326
337static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, 327static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2,
@@ -379,8 +369,18 @@ static inline int ipv6_addr_any(const struct in6_addr *a)
379 369
380static inline int ipv6_addr_v4mapped(const struct in6_addr *a) 370static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
381{ 371{
382 return ((a->s6_addr32[0] | a->s6_addr32[1]) == 0 && 372 return ((a->s6_addr32[0] | a->s6_addr32[1] |
383 a->s6_addr32[2] == htonl(0x0000ffff)); 373 (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0);
374}
375
376/*
377 * Check for a RFC 4843 ORCHID address
378 * (Overlay Routable Cryptographic Hash Identifiers)
379 */
380static inline int ipv6_addr_orchid(const struct in6_addr *a)
381{
382 return ((a->s6_addr32[0] & htonl(0xfffffff0))
383 == htonl(0x20010010));
384} 384}
385 385
386/* 386/*
@@ -451,8 +451,8 @@ extern int ip6_xmit(struct sock *sk,
451extern int ip6_nd_hdr(struct sock *sk, 451extern int ip6_nd_hdr(struct sock *sk,
452 struct sk_buff *skb, 452 struct sk_buff *skb,
453 struct net_device *dev, 453 struct net_device *dev,
454 struct in6_addr *saddr, 454 const struct in6_addr *saddr,
455 struct in6_addr *daddr, 455 const struct in6_addr *daddr,
456 int proto, int len); 456 int proto, int len);
457 457
458extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr); 458extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);
@@ -499,14 +499,6 @@ extern int ip6_local_out(struct sk_buff *skb);
499 * Extension header (options) processing 499 * Extension header (options) processing
500 */ 500 */
501 501
502extern u8 * ipv6_build_nfrag_opts(struct sk_buff *skb,
503 u8 *prev_hdr,
504 struct ipv6_txoptions *opt,
505 struct in6_addr *daddr,
506 u32 jumbolen);
507extern u8 * ipv6_build_frag_opts(struct sk_buff *skb,
508 u8 *prev_hdr,
509 struct ipv6_txoptions *opt);
510extern void ipv6_push_nfrag_opts(struct sk_buff *skb, 502extern void ipv6_push_nfrag_opts(struct sk_buff *skb,
511 struct ipv6_txoptions *opt, 503 struct ipv6_txoptions *opt,
512 u8 *proto, 504 u8 *proto,
@@ -545,10 +537,6 @@ extern int compat_ipv6_getsockopt(struct sock *sk,
545 char __user *optval, 537 char __user *optval,
546 int __user *optlen); 538 int __user *optlen);
547 539
548extern int ipv6_packet_init(void);
549
550extern void ipv6_packet_cleanup(void);
551
552extern int ip6_datagram_connect(struct sock *sk, 540extern int ip6_datagram_connect(struct sock *sk,
553 struct sockaddr *addr, int addr_len); 541 struct sockaddr *addr, int addr_len);
554 542
@@ -585,14 +573,14 @@ extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
585 int __user *optlen); 573 int __user *optlen);
586 574
587#ifdef CONFIG_PROC_FS 575#ifdef CONFIG_PROC_FS
588extern int ac6_proc_init(void); 576extern int ac6_proc_init(struct net *net);
589extern void ac6_proc_exit(void); 577extern void ac6_proc_exit(struct net *net);
590extern int raw6_proc_init(void); 578extern int raw6_proc_init(void);
591extern void raw6_proc_exit(void); 579extern void raw6_proc_exit(void);
592extern int tcp6_proc_init(void); 580extern int tcp6_proc_init(struct net *net);
593extern void tcp6_proc_exit(void); 581extern void tcp6_proc_exit(struct net *net);
594extern int udp6_proc_init(void); 582extern int udp6_proc_init(struct net *net);
595extern void udp6_proc_exit(void); 583extern void udp6_proc_exit(struct net *net);
596extern int udplite6_proc_init(void); 584extern int udplite6_proc_init(void);
597extern void udplite6_proc_exit(void); 585extern void udplite6_proc_exit(void);
598extern int ipv6_misc_proc_init(void); 586extern int ipv6_misc_proc_init(void);
@@ -600,17 +588,11 @@ extern void ipv6_misc_proc_exit(void);
600extern int snmp6_register_dev(struct inet6_dev *idev); 588extern int snmp6_register_dev(struct inet6_dev *idev);
601extern int snmp6_unregister_dev(struct inet6_dev *idev); 589extern int snmp6_unregister_dev(struct inet6_dev *idev);
602 590
603extern struct rt6_statistics rt6_stats;
604#else 591#else
605static inline int snmp6_register_dev(struct inet6_dev *idev) 592static inline int ac6_proc_init(struct net *net) { return 0; }
606{ 593static inline void ac6_proc_exit(struct net *net) { }
607 return 0; 594static inline int snmp6_register_dev(struct inet6_dev *idev) { return 0; }
608} 595static inline int snmp6_unregister_dev(struct inet6_dev *idev) { return 0; }
609
610static inline int snmp6_unregister_dev(struct inet6_dev *idev)
611{
612 return 0;
613}
614#endif 596#endif
615 597
616#ifdef CONFIG_SYSCTL 598#ifdef CONFIG_SYSCTL
diff --git a/include/net/irda/irlan_eth.h b/include/net/irda/irlan_eth.h
index 0062347600b9..de5c81691f33 100644
--- a/include/net/irda/irlan_eth.h
+++ b/include/net/irda/irlan_eth.h
@@ -29,5 +29,4 @@ struct net_device *alloc_irlandev(const char *name);
29int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb); 29int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb);
30 30
31void irlan_eth_flow_indication( void *instance, void *sap, LOCAL_FLOW flow); 31void irlan_eth_flow_indication( void *instance, void *sap, LOCAL_FLOW flow);
32void irlan_eth_send_gratuitous_arp(struct net_device *dev);
33#endif 32#endif
diff --git a/include/net/llc_if.h b/include/net/llc_if.h
index c608812a8e89..b595a004d31b 100644
--- a/include/net/llc_if.h
+++ b/include/net/llc_if.h
@@ -74,11 +74,6 @@ static inline int llc_mac_null(const u8 *mac)
74 return is_zero_ether_addr(mac); 74 return is_zero_ether_addr(mac);
75} 75}
76 76
77static inline int llc_addrany(const struct llc_addr *addr)
78{
79 return llc_mac_null(addr->mac) && !addr->lsap;
80}
81
82static inline int llc_mac_multicast(const u8 *mac) 77static inline int llc_mac_multicast(const u8 *mac)
83{ 78{
84 return is_multicast_ether_addr(mac); 79 return is_multicast_ether_addr(mac);
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 9083bafb63ca..4a80d74975e8 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -38,7 +38,11 @@
38 * called in hardware interrupt context. The low-level driver must not call any 38 * called in hardware interrupt context. The low-level driver must not call any
39 * other functions in hardware interrupt context. If there is a need for such 39 * other functions in hardware interrupt context. If there is a need for such
40 * call, the low-level driver should first ACK the interrupt and perform the 40 * call, the low-level driver should first ACK the interrupt and perform the
41 * IEEE 802.11 code call after this, e.g. from a scheduled workqueue function. 41 * IEEE 802.11 code call after this, e.g. from a scheduled workqueue or even
42 * tasklet function.
43 *
44 * NOTE: If the driver opts to use the _irqsafe() functions, it may not also
45 * use the non-irqsafe functions!
42 */ 46 */
43 47
44/** 48/**
@@ -69,93 +73,12 @@
69 * not do so then mac80211 may add this under certain circumstances. 73 * not do so then mac80211 may add this under certain circumstances.
70 */ 74 */
71 75
72#define IEEE80211_CHAN_W_SCAN 0x00000001
73#define IEEE80211_CHAN_W_ACTIVE_SCAN 0x00000002
74#define IEEE80211_CHAN_W_IBSS 0x00000004
75
76/* Channel information structure. Low-level driver is expected to fill in chan,
77 * freq, and val fields. Other fields will be filled in by 80211.o based on
78 * hostapd information and low-level driver does not need to use them. The
79 * limits for each channel will be provided in 'struct ieee80211_conf' when
80 * configuring the low-level driver with hw->config callback. If a device has
81 * a default regulatory domain, IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED
82 * can be set to let the driver configure all fields */
83struct ieee80211_channel {
84 short chan; /* channel number (IEEE 802.11) */
85 short freq; /* frequency in MHz */
86 int val; /* hw specific value for the channel */
87 int flag; /* flag for hostapd use (IEEE80211_CHAN_*) */
88 unsigned char power_level;
89 unsigned char antenna_max;
90};
91
92#define IEEE80211_RATE_ERP 0x00000001
93#define IEEE80211_RATE_BASIC 0x00000002
94#define IEEE80211_RATE_PREAMBLE2 0x00000004
95#define IEEE80211_RATE_SUPPORTED 0x00000010
96#define IEEE80211_RATE_OFDM 0x00000020
97#define IEEE80211_RATE_CCK 0x00000040
98#define IEEE80211_RATE_MANDATORY 0x00000100
99
100#define IEEE80211_RATE_CCK_2 (IEEE80211_RATE_CCK | IEEE80211_RATE_PREAMBLE2)
101#define IEEE80211_RATE_MODULATION(f) \
102 (f & (IEEE80211_RATE_CCK | IEEE80211_RATE_OFDM))
103
104/* Low-level driver should set PREAMBLE2, OFDM and CCK flags.
105 * BASIC, SUPPORTED, ERP, and MANDATORY flags are set in 80211.o based on the
106 * configuration. */
107struct ieee80211_rate {
108 int rate; /* rate in 100 kbps */
109 int val; /* hw specific value for the rate */
110 int flags; /* IEEE80211_RATE_ flags */
111 int val2; /* hw specific value for the rate when using short preamble
112 * (only when IEEE80211_RATE_PREAMBLE2 flag is set, i.e., for
113 * 2, 5.5, and 11 Mbps) */
114 signed char min_rssi_ack;
115 unsigned char min_rssi_ack_delta;
116
117 /* following fields are set by 80211.o and need not be filled by the
118 * low-level driver */
119 int rate_inv; /* inverse of the rate (LCM(all rates) / rate) for
120 * optimizing channel utilization estimates */
121};
122
123/** 76/**
124 * enum ieee80211_phymode - PHY modes 77 * enum ieee80211_notification_type - Low level driver notification
125 * 78 * @IEEE80211_NOTIFY_RE_ASSOC: start the re-association sequence
126 * @MODE_IEEE80211A: 5GHz as defined by 802.11a/802.11h
127 * @MODE_IEEE80211B: 2.4 GHz as defined by 802.11b
128 * @MODE_IEEE80211G: 2.4 GHz as defined by 802.11g (with OFDM),
129 * backwards compatible with 11b mode
130 * @NUM_IEEE80211_MODES: internal
131 */ 79 */
132enum ieee80211_phymode { 80enum ieee80211_notification_types {
133 MODE_IEEE80211A, 81 IEEE80211_NOTIFY_RE_ASSOC,
134 MODE_IEEE80211B,
135 MODE_IEEE80211G,
136
137 /* keep last */
138 NUM_IEEE80211_MODES
139};
140
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 */
153struct 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}; 82};
160 83
161/** 84/**
@@ -175,46 +98,22 @@ struct ieee80211_ht_bss_info {
175}; 98};
176 99
177/** 100/**
178 * struct ieee80211_hw_mode - PHY mode definition
179 *
180 * This structure describes the capabilities supported by the device
181 * in a single PHY mode.
182 *
183 * @list: internal
184 * @channels: pointer to array of supported channels
185 * @rates: pointer to array of supported bitrates
186 * @mode: the PHY mode for this definition
187 * @num_channels: number of supported channels
188 * @num_rates: number of supported bitrates
189 * @ht_info: PHY's 802.11n HT abilities for this mode
190 */
191struct ieee80211_hw_mode {
192 struct list_head list;
193 struct ieee80211_channel *channels;
194 struct ieee80211_rate *rates;
195 enum ieee80211_phymode mode;
196 int num_channels;
197 int num_rates;
198 struct ieee80211_ht_info ht_info;
199};
200
201/**
202 * struct ieee80211_tx_queue_params - transmit queue configuration 101 * struct ieee80211_tx_queue_params - transmit queue configuration
203 * 102 *
204 * The information provided in this structure is required for QoS 103 * The information provided in this structure is required for QoS
205 * transmit queue configuration. 104 * transmit queue configuration. Cf. IEEE 802.11 7.3.2.29.
206 * 105 *
207 * @aifs: arbitration interface space [0..255, -1: use default] 106 * @aifs: arbitration interface space [0..255, -1: use default]
208 * @cw_min: minimum contention window [will be a value of the form 107 * @cw_min: minimum contention window [will be a value of the form
209 * 2^n-1 in the range 1..1023; 0: use default] 108 * 2^n-1 in the range 1..1023; 0: use default]
210 * @cw_max: maximum contention window [like @cw_min] 109 * @cw_max: maximum contention window [like @cw_min]
211 * @burst_time: maximum burst time in units of 0.1ms, 0 meaning disabled 110 * @txop: maximum burst time in units of 32 usecs, 0 meaning disabled
212 */ 111 */
213struct ieee80211_tx_queue_params { 112struct ieee80211_tx_queue_params {
214 int aifs; 113 s16 aifs;
215 int cw_min; 114 u16 cw_min;
216 int cw_max; 115 u16 cw_max;
217 int burst_time; 116 u16 txop;
218}; 117};
219 118
220/** 119/**
@@ -246,6 +145,7 @@ struct ieee80211_tx_queue_stats_data {
246 * @IEEE80211_TX_QUEUE_AFTER_BEACON: transmit queue for frames to be 145 * @IEEE80211_TX_QUEUE_AFTER_BEACON: transmit queue for frames to be
247 * sent after a beacon 146 * sent after a beacon
248 * @IEEE80211_TX_QUEUE_BEACON: transmit queue for beacon frames 147 * @IEEE80211_TX_QUEUE_BEACON: transmit queue for beacon frames
148 * @NUM_TX_DATA_QUEUES_AMPDU: adding more queues for A-MPDU
249 */ 149 */
250enum ieee80211_tx_queue { 150enum ieee80211_tx_queue {
251 IEEE80211_TX_QUEUE_DATA0, 151 IEEE80211_TX_QUEUE_DATA0,
@@ -261,11 +161,12 @@ enum ieee80211_tx_queue {
261 * this struct need to have fixed values. As soon as it is removed, we can 161 * this struct need to have fixed values. As soon as it is removed, we can
262 * fix these entries. */ 162 * fix these entries. */
263 IEEE80211_TX_QUEUE_AFTER_BEACON = 6, 163 IEEE80211_TX_QUEUE_AFTER_BEACON = 6,
264 IEEE80211_TX_QUEUE_BEACON = 7 164 IEEE80211_TX_QUEUE_BEACON = 7,
165 NUM_TX_DATA_QUEUES_AMPDU = 16
265}; 166};
266 167
267struct ieee80211_tx_queue_stats { 168struct ieee80211_tx_queue_stats {
268 struct ieee80211_tx_queue_stats_data data[NUM_TX_DATA_QUEUES]; 169 struct ieee80211_tx_queue_stats_data data[NUM_TX_DATA_QUEUES_AMPDU];
269}; 170};
270 171
271struct ieee80211_low_level_stats { 172struct ieee80211_low_level_stats {
@@ -285,11 +186,13 @@ struct ieee80211_low_level_stats {
285 * also implies a change in the AID. 186 * also implies a change in the AID.
286 * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed 187 * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed
287 * @BSS_CHANGED_ERP_PREAMBLE: preamble changed 188 * @BSS_CHANGED_ERP_PREAMBLE: preamble changed
189 * @BSS_CHANGED_HT: 802.11n parameters changed
288 */ 190 */
289enum ieee80211_bss_change { 191enum ieee80211_bss_change {
290 BSS_CHANGED_ASSOC = 1<<0, 192 BSS_CHANGED_ASSOC = 1<<0,
291 BSS_CHANGED_ERP_CTS_PROT = 1<<1, 193 BSS_CHANGED_ERP_CTS_PROT = 1<<1,
292 BSS_CHANGED_ERP_PREAMBLE = 1<<2, 194 BSS_CHANGED_ERP_PREAMBLE = 1<<2,
195 BSS_CHANGED_HT = 1<<4,
293}; 196};
294 197
295/** 198/**
@@ -302,6 +205,12 @@ enum ieee80211_bss_change {
302 * @aid: association ID number, valid only when @assoc is true 205 * @aid: association ID number, valid only when @assoc is true
303 * @use_cts_prot: use CTS protection 206 * @use_cts_prot: use CTS protection
304 * @use_short_preamble: use 802.11b short preamble 207 * @use_short_preamble: use 802.11b short preamble
208 * @timestamp: beacon timestamp
209 * @beacon_int: beacon interval
210 * @assoc_capability: capabbilities taken from assoc resp
211 * @assoc_ht: association in HT mode
212 * @ht_conf: ht capabilities
213 * @ht_bss_conf: ht extended capabilities
305 */ 214 */
306struct ieee80211_bss_conf { 215struct ieee80211_bss_conf {
307 /* association related data */ 216 /* association related data */
@@ -310,6 +219,69 @@ struct ieee80211_bss_conf {
310 /* erp related data */ 219 /* erp related data */
311 bool use_cts_prot; 220 bool use_cts_prot;
312 bool use_short_preamble; 221 bool use_short_preamble;
222 u16 beacon_int;
223 u16 assoc_capability;
224 u64 timestamp;
225 /* ht related data */
226 bool assoc_ht;
227 struct ieee80211_ht_info *ht_conf;
228 struct ieee80211_ht_bss_info *ht_bss_conf;
229};
230
231/**
232 * enum mac80211_tx_control_flags - flags to describe Tx configuration for
233 * the Tx frame
234 *
235 * These flags are used with the @flags member of &ieee80211_tx_control
236 *
237 * @IEEE80211_TXCTL_REQ_TX_STATUS: request TX status callback for this frame.
238 * @IEEE80211_TXCTL_DO_NOT_ENCRYPT: send this frame without encryption;
239 * e.g., for EAPOL frame
240 * @IEEE80211_TXCTL_USE_RTS_CTS: use RTS-CTS before sending frame
241 * @IEEE80211_TXCTL_USE_CTS_PROTECT: use CTS protection for the frame (e.g.,
242 * for combined 802.11g / 802.11b networks)
243 * @IEEE80211_TXCTL_NO_ACK: tell the low level not to wait for an ack
244 * @IEEE80211_TXCTL_RATE_CTRL_PROBE
245 * @EEE80211_TXCTL_CLEAR_PS_FILT: clear powersave filter
246 * for destination station
247 * @IEEE80211_TXCTL_REQUEUE:
248 * @IEEE80211_TXCTL_FIRST_FRAGMENT: this is a first fragment of the frame
249 * @IEEE80211_TXCTL_LONG_RETRY_LIMIT: this frame should be send using the
250 * through set_retry_limit configured long
251 * retry value
252 * @IEEE80211_TXCTL_EAPOL_FRAME: internal to mac80211
253 * @IEEE80211_TXCTL_SEND_AFTER_DTIM: send this frame after DTIM beacon
254 * @IEEE80211_TXCTL_AMPDU: this frame should be sent as part of an A-MPDU
255 * @IEEE80211_TXCTL_OFDM_HT: this frame can be sent in HT OFDM rates. number
256 * of streams when this flag is on can be extracted
257 * from antenna_sel_tx, so if 1 antenna is marked
258 * use SISO, 2 antennas marked use MIMO, n antennas
259 * marked use MIMO_n.
260 * @IEEE80211_TXCTL_GREEN_FIELD: use green field protection for this frame
261 * @IEEE80211_TXCTL_40_MHZ_WIDTH: send this frame using 40 Mhz channel width
262 * @IEEE80211_TXCTL_DUP_DATA: duplicate data frame on both 20 Mhz channels
263 * @IEEE80211_TXCTL_SHORT_GI: send this frame using short guard interval
264 */
265enum mac80211_tx_control_flags {
266 IEEE80211_TXCTL_REQ_TX_STATUS = (1<<0),
267 IEEE80211_TXCTL_DO_NOT_ENCRYPT = (1<<1),
268 IEEE80211_TXCTL_USE_RTS_CTS = (1<<2),
269 IEEE80211_TXCTL_USE_CTS_PROTECT = (1<<3),
270 IEEE80211_TXCTL_NO_ACK = (1<<4),
271 IEEE80211_TXCTL_RATE_CTRL_PROBE = (1<<5),
272 IEEE80211_TXCTL_CLEAR_PS_FILT = (1<<6),
273 IEEE80211_TXCTL_REQUEUE = (1<<7),
274 IEEE80211_TXCTL_FIRST_FRAGMENT = (1<<8),
275 IEEE80211_TXCTL_SHORT_PREAMBLE = (1<<9),
276 IEEE80211_TXCTL_LONG_RETRY_LIMIT = (1<<10),
277 IEEE80211_TXCTL_EAPOL_FRAME = (1<<11),
278 IEEE80211_TXCTL_SEND_AFTER_DTIM = (1<<12),
279 IEEE80211_TXCTL_AMPDU = (1<<13),
280 IEEE80211_TXCTL_OFDM_HT = (1<<14),
281 IEEE80211_TXCTL_GREEN_FIELD = (1<<15),
282 IEEE80211_TXCTL_40_MHZ_WIDTH = (1<<16),
283 IEEE80211_TXCTL_DUP_DATA = (1<<17),
284 IEEE80211_TXCTL_SHORT_GI = (1<<18),
313}; 285};
314 286
315/* Transmit control fields. This data structure is passed to low-level driver 287/* Transmit control fields. This data structure is passed to low-level driver
@@ -318,57 +290,27 @@ struct ieee80211_bss_conf {
318 290
319struct ieee80211_tx_control { 291struct ieee80211_tx_control {
320 struct ieee80211_vif *vif; 292 struct ieee80211_vif *vif;
321 int tx_rate; /* Transmit rate, given as the hw specific value for the 293 struct ieee80211_rate *tx_rate;
322 * rate (from struct ieee80211_rate) */ 294
323 int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw 295 /* Transmit rate for RTS/CTS frame */
324 * specific value for the rate (from 296 struct ieee80211_rate *rts_cts_rate;
325 * struct ieee80211_rate) */ 297
326 298 /* retry rate for the last retries */
327#define IEEE80211_TXCTL_REQ_TX_STATUS (1<<0)/* request TX status callback for 299 struct ieee80211_rate *alt_retry_rate;
328 * this frame */ 300
329#define IEEE80211_TXCTL_DO_NOT_ENCRYPT (1<<1) /* send this frame without 301 u32 flags; /* tx control flags defined above */
330 * encryption; e.g., for EAPOL
331 * frames */
332#define IEEE80211_TXCTL_USE_RTS_CTS (1<<2) /* use RTS-CTS before sending
333 * frame */
334#define IEEE80211_TXCTL_USE_CTS_PROTECT (1<<3) /* use CTS protection for the
335 * frame (e.g., for combined
336 * 802.11g / 802.11b networks) */
337#define IEEE80211_TXCTL_NO_ACK (1<<4) /* tell the low level not to
338 * wait for an ack */
339#define IEEE80211_TXCTL_RATE_CTRL_PROBE (1<<5)
340#define IEEE80211_TXCTL_CLEAR_DST_MASK (1<<6)
341#define IEEE80211_TXCTL_REQUEUE (1<<7)
342#define IEEE80211_TXCTL_FIRST_FRAGMENT (1<<8) /* this is a first fragment of
343 * the frame */
344#define IEEE80211_TXCTL_LONG_RETRY_LIMIT (1<<10) /* this frame should be send
345 * using the through
346 * set_retry_limit configured
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 */
351 u32 flags; /* tx control flags defined
352 * above */
353 u8 key_idx; /* keyidx from hw->set_key(), undefined if 302 u8 key_idx; /* keyidx from hw->set_key(), undefined if
354 * IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */ 303 * IEEE80211_TXCTL_DO_NOT_ENCRYPT is set */
355 u8 retry_limit; /* 1 = only first attempt, 2 = one retry, .. 304 u8 retry_limit; /* 1 = only first attempt, 2 = one retry, ..
356 * This could be used when set_retry_limit 305 * This could be used when set_retry_limit
357 * is not implemented by the driver */ 306 * is not implemented by the driver */
358 u8 power_level; /* per-packet transmit power level, in dBm */ 307 u8 antenna_sel_tx; /* 0 = default/diversity, otherwise bit
359 u8 antenna_sel_tx; /* 0 = default/diversity, 1 = Ant0, 2 = Ant1 */ 308 * position represents antenna number used */
360 u8 icv_len; /* length of the ICV/MIC field in octets */ 309 u8 icv_len; /* length of the ICV/MIC field in octets */
361 u8 iv_len; /* length of the IV field in octets */ 310 u8 iv_len; /* length of the IV field in octets */
362 u8 queue; /* hardware queue to use for this frame; 311 u8 queue; /* hardware queue to use for this frame;
363 * 0 = highest, hw->queues-1 = lowest */ 312 * 0 = highest, hw->queues-1 = lowest */
364 struct ieee80211_rate *rate; /* internal 80211.o rate */ 313 u16 aid; /* Station AID */
365 struct ieee80211_rate *rts_rate; /* internal 80211.o rate
366 * for RTS/CTS */
367 int alt_retry_rate; /* retry rate for the last retries, given as the
368 * hw specific value for the rate (from
369 * struct ieee80211_rate). To be used to limit
370 * packet dropping when probing higher rates, if hw
371 * supports multiple retry rates. -1 = not used */
372 int type; /* internal */ 314 int type; /* internal */
373}; 315};
374 316
@@ -391,7 +333,8 @@ struct ieee80211_tx_control {
391 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on 333 * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on
392 * the frame. 334 * the frame.
393 * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field) 335 * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field)
394 * is valid. 336 * is valid. This is useful in monitor mode and necessary for beacon frames
337 * to enable IBSS merging.
395 */ 338 */
396enum mac80211_rx_flags { 339enum mac80211_rx_flags {
397 RX_FLAG_MMIC_ERROR = 1<<0, 340 RX_FLAG_MMIC_ERROR = 1<<0,
@@ -410,27 +353,26 @@ enum mac80211_rx_flags {
410 * The low-level driver should provide this information (the subset 353 * The low-level driver should provide this information (the subset
411 * supported by hardware) to the 802.11 code with each received 354 * supported by hardware) to the 802.11 code with each received
412 * frame. 355 * frame.
413 * @mactime: MAC timestamp as defined by 802.11 356 * @mactime: value in microseconds of the 64-bit Time Synchronization Function
357 * (TSF) timer when the first data symbol (MPDU) arrived at the hardware.
358 * @band: the active band when this frame was received
414 * @freq: frequency the radio was tuned to when receiving this frame, in MHz 359 * @freq: frequency the radio was tuned to when receiving this frame, in MHz
415 * @channel: channel the radio was tuned to
416 * @phymode: active PHY mode
417 * @ssi: signal strength when receiving this frame 360 * @ssi: signal strength when receiving this frame
418 * @signal: used as 'qual' in statistics reporting 361 * @signal: used as 'qual' in statistics reporting
419 * @noise: PHY noise when receiving this frame 362 * @noise: PHY noise when receiving this frame
420 * @antenna: antenna used 363 * @antenna: antenna used
421 * @rate: data rate 364 * @rate_idx: index of data rate into band's supported rates
422 * @flag: %RX_FLAG_* 365 * @flag: %RX_FLAG_*
423 */ 366 */
424struct ieee80211_rx_status { 367struct ieee80211_rx_status {
425 u64 mactime; 368 u64 mactime;
369 enum ieee80211_band band;
426 int freq; 370 int freq;
427 int channel;
428 enum ieee80211_phymode phymode;
429 int ssi; 371 int ssi;
430 int signal; 372 int signal;
431 int noise; 373 int noise;
432 int antenna; 374 int antenna;
433 int rate; 375 int rate_idx;
434 int flag; 376 int flag;
435}; 377};
436 378
@@ -441,12 +383,14 @@ struct ieee80211_rx_status {
441 * 383 *
442 * @IEEE80211_TX_STATUS_TX_FILTERED: The frame was not transmitted 384 * @IEEE80211_TX_STATUS_TX_FILTERED: The frame was not transmitted
443 * because the destination STA was in powersave mode. 385 * because the destination STA was in powersave mode.
444 *
445 * @IEEE80211_TX_STATUS_ACK: Frame was acknowledged 386 * @IEEE80211_TX_STATUS_ACK: Frame was acknowledged
387 * @IEEE80211_TX_STATUS_AMPDU: The frame was aggregated, so status
388 * is for the whole aggregation.
446 */ 389 */
447enum ieee80211_tx_status_flags { 390enum ieee80211_tx_status_flags {
448 IEEE80211_TX_STATUS_TX_FILTERED = 1<<0, 391 IEEE80211_TX_STATUS_TX_FILTERED = 1<<0,
449 IEEE80211_TX_STATUS_ACK = 1<<1, 392 IEEE80211_TX_STATUS_ACK = 1<<1,
393 IEEE80211_TX_STATUS_AMPDU = 1<<2,
450}; 394};
451 395
452/** 396/**
@@ -457,24 +401,25 @@ enum ieee80211_tx_status_flags {
457 * 401 *
458 * @control: a copy of the &struct ieee80211_tx_control passed to the driver 402 * @control: a copy of the &struct ieee80211_tx_control passed to the driver
459 * in the tx() callback. 403 * in the tx() callback.
460 *
461 * @flags: transmit status flags, defined above 404 * @flags: transmit status flags, defined above
462 * 405 * @retry_count: number of retries
463 * @ack_signal: signal strength of the ACK frame
464 *
465 * @excessive_retries: set to 1 if the frame was retried many times 406 * @excessive_retries: set to 1 if the frame was retried many times
466 * but not acknowledged 407 * but not acknowledged
467 * 408 * @ampdu_ack_len: number of aggregated frames.
468 * @retry_count: number of retries 409 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
469 * 410 * @ampdu_ack_map: block ack bit map for the aggregation.
411 * relevant only if IEEE80211_TX_STATUS_AMPDU was set.
412 * @ack_signal: signal strength of the ACK frame
470 * @queue_length: ?? REMOVE 413 * @queue_length: ?? REMOVE
471 * @queue_number: ?? REMOVE 414 * @queue_number: ?? REMOVE
472 */ 415 */
473struct ieee80211_tx_status { 416struct ieee80211_tx_status {
474 struct ieee80211_tx_control control; 417 struct ieee80211_tx_control control;
475 u8 flags; 418 u8 flags;
476 bool excessive_retries;
477 u8 retry_count; 419 u8 retry_count;
420 bool excessive_retries;
421 u8 ampdu_ack_len;
422 u64 ampdu_ack_map;
478 int ack_signal; 423 int ack_signal;
479 int queue_length; 424 int queue_length;
480 int queue_number; 425 int queue_number;
@@ -502,41 +447,29 @@ enum ieee80211_conf_flags {
502 * 447 *
503 * @radio_enabled: when zero, driver is required to switch off the radio. 448 * @radio_enabled: when zero, driver is required to switch off the radio.
504 * TODO make a flag 449 * TODO make a flag
505 * @channel: IEEE 802.11 channel number
506 * @freq: frequency in MHz
507 * @channel_val: hardware specific channel value for the channel
508 * @phymode: PHY mode to activate (REMOVE)
509 * @chan: channel to switch to, pointer to the channel information
510 * @mode: pointer to mode definition
511 * @regulatory_domain: ??
512 * @beacon_int: beacon interval (TODO make interface config) 450 * @beacon_int: beacon interval (TODO make interface config)
513 * @flags: configuration flags defined above 451 * @flags: configuration flags defined above
514 * @power_level: transmit power limit for current regulatory domain in dBm 452 * @power_level: requested transmit power (in dBm)
515 * @antenna_max: maximum antenna gain 453 * @max_antenna_gain: maximum antenna gain (in dBi)
516 * @antenna_sel_tx: transmit antenna selection, 0: default/diversity, 454 * @antenna_sel_tx: transmit antenna selection, 0: default/diversity,
517 * 1/2: antenna 0/1 455 * 1/2: antenna 0/1
518 * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx 456 * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx
519 * @ht_conf: describes current self configuration of 802.11n HT capabilies 457 * @ht_conf: describes current self configuration of 802.11n HT capabilies
520 * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters 458 * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters
459 * @channel: the channel to tune to
521 */ 460 */
522struct ieee80211_conf { 461struct ieee80211_conf {
523 int channel; /* IEEE 802.11 channel number */
524 int freq; /* MHz */
525 int channel_val; /* hw specific value for the channel */
526
527 enum ieee80211_phymode phymode;
528 struct ieee80211_channel *chan;
529 struct ieee80211_hw_mode *mode;
530 unsigned int regulatory_domain;
531 int radio_enabled; 462 int radio_enabled;
532 463
533 int beacon_int; 464 int beacon_int;
534 u32 flags; 465 u32 flags;
535 u8 power_level; 466 int power_level;
536 u8 antenna_max; 467 int max_antenna_gain;
537 u8 antenna_sel_tx; 468 u8 antenna_sel_tx;
538 u8 antenna_sel_rx; 469 u8 antenna_sel_rx;
539 470
471 struct ieee80211_channel *channel;
472
540 struct ieee80211_ht_info ht_conf; 473 struct ieee80211_ht_info ht_conf;
541 struct ieee80211_ht_bss_info ht_bss_conf; 474 struct ieee80211_ht_bss_info ht_bss_conf;
542}; 475};
@@ -555,12 +488,14 @@ struct ieee80211_conf {
555 * @IEEE80211_IF_TYPE_WDS: interface in WDS mode. 488 * @IEEE80211_IF_TYPE_WDS: interface in WDS mode.
556 * @IEEE80211_IF_TYPE_VLAN: VLAN interface bound to an AP, drivers 489 * @IEEE80211_IF_TYPE_VLAN: VLAN interface bound to an AP, drivers
557 * will never see this type. 490 * will never see this type.
491 * @IEEE80211_IF_TYPE_MESH_POINT: 802.11s mesh point
558 */ 492 */
559enum ieee80211_if_types { 493enum ieee80211_if_types {
560 IEEE80211_IF_TYPE_INVALID, 494 IEEE80211_IF_TYPE_INVALID,
561 IEEE80211_IF_TYPE_AP, 495 IEEE80211_IF_TYPE_AP,
562 IEEE80211_IF_TYPE_STA, 496 IEEE80211_IF_TYPE_STA,
563 IEEE80211_IF_TYPE_IBSS, 497 IEEE80211_IF_TYPE_IBSS,
498 IEEE80211_IF_TYPE_MESH_POINT,
564 IEEE80211_IF_TYPE_MNTR, 499 IEEE80211_IF_TYPE_MNTR,
565 IEEE80211_IF_TYPE_WDS, 500 IEEE80211_IF_TYPE_WDS,
566 IEEE80211_IF_TYPE_VLAN, 501 IEEE80211_IF_TYPE_VLAN,
@@ -582,6 +517,14 @@ struct ieee80211_vif {
582 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); 517 u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
583}; 518};
584 519
520static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif)
521{
522#ifdef CONFIG_MAC80211_MESH
523 return vif->type == IEEE80211_IF_TYPE_MESH_POINT;
524#endif
525 return false;
526}
527
585/** 528/**
586 * struct ieee80211_if_init_conf - initial configuration of an interface 529 * struct ieee80211_if_init_conf - initial configuration of an interface
587 * 530 *
@@ -725,6 +668,21 @@ enum sta_notify_cmd {
725}; 668};
726 669
727/** 670/**
671 * enum ieee80211_tkip_key_type - get tkip key
672 *
673 * Used by drivers which need to get a tkip key for skb. Some drivers need a
674 * phase 1 key, others need a phase 2 key. A single function allows the driver
675 * to get the key, this enum indicates what type of key is required.
676 *
677 * @IEEE80211_TKIP_P1_KEY: the driver needs a phase 1 key
678 * @IEEE80211_TKIP_P2_KEY: the driver needs a phase 2 key
679 */
680enum ieee80211_tkip_key_type {
681 IEEE80211_TKIP_P1_KEY,
682 IEEE80211_TKIP_P2_KEY,
683};
684
685/**
728 * enum ieee80211_hw_flags - hardware flags 686 * enum ieee80211_hw_flags - hardware flags
729 * 687 *
730 * These flags are used to indicate hardware capabilities to 688 * These flags are used to indicate hardware capabilities to
@@ -757,15 +715,19 @@ enum sta_notify_cmd {
757 * %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is also not set because 715 * %IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE is also not set because
758 * otherwise the stack will not know when the DTIM beacon was sent. 716 * otherwise the stack will not know when the DTIM beacon was sent.
759 * 717 *
760 * @IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED: 718 * @IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE:
761 * Channels are already configured to the default regulatory domain 719 * Hardware is not capable of short slot operation on the 2.4 GHz band.
762 * specified in the device's EEPROM 720 *
721 * @IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE:
722 * Hardware is not capable of receiving frames with short preamble on
723 * the 2.4 GHz band.
763 */ 724 */
764enum ieee80211_hw_flags { 725enum ieee80211_hw_flags {
765 IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE = 1<<0, 726 IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE = 1<<0,
766 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1, 727 IEEE80211_HW_RX_INCLUDES_FCS = 1<<1,
767 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2, 728 IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING = 1<<2,
768 IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED = 1<<3, 729 IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE = 1<<3,
730 IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE = 1<<4,
769}; 731};
770 732
771/** 733/**
@@ -777,7 +739,8 @@ enum ieee80211_hw_flags {
777 * @wiphy: This points to the &struct wiphy allocated for this 739 * @wiphy: This points to the &struct wiphy allocated for this
778 * 802.11 PHY. You must fill in the @perm_addr and @dev 740 * 802.11 PHY. You must fill in the @perm_addr and @dev
779 * members of this structure using SET_IEEE80211_DEV() 741 * members of this structure using SET_IEEE80211_DEV()
780 * and SET_IEEE80211_PERM_ADDR(). 742 * and SET_IEEE80211_PERM_ADDR(). Additionally, all supported
743 * bands (with channels, bitrates) are registered here.
781 * 744 *
782 * @conf: &struct ieee80211_conf, device configuration, don't use. 745 * @conf: &struct ieee80211_conf, device configuration, don't use.
783 * 746 *
@@ -888,6 +851,16 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
888 * parameter is guaranteed to be valid until another call to set_key() 851 * parameter is guaranteed to be valid until another call to set_key()
889 * removes it, but it can only be used as a cookie to differentiate 852 * removes it, but it can only be used as a cookie to differentiate
890 * keys. 853 * keys.
854 *
855 * In TKIP some HW need to be provided a phase 1 key, for RX decryption
856 * acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key
857 * handler.
858 * The update_tkip_key() call updates the driver with the new phase 1 key.
859 * This happens everytime the iv16 wraps around (every 65536 packets). The
860 * set_key() call will happen only once for each key (unless the AP did
861 * rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
862 * provided by udpate_tkip_key only. The trigger that makes mac80211 call this
863 * handler is software decryption with wrap around of iv16.
891 */ 864 */
892 865
893/** 866/**
@@ -913,8 +886,18 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
913 * parameter to see whether multicast frames should be accepted 886 * parameter to see whether multicast frames should be accepted
914 * or dropped. 887 * or dropped.
915 * 888 *
916 * All unsupported flags in @total_flags must be cleared, i.e. you 889 * All unsupported flags in @total_flags must be cleared.
917 * should clear all bits except those you honoured. 890 * Hardware does not support a flag if it is incapable of _passing_
891 * the frame to the stack. Otherwise the driver must ignore
892 * the flag, but not clear it.
893 * You must _only_ clear the flag (announce no support for the
894 * flag to mac80211) if you are not able to pass the packet type
895 * to the stack (so the hardware always filters it).
896 * So for example, you should clear @FIF_CONTROL, if your hardware
897 * always filters control frames. If your hardware always passes
898 * control frames to the kernel and is incapable of filtering them,
899 * you do _not_ clear the @FIF_CONTROL flag.
900 * This rule applies to all other FIF flags as well.
918 */ 901 */
919 902
920/** 903/**
@@ -967,10 +950,14 @@ enum ieee80211_filter_flags {
967 * &struct ieee80211_ops to indicate which action is needed. 950 * &struct ieee80211_ops to indicate which action is needed.
968 * @IEEE80211_AMPDU_RX_START: start Rx aggregation 951 * @IEEE80211_AMPDU_RX_START: start Rx aggregation
969 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation 952 * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation
953 * @IEEE80211_AMPDU_TX_START: start Tx aggregation
954 * @IEEE80211_AMPDU_TX_STOP: stop Tx aggregation
970 */ 955 */
971enum ieee80211_ampdu_mlme_action { 956enum ieee80211_ampdu_mlme_action {
972 IEEE80211_AMPDU_RX_START, 957 IEEE80211_AMPDU_RX_START,
973 IEEE80211_AMPDU_RX_STOP, 958 IEEE80211_AMPDU_RX_STOP,
959 IEEE80211_AMPDU_TX_START,
960 IEEE80211_AMPDU_TX_STOP,
974}; 961};
975 962
976/** 963/**
@@ -1033,8 +1020,7 @@ enum ieee80211_ampdu_mlme_action {
1033 * level driver (e.g. assoc/disassoc status, erp parameters). 1020 * level driver (e.g. assoc/disassoc status, erp parameters).
1034 * This function should not be used if no BSS has been set, unless 1021 * This function should not be used if no BSS has been set, unless
1035 * for association indication. The @changed parameter indicates which 1022 * for association indication. The @changed parameter indicates which
1036 * of the bss parameters has changed when a call is made. This callback 1023 * of the bss parameters has changed when a call is made.
1037 * has to be atomic.
1038 * 1024 *
1039 * @configure_filter: Configure the device's RX filter. 1025 * @configure_filter: Configure the device's RX filter.
1040 * See the section "Frame filtering" for more information. 1026 * See the section "Frame filtering" for more information.
@@ -1050,8 +1036,14 @@ enum ieee80211_ampdu_mlme_action {
1050 * and remove_interface calls, i.e. while the interface with the 1036 * and remove_interface calls, i.e. while the interface with the
1051 * given local_address is enabled. 1037 * given local_address is enabled.
1052 * 1038 *
1039 * @update_tkip_key: See the section "Hardware crypto acceleration"
1040 * This callback will be called in the context of Rx. Called for drivers
1041 * which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
1042 *
1053 * @hw_scan: Ask the hardware to service the scan request, no need to start 1043 * @hw_scan: Ask the hardware to service the scan request, no need to start
1054 * the scan state machine in stack. 1044 * the scan state machine in stack. The scan must honour the channel
1045 * configuration done by the regulatory agent in the wiphy's registered
1046 * bands.
1055 * 1047 *
1056 * @get_stats: return low-level statistics 1048 * @get_stats: return low-level statistics
1057 * 1049 *
@@ -1111,7 +1103,8 @@ enum ieee80211_ampdu_mlme_action {
1111 * The RA/TID combination determines the destination and TID we want 1103 * The RA/TID combination determines the destination and TID we want
1112 * the ampdu action to be performed for. The action is defined through 1104 * the ampdu action to be performed for. The action is defined through
1113 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) 1105 * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn)
1114 * is the first frame we expect to perform the action on. 1106 * is the first frame we expect to perform the action on. notice
1107 * that TX/RX_STOP can pass NULL for this parameter.
1115 */ 1108 */
1116struct ieee80211_ops { 1109struct ieee80211_ops {
1117 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, 1110 int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb,
@@ -1138,6 +1131,9 @@ struct ieee80211_ops {
1138 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd, 1131 int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
1139 const u8 *local_address, const u8 *address, 1132 const u8 *local_address, const u8 *address,
1140 struct ieee80211_key_conf *key); 1133 struct ieee80211_key_conf *key);
1134 void (*update_tkip_key)(struct ieee80211_hw *hw,
1135 struct ieee80211_key_conf *conf, const u8 *address,
1136 u32 iv32, u16 *phase1key);
1141 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); 1137 int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len);
1142 int (*get_stats)(struct ieee80211_hw *hw, 1138 int (*get_stats)(struct ieee80211_hw *hw,
1143 struct ieee80211_low_level_stats *stats); 1139 struct ieee80211_low_level_stats *stats);
@@ -1159,10 +1155,9 @@ struct ieee80211_ops {
1159 struct sk_buff *skb, 1155 struct sk_buff *skb,
1160 struct ieee80211_tx_control *control); 1156 struct ieee80211_tx_control *control);
1161 int (*tx_last_beacon)(struct ieee80211_hw *hw); 1157 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, 1158 int (*ampdu_action)(struct ieee80211_hw *hw,
1164 enum ieee80211_ampdu_mlme_action action, 1159 enum ieee80211_ampdu_mlme_action action,
1165 const u8 *ra, u16 tid, u16 ssn); 1160 const u8 *addr, u16 tid, u16 *ssn);
1166}; 1161};
1167 1162
1168/** 1163/**
@@ -1183,8 +1178,9 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
1183/** 1178/**
1184 * ieee80211_register_hw - Register hardware device 1179 * ieee80211_register_hw - Register hardware device
1185 * 1180 *
1186 * You must call this function before any other functions 1181 * You must call this function before any other functions in
1187 * except ieee80211_register_hwmode. 1182 * mac80211. Note that before a hardware can be registered, you
1183 * need to fill the contained wiphy's information.
1188 * 1184 *
1189 * @hw: the device to register as returned by ieee80211_alloc_hw() 1185 * @hw: the device to register as returned by ieee80211_alloc_hw()
1190 */ 1186 */
@@ -1272,10 +1268,6 @@ static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw)
1272#endif 1268#endif
1273} 1269}
1274 1270
1275/* Register a new hardware PHYMODE capability to the stack. */
1276int ieee80211_register_hwmode(struct ieee80211_hw *hw,
1277 struct ieee80211_hw_mode *mode);
1278
1279/** 1271/**
1280 * ieee80211_unregister_hw - Unregister a hardware device 1272 * ieee80211_unregister_hw - Unregister a hardware device
1281 * 1273 *
@@ -1308,7 +1300,10 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1308 * buffer in @skb must start with an IEEE 802.11 header or a radiotap 1300 * buffer in @skb must start with an IEEE 802.11 header or a radiotap
1309 * header if %RX_FLAG_RADIOTAP is set in the @status flags. 1301 * header if %RX_FLAG_RADIOTAP is set in the @status flags.
1310 * 1302 *
1311 * This function may not be called in IRQ context. 1303 * This function may not be called in IRQ context. Calls to this function
1304 * for a single hardware must be synchronized against each other. Calls
1305 * to this function and ieee80211_rx_irqsafe() may not be mixed for a
1306 * single hardware.
1312 * 1307 *
1313 * @hw: the hardware this frame came in on 1308 * @hw: the hardware this frame came in on
1314 * @skb: the buffer to receive, owned by mac80211 after this call 1309 * @skb: the buffer to receive, owned by mac80211 after this call
@@ -1325,7 +1320,10 @@ static inline void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb,
1325 * ieee80211_rx_irqsafe - receive frame 1320 * ieee80211_rx_irqsafe - receive frame
1326 * 1321 *
1327 * Like ieee80211_rx() but can be called in IRQ context 1322 * Like ieee80211_rx() but can be called in IRQ context
1328 * (internally defers to a workqueue.) 1323 * (internally defers to a tasklet.)
1324 *
1325 * Calls to this function and ieee80211_rx() may not be mixed for a
1326 * single hardware.
1329 * 1327 *
1330 * @hw: the hardware this frame came in on 1328 * @hw: the hardware this frame came in on
1331 * @skb: the buffer to receive, owned by mac80211 after this call 1329 * @skb: the buffer to receive, owned by mac80211 after this call
@@ -1344,6 +1342,11 @@ void ieee80211_rx_irqsafe(struct ieee80211_hw *hw,
1344 * transmitted. It is permissible to not call this function for 1342 * transmitted. It is permissible to not call this function for
1345 * multicast frames but this can affect statistics. 1343 * multicast frames but this can affect statistics.
1346 * 1344 *
1345 * This function may not be called in IRQ context. Calls to this function
1346 * for a single hardware must be synchronized against each other. Calls
1347 * to this function and ieee80211_tx_status_irqsafe() may not be mixed
1348 * for a single hardware.
1349 *
1347 * @hw: the hardware the frame was transmitted by 1350 * @hw: the hardware the frame was transmitted by
1348 * @skb: the frame that was transmitted, owned by mac80211 after this call 1351 * @skb: the frame that was transmitted, owned by mac80211 after this call
1349 * @status: status information for this frame; the status pointer need not 1352 * @status: status information for this frame; the status pointer need not
@@ -1353,6 +1356,22 @@ void ieee80211_rx_irqsafe(struct ieee80211_hw *hw,
1353void ieee80211_tx_status(struct ieee80211_hw *hw, 1356void ieee80211_tx_status(struct ieee80211_hw *hw,
1354 struct sk_buff *skb, 1357 struct sk_buff *skb,
1355 struct ieee80211_tx_status *status); 1358 struct ieee80211_tx_status *status);
1359
1360/**
1361 * ieee80211_tx_status_irqsafe - irq-safe transmit status callback
1362 *
1363 * Like ieee80211_tx_status() but can be called in IRQ context
1364 * (internally defers to a tasklet.)
1365 *
1366 * Calls to this function and ieee80211_tx_status() may not be mixed for a
1367 * single hardware.
1368 *
1369 * @hw: the hardware the frame was transmitted by
1370 * @skb: the frame that was transmitted, owned by mac80211 after this call
1371 * @status: status information for this frame; the status pointer need not
1372 * be valid after this function returns and is not freed by mac80211,
1373 * it is recommended that it points to a stack area
1374 */
1356void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, 1375void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
1357 struct sk_buff *skb, 1376 struct sk_buff *skb,
1358 struct ieee80211_tx_status *status); 1377 struct ieee80211_tx_status *status);
@@ -1449,7 +1468,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
1449 * @hw: pointer obtained from ieee80211_alloc_hw(). 1468 * @hw: pointer obtained from ieee80211_alloc_hw().
1450 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. 1469 * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf.
1451 * @frame_len: the length of the frame. 1470 * @frame_len: the length of the frame.
1452 * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. 1471 * @rate: the rate at which the frame is going to be transmitted.
1453 * 1472 *
1454 * Calculate the duration field of some generic frame, given its 1473 * Calculate the duration field of some generic frame, given its
1455 * length and transmission rate (in 100kbps). 1474 * length and transmission rate (in 100kbps).
@@ -1457,7 +1476,7 @@ __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw,
1457__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, 1476__le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw,
1458 struct ieee80211_vif *vif, 1477 struct ieee80211_vif *vif,
1459 size_t frame_len, 1478 size_t frame_len,
1460 int rate); 1479 struct ieee80211_rate *rate);
1461 1480
1462/** 1481/**
1463 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames 1482 * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames
@@ -1507,6 +1526,21 @@ int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb);
1507int ieee80211_get_hdrlen(u16 fc); 1526int ieee80211_get_hdrlen(u16 fc);
1508 1527
1509/** 1528/**
1529 * ieee80211_get_tkip_key - get a TKIP rc4 for skb
1530 *
1531 * This function computes a TKIP rc4 key for an skb. It computes
1532 * a phase 1 key if needed (iv16 wraps around). This function is to
1533 * be used by drivers which can do HW encryption but need to compute
1534 * to phase 1/2 key in SW.
1535 *
1536 * @keyconf: the parameter passed with the set key
1537 * @skb: the skb for which the key is needed
1538 * @rc4key: a buffer to which the key will be written
1539 */
1540void ieee80211_get_tkip_key(struct ieee80211_key_conf *keyconf,
1541 struct sk_buff *skb,
1542 enum ieee80211_tkip_key_type type, u8 *key);
1543/**
1510 * ieee80211_wake_queue - wake specific queue 1544 * ieee80211_wake_queue - wake specific queue
1511 * @hw: pointer as obtained from ieee80211_alloc_hw(). 1545 * @hw: pointer as obtained from ieee80211_alloc_hw().
1512 * @queue: queue number (counted from zero). 1546 * @queue: queue number (counted from zero).
@@ -1574,4 +1608,92 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw,
1574 struct ieee80211_vif *vif), 1608 struct ieee80211_vif *vif),
1575 void *data); 1609 void *data);
1576 1610
1611/**
1612 * ieee80211_start_tx_ba_session - Start a tx Block Ack session.
1613 * @hw: pointer as obtained from ieee80211_alloc_hw().
1614 * @ra: receiver address of the BA session recipient
1615 * @tid: the TID to BA on.
1616 * @return: success if addBA request was sent, failure otherwise
1617 *
1618 * Although mac80211/low level driver/user space application can estimate
1619 * the need to start aggregation on a certain RA/TID, the session level
1620 * will be managed by the mac80211.
1621 */
1622int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid);
1623
1624/**
1625 * ieee80211_start_tx_ba_cb - low level driver ready to aggregate.
1626 * @hw: pointer as obtained from ieee80211_alloc_hw().
1627 * @ra: receiver address of the BA session recipient.
1628 * @tid: the TID to BA on.
1629 *
1630 * This function must be called by low level driver once it has
1631 * finished with preparations for the BA session.
1632 */
1633void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid);
1634
1635/**
1636 * ieee80211_start_tx_ba_cb_irqsafe - low level driver ready to aggregate.
1637 * @hw: pointer as obtained from ieee80211_alloc_hw().
1638 * @ra: receiver address of the BA session recipient.
1639 * @tid: the TID to BA on.
1640 *
1641 * This function must be called by low level driver once it has
1642 * finished with preparations for the BA session.
1643 * This version of the function is irq safe.
1644 */
1645void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
1646 u16 tid);
1647
1648/**
1649 * ieee80211_stop_tx_ba_session - Stop a Block Ack session.
1650 * @hw: pointer as obtained from ieee80211_alloc_hw().
1651 * @ra: receiver address of the BA session recipient
1652 * @tid: the TID to stop BA.
1653 * @initiator: if indicates initiator DELBA frame will be sent.
1654 * @return: error if no sta with matching da found, success otherwise
1655 *
1656 * Although mac80211/low level driver/user space application can estimate
1657 * the need to stop aggregation on a certain RA/TID, the session level
1658 * will be managed by the mac80211.
1659 */
1660int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
1661 u8 *ra, u16 tid,
1662 enum ieee80211_back_parties initiator);
1663
1664/**
1665 * ieee80211_stop_tx_ba_cb - low level driver ready to stop aggregate.
1666 * @hw: pointer as obtained from ieee80211_alloc_hw().
1667 * @ra: receiver address of the BA session recipient.
1668 * @tid: the desired TID to BA on.
1669 *
1670 * This function must be called by low level driver once it has
1671 * finished with preparations for the BA session tear down.
1672 */
1673void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid);
1674
1675/**
1676 * ieee80211_stop_tx_ba_cb_irqsafe - low level driver ready to stop aggregate.
1677 * @hw: pointer as obtained from ieee80211_alloc_hw().
1678 * @ra: receiver address of the BA session recipient.
1679 * @tid: the desired TID to BA on.
1680 *
1681 * This function must be called by low level driver once it has
1682 * finished with preparations for the BA session tear down.
1683 * This version of the function is irq safe.
1684 */
1685void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, const u8 *ra,
1686 u16 tid);
1687
1688/**
1689 * ieee80211_notify_mac - low level driver notification
1690 * @hw: pointer as obtained from ieee80211_alloc_hw().
1691 * @notification_types: enum ieee80211_notification_types
1692 *
1693 * This function must be called by low level driver to inform mac80211 of
1694 * low level driver status change or force mac80211 to re-assoc for low
1695 * level driver internal error that require re-assoc.
1696 */
1697void ieee80211_notify_mac(struct ieee80211_hw *hw,
1698 enum ieee80211_notification_types notif_type);
1577#endif /* MAC80211_H */ 1699#endif /* MAC80211_H */
diff --git a/include/net/mip6.h b/include/net/mip6.h
index 63272610a24a..a83ad1982a90 100644
--- a/include/net/mip6.h
+++ b/include/net/mip6.h
@@ -28,9 +28,6 @@
28#include <linux/skbuff.h> 28#include <linux/skbuff.h>
29#include <net/sock.h> 29#include <net/sock.h>
30 30
31#define MIP6_OPT_PAD_1 0
32#define MIP6_OPT_PAD_N 1
33
34/* 31/*
35 * Mobility Header 32 * Mobility Header
36 */ 33 */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 59b70624b056..9c451ff2f4f4 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -12,6 +12,15 @@
12#define NDISC_REDIRECT 137 12#define NDISC_REDIRECT 137
13 13
14/* 14/*
15 * Router type: cross-layer information from link-layer to
16 * IPv6 layer reported by certain link types (e.g., RFC4214).
17 */
18#define NDISC_NODETYPE_UNSPEC 0 /* unspecified (default) */
19#define NDISC_NODETYPE_HOST 1 /* host or unauthorized router */
20#define NDISC_NODETYPE_NODEFAULT 2 /* non-default router */
21#define NDISC_NODETYPE_DEFAULT 3 /* default router */
22
23/*
15 * ndisc options 24 * ndisc options
16 */ 25 */
17 26
@@ -77,7 +86,7 @@ struct nd_opt_hdr {
77} __attribute__((__packed__)); 86} __attribute__((__packed__));
78 87
79 88
80extern int ndisc_init(struct net_proto_family *ops); 89extern int ndisc_init(void);
81 90
82extern void ndisc_cleanup(void); 91extern void ndisc_cleanup(void);
83 92
@@ -85,20 +94,17 @@ extern int ndisc_rcv(struct sk_buff *skb);
85 94
86extern void ndisc_send_ns(struct net_device *dev, 95extern void ndisc_send_ns(struct net_device *dev,
87 struct neighbour *neigh, 96 struct neighbour *neigh,
88 struct in6_addr *solicit, 97 const struct in6_addr *solicit,
89 struct in6_addr *daddr, 98 const struct in6_addr *daddr,
90 struct in6_addr *saddr); 99 const struct in6_addr *saddr);
91 100
92extern void ndisc_send_rs(struct net_device *dev, 101extern void ndisc_send_rs(struct net_device *dev,
93 struct in6_addr *saddr, 102 const struct in6_addr *saddr,
94 struct in6_addr *daddr); 103 const struct in6_addr *daddr);
95
96extern void ndisc_forwarding_on(void);
97extern void ndisc_forwarding_off(void);
98 104
99extern void ndisc_send_redirect(struct sk_buff *skb, 105extern void ndisc_send_redirect(struct sk_buff *skb,
100 struct neighbour *neigh, 106 struct neighbour *neigh,
101 struct in6_addr *target); 107 const struct in6_addr *target);
102 108
103extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir); 109extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);
104 110
@@ -107,7 +113,7 @@ extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *d
107/* 113/*
108 * IGMP 114 * IGMP
109 */ 115 */
110extern int igmp6_init(struct net_proto_family *ops); 116extern int igmp6_init(void);
111 117
112extern void igmp6_cleanup(void); 118extern void igmp6_cleanup(void);
113 119
@@ -115,7 +121,6 @@ extern int igmp6_event_query(struct sk_buff *skb);
115 121
116extern int igmp6_event_report(struct sk_buff *skb); 122extern int igmp6_event_report(struct sk_buff *skb);
117 123
118extern void igmp6_cleanup(void);
119 124
120#ifdef CONFIG_SYSCTL 125#ifdef CONFIG_SYSCTL
121extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, 126extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
@@ -129,7 +134,7 @@ extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl,
129extern void inet6_ifinfo_notify(int event, 134extern void inet6_ifinfo_notify(int event,
130 struct inet6_dev *idev); 135 struct inet6_dev *idev);
131 136
132static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, struct in6_addr *addr) 137static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, const struct in6_addr *addr)
133{ 138{
134 139
135 if (dev) 140 if (dev)
diff --git a/include/net/neighbour.h b/include/net/neighbour.h
index 64a5f0120b52..dc420fecafb9 100644
--- a/include/net/neighbour.h
+++ b/include/net/neighbour.h
@@ -38,7 +38,9 @@ struct neighbour;
38 38
39struct neigh_parms 39struct neigh_parms
40{ 40{
41#ifdef CONFIG_NET_NS
41 struct net *net; 42 struct net *net;
43#endif
42 struct net_device *dev; 44 struct net_device *dev;
43 struct neigh_parms *next; 45 struct neigh_parms *next;
44 int (*neigh_setup)(struct neighbour *); 46 int (*neigh_setup)(struct neighbour *);
@@ -131,7 +133,9 @@ struct neigh_ops
131struct pneigh_entry 133struct pneigh_entry
132{ 134{
133 struct pneigh_entry *next; 135 struct pneigh_entry *next;
136#ifdef CONFIG_NET_NS
134 struct net *net; 137 struct net *net;
138#endif
135 struct net_device *dev; 139 struct net_device *dev;
136 u8 flags; 140 u8 flags;
137 u8 key[0]; 141 u8 key[0];
@@ -213,6 +217,17 @@ extern struct neighbour *neigh_event_ns(struct neigh_table *tbl,
213 217
214extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); 218extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl);
215extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); 219extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms);
220
221static inline
222struct net *neigh_parms_net(const struct neigh_parms *parms)
223{
224#ifdef CONFIG_NET_NS
225 return parms->net;
226#else
227 return &init_net;
228#endif
229}
230
216extern unsigned long neigh_rand_reach_time(unsigned long base); 231extern unsigned long neigh_rand_reach_time(unsigned long base);
217 232
218extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, 233extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p,
@@ -224,6 +239,16 @@ extern struct pneigh_entry *__pneigh_lookup(struct neigh_table *tbl,
224 struct net_device *dev); 239 struct net_device *dev);
225extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev); 240extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev);
226 241
242static inline
243struct net *pneigh_net(const struct pneigh_entry *pneigh)
244{
245#ifdef CONFIG_NET_NS
246 return pneigh->net;
247#else
248 return &init_net;
249#endif
250}
251
227extern void neigh_app_ns(struct neighbour *n); 252extern void neigh_app_ns(struct neighbour *n);
228extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); 253extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie);
229extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *)); 254extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct neighbour *));
@@ -288,12 +313,6 @@ static inline void neigh_confirm(struct neighbour *neigh)
288 neigh->confirmed = jiffies; 313 neigh->confirmed = jiffies;
289} 314}
290 315
291static inline int neigh_is_connected(struct neighbour *neigh)
292{
293 return neigh->nud_state&NUD_CONNECTED;
294}
295
296
297static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) 316static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
298{ 317{
299 neigh->used = jiffies; 318 neigh->used = jiffies;
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 923f2b8b9096..aa540e6be502 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -8,24 +8,29 @@
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/core.h>
11#include <net/netns/unix.h> 12#include <net/netns/unix.h>
12#include <net/netns/packet.h> 13#include <net/netns/packet.h>
13#include <net/netns/ipv4.h> 14#include <net/netns/ipv4.h>
14#include <net/netns/ipv6.h> 15#include <net/netns/ipv6.h>
16#include <net/netns/dccp.h>
15#include <net/netns/x_tables.h> 17#include <net/netns/x_tables.h>
16 18
17struct proc_dir_entry; 19struct proc_dir_entry;
18struct net_device; 20struct net_device;
19struct sock; 21struct sock;
20struct ctl_table_header; 22struct ctl_table_header;
23struct net_generic;
21 24
22struct net { 25struct net {
23 atomic_t count; /* To decided when the network 26 atomic_t count; /* To decided when the network
24 * namespace should be freed. 27 * namespace should be freed.
25 */ 28 */
29#ifdef NETNS_REFCNT_DEBUG
26 atomic_t use_count; /* To track references we 30 atomic_t use_count; /* To track references we
27 * destroy on demand 31 * destroy on demand
28 */ 32 */
33#endif
29 struct list_head list; /* list of network namespaces */ 34 struct list_head list; /* list of network namespaces */
30 struct work_struct work; /* work struct for freeing */ 35 struct work_struct work; /* work struct for freeing */
31 36
@@ -46,40 +51,46 @@ struct net {
46 51
47 struct sock *rtnl; /* rtnetlink socket */ 52 struct sock *rtnl; /* rtnetlink socket */
48 53
49 /* core sysctls */ 54 struct netns_core core;
50 struct ctl_table_header *sysctl_core_hdr;
51 int sysctl_somaxconn;
52
53 struct netns_packet packet; 55 struct netns_packet packet;
54 struct netns_unix unx; 56 struct netns_unix unx;
55 struct netns_ipv4 ipv4; 57 struct netns_ipv4 ipv4;
56#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 58#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
57 struct netns_ipv6 ipv6; 59 struct netns_ipv6 ipv6;
58#endif 60#endif
61#if defined(CONFIG_IP_DCCP) || defined(CONFIG_IP_DCCP_MODULE)
62 struct netns_dccp dccp;
63#endif
59#ifdef CONFIG_NETFILTER 64#ifdef CONFIG_NETFILTER
60 struct netns_xt xt; 65 struct netns_xt xt;
61#endif 66#endif
67 struct net_generic *gen;
62}; 68};
63 69
64#ifdef CONFIG_NET 70
71#include <linux/seq_file_net.h>
72
65/* Init's network namespace */ 73/* Init's network namespace */
66extern struct net init_net; 74extern struct net init_net;
67#define INIT_NET_NS(net_ns) .net_ns = &init_net,
68#else
69#define INIT_NET_NS(net_ns)
70#endif
71
72extern struct list_head net_namespace_list;
73 75
74#ifdef CONFIG_NET 76#ifdef CONFIG_NET
77#define INIT_NET_NS(net_ns) .net_ns = &init_net,
78
75extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns); 79extern struct net *copy_net_ns(unsigned long flags, struct net *net_ns);
76#else 80
81#else /* CONFIG_NET */
82
83#define INIT_NET_NS(net_ns)
84
77static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns) 85static inline struct net *copy_net_ns(unsigned long flags, struct net *net_ns)
78{ 86{
79 /* There is nothing to copy so this is a noop */ 87 /* There is nothing to copy so this is a noop */
80 return net_ns; 88 return net_ns;
81} 89}
82#endif 90#endif /* CONFIG_NET */
91
92
93extern struct list_head net_namespace_list;
83 94
84#ifdef CONFIG_NET_NS 95#ifdef CONFIG_NET_NS
85extern void __put_net(struct net *net); 96extern void __put_net(struct net *net);
@@ -108,41 +119,59 @@ static inline void put_net(struct net *net)
108 __put_net(net); 119 __put_net(net);
109} 120}
110 121
111static inline struct net *hold_net(struct net *net) 122static inline
123int net_eq(const struct net *net1, const struct net *net2)
124{
125 return net1 == net2;
126}
127#else
128static inline struct net *get_net(struct net *net)
112{ 129{
113 atomic_inc(&net->use_count);
114 return net; 130 return net;
115} 131}
116 132
117static inline void release_net(struct net *net) 133static inline void put_net(struct net *net)
118{ 134{
119 atomic_dec(&net->use_count);
120} 135}
121#else 136
122static inline struct net *get_net(struct net *net) 137static inline struct net *maybe_get_net(struct net *net)
123{ 138{
124 return net; 139 return net;
125} 140}
126 141
127static inline void put_net(struct net *net) 142static inline
143int net_eq(const struct net *net1, const struct net *net2)
128{ 144{
145 return 1;
129} 146}
147#endif
148
130 149
150#ifdef NETNS_REFCNT_DEBUG
131static inline struct net *hold_net(struct net *net) 151static inline struct net *hold_net(struct net *net)
132{ 152{
153 if (net)
154 atomic_inc(&net->use_count);
133 return net; 155 return net;
134} 156}
135 157
136static inline void release_net(struct net *net) 158static inline void release_net(struct net *net)
137{ 159{
160 if (net)
161 atomic_dec(&net->use_count);
138} 162}
139 163#else
140static inline struct net *maybe_get_net(struct net *net) 164static inline struct net *hold_net(struct net *net)
141{ 165{
142 return net; 166 return net;
143} 167}
168
169static inline void release_net(struct net *net)
170{
171}
144#endif 172#endif
145 173
174
146#define for_each_net(VAR) \ 175#define for_each_net(VAR) \
147 list_for_each_entry(VAR, &net_namespace_list, list) 176 list_for_each_entry(VAR, &net_namespace_list, list)
148 177
@@ -166,6 +195,8 @@ extern int register_pernet_subsys(struct pernet_operations *);
166extern void unregister_pernet_subsys(struct pernet_operations *); 195extern void unregister_pernet_subsys(struct pernet_operations *);
167extern int register_pernet_device(struct pernet_operations *); 196extern int register_pernet_device(struct pernet_operations *);
168extern void unregister_pernet_device(struct pernet_operations *); 197extern void unregister_pernet_device(struct pernet_operations *);
198extern int register_pernet_gen_device(int *id, struct pernet_operations *);
199extern void unregister_pernet_gen_device(int id, struct pernet_operations *);
169 200
170struct ctl_path; 201struct ctl_path;
171struct ctl_table; 202struct ctl_table;
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 90b3e7f5df5f..2dbd6c015b94 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -20,6 +20,7 @@
20#include <asm/atomic.h> 20#include <asm/atomic.h>
21 21
22#include <linux/netfilter/nf_conntrack_tcp.h> 22#include <linux/netfilter/nf_conntrack_tcp.h>
23#include <linux/netfilter/nf_conntrack_dccp.h>
23#include <linux/netfilter/nf_conntrack_sctp.h> 24#include <linux/netfilter/nf_conntrack_sctp.h>
24#include <linux/netfilter/nf_conntrack_proto_gre.h> 25#include <linux/netfilter/nf_conntrack_proto_gre.h>
25#include <net/netfilter/ipv4/nf_conntrack_icmp.h> 26#include <net/netfilter/ipv4/nf_conntrack_icmp.h>
@@ -30,6 +31,7 @@
30/* per conntrack: protocol private data */ 31/* per conntrack: protocol private data */
31union nf_conntrack_proto { 32union nf_conntrack_proto {
32 /* insert conntrack proto private data here */ 33 /* insert conntrack proto private data here */
34 struct nf_ct_dccp dccp;
33 struct ip_ct_sctp sctp; 35 struct ip_ct_sctp sctp;
34 struct ip_ct_tcp tcp; 36 struct ip_ct_tcp tcp;
35 struct ip_ct_icmp icmp; 37 struct ip_ct_icmp icmp;
@@ -46,6 +48,7 @@ union nf_conntrack_expect_proto {
46#include <linux/netfilter/nf_conntrack_pptp.h> 48#include <linux/netfilter/nf_conntrack_pptp.h>
47#include <linux/netfilter/nf_conntrack_h323.h> 49#include <linux/netfilter/nf_conntrack_h323.h>
48#include <linux/netfilter/nf_conntrack_sane.h> 50#include <linux/netfilter/nf_conntrack_sane.h>
51#include <linux/netfilter/nf_conntrack_sip.h>
49 52
50/* per conntrack: application helper private data */ 53/* per conntrack: application helper private data */
51union nf_conntrack_help { 54union nf_conntrack_help {
@@ -54,6 +57,7 @@ union nf_conntrack_help {
54 struct nf_ct_pptp_master ct_pptp_info; 57 struct nf_ct_pptp_master ct_pptp_info;
55 struct nf_ct_h323_master ct_h323_info; 58 struct nf_ct_h323_master ct_h323_info;
56 struct nf_ct_sane_master ct_sane_info; 59 struct nf_ct_sane_master ct_sane_info;
60 struct nf_ct_sip_master ct_sip_info;
57}; 61};
58 62
59#include <linux/types.h> 63#include <linux/types.h>
@@ -61,20 +65,16 @@ union nf_conntrack_help {
61#include <linux/timer.h> 65#include <linux/timer.h>
62 66
63#ifdef CONFIG_NETFILTER_DEBUG 67#ifdef CONFIG_NETFILTER_DEBUG
64#define NF_CT_ASSERT(x) \ 68#define NF_CT_ASSERT(x) WARN_ON(!(x))
65do { \
66 if (!(x)) \
67 /* Wooah! I'm tripping my conntrack in a frenzy of \
68 netplay... */ \
69 printk("NF_CT_ASSERT: %s:%i(%s)\n", \
70 __FILE__, __LINE__, __FUNCTION__); \
71} while(0)
72#else 69#else
73#define NF_CT_ASSERT(x) 70#define NF_CT_ASSERT(x)
74#endif 71#endif
75 72
76struct nf_conntrack_helper; 73struct nf_conntrack_helper;
77 74
75/* Must be kept in sync with the classes defined by helpers */
76#define NF_CT_MAX_EXPECT_CLASSES 3
77
78/* nf_conn feature for connections that have a helper */ 78/* nf_conn feature for connections that have a helper */
79struct nf_conn_help { 79struct nf_conn_help {
80 /* Helper. if any */ 80 /* Helper. if any */
@@ -85,7 +85,7 @@ struct nf_conn_help {
85 struct hlist_head expectations; 85 struct hlist_head expectations;
86 86
87 /* Current number of expected connections */ 87 /* Current number of expected connections */
88 unsigned int expecting; 88 u8 expecting[NF_CT_MAX_EXPECT_CLASSES];
89}; 89};
90 90
91 91
@@ -140,6 +140,16 @@ nf_ct_tuplehash_to_ctrack(const struct nf_conntrack_tuple_hash *hash)
140 tuplehash[hash->tuple.dst.dir]); 140 tuplehash[hash->tuple.dst.dir]);
141} 141}
142 142
143static inline u_int16_t nf_ct_l3num(const struct nf_conn *ct)
144{
145 return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.src.l3num;
146}
147
148static inline u_int8_t nf_ct_protonum(const struct nf_conn *ct)
149{
150 return ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple.dst.protonum;
151}
152
143/* get master conntrack via master expectation */ 153/* get master conntrack via master expectation */
144#define master_ct(conntr) (conntr->master) 154#define master_ct(conntr) (conntr->master)
145 155
@@ -184,12 +194,11 @@ extern void nf_conntrack_hash_insert(struct nf_conn *ct);
184 194
185extern void nf_conntrack_flush(void); 195extern void nf_conntrack_flush(void);
186 196
187extern int nf_ct_get_tuplepr(const struct sk_buff *skb, 197extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
188 unsigned int nhoff, 198 unsigned int nhoff, u_int16_t l3num,
189 u_int16_t l3num, 199 struct nf_conntrack_tuple *tuple);
190 struct nf_conntrack_tuple *tuple); 200extern bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse,
191extern int nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, 201 const struct nf_conntrack_tuple *orig);
192 const struct nf_conntrack_tuple *orig);
193 202
194extern void __nf_ct_refresh_acct(struct nf_conn *ct, 203extern void __nf_ct_refresh_acct(struct nf_conn *ct,
195 enum ip_conntrack_info ctinfo, 204 enum ip_conntrack_info ctinfo,
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 9ee26469c759..a81771210934 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -30,7 +30,7 @@ extern void nf_conntrack_cleanup(void);
30extern int nf_conntrack_proto_init(void); 30extern int nf_conntrack_proto_init(void);
31extern void nf_conntrack_proto_fini(void); 31extern void nf_conntrack_proto_fini(void);
32 32
33extern int 33extern bool
34nf_ct_get_tuple(const struct sk_buff *skb, 34nf_ct_get_tuple(const struct sk_buff *skb,
35 unsigned int nhoff, 35 unsigned int nhoff,
36 unsigned int dataoff, 36 unsigned int dataoff,
@@ -40,7 +40,7 @@ nf_ct_get_tuple(const struct sk_buff *skb,
40 const struct nf_conntrack_l3proto *l3proto, 40 const struct nf_conntrack_l3proto *l3proto,
41 const struct nf_conntrack_l4proto *l4proto); 41 const struct nf_conntrack_l4proto *l4proto);
42 42
43extern int 43extern bool
44nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, 44nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
45 const struct nf_conntrack_tuple *orig, 45 const struct nf_conntrack_tuple *orig,
46 const struct nf_conntrack_l3proto *l3proto, 46 const struct nf_conntrack_l3proto *l3proto,
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h
index cb608a1b44e5..dfdf4b459475 100644
--- a/include/net/netfilter/nf_conntrack_expect.h
+++ b/include/net/netfilter/nf_conntrack_expect.h
@@ -41,6 +41,9 @@ struct nf_conntrack_expect
41 /* Flags */ 41 /* Flags */
42 unsigned int flags; 42 unsigned int flags;
43 43
44 /* Expectation class */
45 unsigned int class;
46
44#ifdef CONFIG_NF_NAT_NEEDED 47#ifdef CONFIG_NF_NAT_NEEDED
45 __be32 saved_ip; 48 __be32 saved_ip;
46 /* This is the original per-proto part, used to map the 49 /* This is the original per-proto part, used to map the
@@ -53,7 +56,16 @@ struct nf_conntrack_expect
53 struct rcu_head rcu; 56 struct rcu_head rcu;
54}; 57};
55 58
56#define NF_CT_EXPECT_PERMANENT 0x1 59struct nf_conntrack_expect_policy
60{
61 unsigned int max_expected;
62 unsigned int timeout;
63};
64
65#define NF_CT_EXPECT_CLASS_DEFAULT 0
66
67#define NF_CT_EXPECT_PERMANENT 0x1
68#define NF_CT_EXPECT_INACTIVE 0x2
57 69
58int nf_conntrack_expect_init(void); 70int nf_conntrack_expect_init(void);
59void nf_conntrack_expect_fini(void); 71void nf_conntrack_expect_fini(void);
@@ -74,10 +86,10 @@ void nf_ct_unexpect_related(struct nf_conntrack_expect *exp);
74/* Allocate space for an expectation: this is mandatory before calling 86/* Allocate space for an expectation: this is mandatory before calling
75 nf_ct_expect_related. You will have to call put afterwards. */ 87 nf_ct_expect_related. You will have to call put afterwards. */
76struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); 88struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me);
77void nf_ct_expect_init(struct nf_conntrack_expect *, int, 89void nf_ct_expect_init(struct nf_conntrack_expect *, unsigned int, int,
78 union nf_inet_addr *, 90 const union nf_inet_addr *,
79 union nf_inet_addr *, 91 const union nf_inet_addr *,
80 u_int8_t, __be16 *, __be16 *); 92 u_int8_t, const __be16 *, const __be16 *);
81void nf_ct_expect_put(struct nf_conntrack_expect *exp); 93void nf_ct_expect_put(struct nf_conntrack_expect *exp);
82int nf_ct_expect_related(struct nf_conntrack_expect *expect); 94int nf_ct_expect_related(struct nf_conntrack_expect *expect);
83 95
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 4ca125e9b3ce..f8060ab5a083 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -20,9 +20,7 @@ struct nf_conntrack_helper
20 20
21 const char *name; /* name of the module */ 21 const char *name; /* name of the module */
22 struct module *me; /* pointer to self */ 22 struct module *me; /* pointer to self */
23 unsigned int max_expected; /* Maximum number of concurrent 23 const struct nf_conntrack_expect_policy *expect_policy;
24 * expected connections */
25 unsigned int timeout; /* timeout for expecteds */
26 24
27 /* Tuple of things we will help (compared against server response) */ 25 /* Tuple of things we will help (compared against server response) */
28 struct nf_conntrack_tuple tuple; 26 struct nf_conntrack_tuple tuple;
@@ -37,6 +35,7 @@ struct nf_conntrack_helper
37 void (*destroy)(struct nf_conn *ct); 35 void (*destroy)(struct nf_conn *ct);
38 36
39 int (*to_nlattr)(struct sk_buff *skb, const struct nf_conn *ct); 37 int (*to_nlattr)(struct sk_buff *skb, const struct nf_conn *ct);
38 unsigned int expect_class_max;
40}; 39};
41 40
42extern struct nf_conntrack_helper * 41extern struct nf_conntrack_helper *
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index b886e3ae6cad..0378676c3dd8 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -28,31 +28,20 @@ struct nf_conntrack_l3proto
28 * Try to fill in the third arg: nhoff is offset of l3 proto 28 * Try to fill in the third arg: nhoff is offset of l3 proto
29 * hdr. Return true if possible. 29 * hdr. Return true if possible.
30 */ 30 */
31 int (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff, 31 bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff,
32 struct nf_conntrack_tuple *tuple); 32 struct nf_conntrack_tuple *tuple);
33 33
34 /* 34 /*
35 * Invert the per-proto part of the tuple: ie. turn xmit into reply. 35 * Invert the per-proto part of the tuple: ie. turn xmit into reply.
36 * Some packets can't be inverted: return 0 in that case. 36 * Some packets can't be inverted: return 0 in that case.
37 */ 37 */
38 int (*invert_tuple)(struct nf_conntrack_tuple *inverse, 38 bool (*invert_tuple)(struct nf_conntrack_tuple *inverse,
39 const struct nf_conntrack_tuple *orig); 39 const struct nf_conntrack_tuple *orig);
40 40
41 /* Print out the per-protocol part of the tuple. */ 41 /* Print out the per-protocol part of the tuple. */
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 /* Returns verdict for packet, or -1 for invalid. */
46 int (*packet)(struct nf_conn *ct,
47 const struct sk_buff *skb,
48 enum ip_conntrack_info ctinfo);
49
50 /*
51 * Called when a new connection for this protocol found;
52 * returns TRUE if it's OK. If so, packet() called next.
53 */
54 int (*new)(struct nf_conn *ct, const struct sk_buff *skb);
55
56 /* 45 /*
57 * Called before tracking. 46 * Called before tracking.
58 * *dataoff: offset of protocol header (TCP, UDP,...) in skb 47 * *dataoff: offset of protocol header (TCP, UDP,...) in skb
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index efc16eccddb1..723df9d1cc35 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -25,15 +25,14 @@ struct nf_conntrack_l4proto
25 25
26 /* Try to fill in the third arg: dataoff is offset past network protocol 26 /* Try to fill in the third arg: dataoff is offset past network protocol
27 hdr. Return true if possible. */ 27 hdr. Return true if possible. */
28 int (*pkt_to_tuple)(const struct sk_buff *skb, 28 bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int dataoff,
29 unsigned int dataoff, 29 struct nf_conntrack_tuple *tuple);
30 struct nf_conntrack_tuple *tuple);
31 30
32 /* Invert the per-proto part of the tuple: ie. turn xmit into reply. 31 /* Invert the per-proto part of the tuple: ie. turn xmit into reply.
33 * Some packets can't be inverted: return 0 in that case. 32 * Some packets can't be inverted: return 0 in that case.
34 */ 33 */
35 int (*invert_tuple)(struct nf_conntrack_tuple *inverse, 34 bool (*invert_tuple)(struct nf_conntrack_tuple *inverse,
36 const struct nf_conntrack_tuple *orig); 35 const struct nf_conntrack_tuple *orig);
37 36
38 /* Returns verdict for packet, or -1 for invalid. */ 37 /* Returns verdict for packet, or -1 for invalid. */
39 int (*packet)(struct nf_conn *ct, 38 int (*packet)(struct nf_conn *ct,
@@ -45,8 +44,8 @@ struct nf_conntrack_l4proto
45 44
46 /* Called when a new connection for this protocol found; 45 /* Called when a new connection for this protocol found;
47 * returns TRUE if it's OK. If so, packet() called next. */ 46 * returns TRUE if it's OK. If so, packet() called next. */
48 int (*new)(struct nf_conn *ct, const struct sk_buff *skb, 47 bool (*new)(struct nf_conn *ct, const struct sk_buff *skb,
49 unsigned int dataoff); 48 unsigned int dataoff);
50 49
51 /* Called when a conntrack entry is destroyed */ 50 /* Called when a conntrack entry is destroyed */
52 void (*destroy)(struct nf_conn *ct); 51 void (*destroy)(struct nf_conn *ct);
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index e69ab2e87597..1bb7087833d3 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -41,6 +41,9 @@ union nf_conntrack_man_proto
41 } icmp; 41 } icmp;
42 struct { 42 struct {
43 __be16 port; 43 __be16 port;
44 } dccp;
45 struct {
46 __be16 port;
44 } sctp; 47 } sctp;
45 struct { 48 struct {
46 __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */ 49 __be16 key; /* GRE key is 32bit, PPtP only uses 16bit */
@@ -79,6 +82,9 @@ struct nf_conntrack_tuple
79 } icmp; 82 } icmp;
80 struct { 83 struct {
81 __be16 port; 84 __be16 port;
85 } dccp;
86 struct {
87 __be16 port;
82 } sctp; 88 } sctp;
83 struct { 89 struct {
84 __be16 key; 90 __be16 key;
@@ -113,11 +119,37 @@ struct nf_conntrack_tuple_mask
113 119
114#ifdef __KERNEL__ 120#ifdef __KERNEL__
115 121
116#define NF_CT_DUMP_TUPLE(tp) \ 122static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t)
117pr_debug("tuple %p: %u %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n", \ 123{
118 (tp), (tp)->src.l3num, (tp)->dst.protonum, \ 124#ifdef DEBUG
119 NIP6(*(struct in6_addr *)(tp)->src.u3.all), ntohs((tp)->src.u.all), \ 125 printk("tuple %p: %u " NIPQUAD_FMT ":%hu -> " NIPQUAD_FMT ":%hu\n",
120 NIP6(*(struct in6_addr *)(tp)->dst.u3.all), ntohs((tp)->dst.u.all)) 126 t, t->dst.protonum,
127 NIPQUAD(t->src.u3.ip), ntohs(t->src.u.all),
128 NIPQUAD(t->dst.u3.ip), ntohs(t->dst.u.all));
129#endif
130}
131
132static inline void nf_ct_dump_tuple_ipv6(const struct nf_conntrack_tuple *t)
133{
134#ifdef DEBUG
135 printk("tuple %p: %u " NIP6_FMT " %hu -> " NIP6_FMT " %hu\n",
136 t, t->dst.protonum,
137 NIP6(*(struct in6_addr *)t->src.u3.all), ntohs(t->src.u.all),
138 NIP6(*(struct in6_addr *)t->dst.u3.all), ntohs(t->dst.u.all));
139#endif
140}
141
142static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t)
143{
144 switch (t->src.l3num) {
145 case AF_INET:
146 nf_ct_dump_tuple_ip(t);
147 break;
148 case AF_INET6:
149 nf_ct_dump_tuple_ipv6(t);
150 break;
151 }
152}
121 153
122/* If we're the first tuple, it's the original dir. */ 154/* If we're the first tuple, it's the original dir. */
123#define NF_CT_DIRECTION(h) \ 155#define NF_CT_DIRECTION(h) \
@@ -132,70 +164,64 @@ struct nf_conntrack_tuple_hash
132 164
133#endif /* __KERNEL__ */ 165#endif /* __KERNEL__ */
134 166
135static inline int __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, 167static inline bool __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1,
136 const struct nf_conntrack_tuple *t2) 168 const struct nf_conntrack_tuple *t2)
137{ 169{
138 return (t1->src.u3.all[0] == t2->src.u3.all[0] && 170 return (nf_inet_addr_cmp(&t1->src.u3, &t2->src.u3) &&
139 t1->src.u3.all[1] == t2->src.u3.all[1] &&
140 t1->src.u3.all[2] == t2->src.u3.all[2] &&
141 t1->src.u3.all[3] == t2->src.u3.all[3] &&
142 t1->src.u.all == t2->src.u.all && 171 t1->src.u.all == t2->src.u.all &&
143 t1->src.l3num == t2->src.l3num); 172 t1->src.l3num == t2->src.l3num);
144} 173}
145 174
146static inline int __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, 175static inline bool __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1,
147 const struct nf_conntrack_tuple *t2) 176 const struct nf_conntrack_tuple *t2)
148{ 177{
149 return (t1->dst.u3.all[0] == t2->dst.u3.all[0] && 178 return (nf_inet_addr_cmp(&t1->dst.u3, &t2->dst.u3) &&
150 t1->dst.u3.all[1] == t2->dst.u3.all[1] &&
151 t1->dst.u3.all[2] == t2->dst.u3.all[2] &&
152 t1->dst.u3.all[3] == t2->dst.u3.all[3] &&
153 t1->dst.u.all == t2->dst.u.all && 179 t1->dst.u.all == t2->dst.u.all &&
154 t1->dst.protonum == t2->dst.protonum); 180 t1->dst.protonum == t2->dst.protonum);
155} 181}
156 182
157static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1, 183static inline bool nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1,
158 const struct nf_conntrack_tuple *t2) 184 const struct nf_conntrack_tuple *t2)
159{ 185{
160 return __nf_ct_tuple_src_equal(t1, t2) && 186 return __nf_ct_tuple_src_equal(t1, t2) &&
161 __nf_ct_tuple_dst_equal(t1, t2); 187 __nf_ct_tuple_dst_equal(t1, t2);
162} 188}
163 189
164static inline int nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1, 190static inline bool
165 const struct nf_conntrack_tuple_mask *m2) 191nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1,
192 const struct nf_conntrack_tuple_mask *m2)
166{ 193{
167 return (m1->src.u3.all[0] == m2->src.u3.all[0] && 194 return (nf_inet_addr_cmp(&m1->src.u3, &m2->src.u3) &&
168 m1->src.u3.all[1] == m2->src.u3.all[1] &&
169 m1->src.u3.all[2] == m2->src.u3.all[2] &&
170 m1->src.u3.all[3] == m2->src.u3.all[3] &&
171 m1->src.u.all == m2->src.u.all); 195 m1->src.u.all == m2->src.u.all);
172} 196}
173 197
174static inline int nf_ct_tuple_src_mask_cmp(const struct nf_conntrack_tuple *t1, 198static inline bool
175 const struct nf_conntrack_tuple *t2, 199nf_ct_tuple_src_mask_cmp(const struct nf_conntrack_tuple *t1,
176 const struct nf_conntrack_tuple_mask *mask) 200 const struct nf_conntrack_tuple *t2,
201 const struct nf_conntrack_tuple_mask *mask)
177{ 202{
178 int count; 203 int count;
179 204
180 for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++) { 205 for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++) {
181 if ((t1->src.u3.all[count] ^ t2->src.u3.all[count]) & 206 if ((t1->src.u3.all[count] ^ t2->src.u3.all[count]) &
182 mask->src.u3.all[count]) 207 mask->src.u3.all[count])
183 return 0; 208 return false;
184 } 209 }
185 210
186 if ((t1->src.u.all ^ t2->src.u.all) & mask->src.u.all) 211 if ((t1->src.u.all ^ t2->src.u.all) & mask->src.u.all)
187 return 0; 212 return false;
188 213
189 if (t1->src.l3num != t2->src.l3num || 214 if (t1->src.l3num != t2->src.l3num ||
190 t1->dst.protonum != t2->dst.protonum) 215 t1->dst.protonum != t2->dst.protonum)
191 return 0; 216 return false;
192 217
193 return 1; 218 return true;
194} 219}
195 220
196static inline int nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t, 221static inline bool
197 const struct nf_conntrack_tuple *tuple, 222nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t,
198 const struct nf_conntrack_tuple_mask *mask) 223 const struct nf_conntrack_tuple *tuple,
224 const struct nf_conntrack_tuple_mask *mask)
199{ 225{
200 return nf_ct_tuple_src_mask_cmp(t, tuple, mask) && 226 return nf_ct_tuple_src_mask_cmp(t, tuple, mask) &&
201 __nf_ct_tuple_dst_equal(t, tuple); 227 __nf_ct_tuple_dst_equal(t, tuple);
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 58dd22687949..237a961f40e1 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -24,6 +24,9 @@ extern int nf_nat_mangle_udp_packet(struct sk_buff *skb,
24extern int nf_nat_seq_adjust(struct sk_buff *skb, 24extern int nf_nat_seq_adjust(struct sk_buff *skb,
25 struct nf_conn *ct, 25 struct nf_conn *ct,
26 enum ip_conntrack_info ctinfo); 26 enum ip_conntrack_info ctinfo);
27extern int (*nf_nat_seq_adjust_hook)(struct sk_buff *skb,
28 struct nf_conn *ct,
29 enum ip_conntrack_info ctinfo);
27 30
28/* Setup NAT on this expected conntrack so it follows master, but goes 31/* Setup NAT on this expected conntrack so it follows master, but goes
29 * to port ct->master->saved_proto. */ 32 * to port ct->master->saved_proto. */
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h
index 4aa0edbb5b96..f3662c4394ef 100644
--- a/include/net/netfilter/nf_nat_protocol.h
+++ b/include/net/netfilter/nf_nat_protocol.h
@@ -8,9 +8,6 @@ struct nf_nat_range;
8 8
9struct nf_nat_protocol 9struct nf_nat_protocol
10{ 10{
11 /* Protocol name */
12 const char *name;
13
14 /* Protocol number. */ 11 /* Protocol number. */
15 unsigned int protonum; 12 unsigned int protonum;
16 13
@@ -18,25 +15,25 @@ struct nf_nat_protocol
18 15
19 /* Translate a packet to the target according to manip type. 16 /* Translate a packet to the target according to manip type.
20 Return true if succeeded. */ 17 Return true if succeeded. */
21 int (*manip_pkt)(struct sk_buff *skb, 18 bool (*manip_pkt)(struct sk_buff *skb,
22 unsigned int iphdroff, 19 unsigned int iphdroff,
23 const struct nf_conntrack_tuple *tuple, 20 const struct nf_conntrack_tuple *tuple,
24 enum nf_nat_manip_type maniptype); 21 enum nf_nat_manip_type maniptype);
25 22
26 /* Is the manipable part of the tuple between min and max incl? */ 23 /* Is the manipable part of the tuple between min and max incl? */
27 int (*in_range)(const struct nf_conntrack_tuple *tuple, 24 bool (*in_range)(const struct nf_conntrack_tuple *tuple,
28 enum nf_nat_manip_type maniptype, 25 enum nf_nat_manip_type maniptype,
29 const union nf_conntrack_man_proto *min, 26 const union nf_conntrack_man_proto *min,
30 const union nf_conntrack_man_proto *max); 27 const union nf_conntrack_man_proto *max);
31 28
32 /* Alter the per-proto part of the tuple (depending on 29 /* Alter the per-proto part of the tuple (depending on
33 maniptype), to give a unique tuple in the given range if 30 maniptype), to give a unique tuple in the given range if
34 possible; return false if not. Per-protocol part of tuple 31 possible; return false if not. Per-protocol part of tuple
35 is initialized to the incoming packet. */ 32 is initialized to the incoming packet. */
36 int (*unique_tuple)(struct nf_conntrack_tuple *tuple, 33 bool (*unique_tuple)(struct nf_conntrack_tuple *tuple,
37 const struct nf_nat_range *range, 34 const struct nf_nat_range *range,
38 enum nf_nat_manip_type maniptype, 35 enum nf_nat_manip_type maniptype,
39 const struct nf_conn *ct); 36 const struct nf_conn *ct);
40 37
41 int (*range_to_nlattr)(struct sk_buff *skb, 38 int (*range_to_nlattr)(struct sk_buff *skb,
42 const struct nf_nat_range *range); 39 const struct nf_nat_range *range);
@@ -62,9 +59,20 @@ extern int init_protocols(void) __init;
62extern void cleanup_protocols(void); 59extern void cleanup_protocols(void);
63extern const struct nf_nat_protocol *find_nat_proto(u_int16_t protonum); 60extern const struct nf_nat_protocol *find_nat_proto(u_int16_t protonum);
64 61
65extern int nf_nat_port_range_to_nlattr(struct sk_buff *skb, 62extern bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple,
66 const struct nf_nat_range *range); 63 enum nf_nat_manip_type maniptype,
67extern int nf_nat_port_nlattr_to_range(struct nlattr *tb[], 64 const union nf_conntrack_man_proto *min,
68 struct nf_nat_range *range); 65 const union nf_conntrack_man_proto *max);
66
67extern bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple,
68 const struct nf_nat_range *range,
69 enum nf_nat_manip_type maniptype,
70 const struct nf_conn *ct,
71 u_int16_t *rover);
72
73extern int nf_nat_proto_range_to_nlattr(struct sk_buff *skb,
74 const struct nf_nat_range *range);
75extern int nf_nat_proto_nlattr_to_range(struct nlattr *tb[],
76 struct nf_nat_range *range);
69 77
70#endif /*_NF_NAT_PROTO_H*/ 78#endif /*_NF_NAT_PROTO_H*/
diff --git a/include/net/netfilter/nf_nat_rule.h b/include/net/netfilter/nf_nat_rule.h
index 75d1825031d7..e4a18ae361c6 100644
--- a/include/net/netfilter/nf_nat_rule.h
+++ b/include/net/netfilter/nf_nat_rule.h
@@ -14,7 +14,4 @@ extern int nf_nat_rule_find(struct sk_buff *skb,
14 14
15extern unsigned int 15extern unsigned int
16alloc_null_binding(struct nf_conn *ct, unsigned int hooknum); 16alloc_null_binding(struct nf_conn *ct, unsigned int hooknum);
17
18extern unsigned int
19alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum);
20#endif /* _NF_NAT_RULE_H */ 17#endif /* _NF_NAT_RULE_H */
diff --git a/include/net/netlabel.h b/include/net/netlabel.h
index 0ca67d73c7ad..5e53a85b5ca1 100644
--- a/include/net/netlabel.h
+++ b/include/net/netlabel.h
@@ -162,7 +162,7 @@ struct netlbl_lsm_secattr_catmap {
162 162
163/** 163/**
164 * struct netlbl_lsm_secattr - NetLabel LSM security attributes 164 * struct netlbl_lsm_secattr - NetLabel LSM security attributes
165 * @flags: indicate which attributes are contained in this structure 165 * @flags: indicate structure attributes, see NETLBL_SECATTR_*
166 * @type: indicate the NLTYPE of the attributes 166 * @type: indicate the NLTYPE of the attributes
167 * @domain: the NetLabel LSM domain 167 * @domain: the NetLabel LSM domain
168 * @cache: NetLabel LSM specific cache 168 * @cache: NetLabel LSM specific cache
@@ -180,17 +180,22 @@ struct netlbl_lsm_secattr_catmap {
180 * NetLabel itself when returning security attributes to the LSM. 180 * NetLabel itself when returning security attributes to the LSM.
181 * 181 *
182 */ 182 */
183struct netlbl_lsm_secattr {
184 u32 flags;
185 /* bitmap values for 'flags' */
183#define NETLBL_SECATTR_NONE 0x00000000 186#define NETLBL_SECATTR_NONE 0x00000000
184#define NETLBL_SECATTR_DOMAIN 0x00000001 187#define NETLBL_SECATTR_DOMAIN 0x00000001
188#define NETLBL_SECATTR_DOMAIN_CPY (NETLBL_SECATTR_DOMAIN | \
189 NETLBL_SECATTR_FREE_DOMAIN)
185#define NETLBL_SECATTR_CACHE 0x00000002 190#define NETLBL_SECATTR_CACHE 0x00000002
186#define NETLBL_SECATTR_MLS_LVL 0x00000004 191#define NETLBL_SECATTR_MLS_LVL 0x00000004
187#define NETLBL_SECATTR_MLS_CAT 0x00000008 192#define NETLBL_SECATTR_MLS_CAT 0x00000008
188#define NETLBL_SECATTR_SECID 0x00000010 193#define NETLBL_SECATTR_SECID 0x00000010
194 /* bitmap meta-values for 'flags' */
195#define NETLBL_SECATTR_FREE_DOMAIN 0x01000000
189#define NETLBL_SECATTR_CACHEABLE (NETLBL_SECATTR_MLS_LVL | \ 196#define NETLBL_SECATTR_CACHEABLE (NETLBL_SECATTR_MLS_LVL | \
190 NETLBL_SECATTR_MLS_CAT | \ 197 NETLBL_SECATTR_MLS_CAT | \
191 NETLBL_SECATTR_SECID) 198 NETLBL_SECATTR_SECID)
192struct netlbl_lsm_secattr {
193 u32 flags;
194 u32 type; 199 u32 type;
195 char *domain; 200 char *domain;
196 struct netlbl_lsm_cache *cache; 201 struct netlbl_lsm_cache *cache;
@@ -303,7 +308,8 @@ static inline void netlbl_secattr_init(struct netlbl_lsm_secattr *secattr)
303 */ 308 */
304static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr) 309static inline void netlbl_secattr_destroy(struct netlbl_lsm_secattr *secattr)
305{ 310{
306 kfree(secattr->domain); 311 if (secattr->flags & NETLBL_SECATTR_FREE_DOMAIN)
312 kfree(secattr->domain);
307 if (secattr->flags & NETLBL_SECATTR_CACHE) 313 if (secattr->flags & NETLBL_SECATTR_CACHE)
308 netlbl_secattr_cache_free(secattr->cache); 314 netlbl_secattr_cache_free(secattr->cache);
309 if (secattr->flags & NETLBL_SECATTR_MLS_CAT) 315 if (secattr->flags & NETLBL_SECATTR_MLS_CAT)
diff --git a/include/net/netns/core.h b/include/net/netns/core.h
new file mode 100644
index 000000000000..24d4be76bbd1
--- /dev/null
+++ b/include/net/netns/core.h
@@ -0,0 +1,16 @@
1#ifndef __NETNS_CORE_H__
2#define __NETNS_CORE_H__
3
4struct ctl_table_header;
5struct prot_inuse;
6
7struct netns_core {
8 /* core sysctls */
9 struct ctl_table_header *sysctl_hdr;
10
11 int sysctl_somaxconn;
12
13 struct prot_inuse *inuse;
14};
15
16#endif
diff --git a/include/net/netns/dccp.h b/include/net/netns/dccp.h
new file mode 100644
index 000000000000..98d2a7ce1f71
--- /dev/null
+++ b/include/net/netns/dccp.h
@@ -0,0 +1,11 @@
1#ifndef __NETNS_DCCP_H__
2#define __NETNS_DCCP_H__
3
4struct sock;
5
6struct netns_dccp {
7 struct sock *v4_ctl_sk;
8 struct sock *v6_ctl_sk;
9};
10
11#endif
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
new file mode 100644
index 000000000000..0c04fd2a700b
--- /dev/null
+++ b/include/net/netns/generic.h
@@ -0,0 +1,49 @@
1/*
2 * generic net pointers
3 */
4
5#ifndef __NET_GENERIC_H__
6#define __NET_GENERIC_H__
7
8#include <linux/rcupdate.h>
9
10/*
11 * Generic net pointers are to be used by modules to put some private
12 * stuff on the struct net without explicit struct net modification
13 *
14 * The rules are simple:
15 * 1. register the ops with register_pernet_gen_device to get the id
16 * of your private pointer;
17 * 2. call net_assign_generic() to put the private data on the struct
18 * net (most preferably this should be done in the ->init callback
19 * of the ops registered);
20 * 3. do not change this pointer while the net is alive;
21 * 4. do not try to have any private reference on the net_generic object.
22 *
23 * After accomplishing all of the above, the private pointer can be
24 * accessed with the net_generic() call.
25 */
26
27struct net_generic {
28 unsigned int len;
29 struct rcu_head rcu;
30
31 void *ptr[0];
32};
33
34static inline void *net_generic(struct net *net, int id)
35{
36 struct net_generic *ng;
37 void *ptr;
38
39 rcu_read_lock();
40 ng = rcu_dereference(net->gen);
41 BUG_ON(id == 0 || id > ng->len);
42 ptr = ng->ptr[id - 1];
43 rcu_read_unlock();
44
45 return ptr;
46}
47
48extern int net_assign_generic(struct net *net, int id, void *data);
49#endif
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index a9b4f6086294..34ee348a2cf2 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -17,6 +17,7 @@ struct netns_ipv4 {
17#ifdef CONFIG_SYSCTL 17#ifdef CONFIG_SYSCTL
18 struct ctl_table_header *forw_hdr; 18 struct ctl_table_header *forw_hdr;
19 struct ctl_table_header *frags_hdr; 19 struct ctl_table_header *frags_hdr;
20 struct ctl_table_header *ipv4_hdr;
20#endif 21#endif
21 struct ipv4_devconf *devconf_all; 22 struct ipv4_devconf *devconf_all;
22 struct ipv4_devconf *devconf_dflt; 23 struct ipv4_devconf *devconf_dflt;
@@ -26,6 +27,9 @@ struct netns_ipv4 {
26 struct hlist_head *fib_table_hash; 27 struct hlist_head *fib_table_hash;
27 struct sock *fibnl; 28 struct sock *fibnl;
28 29
30 struct sock **icmp_sk;
31 struct sock *tcp_sock;
32
29 struct netns_frags frags; 33 struct netns_frags frags;
30#ifdef CONFIG_NETFILTER 34#ifdef CONFIG_NETFILTER
31 struct xt_table *iptable_filter; 35 struct xt_table *iptable_filter;
@@ -33,5 +37,12 @@ struct netns_ipv4 {
33 struct xt_table *iptable_raw; 37 struct xt_table *iptable_raw;
34 struct xt_table *arptable_filter; 38 struct xt_table *arptable_filter;
35#endif 39#endif
40
41 int sysctl_icmp_echo_ignore_all;
42 int sysctl_icmp_echo_ignore_broadcasts;
43 int sysctl_icmp_ignore_bogus_error_responses;
44 int sysctl_icmp_ratelimit;
45 int sysctl_icmp_ratemask;
46 int sysctl_icmp_errors_use_inbound_ifaddr;
36}; 47};
37#endif 48#endif
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h
index 1dd7de4e4195..ac053be6c256 100644
--- a/include/net/netns/ipv6.h
+++ b/include/net/netns/ipv6.h
@@ -36,5 +36,23 @@ struct netns_ipv6 {
36 struct xt_table *ip6table_mangle; 36 struct xt_table *ip6table_mangle;
37 struct xt_table *ip6table_raw; 37 struct xt_table *ip6table_raw;
38#endif 38#endif
39 struct rt6_info *ip6_null_entry;
40 struct rt6_statistics *rt6_stats;
41 struct timer_list *ip6_fib_timer;
42 struct hlist_head *fib_table_hash;
43 struct fib6_table *fib6_main_tbl;
44 struct dst_ops *ip6_dst_ops;
45 unsigned int ip6_rt_gc_expire;
46 unsigned long ip6_rt_last_gc;
47#ifdef CONFIG_IPV6_MULTIPLE_TABLES
48 struct rt6_info *ip6_prohibit_entry;
49 struct rt6_info *ip6_blk_hole_entry;
50 struct fib6_table *fib6_local_tbl;
51 struct fib_rules_ops *fib6_rules_ops;
52#endif
53 struct sock **icmp_sk;
54 struct sock *ndisc_sk;
55 struct sock *tcp_sk;
56 struct sock *igmp_sk;
39}; 57};
40#endif 58#endif
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index d349c66ef828..aa9e282db485 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -353,7 +353,7 @@ tcf_match_indev(struct sk_buff *skb, char *indev)
353 if (indev[0]) { 353 if (indev[0]) {
354 if (!skb->iif) 354 if (!skb->iif)
355 return 0; 355 return 0;
356 dev = __dev_get_by_index(&init_net, skb->iif); 356 dev = __dev_get_by_index(dev_net(skb->dev), skb->iif);
357 if (!dev || strcmp(indev, dev->name)) 357 if (!dev || strcmp(indev, dev->name))
358 return 0; 358 return 0;
359 } 359 }
diff --git a/include/net/protocol.h b/include/net/protocol.h
index ad8c584233a6..8d024d7cb741 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -39,7 +39,8 @@ struct net_protocol {
39 int (*gso_send_check)(struct sk_buff *skb); 39 int (*gso_send_check)(struct sk_buff *skb);
40 struct sk_buff *(*gso_segment)(struct sk_buff *skb, 40 struct sk_buff *(*gso_segment)(struct sk_buff *skb,
41 int features); 41 int features);
42 int no_policy; 42 unsigned int no_policy:1,
43 netns_ok:1;
43}; 44};
44 45
45#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) 46#if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE)
diff --git a/include/net/raw.h b/include/net/raw.h
index 1828f81fe374..6c14a656357a 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -53,7 +53,7 @@ int raw_seq_open(struct inode *ino, struct file *file,
53 53
54#endif 54#endif
55 55
56void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h); 56void raw_hash_sk(struct sock *sk);
57void raw_unhash_sk(struct sock *sk, struct raw_hashinfo *h); 57void raw_unhash_sk(struct sock *sk);
58 58
59#endif /* _RAW_H */ 59#endif /* _RAW_H */
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index cff4608179c1..b220b5f624de 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -31,8 +31,7 @@ struct request_sock_ops {
31 int obj_size; 31 int obj_size;
32 struct kmem_cache *slab; 32 struct kmem_cache *slab;
33 int (*rtx_syn_ack)(struct sock *sk, 33 int (*rtx_syn_ack)(struct sock *sk,
34 struct request_sock *req, 34 struct request_sock *req);
35 struct dst_entry *dst);
36 void (*send_ack)(struct sk_buff *skb, 35 void (*send_ack)(struct sk_buff *skb,
37 struct request_sock *req); 36 struct request_sock *req);
38 void (*send_reset)(struct sock *sk, 37 void (*send_reset)(struct sock *sk,
@@ -46,7 +45,7 @@ struct request_sock {
46 struct request_sock *dl_next; /* Must be first member! */ 45 struct request_sock *dl_next; /* Must be first member! */
47 u16 mss; 46 u16 mss;
48 u8 retrans; 47 u8 retrans;
49 u8 __pad; 48 u8 cookie_ts; /* syncookie: encode tcpopts in timestamp */
50 /* The following two fields can be easily recomputed I think -AK */ 49 /* The following two fields can be easily recomputed I think -AK */
51 u32 window_clamp; /* window clamp at creation time */ 50 u32 window_clamp; /* window clamp at creation time */
52 u32 rcv_wnd; /* rcv_wnd offered first time */ 51 u32 rcv_wnd; /* rcv_wnd offered first time */
@@ -116,8 +115,8 @@ struct request_sock_queue {
116 struct request_sock *rskq_accept_head; 115 struct request_sock *rskq_accept_head;
117 struct request_sock *rskq_accept_tail; 116 struct request_sock *rskq_accept_tail;
118 rwlock_t syn_wait_lock; 117 rwlock_t syn_wait_lock;
119 u8 rskq_defer_accept; 118 u16 rskq_defer_accept;
120 /* 3 bytes hole, try to pack */ 119 /* 2 bytes hole, try to pack */
121 struct listen_sock *listen_opt; 120 struct listen_sock *listen_opt;
122}; 121};
123 122
diff --git a/include/net/route.h b/include/net/route.h
index eadad5901429..c6338802e8f1 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -34,7 +34,6 @@
34#include <linux/ip.h> 34#include <linux/ip.h>
35#include <linux/cache.h> 35#include <linux/cache.h>
36#include <linux/security.h> 36#include <linux/security.h>
37#include <net/sock.h>
38 37
39#ifndef __KERNEL__ 38#ifndef __KERNEL__
40#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.
@@ -161,7 +160,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst,
161 .dport = dport } } }; 160 .dport = dport } } };
162 161
163 int err; 162 int err;
164 struct net *net = sk->sk_net; 163 struct net *net = sock_net(sk);
165 if (!dst || !src) { 164 if (!dst || !src) {
166 err = __ip_route_output_key(net, rp, &fl); 165 err = __ip_route_output_key(net, rp, &fl);
167 if (err) 166 if (err)
@@ -189,7 +188,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol,
189 ip_rt_put(*rp); 188 ip_rt_put(*rp);
190 *rp = NULL; 189 *rp = NULL;
191 security_sk_classify_flow(sk, &fl); 190 security_sk_classify_flow(sk, &fl);
192 return ip_route_output_flow(sk->sk_net, rp, &fl, sk, 0); 191 return ip_route_output_flow(sock_net(sk), rp, &fl, sk, 0);
193 } 192 }
194 return 0; 193 return 0;
195} 194}
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 793863e09c69..3c1895e54b7f 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -74,6 +74,7 @@ struct rtnl_link_ops {
74 74
75extern int __rtnl_link_register(struct rtnl_link_ops *ops); 75extern int __rtnl_link_register(struct rtnl_link_ops *ops);
76extern void __rtnl_link_unregister(struct rtnl_link_ops *ops); 76extern void __rtnl_link_unregister(struct rtnl_link_ops *ops);
77extern void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops);
77 78
78extern int rtnl_link_register(struct rtnl_link_ops *ops); 79extern int rtnl_link_register(struct rtnl_link_ops *ops);
79extern void rtnl_link_unregister(struct rtnl_link_ops *ops); 80extern void rtnl_link_unregister(struct rtnl_link_ops *ops);
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h
index 35b1e83fb96a..88988ab03d75 100644
--- a/include/net/sctp/command.h
+++ b/include/net/sctp/command.h
@@ -206,12 +206,11 @@ typedef struct {
206int sctp_init_cmd_seq(sctp_cmd_seq_t *seq); 206int sctp_init_cmd_seq(sctp_cmd_seq_t *seq);
207 207
208/* Add a command to an sctp_cmd_seq_t. 208/* Add a command to an sctp_cmd_seq_t.
209 * Return 0 if the command sequence is full.
210 * 209 *
211 * Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above 210 * Use the SCTP_* constructors defined by SCTP_ARG_CONSTRUCTOR() above
212 * to wrap data which goes in the obj argument. 211 * to wrap data which goes in the obj argument.
213 */ 212 */
214int sctp_add_cmd(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj); 213void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj);
215 214
216/* Return the next command structure in an sctp_cmd_seq. 215/* Return the next command structure in an sctp_cmd_seq.
217 * Return NULL at the end of the sequence. 216 * Return NULL at the end of the sequence.
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index ea806732b084..90b1e8d23b16 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -368,11 +368,6 @@ void sctp_sysctl_unregister(void);
368#else 368#else
369static inline void sctp_sysctl_register(void) { return; } 369static inline void sctp_sysctl_register(void) { return; }
370static inline void sctp_sysctl_unregister(void) { return; } 370static inline void sctp_sysctl_unregister(void) { return; }
371static inline int sctp_sysctl_jiffies_ms(ctl_table *table, int __user *name, int nlen,
372 void __user *oldval, size_t __user *oldlenp,
373 void __user *newval, size_t newlen) {
374 return -ENOSYS;
375}
376#endif 371#endif
377 372
378/* Size of Supported Address Parameter for 'x' address types. */ 373/* Size of Supported Address Parameter for 'x' address types. */
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h
index ef9e7ed2c82e..24811732bdb2 100644
--- a/include/net/sctp/sm.h
+++ b/include/net/sctp/sm.h
@@ -385,14 +385,6 @@ static inline int ADDIP_SERIAL_gte(__u16 s, __u16 t)
385 return (((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT)); 385 return (((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT));
386} 386}
387 387
388
389/* Run sctp_add_cmd() generating a BUG() if there is a failure. */
390static inline void sctp_add_cmd_sf(sctp_cmd_seq_t *seq, sctp_verb_t verb, sctp_arg_t obj)
391{
392 if (unlikely(!sctp_add_cmd(seq, verb, obj)))
393 BUG();
394}
395
396/* Check VTAG of the packet matches the sender's own tag. */ 388/* Check VTAG of the packet matches the sender's own tag. */
397static inline int 389static inline int
398sctp_vtag_verify(const struct sctp_chunk *chunk, 390sctp_vtag_verify(const struct sctp_chunk *chunk,
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index 9c827a749b6f..0ce0443c5b79 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -637,8 +637,6 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,
637 struct sctp_sndrcvinfo *, 637 struct sctp_sndrcvinfo *,
638 struct msghdr *, int len); 638 struct msghdr *, int len);
639void sctp_datamsg_put(struct sctp_datamsg *); 639void sctp_datamsg_put(struct sctp_datamsg *);
640void sctp_datamsg_free(struct sctp_datamsg *);
641void sctp_datamsg_track(struct sctp_chunk *);
642void sctp_chunk_fail(struct sctp_chunk *, int error); 640void sctp_chunk_fail(struct sctp_chunk *, int error);
643int sctp_chunk_abandoned(struct sctp_chunk *); 641int sctp_chunk_abandoned(struct sctp_chunk *);
644 642
@@ -1661,6 +1659,9 @@ struct sctp_association {
1661 /* Transport to which SHUTDOWN chunk was last sent. */ 1659 /* Transport to which SHUTDOWN chunk was last sent. */
1662 struct sctp_transport *shutdown_last_sent_to; 1660 struct sctp_transport *shutdown_last_sent_to;
1663 1661
1662 /* How many times have we resent a SHUTDOWN */
1663 int shutdown_retries;
1664
1664 /* Transport to which INIT chunk was last sent. */ 1665 /* Transport to which INIT chunk was last sent. */
1665 struct sctp_transport *init_last_sent_to; 1666 struct sctp_transport *init_last_sent_to;
1666 1667
@@ -1695,6 +1696,11 @@ struct sctp_association {
1695 */ 1696 */
1696 __u16 unack_data; 1697 __u16 unack_data;
1697 1698
1699 /* The total number of data chunks that we've had to retransmit
1700 * as the result of a T3 timer expiration
1701 */
1702 __u32 rtx_data_chunks;
1703
1698 /* This is the association's receive buffer space. This value is used 1704 /* This is the association's receive buffer space. This value is used
1699 * to set a_rwnd field in an INIT or a SACK chunk. 1705 * to set a_rwnd field in an INIT or a SACK chunk.
1700 */ 1706 */
diff --git a/include/net/sock.h b/include/net/sock.h
index fd9876087651..dc42b44c2aa1 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -47,7 +47,6 @@
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>
51#include <linux/skbuff.h> /* struct sk_buff */ 50#include <linux/skbuff.h> /* struct sk_buff */
52#include <linux/mm.h> 51#include <linux/mm.h>
53#include <linux/security.h> 52#include <linux/security.h>
@@ -70,7 +69,11 @@
70#define SOCK_DEBUG(sk, msg...) do { if ((sk) && sock_flag((sk), SOCK_DBG)) \ 69#define SOCK_DEBUG(sk, msg...) do { if ((sk) && sock_flag((sk), SOCK_DBG)) \
71 printk(KERN_DEBUG msg); } while (0) 70 printk(KERN_DEBUG msg); } while (0)
72#else 71#else
73#define SOCK_DEBUG(sk, msg...) do { } while (0) 72/* Validate arguments and do nothing */
73static void inline int __attribute__ ((format (printf, 2, 3)))
74SOCK_DEBUG(struct sock *sk, const char *msg, ...)
75{
76}
74#endif 77#endif
75 78
76/* This is the per-socket lock. The spinlock provides a synchronization 79/* This is the per-socket lock. The spinlock provides a synchronization
@@ -122,7 +125,9 @@ struct sock_common {
122 atomic_t skc_refcnt; 125 atomic_t skc_refcnt;
123 unsigned int skc_hash; 126 unsigned int skc_hash;
124 struct proto *skc_prot; 127 struct proto *skc_prot;
128#ifdef CONFIG_NET_NS
125 struct net *skc_net; 129 struct net *skc_net;
130#endif
126}; 131};
127 132
128/** 133/**
@@ -151,6 +156,7 @@ struct sock_common {
151 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets 156 * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
152 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) 157 * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
153 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) 158 * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
159 * @sk_gso_max_size: Maximum GSO segment size to build
154 * @sk_lingertime: %SO_LINGER l_linger setting 160 * @sk_lingertime: %SO_LINGER l_linger setting
155 * @sk_backlog: always used with the per-socket spinlock held 161 * @sk_backlog: always used with the per-socket spinlock held
156 * @sk_callback_lock: used with the callbacks in the end of this struct 162 * @sk_callback_lock: used with the callbacks in the end of this struct
@@ -237,6 +243,7 @@ struct sock {
237 gfp_t sk_allocation; 243 gfp_t sk_allocation;
238 int sk_route_caps; 244 int sk_route_caps;
239 int sk_gso_type; 245 int sk_gso_type;
246 unsigned int sk_gso_max_size;
240 int sk_rcvlowat; 247 int sk_rcvlowat;
241 unsigned long sk_flags; 248 unsigned long sk_flags;
242 unsigned long sk_lingertime; 249 unsigned long sk_lingertime;
@@ -498,6 +505,7 @@ extern int sk_wait_data(struct sock *sk, long *timeo);
498struct request_sock_ops; 505struct request_sock_ops;
499struct timewait_sock_ops; 506struct timewait_sock_ops;
500struct inet_hashinfo; 507struct inet_hashinfo;
508struct raw_hashinfo;
501 509
502/* Networking protocol blocks we attach to sockets. 510/* Networking protocol blocks we attach to sockets.
503 * socket layer -> transport layer interface 511 * socket layer -> transport layer interface
@@ -553,7 +561,7 @@ struct proto {
553 561
554 /* Keeping track of sockets in use */ 562 /* Keeping track of sockets in use */
555#ifdef CONFIG_PROC_FS 563#ifdef CONFIG_PROC_FS
556 struct pcounter inuse; 564 unsigned int inuse_idx;
557#endif 565#endif
558 566
559 /* Memory pressure */ 567 /* Memory pressure */
@@ -580,7 +588,11 @@ struct proto {
580 struct request_sock_ops *rsk_prot; 588 struct request_sock_ops *rsk_prot;
581 struct timewait_sock_ops *twsk_prot; 589 struct timewait_sock_ops *twsk_prot;
582 590
583 struct inet_hashinfo *hashinfo; 591 union {
592 struct inet_hashinfo *hashinfo;
593 struct hlist_head *udp_hash;
594 struct raw_hashinfo *raw_hash;
595 } h;
584 596
585 struct module *owner; 597 struct module *owner;
586 598
@@ -622,36 +634,12 @@ static inline void sk_refcnt_debug_release(const struct sock *sk)
622 634
623 635
624#ifdef CONFIG_PROC_FS 636#ifdef CONFIG_PROC_FS
625# define DEFINE_PROTO_INUSE(NAME) DEFINE_PCOUNTER(NAME)
626# define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse)
627/* Called with local bh disabled */ 637/* Called with local bh disabled */
628static inline void sock_prot_inuse_add(struct proto *prot, int inc) 638extern void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc);
629{ 639extern int sock_prot_inuse_get(struct net *net, struct proto *proto);
630 pcounter_add(&prot->inuse, inc);
631}
632static inline int sock_prot_inuse_init(struct proto *proto)
633{
634 return pcounter_alloc(&proto->inuse);
635}
636static inline int sock_prot_inuse_get(struct proto *proto)
637{
638 return pcounter_getval(&proto->inuse);
639}
640static inline void sock_prot_inuse_free(struct proto *proto)
641{
642 pcounter_free(&proto->inuse);
643}
644#else 640#else
645# define DEFINE_PROTO_INUSE(NAME) 641static void inline sock_prot_inuse_add(struct net *net, struct proto *prot,
646# define REF_PROTO_INUSE(NAME) 642 int inc)
647static void inline sock_prot_inuse_add(struct proto *prot, int inc)
648{
649}
650static int inline sock_prot_inuse_init(struct proto *proto)
651{
652 return 0;
653}
654static void inline sock_prot_inuse_free(struct proto *proto)
655{ 643{
656} 644}
657#endif 645#endif
@@ -850,6 +838,7 @@ extern struct sock *sk_alloc(struct net *net, int family,
850 gfp_t priority, 838 gfp_t priority,
851 struct proto *prot); 839 struct proto *prot);
852extern void sk_free(struct sock *sk); 840extern void sk_free(struct sock *sk);
841extern void sk_release_kernel(struct sock *sk);
853extern struct sock *sk_clone(const struct sock *sk, 842extern struct sock *sk_clone(const struct sock *sk,
854 const gfp_t priority); 843 const gfp_t priority);
855 844
@@ -939,41 +928,6 @@ extern void sk_common_release(struct sock *sk);
939extern void sock_init_data(struct socket *sock, struct sock *sk); 928extern void sock_init_data(struct socket *sock, struct sock *sk);
940 929
941/** 930/**
942 * sk_filter - run a packet through a socket filter
943 * @sk: sock associated with &sk_buff
944 * @skb: buffer to filter
945 * @needlock: set to 1 if the sock is not locked by caller.
946 *
947 * Run the filter code and then cut skb->data to correct size returned by
948 * sk_run_filter. If pkt_len is 0 we toss packet. If skb->len is smaller
949 * than pkt_len we keep whole skb->data. This is the socket level
950 * wrapper to sk_run_filter. It returns 0 if the packet should
951 * be accepted or -EPERM if the packet should be tossed.
952 *
953 */
954
955static inline int sk_filter(struct sock *sk, struct sk_buff *skb)
956{
957 int err;
958 struct sk_filter *filter;
959
960 err = security_sock_rcv_skb(sk, skb);
961 if (err)
962 return err;
963
964 rcu_read_lock_bh();
965 filter = rcu_dereference(sk->sk_filter);
966 if (filter) {
967 unsigned int pkt_len = sk_run_filter(skb, filter->insns,
968 filter->len);
969 err = pkt_len ? pskb_trim(skb, pkt_len) : -EPERM;
970 }
971 rcu_read_unlock_bh();
972
973 return err;
974}
975
976/**
977 * sk_filter_release: Release a socket filter 931 * sk_filter_release: Release a socket filter
978 * @sk: socket 932 * @sk: socket
979 * @fp: filter to remove 933 * @fp: filter to remove
@@ -1333,6 +1287,36 @@ static inline void sk_eat_skb(struct sock *sk, struct sk_buff *skb, int copied_e
1333} 1287}
1334#endif 1288#endif
1335 1289
1290static inline
1291struct net *sock_net(const struct sock *sk)
1292{
1293#ifdef CONFIG_NET_NS
1294 return sk->sk_net;
1295#else
1296 return &init_net;
1297#endif
1298}
1299
1300static inline
1301void sock_net_set(struct sock *sk, struct net *net)
1302{
1303#ifdef CONFIG_NET_NS
1304 sk->sk_net = net;
1305#endif
1306}
1307
1308/*
1309 * Kernel sockets, f.e. rtnl or icmp_socket, are a part of a namespace.
1310 * They should not hold a referrence to a namespace in order to allow
1311 * to stop it.
1312 * Sockets after sk_change_net should be released using sk_release_kernel
1313 */
1314static inline void sk_change_net(struct sock *sk, struct net *net)
1315{
1316 put_net(sock_net(sk));
1317 sock_net_set(sk, hold_net(net));
1318}
1319
1336extern void sock_enable_timestamp(struct sock *sk); 1320extern void sock_enable_timestamp(struct sock *sk);
1337extern int sock_get_timestamp(struct sock *, struct timeval __user *); 1321extern int sock_get_timestamp(struct sock *, struct timeval __user *);
1338extern int sock_get_timestampns(struct sock *, struct timespec __user *); 1322extern int sock_get_timestampns(struct sock *, struct timespec __user *);
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 4fd3eb2f8ec2..633147cb6bbc 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -29,6 +29,7 @@
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30#include <linux/dmaengine.h> 30#include <linux/dmaengine.h>
31#include <linux/crypto.h> 31#include <linux/crypto.h>
32#include <linux/cryptohash.h>
32 33
33#include <net/inet_connection_sock.h> 34#include <net/inet_connection_sock.h>
34#include <net/inet_timewait_sock.h> 35#include <net/inet_timewait_sock.h>
@@ -138,6 +139,7 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
138#define MAX_TCP_KEEPINTVL 32767 139#define MAX_TCP_KEEPINTVL 32767
139#define MAX_TCP_KEEPCNT 127 140#define MAX_TCP_KEEPCNT 127
140#define MAX_TCP_SYNCNT 127 141#define MAX_TCP_SYNCNT 127
142#define MAX_TCP_ACCEPT_DEFERRED 65535
141 143
142#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */ 144#define TCP_SYNQ_INTERVAL (HZ/5) /* Period of SYNACK timer */
143 145
@@ -434,11 +436,20 @@ extern int tcp_disconnect(struct sock *sk, int flags);
434extern void tcp_unhash(struct sock *sk); 436extern void tcp_unhash(struct sock *sk);
435 437
436/* From syncookies.c */ 438/* From syncookies.c */
439extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
437extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 440extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
438 struct ip_options *opt); 441 struct ip_options *opt);
439extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, 442extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
440 __u16 *mss); 443 __u16 *mss);
441 444
445extern __u32 cookie_init_timestamp(struct request_sock *req);
446extern void cookie_check_timestamp(struct tcp_options_received *tcp_opt);
447
448/* From net/ipv6/syncookies.c */
449extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
450extern __u32 cookie_v6_init_sequence(struct sock *sk, struct sk_buff *skb,
451 __u16 *mss);
452
442/* tcp_output.c */ 453/* tcp_output.c */
443 454
444extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, 455extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
@@ -776,11 +787,14 @@ extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
776extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); 787extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst);
777 788
778/* Slow start with delack produces 3 packets of burst, so that 789/* Slow start with delack produces 3 packets of burst, so that
779 * it is safe "de facto". 790 * it is safe "de facto". This will be the default - same as
791 * the default reordering threshold - but if reordering increases,
792 * we must be able to allow cwnd to burst at least this much in order
793 * to not pull it back when holes are filled.
780 */ 794 */
781static __inline__ __u32 tcp_max_burst(const struct tcp_sock *tp) 795static __inline__ __u32 tcp_max_burst(const struct tcp_sock *tp)
782{ 796{
783 return 3; 797 return tp->reordering;
784} 798}
785 799
786/* Returns end sequence number of the receiver's advertised window */ 800/* Returns end sequence number of the receiver's advertised window */
@@ -950,6 +964,7 @@ static inline void tcp_openreq_init(struct request_sock *req,
950 struct inet_request_sock *ireq = inet_rsk(req); 964 struct inet_request_sock *ireq = inet_rsk(req);
951 965
952 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */ 966 req->rcv_wnd = 0; /* So that tcp_send_synack() knows! */
967 req->cookie_ts = 0;
953 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq; 968 tcp_rsk(req)->rcv_isn = TCP_SKB_CB(skb)->seq;
954 req->mss = rx_opt->mss_clamp; 969 req->mss = rx_opt->mss_clamp;
955 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0; 970 req->ts_recent = rx_opt->saw_tstamp ? rx_opt->rcv_tsval : 0;
@@ -1237,7 +1252,7 @@ static inline void tcp_insert_write_queue_after(struct sk_buff *skb,
1237 struct sk_buff *buff, 1252 struct sk_buff *buff,
1238 struct sock *sk) 1253 struct sock *sk)
1239{ 1254{
1240 __skb_append(skb, buff, &sk->sk_write_queue); 1255 __skb_queue_after(&sk->sk_write_queue, skb, buff);
1241} 1256}
1242 1257
1243/* Insert skb between prev and next on the write queue of sk. */ 1258/* Insert skb between prev and next on the write queue of sk. */
@@ -1315,25 +1330,25 @@ enum tcp_seq_states {
1315}; 1330};
1316 1331
1317struct tcp_seq_afinfo { 1332struct tcp_seq_afinfo {
1318 struct module *owner;
1319 char *name; 1333 char *name;
1320 sa_family_t family; 1334 sa_family_t family;
1321 int (*seq_show) (struct seq_file *m, void *v); 1335 struct file_operations seq_fops;
1322 struct file_operations *seq_fops; 1336 struct seq_operations seq_ops;
1323}; 1337};
1324 1338
1325struct tcp_iter_state { 1339struct tcp_iter_state {
1340 struct seq_net_private p;
1326 sa_family_t family; 1341 sa_family_t family;
1327 enum tcp_seq_states state; 1342 enum tcp_seq_states state;
1328 struct sock *syn_wait_sk; 1343 struct sock *syn_wait_sk;
1329 int bucket, sbucket, num, uid; 1344 int bucket, sbucket, num, uid;
1330 struct seq_operations seq_ops;
1331}; 1345};
1332 1346
1333extern int tcp_proc_register(struct tcp_seq_afinfo *afinfo); 1347extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
1334extern void tcp_proc_unregister(struct tcp_seq_afinfo *afinfo); 1348extern void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo);
1335 1349
1336extern struct request_sock_ops tcp_request_sock_ops; 1350extern struct request_sock_ops tcp_request_sock_ops;
1351extern struct request_sock_ops tcp6_request_sock_ops;
1337 1352
1338extern int tcp_v4_destroy_sock(struct sock *sk); 1353extern int tcp_v4_destroy_sock(struct sock *sk);
1339 1354
@@ -1375,7 +1390,7 @@ struct tcp_request_sock_ops {
1375#endif 1390#endif
1376}; 1391};
1377 1392
1378extern void tcp_v4_init(struct net_proto_family *ops); 1393extern void tcp_v4_init(void);
1379extern void tcp_init(void); 1394extern void tcp_init(void);
1380 1395
1381#endif /* _TCP_H */ 1396#endif /* _TCP_H */
diff --git a/include/net/tipc/tipc_bearer.h b/include/net/tipc/tipc_bearer.h
index 2151a80cdf30..ee2f304e4919 100644
--- a/include/net/tipc/tipc_bearer.h
+++ b/include/net/tipc/tipc_bearer.h
@@ -99,6 +99,9 @@ struct tipc_bearer {
99 char name[TIPC_MAX_BEARER_NAME]; 99 char name[TIPC_MAX_BEARER_NAME];
100}; 100};
101 101
102/*
103 * TIPC routines available to supported media types
104 */
102 105
103int tipc_register_media(u32 media_type, 106int tipc_register_media(u32 media_type,
104 char *media_name, 107 char *media_name,
@@ -123,6 +126,12 @@ void tipc_continue(struct tipc_bearer *tb_ptr);
123int tipc_enable_bearer(const char *bearer_name, u32 bcast_scope, u32 priority); 126int tipc_enable_bearer(const char *bearer_name, u32 bcast_scope, u32 priority);
124int tipc_disable_bearer(const char *name); 127int tipc_disable_bearer(const char *name);
125 128
129/*
130 * Routines made available to TIPC by supported media types
131 */
132
133int tipc_eth_media_start(void);
134void tipc_eth_media_stop(void);
126 135
127#endif 136#endif
128 137
diff --git a/include/net/tipc/tipc_port.h b/include/net/tipc/tipc_port.h
index cfc4ba46de8f..11105bcc4457 100644
--- a/include/net/tipc/tipc_port.h
+++ b/include/net/tipc/tipc_port.h
@@ -86,13 +86,6 @@ u32 tipc_createport_raw(void *usr_handle,
86 void (*wakeup)(struct tipc_port *), 86 void (*wakeup)(struct tipc_port *),
87 const u32 importance); 87 const u32 importance);
88 88
89/*
90 * tipc_set_msg_option(): port must be locked.
91 */
92int tipc_set_msg_option(struct tipc_port *tp_ptr,
93 const char *opt,
94 const u32 len);
95
96int tipc_reject_msg(struct sk_buff *buf, u32 err); 89int tipc_reject_msg(struct sk_buff *buf, u32 err);
97 90
98int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode); 91int tipc_send_buf_fast(struct sk_buff *buf, u32 destnode);
@@ -103,6 +96,12 @@ struct tipc_port *tipc_get_port(const u32 ref);
103 96
104void *tipc_get_handle(const u32 ref); 97void *tipc_get_handle(const u32 ref);
105 98
99/*
100 * The following routines require that the port be locked on entry
101 */
102
103int tipc_disconnect_port(struct tipc_port *tp_ptr);
104
106 105
107#endif 106#endif
108 107
diff --git a/include/net/udp.h b/include/net/udp.h
index c6669c0a74c7..3e55a99b0ba3 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -115,7 +115,7 @@ static inline void udp_lib_unhash(struct sock *sk)
115 write_lock_bh(&udp_hash_lock); 115 write_lock_bh(&udp_hash_lock);
116 if (sk_del_node_init(sk)) { 116 if (sk_del_node_init(sk)) {
117 inet_sk(sk)->num = 0; 117 inet_sk(sk)->num = 0;
118 sock_prot_inuse_add(sk->sk_prot, -1); 118 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
119 } 119 }
120 write_unlock_bh(&udp_hash_lock); 120 write_unlock_bh(&udp_hash_lock);
121} 121}
@@ -125,6 +125,8 @@ static inline void udp_lib_close(struct sock *sk, long timeout)
125 sk_common_release(sk); 125 sk_common_release(sk);
126} 126}
127 127
128extern int udp_lib_get_port(struct sock *sk, unsigned short snum,
129 int (*)(const struct sock*,const struct sock*));
128 130
129/* net/ipv4/udp.c */ 131/* net/ipv4/udp.c */
130extern int udp_get_port(struct sock *sk, unsigned short snum, 132extern int udp_get_port(struct sock *sk, unsigned short snum,
@@ -183,24 +185,23 @@ DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6);
183 185
184/* /proc */ 186/* /proc */
185struct udp_seq_afinfo { 187struct udp_seq_afinfo {
186 struct module *owner;
187 char *name; 188 char *name;
188 sa_family_t family; 189 sa_family_t family;
189 struct hlist_head *hashtable; 190 struct hlist_head *hashtable;
190 int (*seq_show) (struct seq_file *m, void *v); 191 struct file_operations seq_fops;
191 struct file_operations *seq_fops; 192 struct seq_operations seq_ops;
192}; 193};
193 194
194struct udp_iter_state { 195struct udp_iter_state {
196 struct seq_net_private p;
195 sa_family_t family; 197 sa_family_t family;
196 struct hlist_head *hashtable; 198 struct hlist_head *hashtable;
197 int bucket; 199 int bucket;
198 struct seq_operations seq_ops;
199}; 200};
200 201
201#ifdef CONFIG_PROC_FS 202#ifdef CONFIG_PROC_FS
202extern int udp_proc_register(struct udp_seq_afinfo *afinfo); 203extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo);
203extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo); 204extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo);
204 205
205extern int udp4_proc_init(void); 206extern int udp4_proc_init(void);
206extern void udp4_proc_exit(void); 207extern void udp4_proc_exit(void);
diff --git a/include/net/wireless.h b/include/net/wireless.h
index d30c4ba8fd99..667b4080d30f 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -13,6 +13,162 @@
13#include <net/cfg80211.h> 13#include <net/cfg80211.h>
14 14
15/** 15/**
16 * enum ieee80211_band - supported frequency bands
17 *
18 * The bands are assigned this way because the supported
19 * bitrates differ in these bands.
20 *
21 * @IEEE80211_BAND_2GHZ: 2.4GHz ISM band
22 * @IEEE80211_BAND_5GHZ: around 5GHz band (4.9-5.7)
23 */
24enum ieee80211_band {
25 IEEE80211_BAND_2GHZ,
26 IEEE80211_BAND_5GHZ,
27
28 /* keep last */
29 IEEE80211_NUM_BANDS
30};
31
32/**
33 * enum ieee80211_channel_flags - channel flags
34 *
35 * Channel flags set by the regulatory control code.
36 *
37 * @IEEE80211_CHAN_DISABLED: This channel is disabled.
38 * @IEEE80211_CHAN_PASSIVE_SCAN: Only passive scanning is permitted
39 * on this channel.
40 * @IEEE80211_CHAN_NO_IBSS: IBSS is not allowed on this channel.
41 * @IEEE80211_CHAN_RADAR: Radar detection is required on this channel.
42 */
43enum ieee80211_channel_flags {
44 IEEE80211_CHAN_DISABLED = 1<<0,
45 IEEE80211_CHAN_PASSIVE_SCAN = 1<<1,
46 IEEE80211_CHAN_NO_IBSS = 1<<2,
47 IEEE80211_CHAN_RADAR = 1<<3,
48};
49
50/**
51 * struct ieee80211_channel - channel definition
52 *
53 * This structure describes a single channel for use
54 * with cfg80211.
55 *
56 * @center_freq: center frequency in MHz
57 * @hw_value: hardware-specific value for the channel
58 * @flags: channel flags from &enum ieee80211_channel_flags.
59 * @orig_flags: channel flags at registration time, used by regulatory
60 * code to support devices with additional restrictions
61 * @band: band this channel belongs to.
62 * @max_antenna_gain: maximum antenna gain in dBi
63 * @max_power: maximum transmission power (in dBm)
64 * @orig_mag: internal use
65 * @orig_mpwr: internal use
66 */
67struct ieee80211_channel {
68 enum ieee80211_band band;
69 u16 center_freq;
70 u16 hw_value;
71 u32 flags;
72 int max_antenna_gain;
73 int max_power;
74 u32 orig_flags;
75 int orig_mag, orig_mpwr;
76};
77
78/**
79 * enum ieee80211_rate_flags - rate flags
80 *
81 * Hardware/specification flags for rates. These are structured
82 * in a way that allows using the same bitrate structure for
83 * different bands/PHY modes.
84 *
85 * @IEEE80211_RATE_SHORT_PREAMBLE: Hardware can send with short
86 * preamble on this bitrate; only relevant in 2.4GHz band and
87 * with CCK rates.
88 * @IEEE80211_RATE_MANDATORY_A: This bitrate is a mandatory rate
89 * when used with 802.11a (on the 5 GHz band); filled by the
90 * core code when registering the wiphy.
91 * @IEEE80211_RATE_MANDATORY_B: This bitrate is a mandatory rate
92 * when used with 802.11b (on the 2.4 GHz band); filled by the
93 * core code when registering the wiphy.
94 * @IEEE80211_RATE_MANDATORY_G: This bitrate is a mandatory rate
95 * when used with 802.11g (on the 2.4 GHz band); filled by the
96 * core code when registering the wiphy.
97 * @IEEE80211_RATE_ERP_G: This is an ERP rate in 802.11g mode.
98 */
99enum ieee80211_rate_flags {
100 IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
101 IEEE80211_RATE_MANDATORY_A = 1<<1,
102 IEEE80211_RATE_MANDATORY_B = 1<<2,
103 IEEE80211_RATE_MANDATORY_G = 1<<3,
104 IEEE80211_RATE_ERP_G = 1<<4,
105};
106
107/**
108 * struct ieee80211_rate - bitrate definition
109 *
110 * This structure describes a bitrate that an 802.11 PHY can
111 * operate with. The two values @hw_value and @hw_value_short
112 * are only for driver use when pointers to this structure are
113 * passed around.
114 *
115 * @flags: rate-specific flags
116 * @bitrate: bitrate in units of 100 Kbps
117 * @hw_value: driver/hardware value for this rate
118 * @hw_value_short: driver/hardware value for this rate when
119 * short preamble is used
120 */
121struct ieee80211_rate {
122 u32 flags;
123 u16 bitrate;
124 u16 hw_value, hw_value_short;
125};
126
127/**
128 * struct ieee80211_ht_info - describing STA's HT capabilities
129 *
130 * This structure describes most essential parameters needed
131 * to describe 802.11n HT capabilities for an STA.
132 *
133 * @ht_supported: is HT supported by STA, 0: no, 1: yes
134 * @cap: HT capabilities map as described in 802.11n spec
135 * @ampdu_factor: Maximum A-MPDU length factor
136 * @ampdu_density: Minimum A-MPDU spacing
137 * @supp_mcs_set: Supported MCS set as described in 802.11n spec
138 */
139struct ieee80211_ht_info {
140 u16 cap; /* use IEEE80211_HT_CAP_ */
141 u8 ht_supported;
142 u8 ampdu_factor;
143 u8 ampdu_density;
144 u8 supp_mcs_set[16];
145};
146
147/**
148 * struct ieee80211_supported_band - frequency band definition
149 *
150 * This structure describes a frequency band a wiphy
151 * is able to operate in.
152 *
153 * @channels: Array of channels the hardware can operate in
154 * in this band.
155 * @band: the band this structure represents
156 * @n_channels: Number of channels in @channels
157 * @bitrates: Array of bitrates the hardware can operate with
158 * in this band. Must be sorted to give a valid "supported
159 * rates" IE, i.e. CCK rates first, then OFDM.
160 * @n_bitrates: Number of bitrates in @bitrates
161 */
162struct ieee80211_supported_band {
163 struct ieee80211_channel *channels;
164 struct ieee80211_rate *bitrates;
165 enum ieee80211_band band;
166 int n_channels;
167 int n_bitrates;
168 struct ieee80211_ht_info ht_info;
169};
170
171/**
16 * struct wiphy - wireless hardware description 172 * struct wiphy - wireless hardware description
17 * @idx: the wiphy index assigned to this item 173 * @idx: the wiphy index assigned to this item
18 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name> 174 * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
@@ -30,6 +186,8 @@ struct wiphy {
30 * help determine whether you own this wiphy or not. */ 186 * help determine whether you own this wiphy or not. */
31 void *privid; 187 void *privid;
32 188
189 struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
190
33 /* fields below are read-only, assigned by cfg80211 */ 191 /* fields below are read-only, assigned by cfg80211 */
34 192
35 /* the item in /sys/class/ieee80211/ points to this, 193 /* the item in /sys/class/ieee80211/ points to this,
@@ -136,4 +294,32 @@ extern void wiphy_unregister(struct wiphy *wiphy);
136 */ 294 */
137extern void wiphy_free(struct wiphy *wiphy); 295extern void wiphy_free(struct wiphy *wiphy);
138 296
297/**
298 * ieee80211_channel_to_frequency - convert channel number to frequency
299 */
300extern int ieee80211_channel_to_frequency(int chan);
301
302/**
303 * ieee80211_frequency_to_channel - convert frequency to channel number
304 */
305extern int ieee80211_frequency_to_channel(int freq);
306
307/*
308 * Name indirection necessary because the ieee80211 code also has
309 * a function named "ieee80211_get_channel", so if you include
310 * cfg80211's header file you get cfg80211's version, if you try
311 * to include both header files you'll (rightfully!) get a symbol
312 * clash.
313 */
314extern struct ieee80211_channel *__ieee80211_get_channel(struct wiphy *wiphy,
315 int freq);
316
317/**
318 * ieee80211_get_channel - get channel struct from wiphy for specified frequency
319 */
320static inline struct ieee80211_channel *
321ieee80211_get_channel(struct wiphy *wiphy, int freq)
322{
323 return __ieee80211_get_channel(wiphy, freq);
324}
139#endif /* __NET_WIRELESS_H */ 325#endif /* __NET_WIRELESS_H */
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 0d255ae008b6..b56b6a10fe5e 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -121,6 +121,7 @@ extern struct mutex xfrm_cfg_mutex;
121struct xfrm_state 121struct xfrm_state
122{ 122{
123 /* Note: bydst is re-used during gc */ 123 /* Note: bydst is re-used during gc */
124 struct list_head all;
124 struct hlist_node bydst; 125 struct hlist_node bydst;
125 struct hlist_node bysrc; 126 struct hlist_node bysrc;
126 struct hlist_node byspi; 127 struct hlist_node byspi;
@@ -446,6 +447,7 @@ struct xfrm_tmpl
446struct xfrm_policy 447struct xfrm_policy
447{ 448{
448 struct xfrm_policy *next; 449 struct xfrm_policy *next;
450 struct list_head bytype;
449 struct hlist_node bydst; 451 struct hlist_node bydst;
450 struct hlist_node byidx; 452 struct hlist_node byidx;
451 453
@@ -1071,6 +1073,23 @@ xfrm_address_t *xfrm_flowi_saddr(struct flowi *fl, unsigned short family)
1071 return NULL; 1073 return NULL;
1072} 1074}
1073 1075
1076static __inline__
1077void xfrm_flowi_addr_get(struct flowi *fl,
1078 xfrm_address_t *saddr, xfrm_address_t *daddr,
1079 unsigned short family)
1080{
1081 switch(family) {
1082 case AF_INET:
1083 memcpy(&saddr->a4, &fl->fl4_src, sizeof(saddr->a4));
1084 memcpy(&daddr->a4, &fl->fl4_dst, sizeof(daddr->a4));
1085 break;
1086 case AF_INET6:
1087 ipv6_addr_copy((struct in6_addr *)&saddr->a6, &fl->fl6_src);
1088 ipv6_addr_copy((struct in6_addr *)&daddr->a6, &fl->fl6_dst);
1089 break;
1090 }
1091}
1092
1074static __inline__ int 1093static __inline__ int
1075__xfrm4_state_addr_check(struct xfrm_state *x, 1094__xfrm4_state_addr_check(struct xfrm_state *x,
1076 xfrm_address_t *daddr, xfrm_address_t *saddr) 1095 xfrm_address_t *daddr, xfrm_address_t *saddr)
@@ -1188,6 +1207,18 @@ struct xfrm6_tunnel {
1188 int priority; 1207 int priority;
1189}; 1208};
1190 1209
1210struct xfrm_state_walk {
1211 struct xfrm_state *state;
1212 int count;
1213 u8 proto;
1214};
1215
1216struct xfrm_policy_walk {
1217 struct xfrm_policy *policy;
1218 int count;
1219 u8 type, cur_type;
1220};
1221
1191extern void xfrm_init(void); 1222extern void xfrm_init(void);
1192extern void xfrm4_init(void); 1223extern void xfrm4_init(void);
1193extern void xfrm_state_init(void); 1224extern void xfrm_state_init(void);
@@ -1212,7 +1243,23 @@ static inline void xfrm6_fini(void)
1212extern int xfrm_proc_init(void); 1243extern int xfrm_proc_init(void);
1213#endif 1244#endif
1214 1245
1215extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *); 1246static inline void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto)
1247{
1248 walk->proto = proto;
1249 walk->state = NULL;
1250 walk->count = 0;
1251}
1252
1253static inline void xfrm_state_walk_done(struct xfrm_state_walk *walk)
1254{
1255 if (walk->state != NULL) {
1256 xfrm_state_put(walk->state);
1257 walk->state = NULL;
1258 }
1259}
1260
1261extern int xfrm_state_walk(struct xfrm_state_walk *walk,
1262 int (*func)(struct xfrm_state *, int, void*), void *);
1216extern struct xfrm_state *xfrm_state_alloc(void); 1263extern struct xfrm_state *xfrm_state_alloc(void);
1217extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, 1264extern struct xfrm_state *xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
1218 struct flowi *fl, struct xfrm_tmpl *tmpl, 1265 struct flowi *fl, struct xfrm_tmpl *tmpl,
@@ -1335,7 +1382,25 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
1335#endif 1382#endif
1336 1383
1337struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); 1384struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp);
1338extern int xfrm_policy_walk(u8 type, int (*func)(struct xfrm_policy *, int, int, void*), void *); 1385
1386static inline void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type)
1387{
1388 walk->cur_type = XFRM_POLICY_TYPE_MAIN;
1389 walk->type = type;
1390 walk->policy = NULL;
1391 walk->count = 0;
1392}
1393
1394static inline void xfrm_policy_walk_done(struct xfrm_policy_walk *walk)
1395{
1396 if (walk->policy != NULL) {
1397 xfrm_pol_put(walk->policy);
1398 walk->policy = NULL;
1399 }
1400}
1401
1402extern int xfrm_policy_walk(struct xfrm_policy_walk *walk,
1403 int (*func)(struct xfrm_policy *, int, int, void*), void *);
1339int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1404int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1340struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir, 1405struct xfrm_policy *xfrm_policy_bysel_ctx(u8 type, int dir,
1341 struct xfrm_selector *sel, 1406 struct xfrm_selector *sel,