diff options
Diffstat (limited to 'include/net')
64 files changed, 1560 insertions, 735 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h index 68b4eaf7719d..565eed8fe496 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -89,7 +89,7 @@ struct tc_action_ops { | |||
89 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); | 89 | int (*dump)(struct sk_buff *, struct tc_action *, int, int); |
90 | int (*cleanup)(struct tc_action *, int bind); | 90 | int (*cleanup)(struct tc_action *, int bind); |
91 | int (*lookup)(struct tc_action *, u32); | 91 | int (*lookup)(struct tc_action *, u32); |
92 | int (*init)(struct rtattr *, struct rtattr *, struct tc_action *, int , int); | 92 | int (*init)(struct nlattr *, struct nlattr *, struct tc_action *, int , int); |
93 | int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); | 93 | int (*walk)(struct sk_buff *, struct netlink_callback *, int, struct tc_action *); |
94 | }; | 94 | }; |
95 | 95 | ||
@@ -104,7 +104,7 @@ extern u32 tcf_hash_new_index(u32 *idx_gen, struct tcf_hashinfo *hinfo); | |||
104 | extern int tcf_hash_search(struct tc_action *a, u32 index); | 104 | extern int tcf_hash_search(struct tc_action *a, u32 index); |
105 | extern struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, | 105 | extern struct tcf_common *tcf_hash_check(u32 index, struct tc_action *a, |
106 | int bind, struct tcf_hashinfo *hinfo); | 106 | int bind, struct tcf_hashinfo *hinfo); |
107 | extern struct tcf_common *tcf_hash_create(u32 index, struct rtattr *est, | 107 | extern struct tcf_common *tcf_hash_create(u32 index, struct nlattr *est, |
108 | struct tc_action *a, int size, | 108 | struct tc_action *a, int size, |
109 | int bind, u32 *idx_gen, | 109 | int bind, u32 *idx_gen, |
110 | struct tcf_hashinfo *hinfo); | 110 | struct tcf_hashinfo *hinfo); |
@@ -114,8 +114,8 @@ extern int tcf_register_action(struct tc_action_ops *a); | |||
114 | extern int tcf_unregister_action(struct tc_action_ops *a); | 114 | extern int tcf_unregister_action(struct tc_action_ops *a); |
115 | extern void tcf_action_destroy(struct tc_action *a, int bind); | 115 | extern void tcf_action_destroy(struct tc_action *a, int bind); |
116 | extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res); | 116 | extern int tcf_action_exec(struct sk_buff *skb, struct tc_action *a, struct tcf_result *res); |
117 | extern struct tc_action *tcf_action_init(struct rtattr *rta, struct rtattr *est, char *n, int ovr, int bind, int *err); | 117 | extern struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); |
118 | extern struct tc_action *tcf_action_init_1(struct rtattr *rta, struct rtattr *est, char *n, int ovr, int bind, int *err); | 118 | extern struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est, char *n, int ovr, int bind); |
119 | extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); | 119 | extern int tcf_action_dump(struct sk_buff *skb, struct tc_action *a, int, int); |
120 | extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); | 120 | extern int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int); |
121 | extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); | 121 | extern int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int); |
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 33b593e17441..496503c03846 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #define IPV6_MAX_ADDRESSES 16 | 18 | #define IPV6_MAX_ADDRESSES 16 |
19 | 19 | ||
20 | #include <linux/in.h> | ||
20 | #include <linux/in6.h> | 21 | #include <linux/in6.h> |
21 | 22 | ||
22 | struct prefix_info { | 23 | struct prefix_info { |
@@ -58,15 +59,20 @@ extern int addrconf_add_ifaddr(void __user *arg); | |||
58 | extern int addrconf_del_ifaddr(void __user *arg); | 59 | extern int addrconf_del_ifaddr(void __user *arg); |
59 | extern int addrconf_set_dstaddr(void __user *arg); | 60 | extern int addrconf_set_dstaddr(void __user *arg); |
60 | 61 | ||
61 | extern int ipv6_chk_addr(struct in6_addr *addr, | 62 | extern int ipv6_chk_addr(struct net *net, |
63 | struct in6_addr *addr, | ||
62 | struct net_device *dev, | 64 | struct net_device *dev, |
63 | int strict); | 65 | int strict); |
66 | |||
64 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 67 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
65 | extern int ipv6_chk_home_addr(struct in6_addr *addr); | 68 | extern int ipv6_chk_home_addr(struct net *net, |
69 | struct in6_addr *addr); | ||
66 | #endif | 70 | #endif |
67 | extern struct inet6_ifaddr * ipv6_get_ifaddr(struct in6_addr *addr, | 71 | extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, |
68 | struct net_device *dev, | 72 | struct in6_addr *addr, |
69 | int strict); | 73 | struct net_device *dev, |
74 | int strict); | ||
75 | |||
70 | extern int ipv6_get_saddr(struct dst_entry *dst, | 76 | extern int ipv6_get_saddr(struct dst_entry *dst, |
71 | struct in6_addr *daddr, | 77 | struct in6_addr *daddr, |
72 | struct in6_addr *saddr); | 78 | struct in6_addr *saddr); |
@@ -84,6 +90,14 @@ extern void addrconf_leave_solict(struct inet6_dev *idev, | |||
84 | struct in6_addr *addr); | 90 | struct in6_addr *addr); |
85 | 91 | ||
86 | /* | 92 | /* |
93 | * IPv6 Address Label subsystem (addrlabel.c) | ||
94 | */ | ||
95 | extern int ipv6_addr_label_init(void); | ||
96 | extern void ipv6_addr_label_rtnl_register(void); | ||
97 | extern u32 ipv6_addr_label(const struct in6_addr *addr, | ||
98 | int type, int ifindex); | ||
99 | |||
100 | /* | ||
87 | * multicast prototypes (mcast.c) | 101 | * multicast prototypes (mcast.c) |
88 | */ | 102 | */ |
89 | extern int ipv6_sock_mc_join(struct sock *sk, int ifindex, | 103 | extern int ipv6_sock_mc_join(struct sock *sk, int ifindex, |
@@ -241,6 +255,26 @@ static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) | |||
241 | addr->s6_addr32[3] == htonl(0x00000002)); | 255 | addr->s6_addr32[3] == htonl(0x00000002)); |
242 | } | 256 | } |
243 | 257 | ||
258 | static inline int ipv6_isatap_eui64(u8 *eui, __be32 addr) | ||
259 | { | ||
260 | eui[0] = (ipv4_is_zeronet(addr) || ipv4_is_private_10(addr) || | ||
261 | ipv4_is_loopback(addr) || ipv4_is_linklocal_169(addr) || | ||
262 | ipv4_is_private_172(addr) || ipv4_is_test_192(addr) || | ||
263 | ipv4_is_anycast_6to4(addr) || ipv4_is_private_192(addr) || | ||
264 | ipv4_is_test_198(addr) || ipv4_is_multicast(addr) || | ||
265 | ipv4_is_lbcast(addr)) ? 0x00 : 0x02; | ||
266 | eui[1] = 0; | ||
267 | eui[2] = 0x5E; | ||
268 | eui[3] = 0xFE; | ||
269 | memcpy (eui+4, &addr, 4); | ||
270 | return 0; | ||
271 | } | ||
272 | |||
273 | static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) | ||
274 | { | ||
275 | return ((addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE)); | ||
276 | } | ||
277 | |||
244 | #ifdef CONFIG_PROC_FS | 278 | #ifdef CONFIG_PROC_FS |
245 | extern int if6_proc_init(void); | 279 | extern int if6_proc_init(void); |
246 | extern void if6_proc_exit(void); | 280 | extern void if6_proc_exit(void); |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index a1c805d7f488..2dfa96b0575e 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -59,12 +59,11 @@ struct unix_sock { | |||
59 | #define unix_sk(__sk) ((struct unix_sock *)__sk) | 59 | #define unix_sk(__sk) ((struct unix_sock *)__sk) |
60 | 60 | ||
61 | #ifdef CONFIG_SYSCTL | 61 | #ifdef CONFIG_SYSCTL |
62 | extern int sysctl_unix_max_dgram_qlen; | 62 | extern int unix_sysctl_register(struct net *net); |
63 | extern void unix_sysctl_register(void); | 63 | extern void unix_sysctl_unregister(struct net *net); |
64 | extern void unix_sysctl_unregister(void); | ||
65 | #else | 64 | #else |
66 | static inline void unix_sysctl_register(void) {} | 65 | static inline int unix_sysctl_register(struct net *net) { return 0; } |
67 | static inline void unix_sysctl_unregister(void) {} | 66 | static inline void unix_sysctl_unregister(struct net *net) {} |
68 | #endif | 67 | #endif |
69 | #endif | 68 | #endif |
70 | #endif | 69 | #endif |
diff --git a/include/net/arp.h b/include/net/arp.h index f02664568600..752eb47b2678 100644 --- a/include/net/arp.h +++ b/include/net/arp.h | |||
@@ -5,13 +5,12 @@ | |||
5 | #include <linux/if_arp.h> | 5 | #include <linux/if_arp.h> |
6 | #include <net/neighbour.h> | 6 | #include <net/neighbour.h> |
7 | 7 | ||
8 | #define HAVE_ARP_CREATE | ||
9 | 8 | ||
10 | extern struct neigh_table arp_tbl; | 9 | extern struct neigh_table arp_tbl; |
11 | 10 | ||
12 | extern void arp_init(void); | 11 | extern void arp_init(void); |
13 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); | 12 | extern int arp_find(unsigned char *haddr, struct sk_buff *skb); |
14 | extern int arp_ioctl(unsigned int cmd, void __user *arg); | 13 | extern int arp_ioctl(struct net *net, unsigned int cmd, void __user *arg); |
15 | extern void arp_send(int type, int ptype, __be32 dest_ip, | 14 | extern void arp_send(int type, int ptype, __be32 dest_ip, |
16 | struct net_device *dev, __be32 src_ip, | 15 | struct net_device *dev, __be32 src_ip, |
17 | unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); | 16 | unsigned char *dest_hw, unsigned char *src_hw, unsigned char *th); |
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index 25aa575db807..98ec7a320689 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
@@ -252,8 +252,8 @@ static inline void rfcomm_dlc_put(struct rfcomm_dlc *d) | |||
252 | rfcomm_dlc_free(d); | 252 | rfcomm_dlc_free(d); |
253 | } | 253 | } |
254 | 254 | ||
255 | extern void FASTCALL(__rfcomm_dlc_throttle(struct rfcomm_dlc *d)); | 255 | extern void __rfcomm_dlc_throttle(struct rfcomm_dlc *d); |
256 | extern void FASTCALL(__rfcomm_dlc_unthrottle(struct rfcomm_dlc *d)); | 256 | extern void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d); |
257 | 257 | ||
258 | static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d) | 258 | static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d) |
259 | { | 259 | { |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index d30960e1755c..bcc480b8892a 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -49,6 +49,120 @@ extern int ieee80211_radiotap_iterator_next( | |||
49 | struct ieee80211_radiotap_iterator *iterator); | 49 | struct ieee80211_radiotap_iterator *iterator); |
50 | 50 | ||
51 | 51 | ||
52 | /** | ||
53 | * struct key_params - key information | ||
54 | * | ||
55 | * Information about a key | ||
56 | * | ||
57 | * @key: key material | ||
58 | * @key_len: length of key material | ||
59 | * @cipher: cipher suite selector | ||
60 | * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used | ||
61 | * with the get_key() callback, must be in little endian, | ||
62 | * length given by @seq_len. | ||
63 | */ | ||
64 | struct key_params { | ||
65 | u8 *key; | ||
66 | u8 *seq; | ||
67 | int key_len; | ||
68 | int seq_len; | ||
69 | u32 cipher; | ||
70 | }; | ||
71 | |||
72 | /** | ||
73 | * struct beacon_parameters - beacon parameters | ||
74 | * | ||
75 | * Used to configure the beacon for an interface. | ||
76 | * | ||
77 | * @head: head portion of beacon (before TIM IE) | ||
78 | * or %NULL if not changed | ||
79 | * @tail: tail portion of beacon (after TIM IE) | ||
80 | * or %NULL if not changed | ||
81 | * @interval: beacon interval or zero if not changed | ||
82 | * @dtim_period: DTIM period or zero if not changed | ||
83 | * @head_len: length of @head | ||
84 | * @tail_len: length of @tail | ||
85 | */ | ||
86 | struct beacon_parameters { | ||
87 | u8 *head, *tail; | ||
88 | int interval, dtim_period; | ||
89 | int head_len, tail_len; | ||
90 | }; | ||
91 | |||
92 | /** | ||
93 | * enum station_flags - station flags | ||
94 | * | ||
95 | * Station capability flags. Note that these must be the bits | ||
96 | * according to the nl80211 flags. | ||
97 | * | ||
98 | * @STATION_FLAG_CHANGED: station flags were changed | ||
99 | * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X) | ||
100 | * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames | ||
101 | * with short preambles | ||
102 | * @STATION_FLAG_WME: station is WME/QoS capable | ||
103 | */ | ||
104 | enum station_flags { | ||
105 | STATION_FLAG_CHANGED = 1<<0, | ||
106 | STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED, | ||
107 | STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE, | ||
108 | STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME, | ||
109 | }; | ||
110 | |||
111 | /** | ||
112 | * struct station_parameters - station parameters | ||
113 | * | ||
114 | * Used to change and create a new station. | ||
115 | * | ||
116 | * @vlan: vlan interface station should belong to | ||
117 | * @supported_rates: supported rates in IEEE 802.11 format | ||
118 | * (or NULL for no change) | ||
119 | * @supported_rates_len: number of supported rates | ||
120 | * @station_flags: station flags (see &enum station_flags) | ||
121 | * @listen_interval: listen interval or -1 for no change | ||
122 | * @aid: AID or zero for no change | ||
123 | */ | ||
124 | struct station_parameters { | ||
125 | u8 *supported_rates; | ||
126 | struct net_device *vlan; | ||
127 | u32 station_flags; | ||
128 | int listen_interval; | ||
129 | u16 aid; | ||
130 | u8 supported_rates_len; | ||
131 | }; | ||
132 | |||
133 | /** | ||
134 | * enum station_stats_flags - station statistics flags | ||
135 | * | ||
136 | * Used by the driver to indicate which info in &struct station_stats | ||
137 | * it has filled in during get_station(). | ||
138 | * | ||
139 | * @STATION_STAT_INACTIVE_TIME: @inactive_time filled | ||
140 | * @STATION_STAT_RX_BYTES: @rx_bytes filled | ||
141 | * @STATION_STAT_TX_BYTES: @tx_bytes filled | ||
142 | */ | ||
143 | enum station_stats_flags { | ||
144 | STATION_STAT_INACTIVE_TIME = 1<<0, | ||
145 | STATION_STAT_RX_BYTES = 1<<1, | ||
146 | STATION_STAT_TX_BYTES = 1<<2, | ||
147 | }; | ||
148 | |||
149 | /** | ||
150 | * struct station_stats - station statistics | ||
151 | * | ||
152 | * Station information filled by driver for get_station(). | ||
153 | * | ||
154 | * @filled: bitflag of flags from &enum station_stats_flags | ||
155 | * @inactive_time: time since last station activity (tx/rx) in milliseconds | ||
156 | * @rx_bytes: bytes received from this station | ||
157 | * @tx_bytes: bytes transmitted to this station | ||
158 | */ | ||
159 | struct station_stats { | ||
160 | u32 filled; | ||
161 | u32 inactive_time; | ||
162 | u32 rx_bytes; | ||
163 | u32 tx_bytes; | ||
164 | }; | ||
165 | |||
52 | /* from net/wireless.h */ | 166 | /* from net/wireless.h */ |
53 | struct wiphy; | 167 | struct wiphy; |
54 | 168 | ||
@@ -71,6 +185,31 @@ struct wiphy; | |||
71 | * | 185 | * |
72 | * @change_virtual_intf: change type of virtual interface | 186 | * @change_virtual_intf: change type of virtual interface |
73 | * | 187 | * |
188 | * @add_key: add a key with the given parameters. @mac_addr will be %NULL | ||
189 | * when adding a group key. | ||
190 | * | ||
191 | * @get_key: get information about the key with the given parameters. | ||
192 | * @mac_addr will be %NULL when requesting information for a group | ||
193 | * key. All pointers given to the @callback function need not be valid | ||
194 | * after it returns. | ||
195 | * | ||
196 | * @del_key: remove a key given the @mac_addr (%NULL for a group key) | ||
197 | * and @key_index | ||
198 | * | ||
199 | * @set_default_key: set the default key on an interface | ||
200 | * | ||
201 | * @add_beacon: Add a beacon with given parameters, @head, @interval | ||
202 | * and @dtim_period will be valid, @tail is optional. | ||
203 | * @set_beacon: Change the beacon parameters for an access point mode | ||
204 | * interface. This should reject the call when no beacon has been | ||
205 | * configured. | ||
206 | * @del_beacon: Remove beacon configuration and stop sending the beacon. | ||
207 | * | ||
208 | * @add_station: Add a new station. | ||
209 | * | ||
210 | * @del_station: Remove a station; @mac may be NULL to remove all stations. | ||
211 | * | ||
212 | * @change_station: Modify a given station. | ||
74 | */ | 213 | */ |
75 | struct cfg80211_ops { | 214 | struct cfg80211_ops { |
76 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, | 215 | int (*add_virtual_intf)(struct wiphy *wiphy, char *name, |
@@ -78,6 +217,34 @@ struct cfg80211_ops { | |||
78 | int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); | 217 | int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex); |
79 | int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, | 218 | int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex, |
80 | enum nl80211_iftype type); | 219 | enum nl80211_iftype type); |
220 | |||
221 | int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, | ||
222 | u8 key_index, u8 *mac_addr, | ||
223 | struct key_params *params); | ||
224 | int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, | ||
225 | u8 key_index, u8 *mac_addr, void *cookie, | ||
226 | void (*callback)(void *cookie, struct key_params*)); | ||
227 | int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, | ||
228 | u8 key_index, u8 *mac_addr); | ||
229 | int (*set_default_key)(struct wiphy *wiphy, | ||
230 | struct net_device *netdev, | ||
231 | u8 key_index); | ||
232 | |||
233 | int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev, | ||
234 | struct beacon_parameters *info); | ||
235 | int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev, | ||
236 | struct beacon_parameters *info); | ||
237 | int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev); | ||
238 | |||
239 | |||
240 | int (*add_station)(struct wiphy *wiphy, struct net_device *dev, | ||
241 | u8 *mac, struct station_parameters *params); | ||
242 | int (*del_station)(struct wiphy *wiphy, struct net_device *dev, | ||
243 | u8 *mac); | ||
244 | int (*change_station)(struct wiphy *wiphy, struct net_device *dev, | ||
245 | u8 *mac, struct station_parameters *params); | ||
246 | int (*get_station)(struct wiphy *wiphy, struct net_device *dev, | ||
247 | u8 *mac, struct station_stats *stats); | ||
81 | }; | 248 | }; |
82 | 249 | ||
83 | #endif /* __NET_CFG80211_H */ | 250 | #endif /* __NET_CFG80211_H */ |
diff --git a/include/net/checksum.h b/include/net/checksum.h index 124246172a88..07602b7fa218 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h | |||
@@ -93,4 +93,29 @@ static inline __wsum csum_unfold(__sum16 n) | |||
93 | } | 93 | } |
94 | 94 | ||
95 | #define CSUM_MANGLED_0 ((__force __sum16)0xffff) | 95 | #define CSUM_MANGLED_0 ((__force __sum16)0xffff) |
96 | |||
97 | static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) | ||
98 | { | ||
99 | __be32 diff[] = { ~from, to }; | ||
100 | |||
101 | *sum = csum_fold(csum_partial((char *)diff, sizeof(diff), ~csum_unfold(*sum))); | ||
102 | } | ||
103 | |||
104 | static inline void csum_replace2(__sum16 *sum, __be16 from, __be16 to) | ||
105 | { | ||
106 | csum_replace4(sum, (__force __be32)from, (__force __be32)to); | ||
107 | } | ||
108 | |||
109 | struct sk_buff; | ||
110 | extern void inet_proto_csum_replace4(__sum16 *sum, struct sk_buff *skb, | ||
111 | __be32 from, __be32 to, int pseudohdr); | ||
112 | |||
113 | static inline void inet_proto_csum_replace2(__sum16 *sum, struct sk_buff *skb, | ||
114 | __be16 from, __be16 to, | ||
115 | int pseudohdr) | ||
116 | { | ||
117 | inet_proto_csum_replace4(sum, skb, (__force __be32)from, | ||
118 | (__force __be32)to, pseudohdr); | ||
119 | } | ||
120 | |||
96 | #endif | 121 | #endif |
diff --git a/include/net/dsfield.h b/include/net/dsfield.h index eb65bf2e2502..8a8d4e06900d 100644 --- a/include/net/dsfield.h +++ b/include/net/dsfield.h | |||
@@ -12,15 +12,15 @@ | |||
12 | #include <asm/byteorder.h> | 12 | #include <asm/byteorder.h> |
13 | 13 | ||
14 | 14 | ||
15 | static inline __u8 ipv4_get_dsfield(struct iphdr *iph) | 15 | static inline __u8 ipv4_get_dsfield(const struct iphdr *iph) |
16 | { | 16 | { |
17 | return iph->tos; | 17 | return iph->tos; |
18 | } | 18 | } |
19 | 19 | ||
20 | 20 | ||
21 | static inline __u8 ipv6_get_dsfield(struct ipv6hdr *ipv6h) | 21 | static inline __u8 ipv6_get_dsfield(const struct ipv6hdr *ipv6h) |
22 | { | 22 | { |
23 | return ntohs(*(__be16 *) ipv6h) >> 4; | 23 | return ntohs(*(const __be16 *)ipv6h) >> 4; |
24 | } | 24 | } |
25 | 25 | ||
26 | 26 | ||
diff --git a/include/net/dst.h b/include/net/dst.h index 2f65e894b829..e3ac7d0fc4e1 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -50,14 +50,17 @@ struct dst_entry | |||
50 | unsigned long expires; | 50 | unsigned long expires; |
51 | 51 | ||
52 | unsigned short header_len; /* more space at head required */ | 52 | unsigned short header_len; /* more space at head required */ |
53 | unsigned short nfheader_len; /* more non-fragment space at head required */ | ||
54 | unsigned short trailer_len; /* space to reserve at tail */ | 53 | unsigned short trailer_len; /* space to reserve at tail */ |
55 | 54 | ||
56 | u32 metrics[RTAX_MAX]; | 55 | u32 metrics[RTAX_MAX]; |
57 | struct dst_entry *path; | 56 | struct dst_entry *path; |
58 | 57 | ||
59 | unsigned long rate_last; /* rate limiting for ICMP */ | 58 | unsigned long rate_last; /* rate limiting for ICMP */ |
60 | unsigned long rate_tokens; | 59 | unsigned int rate_tokens; |
60 | |||
61 | #ifdef CONFIG_NET_CLS_ROUTE | ||
62 | __u32 tclassid; | ||
63 | #endif | ||
61 | 64 | ||
62 | struct neighbour *neighbour; | 65 | struct neighbour *neighbour; |
63 | struct hh_cache *hh; | 66 | struct hh_cache *hh; |
@@ -66,10 +69,6 @@ struct dst_entry | |||
66 | int (*input)(struct sk_buff*); | 69 | int (*input)(struct sk_buff*); |
67 | int (*output)(struct sk_buff*); | 70 | int (*output)(struct sk_buff*); |
68 | 71 | ||
69 | #ifdef CONFIG_NET_CLS_ROUTE | ||
70 | __u32 tclassid; | ||
71 | #endif | ||
72 | |||
73 | struct dst_ops *ops; | 72 | struct dst_ops *ops; |
74 | 73 | ||
75 | unsigned long lastuse; | 74 | unsigned long lastuse; |
@@ -81,7 +80,6 @@ struct dst_entry | |||
81 | struct rt6_info *rt6_next; | 80 | struct rt6_info *rt6_next; |
82 | struct dn_route *dn_next; | 81 | struct dn_route *dn_next; |
83 | }; | 82 | }; |
84 | char info[0]; | ||
85 | }; | 83 | }; |
86 | 84 | ||
87 | 85 | ||
@@ -91,7 +89,7 @@ struct dst_ops | |||
91 | __be16 protocol; | 89 | __be16 protocol; |
92 | unsigned gc_thresh; | 90 | unsigned gc_thresh; |
93 | 91 | ||
94 | int (*gc)(void); | 92 | int (*gc)(struct dst_ops *ops); |
95 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); | 93 | struct dst_entry * (*check)(struct dst_entry *, __u32 cookie); |
96 | void (*destroy)(struct dst_entry *); | 94 | void (*destroy)(struct dst_entry *); |
97 | void (*ifdown)(struct dst_entry *, | 95 | void (*ifdown)(struct dst_entry *, |
@@ -99,10 +97,12 @@ struct dst_ops | |||
99 | struct dst_entry * (*negative_advice)(struct dst_entry *); | 97 | struct dst_entry * (*negative_advice)(struct dst_entry *); |
100 | void (*link_failure)(struct sk_buff *); | 98 | void (*link_failure)(struct sk_buff *); |
101 | void (*update_pmtu)(struct dst_entry *dst, u32 mtu); | 99 | void (*update_pmtu)(struct dst_entry *dst, u32 mtu); |
100 | int (*local_out)(struct sk_buff *skb); | ||
102 | int entry_size; | 101 | int entry_size; |
103 | 102 | ||
104 | atomic_t entries; | 103 | atomic_t entries; |
105 | struct kmem_cache *kmem_cachep; | 104 | struct kmem_cache *kmem_cachep; |
105 | struct net *dst_net; | ||
106 | }; | 106 | }; |
107 | 107 | ||
108 | #ifdef __KERNEL__ | 108 | #ifdef __KERNEL__ |
@@ -180,6 +180,7 @@ static inline struct dst_entry *dst_pop(struct dst_entry *dst) | |||
180 | return child; | 180 | return child; |
181 | } | 181 | } |
182 | 182 | ||
183 | extern int dst_discard(struct sk_buff *skb); | ||
183 | extern void * dst_alloc(struct dst_ops * ops); | 184 | extern void * dst_alloc(struct dst_ops * ops); |
184 | extern void __dst_free(struct dst_entry * dst); | 185 | extern void __dst_free(struct dst_entry * dst); |
185 | extern struct dst_entry *dst_destroy(struct dst_entry * dst); | 186 | extern struct dst_entry *dst_destroy(struct dst_entry * dst); |
@@ -264,6 +265,12 @@ static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie) | |||
264 | 265 | ||
265 | extern void dst_init(void); | 266 | extern void dst_init(void); |
266 | 267 | ||
268 | /* Flags for xfrm_lookup flags argument. */ | ||
269 | enum { | ||
270 | XFRM_LOOKUP_WAIT = 1 << 0, | ||
271 | XFRM_LOOKUP_ICMP = 1 << 1, | ||
272 | }; | ||
273 | |||
267 | struct flowi; | 274 | struct flowi; |
268 | #ifndef CONFIG_XFRM | 275 | #ifndef CONFIG_XFRM |
269 | static inline int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, | 276 | static inline int xfrm_lookup(struct dst_entry **dst_p, struct flowi *fl, |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 41a301e38643..34349f9f4331 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
@@ -22,6 +22,7 @@ struct fib_rule | |||
22 | u32 target; | 22 | u32 target; |
23 | struct fib_rule * ctarget; | 23 | struct fib_rule * ctarget; |
24 | struct rcu_head rcu; | 24 | struct rcu_head rcu; |
25 | struct net * fr_net; | ||
25 | }; | 26 | }; |
26 | 27 | ||
27 | struct fib_lookup_arg | 28 | struct fib_lookup_arg |
@@ -56,7 +57,7 @@ struct fib_rules_ops | |||
56 | int (*fill)(struct fib_rule *, struct sk_buff *, | 57 | int (*fill)(struct fib_rule *, struct sk_buff *, |
57 | struct nlmsghdr *, | 58 | struct nlmsghdr *, |
58 | struct fib_rule_hdr *); | 59 | struct fib_rule_hdr *); |
59 | u32 (*default_pref)(void); | 60 | u32 (*default_pref)(struct fib_rules_ops *ops); |
60 | size_t (*nlmsg_payload)(struct fib_rule *); | 61 | size_t (*nlmsg_payload)(struct fib_rule *); |
61 | 62 | ||
62 | /* Called after modifications to the rules set, must flush | 63 | /* Called after modifications to the rules set, must flush |
@@ -67,6 +68,7 @@ struct fib_rules_ops | |||
67 | const struct nla_policy *policy; | 68 | const struct nla_policy *policy; |
68 | struct list_head rules_list; | 69 | struct list_head rules_list; |
69 | struct module *owner; | 70 | struct module *owner; |
71 | struct net *fro_net; | ||
70 | }; | 72 | }; |
71 | 73 | ||
72 | #define FRA_GENERIC_POLICY \ | 74 | #define FRA_GENERIC_POLICY \ |
@@ -101,8 +103,9 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) | |||
101 | return frh->table; | 103 | return frh->table; |
102 | } | 104 | } |
103 | 105 | ||
104 | extern int fib_rules_register(struct fib_rules_ops *); | 106 | extern int fib_rules_register(struct fib_rules_ops *); |
105 | extern int fib_rules_unregister(struct fib_rules_ops *); | 107 | extern void fib_rules_unregister(struct fib_rules_ops *); |
108 | extern void fib_rules_cleanup_ops(struct fib_rules_ops *); | ||
106 | 109 | ||
107 | extern int fib_rules_lookup(struct fib_rules_ops *, | 110 | extern int fib_rules_lookup(struct fib_rules_ops *, |
108 | struct flowi *, int flags, | 111 | struct flowi *, int flags, |
diff --git a/include/net/flow.h b/include/net/flow.h index af59fa5cc1f8..ad16e0076c89 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -48,7 +48,6 @@ struct flowi { | |||
48 | 48 | ||
49 | __u8 proto; | 49 | __u8 proto; |
50 | __u8 flags; | 50 | __u8 flags; |
51 | #define FLOWI_FLAG_MULTIPATHOLDROUTE 0x01 | ||
52 | union { | 51 | union { |
53 | struct { | 52 | struct { |
54 | __be16 sport; | 53 | __be16 sport; |
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h index 0b95cf031d6e..8cd8185fa2ed 100644 --- a/include/net/gen_stats.h +++ b/include/net/gen_stats.h | |||
@@ -10,7 +10,7 @@ struct gnet_dump | |||
10 | { | 10 | { |
11 | spinlock_t * lock; | 11 | spinlock_t * lock; |
12 | struct sk_buff * skb; | 12 | struct sk_buff * skb; |
13 | struct rtattr * tail; | 13 | struct nlattr * tail; |
14 | 14 | ||
15 | /* Backward compatability */ | 15 | /* Backward compatability */ |
16 | int compat_tc_stats; | 16 | int compat_tc_stats; |
@@ -39,11 +39,11 @@ extern int gnet_stats_finish_copy(struct gnet_dump *d); | |||
39 | 39 | ||
40 | extern int gen_new_estimator(struct gnet_stats_basic *bstats, | 40 | extern int gen_new_estimator(struct gnet_stats_basic *bstats, |
41 | struct gnet_stats_rate_est *rate_est, | 41 | struct gnet_stats_rate_est *rate_est, |
42 | spinlock_t *stats_lock, struct rtattr *opt); | 42 | spinlock_t *stats_lock, struct nlattr *opt); |
43 | extern void gen_kill_estimator(struct gnet_stats_basic *bstats, | 43 | extern void gen_kill_estimator(struct gnet_stats_basic *bstats, |
44 | struct gnet_stats_rate_est *rate_est); | 44 | struct gnet_stats_rate_est *rate_est); |
45 | extern int gen_replace_estimator(struct gnet_stats_basic *bstats, | 45 | extern int gen_replace_estimator(struct gnet_stats_basic *bstats, |
46 | struct gnet_stats_rate_est *rate_est, | 46 | struct gnet_stats_rate_est *rate_est, |
47 | spinlock_t *stats_lock, struct rtattr *opt); | 47 | spinlock_t *stats_lock, struct nlattr *opt); |
48 | 48 | ||
49 | #endif | 49 | #endif |
diff --git a/include/net/ieee80211.h b/include/net/ieee80211.h index d8ae48439f12..285b2adfa648 100644 --- a/include/net/ieee80211.h +++ b/include/net/ieee80211.h | |||
@@ -677,7 +677,7 @@ struct ieee80211_probe_request { | |||
677 | 677 | ||
678 | struct ieee80211_probe_response { | 678 | struct ieee80211_probe_response { |
679 | struct ieee80211_hdr_3addr header; | 679 | struct ieee80211_hdr_3addr header; |
680 | u32 time_stamp[2]; | 680 | __le32 time_stamp[2]; |
681 | __le16 beacon_interval; | 681 | __le16 beacon_interval; |
682 | __le16 capability; | 682 | __le16 capability; |
683 | /* SSID, supported rates, FH params, DS params, | 683 | /* SSID, supported rates, FH params, DS params, |
@@ -718,8 +718,8 @@ struct ieee80211_txb { | |||
718 | u8 encrypted; | 718 | u8 encrypted; |
719 | u8 rts_included; | 719 | u8 rts_included; |
720 | u8 reserved; | 720 | u8 reserved; |
721 | __le16 frag_size; | 721 | u16 frag_size; |
722 | __le16 payload_size; | 722 | u16 payload_size; |
723 | struct sk_buff *fragments[0]; | 723 | struct sk_buff *fragments[0]; |
724 | }; | 724 | }; |
725 | 725 | ||
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index de8399a79774..ba33db053854 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h | |||
@@ -83,9 +83,9 @@ static inline void IP_ECN_clear(struct iphdr *iph) | |||
83 | iph->tos &= ~INET_ECN_MASK; | 83 | iph->tos &= ~INET_ECN_MASK; |
84 | } | 84 | } |
85 | 85 | ||
86 | static inline void ipv4_copy_dscp(struct iphdr *outer, struct iphdr *inner) | 86 | static inline void ipv4_copy_dscp(unsigned int dscp, struct iphdr *inner) |
87 | { | 87 | { |
88 | u32 dscp = ipv4_get_dsfield(outer) & ~INET_ECN_MASK; | 88 | dscp &= ~INET_ECN_MASK; |
89 | ipv4_change_dsfield(inner, INET_ECN_MASK, dscp); | 89 | ipv4_change_dsfield(inner, INET_ECN_MASK, dscp); |
90 | } | 90 | } |
91 | 91 | ||
@@ -104,9 +104,9 @@ static inline void IP6_ECN_clear(struct ipv6hdr *iph) | |||
104 | *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20); | 104 | *(__be32*)iph &= ~htonl(INET_ECN_MASK << 20); |
105 | } | 105 | } |
106 | 106 | ||
107 | static inline void ipv6_copy_dscp(struct ipv6hdr *outer, struct ipv6hdr *inner) | 107 | static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner) |
108 | { | 108 | { |
109 | u32 dscp = ipv6_get_dsfield(outer) & ~INET_ECN_MASK; | 109 | dscp &= ~INET_ECN_MASK; |
110 | ipv6_change_dsfield(inner, INET_ECN_MASK, dscp); | 110 | ipv6_change_dsfield(inner, INET_ECN_MASK, dscp); |
111 | } | 111 | } |
112 | 112 | ||
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 954def408975..7374251b9787 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
@@ -1,8 +1,20 @@ | |||
1 | #ifndef __NET_FRAG_H__ | 1 | #ifndef __NET_FRAG_H__ |
2 | #define __NET_FRAG_H__ | 2 | #define __NET_FRAG_H__ |
3 | 3 | ||
4 | struct netns_frags { | ||
5 | int nqueues; | ||
6 | atomic_t mem; | ||
7 | struct list_head lru_list; | ||
8 | |||
9 | /* sysctls */ | ||
10 | int timeout; | ||
11 | int high_thresh; | ||
12 | int low_thresh; | ||
13 | }; | ||
14 | |||
4 | struct inet_frag_queue { | 15 | struct inet_frag_queue { |
5 | struct hlist_node list; | 16 | struct hlist_node list; |
17 | struct netns_frags *net; | ||
6 | struct list_head lru_list; /* lru list member */ | 18 | struct list_head lru_list; /* lru list member */ |
7 | spinlock_t lock; | 19 | spinlock_t lock; |
8 | atomic_t refcnt; | 20 | atomic_t refcnt; |
@@ -20,23 +32,13 @@ struct inet_frag_queue { | |||
20 | 32 | ||
21 | #define INETFRAGS_HASHSZ 64 | 33 | #define INETFRAGS_HASHSZ 64 |
22 | 34 | ||
23 | struct inet_frags_ctl { | ||
24 | int high_thresh; | ||
25 | int low_thresh; | ||
26 | int timeout; | ||
27 | int secret_interval; | ||
28 | }; | ||
29 | |||
30 | struct inet_frags { | 35 | struct inet_frags { |
31 | struct list_head lru_list; | ||
32 | struct hlist_head hash[INETFRAGS_HASHSZ]; | 36 | struct hlist_head hash[INETFRAGS_HASHSZ]; |
33 | rwlock_t lock; | 37 | rwlock_t lock; |
34 | u32 rnd; | 38 | u32 rnd; |
35 | int nqueues; | ||
36 | int qsize; | 39 | int qsize; |
37 | atomic_t mem; | 40 | int secret_interval; |
38 | struct timer_list secret_timer; | 41 | struct timer_list secret_timer; |
39 | struct inet_frags_ctl *ctl; | ||
40 | 42 | ||
41 | unsigned int (*hashfn)(struct inet_frag_queue *); | 43 | unsigned int (*hashfn)(struct inet_frag_queue *); |
42 | void (*constructor)(struct inet_frag_queue *q, | 44 | void (*constructor)(struct inet_frag_queue *q, |
@@ -51,12 +53,15 @@ struct inet_frags { | |||
51 | void inet_frags_init(struct inet_frags *); | 53 | void inet_frags_init(struct inet_frags *); |
52 | void inet_frags_fini(struct inet_frags *); | 54 | void inet_frags_fini(struct inet_frags *); |
53 | 55 | ||
56 | void inet_frags_init_net(struct netns_frags *nf); | ||
57 | void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f); | ||
58 | |||
54 | void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); | 59 | void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); |
55 | void inet_frag_destroy(struct inet_frag_queue *q, | 60 | void inet_frag_destroy(struct inet_frag_queue *q, |
56 | struct inet_frags *f, int *work); | 61 | struct inet_frags *f, int *work); |
57 | int inet_frag_evictor(struct inet_frags *f); | 62 | int inet_frag_evictor(struct netns_frags *nf, struct inet_frags *f); |
58 | struct inet_frag_queue *inet_frag_find(struct inet_frags *f, void *key, | 63 | struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, |
59 | unsigned int hash); | 64 | struct inet_frags *f, void *key, unsigned int hash); |
60 | 65 | ||
61 | static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) | 66 | static inline void inet_frag_put(struct inet_frag_queue *q, struct inet_frags *f) |
62 | { | 67 | { |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 37f6cb112127..761bdc01425d 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -264,37 +264,14 @@ static inline void inet_listen_unlock(struct inet_hashinfo *hashinfo) | |||
264 | wake_up(&hashinfo->lhash_wait); | 264 | wake_up(&hashinfo->lhash_wait); |
265 | } | 265 | } |
266 | 266 | ||
267 | static inline void __inet_hash(struct inet_hashinfo *hashinfo, | 267 | extern void __inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk); |
268 | struct sock *sk, const int listen_possible) | 268 | extern void __inet_hash_nolisten(struct inet_hashinfo *hinfo, struct sock *sk); |
269 | { | ||
270 | struct hlist_head *list; | ||
271 | rwlock_t *lock; | ||
272 | |||
273 | BUG_TRAP(sk_unhashed(sk)); | ||
274 | if (listen_possible && sk->sk_state == TCP_LISTEN) { | ||
275 | list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; | ||
276 | lock = &hashinfo->lhash_lock; | ||
277 | inet_listen_wlock(hashinfo); | ||
278 | } else { | ||
279 | struct inet_ehash_bucket *head; | ||
280 | sk->sk_hash = inet_sk_ehashfn(sk); | ||
281 | head = inet_ehash_bucket(hashinfo, sk->sk_hash); | ||
282 | list = &head->chain; | ||
283 | lock = inet_ehash_lockp(hashinfo, sk->sk_hash); | ||
284 | write_lock(lock); | ||
285 | } | ||
286 | __sk_add_node(sk, list); | ||
287 | sock_prot_inc_use(sk->sk_prot); | ||
288 | write_unlock(lock); | ||
289 | if (listen_possible && sk->sk_state == TCP_LISTEN) | ||
290 | wake_up(&hashinfo->lhash_wait); | ||
291 | } | ||
292 | 269 | ||
293 | static inline void inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk) | 270 | static inline void inet_hash(struct inet_hashinfo *hashinfo, struct sock *sk) |
294 | { | 271 | { |
295 | if (sk->sk_state != TCP_CLOSE) { | 272 | if (sk->sk_state != TCP_CLOSE) { |
296 | local_bh_disable(); | 273 | local_bh_disable(); |
297 | __inet_hash(hashinfo, sk, 1); | 274 | __inet_hash(hashinfo, sk); |
298 | local_bh_enable(); | 275 | local_bh_enable(); |
299 | } | 276 | } |
300 | } | 277 | } |
@@ -316,7 +293,7 @@ static inline void inet_unhash(struct inet_hashinfo *hashinfo, struct sock *sk) | |||
316 | } | 293 | } |
317 | 294 | ||
318 | if (__sk_del_node_init(sk)) | 295 | if (__sk_del_node_init(sk)) |
319 | sock_prot_dec_use(sk->sk_prot); | 296 | sock_prot_inuse_add(sk->sk_prot, -1); |
320 | write_unlock_bh(lock); | 297 | write_unlock_bh(lock); |
321 | out: | 298 | out: |
322 | if (sk->sk_state == TCP_LISTEN) | 299 | if (sk->sk_state == TCP_LISTEN) |
@@ -397,43 +374,9 @@ typedef __u64 __bitwise __addrpair; | |||
397 | * | 374 | * |
398 | * Local BH must be disabled here. | 375 | * Local BH must be disabled here. |
399 | */ | 376 | */ |
400 | static inline struct sock * | 377 | extern struct sock * __inet_lookup_established(struct inet_hashinfo *hashinfo, |
401 | __inet_lookup_established(struct inet_hashinfo *hashinfo, | 378 | const __be32 saddr, const __be16 sport, |
402 | const __be32 saddr, const __be16 sport, | 379 | const __be32 daddr, const u16 hnum, const int dif); |
403 | const __be32 daddr, const u16 hnum, | ||
404 | const int dif) | ||
405 | { | ||
406 | INET_ADDR_COOKIE(acookie, saddr, daddr) | ||
407 | const __portpair ports = INET_COMBINED_PORTS(sport, hnum); | ||
408 | struct sock *sk; | ||
409 | const struct hlist_node *node; | ||
410 | /* Optimize here for direct hit, only listening connections can | ||
411 | * have wildcards anyways. | ||
412 | */ | ||
413 | unsigned int hash = inet_ehashfn(daddr, hnum, saddr, sport); | ||
414 | struct inet_ehash_bucket *head = inet_ehash_bucket(hashinfo, hash); | ||
415 | rwlock_t *lock = inet_ehash_lockp(hashinfo, hash); | ||
416 | |||
417 | prefetch(head->chain.first); | ||
418 | read_lock(lock); | ||
419 | sk_for_each(sk, node, &head->chain) { | ||
420 | if (INET_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) | ||
421 | goto hit; /* You sunk my battleship! */ | ||
422 | } | ||
423 | |||
424 | /* Must check for a TIME_WAIT'er before going to listener hash. */ | ||
425 | sk_for_each(sk, node, &head->twchain) { | ||
426 | if (INET_TW_MATCH(sk, hash, acookie, saddr, daddr, ports, dif)) | ||
427 | goto hit; | ||
428 | } | ||
429 | sk = NULL; | ||
430 | out: | ||
431 | read_unlock(lock); | ||
432 | return sk; | ||
433 | hit: | ||
434 | sock_hold(sk); | ||
435 | goto out; | ||
436 | } | ||
437 | 380 | ||
438 | static inline struct sock * | 381 | static inline struct sock * |
439 | inet_lookup_established(struct inet_hashinfo *hashinfo, | 382 | inet_lookup_established(struct inet_hashinfo *hashinfo, |
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index abaff0597270..67e925065aae 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -193,19 +193,7 @@ static inline __be32 inet_rcv_saddr(const struct sock *sk) | |||
193 | inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; | 193 | inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; |
194 | } | 194 | } |
195 | 195 | ||
196 | static inline void inet_twsk_put(struct inet_timewait_sock *tw) | 196 | extern void inet_twsk_put(struct inet_timewait_sock *tw); |
197 | { | ||
198 | if (atomic_dec_and_test(&tw->tw_refcnt)) { | ||
199 | struct module *owner = tw->tw_prot->owner; | ||
200 | twsk_destructor((struct sock *)tw); | ||
201 | #ifdef SOCK_REFCNT_DEBUG | ||
202 | printk(KERN_DEBUG "%s timewait_sock %p released\n", | ||
203 | tw->tw_prot->name, tw); | ||
204 | #endif | ||
205 | kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw); | ||
206 | module_put(owner); | ||
207 | } | ||
208 | } | ||
209 | 197 | ||
210 | extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, | 198 | extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, |
211 | const int state); | 199 | const int state); |
diff --git a/include/net/ip.h b/include/net/ip.h index 50c8889b1b8d..9f50d4f1f157 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -82,8 +82,6 @@ struct packet_type; | |||
82 | struct rtable; | 82 | struct rtable; |
83 | struct sockaddr; | 83 | struct sockaddr; |
84 | 84 | ||
85 | extern void ip_mc_dropsocket(struct sock *); | ||
86 | extern void ip_mc_dropdevice(struct net_device *dev); | ||
87 | extern int igmp_mc_proc_init(void); | 85 | extern int igmp_mc_proc_init(void); |
88 | 86 | ||
89 | /* | 87 | /* |
@@ -102,6 +100,8 @@ extern int ip_mc_output(struct sk_buff *skb); | |||
102 | extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); | 100 | extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); |
103 | extern int ip_do_nat(struct sk_buff *skb); | 101 | extern int ip_do_nat(struct sk_buff *skb); |
104 | extern void ip_send_check(struct iphdr *ip); | 102 | extern void ip_send_check(struct iphdr *ip); |
103 | extern int __ip_local_out(struct sk_buff *skb); | ||
104 | extern int ip_local_out(struct sk_buff *skb); | ||
105 | extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); | 105 | extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok); |
106 | extern void ip_init(void); | 106 | extern void ip_init(void); |
107 | extern int ip_append_data(struct sock *sk, | 107 | extern int ip_append_data(struct sock *sk, |
@@ -169,7 +169,7 @@ DECLARE_SNMP_STAT(struct linux_mib, net_statistics); | |||
169 | #define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd) | 169 | #define NET_ADD_STATS_USER(field, adnd) SNMP_ADD_STATS_USER(net_statistics, field, adnd) |
170 | 170 | ||
171 | extern unsigned long snmp_fold_field(void *mib[], int offt); | 171 | extern unsigned long snmp_fold_field(void *mib[], int offt); |
172 | extern int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign); | 172 | extern int snmp_mib_init(void *ptr[2], size_t mibsize); |
173 | extern void snmp_mib_free(void *ptr[2]); | 173 | extern void snmp_mib_free(void *ptr[2]); |
174 | 174 | ||
175 | extern void inet_get_local_port_range(int *low, int *high); | 175 | extern void inet_get_local_port_range(int *low, int *high); |
@@ -177,10 +177,7 @@ extern void inet_get_local_port_range(int *low, int *high); | |||
177 | extern int sysctl_ip_default_ttl; | 177 | extern int sysctl_ip_default_ttl; |
178 | extern int sysctl_ip_nonlocal_bind; | 178 | extern int sysctl_ip_nonlocal_bind; |
179 | 179 | ||
180 | /* From ip_fragment.c */ | 180 | extern struct ctl_path net_ipv4_ctl_path[]; |
181 | struct inet_frags_ctl; | ||
182 | extern struct inet_frags_ctl ip4_frags_ctl; | ||
183 | extern int sysctl_ipfrag_max_dist; | ||
184 | 181 | ||
185 | /* From inetpeer.c */ | 182 | /* From inetpeer.c */ |
186 | extern int inet_peer_threshold; | 183 | extern int inet_peer_threshold; |
@@ -319,7 +316,7 @@ static __inline__ void inet_reset_saddr(struct sock *sk) | |||
319 | extern int ip_call_ra_chain(struct sk_buff *skb); | 316 | extern int ip_call_ra_chain(struct sk_buff *skb); |
320 | 317 | ||
321 | /* | 318 | /* |
322 | * Functions provided by ip_fragment.o | 319 | * Functions provided by ip_fragment.c |
323 | */ | 320 | */ |
324 | 321 | ||
325 | enum ip_defrag_users | 322 | enum ip_defrag_users |
@@ -334,15 +331,14 @@ enum ip_defrag_users | |||
334 | }; | 331 | }; |
335 | 332 | ||
336 | int ip_defrag(struct sk_buff *skb, u32 user); | 333 | int ip_defrag(struct sk_buff *skb, u32 user); |
337 | int ip_frag_mem(void); | 334 | int ip_frag_mem(struct net *net); |
338 | int ip_frag_nqueues(void); | 335 | int ip_frag_nqueues(struct net *net); |
339 | 336 | ||
340 | /* | 337 | /* |
341 | * Functions provided by ip_forward.c | 338 | * Functions provided by ip_forward.c |
342 | */ | 339 | */ |
343 | 340 | ||
344 | extern int ip_forward(struct sk_buff *skb); | 341 | extern int ip_forward(struct sk_buff *skb); |
345 | extern int ip_net_unreachable(struct sk_buff *skb); | ||
346 | 342 | ||
347 | /* | 343 | /* |
348 | * Functions provided by ip_options.c | 344 | * Functions provided by ip_options.c |
@@ -393,6 +389,4 @@ int ipv4_doint_and_flush_strategy(ctl_table *table, int __user *name, int nlen, | |||
393 | extern int ip_misc_proc_init(void); | 389 | extern int ip_misc_proc_init(void); |
394 | #endif | 390 | #endif |
395 | 391 | ||
396 | extern struct ctl_table ipv4_table[]; | ||
397 | |||
398 | #endif /* _IP_H */ | 392 | #endif /* _IP_H */ |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index 857821360bb6..d8d85b13364d 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -99,16 +99,21 @@ struct rt6_info | |||
99 | u32 rt6i_flags; | 99 | u32 rt6i_flags; |
100 | u32 rt6i_metric; | 100 | u32 rt6i_metric; |
101 | atomic_t rt6i_ref; | 101 | atomic_t rt6i_ref; |
102 | struct fib6_table *rt6i_table; | ||
103 | 102 | ||
104 | struct rt6key rt6i_dst; | 103 | /* more non-fragment space at head required */ |
105 | struct rt6key rt6i_src; | 104 | unsigned short rt6i_nfheader_len; |
106 | 105 | ||
107 | u8 rt6i_protocol; | 106 | u8 rt6i_protocol; |
108 | 107 | ||
108 | struct fib6_table *rt6i_table; | ||
109 | |||
110 | struct rt6key rt6i_dst; | ||
111 | |||
109 | #ifdef CONFIG_XFRM | 112 | #ifdef CONFIG_XFRM |
110 | u32 rt6i_flow_cache_genid; | 113 | u32 rt6i_flow_cache_genid; |
111 | #endif | 114 | #endif |
115 | |||
116 | struct rt6key rt6i_src; | ||
112 | }; | 117 | }; |
113 | 118 | ||
114 | static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) | 119 | static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst) |
@@ -219,10 +224,20 @@ extern void fib6_run_gc(unsigned long dummy); | |||
219 | 224 | ||
220 | extern void fib6_gc_cleanup(void); | 225 | extern void fib6_gc_cleanup(void); |
221 | 226 | ||
222 | extern void fib6_init(void); | 227 | extern int fib6_init(void); |
223 | 228 | ||
224 | extern void fib6_rules_init(void); | 229 | #ifdef CONFIG_IPV6_MULTIPLE_TABLES |
230 | extern int fib6_rules_init(void); | ||
225 | extern void fib6_rules_cleanup(void); | 231 | extern void fib6_rules_cleanup(void); |
226 | 232 | #else | |
233 | static inline int fib6_rules_init(void) | ||
234 | { | ||
235 | return 0; | ||
236 | } | ||
237 | static inline void fib6_rules_cleanup(void) | ||
238 | { | ||
239 | return ; | ||
240 | } | ||
241 | #endif | ||
227 | #endif | 242 | #endif |
228 | #endif | 243 | #endif |
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index 5456fdd6d047..faac0eee1ef3 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -43,14 +43,12 @@ extern struct rt6_info ip6_prohibit_entry; | |||
43 | extern struct rt6_info ip6_blk_hole_entry; | 43 | extern struct rt6_info ip6_blk_hole_entry; |
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | extern int ip6_rt_gc_interval; | ||
47 | |||
48 | extern void ip6_route_input(struct sk_buff *skb); | 46 | extern void ip6_route_input(struct sk_buff *skb); |
49 | 47 | ||
50 | extern struct dst_entry * ip6_route_output(struct sock *sk, | 48 | extern struct dst_entry * ip6_route_output(struct sock *sk, |
51 | struct flowi *fl); | 49 | struct flowi *fl); |
52 | 50 | ||
53 | extern void ip6_route_init(void); | 51 | extern int ip6_route_init(void); |
54 | extern void ip6_route_cleanup(void); | 52 | extern void ip6_route_cleanup(void); |
55 | 53 | ||
56 | extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); | 54 | extern int ipv6_route_ioctl(unsigned int cmd, void __user *arg); |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index ed514bfb61ba..9daa60b544ba 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -125,11 +125,15 @@ struct fib_result_nl { | |||
125 | #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) | 125 | #define FIB_RES_NH(res) ((res).fi->fib_nh[(res).nh_sel]) |
126 | #define FIB_RES_RESET(res) ((res).nh_sel = 0) | 126 | #define FIB_RES_RESET(res) ((res).nh_sel = 0) |
127 | 127 | ||
128 | #define FIB_TABLE_HASHSZ 2 | ||
129 | |||
128 | #else /* CONFIG_IP_ROUTE_MULTIPATH */ | 130 | #else /* CONFIG_IP_ROUTE_MULTIPATH */ |
129 | 131 | ||
130 | #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) | 132 | #define FIB_RES_NH(res) ((res).fi->fib_nh[0]) |
131 | #define FIB_RES_RESET(res) | 133 | #define FIB_RES_RESET(res) |
132 | 134 | ||
135 | #define FIB_TABLE_HASHSZ 256 | ||
136 | |||
133 | #endif /* CONFIG_IP_ROUTE_MULTIPATH */ | 137 | #endif /* CONFIG_IP_ROUTE_MULTIPATH */ |
134 | 138 | ||
135 | #define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __fib_res_prefsrc(&res)) | 139 | #define FIB_RES_PREFSRC(res) ((res).fi->fib_prefsrc ? : __fib_res_prefsrc(&res)) |
@@ -141,6 +145,7 @@ struct fib_table { | |||
141 | struct hlist_node tb_hlist; | 145 | struct hlist_node tb_hlist; |
142 | u32 tb_id; | 146 | u32 tb_id; |
143 | unsigned tb_stamp; | 147 | unsigned tb_stamp; |
148 | int tb_default; | ||
144 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); | 149 | int (*tb_lookup)(struct fib_table *tb, const struct flowi *flp, struct fib_result *res); |
145 | int (*tb_insert)(struct fib_table *, struct fib_config *); | 150 | int (*tb_insert)(struct fib_table *, struct fib_config *); |
146 | int (*tb_delete)(struct fib_table *, struct fib_config *); | 151 | int (*tb_delete)(struct fib_table *, struct fib_config *); |
@@ -155,50 +160,51 @@ struct fib_table { | |||
155 | 160 | ||
156 | #ifndef CONFIG_IP_MULTIPLE_TABLES | 161 | #ifndef CONFIG_IP_MULTIPLE_TABLES |
157 | 162 | ||
158 | extern struct fib_table *ip_fib_local_table; | 163 | #define TABLE_LOCAL_INDEX 0 |
159 | extern struct fib_table *ip_fib_main_table; | 164 | #define TABLE_MAIN_INDEX 1 |
160 | 165 | ||
161 | static inline struct fib_table *fib_get_table(u32 id) | 166 | static inline struct fib_table *fib_get_table(struct net *net, u32 id) |
162 | { | 167 | { |
163 | if (id != RT_TABLE_LOCAL) | 168 | struct hlist_head *ptr; |
164 | return ip_fib_main_table; | ||
165 | return ip_fib_local_table; | ||
166 | } | ||
167 | 169 | ||
168 | static inline struct fib_table *fib_new_table(u32 id) | 170 | ptr = id == RT_TABLE_LOCAL ? |
169 | { | 171 | &net->ipv4.fib_table_hash[TABLE_LOCAL_INDEX] : |
170 | return fib_get_table(id); | 172 | &net->ipv4.fib_table_hash[TABLE_MAIN_INDEX]; |
173 | return hlist_entry(ptr->first, struct fib_table, tb_hlist); | ||
171 | } | 174 | } |
172 | 175 | ||
173 | static inline int fib_lookup(const struct flowi *flp, struct fib_result *res) | 176 | static inline struct fib_table *fib_new_table(struct net *net, u32 id) |
174 | { | 177 | { |
175 | if (ip_fib_local_table->tb_lookup(ip_fib_local_table, flp, res) && | 178 | return fib_get_table(net, id); |
176 | ip_fib_main_table->tb_lookup(ip_fib_main_table, flp, res)) | ||
177 | return -ENETUNREACH; | ||
178 | return 0; | ||
179 | } | 179 | } |
180 | 180 | ||
181 | static inline void fib_select_default(const struct flowi *flp, struct fib_result *res) | 181 | static inline int fib_lookup(struct net *net, const struct flowi *flp, |
182 | struct fib_result *res) | ||
182 | { | 183 | { |
183 | if (FIB_RES_GW(*res) && FIB_RES_NH(*res).nh_scope == RT_SCOPE_LINK) | 184 | struct fib_table *table; |
184 | ip_fib_main_table->tb_select_default(ip_fib_main_table, flp, res); | 185 | |
186 | table = fib_get_table(net, RT_TABLE_LOCAL); | ||
187 | if (!table->tb_lookup(table, flp, res)) | ||
188 | return 0; | ||
189 | |||
190 | table = fib_get_table(net, RT_TABLE_MAIN); | ||
191 | if (!table->tb_lookup(table, flp, res)) | ||
192 | return 0; | ||
193 | return -ENETUNREACH; | ||
185 | } | 194 | } |
186 | 195 | ||
187 | #else /* CONFIG_IP_MULTIPLE_TABLES */ | 196 | #else /* CONFIG_IP_MULTIPLE_TABLES */ |
188 | extern void __init fib4_rules_init(void); | 197 | extern int __net_init fib4_rules_init(struct net *net); |
198 | extern void __net_exit fib4_rules_exit(struct net *net); | ||
189 | 199 | ||
190 | #ifdef CONFIG_NET_CLS_ROUTE | 200 | #ifdef CONFIG_NET_CLS_ROUTE |
191 | extern u32 fib_rules_tclass(struct fib_result *res); | 201 | extern u32 fib_rules_tclass(struct fib_result *res); |
192 | #endif | 202 | #endif |
193 | 203 | ||
194 | #define ip_fib_local_table fib_get_table(RT_TABLE_LOCAL) | 204 | extern int fib_lookup(struct net *n, struct flowi *flp, struct fib_result *res); |
195 | #define ip_fib_main_table fib_get_table(RT_TABLE_MAIN) | ||
196 | |||
197 | extern int fib_lookup(struct flowi *flp, struct fib_result *res); | ||
198 | 205 | ||
199 | extern struct fib_table *fib_new_table(u32 id); | 206 | extern struct fib_table *fib_new_table(struct net *net, u32 id); |
200 | extern struct fib_table *fib_get_table(u32 id); | 207 | extern struct fib_table *fib_get_table(struct net *net, u32 id); |
201 | extern void fib_select_default(const struct flowi *flp, struct fib_result *res); | ||
202 | 208 | ||
203 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ | 209 | #endif /* CONFIG_IP_MULTIPLE_TABLES */ |
204 | 210 | ||
@@ -207,18 +213,19 @@ extern const struct nla_policy rtm_ipv4_policy[]; | |||
207 | extern void ip_fib_init(void); | 213 | extern void ip_fib_init(void); |
208 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | 214 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, |
209 | struct net_device *dev, __be32 *spec_dst, u32 *itag); | 215 | struct net_device *dev, __be32 *spec_dst, u32 *itag); |
210 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); | 216 | extern void fib_select_default(struct net *net, const struct flowi *flp, |
211 | 217 | struct fib_result *res); | |
212 | struct rtentry; | ||
213 | 218 | ||
214 | /* Exported by fib_semantics.c */ | 219 | /* Exported by fib_semantics.c */ |
215 | extern int ip_fib_check_default(__be32 gw, struct net_device *dev); | 220 | extern int ip_fib_check_default(__be32 gw, struct net_device *dev); |
216 | extern int fib_sync_down(__be32 local, struct net_device *dev, int force); | 221 | extern int fib_sync_down(__be32 local, struct net_device *dev, int force); |
217 | extern int fib_sync_up(struct net_device *dev); | 222 | extern int fib_sync_up(struct net_device *dev); |
218 | extern __be32 __fib_res_prefsrc(struct fib_result *res); | 223 | extern __be32 __fib_res_prefsrc(struct fib_result *res); |
224 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); | ||
219 | 225 | ||
220 | /* Exported by fib_hash.c */ | 226 | /* Exported by fib_{hash|trie}.c */ |
221 | extern struct fib_table *fib_hash_init(u32 id); | 227 | extern void fib_hash_init(void); |
228 | extern struct fib_table *fib_hash_table(u32 id); | ||
222 | 229 | ||
223 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) | 230 | static inline void fib_combine_itag(u32 *itag, struct fib_result *res) |
224 | { | 231 | { |
@@ -255,8 +262,8 @@ static inline void fib_res_put(struct fib_result *res) | |||
255 | } | 262 | } |
256 | 263 | ||
257 | #ifdef CONFIG_PROC_FS | 264 | #ifdef CONFIG_PROC_FS |
258 | extern int fib_proc_init(void); | 265 | extern int __net_init fib_proc_init(struct net *net); |
259 | extern void fib_proc_exit(void); | 266 | extern void __net_exit fib_proc_exit(struct net *net); |
260 | #endif | 267 | #endif |
261 | 268 | ||
262 | #endif /* _NET_FIB_H */ | 269 | #endif /* _NET_FIB_H */ |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 8a7d59be8a0d..56f3c94ae620 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #include <asm/types.h> /* For __uXX types */ | 9 | #include <asm/types.h> /* For __uXX types */ |
10 | #include <linux/types.h> /* For __beXX types in userland */ | 10 | #include <linux/types.h> /* For __beXX types in userland */ |
11 | 11 | ||
12 | #include <linux/sysctl.h> /* For ctl_path */ | ||
13 | |||
12 | #define IP_VS_VERSION_CODE 0x010201 | 14 | #define IP_VS_VERSION_CODE 0x010201 |
13 | #define NVERSION(version) \ | 15 | #define NVERSION(version) \ |
14 | (version >> 16) & 0xFF, \ | 16 | (version >> 16) & 0xFF, \ |
@@ -676,7 +678,6 @@ extern const char *ip_vs_proto_name(unsigned proto); | |||
676 | extern void ip_vs_init_hash_table(struct list_head *table, int rows); | 678 | extern void ip_vs_init_hash_table(struct list_head *table, int rows); |
677 | #define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table(t, sizeof(t)/sizeof(t[0])) | 679 | #define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table(t, sizeof(t)/sizeof(t[0])) |
678 | 680 | ||
679 | #define IP_VS_APP_TYPE_UNSPEC 0 | ||
680 | #define IP_VS_APP_TYPE_FTP 1 | 681 | #define IP_VS_APP_TYPE_FTP 1 |
681 | 682 | ||
682 | /* | 683 | /* |
@@ -735,7 +736,6 @@ extern const char * ip_vs_state_name(__u16 proto, int state); | |||
735 | 736 | ||
736 | extern void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp); | 737 | extern void ip_vs_tcp_conn_listen(struct ip_vs_conn *cp); |
737 | extern int ip_vs_check_template(struct ip_vs_conn *ct); | 738 | extern int ip_vs_check_template(struct ip_vs_conn *ct); |
738 | extern void ip_vs_secure_tcp_set(int on); | ||
739 | extern void ip_vs_random_dropentry(void); | 739 | extern void ip_vs_random_dropentry(void); |
740 | extern int ip_vs_conn_init(void); | 740 | extern int ip_vs_conn_init(void); |
741 | extern void ip_vs_conn_cleanup(void); | 741 | extern void ip_vs_conn_cleanup(void); |
@@ -856,6 +856,7 @@ extern int sysctl_ip_vs_expire_quiescent_template; | |||
856 | extern int sysctl_ip_vs_sync_threshold[2]; | 856 | extern int sysctl_ip_vs_sync_threshold[2]; |
857 | extern int sysctl_ip_vs_nat_icmp_send; | 857 | extern int sysctl_ip_vs_nat_icmp_send; |
858 | extern struct ip_vs_stats ip_vs_stats; | 858 | extern struct ip_vs_stats ip_vs_stats; |
859 | extern struct ctl_path net_vs_ctl_path[]; | ||
859 | 860 | ||
860 | extern struct ip_vs_service * | 861 | extern struct ip_vs_service * |
861 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); | 862 | ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); |
diff --git a/include/net/ipip.h b/include/net/ipip.h index 7cdc914322f0..549e132bca9c 100644 --- a/include/net/ipip.h +++ b/include/net/ipip.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __NET_IPIP_H 1 | 2 | #define __NET_IPIP_H 1 |
3 | 3 | ||
4 | #include <linux/if_tunnel.h> | 4 | #include <linux/if_tunnel.h> |
5 | #include <net/ip.h> | ||
5 | 6 | ||
6 | /* Keep error state on tunnel for 30 sec */ | 7 | /* Keep error state on tunnel for 30 sec */ |
7 | #define IPTUNNEL_ERR_TIMEO (30*HZ) | 8 | #define IPTUNNEL_ERR_TIMEO (30*HZ) |
@@ -30,11 +31,9 @@ struct ip_tunnel | |||
30 | int pkt_len = skb->len; \ | 31 | int pkt_len = skb->len; \ |
31 | \ | 32 | \ |
32 | skb->ip_summed = CHECKSUM_NONE; \ | 33 | skb->ip_summed = CHECKSUM_NONE; \ |
33 | iph->tot_len = htons(skb->len); \ | ||
34 | ip_select_ident(iph, &rt->u.dst, NULL); \ | 34 | ip_select_ident(iph, &rt->u.dst, NULL); \ |
35 | ip_send_check(iph); \ | ||
36 | \ | 35 | \ |
37 | err = NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, skb, NULL, rt->u.dst.dev, dst_output);\ | 36 | err = ip_local_out(skb); \ |
38 | if (net_xmit_eval(err) == 0) { \ | 37 | if (net_xmit_eval(err) == 0) { \ |
39 | stats->tx_bytes += pkt_len; \ | 38 | stats->tx_bytes += pkt_len; \ |
40 | stats->tx_packets++; \ | 39 | stats->tx_packets++; \ |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index ae328b680ff2..fa80ea48639d 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -109,9 +109,10 @@ struct frag_hdr { | |||
109 | #include <net/sock.h> | 109 | #include <net/sock.h> |
110 | 110 | ||
111 | /* sysctls */ | 111 | /* sysctls */ |
112 | extern int sysctl_ipv6_bindv6only; | ||
113 | extern int sysctl_mld_max_msf; | 112 | extern int sysctl_mld_max_msf; |
114 | 113 | ||
114 | extern struct ctl_path net_ipv6_ctl_path[]; | ||
115 | |||
115 | #define _DEVINC(statname, modifier, idev, field) \ | 116 | #define _DEVINC(statname, modifier, idev, field) \ |
116 | ({ \ | 117 | ({ \ |
117 | struct inet6_dev *_idev = (idev); \ | 118 | struct inet6_dev *_idev = (idev); \ |
@@ -143,14 +144,6 @@ DECLARE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); | |||
143 | #define ICMP6_INC_STATS_BH(idev, field) _DEVINC(icmpv6, _BH, idev, field) | 144 | #define ICMP6_INC_STATS_BH(idev, field) _DEVINC(icmpv6, _BH, idev, field) |
144 | #define ICMP6_INC_STATS_USER(idev, field) _DEVINC(icmpv6, _USER, idev, field) | 145 | #define ICMP6_INC_STATS_USER(idev, field) _DEVINC(icmpv6, _USER, idev, field) |
145 | 146 | ||
146 | #define ICMP6_INC_STATS_OFFSET_BH(idev, field, offset) ({ \ | ||
147 | struct inet6_dev *_idev = idev; \ | ||
148 | __typeof__(offset) _offset = (offset); \ | ||
149 | if (likely(_idev != NULL)) \ | ||
150 | SNMP_INC_STATS_OFFSET_BH(_idev->stats.icmpv6, field, _offset); \ | ||
151 | SNMP_INC_STATS_OFFSET_BH(icmpv6_statistics, field, _offset); \ | ||
152 | }) | ||
153 | |||
154 | #define ICMP6MSGOUT_INC_STATS(idev, field) \ | 147 | #define ICMP6MSGOUT_INC_STATS(idev, field) \ |
155 | _DEVINC(icmpv6msg, , idev, field +256) | 148 | _DEVINC(icmpv6msg, , idev, field +256) |
156 | #define ICMP6MSGOUT_INC_STATS_BH(idev, field) \ | 149 | #define ICMP6MSGOUT_INC_STATS_BH(idev, field) \ |
@@ -164,15 +157,6 @@ DECLARE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg_statistics); | |||
164 | #define ICMP6MSGIN_INC_STATS_USER(idev, field) \ | 157 | #define ICMP6MSGIN_INC_STATS_USER(idev, field) \ |
165 | _DEVINC(icmpv6msg, _USER, idev, field) | 158 | _DEVINC(icmpv6msg, _USER, idev, field) |
166 | 159 | ||
167 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); | ||
168 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | ||
169 | #define UDP6_INC_STATS_BH(field, is_udplite) do { \ | ||
170 | if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ | ||
171 | else SNMP_INC_STATS_BH(udp_stats_in6, field); } while(0) | ||
172 | #define UDP6_INC_STATS_USER(field, is_udplite) do { \ | ||
173 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ | ||
174 | else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) | ||
175 | |||
176 | struct ip6_ra_chain | 160 | struct ip6_ra_chain |
177 | { | 161 | { |
178 | struct ip6_ra_chain *next; | 162 | struct ip6_ra_chain *next; |
@@ -236,7 +220,7 @@ extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_spac | |||
236 | struct ipv6_txoptions * fopt); | 220 | struct ipv6_txoptions * fopt); |
237 | extern void fl6_free_socklist(struct sock *sk); | 221 | extern void fl6_free_socklist(struct sock *sk); |
238 | extern int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); | 222 | extern int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); |
239 | extern void ip6_flowlabel_init(void); | 223 | extern int ip6_flowlabel_init(void); |
240 | extern void ip6_flowlabel_cleanup(void); | 224 | extern void ip6_flowlabel_cleanup(void); |
241 | 225 | ||
242 | static inline void fl6_sock_release(struct ip6_flowlabel *fl) | 226 | static inline void fl6_sock_release(struct ip6_flowlabel *fl) |
@@ -261,8 +245,8 @@ struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, | |||
261 | 245 | ||
262 | extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); | 246 | extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); |
263 | 247 | ||
264 | int ip6_frag_nqueues(void); | 248 | int ip6_frag_nqueues(struct net *net); |
265 | int ip6_frag_mem(void); | 249 | int ip6_frag_mem(struct net *net); |
266 | 250 | ||
267 | #define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ | 251 | #define IPV6_FRAG_TIMEOUT (60*HZ) /* 60 seconds */ |
268 | 252 | ||
@@ -509,6 +493,9 @@ extern int ip6_forward(struct sk_buff *skb); | |||
509 | extern int ip6_input(struct sk_buff *skb); | 493 | extern int ip6_input(struct sk_buff *skb); |
510 | extern int ip6_mc_input(struct sk_buff *skb); | 494 | extern int ip6_mc_input(struct sk_buff *skb); |
511 | 495 | ||
496 | extern int __ip6_local_out(struct sk_buff *skb); | ||
497 | extern int ip6_local_out(struct sk_buff *skb); | ||
498 | |||
512 | /* | 499 | /* |
513 | * Extension header (options) processing | 500 | * Extension header (options) processing |
514 | */ | 501 | */ |
@@ -559,7 +546,7 @@ extern int compat_ipv6_getsockopt(struct sock *sk, | |||
559 | char __user *optval, | 546 | char __user *optval, |
560 | int __user *optlen); | 547 | int __user *optlen); |
561 | 548 | ||
562 | extern void ipv6_packet_init(void); | 549 | extern int ipv6_packet_init(void); |
563 | 550 | ||
564 | extern void ipv6_packet_cleanup(void); | 551 | extern void ipv6_packet_cleanup(void); |
565 | 552 | ||
@@ -585,9 +572,6 @@ extern int inet6_hash_connect(struct inet_timewait_death_row *death_row, | |||
585 | /* | 572 | /* |
586 | * reassembly.c | 573 | * reassembly.c |
587 | */ | 574 | */ |
588 | struct inet_frags_ctl; | ||
589 | extern struct inet_frags_ctl ip6_frags_ctl; | ||
590 | |||
591 | extern const struct proto_ops inet6_stream_ops; | 575 | extern const struct proto_ops inet6_stream_ops; |
592 | extern const struct proto_ops inet6_dgram_ops; | 576 | extern const struct proto_ops inet6_dgram_ops; |
593 | 577 | ||
@@ -602,6 +586,9 @@ extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, | |||
602 | int __user *optlen); | 586 | int __user *optlen); |
603 | 587 | ||
604 | #ifdef CONFIG_PROC_FS | 588 | #ifdef CONFIG_PROC_FS |
589 | extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net); | ||
590 | extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); | ||
591 | |||
605 | extern int ac6_proc_init(void); | 592 | extern int ac6_proc_init(void); |
606 | extern void ac6_proc_exit(void); | 593 | extern void ac6_proc_exit(void); |
607 | extern int raw6_proc_init(void); | 594 | extern int raw6_proc_init(void); |
@@ -631,10 +618,10 @@ static inline int snmp6_unregister_dev(struct inet6_dev *idev) | |||
631 | #endif | 618 | #endif |
632 | 619 | ||
633 | #ifdef CONFIG_SYSCTL | 620 | #ifdef CONFIG_SYSCTL |
634 | extern ctl_table ipv6_route_table[]; | 621 | extern ctl_table ipv6_route_table_template[]; |
635 | extern ctl_table ipv6_icmp_table[]; | 622 | extern ctl_table ipv6_icmp_table_template[]; |
636 | 623 | ||
637 | extern void ipv6_sysctl_register(void); | 624 | extern int ipv6_sysctl_register(void); |
638 | extern void ipv6_sysctl_unregister(void); | 625 | extern void ipv6_sysctl_unregister(void); |
639 | #endif | 626 | #endif |
640 | 627 | ||
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h index bca19ca7bdd4..f70e9b39ebaf 100644 --- a/include/net/irda/irda_device.h +++ b/include/net/irda/irda_device.h | |||
@@ -228,21 +228,8 @@ static inline int irda_device_txqueue_empty(const struct net_device *dev) | |||
228 | int irda_device_set_raw_mode(struct net_device* self, int status); | 228 | int irda_device_set_raw_mode(struct net_device* self, int status); |
229 | struct net_device *alloc_irdadev(int sizeof_priv); | 229 | struct net_device *alloc_irdadev(int sizeof_priv); |
230 | 230 | ||
231 | /* Dongle interface */ | ||
232 | void irda_device_unregister_dongle(struct dongle_reg *dongle); | ||
233 | int irda_device_register_dongle(struct dongle_reg *dongle); | ||
234 | dongle_t *irda_device_dongle_init(struct net_device *dev, int type); | ||
235 | int irda_device_dongle_cleanup(dongle_t *dongle); | ||
236 | |||
237 | void irda_setup_dma(int channel, dma_addr_t buffer, int count, int mode); | 231 | void irda_setup_dma(int channel, dma_addr_t buffer, int count, int mode); |
238 | 232 | ||
239 | void irda_task_delete(struct irda_task *task); | ||
240 | struct irda_task *irda_task_execute(void *instance, | ||
241 | IRDA_TASK_CALLBACK function, | ||
242 | IRDA_TASK_CALLBACK finished, | ||
243 | struct irda_task *parent, void *param); | ||
244 | void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state); | ||
245 | |||
246 | /* | 233 | /* |
247 | * Function irda_get_mtt (skb) | 234 | * Function irda_get_mtt (skb) |
248 | * | 235 | * |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 17b60391fcd6..9083bafb63ca 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -139,17 +139,54 @@ enum ieee80211_phymode { | |||
139 | }; | 139 | }; |
140 | 140 | ||
141 | /** | 141 | /** |
142 | * struct ieee80211_ht_info - describing STA's HT capabilities | ||
143 | * | ||
144 | * This structure describes most essential parameters needed | ||
145 | * to describe 802.11n HT capabilities for an STA. | ||
146 | * | ||
147 | * @ht_supported: is HT supported by STA, 0: no, 1: yes | ||
148 | * @cap: HT capabilities map as described in 802.11n spec | ||
149 | * @ampdu_factor: Maximum A-MPDU length factor | ||
150 | * @ampdu_density: Minimum A-MPDU spacing | ||
151 | * @supp_mcs_set: Supported MCS set as described in 802.11n spec | ||
152 | */ | ||
153 | struct ieee80211_ht_info { | ||
154 | u8 ht_supported; | ||
155 | u16 cap; /* use IEEE80211_HT_CAP_ */ | ||
156 | u8 ampdu_factor; | ||
157 | u8 ampdu_density; | ||
158 | u8 supp_mcs_set[16]; | ||
159 | }; | ||
160 | |||
161 | /** | ||
162 | * struct ieee80211_ht_bss_info - describing BSS's HT characteristics | ||
163 | * | ||
164 | * This structure describes most essential parameters needed | ||
165 | * to describe 802.11n HT characteristics in a BSS | ||
166 | * | ||
167 | * @primary_channel: channel number of primery channel | ||
168 | * @bss_cap: 802.11n's general BSS capabilities (e.g. channel width) | ||
169 | * @bss_op_mode: 802.11n's BSS operation modes (e.g. HT protection) | ||
170 | */ | ||
171 | struct ieee80211_ht_bss_info { | ||
172 | u8 primary_channel; | ||
173 | u8 bss_cap; /* use IEEE80211_HT_IE_CHA_ */ | ||
174 | u8 bss_op_mode; /* use IEEE80211_HT_IE_ */ | ||
175 | }; | ||
176 | |||
177 | /** | ||
142 | * struct ieee80211_hw_mode - PHY mode definition | 178 | * struct ieee80211_hw_mode - PHY mode definition |
143 | * | 179 | * |
144 | * This structure describes the capabilities supported by the device | 180 | * This structure describes the capabilities supported by the device |
145 | * in a single PHY mode. | 181 | * in a single PHY mode. |
146 | * | 182 | * |
183 | * @list: internal | ||
184 | * @channels: pointer to array of supported channels | ||
185 | * @rates: pointer to array of supported bitrates | ||
147 | * @mode: the PHY mode for this definition | 186 | * @mode: the PHY mode for this definition |
148 | * @num_channels: number of supported channels | 187 | * @num_channels: number of supported channels |
149 | * @channels: pointer to array of supported channels | ||
150 | * @num_rates: number of supported bitrates | 188 | * @num_rates: number of supported bitrates |
151 | * @rates: pointer to array of supported bitrates | 189 | * @ht_info: PHY's 802.11n HT abilities for this mode |
152 | * @list: internal | ||
153 | */ | 190 | */ |
154 | struct ieee80211_hw_mode { | 191 | struct ieee80211_hw_mode { |
155 | struct list_head list; | 192 | struct list_head list; |
@@ -158,6 +195,7 @@ struct ieee80211_hw_mode { | |||
158 | enum ieee80211_phymode mode; | 195 | enum ieee80211_phymode mode; |
159 | int num_channels; | 196 | int num_channels; |
160 | int num_rates; | 197 | int num_rates; |
198 | struct ieee80211_ht_info ht_info; | ||
161 | }; | 199 | }; |
162 | 200 | ||
163 | /** | 201 | /** |
@@ -237,11 +275,49 @@ struct ieee80211_low_level_stats { | |||
237 | unsigned int dot11RTSSuccessCount; | 275 | unsigned int dot11RTSSuccessCount; |
238 | }; | 276 | }; |
239 | 277 | ||
278 | /** | ||
279 | * enum ieee80211_bss_change - BSS change notification flags | ||
280 | * | ||
281 | * These flags are used with the bss_info_changed() callback | ||
282 | * to indicate which BSS parameter changed. | ||
283 | * | ||
284 | * @BSS_CHANGED_ASSOC: association status changed (associated/disassociated), | ||
285 | * also implies a change in the AID. | ||
286 | * @BSS_CHANGED_ERP_CTS_PROT: CTS protection changed | ||
287 | * @BSS_CHANGED_ERP_PREAMBLE: preamble changed | ||
288 | */ | ||
289 | enum ieee80211_bss_change { | ||
290 | BSS_CHANGED_ASSOC = 1<<0, | ||
291 | BSS_CHANGED_ERP_CTS_PROT = 1<<1, | ||
292 | BSS_CHANGED_ERP_PREAMBLE = 1<<2, | ||
293 | }; | ||
294 | |||
295 | /** | ||
296 | * struct ieee80211_bss_conf - holds the BSS's changing parameters | ||
297 | * | ||
298 | * This structure keeps information about a BSS (and an association | ||
299 | * to that BSS) that can change during the lifetime of the BSS. | ||
300 | * | ||
301 | * @assoc: association status | ||
302 | * @aid: association ID number, valid only when @assoc is true | ||
303 | * @use_cts_prot: use CTS protection | ||
304 | * @use_short_preamble: use 802.11b short preamble | ||
305 | */ | ||
306 | struct ieee80211_bss_conf { | ||
307 | /* association related data */ | ||
308 | bool assoc; | ||
309 | u16 aid; | ||
310 | /* erp related data */ | ||
311 | bool use_cts_prot; | ||
312 | bool use_short_preamble; | ||
313 | }; | ||
314 | |||
240 | /* Transmit control fields. This data structure is passed to low-level driver | 315 | /* Transmit control fields. This data structure is passed to low-level driver |
241 | * with each TX frame. The low-level driver is responsible for configuring | 316 | * with each TX frame. The low-level driver is responsible for configuring |
242 | * the hardware to use given values (depending on what is supported). */ | 317 | * the hardware to use given values (depending on what is supported). */ |
243 | 318 | ||
244 | struct ieee80211_tx_control { | 319 | struct ieee80211_tx_control { |
320 | struct ieee80211_vif *vif; | ||
245 | int tx_rate; /* Transmit rate, given as the hw specific value for the | 321 | int tx_rate; /* Transmit rate, given as the hw specific value for the |
246 | * rate (from struct ieee80211_rate) */ | 322 | * rate (from struct ieee80211_rate) */ |
247 | int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw | 323 | int rts_cts_rate; /* Transmit rate for RTS/CTS frame, given as the hw |
@@ -269,6 +345,9 @@ struct ieee80211_tx_control { | |||
269 | * using the through | 345 | * using the through |
270 | * set_retry_limit configured | 346 | * set_retry_limit configured |
271 | * long retry value */ | 347 | * long retry value */ |
348 | #define IEEE80211_TXCTL_EAPOL_FRAME (1<<11) /* internal to mac80211 */ | ||
349 | #define IEEE80211_TXCTL_SEND_AFTER_DTIM (1<<12) /* send this frame after DTIM | ||
350 | * beacon */ | ||
272 | u32 flags; /* tx control flags defined | 351 | u32 flags; /* tx control flags defined |
273 | * above */ | 352 | * above */ |
274 | u8 key_idx; /* keyidx from hw->set_key(), undefined if | 353 | u8 key_idx; /* keyidx from hw->set_key(), undefined if |
@@ -291,7 +370,6 @@ struct ieee80211_tx_control { | |||
291 | * packet dropping when probing higher rates, if hw | 370 | * packet dropping when probing higher rates, if hw |
292 | * supports multiple retry rates. -1 = not used */ | 371 | * supports multiple retry rates. -1 = not used */ |
293 | int type; /* internal */ | 372 | int type; /* internal */ |
294 | int ifindex; /* internal */ | ||
295 | }; | 373 | }; |
296 | 374 | ||
297 | 375 | ||
@@ -312,6 +390,8 @@ struct ieee80211_tx_control { | |||
312 | * the frame. | 390 | * the frame. |
313 | * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on | 391 | * @RX_FLAG_FAILED_PLCP_CRC: Set this flag if the PCLP check failed on |
314 | * the frame. | 392 | * the frame. |
393 | * @RX_FLAG_TSFT: The timestamp passed in the RX status (@mactime field) | ||
394 | * is valid. | ||
315 | */ | 395 | */ |
316 | enum mac80211_rx_flags { | 396 | enum mac80211_rx_flags { |
317 | RX_FLAG_MMIC_ERROR = 1<<0, | 397 | RX_FLAG_MMIC_ERROR = 1<<0, |
@@ -321,6 +401,7 @@ enum mac80211_rx_flags { | |||
321 | RX_FLAG_IV_STRIPPED = 1<<4, | 401 | RX_FLAG_IV_STRIPPED = 1<<4, |
322 | RX_FLAG_FAILED_FCS_CRC = 1<<5, | 402 | RX_FLAG_FAILED_FCS_CRC = 1<<5, |
323 | RX_FLAG_FAILED_PLCP_CRC = 1<<6, | 403 | RX_FLAG_FAILED_PLCP_CRC = 1<<6, |
404 | RX_FLAG_TSFT = 1<<7, | ||
324 | }; | 405 | }; |
325 | 406 | ||
326 | /** | 407 | /** |
@@ -406,11 +487,12 @@ struct ieee80211_tx_status { | |||
406 | * | 487 | * |
407 | * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time | 488 | * @IEEE80211_CONF_SHORT_SLOT_TIME: use 802.11g short slot time |
408 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) | 489 | * @IEEE80211_CONF_RADIOTAP: add radiotap header at receive time (if supported) |
409 | * | 490 | * @IEEE80211_CONF_SUPPORT_HT_MODE: use 802.11n HT capabilities (if supported) |
410 | */ | 491 | */ |
411 | enum ieee80211_conf_flags { | 492 | enum ieee80211_conf_flags { |
412 | IEEE80211_CONF_SHORT_SLOT_TIME = 1<<0, | 493 | IEEE80211_CONF_SHORT_SLOT_TIME = (1<<0), |
413 | IEEE80211_CONF_RADIOTAP = 1<<1, | 494 | IEEE80211_CONF_RADIOTAP = (1<<1), |
495 | IEEE80211_CONF_SUPPORT_HT_MODE = (1<<2), | ||
414 | }; | 496 | }; |
415 | 497 | ||
416 | /** | 498 | /** |
@@ -434,6 +516,8 @@ enum ieee80211_conf_flags { | |||
434 | * @antenna_sel_tx: transmit antenna selection, 0: default/diversity, | 516 | * @antenna_sel_tx: transmit antenna selection, 0: default/diversity, |
435 | * 1/2: antenna 0/1 | 517 | * 1/2: antenna 0/1 |
436 | * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx | 518 | * @antenna_sel_rx: receive antenna selection, like @antenna_sel_tx |
519 | * @ht_conf: describes current self configuration of 802.11n HT capabilies | ||
520 | * @ht_bss_conf: describes current BSS configuration of 802.11n HT parameters | ||
437 | */ | 521 | */ |
438 | struct ieee80211_conf { | 522 | struct ieee80211_conf { |
439 | int channel; /* IEEE 802.11 channel number */ | 523 | int channel; /* IEEE 802.11 channel number */ |
@@ -452,6 +536,9 @@ struct ieee80211_conf { | |||
452 | u8 antenna_max; | 536 | u8 antenna_max; |
453 | u8 antenna_sel_tx; | 537 | u8 antenna_sel_tx; |
454 | u8 antenna_sel_rx; | 538 | u8 antenna_sel_rx; |
539 | |||
540 | struct ieee80211_ht_info ht_conf; | ||
541 | struct ieee80211_ht_bss_info ht_bss_conf; | ||
455 | }; | 542 | }; |
456 | 543 | ||
457 | /** | 544 | /** |
@@ -480,13 +567,27 @@ enum ieee80211_if_types { | |||
480 | }; | 567 | }; |
481 | 568 | ||
482 | /** | 569 | /** |
570 | * struct ieee80211_vif - per-interface data | ||
571 | * | ||
572 | * Data in this structure is continually present for driver | ||
573 | * use during the life of a virtual interface. | ||
574 | * | ||
575 | * @type: type of this virtual interface | ||
576 | * @drv_priv: data area for driver use, will always be aligned to | ||
577 | * sizeof(void *). | ||
578 | */ | ||
579 | struct ieee80211_vif { | ||
580 | enum ieee80211_if_types type; | ||
581 | /* must be last */ | ||
582 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | ||
583 | }; | ||
584 | |||
585 | /** | ||
483 | * struct ieee80211_if_init_conf - initial configuration of an interface | 586 | * struct ieee80211_if_init_conf - initial configuration of an interface |
484 | * | 587 | * |
485 | * @if_id: internal interface ID. This number has no particular meaning to | 588 | * @vif: pointer to a driver-use per-interface structure. The pointer |
486 | * drivers and the only allowed usage is to pass it to | 589 | * itself is also used for various functions including |
487 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc() functions. | 590 | * ieee80211_beacon_get() and ieee80211_get_buffered_bc(). |
488 | * This field is not valid for monitor interfaces | ||
489 | * (interfaces of %IEEE80211_IF_TYPE_MNTR type). | ||
490 | * @type: one of &enum ieee80211_if_types constants. Determines the type of | 591 | * @type: one of &enum ieee80211_if_types constants. Determines the type of |
491 | * added/removed interface. | 592 | * added/removed interface. |
492 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid | 593 | * @mac_addr: pointer to MAC address of the interface. This pointer is valid |
@@ -503,8 +604,8 @@ enum ieee80211_if_types { | |||
503 | * in pure monitor mode. | 604 | * in pure monitor mode. |
504 | */ | 605 | */ |
505 | struct ieee80211_if_init_conf { | 606 | struct ieee80211_if_init_conf { |
506 | int if_id; | ||
507 | enum ieee80211_if_types type; | 607 | enum ieee80211_if_types type; |
608 | struct ieee80211_vif *vif; | ||
508 | void *mac_addr; | 609 | void *mac_addr; |
509 | }; | 610 | }; |
510 | 611 | ||
@@ -597,9 +698,6 @@ struct ieee80211_key_conf { | |||
597 | u8 key[0]; | 698 | u8 key[0]; |
598 | }; | 699 | }; |
599 | 700 | ||
600 | #define IEEE80211_SEQ_COUNTER_RX 0 | ||
601 | #define IEEE80211_SEQ_COUNTER_TX 1 | ||
602 | |||
603 | /** | 701 | /** |
604 | * enum set_key_cmd - key command | 702 | * enum set_key_cmd - key command |
605 | * | 703 | * |
@@ -710,6 +808,9 @@ enum ieee80211_hw_flags { | |||
710 | * @rate_control_algorithm: rate control algorithm for this hardware. | 808 | * @rate_control_algorithm: rate control algorithm for this hardware. |
711 | * If unset (NULL), the default algorithm will be used. Must be | 809 | * If unset (NULL), the default algorithm will be used. Must be |
712 | * set before calling ieee80211_register_hw(). | 810 | * set before calling ieee80211_register_hw(). |
811 | * | ||
812 | * @vif_data_size: size (in bytes) of the drv_priv data area | ||
813 | * within &struct ieee80211_vif. | ||
713 | */ | 814 | */ |
714 | struct ieee80211_hw { | 815 | struct ieee80211_hw { |
715 | struct ieee80211_conf conf; | 816 | struct ieee80211_conf conf; |
@@ -720,6 +821,7 @@ struct ieee80211_hw { | |||
720 | u32 flags; | 821 | u32 flags; |
721 | unsigned int extra_tx_headroom; | 822 | unsigned int extra_tx_headroom; |
722 | int channel_change_time; | 823 | int channel_change_time; |
824 | int vif_data_size; | ||
723 | u8 queues; | 825 | u8 queues; |
724 | s8 max_rssi; | 826 | s8 max_rssi; |
725 | s8 max_signal; | 827 | s8 max_signal; |
@@ -859,19 +961,18 @@ enum ieee80211_filter_flags { | |||
859 | }; | 961 | }; |
860 | 962 | ||
861 | /** | 963 | /** |
862 | * enum ieee80211_erp_change_flags - erp change flags | 964 | * enum ieee80211_ampdu_mlme_action - A-MPDU actions |
863 | * | 965 | * |
864 | * These flags are used with the erp_ie_changed() callback in | 966 | * These flags are used with the ampdu_action() callback in |
865 | * &struct ieee80211_ops to indicate which parameter(s) changed. | 967 | * &struct ieee80211_ops to indicate which action is needed. |
866 | * @IEEE80211_ERP_CHANGE_PROTECTION: protection changed | 968 | * @IEEE80211_AMPDU_RX_START: start Rx aggregation |
867 | * @IEEE80211_ERP_CHANGE_PREAMBLE: barker preamble mode changed | 969 | * @IEEE80211_AMPDU_RX_STOP: stop Rx aggregation |
868 | */ | 970 | */ |
869 | enum ieee80211_erp_change_flags { | 971 | enum ieee80211_ampdu_mlme_action { |
870 | IEEE80211_ERP_CHANGE_PROTECTION = 1<<0, | 972 | IEEE80211_AMPDU_RX_START, |
871 | IEEE80211_ERP_CHANGE_PREAMBLE = 1<<1, | 973 | IEEE80211_AMPDU_RX_STOP, |
872 | }; | 974 | }; |
873 | 975 | ||
874 | |||
875 | /** | 976 | /** |
876 | * struct ieee80211_ops - callbacks from mac80211 to the driver | 977 | * struct ieee80211_ops - callbacks from mac80211 to the driver |
877 | * | 978 | * |
@@ -927,6 +1028,14 @@ enum ieee80211_erp_change_flags { | |||
927 | * @config_interface: Handler for configuration requests related to interfaces | 1028 | * @config_interface: Handler for configuration requests related to interfaces |
928 | * (e.g. BSSID changes.) | 1029 | * (e.g. BSSID changes.) |
929 | * | 1030 | * |
1031 | * @bss_info_changed: Handler for configuration requests related to BSS | ||
1032 | * parameters that may vary during BSS's lifespan, and may affect low | ||
1033 | * level driver (e.g. assoc/disassoc status, erp parameters). | ||
1034 | * This function should not be used if no BSS has been set, unless | ||
1035 | * for association indication. The @changed parameter indicates which | ||
1036 | * of the bss parameters has changed when a call is made. This callback | ||
1037 | * has to be atomic. | ||
1038 | * | ||
930 | * @configure_filter: Configure the device's RX filter. | 1039 | * @configure_filter: Configure the device's RX filter. |
931 | * See the section "Frame filtering" for more information. | 1040 | * See the section "Frame filtering" for more information. |
932 | * This callback must be implemented and atomic. | 1041 | * This callback must be implemented and atomic. |
@@ -946,9 +1055,9 @@ enum ieee80211_erp_change_flags { | |||
946 | * | 1055 | * |
947 | * @get_stats: return low-level statistics | 1056 | * @get_stats: return low-level statistics |
948 | * | 1057 | * |
949 | * @get_sequence_counter: For devices that have internal sequence counters this | 1058 | * @get_tkip_seq: If your device implements TKIP encryption in hardware this |
950 | * callback allows mac80211 to access the current value of a counter. | 1059 | * callback should be provided to read the TKIP transmit IVs (both IV32 |
951 | * This callback seems not well-defined, tell us if you need it. | 1060 | * and IV16) for the given key from hardware. |
952 | * | 1061 | * |
953 | * @set_rts_threshold: Configuration of RTS threshold (if device needs it) | 1062 | * @set_rts_threshold: Configuration of RTS threshold (if device needs it) |
954 | * | 1063 | * |
@@ -961,8 +1070,6 @@ enum ieee80211_erp_change_flags { | |||
961 | * @sta_notify: Notifies low level driver about addition or removal | 1070 | * @sta_notify: Notifies low level driver about addition or removal |
962 | * of assocaited station or AP. | 1071 | * of assocaited station or AP. |
963 | * | 1072 | * |
964 | * @erp_ie_changed: Handle ERP IE change notifications. Must be atomic. | ||
965 | * | ||
966 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), | 1073 | * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max), |
967 | * bursting) for a hardware TX queue. The @queue parameter uses the | 1074 | * bursting) for a hardware TX queue. The @queue parameter uses the |
968 | * %IEEE80211_TX_QUEUE_* constants. Must be atomic. | 1075 | * %IEEE80211_TX_QUEUE_* constants. Must be atomic. |
@@ -997,6 +1104,14 @@ enum ieee80211_erp_change_flags { | |||
997 | * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. | 1104 | * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us. |
998 | * This is needed only for IBSS mode and the result of this function is | 1105 | * This is needed only for IBSS mode and the result of this function is |
999 | * used to determine whether to reply to Probe Requests. | 1106 | * used to determine whether to reply to Probe Requests. |
1107 | * | ||
1108 | * @conf_ht: Configures low level driver with 802.11n HT data. Must be atomic. | ||
1109 | * | ||
1110 | * @ampdu_action: Perform a certain A-MPDU action | ||
1111 | * The RA/TID combination determines the destination and TID we want | ||
1112 | * the ampdu action to be performed for. The action is defined through | ||
1113 | * ieee80211_ampdu_mlme_action. Starting sequence number (@ssn) | ||
1114 | * is the first frame we expect to perform the action on. | ||
1000 | */ | 1115 | */ |
1001 | struct ieee80211_ops { | 1116 | struct ieee80211_ops { |
1002 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, | 1117 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb, |
@@ -1009,7 +1124,12 @@ struct ieee80211_ops { | |||
1009 | struct ieee80211_if_init_conf *conf); | 1124 | struct ieee80211_if_init_conf *conf); |
1010 | int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | 1125 | int (*config)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); |
1011 | int (*config_interface)(struct ieee80211_hw *hw, | 1126 | int (*config_interface)(struct ieee80211_hw *hw, |
1012 | int if_id, struct ieee80211_if_conf *conf); | 1127 | struct ieee80211_vif *vif, |
1128 | struct ieee80211_if_conf *conf); | ||
1129 | void (*bss_info_changed)(struct ieee80211_hw *hw, | ||
1130 | struct ieee80211_vif *vif, | ||
1131 | struct ieee80211_bss_conf *info, | ||
1132 | u32 changed); | ||
1013 | void (*configure_filter)(struct ieee80211_hw *hw, | 1133 | void (*configure_filter)(struct ieee80211_hw *hw, |
1014 | unsigned int changed_flags, | 1134 | unsigned int changed_flags, |
1015 | unsigned int *total_flags, | 1135 | unsigned int *total_flags, |
@@ -1021,17 +1141,14 @@ struct ieee80211_ops { | |||
1021 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); | 1141 | int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len); |
1022 | int (*get_stats)(struct ieee80211_hw *hw, | 1142 | int (*get_stats)(struct ieee80211_hw *hw, |
1023 | struct ieee80211_low_level_stats *stats); | 1143 | struct ieee80211_low_level_stats *stats); |
1024 | int (*get_sequence_counter)(struct ieee80211_hw *hw, | 1144 | void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx, |
1025 | u8* addr, u8 keyidx, u8 txrx, | 1145 | u32 *iv32, u16 *iv16); |
1026 | u32* iv32, u16* iv16); | ||
1027 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); | 1146 | int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value); |
1028 | int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); | 1147 | int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value); |
1029 | int (*set_retry_limit)(struct ieee80211_hw *hw, | 1148 | int (*set_retry_limit)(struct ieee80211_hw *hw, |
1030 | u32 short_retry, u32 long_retr); | 1149 | u32 short_retry, u32 long_retr); |
1031 | void (*sta_notify)(struct ieee80211_hw *hw, int if_id, | 1150 | void (*sta_notify)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1032 | enum sta_notify_cmd, const u8 *addr); | 1151 | enum sta_notify_cmd, const u8 *addr); |
1033 | void (*erp_ie_changed)(struct ieee80211_hw *hw, u8 changes, | ||
1034 | int cts_protection, int preamble); | ||
1035 | int (*conf_tx)(struct ieee80211_hw *hw, int queue, | 1152 | int (*conf_tx)(struct ieee80211_hw *hw, int queue, |
1036 | const struct ieee80211_tx_queue_params *params); | 1153 | const struct ieee80211_tx_queue_params *params); |
1037 | int (*get_tx_stats)(struct ieee80211_hw *hw, | 1154 | int (*get_tx_stats)(struct ieee80211_hw *hw, |
@@ -1042,6 +1159,10 @@ struct ieee80211_ops { | |||
1042 | struct sk_buff *skb, | 1159 | struct sk_buff *skb, |
1043 | struct ieee80211_tx_control *control); | 1160 | struct ieee80211_tx_control *control); |
1044 | int (*tx_last_beacon)(struct ieee80211_hw *hw); | 1161 | int (*tx_last_beacon)(struct ieee80211_hw *hw); |
1162 | int (*conf_ht)(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | ||
1163 | int (*ampdu_action)(struct ieee80211_hw *hw, | ||
1164 | enum ieee80211_ampdu_mlme_action action, | ||
1165 | const u8 *ra, u16 tid, u16 ssn); | ||
1045 | }; | 1166 | }; |
1046 | 1167 | ||
1047 | /** | 1168 | /** |
@@ -1073,6 +1194,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw); | |||
1073 | extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); | 1194 | extern char *__ieee80211_get_tx_led_name(struct ieee80211_hw *hw); |
1074 | extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); | 1195 | extern char *__ieee80211_get_rx_led_name(struct ieee80211_hw *hw); |
1075 | extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw); | 1196 | extern char *__ieee80211_get_assoc_led_name(struct ieee80211_hw *hw); |
1197 | extern char *__ieee80211_get_radio_led_name(struct ieee80211_hw *hw); | ||
1076 | #endif | 1198 | #endif |
1077 | /** | 1199 | /** |
1078 | * ieee80211_get_tx_led_name - get name of TX LED | 1200 | * ieee80211_get_tx_led_name - get name of TX LED |
@@ -1112,6 +1234,16 @@ static inline char *ieee80211_get_rx_led_name(struct ieee80211_hw *hw) | |||
1112 | #endif | 1234 | #endif |
1113 | } | 1235 | } |
1114 | 1236 | ||
1237 | /** | ||
1238 | * ieee80211_get_assoc_led_name - get name of association LED | ||
1239 | * | ||
1240 | * mac80211 creates a association LED trigger for each wireless hardware | ||
1241 | * that can be used to drive LEDs if your driver registers a LED device. | ||
1242 | * This function returns the name (or %NULL if not configured for LEDs) | ||
1243 | * of the trigger so you can automatically link the LED device. | ||
1244 | * | ||
1245 | * @hw: the hardware to get the LED trigger name for | ||
1246 | */ | ||
1115 | static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) | 1247 | static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) |
1116 | { | 1248 | { |
1117 | #ifdef CONFIG_MAC80211_LEDS | 1249 | #ifdef CONFIG_MAC80211_LEDS |
@@ -1121,6 +1253,24 @@ static inline char *ieee80211_get_assoc_led_name(struct ieee80211_hw *hw) | |||
1121 | #endif | 1253 | #endif |
1122 | } | 1254 | } |
1123 | 1255 | ||
1256 | /** | ||
1257 | * ieee80211_get_radio_led_name - get name of radio LED | ||
1258 | * | ||
1259 | * mac80211 creates a radio change LED trigger for each wireless hardware | ||
1260 | * that can be used to drive LEDs if your driver registers a LED device. | ||
1261 | * This function returns the name (or %NULL if not configured for LEDs) | ||
1262 | * of the trigger so you can automatically link the LED device. | ||
1263 | * | ||
1264 | * @hw: the hardware to get the LED trigger name for | ||
1265 | */ | ||
1266 | static inline char *ieee80211_get_radio_led_name(struct ieee80211_hw *hw) | ||
1267 | { | ||
1268 | #ifdef CONFIG_MAC80211_LEDS | ||
1269 | return __ieee80211_get_radio_led_name(hw); | ||
1270 | #else | ||
1271 | return NULL; | ||
1272 | #endif | ||
1273 | } | ||
1124 | 1274 | ||
1125 | /* Register a new hardware PHYMODE capability to the stack. */ | 1275 | /* Register a new hardware PHYMODE capability to the stack. */ |
1126 | int ieee80211_register_hwmode(struct ieee80211_hw *hw, | 1276 | int ieee80211_register_hwmode(struct ieee80211_hw *hw, |
@@ -1210,7 +1360,7 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, | |||
1210 | /** | 1360 | /** |
1211 | * ieee80211_beacon_get - beacon generation function | 1361 | * ieee80211_beacon_get - beacon generation function |
1212 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1362 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1213 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1363 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1214 | * @control: will be filled with information needed to send this beacon. | 1364 | * @control: will be filled with information needed to send this beacon. |
1215 | * | 1365 | * |
1216 | * If the beacon frames are generated by the host system (i.e., not in | 1366 | * If the beacon frames are generated by the host system (i.e., not in |
@@ -1221,13 +1371,13 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, | |||
1221 | * is responsible of freeing it. | 1371 | * is responsible of freeing it. |
1222 | */ | 1372 | */ |
1223 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | 1373 | struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, |
1224 | int if_id, | 1374 | struct ieee80211_vif *vif, |
1225 | struct ieee80211_tx_control *control); | 1375 | struct ieee80211_tx_control *control); |
1226 | 1376 | ||
1227 | /** | 1377 | /** |
1228 | * ieee80211_rts_get - RTS frame generation function | 1378 | * ieee80211_rts_get - RTS frame generation function |
1229 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1379 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1230 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1380 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1231 | * @frame: pointer to the frame that is going to be protected by the RTS. | 1381 | * @frame: pointer to the frame that is going to be protected by the RTS. |
1232 | * @frame_len: the frame length (in octets). | 1382 | * @frame_len: the frame length (in octets). |
1233 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1383 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
@@ -1238,7 +1388,7 @@ struct sk_buff *ieee80211_beacon_get(struct ieee80211_hw *hw, | |||
1238 | * the next RTS frame from the 802.11 code. The low-level is responsible | 1388 | * the next RTS frame from the 802.11 code. The low-level is responsible |
1239 | * for calling this function before and RTS frame is needed. | 1389 | * for calling this function before and RTS frame is needed. |
1240 | */ | 1390 | */ |
1241 | void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, | 1391 | void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1242 | const void *frame, size_t frame_len, | 1392 | const void *frame, size_t frame_len, |
1243 | const struct ieee80211_tx_control *frame_txctl, | 1393 | const struct ieee80211_tx_control *frame_txctl, |
1244 | struct ieee80211_rts *rts); | 1394 | struct ieee80211_rts *rts); |
@@ -1246,7 +1396,7 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, | |||
1246 | /** | 1396 | /** |
1247 | * ieee80211_rts_duration - Get the duration field for an RTS frame | 1397 | * ieee80211_rts_duration - Get the duration field for an RTS frame |
1248 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1398 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1249 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1399 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1250 | * @frame_len: the length of the frame that is going to be protected by the RTS. | 1400 | * @frame_len: the length of the frame that is going to be protected by the RTS. |
1251 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1401 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
1252 | * | 1402 | * |
@@ -1254,14 +1404,14 @@ void ieee80211_rts_get(struct ieee80211_hw *hw, int if_id, | |||
1254 | * the duration field, the low-level driver uses this function to receive | 1404 | * the duration field, the low-level driver uses this function to receive |
1255 | * the duration field value in little-endian byteorder. | 1405 | * the duration field value in little-endian byteorder. |
1256 | */ | 1406 | */ |
1257 | __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, | 1407 | __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, |
1258 | size_t frame_len, | 1408 | struct ieee80211_vif *vif, size_t frame_len, |
1259 | const struct ieee80211_tx_control *frame_txctl); | 1409 | const struct ieee80211_tx_control *frame_txctl); |
1260 | 1410 | ||
1261 | /** | 1411 | /** |
1262 | * ieee80211_ctstoself_get - CTS-to-self frame generation function | 1412 | * ieee80211_ctstoself_get - CTS-to-self frame generation function |
1263 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1413 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1264 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1414 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1265 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. | 1415 | * @frame: pointer to the frame that is going to be protected by the CTS-to-self. |
1266 | * @frame_len: the frame length (in octets). | 1416 | * @frame_len: the frame length (in octets). |
1267 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1417 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
@@ -1272,7 +1422,8 @@ __le16 ieee80211_rts_duration(struct ieee80211_hw *hw, int if_id, | |||
1272 | * the next CTS-to-self frame from the 802.11 code. The low-level is responsible | 1422 | * the next CTS-to-self frame from the 802.11 code. The low-level is responsible |
1273 | * for calling this function before and CTS-to-self frame is needed. | 1423 | * for calling this function before and CTS-to-self frame is needed. |
1274 | */ | 1424 | */ |
1275 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, | 1425 | void ieee80211_ctstoself_get(struct ieee80211_hw *hw, |
1426 | struct ieee80211_vif *vif, | ||
1276 | const void *frame, size_t frame_len, | 1427 | const void *frame, size_t frame_len, |
1277 | const struct ieee80211_tx_control *frame_txctl, | 1428 | const struct ieee80211_tx_control *frame_txctl, |
1278 | struct ieee80211_cts *cts); | 1429 | struct ieee80211_cts *cts); |
@@ -1280,7 +1431,7 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, | |||
1280 | /** | 1431 | /** |
1281 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame | 1432 | * ieee80211_ctstoself_duration - Get the duration field for a CTS-to-self frame |
1282 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1433 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1283 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1434 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1284 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. | 1435 | * @frame_len: the length of the frame that is going to be protected by the CTS-to-self. |
1285 | * @frame_txctl: &struct ieee80211_tx_control of the frame. | 1436 | * @frame_txctl: &struct ieee80211_tx_control of the frame. |
1286 | * | 1437 | * |
@@ -1288,28 +1439,30 @@ void ieee80211_ctstoself_get(struct ieee80211_hw *hw, int if_id, | |||
1288 | * the duration field, the low-level driver uses this function to receive | 1439 | * the duration field, the low-level driver uses this function to receive |
1289 | * the duration field value in little-endian byteorder. | 1440 | * the duration field value in little-endian byteorder. |
1290 | */ | 1441 | */ |
1291 | __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, int if_id, | 1442 | __le16 ieee80211_ctstoself_duration(struct ieee80211_hw *hw, |
1443 | struct ieee80211_vif *vif, | ||
1292 | size_t frame_len, | 1444 | size_t frame_len, |
1293 | const struct ieee80211_tx_control *frame_txctl); | 1445 | const struct ieee80211_tx_control *frame_txctl); |
1294 | 1446 | ||
1295 | /** | 1447 | /** |
1296 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame | 1448 | * ieee80211_generic_frame_duration - Calculate the duration field for a frame |
1297 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 1449 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
1298 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1450 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1299 | * @frame_len: the length of the frame. | 1451 | * @frame_len: the length of the frame. |
1300 | * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. | 1452 | * @rate: the rate (in 100kbps) at which the frame is going to be transmitted. |
1301 | * | 1453 | * |
1302 | * Calculate the duration field of some generic frame, given its | 1454 | * Calculate the duration field of some generic frame, given its |
1303 | * length and transmission rate (in 100kbps). | 1455 | * length and transmission rate (in 100kbps). |
1304 | */ | 1456 | */ |
1305 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, | 1457 | __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, |
1458 | struct ieee80211_vif *vif, | ||
1306 | size_t frame_len, | 1459 | size_t frame_len, |
1307 | int rate); | 1460 | int rate); |
1308 | 1461 | ||
1309 | /** | 1462 | /** |
1310 | * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames | 1463 | * ieee80211_get_buffered_bc - accessing buffered broadcast and multicast frames |
1311 | * @hw: pointer as obtained from ieee80211_alloc_hw(). | 1464 | * @hw: pointer as obtained from ieee80211_alloc_hw(). |
1312 | * @if_id: interface ID from &struct ieee80211_if_init_conf. | 1465 | * @vif: &struct ieee80211_vif pointer from &struct ieee80211_if_init_conf. |
1313 | * @control: will be filled with information needed to send returned frame. | 1466 | * @control: will be filled with information needed to send returned frame. |
1314 | * | 1467 | * |
1315 | * Function for accessing buffered broadcast and multicast frames. If | 1468 | * Function for accessing buffered broadcast and multicast frames. If |
@@ -1328,7 +1481,7 @@ __le16 ieee80211_generic_frame_duration(struct ieee80211_hw *hw, int if_id, | |||
1328 | * use common code for all beacons. | 1481 | * use common code for all beacons. |
1329 | */ | 1482 | */ |
1330 | struct sk_buff * | 1483 | struct sk_buff * |
1331 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, int if_id, | 1484 | ieee80211_get_buffered_bc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1332 | struct ieee80211_tx_control *control); | 1485 | struct ieee80211_tx_control *control); |
1333 | 1486 | ||
1334 | /** | 1487 | /** |
@@ -1406,4 +1559,19 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw); | |||
1406 | */ | 1559 | */ |
1407 | void ieee80211_scan_completed(struct ieee80211_hw *hw); | 1560 | void ieee80211_scan_completed(struct ieee80211_hw *hw); |
1408 | 1561 | ||
1562 | /** | ||
1563 | * ieee80211_iterate_active_interfaces - iterate active interfaces | ||
1564 | * | ||
1565 | * This function iterates over the interfaces associated with a given | ||
1566 | * hardware that are currently active and calls the callback for them. | ||
1567 | * | ||
1568 | * @hw: the hardware struct of which the interfaces should be iterated over | ||
1569 | * @iterator: the iterator function to call, cannot sleep | ||
1570 | * @data: first argument of the iterator function | ||
1571 | */ | ||
1572 | void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, | ||
1573 | void (*iterator)(void *data, u8 *mac, | ||
1574 | struct ieee80211_vif *vif), | ||
1575 | void *data); | ||
1576 | |||
1409 | #endif /* MAC80211_H */ | 1577 | #endif /* MAC80211_H */ |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index a4f26187fc1a..ebbfb509822e 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -26,6 +26,10 @@ | |||
26 | #include <linux/sysctl.h> | 26 | #include <linux/sysctl.h> |
27 | #include <net/rtnetlink.h> | 27 | #include <net/rtnetlink.h> |
28 | 28 | ||
29 | /* | ||
30 | * NUD stands for "neighbor unreachability detection" | ||
31 | */ | ||
32 | |||
29 | #define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) | 33 | #define NUD_IN_TIMER (NUD_INCOMPLETE|NUD_REACHABLE|NUD_DELAY|NUD_PROBE) |
30 | #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) | 34 | #define NUD_VALID (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE|NUD_PROBE|NUD_STALE|NUD_DELAY) |
31 | #define NUD_CONNECTED (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE) | 35 | #define NUD_CONNECTED (NUD_PERMANENT|NUD_NOARP|NUD_REACHABLE) |
@@ -34,6 +38,7 @@ struct neighbour; | |||
34 | 38 | ||
35 | struct neigh_parms | 39 | struct neigh_parms |
36 | { | 40 | { |
41 | struct net *net; | ||
37 | struct net_device *dev; | 42 | struct net_device *dev; |
38 | struct neigh_parms *next; | 43 | struct neigh_parms *next; |
39 | int (*neigh_setup)(struct neighbour *); | 44 | int (*neigh_setup)(struct neighbour *); |
@@ -126,7 +131,8 @@ struct neigh_ops | |||
126 | struct pneigh_entry | 131 | struct pneigh_entry |
127 | { | 132 | { |
128 | struct pneigh_entry *next; | 133 | struct pneigh_entry *next; |
129 | struct net_device *dev; | 134 | struct net *net; |
135 | struct net_device *dev; | ||
130 | u8 flags; | 136 | u8 flags; |
131 | u8 key[0]; | 137 | u8 key[0]; |
132 | }; | 138 | }; |
@@ -187,6 +193,7 @@ extern struct neighbour * neigh_lookup(struct neigh_table *tbl, | |||
187 | const void *pkey, | 193 | const void *pkey, |
188 | struct net_device *dev); | 194 | struct net_device *dev); |
189 | extern struct neighbour * neigh_lookup_nodev(struct neigh_table *tbl, | 195 | extern struct neighbour * neigh_lookup_nodev(struct neigh_table *tbl, |
196 | struct net *net, | ||
190 | const void *pkey); | 197 | const void *pkey); |
191 | extern struct neighbour * neigh_create(struct neigh_table *tbl, | 198 | extern struct neighbour * neigh_create(struct neigh_table *tbl, |
192 | const void *pkey, | 199 | const void *pkey, |
@@ -206,13 +213,12 @@ extern struct neighbour *neigh_event_ns(struct neigh_table *tbl, | |||
206 | 213 | ||
207 | extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); | 214 | extern struct neigh_parms *neigh_parms_alloc(struct net_device *dev, struct neigh_table *tbl); |
208 | extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); | 215 | extern void neigh_parms_release(struct neigh_table *tbl, struct neigh_parms *parms); |
209 | extern void neigh_parms_destroy(struct neigh_parms *parms); | ||
210 | extern unsigned long neigh_rand_reach_time(unsigned long base); | 216 | extern unsigned long neigh_rand_reach_time(unsigned long base); |
211 | 217 | ||
212 | extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, | 218 | extern void pneigh_enqueue(struct neigh_table *tbl, struct neigh_parms *p, |
213 | struct sk_buff *skb); | 219 | struct sk_buff *skb); |
214 | extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, const void *key, struct net_device *dev, int creat); | 220 | extern struct pneigh_entry *pneigh_lookup(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev, int creat); |
215 | extern int pneigh_delete(struct neigh_table *tbl, const void *key, struct net_device *dev); | 221 | extern int pneigh_delete(struct neigh_table *tbl, struct net *net, const void *key, struct net_device *dev); |
216 | 222 | ||
217 | extern void neigh_app_ns(struct neighbour *n); | 223 | extern void neigh_app_ns(struct neighbour *n); |
218 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); | 224 | extern void neigh_for_each(struct neigh_table *tbl, void (*cb)(struct neighbour *, void *), void *cookie); |
@@ -220,6 +226,7 @@ extern void __neigh_for_each_release(struct neigh_table *tbl, int (*cb)(struct n | |||
220 | extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); | 226 | extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_entry *)); |
221 | 227 | ||
222 | struct neigh_seq_state { | 228 | struct neigh_seq_state { |
229 | struct seq_net_private p; | ||
223 | struct neigh_table *tbl; | 230 | struct neigh_table *tbl; |
224 | void *(*neigh_sub_iter)(struct neigh_seq_state *state, | 231 | void *(*neigh_sub_iter)(struct neigh_seq_state *state, |
225 | struct neighbour *n, loff_t *pos); | 232 | struct neighbour *n, loff_t *pos); |
@@ -246,12 +253,6 @@ static inline void __neigh_parms_put(struct neigh_parms *parms) | |||
246 | atomic_dec(&parms->refcnt); | 253 | atomic_dec(&parms->refcnt); |
247 | } | 254 | } |
248 | 255 | ||
249 | static inline void neigh_parms_put(struct neigh_parms *parms) | ||
250 | { | ||
251 | if (atomic_dec_and_test(&parms->refcnt)) | ||
252 | neigh_parms_destroy(parms); | ||
253 | } | ||
254 | |||
255 | static inline struct neigh_parms *neigh_parms_clone(struct neigh_parms *parms) | 256 | static inline struct neigh_parms *neigh_parms_clone(struct neigh_parms *parms) |
256 | { | 257 | { |
257 | atomic_inc(&parms->refcnt); | 258 | atomic_inc(&parms->refcnt); |
@@ -288,10 +289,6 @@ static inline int neigh_is_connected(struct neighbour *neigh) | |||
288 | return neigh->nud_state&NUD_CONNECTED; | 289 | return neigh->nud_state&NUD_CONNECTED; |
289 | } | 290 | } |
290 | 291 | ||
291 | static inline int neigh_is_valid(struct neighbour *neigh) | ||
292 | { | ||
293 | return neigh->nud_state&NUD_VALID; | ||
294 | } | ||
295 | 292 | ||
296 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | 293 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) |
297 | { | 294 | { |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index 5dd6d90b37eb..b8c1d60ba9e4 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
@@ -8,8 +8,16 @@ | |||
8 | #include <linux/workqueue.h> | 8 | #include <linux/workqueue.h> |
9 | #include <linux/list.h> | 9 | #include <linux/list.h> |
10 | 10 | ||
11 | #include <net/netns/unix.h> | ||
12 | #include <net/netns/packet.h> | ||
13 | #include <net/netns/ipv4.h> | ||
14 | #include <net/netns/ipv6.h> | ||
15 | |||
11 | struct proc_dir_entry; | 16 | struct proc_dir_entry; |
12 | struct net_device; | 17 | struct net_device; |
18 | struct sock; | ||
19 | struct ctl_table_header; | ||
20 | |||
13 | struct net { | 21 | struct net { |
14 | atomic_t count; /* To decided when the network | 22 | atomic_t count; /* To decided when the network |
15 | * namespace should be freed. | 23 | * namespace should be freed. |
@@ -24,11 +32,30 @@ struct net { | |||
24 | struct proc_dir_entry *proc_net_stat; | 32 | struct proc_dir_entry *proc_net_stat; |
25 | struct proc_dir_entry *proc_net_root; | 33 | struct proc_dir_entry *proc_net_root; |
26 | 34 | ||
35 | struct list_head sysctl_table_headers; | ||
36 | |||
27 | struct net_device *loopback_dev; /* The loopback */ | 37 | struct net_device *loopback_dev; /* The loopback */ |
28 | 38 | ||
29 | struct list_head dev_base_head; | 39 | struct list_head dev_base_head; |
30 | struct hlist_head *dev_name_head; | 40 | struct hlist_head *dev_name_head; |
31 | struct hlist_head *dev_index_head; | 41 | struct hlist_head *dev_index_head; |
42 | |||
43 | /* core fib_rules */ | ||
44 | struct list_head rules_ops; | ||
45 | spinlock_t rules_mod_lock; | ||
46 | |||
47 | struct sock *rtnl; /* rtnetlink socket */ | ||
48 | |||
49 | /* core sysctls */ | ||
50 | struct ctl_table_header *sysctl_core_hdr; | ||
51 | int sysctl_somaxconn; | ||
52 | |||
53 | struct netns_packet packet; | ||
54 | struct netns_unix unx; | ||
55 | struct netns_ipv4 ipv4; | ||
56 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
57 | struct netns_ipv6 ipv6; | ||
58 | #endif | ||
32 | }; | 59 | }; |
33 | 60 | ||
34 | #ifdef CONFIG_NET | 61 | #ifdef CONFIG_NET |
@@ -137,4 +164,11 @@ extern void unregister_pernet_subsys(struct pernet_operations *); | |||
137 | extern int register_pernet_device(struct pernet_operations *); | 164 | extern int register_pernet_device(struct pernet_operations *); |
138 | extern void unregister_pernet_device(struct pernet_operations *); | 165 | extern void unregister_pernet_device(struct pernet_operations *); |
139 | 166 | ||
167 | struct ctl_path; | ||
168 | struct ctl_table; | ||
169 | struct ctl_table_header; | ||
170 | extern struct ctl_table_header *register_net_sysctl_table(struct net *net, | ||
171 | const struct ctl_path *path, struct ctl_table *table); | ||
172 | extern void unregister_net_sysctl_table(struct ctl_table_header *header); | ||
173 | |||
140 | #endif /* __NET_NET_NAMESPACE_H */ | 174 | #endif /* __NET_NET_NAMESPACE_H */ |
diff --git a/include/net/netevent.h b/include/net/netevent.h index e5d216241423..e82b7bab3ff3 100644 --- a/include/net/netevent.h +++ b/include/net/netevent.h | |||
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | #ifdef __KERNEL__ | 13 | #ifdef __KERNEL__ |
14 | 14 | ||
15 | #include <net/dst.h> | 15 | struct dst_entry; |
16 | 16 | ||
17 | struct netevent_redirect { | 17 | struct netevent_redirect { |
18 | struct dst_entry *old; | 18 | struct dst_entry *old; |
diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h index f703533fb4db..abc55ad75c2b 100644 --- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h +++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h | |||
@@ -16,6 +16,8 @@ extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb, | |||
16 | int (*okfn)(struct sk_buff *)); | 16 | int (*okfn)(struct sk_buff *)); |
17 | 17 | ||
18 | struct inet_frags_ctl; | 18 | struct inet_frags_ctl; |
19 | extern struct inet_frags_ctl nf_frags_ctl; | 19 | |
20 | #include <linux/sysctl.h> | ||
21 | extern struct ctl_table nf_ct_ipv6_sysctl_table[]; | ||
20 | 22 | ||
21 | #endif /* _NF_CONNTRACK_IPV6_H*/ | 23 | #endif /* _NF_CONNTRACK_IPV6_H*/ |
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 4ac5ab187c2a..857d89951790 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -223,8 +223,6 @@ extern void nf_conntrack_tcp_update(struct sk_buff *skb, | |||
223 | /* Fake conntrack entry for untracked connections */ | 223 | /* Fake conntrack entry for untracked connections */ |
224 | extern struct nf_conn nf_conntrack_untracked; | 224 | extern struct nf_conn nf_conntrack_untracked; |
225 | 225 | ||
226 | extern int nf_ct_no_defrag; | ||
227 | |||
228 | /* Iterate over all conntracks: if iter returns true, it's deleted. */ | 226 | /* Iterate over all conntracks: if iter returns true, it's deleted. */ |
229 | extern void | 227 | extern void |
230 | nf_ct_iterate_cleanup(int (*iter)(struct nf_conn *i, void *data), void *data); | 228 | nf_ct_iterate_cleanup(int (*iter)(struct nf_conn *i, void *data), void *data); |
@@ -264,10 +262,5 @@ do { \ | |||
264 | local_bh_enable(); \ | 262 | local_bh_enable(); \ |
265 | } while (0) | 263 | } while (0) |
266 | 264 | ||
267 | extern int | ||
268 | nf_conntrack_register_cache(u_int32_t features, const char *name, size_t size); | ||
269 | extern void | ||
270 | nf_conntrack_unregister_cache(u_int32_t features); | ||
271 | |||
272 | #endif /* __KERNEL__ */ | 265 | #endif /* __KERNEL__ */ |
273 | #endif /* _NF_CONNTRACK_H */ | 266 | #endif /* _NF_CONNTRACK_H */ |
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h index a532e7b5ed6a..7ad0828f05cf 100644 --- a/include/net/netfilter/nf_conntrack_core.h +++ b/include/net/netfilter/nf_conntrack_core.h | |||
@@ -30,16 +30,6 @@ extern void nf_conntrack_cleanup(void); | |||
30 | extern int nf_conntrack_proto_init(void); | 30 | extern int nf_conntrack_proto_init(void); |
31 | extern void nf_conntrack_proto_fini(void); | 31 | extern void nf_conntrack_proto_fini(void); |
32 | 32 | ||
33 | extern int nf_conntrack_helper_init(void); | ||
34 | extern void nf_conntrack_helper_fini(void); | ||
35 | |||
36 | struct nf_conntrack_l3proto; | ||
37 | extern struct nf_conntrack_l3proto *nf_ct_find_l3proto(u_int16_t pf); | ||
38 | /* Like above, but you already have conntrack read lock. */ | ||
39 | extern struct nf_conntrack_l3proto *__nf_ct_find_l3proto(u_int16_t l3proto); | ||
40 | |||
41 | struct nf_conntrack_l4proto; | ||
42 | |||
43 | extern int | 33 | extern int |
44 | nf_ct_get_tuple(const struct sk_buff *skb, | 34 | nf_ct_get_tuple(const struct sk_buff *skb, |
45 | unsigned int nhoff, | 35 | unsigned int nhoff, |
@@ -76,8 +66,6 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb) | |||
76 | return ret; | 66 | return ret; |
77 | } | 67 | } |
78 | 68 | ||
79 | extern void __nf_conntrack_attach(struct sk_buff *nskb, struct sk_buff *skb); | ||
80 | |||
81 | int | 69 | int |
82 | print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, | 70 | print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, |
83 | struct nf_conntrack_l3proto *l3proto, | 71 | struct nf_conntrack_l3proto *l3proto, |
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index b47c04f12dbe..6c3fd254c28e 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h | |||
@@ -73,8 +73,8 @@ void nf_ct_unexpect_related(struct nf_conntrack_expect *exp); | |||
73 | nf_ct_expect_related. You will have to call put afterwards. */ | 73 | nf_ct_expect_related. You will have to call put afterwards. */ |
74 | struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); | 74 | struct nf_conntrack_expect *nf_ct_expect_alloc(struct nf_conn *me); |
75 | void nf_ct_expect_init(struct nf_conntrack_expect *, int, | 75 | void nf_ct_expect_init(struct nf_conntrack_expect *, int, |
76 | union nf_conntrack_address *, | 76 | union nf_inet_addr *, |
77 | union nf_conntrack_address *, | 77 | union nf_inet_addr *, |
78 | u_int8_t, __be16 *, __be16 *); | 78 | u_int8_t, __be16 *, __be16 *); |
79 | void nf_ct_expect_put(struct nf_conntrack_expect *exp); | 79 | void nf_ct_expect_put(struct nf_conntrack_expect *exp); |
80 | int nf_ct_expect_related(struct nf_conntrack_expect *expect); | 80 | int nf_ct_expect_related(struct nf_conntrack_expect *expect); |
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h index d7b2d5483a71..2f3af00643cf 100644 --- a/include/net/netfilter/nf_conntrack_helper.h +++ b/include/net/netfilter/nf_conntrack_helper.h | |||
@@ -58,4 +58,8 @@ static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) | |||
58 | { | 58 | { |
59 | return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); | 59 | return nf_ct_ext_find(ct, NF_CT_EXT_HELPER); |
60 | } | 60 | } |
61 | |||
62 | extern int nf_conntrack_helper_init(void); | ||
63 | extern void nf_conntrack_helper_fini(void); | ||
64 | |||
61 | #endif /*_NF_CONNTRACK_HELPER_H*/ | 65 | #endif /*_NF_CONNTRACK_HELPER_H*/ |
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h index 15888fc7b72d..d5526bcce147 100644 --- a/include/net/netfilter/nf_conntrack_l3proto.h +++ b/include/net/netfilter/nf_conntrack_l3proto.h | |||
@@ -42,9 +42,6 @@ struct nf_conntrack_l3proto | |||
42 | int (*print_tuple)(struct seq_file *s, | 42 | int (*print_tuple)(struct seq_file *s, |
43 | const struct nf_conntrack_tuple *); | 43 | const struct nf_conntrack_tuple *); |
44 | 44 | ||
45 | /* Print out the private part of the conntrack. */ | ||
46 | int (*print_conntrack)(struct seq_file *s, const struct nf_conn *); | ||
47 | |||
48 | /* Returns verdict for packet, or -1 for invalid. */ | 45 | /* Returns verdict for packet, or -1 for invalid. */ |
49 | int (*packet)(struct nf_conn *conntrack, | 46 | int (*packet)(struct nf_conn *conntrack, |
50 | const struct sk_buff *skb, | 47 | const struct sk_buff *skb, |
@@ -73,7 +70,7 @@ struct nf_conntrack_l3proto | |||
73 | 70 | ||
74 | #ifdef CONFIG_SYSCTL | 71 | #ifdef CONFIG_SYSCTL |
75 | struct ctl_table_header *ctl_table_header; | 72 | struct ctl_table_header *ctl_table_header; |
76 | struct ctl_table *ctl_table_path; | 73 | struct ctl_path *ctl_table_path; |
77 | struct ctl_table *ctl_table; | 74 | struct ctl_table *ctl_table; |
78 | #endif /* CONFIG_SYSCTL */ | 75 | #endif /* CONFIG_SYSCTL */ |
79 | 76 | ||
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index c48e390f4b0f..45cb17cdcfd0 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #ifndef _NF_CONNTRACK_TUPLE_H | 10 | #ifndef _NF_CONNTRACK_TUPLE_H |
11 | #define _NF_CONNTRACK_TUPLE_H | 11 | #define _NF_CONNTRACK_TUPLE_H |
12 | 12 | ||
13 | #include <linux/netfilter/x_tables.h> | ||
13 | #include <linux/netfilter/nf_conntrack_tuple_common.h> | 14 | #include <linux/netfilter/nf_conntrack_tuple_common.h> |
14 | 15 | ||
15 | /* A `tuple' is a structure containing the information to uniquely | 16 | /* A `tuple' is a structure containing the information to uniquely |
@@ -20,15 +21,7 @@ | |||
20 | "non-manipulatable" lines, for the benefit of the NAT code. | 21 | "non-manipulatable" lines, for the benefit of the NAT code. |
21 | */ | 22 | */ |
22 | 23 | ||
23 | #define NF_CT_TUPLE_L3SIZE 4 | 24 | #define NF_CT_TUPLE_L3SIZE ARRAY_SIZE(((union nf_inet_addr *)NULL)->all) |
24 | |||
25 | /* The l3 protocol-specific manipulable parts of the tuple: always in | ||
26 | network order! */ | ||
27 | union nf_conntrack_address { | ||
28 | u_int32_t all[NF_CT_TUPLE_L3SIZE]; | ||
29 | __be32 ip; | ||
30 | __be32 ip6[4]; | ||
31 | }; | ||
32 | 25 | ||
33 | /* The protocol-specific manipulable parts of the tuple: always in | 26 | /* The protocol-specific manipulable parts of the tuple: always in |
34 | network order! */ | 27 | network order! */ |
@@ -57,7 +50,7 @@ union nf_conntrack_man_proto | |||
57 | /* The manipulable part of the tuple. */ | 50 | /* The manipulable part of the tuple. */ |
58 | struct nf_conntrack_man | 51 | struct nf_conntrack_man |
59 | { | 52 | { |
60 | union nf_conntrack_address u3; | 53 | union nf_inet_addr u3; |
61 | union nf_conntrack_man_proto u; | 54 | union nf_conntrack_man_proto u; |
62 | /* Layer 3 protocol */ | 55 | /* Layer 3 protocol */ |
63 | u_int16_t l3num; | 56 | u_int16_t l3num; |
@@ -70,7 +63,7 @@ struct nf_conntrack_tuple | |||
70 | 63 | ||
71 | /* These are the parts of the tuple which are fixed. */ | 64 | /* These are the parts of the tuple which are fixed. */ |
72 | struct { | 65 | struct { |
73 | union nf_conntrack_address u3; | 66 | union nf_inet_addr u3; |
74 | union { | 67 | union { |
75 | /* Add other protocols here. */ | 68 | /* Add other protocols here. */ |
76 | __be16 all; | 69 | __be16 all; |
@@ -103,7 +96,7 @@ struct nf_conntrack_tuple | |||
103 | struct nf_conntrack_tuple_mask | 96 | struct nf_conntrack_tuple_mask |
104 | { | 97 | { |
105 | struct { | 98 | struct { |
106 | union nf_conntrack_address u3; | 99 | union nf_inet_addr u3; |
107 | union nf_conntrack_man_proto u; | 100 | union nf_conntrack_man_proto u; |
108 | } src; | 101 | } src; |
109 | }; | 102 | }; |
diff --git a/include/net/netfilter/nf_log.h b/include/net/netfilter/nf_log.h new file mode 100644 index 000000000000..037e82403f91 --- /dev/null +++ b/include/net/netfilter/nf_log.h | |||
@@ -0,0 +1,59 @@ | |||
1 | #ifndef _NF_LOG_H | ||
2 | #define _NF_LOG_H | ||
3 | |||
4 | /* those NF_LOG_* defines and struct nf_loginfo are legacy definitios that will | ||
5 | * disappear once iptables is replaced with pkttables. Please DO NOT use them | ||
6 | * for any new code! */ | ||
7 | #define NF_LOG_TCPSEQ 0x01 /* Log TCP sequence numbers */ | ||
8 | #define NF_LOG_TCPOPT 0x02 /* Log TCP options */ | ||
9 | #define NF_LOG_IPOPT 0x04 /* Log IP options */ | ||
10 | #define NF_LOG_UID 0x08 /* Log UID owning local socket */ | ||
11 | #define NF_LOG_MASK 0x0f | ||
12 | |||
13 | #define NF_LOG_TYPE_LOG 0x01 | ||
14 | #define NF_LOG_TYPE_ULOG 0x02 | ||
15 | |||
16 | struct nf_loginfo { | ||
17 | u_int8_t type; | ||
18 | union { | ||
19 | struct { | ||
20 | u_int32_t copy_len; | ||
21 | u_int16_t group; | ||
22 | u_int16_t qthreshold; | ||
23 | } ulog; | ||
24 | struct { | ||
25 | u_int8_t level; | ||
26 | u_int8_t logflags; | ||
27 | } log; | ||
28 | } u; | ||
29 | }; | ||
30 | |||
31 | typedef void nf_logfn(unsigned int pf, | ||
32 | unsigned int hooknum, | ||
33 | const struct sk_buff *skb, | ||
34 | const struct net_device *in, | ||
35 | const struct net_device *out, | ||
36 | const struct nf_loginfo *li, | ||
37 | const char *prefix); | ||
38 | |||
39 | struct nf_logger { | ||
40 | struct module *me; | ||
41 | nf_logfn *logfn; | ||
42 | char *name; | ||
43 | }; | ||
44 | |||
45 | /* Function to register/unregister log function. */ | ||
46 | int nf_log_register(int pf, const struct nf_logger *logger); | ||
47 | void nf_log_unregister(const struct nf_logger *logger); | ||
48 | void nf_log_unregister_pf(int pf); | ||
49 | |||
50 | /* Calls the registered backend logging function */ | ||
51 | void nf_log_packet(int pf, | ||
52 | unsigned int hooknum, | ||
53 | const struct sk_buff *skb, | ||
54 | const struct net_device *in, | ||
55 | const struct net_device *out, | ||
56 | const struct nf_loginfo *li, | ||
57 | const char *fmt, ...); | ||
58 | |||
59 | #endif /* _NF_LOG_H */ | ||
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h index 6ae52f7c9f55..9dc1039ff78b 100644 --- a/include/net/netfilter/nf_nat.h +++ b/include/net/netfilter/nf_nat.h | |||
@@ -12,7 +12,8 @@ enum nf_nat_manip_type | |||
12 | }; | 12 | }; |
13 | 13 | ||
14 | /* SRC manip occurs POST_ROUTING or LOCAL_IN */ | 14 | /* SRC manip occurs POST_ROUTING or LOCAL_IN */ |
15 | #define HOOK2MANIP(hooknum) ((hooknum) != NF_IP_POST_ROUTING && (hooknum) != NF_IP_LOCAL_IN) | 15 | #define HOOK2MANIP(hooknum) ((hooknum) != NF_INET_POST_ROUTING && \ |
16 | (hooknum) != NF_INET_LOCAL_IN) | ||
16 | 17 | ||
17 | #define IP_NAT_RANGE_MAP_IPS 1 | 18 | #define IP_NAT_RANGE_MAP_IPS 1 |
18 | #define IP_NAT_RANGE_PROTO_SPECIFIED 2 | 19 | #define IP_NAT_RANGE_PROTO_SPECIFIED 2 |
@@ -79,7 +80,7 @@ struct nf_conn_nat | |||
79 | /* Set up the info structure to map into this range. */ | 80 | /* Set up the info structure to map into this range. */ |
80 | extern unsigned int nf_nat_setup_info(struct nf_conn *ct, | 81 | extern unsigned int nf_nat_setup_info(struct nf_conn *ct, |
81 | const struct nf_nat_range *range, | 82 | const struct nf_nat_range *range, |
82 | unsigned int hooknum); | 83 | enum nf_nat_manip_type maniptype); |
83 | 84 | ||
84 | /* Is this tuple already taken? (not by us)*/ | 85 | /* Is this tuple already taken? (not by us)*/ |
85 | extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, | 86 | extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, |
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h index 04578bfe23e1..4aa0edbb5b96 100644 --- a/include/net/netfilter/nf_nat_protocol.h +++ b/include/net/netfilter/nf_nat_protocol.h | |||
@@ -46,21 +46,21 @@ struct nf_nat_protocol | |||
46 | }; | 46 | }; |
47 | 47 | ||
48 | /* Protocol registration. */ | 48 | /* Protocol registration. */ |
49 | extern int nf_nat_protocol_register(struct nf_nat_protocol *proto); | 49 | extern int nf_nat_protocol_register(const struct nf_nat_protocol *proto); |
50 | extern void nf_nat_protocol_unregister(struct nf_nat_protocol *proto); | 50 | extern void nf_nat_protocol_unregister(const struct nf_nat_protocol *proto); |
51 | 51 | ||
52 | extern struct nf_nat_protocol *nf_nat_proto_find_get(u_int8_t protocol); | 52 | extern const struct nf_nat_protocol *nf_nat_proto_find_get(u_int8_t protocol); |
53 | extern void nf_nat_proto_put(struct nf_nat_protocol *proto); | 53 | extern void nf_nat_proto_put(const struct nf_nat_protocol *proto); |
54 | 54 | ||
55 | /* Built-in protocols. */ | 55 | /* Built-in protocols. */ |
56 | extern struct nf_nat_protocol nf_nat_protocol_tcp; | 56 | extern const struct nf_nat_protocol nf_nat_protocol_tcp; |
57 | extern struct nf_nat_protocol nf_nat_protocol_udp; | 57 | extern const struct nf_nat_protocol nf_nat_protocol_udp; |
58 | extern struct nf_nat_protocol nf_nat_protocol_icmp; | 58 | extern const struct nf_nat_protocol nf_nat_protocol_icmp; |
59 | extern struct nf_nat_protocol nf_nat_unknown_protocol; | 59 | extern const struct nf_nat_protocol nf_nat_unknown_protocol; |
60 | 60 | ||
61 | extern int init_protocols(void) __init; | 61 | extern int init_protocols(void) __init; |
62 | extern void cleanup_protocols(void); | 62 | extern void cleanup_protocols(void); |
63 | extern struct nf_nat_protocol *find_nat_proto(u_int16_t protonum); | 63 | extern const struct nf_nat_protocol *find_nat_proto(u_int16_t protonum); |
64 | 64 | ||
65 | extern int nf_nat_port_range_to_nlattr(struct sk_buff *skb, | 65 | extern int nf_nat_port_range_to_nlattr(struct sk_buff *skb, |
66 | const struct nf_nat_range *range); | 66 | const struct nf_nat_range *range); |
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h new file mode 100644 index 000000000000..d030044e9235 --- /dev/null +++ b/include/net/netfilter/nf_queue.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef _NF_QUEUE_H | ||
2 | #define _NF_QUEUE_H | ||
3 | |||
4 | /* Each queued (to userspace) skbuff has one of these. */ | ||
5 | struct nf_queue_entry { | ||
6 | struct list_head list; | ||
7 | struct sk_buff *skb; | ||
8 | unsigned int id; | ||
9 | |||
10 | struct nf_hook_ops *elem; | ||
11 | int pf; | ||
12 | unsigned int hook; | ||
13 | struct net_device *indev; | ||
14 | struct net_device *outdev; | ||
15 | int (*okfn)(struct sk_buff *); | ||
16 | }; | ||
17 | |||
18 | #define nf_queue_entry_reroute(x) ((void *)x + sizeof(struct nf_queue_entry)) | ||
19 | |||
20 | /* Packet queuing */ | ||
21 | struct nf_queue_handler { | ||
22 | int (*outfn)(struct nf_queue_entry *entry, | ||
23 | unsigned int queuenum); | ||
24 | char *name; | ||
25 | }; | ||
26 | |||
27 | extern int nf_register_queue_handler(int pf, | ||
28 | const struct nf_queue_handler *qh); | ||
29 | extern int nf_unregister_queue_handler(int pf, | ||
30 | const struct nf_queue_handler *qh); | ||
31 | extern void nf_unregister_queue_handlers(const struct nf_queue_handler *qh); | ||
32 | extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); | ||
33 | |||
34 | #endif /* _NF_QUEUE_H */ | ||
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h new file mode 100644 index 000000000000..65d594dffbff --- /dev/null +++ b/include/net/netfilter/xt_rateest.h | |||
@@ -0,0 +1,17 @@ | |||
1 | #ifndef _XT_RATEEST_H | ||
2 | #define _XT_RATEEST_H | ||
3 | |||
4 | struct xt_rateest { | ||
5 | struct hlist_node list; | ||
6 | char name[IFNAMSIZ]; | ||
7 | unsigned int refcnt; | ||
8 | spinlock_t lock; | ||
9 | struct gnet_estimator params; | ||
10 | struct gnet_stats_rate_est rstats; | ||
11 | struct gnet_stats_basic bstats; | ||
12 | }; | ||
13 | |||
14 | extern struct xt_rateest *xt_rateest_lookup(const char *name); | ||
15 | extern void xt_rateest_put(struct xt_rateest *est); | ||
16 | |||
17 | #endif /* _XT_RATEEST_H */ | ||
diff --git a/include/net/netlink.h b/include/net/netlink.h index 9298218c07f9..a5506c42f03c 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h | |||
@@ -91,6 +91,7 @@ | |||
91 | * nla_reserve_nohdr(skb, len) reserve room for an attribute w/o hdr | 91 | * nla_reserve_nohdr(skb, len) reserve room for an attribute w/o hdr |
92 | * nla_put(skb, type, len, data) add attribute to skb | 92 | * nla_put(skb, type, len, data) add attribute to skb |
93 | * nla_put_nohdr(skb, len, data) add attribute w/o hdr | 93 | * nla_put_nohdr(skb, len, data) add attribute w/o hdr |
94 | * nla_append(skb, len, data) append data to skb | ||
94 | * | 95 | * |
95 | * Attribute Construction for Basic Types: | 96 | * Attribute Construction for Basic Types: |
96 | * nla_put_u8(skb, type, value) add u8 attribute to skb | 97 | * nla_put_u8(skb, type, value) add u8 attribute to skb |
@@ -217,6 +218,7 @@ struct nla_policy { | |||
217 | */ | 218 | */ |
218 | struct nl_info { | 219 | struct nl_info { |
219 | struct nlmsghdr *nlh; | 220 | struct nlmsghdr *nlh; |
221 | struct net *nl_net; | ||
220 | u32 pid; | 222 | u32 pid; |
221 | }; | 223 | }; |
222 | 224 | ||
@@ -253,6 +255,8 @@ extern int nla_put(struct sk_buff *skb, int attrtype, | |||
253 | int attrlen, const void *data); | 255 | int attrlen, const void *data); |
254 | extern int nla_put_nohdr(struct sk_buff *skb, int attrlen, | 256 | extern int nla_put_nohdr(struct sk_buff *skb, int attrlen, |
255 | const void *data); | 257 | const void *data); |
258 | extern int nla_append(struct sk_buff *skb, int attrlen, | ||
259 | const void *data); | ||
256 | 260 | ||
257 | /************************************************************************** | 261 | /************************************************************************** |
258 | * Netlink Messages | 262 | * Netlink Messages |
@@ -862,7 +866,7 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, | |||
862 | 866 | ||
863 | #define NLA_PUT(skb, attrtype, attrlen, data) \ | 867 | #define NLA_PUT(skb, attrtype, attrlen, data) \ |
864 | do { \ | 868 | do { \ |
865 | if (nla_put(skb, attrtype, attrlen, data) < 0) \ | 869 | if (unlikely(nla_put(skb, attrtype, attrlen, data) < 0)) \ |
866 | goto nla_put_failure; \ | 870 | goto nla_put_failure; \ |
867 | } while(0) | 871 | } while(0) |
868 | 872 | ||
@@ -881,6 +885,9 @@ static inline int nla_put_msecs(struct sk_buff *skb, int attrtype, | |||
881 | #define NLA_PUT_LE16(skb, attrtype, value) \ | 885 | #define NLA_PUT_LE16(skb, attrtype, value) \ |
882 | NLA_PUT_TYPE(skb, __le16, attrtype, value) | 886 | NLA_PUT_TYPE(skb, __le16, attrtype, value) |
883 | 887 | ||
888 | #define NLA_PUT_BE16(skb, attrtype, value) \ | ||
889 | NLA_PUT_TYPE(skb, __be16, attrtype, value) | ||
890 | |||
884 | #define NLA_PUT_U32(skb, attrtype, value) \ | 891 | #define NLA_PUT_U32(skb, attrtype, value) \ |
885 | NLA_PUT_TYPE(skb, u32, attrtype, value) | 892 | NLA_PUT_TYPE(skb, u32, attrtype, value) |
886 | 893 | ||
@@ -927,6 +934,15 @@ static inline u16 nla_get_u16(struct nlattr *nla) | |||
927 | } | 934 | } |
928 | 935 | ||
929 | /** | 936 | /** |
937 | * nla_get_be16 - return payload of __be16 attribute | ||
938 | * @nla: __be16 netlink attribute | ||
939 | */ | ||
940 | static inline __be16 nla_get_be16(struct nlattr *nla) | ||
941 | { | ||
942 | return *(__be16 *) nla_data(nla); | ||
943 | } | ||
944 | |||
945 | /** | ||
930 | * nla_get_le16 - return payload of __le16 attribute | 946 | * nla_get_le16 - return payload of __le16 attribute |
931 | * @nla: __le16 netlink attribute | 947 | * @nla: __le16 netlink attribute |
932 | */ | 948 | */ |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h new file mode 100644 index 000000000000..15a0b052df22 --- /dev/null +++ b/include/net/netns/ipv4.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * ipv4 in net namespaces | ||
3 | */ | ||
4 | |||
5 | #ifndef __NETNS_IPV4_H__ | ||
6 | #define __NETNS_IPV4_H__ | ||
7 | |||
8 | #include <net/inet_frag.h> | ||
9 | |||
10 | struct ctl_table_header; | ||
11 | struct ipv4_devconf; | ||
12 | struct fib_rules_ops; | ||
13 | struct hlist_head; | ||
14 | struct sock; | ||
15 | |||
16 | struct netns_ipv4 { | ||
17 | #ifdef CONFIG_SYSCTL | ||
18 | struct ctl_table_header *forw_hdr; | ||
19 | struct ctl_table_header *frags_hdr; | ||
20 | #endif | ||
21 | struct ipv4_devconf *devconf_all; | ||
22 | struct ipv4_devconf *devconf_dflt; | ||
23 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
24 | struct fib_rules_ops *rules_ops; | ||
25 | #endif | ||
26 | struct hlist_head *fib_table_hash; | ||
27 | struct sock *fibnl; | ||
28 | |||
29 | struct netns_frags frags; | ||
30 | }; | ||
31 | #endif | ||
diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h new file mode 100644 index 000000000000..187c4248df22 --- /dev/null +++ b/include/net/netns/ipv6.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * ipv6 in net namespaces | ||
3 | */ | ||
4 | |||
5 | #include <net/inet_frag.h> | ||
6 | |||
7 | #ifndef __NETNS_IPV6_H__ | ||
8 | #define __NETNS_IPV6_H__ | ||
9 | |||
10 | struct ctl_table_header; | ||
11 | |||
12 | struct netns_sysctl_ipv6 { | ||
13 | #ifdef CONFIG_SYSCTL | ||
14 | struct ctl_table_header *table; | ||
15 | struct ctl_table_header *frags_hdr; | ||
16 | #endif | ||
17 | int bindv6only; | ||
18 | int flush_delay; | ||
19 | int ip6_rt_max_size; | ||
20 | int ip6_rt_gc_min_interval; | ||
21 | int ip6_rt_gc_timeout; | ||
22 | int ip6_rt_gc_interval; | ||
23 | int ip6_rt_gc_elasticity; | ||
24 | int ip6_rt_mtu_expires; | ||
25 | int ip6_rt_min_advmss; | ||
26 | int icmpv6_time; | ||
27 | }; | ||
28 | |||
29 | struct netns_ipv6 { | ||
30 | struct netns_sysctl_ipv6 sysctl; | ||
31 | struct ipv6_devconf *devconf_all; | ||
32 | struct ipv6_devconf *devconf_dflt; | ||
33 | struct netns_frags frags; | ||
34 | }; | ||
35 | #endif | ||
diff --git a/include/net/netns/packet.h b/include/net/netns/packet.h new file mode 100644 index 000000000000..637daf698884 --- /dev/null +++ b/include/net/netns/packet.h | |||
@@ -0,0 +1,15 @@ | |||
1 | /* | ||
2 | * Packet network namespace | ||
3 | */ | ||
4 | #ifndef __NETNS_PACKET_H__ | ||
5 | #define __NETNS_PACKET_H__ | ||
6 | |||
7 | #include <linux/list.h> | ||
8 | #include <linux/spinlock.h> | ||
9 | |||
10 | struct netns_packet { | ||
11 | rwlock_t sklist_lock; | ||
12 | struct hlist_head sklist; | ||
13 | }; | ||
14 | |||
15 | #endif /* __NETNS_PACKET_H__ */ | ||
diff --git a/include/net/netns/unix.h b/include/net/netns/unix.h new file mode 100644 index 000000000000..284649d4dfb4 --- /dev/null +++ b/include/net/netns/unix.h | |||
@@ -0,0 +1,13 @@ | |||
1 | /* | ||
2 | * Unix network namespace | ||
3 | */ | ||
4 | #ifndef __NETNS_UNIX_H__ | ||
5 | #define __NETNS_UNIX_H__ | ||
6 | |||
7 | struct ctl_table_header; | ||
8 | struct netns_unix { | ||
9 | int sysctl_max_dgram_qlen; | ||
10 | struct ctl_table_header *ctl; | ||
11 | }; | ||
12 | |||
13 | #endif /* __NETNS_UNIX_H__ */ | ||
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h index f285de69c615..8716eb757d51 100644 --- a/include/net/pkt_cls.h +++ b/include/net/pkt_cls.h | |||
@@ -2,7 +2,6 @@ | |||
2 | #define __NET_PKT_CLS_H | 2 | #define __NET_PKT_CLS_H |
3 | 3 | ||
4 | #include <linux/pkt_cls.h> | 4 | #include <linux/pkt_cls.h> |
5 | #include <net/net_namespace.h> | ||
6 | #include <net/sch_generic.h> | 5 | #include <net/sch_generic.h> |
7 | #include <net/act_api.h> | 6 | #include <net/act_api.h> |
8 | 7 | ||
@@ -130,8 +129,8 @@ tcf_exts_exec(struct sk_buff *skb, struct tcf_exts *exts, | |||
130 | return 0; | 129 | return 0; |
131 | } | 130 | } |
132 | 131 | ||
133 | extern int tcf_exts_validate(struct tcf_proto *tp, struct rtattr **tb, | 132 | extern int tcf_exts_validate(struct tcf_proto *tp, struct nlattr **tb, |
134 | struct rtattr *rate_tlv, struct tcf_exts *exts, | 133 | struct nlattr *rate_tlv, struct tcf_exts *exts, |
135 | struct tcf_ext_map *map); | 134 | struct tcf_ext_map *map); |
136 | extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); | 135 | extern void tcf_exts_destroy(struct tcf_proto *tp, struct tcf_exts *exts); |
137 | extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, | 136 | extern void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, |
@@ -248,7 +247,7 @@ struct tcf_ematch_ops | |||
248 | 247 | ||
249 | extern int tcf_em_register(struct tcf_ematch_ops *); | 248 | extern int tcf_em_register(struct tcf_ematch_ops *); |
250 | extern int tcf_em_unregister(struct tcf_ematch_ops *); | 249 | extern int tcf_em_unregister(struct tcf_ematch_ops *); |
251 | extern int tcf_em_tree_validate(struct tcf_proto *, struct rtattr *, | 250 | extern int tcf_em_tree_validate(struct tcf_proto *, struct nlattr *, |
252 | struct tcf_ematch_tree *); | 251 | struct tcf_ematch_tree *); |
253 | extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); | 252 | extern void tcf_em_tree_destroy(struct tcf_proto *, struct tcf_ematch_tree *); |
254 | extern int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int); | 253 | extern int tcf_em_tree_dump(struct sk_buff *, struct tcf_ematch_tree *, int); |
@@ -336,10 +335,12 @@ static inline int tcf_valid_offset(const struct sk_buff *skb, | |||
336 | } | 335 | } |
337 | 336 | ||
338 | #ifdef CONFIG_NET_CLS_IND | 337 | #ifdef CONFIG_NET_CLS_IND |
338 | #include <net/net_namespace.h> | ||
339 | |||
339 | static inline int | 340 | static inline int |
340 | tcf_change_indev(struct tcf_proto *tp, char *indev, struct rtattr *indev_tlv) | 341 | tcf_change_indev(struct tcf_proto *tp, char *indev, struct nlattr *indev_tlv) |
341 | { | 342 | { |
342 | if (rtattr_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) | 343 | if (nla_strlcpy(indev, indev_tlv, IFNAMSIZ) >= IFNAMSIZ) |
343 | return -EINVAL; | 344 | return -EINVAL; |
344 | return 0; | 345 | return 0; |
345 | } | 346 | } |
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h index ab61809a9616..46fb4d80c74a 100644 --- a/include/net/pkt_sched.h +++ b/include/net/pkt_sched.h | |||
@@ -77,7 +77,7 @@ extern int unregister_qdisc(struct Qdisc_ops *qops); | |||
77 | extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle); | 77 | extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle); |
78 | extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle); | 78 | extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle); |
79 | extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, | 79 | extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, |
80 | struct rtattr *tab); | 80 | struct nlattr *tab); |
81 | extern void qdisc_put_rtab(struct qdisc_rate_table *tab); | 81 | extern void qdisc_put_rtab(struct qdisc_rate_table *tab); |
82 | 82 | ||
83 | extern void __qdisc_run(struct net_device *dev); | 83 | extern void __qdisc_run(struct net_device *dev); |
diff --git a/include/net/protocol.h b/include/net/protocol.h index 1166ffb4b3ec..ad8c584233a6 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
@@ -102,7 +102,7 @@ extern void inet_unregister_protosw(struct inet_protosw *p); | |||
102 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 102 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
103 | extern int inet6_add_protocol(struct inet6_protocol *prot, unsigned char num); | 103 | extern int inet6_add_protocol(struct inet6_protocol *prot, unsigned char num); |
104 | extern int inet6_del_protocol(struct inet6_protocol *prot, unsigned char num); | 104 | extern int inet6_del_protocol(struct inet6_protocol *prot, unsigned char num); |
105 | extern void inet6_register_protosw(struct inet_protosw *p); | 105 | extern int inet6_register_protosw(struct inet_protosw *p); |
106 | extern void inet6_unregister_protosw(struct inet_protosw *p); | 106 | extern void inet6_unregister_protosw(struct inet_protosw *p); |
107 | #endif | 107 | #endif |
108 | 108 | ||
diff --git a/include/net/raw.h b/include/net/raw.h index e4af59781949..cca81d8b2d8b 100644 --- a/include/net/raw.h +++ b/include/net/raw.h | |||
@@ -22,27 +22,39 @@ | |||
22 | 22 | ||
23 | extern struct proto raw_prot; | 23 | extern struct proto raw_prot; |
24 | 24 | ||
25 | extern void raw_err(struct sock *, struct sk_buff *, u32 info); | 25 | void raw_icmp_error(struct sk_buff *, int, u32); |
26 | extern int raw_rcv(struct sock *, struct sk_buff *); | 26 | int raw_local_deliver(struct sk_buff *, int); |
27 | |||
28 | /* Note: v4 ICMP wants to get at this stuff, if you change the | ||
29 | * hashing mechanism, make sure you update icmp.c as well. | ||
30 | */ | ||
31 | #define RAWV4_HTABLE_SIZE MAX_INET_PROTOS | ||
32 | extern struct hlist_head raw_v4_htable[RAWV4_HTABLE_SIZE]; | ||
33 | |||
34 | extern rwlock_t raw_v4_lock; | ||
35 | 27 | ||
28 | extern int raw_rcv(struct sock *, struct sk_buff *); | ||
36 | 29 | ||
37 | extern struct sock *__raw_v4_lookup(struct sock *sk, unsigned short num, | 30 | #define RAW_HTABLE_SIZE MAX_INET_PROTOS |
38 | __be32 raddr, __be32 laddr, | ||
39 | int dif); | ||
40 | 31 | ||
41 | extern int raw_v4_input(struct sk_buff *skb, struct iphdr *iph, int hash); | 32 | struct raw_hashinfo { |
33 | rwlock_t lock; | ||
34 | struct hlist_head ht[RAW_HTABLE_SIZE]; | ||
35 | }; | ||
42 | 36 | ||
43 | #ifdef CONFIG_PROC_FS | 37 | #ifdef CONFIG_PROC_FS |
44 | extern int raw_proc_init(void); | 38 | extern int raw_proc_init(void); |
45 | extern void raw_proc_exit(void); | 39 | extern void raw_proc_exit(void); |
40 | |||
41 | struct raw_iter_state { | ||
42 | struct seq_net_private p; | ||
43 | int bucket; | ||
44 | unsigned short family; | ||
45 | struct raw_hashinfo *h; | ||
46 | }; | ||
47 | |||
48 | #define raw_seq_private(seq) ((struct raw_iter_state *)(seq)->private) | ||
49 | void *raw_seq_start(struct seq_file *seq, loff_t *pos); | ||
50 | void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos); | ||
51 | void raw_seq_stop(struct seq_file *seq, void *v); | ||
52 | int raw_seq_open(struct inode *ino, struct file *file, struct raw_hashinfo *h, | ||
53 | unsigned short family); | ||
54 | |||
46 | #endif | 55 | #endif |
47 | 56 | ||
57 | void raw_hash_sk(struct sock *sk, struct raw_hashinfo *h); | ||
58 | void raw_unhash_sk(struct sock *sk, struct raw_hashinfo *h); | ||
59 | |||
48 | #endif /* _RAW_H */ | 60 | #endif /* _RAW_H */ |
diff --git a/include/net/rawv6.h b/include/net/rawv6.h index a5819891d525..8a22599f26ba 100644 --- a/include/net/rawv6.h +++ b/include/net/rawv6.h | |||
@@ -5,26 +5,13 @@ | |||
5 | 5 | ||
6 | #include <net/protocol.h> | 6 | #include <net/protocol.h> |
7 | 7 | ||
8 | #define RAWV6_HTABLE_SIZE MAX_INET_PROTOS | 8 | void raw6_icmp_error(struct sk_buff *, int nexthdr, |
9 | extern struct hlist_head raw_v6_htable[RAWV6_HTABLE_SIZE]; | 9 | int type, int code, int inner_offset, __be32); |
10 | extern rwlock_t raw_v6_lock; | 10 | int raw6_local_deliver(struct sk_buff *, int); |
11 | |||
12 | extern int ipv6_raw_deliver(struct sk_buff *skb, int nexthdr); | ||
13 | |||
14 | extern struct sock *__raw_v6_lookup(struct sock *sk, unsigned short num, | ||
15 | struct in6_addr *loc_addr, struct in6_addr *rmt_addr, | ||
16 | int dif); | ||
17 | 11 | ||
18 | extern int rawv6_rcv(struct sock *sk, | 12 | extern int rawv6_rcv(struct sock *sk, |
19 | struct sk_buff *skb); | 13 | struct sk_buff *skb); |
20 | 14 | ||
21 | |||
22 | extern void rawv6_err(struct sock *sk, | ||
23 | struct sk_buff *skb, | ||
24 | struct inet6_skb_parm *opt, | ||
25 | int type, int code, | ||
26 | int offset, __be32 info); | ||
27 | |||
28 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 15 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
29 | int rawv6_mh_filter_register(int (*filter)(struct sock *sock, | 16 | int rawv6_mh_filter_register(int (*filter)(struct sock *sock, |
30 | struct sk_buff *skb)); | 17 | struct sk_buff *skb)); |
diff --git a/include/net/route.h b/include/net/route.h index 59b0b19205a2..4eabf008413b 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/ip.h> | 33 | #include <linux/ip.h> |
34 | #include <linux/cache.h> | 34 | #include <linux/cache.h> |
35 | #include <linux/security.h> | 35 | #include <linux/security.h> |
36 | #include <net/sock.h> | ||
36 | 37 | ||
37 | #ifndef __KERNEL__ | 38 | #ifndef __KERNEL__ |
38 | #warning This file is not supposed to be used outside of kernel. | 39 | #warning This file is not supposed to be used outside of kernel. |
@@ -110,16 +111,17 @@ extern int ip_rt_init(void); | |||
110 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, | 111 | extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, |
111 | __be32 src, struct net_device *dev); | 112 | __be32 src, struct net_device *dev); |
112 | extern void rt_cache_flush(int how); | 113 | extern void rt_cache_flush(int how); |
113 | extern int __ip_route_output_key(struct rtable **, const struct flowi *flp); | 114 | extern int __ip_route_output_key(struct net *, struct rtable **, const struct flowi *flp); |
114 | extern int ip_route_output_key(struct rtable **, struct flowi *flp); | 115 | extern int ip_route_output_key(struct net *, struct rtable **, struct flowi *flp); |
115 | extern int ip_route_output_flow(struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); | 116 | extern int ip_route_output_flow(struct net *, struct rtable **rp, struct flowi *flp, struct sock *sk, int flags); |
116 | extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); | 117 | extern int ip_route_input(struct sk_buff*, __be32 dst, __be32 src, u8 tos, struct net_device *devin); |
117 | extern unsigned short ip_rt_frag_needed(struct iphdr *iph, unsigned short new_mtu); | 118 | extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu); |
118 | extern void ip_rt_send_redirect(struct sk_buff *skb); | 119 | extern void ip_rt_send_redirect(struct sk_buff *skb); |
119 | 120 | ||
120 | extern unsigned inet_addr_type(__be32 addr); | 121 | extern unsigned inet_addr_type(struct net *net, __be32 addr); |
122 | extern unsigned inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); | ||
121 | extern void ip_rt_multicast_event(struct in_device *); | 123 | extern void ip_rt_multicast_event(struct in_device *); |
122 | extern int ip_rt_ioctl(unsigned int cmd, void __user *arg); | 124 | extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); |
123 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); | 125 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); |
124 | extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); | 126 | extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); |
125 | 127 | ||
@@ -156,8 +158,9 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
156 | .dport = dport } } }; | 158 | .dport = dport } } }; |
157 | 159 | ||
158 | int err; | 160 | int err; |
161 | struct net *net = sk->sk_net; | ||
159 | if (!dst || !src) { | 162 | if (!dst || !src) { |
160 | err = __ip_route_output_key(rp, &fl); | 163 | err = __ip_route_output_key(net, rp, &fl); |
161 | if (err) | 164 | if (err) |
162 | return err; | 165 | return err; |
163 | fl.fl4_dst = (*rp)->rt_dst; | 166 | fl.fl4_dst = (*rp)->rt_dst; |
@@ -166,7 +169,7 @@ static inline int ip_route_connect(struct rtable **rp, __be32 dst, | |||
166 | *rp = NULL; | 169 | *rp = NULL; |
167 | } | 170 | } |
168 | security_sk_classify_flow(sk, &fl); | 171 | security_sk_classify_flow(sk, &fl); |
169 | return ip_route_output_flow(rp, &fl, sk, flags); | 172 | return ip_route_output_flow(net, rp, &fl, sk, flags); |
170 | } | 173 | } |
171 | 174 | ||
172 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, | 175 | static inline int ip_route_newports(struct rtable **rp, u8 protocol, |
@@ -183,7 +186,7 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, | |||
183 | ip_rt_put(*rp); | 186 | ip_rt_put(*rp); |
184 | *rp = NULL; | 187 | *rp = NULL; |
185 | security_sk_classify_flow(sk, &fl); | 188 | security_sk_classify_flow(sk, &fl); |
186 | return ip_route_output_flow(rp, &fl, sk, 0); | 189 | return ip_route_output_flow(sk->sk_net, rp, &fl, sk, 0); |
187 | } | 190 | } |
188 | return 0; | 191 | return 0; |
189 | } | 192 | } |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 4c3b35153c37..ab502ec1c61c 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -66,7 +66,7 @@ struct Qdisc_class_ops | |||
66 | unsigned long (*get)(struct Qdisc *, u32 classid); | 66 | unsigned long (*get)(struct Qdisc *, u32 classid); |
67 | void (*put)(struct Qdisc *, unsigned long); | 67 | void (*put)(struct Qdisc *, unsigned long); |
68 | int (*change)(struct Qdisc *, u32, u32, | 68 | int (*change)(struct Qdisc *, u32, u32, |
69 | struct rtattr **, unsigned long *); | 69 | struct nlattr **, unsigned long *); |
70 | int (*delete)(struct Qdisc *, unsigned long); | 70 | int (*delete)(struct Qdisc *, unsigned long); |
71 | void (*walk)(struct Qdisc *, struct qdisc_walker * arg); | 71 | void (*walk)(struct Qdisc *, struct qdisc_walker * arg); |
72 | 72 | ||
@@ -86,7 +86,7 @@ struct Qdisc_class_ops | |||
86 | struct Qdisc_ops | 86 | struct Qdisc_ops |
87 | { | 87 | { |
88 | struct Qdisc_ops *next; | 88 | struct Qdisc_ops *next; |
89 | struct Qdisc_class_ops *cl_ops; | 89 | const struct Qdisc_class_ops *cl_ops; |
90 | char id[IFNAMSIZ]; | 90 | char id[IFNAMSIZ]; |
91 | int priv_size; | 91 | int priv_size; |
92 | 92 | ||
@@ -95,10 +95,10 @@ struct Qdisc_ops | |||
95 | int (*requeue)(struct sk_buff *, struct Qdisc *); | 95 | int (*requeue)(struct sk_buff *, struct Qdisc *); |
96 | unsigned int (*drop)(struct Qdisc *); | 96 | unsigned int (*drop)(struct Qdisc *); |
97 | 97 | ||
98 | int (*init)(struct Qdisc *, struct rtattr *arg); | 98 | int (*init)(struct Qdisc *, struct nlattr *arg); |
99 | void (*reset)(struct Qdisc *); | 99 | void (*reset)(struct Qdisc *); |
100 | void (*destroy)(struct Qdisc *); | 100 | void (*destroy)(struct Qdisc *); |
101 | int (*change)(struct Qdisc *, struct rtattr *arg); | 101 | int (*change)(struct Qdisc *, struct nlattr *arg); |
102 | 102 | ||
103 | int (*dump)(struct Qdisc *, struct sk_buff *); | 103 | int (*dump)(struct Qdisc *, struct sk_buff *); |
104 | int (*dump_stats)(struct Qdisc *, struct gnet_dump *); | 104 | int (*dump_stats)(struct Qdisc *, struct gnet_dump *); |
@@ -126,7 +126,7 @@ struct tcf_proto_ops | |||
126 | unsigned long (*get)(struct tcf_proto*, u32 handle); | 126 | unsigned long (*get)(struct tcf_proto*, u32 handle); |
127 | void (*put)(struct tcf_proto*, unsigned long); | 127 | void (*put)(struct tcf_proto*, unsigned long); |
128 | int (*change)(struct tcf_proto*, unsigned long, | 128 | int (*change)(struct tcf_proto*, unsigned long, |
129 | u32 handle, struct rtattr **, | 129 | u32 handle, struct nlattr **, |
130 | unsigned long *); | 130 | unsigned long *); |
131 | int (*delete)(struct tcf_proto*, unsigned long); | 131 | int (*delete)(struct tcf_proto*, unsigned long); |
132 | void (*walk)(struct tcf_proto*, struct tcf_walker *arg); | 132 | void (*walk)(struct tcf_proto*, struct tcf_walker *arg); |
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h new file mode 100644 index 000000000000..ba75c67cb992 --- /dev/null +++ b/include/net/sctp/checksum.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* SCTP kernel reference Implementation | ||
2 | * Copyright (c) 1999-2001 Motorola, Inc. | ||
3 | * Copyright (c) 2001-2003 International Business Machines, Corp. | ||
4 | * | ||
5 | * This file is part of the SCTP kernel reference Implementation | ||
6 | * | ||
7 | * SCTP Checksum functions | ||
8 | * | ||
9 | * The SCTP reference implementation is free software; | ||
10 | * you can redistribute it and/or modify it under the terms of | ||
11 | * the GNU General Public License as published by | ||
12 | * the Free Software Foundation; either version 2, or (at your option) | ||
13 | * any later version. | ||
14 | * | ||
15 | * The SCTP reference implementation is distributed in the hope that it | ||
16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
17 | * ************************ | ||
18 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
19 | * See the GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with GNU CC; see the file COPYING. If not, write to | ||
23 | * the Free Software Foundation, 59 Temple Place - Suite 330, | ||
24 | * Boston, MA 02111-1307, USA. | ||
25 | * | ||
26 | * Please send any bug reports or fixes you make to the | ||
27 | * email address(es): | ||
28 | * lksctp developers <lksctp-developers@lists.sourceforge.net> | ||
29 | * | ||
30 | * Or submit a bug report through the following website: | ||
31 | * http://www.sf.net/projects/lksctp | ||
32 | * | ||
33 | * Written or modified by: | ||
34 | * Dinakaran Joseph | ||
35 | * Jon Grimm <jgrimm@us.ibm.com> | ||
36 | * Sridhar Samudrala <sri@us.ibm.com> | ||
37 | * | ||
38 | * Rewritten to use libcrc32c by: | ||
39 | * Vlad Yasevich <vladislav.yasevich@hp.com> | ||
40 | * | ||
41 | * Any bugs reported given to us we will try to fix... any fixes shared will | ||
42 | * be incorporated into the next SCTP release. | ||
43 | */ | ||
44 | |||
45 | #include <linux/types.h> | ||
46 | #include <net/sctp/sctp.h> | ||
47 | #include <linux/crc32c.h> | ||
48 | |||
49 | static inline __u32 sctp_start_cksum(__u8 *buffer, __u16 length) | ||
50 | { | ||
51 | __u32 crc = ~(__u32) 0; | ||
52 | __u8 zero[sizeof(__u32)] = {0}; | ||
53 | |||
54 | /* Optimize this routine to be SCTP specific, knowing how | ||
55 | * to skip the checksum field of the SCTP header. | ||
56 | */ | ||
57 | |||
58 | /* Calculate CRC up to the checksum. */ | ||
59 | crc = crc32c(crc, buffer, sizeof(struct sctphdr) - sizeof(__u32)); | ||
60 | |||
61 | /* Skip checksum field of the header. */ | ||
62 | crc = crc32c(crc, zero, sizeof(__u32)); | ||
63 | |||
64 | /* Calculate the rest of the CRC. */ | ||
65 | crc = crc32c(crc, &buffer[sizeof(struct sctphdr)], | ||
66 | length - sizeof(struct sctphdr)); | ||
67 | return crc; | ||
68 | } | ||
69 | |||
70 | static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32) | ||
71 | { | ||
72 | return crc32c(crc32, buffer, length); | ||
73 | } | ||
74 | |||
75 | static inline __u32 sctp_end_cksum(__u32 crc32) | ||
76 | { | ||
77 | return ntohl(~crc32); | ||
78 | } | ||
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index 05f22a6afbcd..fefcba67bd1e 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -365,36 +365,12 @@ typedef enum { | |||
365 | * Also, RFC 8.4, non-unicast addresses are not considered valid SCTP | 365 | * Also, RFC 8.4, non-unicast addresses are not considered valid SCTP |
366 | * addresses. | 366 | * addresses. |
367 | */ | 367 | */ |
368 | #define IS_IPV4_UNUSABLE_ADDRESS(a) \ | 368 | #define IS_IPV4_UNUSABLE_ADDRESS(a) \ |
369 | ((htonl(INADDR_BROADCAST) == *a) || \ | 369 | ((htonl(INADDR_BROADCAST) == a) || \ |
370 | (MULTICAST(*a)) || \ | 370 | ipv4_is_multicast(a) || \ |
371 | (((unsigned char *)(a))[0] == 0) || \ | 371 | ipv4_is_zeronet(a) || \ |
372 | ((((unsigned char *)(a))[0] == 198) && \ | 372 | ipv4_is_test_198(a) || \ |
373 | (((unsigned char *)(a))[1] == 18) && \ | 373 | ipv4_is_anycast_6to4(a)) |
374 | (((unsigned char *)(a))[2] == 0)) || \ | ||
375 | ((((unsigned char *)(a))[0] == 192) && \ | ||
376 | (((unsigned char *)(a))[1] == 88) && \ | ||
377 | (((unsigned char *)(a))[2] == 99))) | ||
378 | |||
379 | /* IPv4 Link-local addresses: 169.254.0.0/16. */ | ||
380 | #define IS_IPV4_LINK_ADDRESS(a) \ | ||
381 | ((((unsigned char *)(a))[0] == 169) && \ | ||
382 | (((unsigned char *)(a))[1] == 254)) | ||
383 | |||
384 | /* RFC 1918 "Address Allocation for Private Internets" defines the IPv4 | ||
385 | * private address space as the following: | ||
386 | * | ||
387 | * 10.0.0.0 - 10.255.255.255 (10/8 prefix) | ||
388 | * 172.16.0.0.0 - 172.31.255.255 (172.16/12 prefix) | ||
389 | * 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) | ||
390 | */ | ||
391 | #define IS_IPV4_PRIVATE_ADDRESS(a) \ | ||
392 | ((((unsigned char *)(a))[0] == 10) || \ | ||
393 | ((((unsigned char *)(a))[0] == 172) && \ | ||
394 | (((unsigned char *)(a))[1] >= 16) && \ | ||
395 | (((unsigned char *)(a))[1] < 32)) || \ | ||
396 | ((((unsigned char *)(a))[0] == 192) && \ | ||
397 | (((unsigned char *)(a))[1] == 168))) | ||
398 | 374 | ||
399 | /* Flags used for the bind address copy functions. */ | 375 | /* Flags used for the bind address copy functions. */ |
400 | #define SCTP_ADDR6_ALLOWED 0x00000001 /* IPv6 address is allowed by | 376 | #define SCTP_ADDR6_ALLOWED 0x00000001 /* IPv6 address is allowed by |
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 34318a33a94c..4977b0a81535 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -150,13 +150,6 @@ int sctp_primitive_REQUESTHEARTBEAT(struct sctp_association *, void *arg); | |||
150 | int sctp_primitive_ASCONF(struct sctp_association *, void *arg); | 150 | int sctp_primitive_ASCONF(struct sctp_association *, void *arg); |
151 | 151 | ||
152 | /* | 152 | /* |
153 | * sctp/crc32c.c | ||
154 | */ | ||
155 | __u32 sctp_start_cksum(__u8 *ptr, __u16 count); | ||
156 | __u32 sctp_update_cksum(__u8 *ptr, __u16 count, __u32 cksum); | ||
157 | __u32 sctp_end_cksum(__u32 cksum); | ||
158 | |||
159 | /* | ||
160 | * sctp/input.c | 153 | * sctp/input.c |
161 | */ | 154 | */ |
162 | int sctp_rcv(struct sk_buff *skb); | 155 | int sctp_rcv(struct sk_buff *skb); |
@@ -470,8 +463,7 @@ static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk) | |||
470 | skb->destructor = sctp_sock_rfree; | 463 | skb->destructor = sctp_sock_rfree; |
471 | atomic_add(event->rmem_len, &sk->sk_rmem_alloc); | 464 | atomic_add(event->rmem_len, &sk->sk_rmem_alloc); |
472 | /* | 465 | /* |
473 | * This mimics the behavior of | 466 | * This mimics the behavior of skb_set_owner_r |
474 | * sk_stream_set_owner_r | ||
475 | */ | 467 | */ |
476 | sk->sk_forward_alloc -= event->rmem_len; | 468 | sk->sk_forward_alloc -= event->rmem_len; |
477 | } | 469 | } |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index bb965742b64e..4d591bfce452 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -451,6 +451,7 @@ union sctp_params { | |||
451 | struct sctp_random_param *random; | 451 | struct sctp_random_param *random; |
452 | struct sctp_chunks_param *chunks; | 452 | struct sctp_chunks_param *chunks; |
453 | struct sctp_hmac_algo_param *hmac_algo; | 453 | struct sctp_hmac_algo_param *hmac_algo; |
454 | struct sctp_addip_param *addip; | ||
454 | }; | 455 | }; |
455 | 456 | ||
456 | /* RFC 2960. Section 3.3.5 Heartbeat. | 457 | /* RFC 2960. Section 3.3.5 Heartbeat. |
@@ -743,6 +744,7 @@ struct sctp_chunk { | |||
743 | __u8 tsn_missing_report; /* Data chunk missing counter. */ | 744 | __u8 tsn_missing_report; /* Data chunk missing counter. */ |
744 | __u8 data_accepted; /* At least 1 chunk in this packet accepted */ | 745 | __u8 data_accepted; /* At least 1 chunk in this packet accepted */ |
745 | __u8 auth; /* IN: was auth'ed | OUT: needs auth */ | 746 | __u8 auth; /* IN: was auth'ed | OUT: needs auth */ |
747 | __u8 has_asconf; /* IN: have seen an asconf before */ | ||
746 | }; | 748 | }; |
747 | 749 | ||
748 | void sctp_chunk_hold(struct sctp_chunk *); | 750 | void sctp_chunk_hold(struct sctp_chunk *); |
@@ -758,12 +760,18 @@ void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *, | |||
758 | union sctp_addr *); | 760 | union sctp_addr *); |
759 | const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); | 761 | const union sctp_addr *sctp_source(const struct sctp_chunk *chunk); |
760 | 762 | ||
763 | enum { | ||
764 | SCTP_ADDR_NEW, /* new address added to assoc/ep */ | ||
765 | SCTP_ADDR_SRC, /* address can be used as source */ | ||
766 | SCTP_ADDR_DEL, /* address about to be deleted */ | ||
767 | }; | ||
768 | |||
761 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ | 769 | /* This is a structure for holding either an IPv6 or an IPv4 address. */ |
762 | struct sctp_sockaddr_entry { | 770 | struct sctp_sockaddr_entry { |
763 | struct list_head list; | 771 | struct list_head list; |
764 | struct rcu_head rcu; | 772 | struct rcu_head rcu; |
765 | union sctp_addr a; | 773 | union sctp_addr a; |
766 | __u8 use_as_src; | 774 | __u8 state; |
767 | __u8 valid; | 775 | __u8 valid; |
768 | }; | 776 | }; |
769 | 777 | ||
@@ -1188,10 +1196,12 @@ int sctp_bind_addr_dup(struct sctp_bind_addr *dest, | |||
1188 | const struct sctp_bind_addr *src, | 1196 | const struct sctp_bind_addr *src, |
1189 | gfp_t gfp); | 1197 | gfp_t gfp); |
1190 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, | 1198 | int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, |
1191 | __u8 use_as_src, gfp_t gfp); | 1199 | __u8 addr_state, gfp_t gfp); |
1192 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); | 1200 | int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); |
1193 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, | 1201 | int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, |
1194 | struct sctp_sock *); | 1202 | struct sctp_sock *); |
1203 | int sctp_bind_addr_state(const struct sctp_bind_addr *bp, | ||
1204 | const union sctp_addr *addr); | ||
1195 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, | 1205 | union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, |
1196 | const union sctp_addr *addrs, | 1206 | const union sctp_addr *addrs, |
1197 | int addrcnt, | 1207 | int addrcnt, |
@@ -1784,20 +1794,16 @@ struct sctp_association { | |||
1784 | */ | 1794 | */ |
1785 | struct sctp_chunk *addip_last_asconf; | 1795 | struct sctp_chunk *addip_last_asconf; |
1786 | 1796 | ||
1787 | /* ADDIP Section 4.2 Upon reception of an ASCONF Chunk. | 1797 | /* ADDIP Section 5.2 Upon reception of an ASCONF Chunk. |
1788 | * | 1798 | * |
1789 | * IMPLEMENTATION NOTE: As an optimization a receiver may wish | 1799 | * This is needed to implement itmes E1 - E4 of the updated |
1790 | * to save the last ASCONF-ACK for some predetermined period | 1800 | * spec. Here is the justification: |
1791 | * of time and instead of re-processing the ASCONF (with the | ||
1792 | * same serial number) it may just re-transmit the | ||
1793 | * ASCONF-ACK. It may wish to use the arrival of a new serial | ||
1794 | * number to discard the previously saved ASCONF-ACK or any | ||
1795 | * other means it may choose to expire the saved ASCONF-ACK. | ||
1796 | * | 1801 | * |
1797 | * [This is our saved ASCONF-ACK. We invalidate it when a new | 1802 | * Since the peer may bundle multiple ASCONF chunks toward us, |
1798 | * ASCONF serial number arrives.] | 1803 | * we now need the ability to cache multiple ACKs. The section |
1804 | * describes in detail how they are cached and cleaned up. | ||
1799 | */ | 1805 | */ |
1800 | struct sctp_chunk *addip_last_asconf_ack; | 1806 | struct list_head asconf_ack_list; |
1801 | 1807 | ||
1802 | /* These ASCONF chunks are waiting to be sent. | 1808 | /* These ASCONF chunks are waiting to be sent. |
1803 | * | 1809 | * |
@@ -1938,12 +1944,19 @@ void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned); | |||
1938 | void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned); | 1944 | void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned); |
1939 | void sctp_assoc_set_primary(struct sctp_association *, | 1945 | void sctp_assoc_set_primary(struct sctp_association *, |
1940 | struct sctp_transport *); | 1946 | struct sctp_transport *); |
1947 | void sctp_assoc_del_nonprimary_peers(struct sctp_association *, | ||
1948 | struct sctp_transport *); | ||
1941 | int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, | 1949 | int sctp_assoc_set_bind_addr_from_ep(struct sctp_association *, |
1942 | gfp_t); | 1950 | gfp_t); |
1943 | int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, | 1951 | int sctp_assoc_set_bind_addr_from_cookie(struct sctp_association *, |
1944 | struct sctp_cookie*, | 1952 | struct sctp_cookie*, |
1945 | gfp_t gfp); | 1953 | gfp_t gfp); |
1946 | int sctp_assoc_set_id(struct sctp_association *, gfp_t); | 1954 | int sctp_assoc_set_id(struct sctp_association *, gfp_t); |
1955 | void sctp_assoc_clean_asconf_ack_cache(const struct sctp_association *asoc); | ||
1956 | struct sctp_chunk *sctp_assoc_lookup_asconf_ack( | ||
1957 | const struct sctp_association *asoc, | ||
1958 | __be32 serial); | ||
1959 | |||
1947 | 1960 | ||
1948 | int sctp_cmp_addr_exact(const union sctp_addr *ss1, | 1961 | int sctp_cmp_addr_exact(const union sctp_addr *ss1, |
1949 | const union sctp_addr *ss2); | 1962 | const union sctp_addr *ss2); |
diff --git a/include/net/snmp.h b/include/net/snmp.h index ea206bff0dc4..ce2f48507510 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -23,6 +23,7 @@ | |||
23 | 23 | ||
24 | #include <linux/cache.h> | 24 | #include <linux/cache.h> |
25 | #include <linux/snmp.h> | 25 | #include <linux/snmp.h> |
26 | #include <linux/smp.h> | ||
26 | 27 | ||
27 | /* | 28 | /* |
28 | * Mibs are stored in array of unsigned long. | 29 | * Mibs are stored in array of unsigned long. |
@@ -117,6 +118,11 @@ struct linux_mib { | |||
117 | unsigned long mibs[LINUX_MIB_MAX]; | 118 | unsigned long mibs[LINUX_MIB_MAX]; |
118 | }; | 119 | }; |
119 | 120 | ||
121 | /* Linux Xfrm */ | ||
122 | #define LINUX_MIB_XFRMMAX __LINUX_MIB_XFRMMAX | ||
123 | struct linux_xfrm_mib { | ||
124 | unsigned long mibs[LINUX_MIB_XFRMMAX]; | ||
125 | }; | ||
120 | 126 | ||
121 | /* | 127 | /* |
122 | * FIXME: On x86 and some other CPUs the split into user and softirq parts | 128 | * FIXME: On x86 and some other CPUs the split into user and softirq parts |
@@ -134,17 +140,27 @@ struct linux_mib { | |||
134 | 140 | ||
135 | #define SNMP_INC_STATS_BH(mib, field) \ | 141 | #define SNMP_INC_STATS_BH(mib, field) \ |
136 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) | 142 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field]++) |
137 | #define SNMP_INC_STATS_OFFSET_BH(mib, field, offset) \ | ||
138 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field + (offset)]++) | ||
139 | #define SNMP_INC_STATS_USER(mib, field) \ | 143 | #define SNMP_INC_STATS_USER(mib, field) \ |
140 | (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field]++) | 144 | do { \ |
145 | per_cpu_ptr(mib[1], get_cpu())->mibs[field]++; \ | ||
146 | put_cpu(); \ | ||
147 | } while (0) | ||
141 | #define SNMP_INC_STATS(mib, field) \ | 148 | #define SNMP_INC_STATS(mib, field) \ |
142 | (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]++) | 149 | do { \ |
150 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]++; \ | ||
151 | put_cpu(); \ | ||
152 | } while (0) | ||
143 | #define SNMP_DEC_STATS(mib, field) \ | 153 | #define SNMP_DEC_STATS(mib, field) \ |
144 | (per_cpu_ptr(mib[!in_softirq()], raw_smp_processor_id())->mibs[field]--) | 154 | do { \ |
155 | per_cpu_ptr(mib[!in_softirq()], get_cpu())->mibs[field]--; \ | ||
156 | put_cpu(); \ | ||
157 | } while (0) | ||
145 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ | 158 | #define SNMP_ADD_STATS_BH(mib, field, addend) \ |
146 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) | 159 | (per_cpu_ptr(mib[0], raw_smp_processor_id())->mibs[field] += addend) |
147 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ | 160 | #define SNMP_ADD_STATS_USER(mib, field, addend) \ |
148 | (per_cpu_ptr(mib[1], raw_smp_processor_id())->mibs[field] += addend) | 161 | do { \ |
162 | per_cpu_ptr(mib[1], get_cpu())->mibs[field] += addend; \ | ||
163 | put_cpu(); \ | ||
164 | } while (0) | ||
149 | 165 | ||
150 | #endif | 166 | #endif |
diff --git a/include/net/sock.h b/include/net/sock.h index 6e1542da33a1..902324488d0f 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/module.h> | 47 | #include <linux/module.h> |
48 | #include <linux/lockdep.h> | 48 | #include <linux/lockdep.h> |
49 | #include <linux/netdevice.h> | 49 | #include <linux/netdevice.h> |
50 | #include <linux/pcounter.h> | ||
50 | #include <linux/skbuff.h> /* struct sk_buff */ | 51 | #include <linux/skbuff.h> /* struct sk_buff */ |
51 | #include <linux/mm.h> | 52 | #include <linux/mm.h> |
52 | #include <linux/security.h> | 53 | #include <linux/security.h> |
@@ -56,7 +57,6 @@ | |||
56 | #include <asm/atomic.h> | 57 | #include <asm/atomic.h> |
57 | #include <net/dst.h> | 58 | #include <net/dst.h> |
58 | #include <net/checksum.h> | 59 | #include <net/checksum.h> |
59 | #include <net/net_namespace.h> | ||
60 | 60 | ||
61 | /* | 61 | /* |
62 | * This structure really needs to be cleaned up. | 62 | * This structure really needs to be cleaned up. |
@@ -94,6 +94,7 @@ typedef struct { | |||
94 | 94 | ||
95 | struct sock; | 95 | struct sock; |
96 | struct proto; | 96 | struct proto; |
97 | struct net; | ||
97 | 98 | ||
98 | /** | 99 | /** |
99 | * struct sock_common - minimal network layer representation of sockets | 100 | * struct sock_common - minimal network layer representation of sockets |
@@ -145,7 +146,8 @@ struct sock_common { | |||
145 | * @sk_forward_alloc: space allocated forward | 146 | * @sk_forward_alloc: space allocated forward |
146 | * @sk_allocation: allocation mode | 147 | * @sk_allocation: allocation mode |
147 | * @sk_sndbuf: size of send buffer in bytes | 148 | * @sk_sndbuf: size of send buffer in bytes |
148 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, %SO_OOBINLINE settings | 149 | * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, |
150 | * %SO_OOBINLINE settings | ||
149 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets | 151 | * @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets |
150 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) | 152 | * @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO) |
151 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) | 153 | * @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4) |
@@ -153,9 +155,12 @@ struct sock_common { | |||
153 | * @sk_backlog: always used with the per-socket spinlock held | 155 | * @sk_backlog: always used with the per-socket spinlock held |
154 | * @sk_callback_lock: used with the callbacks in the end of this struct | 156 | * @sk_callback_lock: used with the callbacks in the end of this struct |
155 | * @sk_error_queue: rarely used | 157 | * @sk_error_queue: rarely used |
156 | * @sk_prot_creator: sk_prot of original sock creator (see ipv6_setsockopt, IPV6_ADDRFORM for instance) | 158 | * @sk_prot_creator: sk_prot of original sock creator (see ipv6_setsockopt, |
159 | * IPV6_ADDRFORM for instance) | ||
157 | * @sk_err: last error | 160 | * @sk_err: last error |
158 | * @sk_err_soft: errors that don't cause failure but are the cause of a persistent failure not just 'timed out' | 161 | * @sk_err_soft: errors that don't cause failure but are the cause of a |
162 | * persistent failure not just 'timed out' | ||
163 | * @sk_drops: raw drops counter | ||
159 | * @sk_ack_backlog: current listen backlog | 164 | * @sk_ack_backlog: current listen backlog |
160 | * @sk_max_ack_backlog: listen backlog set in listen() | 165 | * @sk_max_ack_backlog: listen backlog set in listen() |
161 | * @sk_priority: %SO_PRIORITY setting | 166 | * @sk_priority: %SO_PRIORITY setting |
@@ -239,6 +244,7 @@ struct sock { | |||
239 | rwlock_t sk_callback_lock; | 244 | rwlock_t sk_callback_lock; |
240 | int sk_err, | 245 | int sk_err, |
241 | sk_err_soft; | 246 | sk_err_soft; |
247 | atomic_t sk_drops; | ||
242 | unsigned short sk_ack_backlog; | 248 | unsigned short sk_ack_backlog; |
243 | unsigned short sk_max_ack_backlog; | 249 | unsigned short sk_max_ack_backlog; |
244 | __u32 sk_priority; | 250 | __u32 sk_priority; |
@@ -439,7 +445,7 @@ static inline int sk_acceptq_is_full(struct sock *sk) | |||
439 | */ | 445 | */ |
440 | static inline int sk_stream_min_wspace(struct sock *sk) | 446 | static inline int sk_stream_min_wspace(struct sock *sk) |
441 | { | 447 | { |
442 | return sk->sk_wmem_queued / 2; | 448 | return sk->sk_wmem_queued >> 1; |
443 | } | 449 | } |
444 | 450 | ||
445 | static inline int sk_stream_wspace(struct sock *sk) | 451 | static inline int sk_stream_wspace(struct sock *sk) |
@@ -454,25 +460,6 @@ static inline int sk_stream_memory_free(struct sock *sk) | |||
454 | return sk->sk_wmem_queued < sk->sk_sndbuf; | 460 | return sk->sk_wmem_queued < sk->sk_sndbuf; |
455 | } | 461 | } |
456 | 462 | ||
457 | extern void sk_stream_rfree(struct sk_buff *skb); | ||
458 | |||
459 | static inline void sk_stream_set_owner_r(struct sk_buff *skb, struct sock *sk) | ||
460 | { | ||
461 | skb->sk = sk; | ||
462 | skb->destructor = sk_stream_rfree; | ||
463 | atomic_add(skb->truesize, &sk->sk_rmem_alloc); | ||
464 | sk->sk_forward_alloc -= skb->truesize; | ||
465 | } | ||
466 | |||
467 | static inline void sk_stream_free_skb(struct sock *sk, struct sk_buff *skb) | ||
468 | { | ||
469 | skb_truesize_check(skb); | ||
470 | sock_set_flag(sk, SOCK_QUEUE_SHRUNK); | ||
471 | sk->sk_wmem_queued -= skb->truesize; | ||
472 | sk->sk_forward_alloc += skb->truesize; | ||
473 | __kfree_skb(skb); | ||
474 | } | ||
475 | |||
476 | /* The per-socket spinlock must be held here. */ | 463 | /* The per-socket spinlock must be held here. */ |
477 | static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) | 464 | static inline void sk_add_backlog(struct sock *sk, struct sk_buff *skb) |
478 | { | 465 | { |
@@ -560,14 +547,11 @@ struct proto { | |||
560 | void (*unhash)(struct sock *sk); | 547 | void (*unhash)(struct sock *sk); |
561 | int (*get_port)(struct sock *sk, unsigned short snum); | 548 | int (*get_port)(struct sock *sk, unsigned short snum); |
562 | 549 | ||
563 | #ifdef CONFIG_SMP | ||
564 | /* Keeping track of sockets in use */ | 550 | /* Keeping track of sockets in use */ |
565 | void (*inuse_add)(struct proto *prot, int inc); | 551 | #ifdef CONFIG_PROC_FS |
566 | int (*inuse_getval)(const struct proto *prot); | 552 | struct pcounter inuse; |
567 | int *inuse_ptr; | ||
568 | #else | ||
569 | int inuse; | ||
570 | #endif | 553 | #endif |
554 | |||
571 | /* Memory pressure */ | 555 | /* Memory pressure */ |
572 | void (*enter_memory_pressure)(void); | 556 | void (*enter_memory_pressure)(void); |
573 | atomic_t *memory_allocated; /* Current allocated memory. */ | 557 | atomic_t *memory_allocated; /* Current allocated memory. */ |
@@ -575,7 +559,7 @@ struct proto { | |||
575 | /* | 559 | /* |
576 | * Pressure flag: try to collapse. | 560 | * Pressure flag: try to collapse. |
577 | * Technical note: it is used by multiple contexts non atomically. | 561 | * Technical note: it is used by multiple contexts non atomically. |
578 | * All the sk_stream_mem_schedule() is of this nature: accounting | 562 | * All the __sk_mem_schedule() is of this nature: accounting |
579 | * is strict, actions are advisory and have some latency. | 563 | * is strict, actions are advisory and have some latency. |
580 | */ | 564 | */ |
581 | int *memory_pressure; | 565 | int *memory_pressure; |
@@ -602,36 +586,6 @@ struct proto { | |||
602 | #endif | 586 | #endif |
603 | }; | 587 | }; |
604 | 588 | ||
605 | /* | ||
606 | * Special macros to let protos use a fast version of inuse{get|add} | ||
607 | * using a static percpu variable per proto instead of an allocated one, | ||
608 | * saving one dereference. | ||
609 | * This might be changed if/when dynamic percpu vars become fast. | ||
610 | */ | ||
611 | #ifdef CONFIG_SMP | ||
612 | # define DEFINE_PROTO_INUSE(NAME) \ | ||
613 | static DEFINE_PER_CPU(int, NAME##_inuse); \ | ||
614 | static void NAME##_inuse_add(struct proto *prot, int inc) \ | ||
615 | { \ | ||
616 | __get_cpu_var(NAME##_inuse) += inc; \ | ||
617 | } \ | ||
618 | \ | ||
619 | static int NAME##_inuse_getval(const struct proto *prot)\ | ||
620 | { \ | ||
621 | int res = 0, cpu; \ | ||
622 | \ | ||
623 | for_each_possible_cpu(cpu) \ | ||
624 | res += per_cpu(NAME##_inuse, cpu); \ | ||
625 | return res; \ | ||
626 | } | ||
627 | # define REF_PROTO_INUSE(NAME) \ | ||
628 | .inuse_add = NAME##_inuse_add, \ | ||
629 | .inuse_getval = NAME##_inuse_getval, | ||
630 | #else | ||
631 | # define DEFINE_PROTO_INUSE(NAME) | ||
632 | # define REF_PROTO_INUSE(NAME) | ||
633 | #endif | ||
634 | |||
635 | extern int proto_register(struct proto *prot, int alloc_slab); | 589 | extern int proto_register(struct proto *prot, int alloc_slab); |
636 | extern void proto_unregister(struct proto *prot); | 590 | extern void proto_unregister(struct proto *prot); |
637 | 591 | ||
@@ -660,33 +614,42 @@ static inline void sk_refcnt_debug_release(const struct sock *sk) | |||
660 | #define sk_refcnt_debug_release(sk) do { } while (0) | 614 | #define sk_refcnt_debug_release(sk) do { } while (0) |
661 | #endif /* SOCK_REFCNT_DEBUG */ | 615 | #endif /* SOCK_REFCNT_DEBUG */ |
662 | 616 | ||
617 | |||
618 | #ifdef CONFIG_PROC_FS | ||
619 | # define DEFINE_PROTO_INUSE(NAME) DEFINE_PCOUNTER(NAME) | ||
620 | # define REF_PROTO_INUSE(NAME) PCOUNTER_MEMBER_INITIALIZER(NAME, .inuse) | ||
663 | /* Called with local bh disabled */ | 621 | /* Called with local bh disabled */ |
664 | static __inline__ void sock_prot_inc_use(struct proto *prot) | 622 | static inline void sock_prot_inuse_add(struct proto *prot, int inc) |
665 | { | 623 | { |
666 | #ifdef CONFIG_SMP | 624 | pcounter_add(&prot->inuse, inc); |
667 | prot->inuse_add(prot, 1); | ||
668 | #else | ||
669 | prot->inuse++; | ||
670 | #endif | ||
671 | } | 625 | } |
672 | 626 | static inline int sock_prot_inuse_init(struct proto *proto) | |
673 | static __inline__ void sock_prot_dec_use(struct proto *prot) | ||
674 | { | 627 | { |
675 | #ifdef CONFIG_SMP | 628 | return pcounter_alloc(&proto->inuse); |
676 | prot->inuse_add(prot, -1); | ||
677 | #else | ||
678 | prot->inuse--; | ||
679 | #endif | ||
680 | } | 629 | } |
681 | 630 | static inline int sock_prot_inuse_get(struct proto *proto) | |
682 | static __inline__ int sock_prot_inuse(struct proto *proto) | ||
683 | { | 631 | { |
684 | #ifdef CONFIG_SMP | 632 | return pcounter_getval(&proto->inuse); |
685 | return proto->inuse_getval(proto); | 633 | } |
634 | static inline void sock_prot_inuse_free(struct proto *proto) | ||
635 | { | ||
636 | pcounter_free(&proto->inuse); | ||
637 | } | ||
686 | #else | 638 | #else |
687 | return proto->inuse; | 639 | # define DEFINE_PROTO_INUSE(NAME) |
688 | #endif | 640 | # define REF_PROTO_INUSE(NAME) |
641 | static void inline sock_prot_inuse_add(struct proto *prot, int inc) | ||
642 | { | ||
643 | } | ||
644 | static int inline sock_prot_inuse_init(struct proto *proto) | ||
645 | { | ||
646 | return 0; | ||
689 | } | 647 | } |
648 | static void inline sock_prot_inuse_free(struct proto *proto) | ||
649 | { | ||
650 | } | ||
651 | #endif | ||
652 | |||
690 | 653 | ||
691 | /* With per-bucket locks this operation is not-atomic, so that | 654 | /* With per-bucket locks this operation is not-atomic, so that |
692 | * this version is not worse. | 655 | * this version is not worse. |
@@ -750,32 +713,81 @@ static inline struct inode *SOCK_INODE(struct socket *socket) | |||
750 | return &container_of(socket, struct socket_alloc, socket)->vfs_inode; | 713 | return &container_of(socket, struct socket_alloc, socket)->vfs_inode; |
751 | } | 714 | } |
752 | 715 | ||
753 | extern void __sk_stream_mem_reclaim(struct sock *sk); | 716 | /* |
754 | extern int sk_stream_mem_schedule(struct sock *sk, int size, int kind); | 717 | * Functions for memory accounting |
718 | */ | ||
719 | extern int __sk_mem_schedule(struct sock *sk, int size, int kind); | ||
720 | extern void __sk_mem_reclaim(struct sock *sk); | ||
755 | 721 | ||
756 | #define SK_STREAM_MEM_QUANTUM ((int)PAGE_SIZE) | 722 | #define SK_MEM_QUANTUM ((int)PAGE_SIZE) |
723 | #define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM) | ||
724 | #define SK_MEM_SEND 0 | ||
725 | #define SK_MEM_RECV 1 | ||
757 | 726 | ||
758 | static inline int sk_stream_pages(int amt) | 727 | static inline int sk_mem_pages(int amt) |
759 | { | 728 | { |
760 | return DIV_ROUND_UP(amt, SK_STREAM_MEM_QUANTUM); | 729 | return (amt + SK_MEM_QUANTUM - 1) >> SK_MEM_QUANTUM_SHIFT; |
761 | } | 730 | } |
762 | 731 | ||
763 | static inline void sk_stream_mem_reclaim(struct sock *sk) | 732 | static inline int sk_has_account(struct sock *sk) |
764 | { | 733 | { |
765 | if (sk->sk_forward_alloc >= SK_STREAM_MEM_QUANTUM) | 734 | /* return true if protocol supports memory accounting */ |
766 | __sk_stream_mem_reclaim(sk); | 735 | return !!sk->sk_prot->memory_allocated; |
767 | } | 736 | } |
768 | 737 | ||
769 | static inline int sk_stream_rmem_schedule(struct sock *sk, struct sk_buff *skb) | 738 | static inline int sk_wmem_schedule(struct sock *sk, int size) |
770 | { | 739 | { |
771 | return (int)skb->truesize <= sk->sk_forward_alloc || | 740 | if (!sk_has_account(sk)) |
772 | sk_stream_mem_schedule(sk, skb->truesize, 1); | 741 | return 1; |
742 | return size <= sk->sk_forward_alloc || | ||
743 | __sk_mem_schedule(sk, size, SK_MEM_SEND); | ||
773 | } | 744 | } |
774 | 745 | ||
775 | static inline int sk_stream_wmem_schedule(struct sock *sk, int size) | 746 | static inline int sk_rmem_schedule(struct sock *sk, int size) |
776 | { | 747 | { |
748 | if (!sk_has_account(sk)) | ||
749 | return 1; | ||
777 | return size <= sk->sk_forward_alloc || | 750 | return size <= sk->sk_forward_alloc || |
778 | sk_stream_mem_schedule(sk, size, 0); | 751 | __sk_mem_schedule(sk, size, SK_MEM_RECV); |
752 | } | ||
753 | |||
754 | static inline void sk_mem_reclaim(struct sock *sk) | ||
755 | { | ||
756 | if (!sk_has_account(sk)) | ||
757 | return; | ||
758 | if (sk->sk_forward_alloc >= SK_MEM_QUANTUM) | ||
759 | __sk_mem_reclaim(sk); | ||
760 | } | ||
761 | |||
762 | static inline void sk_mem_reclaim_partial(struct sock *sk) | ||
763 | { | ||
764 | if (!sk_has_account(sk)) | ||
765 | return; | ||
766 | if (sk->sk_forward_alloc > SK_MEM_QUANTUM) | ||
767 | __sk_mem_reclaim(sk); | ||
768 | } | ||
769 | |||
770 | static inline void sk_mem_charge(struct sock *sk, int size) | ||
771 | { | ||
772 | if (!sk_has_account(sk)) | ||
773 | return; | ||
774 | sk->sk_forward_alloc -= size; | ||
775 | } | ||
776 | |||
777 | static inline void sk_mem_uncharge(struct sock *sk, int size) | ||
778 | { | ||
779 | if (!sk_has_account(sk)) | ||
780 | return; | ||
781 | sk->sk_forward_alloc += size; | ||
782 | } | ||
783 | |||
784 | static inline void sk_wmem_free_skb(struct sock *sk, struct sk_buff *skb) | ||
785 | { | ||
786 | skb_truesize_check(skb); | ||
787 | sock_set_flag(sk, SOCK_QUEUE_SHRUNK); | ||
788 | sk->sk_wmem_queued -= skb->truesize; | ||
789 | sk_mem_uncharge(sk, skb->truesize); | ||
790 | __kfree_skb(skb); | ||
779 | } | 791 | } |
780 | 792 | ||
781 | /* Used by processes to "lock" a socket state, so that | 793 | /* Used by processes to "lock" a socket state, so that |
@@ -812,14 +824,14 @@ do { \ | |||
812 | lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ | 824 | lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ |
813 | } while (0) | 825 | } while (0) |
814 | 826 | ||
815 | extern void FASTCALL(lock_sock_nested(struct sock *sk, int subclass)); | 827 | extern void lock_sock_nested(struct sock *sk, int subclass); |
816 | 828 | ||
817 | static inline void lock_sock(struct sock *sk) | 829 | static inline void lock_sock(struct sock *sk) |
818 | { | 830 | { |
819 | lock_sock_nested(sk, 0); | 831 | lock_sock_nested(sk, 0); |
820 | } | 832 | } |
821 | 833 | ||
822 | extern void FASTCALL(release_sock(struct sock *sk)); | 834 | extern void release_sock(struct sock *sk); |
823 | 835 | ||
824 | /* BH context may only use the following locking interface. */ | 836 | /* BH context may only use the following locking interface. */ |
825 | #define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) | 837 | #define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) |
@@ -1113,12 +1125,6 @@ static inline int sk_can_gso(const struct sock *sk) | |||
1113 | 1125 | ||
1114 | extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); | 1126 | extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); |
1115 | 1127 | ||
1116 | static inline void sk_charge_skb(struct sock *sk, struct sk_buff *skb) | ||
1117 | { | ||
1118 | sk->sk_wmem_queued += skb->truesize; | ||
1119 | sk->sk_forward_alloc -= skb->truesize; | ||
1120 | } | ||
1121 | |||
1122 | static inline int skb_copy_to_page(struct sock *sk, char __user *from, | 1128 | static inline int skb_copy_to_page(struct sock *sk, char __user *from, |
1123 | struct sk_buff *skb, struct page *page, | 1129 | struct sk_buff *skb, struct page *page, |
1124 | int off, int copy) | 1130 | int off, int copy) |
@@ -1138,7 +1144,7 @@ static inline int skb_copy_to_page(struct sock *sk, char __user *from, | |||
1138 | skb->data_len += copy; | 1144 | skb->data_len += copy; |
1139 | skb->truesize += copy; | 1145 | skb->truesize += copy; |
1140 | sk->sk_wmem_queued += copy; | 1146 | sk->sk_wmem_queued += copy; |
1141 | sk->sk_forward_alloc -= copy; | 1147 | sk_mem_charge(sk, copy); |
1142 | return 0; | 1148 | return 0; |
1143 | } | 1149 | } |
1144 | 1150 | ||
@@ -1164,6 +1170,7 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk) | |||
1164 | skb->sk = sk; | 1170 | skb->sk = sk; |
1165 | skb->destructor = sock_rfree; | 1171 | skb->destructor = sock_rfree; |
1166 | atomic_add(skb->truesize, &sk->sk_rmem_alloc); | 1172 | atomic_add(skb->truesize, &sk->sk_rmem_alloc); |
1173 | sk_mem_charge(sk, skb->truesize); | ||
1167 | } | 1174 | } |
1168 | 1175 | ||
1169 | extern void sk_reset_timer(struct sock *sk, struct timer_list* timer, | 1176 | extern void sk_reset_timer(struct sock *sk, struct timer_list* timer, |
@@ -1225,45 +1232,12 @@ static inline void sk_wake_async(struct sock *sk, int how, int band) | |||
1225 | static inline void sk_stream_moderate_sndbuf(struct sock *sk) | 1232 | static inline void sk_stream_moderate_sndbuf(struct sock *sk) |
1226 | { | 1233 | { |
1227 | if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) { | 1234 | if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) { |
1228 | sk->sk_sndbuf = min(sk->sk_sndbuf, sk->sk_wmem_queued / 2); | 1235 | sk->sk_sndbuf = min(sk->sk_sndbuf, sk->sk_wmem_queued >> 1); |
1229 | sk->sk_sndbuf = max(sk->sk_sndbuf, SOCK_MIN_SNDBUF); | 1236 | sk->sk_sndbuf = max(sk->sk_sndbuf, SOCK_MIN_SNDBUF); |
1230 | } | 1237 | } |
1231 | } | 1238 | } |
1232 | 1239 | ||
1233 | static inline struct sk_buff *sk_stream_alloc_pskb(struct sock *sk, | 1240 | struct sk_buff *sk_stream_alloc_skb(struct sock *sk, int size, gfp_t gfp); |
1234 | int size, int mem, | ||
1235 | gfp_t gfp) | ||
1236 | { | ||
1237 | struct sk_buff *skb; | ||
1238 | |||
1239 | /* The TCP header must be at least 32-bit aligned. */ | ||
1240 | size = ALIGN(size, 4); | ||
1241 | |||
1242 | skb = alloc_skb_fclone(size + sk->sk_prot->max_header, gfp); | ||
1243 | if (skb) { | ||
1244 | skb->truesize += mem; | ||
1245 | if (sk_stream_wmem_schedule(sk, skb->truesize)) { | ||
1246 | /* | ||
1247 | * Make sure that we have exactly size bytes | ||
1248 | * available to the caller, no more, no less. | ||
1249 | */ | ||
1250 | skb_reserve(skb, skb_tailroom(skb) - size); | ||
1251 | return skb; | ||
1252 | } | ||
1253 | __kfree_skb(skb); | ||
1254 | } else { | ||
1255 | sk->sk_prot->enter_memory_pressure(); | ||
1256 | sk_stream_moderate_sndbuf(sk); | ||
1257 | } | ||
1258 | return NULL; | ||
1259 | } | ||
1260 | |||
1261 | static inline struct sk_buff *sk_stream_alloc_skb(struct sock *sk, | ||
1262 | int size, | ||
1263 | gfp_t gfp) | ||
1264 | { | ||
1265 | return sk_stream_alloc_pskb(sk, size, 0, gfp); | ||
1266 | } | ||
1267 | 1241 | ||
1268 | static inline struct page *sk_stream_alloc_page(struct sock *sk) | 1242 | static inline struct page *sk_stream_alloc_page(struct sock *sk) |
1269 | { | 1243 | { |
@@ -1282,7 +1256,7 @@ static inline struct page *sk_stream_alloc_page(struct sock *sk) | |||
1282 | */ | 1256 | */ |
1283 | static inline int sock_writeable(const struct sock *sk) | 1257 | static inline int sock_writeable(const struct sock *sk) |
1284 | { | 1258 | { |
1285 | return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf / 2); | 1259 | return atomic_read(&sk->sk_wmem_alloc) < (sk->sk_sndbuf >> 1); |
1286 | } | 1260 | } |
1287 | 1261 | ||
1288 | static inline gfp_t gfp_any(void) | 1262 | static inline gfp_t gfp_any(void) |
@@ -1391,23 +1365,11 @@ extern int net_msg_warn; | |||
1391 | lock_sock(sk); \ | 1365 | lock_sock(sk); \ |
1392 | } | 1366 | } |
1393 | 1367 | ||
1394 | static inline void sock_valbool_flag(struct sock *sk, int bit, int valbool) | ||
1395 | { | ||
1396 | if (valbool) | ||
1397 | sock_set_flag(sk, bit); | ||
1398 | else | ||
1399 | sock_reset_flag(sk, bit); | ||
1400 | } | ||
1401 | |||
1402 | extern __u32 sysctl_wmem_max; | 1368 | extern __u32 sysctl_wmem_max; |
1403 | extern __u32 sysctl_rmem_max; | 1369 | extern __u32 sysctl_rmem_max; |
1404 | 1370 | ||
1405 | extern void sk_init(void); | 1371 | extern void sk_init(void); |
1406 | 1372 | ||
1407 | #ifdef CONFIG_SYSCTL | ||
1408 | extern struct ctl_table core_table[]; | ||
1409 | #endif | ||
1410 | |||
1411 | extern int sysctl_optmem_max; | 1373 | extern int sysctl_optmem_max; |
1412 | 1374 | ||
1413 | extern __u32 sysctl_wmem_default; | 1375 | extern __u32 sysctl_wmem_default; |
diff --git a/include/net/tcp.h b/include/net/tcp.h index cb5b033e0e59..7de4ea3a04d9 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -309,6 +309,9 @@ extern int tcp_twsk_unique(struct sock *sk, | |||
309 | 309 | ||
310 | extern void tcp_twsk_destructor(struct sock *sk); | 310 | extern void tcp_twsk_destructor(struct sock *sk); |
311 | 311 | ||
312 | extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, | ||
313 | struct pipe_inode_info *pipe, size_t len, unsigned int flags); | ||
314 | |||
312 | static inline void tcp_dec_quickack_mode(struct sock *sk, | 315 | static inline void tcp_dec_quickack_mode(struct sock *sk, |
313 | const unsigned int pkts) | 316 | const unsigned int pkts) |
314 | { | 317 | { |
@@ -575,10 +578,6 @@ struct tcp_skb_cb { | |||
575 | #define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ | 578 | #define TCPCB_EVER_RETRANS 0x80 /* Ever retransmitted frame */ |
576 | #define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) | 579 | #define TCPCB_RETRANS (TCPCB_SACKED_RETRANS|TCPCB_EVER_RETRANS) |
577 | 580 | ||
578 | #define TCPCB_URG 0x20 /* Urgent pointer advanced here */ | ||
579 | |||
580 | #define TCPCB_AT_TAIL (TCPCB_URG) | ||
581 | |||
582 | __u16 urg_ptr; /* Valid w/URG flags is set. */ | 581 | __u16 urg_ptr; /* Valid w/URG flags is set. */ |
583 | __u32 ack_seq; /* Sequence number ACK'd */ | 582 | __u32 ack_seq; /* Sequence number ACK'd */ |
584 | }; | 583 | }; |
@@ -649,7 +648,7 @@ struct tcp_congestion_ops { | |||
649 | /* lower bound for congestion window (optional) */ | 648 | /* lower bound for congestion window (optional) */ |
650 | u32 (*min_cwnd)(const struct sock *sk); | 649 | u32 (*min_cwnd)(const struct sock *sk); |
651 | /* do new cwnd calculation (required) */ | 650 | /* do new cwnd calculation (required) */ |
652 | void (*cong_avoid)(struct sock *sk, u32 ack, u32 in_flight, int good_ack); | 651 | void (*cong_avoid)(struct sock *sk, u32 ack, u32 in_flight); |
653 | /* call before changing ca_state (optional) */ | 652 | /* call before changing ca_state (optional) */ |
654 | void (*set_state)(struct sock *sk, u8 new_state); | 653 | void (*set_state)(struct sock *sk, u8 new_state); |
655 | /* call when cwnd event occurs (optional) */ | 654 | /* call when cwnd event occurs (optional) */ |
@@ -680,7 +679,7 @@ extern void tcp_slow_start(struct tcp_sock *tp); | |||
680 | 679 | ||
681 | extern struct tcp_congestion_ops tcp_init_congestion_ops; | 680 | extern struct tcp_congestion_ops tcp_init_congestion_ops; |
682 | extern u32 tcp_reno_ssthresh(struct sock *sk); | 681 | extern u32 tcp_reno_ssthresh(struct sock *sk); |
683 | extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight, int flag); | 682 | extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight); |
684 | extern u32 tcp_reno_min_cwnd(const struct sock *sk); | 683 | extern u32 tcp_reno_min_cwnd(const struct sock *sk); |
685 | extern struct tcp_congestion_ops tcp_reno; | 684 | extern struct tcp_congestion_ops tcp_reno; |
686 | 685 | ||
@@ -782,26 +781,12 @@ static __inline__ __u32 tcp_max_burst(const struct tcp_sock *tp) | |||
782 | return 3; | 781 | return 3; |
783 | } | 782 | } |
784 | 783 | ||
785 | /* RFC2861 Check whether we are limited by application or congestion window | 784 | /* Returns end sequence number of the receiver's advertised window */ |
786 | * This is the inverse of cwnd check in tcp_tso_should_defer | 785 | static inline u32 tcp_wnd_end(const struct tcp_sock *tp) |
787 | */ | ||
788 | static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight) | ||
789 | { | 786 | { |
790 | const struct tcp_sock *tp = tcp_sk(sk); | 787 | return tp->snd_una + tp->snd_wnd; |
791 | u32 left; | ||
792 | |||
793 | if (in_flight >= tp->snd_cwnd) | ||
794 | return 1; | ||
795 | |||
796 | if (!sk_can_gso(sk)) | ||
797 | return 0; | ||
798 | |||
799 | left = tp->snd_cwnd - in_flight; | ||
800 | if (sysctl_tcp_tso_win_divisor) | ||
801 | return left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd; | ||
802 | else | ||
803 | return left <= tcp_max_burst(tp); | ||
804 | } | 788 | } |
789 | extern int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); | ||
805 | 790 | ||
806 | static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, | 791 | static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, |
807 | const struct sk_buff *skb) | 792 | const struct sk_buff *skb) |
@@ -921,40 +906,7 @@ static const char *statename[]={ | |||
921 | "Close Wait","Last ACK","Listen","Closing" | 906 | "Close Wait","Last ACK","Listen","Closing" |
922 | }; | 907 | }; |
923 | #endif | 908 | #endif |
924 | 909 | extern void tcp_set_state(struct sock *sk, int state); | |
925 | static inline void tcp_set_state(struct sock *sk, int state) | ||
926 | { | ||
927 | int oldstate = sk->sk_state; | ||
928 | |||
929 | switch (state) { | ||
930 | case TCP_ESTABLISHED: | ||
931 | if (oldstate != TCP_ESTABLISHED) | ||
932 | TCP_INC_STATS(TCP_MIB_CURRESTAB); | ||
933 | break; | ||
934 | |||
935 | case TCP_CLOSE: | ||
936 | if (oldstate == TCP_CLOSE_WAIT || oldstate == TCP_ESTABLISHED) | ||
937 | TCP_INC_STATS(TCP_MIB_ESTABRESETS); | ||
938 | |||
939 | sk->sk_prot->unhash(sk); | ||
940 | if (inet_csk(sk)->icsk_bind_hash && | ||
941 | !(sk->sk_userlocks & SOCK_BINDPORT_LOCK)) | ||
942 | inet_put_port(&tcp_hashinfo, sk); | ||
943 | /* fall through */ | ||
944 | default: | ||
945 | if (oldstate==TCP_ESTABLISHED) | ||
946 | TCP_DEC_STATS(TCP_MIB_CURRESTAB); | ||
947 | } | ||
948 | |||
949 | /* Change state AFTER socket is unhashed to avoid closed | ||
950 | * socket sitting in hash tables. | ||
951 | */ | ||
952 | sk->sk_state = state; | ||
953 | |||
954 | #ifdef STATE_TRACE | ||
955 | SOCK_DEBUG(sk, "TCP sk=%p, State %s -> %s\n",sk, statename[oldstate],statename[state]); | ||
956 | #endif | ||
957 | } | ||
958 | 910 | ||
959 | extern void tcp_done(struct sock *sk); | 911 | extern void tcp_done(struct sock *sk); |
960 | 912 | ||
@@ -1078,7 +1030,6 @@ static inline void tcp_clear_retrans_hints_partial(struct tcp_sock *tp) | |||
1078 | static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) | 1030 | static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp) |
1079 | { | 1031 | { |
1080 | tcp_clear_retrans_hints_partial(tp); | 1032 | tcp_clear_retrans_hints_partial(tp); |
1081 | tp->fastpath_skb_hint = NULL; | ||
1082 | } | 1033 | } |
1083 | 1034 | ||
1084 | /* MD5 Signature */ | 1035 | /* MD5 Signature */ |
@@ -1153,7 +1104,8 @@ extern int tcp_v4_calc_md5_hash(char *md5_hash, | |||
1153 | struct dst_entry *dst, | 1104 | struct dst_entry *dst, |
1154 | struct request_sock *req, | 1105 | struct request_sock *req, |
1155 | struct tcphdr *th, | 1106 | struct tcphdr *th, |
1156 | int protocol, int tcplen); | 1107 | int protocol, |
1108 | unsigned int tcplen); | ||
1157 | extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, | 1109 | extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk, |
1158 | struct sock *addr_sk); | 1110 | struct sock *addr_sk); |
1159 | 1111 | ||
@@ -1193,8 +1145,8 @@ static inline void tcp_write_queue_purge(struct sock *sk) | |||
1193 | struct sk_buff *skb; | 1145 | struct sk_buff *skb; |
1194 | 1146 | ||
1195 | while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) | 1147 | while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL) |
1196 | sk_stream_free_skb(sk, skb); | 1148 | sk_wmem_free_skb(sk, skb); |
1197 | sk_stream_mem_reclaim(sk); | 1149 | sk_mem_reclaim(sk); |
1198 | } | 1150 | } |
1199 | 1151 | ||
1200 | static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) | 1152 | static inline struct sk_buff *tcp_write_queue_head(struct sock *sk) |
@@ -1227,6 +1179,11 @@ static inline struct sk_buff *tcp_write_queue_next(struct sock *sk, struct sk_bu | |||
1227 | for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\ | 1179 | for (; (skb != (struct sk_buff *)&(sk)->sk_write_queue);\ |
1228 | skb = skb->next) | 1180 | skb = skb->next) |
1229 | 1181 | ||
1182 | #define tcp_for_write_queue_from_safe(skb, tmp, sk) \ | ||
1183 | for (tmp = skb->next; \ | ||
1184 | (skb != (struct sk_buff *)&(sk)->sk_write_queue); \ | ||
1185 | skb = tmp, tmp = skb->next) | ||
1186 | |||
1230 | static inline struct sk_buff *tcp_send_head(struct sock *sk) | 1187 | static inline struct sk_buff *tcp_send_head(struct sock *sk) |
1231 | { | 1188 | { |
1232 | return sk->sk_send_head; | 1189 | return sk->sk_send_head; |
@@ -1234,14 +1191,9 @@ static inline struct sk_buff *tcp_send_head(struct sock *sk) | |||
1234 | 1191 | ||
1235 | static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb) | 1192 | static inline void tcp_advance_send_head(struct sock *sk, struct sk_buff *skb) |
1236 | { | 1193 | { |
1237 | struct tcp_sock *tp = tcp_sk(sk); | ||
1238 | |||
1239 | sk->sk_send_head = skb->next; | 1194 | sk->sk_send_head = skb->next; |
1240 | if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue) | 1195 | if (sk->sk_send_head == (struct sk_buff *)&sk->sk_write_queue) |
1241 | sk->sk_send_head = NULL; | 1196 | sk->sk_send_head = NULL; |
1242 | /* Don't override Nagle indefinately with F-RTO */ | ||
1243 | if (tp->frto_counter == 2) | ||
1244 | tp->frto_counter = 3; | ||
1245 | } | 1197 | } |
1246 | 1198 | ||
1247 | static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked) | 1199 | static inline void tcp_check_send_head(struct sock *sk, struct sk_buff *skb_unlinked) |
@@ -1265,8 +1217,12 @@ static inline void tcp_add_write_queue_tail(struct sock *sk, struct sk_buff *skb | |||
1265 | __tcp_add_write_queue_tail(sk, skb); | 1217 | __tcp_add_write_queue_tail(sk, skb); |
1266 | 1218 | ||
1267 | /* Queue it, remembering where we must start sending. */ | 1219 | /* Queue it, remembering where we must start sending. */ |
1268 | if (sk->sk_send_head == NULL) | 1220 | if (sk->sk_send_head == NULL) { |
1269 | sk->sk_send_head = skb; | 1221 | sk->sk_send_head = skb; |
1222 | |||
1223 | if (tcp_sk(sk)->highest_sack == NULL) | ||
1224 | tcp_sk(sk)->highest_sack = skb; | ||
1225 | } | ||
1270 | } | 1226 | } |
1271 | 1227 | ||
1272 | static inline void __tcp_add_write_queue_head(struct sock *sk, struct sk_buff *skb) | 1228 | static inline void __tcp_add_write_queue_head(struct sock *sk, struct sk_buff *skb) |
@@ -1309,6 +1265,45 @@ static inline int tcp_write_queue_empty(struct sock *sk) | |||
1309 | return skb_queue_empty(&sk->sk_write_queue); | 1265 | return skb_queue_empty(&sk->sk_write_queue); |
1310 | } | 1266 | } |
1311 | 1267 | ||
1268 | /* Start sequence of the highest skb with SACKed bit, valid only if | ||
1269 | * sacked > 0 or when the caller has ensured validity by itself. | ||
1270 | */ | ||
1271 | static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp) | ||
1272 | { | ||
1273 | if (!tp->sacked_out) | ||
1274 | return tp->snd_una; | ||
1275 | |||
1276 | if (tp->highest_sack == NULL) | ||
1277 | return tp->snd_nxt; | ||
1278 | |||
1279 | return TCP_SKB_CB(tp->highest_sack)->seq; | ||
1280 | } | ||
1281 | |||
1282 | static inline void tcp_advance_highest_sack(struct sock *sk, struct sk_buff *skb) | ||
1283 | { | ||
1284 | tcp_sk(sk)->highest_sack = tcp_skb_is_last(sk, skb) ? NULL : | ||
1285 | tcp_write_queue_next(sk, skb); | ||
1286 | } | ||
1287 | |||
1288 | static inline struct sk_buff *tcp_highest_sack(struct sock *sk) | ||
1289 | { | ||
1290 | return tcp_sk(sk)->highest_sack; | ||
1291 | } | ||
1292 | |||
1293 | static inline void tcp_highest_sack_reset(struct sock *sk) | ||
1294 | { | ||
1295 | tcp_sk(sk)->highest_sack = tcp_write_queue_head(sk); | ||
1296 | } | ||
1297 | |||
1298 | /* Called when old skb is about to be deleted (to be combined with new skb) */ | ||
1299 | static inline void tcp_highest_sack_combine(struct sock *sk, | ||
1300 | struct sk_buff *old, | ||
1301 | struct sk_buff *new) | ||
1302 | { | ||
1303 | if (tcp_sk(sk)->sacked_out && (old == tcp_sk(sk)->highest_sack)) | ||
1304 | tcp_sk(sk)->highest_sack = new; | ||
1305 | } | ||
1306 | |||
1312 | /* /proc */ | 1307 | /* /proc */ |
1313 | enum tcp_seq_states { | 1308 | enum tcp_seq_states { |
1314 | TCP_SEQ_STATE_LISTENING, | 1309 | TCP_SEQ_STATE_LISTENING, |
@@ -1359,7 +1354,8 @@ struct tcp_sock_af_ops { | |||
1359 | struct dst_entry *dst, | 1354 | struct dst_entry *dst, |
1360 | struct request_sock *req, | 1355 | struct request_sock *req, |
1361 | struct tcphdr *th, | 1356 | struct tcphdr *th, |
1362 | int protocol, int len); | 1357 | int protocol, |
1358 | unsigned int len); | ||
1363 | int (*md5_add) (struct sock *sk, | 1359 | int (*md5_add) (struct sock *sk, |
1364 | struct sock *addr_sk, | 1360 | struct sock *addr_sk, |
1365 | u8 *newkey, | 1361 | u8 *newkey, |
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 409da3a9a455..27394e0447d8 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h | |||
@@ -17,16 +17,20 @@ extern struct proto tcpv6_prot; | |||
17 | struct flowi; | 17 | struct flowi; |
18 | 18 | ||
19 | /* extention headers */ | 19 | /* extention headers */ |
20 | extern void ipv6_rthdr_init(void); | 20 | extern int ipv6_exthdrs_init(void); |
21 | extern void ipv6_frag_init(void); | 21 | extern void ipv6_exthdrs_exit(void); |
22 | extern void ipv6_nodata_init(void); | 22 | extern int ipv6_frag_init(void); |
23 | extern void ipv6_destopt_init(void); | 23 | extern void ipv6_frag_exit(void); |
24 | 24 | ||
25 | /* transport protocols */ | 25 | /* transport protocols */ |
26 | extern void rawv6_init(void); | 26 | extern int rawv6_init(void); |
27 | extern void udpv6_init(void); | 27 | extern void rawv6_exit(void); |
28 | extern void udplitev6_init(void); | 28 | extern int udpv6_init(void); |
29 | extern void tcpv6_init(void); | 29 | extern void udpv6_exit(void); |
30 | extern int udplitev6_init(void); | ||
31 | extern void udplitev6_exit(void); | ||
32 | extern int tcpv6_init(void); | ||
33 | extern void tcpv6_exit(void); | ||
30 | 34 | ||
31 | extern int udpv6_connect(struct sock *sk, | 35 | extern int udpv6_connect(struct sock *sk, |
32 | struct sockaddr *uaddr, | 36 | struct sockaddr *uaddr, |
diff --git a/include/net/udp.h b/include/net/udp.h index 98755ebaf163..c6669c0a74c7 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -65,6 +65,13 @@ extern rwlock_t udp_hash_lock; | |||
65 | 65 | ||
66 | extern struct proto udp_prot; | 66 | extern struct proto udp_prot; |
67 | 67 | ||
68 | extern atomic_t udp_memory_allocated; | ||
69 | |||
70 | /* sysctl variables for udp */ | ||
71 | extern int sysctl_udp_mem[3]; | ||
72 | extern int sysctl_udp_rmem_min; | ||
73 | extern int sysctl_udp_wmem_min; | ||
74 | |||
68 | struct sk_buff; | 75 | struct sk_buff; |
69 | 76 | ||
70 | /* | 77 | /* |
@@ -108,7 +115,7 @@ static inline void udp_lib_unhash(struct sock *sk) | |||
108 | write_lock_bh(&udp_hash_lock); | 115 | write_lock_bh(&udp_hash_lock); |
109 | if (sk_del_node_init(sk)) { | 116 | if (sk_del_node_init(sk)) { |
110 | inet_sk(sk)->num = 0; | 117 | inet_sk(sk)->num = 0; |
111 | sock_prot_dec_use(sk->sk_prot); | 118 | sock_prot_inuse_add(sk->sk_prot, -1); |
112 | } | 119 | } |
113 | write_unlock_bh(&udp_hash_lock); | 120 | write_unlock_bh(&udp_hash_lock); |
114 | } | 121 | } |
@@ -139,6 +146,12 @@ extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, | |||
139 | int (*push_pending_frames)(struct sock *)); | 146 | int (*push_pending_frames)(struct sock *)); |
140 | 147 | ||
141 | DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); | 148 | DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); |
149 | DECLARE_SNMP_STAT(struct udp_mib, udp_stats_in6); | ||
150 | |||
151 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ | ||
152 | DECLARE_SNMP_STAT(struct udp_mib, udplite_statistics); | ||
153 | DECLARE_SNMP_STAT(struct udp_mib, udplite_stats_in6); | ||
154 | |||
142 | /* | 155 | /* |
143 | * SNMP statistics for UDP and UDP-Lite | 156 | * SNMP statistics for UDP and UDP-Lite |
144 | */ | 157 | */ |
@@ -149,6 +162,25 @@ DECLARE_SNMP_STAT(struct udp_mib, udp_statistics); | |||
149 | if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \ | 162 | if (is_udplite) SNMP_INC_STATS_BH(udplite_statistics, field); \ |
150 | else SNMP_INC_STATS_BH(udp_statistics, field); } while(0) | 163 | else SNMP_INC_STATS_BH(udp_statistics, field); } while(0) |
151 | 164 | ||
165 | #define UDP6_INC_STATS_BH(field, is_udplite) do { \ | ||
166 | if (is_udplite) SNMP_INC_STATS_BH(udplite_stats_in6, field); \ | ||
167 | else SNMP_INC_STATS_BH(udp_stats_in6, field); } while(0) | ||
168 | #define UDP6_INC_STATS_USER(field, is_udplite) do { \ | ||
169 | if (is_udplite) SNMP_INC_STATS_USER(udplite_stats_in6, field); \ | ||
170 | else SNMP_INC_STATS_USER(udp_stats_in6, field); } while(0) | ||
171 | |||
172 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
173 | #define UDPX_INC_STATS_BH(sk, field) \ | ||
174 | do { \ | ||
175 | if ((sk)->sk_family == AF_INET) \ | ||
176 | UDP_INC_STATS_BH(field, 0); \ | ||
177 | else \ | ||
178 | UDP6_INC_STATS_BH(field, 0); \ | ||
179 | } while (0); | ||
180 | #else | ||
181 | #define UDPX_INC_STATS_BH(sk, field) UDP_INC_STATS_BH(field, 0) | ||
182 | #endif | ||
183 | |||
152 | /* /proc */ | 184 | /* /proc */ |
153 | struct udp_seq_afinfo { | 185 | struct udp_seq_afinfo { |
154 | struct module *owner; | 186 | struct module *owner; |
@@ -173,4 +205,6 @@ extern void udp_proc_unregister(struct udp_seq_afinfo *afinfo); | |||
173 | extern int udp4_proc_init(void); | 205 | extern int udp4_proc_init(void); |
174 | extern void udp4_proc_exit(void); | 206 | extern void udp4_proc_exit(void); |
175 | #endif | 207 | #endif |
208 | |||
209 | extern void udp_init(void); | ||
176 | #endif /* _UDP_H */ | 210 | #endif /* _UDP_H */ |
diff --git a/include/net/udplite.h b/include/net/udplite.h index 635b0eafca95..b76b2e377af4 100644 --- a/include/net/udplite.h +++ b/include/net/udplite.h | |||
@@ -13,9 +13,6 @@ | |||
13 | extern struct proto udplite_prot; | 13 | extern struct proto udplite_prot; |
14 | extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; | 14 | extern struct hlist_head udplite_hash[UDP_HTABLE_SIZE]; |
15 | 15 | ||
16 | /* UDP-Lite does not have a standardized MIB yet, so we inherit from UDP */ | ||
17 | DECLARE_SNMP_STAT(struct udp_mib, udplite_statistics); | ||
18 | |||
19 | /* | 16 | /* |
20 | * Checksum computation is all in software, hence simpler getfrag. | 17 | * Checksum computation is all in software, hence simpler getfrag. |
21 | */ | 18 | */ |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 1dd20cf17982..5ebb9ba479b1 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -19,6 +19,9 @@ | |||
19 | #include <net/route.h> | 19 | #include <net/route.h> |
20 | #include <net/ipv6.h> | 20 | #include <net/ipv6.h> |
21 | #include <net/ip6_fib.h> | 21 | #include <net/ip6_fib.h> |
22 | #ifdef CONFIG_XFRM_STATISTICS | ||
23 | #include <net/snmp.h> | ||
24 | #endif | ||
22 | 25 | ||
23 | #define XFRM_PROTO_ESP 50 | 26 | #define XFRM_PROTO_ESP 50 |
24 | #define XFRM_PROTO_AH 51 | 27 | #define XFRM_PROTO_AH 51 |
@@ -34,6 +37,17 @@ | |||
34 | #define MODULE_ALIAS_XFRM_TYPE(family, proto) \ | 37 | #define MODULE_ALIAS_XFRM_TYPE(family, proto) \ |
35 | MODULE_ALIAS("xfrm-type-" __stringify(family) "-" __stringify(proto)) | 38 | MODULE_ALIAS("xfrm-type-" __stringify(family) "-" __stringify(proto)) |
36 | 39 | ||
40 | #ifdef CONFIG_XFRM_STATISTICS | ||
41 | DECLARE_SNMP_STAT(struct linux_xfrm_mib, xfrm_statistics); | ||
42 | #define XFRM_INC_STATS(field) SNMP_INC_STATS(xfrm_statistics, field) | ||
43 | #define XFRM_INC_STATS_BH(field) SNMP_INC_STATS_BH(xfrm_statistics, field) | ||
44 | #define XFRM_INC_STATS_USER(field) SNMP_INC_STATS_USER(xfrm_statistics, field) | ||
45 | #else | ||
46 | #define XFRM_INC_STATS(field) | ||
47 | #define XFRM_INC_STATS_BH(field) | ||
48 | #define XFRM_INC_STATS_USER(field) | ||
49 | #endif | ||
50 | |||
37 | extern struct sock *xfrm_nl; | 51 | extern struct sock *xfrm_nl; |
38 | extern u32 sysctl_xfrm_aevent_etime; | 52 | extern u32 sysctl_xfrm_aevent_etime; |
39 | extern u32 sysctl_xfrm_aevent_rseqth; | 53 | extern u32 sysctl_xfrm_aevent_rseqth; |
@@ -183,7 +197,7 @@ struct xfrm_state | |||
183 | struct timer_list timer; | 197 | struct timer_list timer; |
184 | 198 | ||
185 | /* Last used time */ | 199 | /* Last used time */ |
186 | u64 lastused; | 200 | unsigned long lastused; |
187 | 201 | ||
188 | /* Reference to data common to all the instances of this | 202 | /* Reference to data common to all the instances of this |
189 | * transformer. */ | 203 | * transformer. */ |
@@ -227,22 +241,26 @@ struct km_event | |||
227 | u32 event; | 241 | u32 event; |
228 | }; | 242 | }; |
229 | 243 | ||
244 | struct net_device; | ||
230 | struct xfrm_type; | 245 | struct xfrm_type; |
231 | struct xfrm_dst; | 246 | struct xfrm_dst; |
232 | struct xfrm_policy_afinfo { | 247 | struct xfrm_policy_afinfo { |
233 | unsigned short family; | 248 | unsigned short family; |
234 | struct dst_ops *dst_ops; | 249 | struct dst_ops *dst_ops; |
235 | void (*garbage_collect)(void); | 250 | void (*garbage_collect)(void); |
236 | int (*dst_lookup)(struct xfrm_dst **dst, struct flowi *fl); | 251 | struct dst_entry *(*dst_lookup)(int tos, xfrm_address_t *saddr, |
252 | xfrm_address_t *daddr); | ||
237 | int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); | 253 | int (*get_saddr)(xfrm_address_t *saddr, xfrm_address_t *daddr); |
238 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); | 254 | struct dst_entry *(*find_bundle)(struct flowi *fl, struct xfrm_policy *policy); |
239 | int (*bundle_create)(struct xfrm_policy *policy, | ||
240 | struct xfrm_state **xfrm, | ||
241 | int nx, | ||
242 | struct flowi *fl, | ||
243 | struct dst_entry **dst_p); | ||
244 | void (*decode_session)(struct sk_buff *skb, | 255 | void (*decode_session)(struct sk_buff *skb, |
245 | struct flowi *fl); | 256 | struct flowi *fl, |
257 | int reverse); | ||
258 | int (*get_tos)(struct flowi *fl); | ||
259 | int (*init_path)(struct xfrm_dst *path, | ||
260 | struct dst_entry *dst, | ||
261 | int nfheader_len); | ||
262 | int (*fill_dst)(struct xfrm_dst *xdst, | ||
263 | struct net_device *dev); | ||
246 | }; | 264 | }; |
247 | 265 | ||
248 | extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); | 266 | extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); |
@@ -257,6 +275,8 @@ extern int __xfrm_state_delete(struct xfrm_state *x); | |||
257 | 275 | ||
258 | struct xfrm_state_afinfo { | 276 | struct xfrm_state_afinfo { |
259 | unsigned int family; | 277 | unsigned int family; |
278 | unsigned int proto; | ||
279 | unsigned int eth_proto; | ||
260 | struct module *owner; | 280 | struct module *owner; |
261 | struct xfrm_type *type_map[IPPROTO_MAX]; | 281 | struct xfrm_type *type_map[IPPROTO_MAX]; |
262 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; | 282 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; |
@@ -267,6 +287,12 @@ struct xfrm_state_afinfo { | |||
267 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); | 287 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); |
268 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); | 288 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); |
269 | int (*output)(struct sk_buff *skb); | 289 | int (*output)(struct sk_buff *skb); |
290 | int (*extract_input)(struct xfrm_state *x, | ||
291 | struct sk_buff *skb); | ||
292 | int (*extract_output)(struct xfrm_state *x, | ||
293 | struct sk_buff *skb); | ||
294 | int (*transport_finish)(struct sk_buff *skb, | ||
295 | int async); | ||
270 | }; | 296 | }; |
271 | 297 | ||
272 | extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); | 298 | extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); |
@@ -282,6 +308,8 @@ struct xfrm_type | |||
282 | __u8 flags; | 308 | __u8 flags; |
283 | #define XFRM_TYPE_NON_FRAGMENT 1 | 309 | #define XFRM_TYPE_NON_FRAGMENT 1 |
284 | #define XFRM_TYPE_REPLAY_PROT 2 | 310 | #define XFRM_TYPE_REPLAY_PROT 2 |
311 | #define XFRM_TYPE_LOCAL_COADDR 4 | ||
312 | #define XFRM_TYPE_REMOTE_COADDR 8 | ||
285 | 313 | ||
286 | int (*init_state)(struct xfrm_state *x); | 314 | int (*init_state)(struct xfrm_state *x); |
287 | void (*destructor)(struct xfrm_state *); | 315 | void (*destructor)(struct xfrm_state *); |
@@ -289,8 +317,6 @@ struct xfrm_type | |||
289 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); | 317 | int (*output)(struct xfrm_state *, struct sk_buff *pskb); |
290 | int (*reject)(struct xfrm_state *, struct sk_buff *, struct flowi *); | 318 | int (*reject)(struct xfrm_state *, struct sk_buff *, struct flowi *); |
291 | int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); | 319 | int (*hdr_offset)(struct xfrm_state *, struct sk_buff *, u8 **); |
292 | xfrm_address_t *(*local_addr)(struct xfrm_state *, xfrm_address_t *); | ||
293 | xfrm_address_t *(*remote_addr)(struct xfrm_state *, xfrm_address_t *); | ||
294 | /* Estimate maximal size of result of transformation of a dgram */ | 320 | /* Estimate maximal size of result of transformation of a dgram */ |
295 | u32 (*get_mtu)(struct xfrm_state *, int size); | 321 | u32 (*get_mtu)(struct xfrm_state *, int size); |
296 | }; | 322 | }; |
@@ -299,6 +325,27 @@ extern int xfrm_register_type(struct xfrm_type *type, unsigned short family); | |||
299 | extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); | 325 | extern int xfrm_unregister_type(struct xfrm_type *type, unsigned short family); |
300 | 326 | ||
301 | struct xfrm_mode { | 327 | struct xfrm_mode { |
328 | /* | ||
329 | * Remove encapsulation header. | ||
330 | * | ||
331 | * The IP header will be moved over the top of the encapsulation | ||
332 | * header. | ||
333 | * | ||
334 | * On entry, the transport header shall point to where the IP header | ||
335 | * should be and the network header shall be set to where the IP | ||
336 | * header currently is. skb->data shall point to the start of the | ||
337 | * payload. | ||
338 | */ | ||
339 | int (*input2)(struct xfrm_state *x, struct sk_buff *skb); | ||
340 | |||
341 | /* | ||
342 | * This is the actual input entry point. | ||
343 | * | ||
344 | * For transport mode and equivalent this would be identical to | ||
345 | * input2 (which does not need to be set). While tunnel mode | ||
346 | * and equivalent would set this to the tunnel encapsulation function | ||
347 | * xfrm4_prepare_input that would in turn call input2. | ||
348 | */ | ||
302 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); | 349 | int (*input)(struct xfrm_state *x, struct sk_buff *skb); |
303 | 350 | ||
304 | /* | 351 | /* |
@@ -312,7 +359,18 @@ struct xfrm_mode { | |||
312 | * header. The value of the network header will always point | 359 | * header. The value of the network header will always point |
313 | * to the top IP header while skb->data will point to the payload. | 360 | * to the top IP header while skb->data will point to the payload. |
314 | */ | 361 | */ |
315 | int (*output)(struct xfrm_state *x,struct sk_buff *skb); | 362 | int (*output2)(struct xfrm_state *x,struct sk_buff *skb); |
363 | |||
364 | /* | ||
365 | * This is the actual output entry point. | ||
366 | * | ||
367 | * For transport mode and equivalent this would be identical to | ||
368 | * output2 (which does not need to be set). While tunnel mode | ||
369 | * and equivalent would set this to a tunnel encapsulation function | ||
370 | * (xfrm4_prepare_output or xfrm6_prepare_output) that would in turn | ||
371 | * call output2. | ||
372 | */ | ||
373 | int (*output)(struct xfrm_state *x, struct sk_buff *skb); | ||
316 | 374 | ||
317 | struct xfrm_state_afinfo *afinfo; | 375 | struct xfrm_state_afinfo *afinfo; |
318 | struct module *owner; | 376 | struct module *owner; |
@@ -454,6 +512,51 @@ struct xfrm_skb_cb { | |||
454 | 512 | ||
455 | #define XFRM_SKB_CB(__skb) ((struct xfrm_skb_cb *)&((__skb)->cb[0])) | 513 | #define XFRM_SKB_CB(__skb) ((struct xfrm_skb_cb *)&((__skb)->cb[0])) |
456 | 514 | ||
515 | /* | ||
516 | * This structure is used by the afinfo prepare_input/prepare_output functions | ||
517 | * to transmit header information to the mode input/output functions. | ||
518 | */ | ||
519 | struct xfrm_mode_skb_cb { | ||
520 | union { | ||
521 | struct inet_skb_parm h4; | ||
522 | struct inet6_skb_parm h6; | ||
523 | } header; | ||
524 | |||
525 | /* Copied from header for IPv4, always set to zero and DF for IPv6. */ | ||
526 | __be16 id; | ||
527 | __be16 frag_off; | ||
528 | |||
529 | /* TOS for IPv4, class for IPv6. */ | ||
530 | u8 tos; | ||
531 | |||
532 | /* TTL for IPv4, hop limitfor IPv6. */ | ||
533 | u8 ttl; | ||
534 | |||
535 | /* Protocol for IPv4, NH for IPv6. */ | ||
536 | u8 protocol; | ||
537 | |||
538 | /* Used by IPv6 only, zero for IPv4. */ | ||
539 | u8 flow_lbl[3]; | ||
540 | }; | ||
541 | |||
542 | #define XFRM_MODE_SKB_CB(__skb) ((struct xfrm_mode_skb_cb *)&((__skb)->cb[0])) | ||
543 | |||
544 | /* | ||
545 | * This structure is used by the input processing to locate the SPI and | ||
546 | * related information. | ||
547 | */ | ||
548 | struct xfrm_spi_skb_cb { | ||
549 | union { | ||
550 | struct inet_skb_parm h4; | ||
551 | struct inet6_skb_parm h6; | ||
552 | } header; | ||
553 | |||
554 | unsigned int daddroff; | ||
555 | unsigned int family; | ||
556 | }; | ||
557 | |||
558 | #define XFRM_SPI_SKB_CB(__skb) ((struct xfrm_spi_skb_cb *)&((__skb)->cb[0])) | ||
559 | |||
457 | /* Audit Information */ | 560 | /* Audit Information */ |
458 | struct xfrm_audit | 561 | struct xfrm_audit |
459 | { | 562 | { |
@@ -462,41 +565,59 @@ struct xfrm_audit | |||
462 | }; | 565 | }; |
463 | 566 | ||
464 | #ifdef CONFIG_AUDITSYSCALL | 567 | #ifdef CONFIG_AUDITSYSCALL |
465 | static inline struct audit_buffer *xfrm_audit_start(u32 auid, u32 sid) | 568 | static inline struct audit_buffer *xfrm_audit_start(const char *op) |
466 | { | 569 | { |
467 | struct audit_buffer *audit_buf = NULL; | 570 | struct audit_buffer *audit_buf = NULL; |
468 | char *secctx; | ||
469 | u32 secctx_len; | ||
470 | 571 | ||
572 | if (audit_enabled == 0) | ||
573 | return NULL; | ||
471 | audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, | 574 | audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, |
472 | AUDIT_MAC_IPSEC_EVENT); | 575 | AUDIT_MAC_IPSEC_EVENT); |
473 | if (audit_buf == NULL) | 576 | if (audit_buf == NULL) |
474 | return NULL; | 577 | return NULL; |
578 | audit_log_format(audit_buf, "op=%s", op); | ||
579 | return audit_buf; | ||
580 | } | ||
475 | 581 | ||
476 | audit_log_format(audit_buf, "auid=%u", auid); | 582 | static inline void xfrm_audit_helper_usrinfo(u32 auid, u32 secid, |
583 | struct audit_buffer *audit_buf) | ||
584 | { | ||
585 | char *secctx; | ||
586 | u32 secctx_len; | ||
477 | 587 | ||
478 | if (sid != 0 && | 588 | audit_log_format(audit_buf, " auid=%u", auid); |
479 | security_secid_to_secctx(sid, &secctx, &secctx_len) == 0) { | 589 | if (secid != 0 && |
590 | security_secid_to_secctx(secid, &secctx, &secctx_len) == 0) { | ||
480 | audit_log_format(audit_buf, " subj=%s", secctx); | 591 | audit_log_format(audit_buf, " subj=%s", secctx); |
481 | security_release_secctx(secctx, secctx_len); | 592 | security_release_secctx(secctx, secctx_len); |
482 | } else | 593 | } else |
483 | audit_log_task_context(audit_buf); | 594 | audit_log_task_context(audit_buf); |
484 | return audit_buf; | ||
485 | } | 595 | } |
486 | 596 | ||
487 | extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, | 597 | extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, |
488 | u32 auid, u32 sid); | 598 | u32 auid, u32 secid); |
489 | extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, | 599 | extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, |
490 | u32 auid, u32 sid); | 600 | u32 auid, u32 secid); |
491 | extern void xfrm_audit_state_add(struct xfrm_state *x, int result, | 601 | extern void xfrm_audit_state_add(struct xfrm_state *x, int result, |
492 | u32 auid, u32 sid); | 602 | u32 auid, u32 secid); |
493 | extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, | 603 | extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, |
494 | u32 auid, u32 sid); | 604 | u32 auid, u32 secid); |
605 | extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, | ||
606 | struct sk_buff *skb); | ||
607 | extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family); | ||
608 | extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, | ||
609 | __be32 net_spi, __be32 net_seq); | ||
610 | extern void xfrm_audit_state_icvfail(struct xfrm_state *x, | ||
611 | struct sk_buff *skb, u8 proto); | ||
495 | #else | 612 | #else |
496 | #define xfrm_audit_policy_add(x, r, a, s) do { ; } while (0) | 613 | #define xfrm_audit_policy_add(x, r, a, s) do { ; } while (0) |
497 | #define xfrm_audit_policy_delete(x, r, a, s) do { ; } while (0) | 614 | #define xfrm_audit_policy_delete(x, r, a, s) do { ; } while (0) |
498 | #define xfrm_audit_state_add(x, r, a, s) do { ; } while (0) | 615 | #define xfrm_audit_state_add(x, r, a, s) do { ; } while (0) |
499 | #define xfrm_audit_state_delete(x, r, a, s) do { ; } while (0) | 616 | #define xfrm_audit_state_delete(x, r, a, s) do { ; } while (0) |
617 | #define xfrm_audit_state_replay_overflow(x, s) do { ; } while (0) | ||
618 | #define xfrm_audit_state_notfound_simple(s, f) do { ; } while (0) | ||
619 | #define xfrm_audit_state_notfound(s, f, sp, sq) do { ; } while (0) | ||
620 | #define xfrm_audit_state_icvfail(x, s, p) do { ; } while (0) | ||
500 | #endif /* CONFIG_AUDITSYSCALL */ | 621 | #endif /* CONFIG_AUDITSYSCALL */ |
501 | 622 | ||
502 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) | 623 | static inline void xfrm_pol_hold(struct xfrm_policy *policy) |
@@ -505,12 +626,12 @@ static inline void xfrm_pol_hold(struct xfrm_policy *policy) | |||
505 | atomic_inc(&policy->refcnt); | 626 | atomic_inc(&policy->refcnt); |
506 | } | 627 | } |
507 | 628 | ||
508 | extern void __xfrm_policy_destroy(struct xfrm_policy *policy); | 629 | extern void xfrm_policy_destroy(struct xfrm_policy *policy); |
509 | 630 | ||
510 | static inline void xfrm_pol_put(struct xfrm_policy *policy) | 631 | static inline void xfrm_pol_put(struct xfrm_policy *policy) |
511 | { | 632 | { |
512 | if (atomic_dec_and_test(&policy->refcnt)) | 633 | if (atomic_dec_and_test(&policy->refcnt)) |
513 | __xfrm_policy_destroy(policy); | 634 | xfrm_policy_destroy(policy); |
514 | } | 635 | } |
515 | 636 | ||
516 | #ifdef CONFIG_XFRM_SUB_POLICY | 637 | #ifdef CONFIG_XFRM_SUB_POLICY |
@@ -757,17 +878,25 @@ xfrm_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x, unsigned short | |||
757 | } | 878 | } |
758 | 879 | ||
759 | #ifdef CONFIG_XFRM | 880 | #ifdef CONFIG_XFRM |
760 | |||
761 | extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family); | 881 | extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family); |
762 | 882 | ||
763 | static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family) | 883 | static inline int __xfrm_policy_check2(struct sock *sk, int dir, |
884 | struct sk_buff *skb, | ||
885 | unsigned int family, int reverse) | ||
764 | { | 886 | { |
887 | int ndir = dir | (reverse ? XFRM_POLICY_MASK + 1 : 0); | ||
888 | |||
765 | if (sk && sk->sk_policy[XFRM_POLICY_IN]) | 889 | if (sk && sk->sk_policy[XFRM_POLICY_IN]) |
766 | return __xfrm_policy_check(sk, dir, skb, family); | 890 | return __xfrm_policy_check(sk, ndir, skb, family); |
767 | 891 | ||
768 | return (!xfrm_policy_count[dir] && !skb->sp) || | 892 | return (!xfrm_policy_count[dir] && !skb->sp) || |
769 | (skb->dst->flags & DST_NOPOLICY) || | 893 | (skb->dst->flags & DST_NOPOLICY) || |
770 | __xfrm_policy_check(sk, dir, skb, family); | 894 | __xfrm_policy_check(sk, ndir, skb, family); |
895 | } | ||
896 | |||
897 | static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb, unsigned short family) | ||
898 | { | ||
899 | return __xfrm_policy_check2(sk, dir, skb, family, 0); | ||
771 | } | 900 | } |
772 | 901 | ||
773 | static inline int xfrm4_policy_check(struct sock *sk, int dir, struct sk_buff *skb) | 902 | static inline int xfrm4_policy_check(struct sock *sk, int dir, struct sk_buff *skb) |
@@ -780,7 +909,34 @@ static inline int xfrm6_policy_check(struct sock *sk, int dir, struct sk_buff *s | |||
780 | return xfrm_policy_check(sk, dir, skb, AF_INET6); | 909 | return xfrm_policy_check(sk, dir, skb, AF_INET6); |
781 | } | 910 | } |
782 | 911 | ||
783 | extern int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, unsigned short family); | 912 | static inline int xfrm4_policy_check_reverse(struct sock *sk, int dir, |
913 | struct sk_buff *skb) | ||
914 | { | ||
915 | return __xfrm_policy_check2(sk, dir, skb, AF_INET, 1); | ||
916 | } | ||
917 | |||
918 | static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir, | ||
919 | struct sk_buff *skb) | ||
920 | { | ||
921 | return __xfrm_policy_check2(sk, dir, skb, AF_INET6, 1); | ||
922 | } | ||
923 | |||
924 | extern int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, | ||
925 | unsigned int family, int reverse); | ||
926 | |||
927 | static inline int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, | ||
928 | unsigned int family) | ||
929 | { | ||
930 | return __xfrm_decode_session(skb, fl, family, 0); | ||
931 | } | ||
932 | |||
933 | static inline int xfrm_decode_session_reverse(struct sk_buff *skb, | ||
934 | struct flowi *fl, | ||
935 | unsigned int family) | ||
936 | { | ||
937 | return __xfrm_decode_session(skb, fl, family, 1); | ||
938 | } | ||
939 | |||
784 | extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); | 940 | extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); |
785 | 941 | ||
786 | static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) | 942 | static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) |
@@ -841,6 +997,22 @@ static inline int xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *sk | |||
841 | { | 997 | { |
842 | return 1; | 998 | return 1; |
843 | } | 999 | } |
1000 | static inline int xfrm_decode_session_reverse(struct sk_buff *skb, | ||
1001 | struct flowi *fl, | ||
1002 | unsigned int family) | ||
1003 | { | ||
1004 | return -ENOSYS; | ||
1005 | } | ||
1006 | static inline int xfrm4_policy_check_reverse(struct sock *sk, int dir, | ||
1007 | struct sk_buff *skb) | ||
1008 | { | ||
1009 | return 1; | ||
1010 | } | ||
1011 | static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir, | ||
1012 | struct sk_buff *skb) | ||
1013 | { | ||
1014 | return 1; | ||
1015 | } | ||
844 | #endif | 1016 | #endif |
845 | 1017 | ||
846 | static __inline__ | 1018 | static __inline__ |
@@ -981,12 +1153,27 @@ struct xfrm6_tunnel { | |||
981 | 1153 | ||
982 | extern void xfrm_init(void); | 1154 | extern void xfrm_init(void); |
983 | extern void xfrm4_init(void); | 1155 | extern void xfrm4_init(void); |
984 | extern void xfrm6_init(void); | ||
985 | extern void xfrm6_fini(void); | ||
986 | extern void xfrm_state_init(void); | 1156 | extern void xfrm_state_init(void); |
987 | extern void xfrm4_state_init(void); | 1157 | extern void xfrm4_state_init(void); |
988 | extern void xfrm6_state_init(void); | 1158 | #ifdef CONFIG_XFRM |
1159 | extern int xfrm6_init(void); | ||
1160 | extern void xfrm6_fini(void); | ||
1161 | extern int xfrm6_state_init(void); | ||
989 | extern void xfrm6_state_fini(void); | 1162 | extern void xfrm6_state_fini(void); |
1163 | #else | ||
1164 | static inline int xfrm6_init(void) | ||
1165 | { | ||
1166 | return 0; | ||
1167 | } | ||
1168 | static inline void xfrm6_fini(void) | ||
1169 | { | ||
1170 | ; | ||
1171 | } | ||
1172 | #endif | ||
1173 | |||
1174 | #ifdef CONFIG_XFRM_STATISTICS | ||
1175 | extern int xfrm_proc_init(void); | ||
1176 | #endif | ||
990 | 1177 | ||
991 | extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *); | 1178 | extern int xfrm_state_walk(u8 proto, int (*func)(struct xfrm_state *, int, void*), void *); |
992 | extern struct xfrm_state *xfrm_state_alloc(void); | 1179 | extern struct xfrm_state *xfrm_state_alloc(void); |
@@ -1045,14 +1232,23 @@ extern int xfrm_state_delete(struct xfrm_state *x); | |||
1045 | extern int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); | 1232 | extern int xfrm_state_flush(u8 proto, struct xfrm_audit *audit_info); |
1046 | extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); | 1233 | extern void xfrm_sad_getinfo(struct xfrmk_sadinfo *si); |
1047 | extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); | 1234 | extern void xfrm_spd_getinfo(struct xfrmk_spdinfo *si); |
1048 | extern int xfrm_replay_check(struct xfrm_state *x, __be32 seq); | 1235 | extern int xfrm_replay_check(struct xfrm_state *x, |
1236 | struct sk_buff *skb, __be32 seq); | ||
1049 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); | 1237 | extern void xfrm_replay_advance(struct xfrm_state *x, __be32 seq); |
1050 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); | 1238 | extern void xfrm_replay_notify(struct xfrm_state *x, int event); |
1051 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); | 1239 | extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); |
1052 | extern int xfrm_init_state(struct xfrm_state *x); | 1240 | extern int xfrm_init_state(struct xfrm_state *x); |
1241 | extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); | ||
1242 | extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, | ||
1243 | int encap_type); | ||
1244 | extern int xfrm_input_resume(struct sk_buff *skb, int nexthdr); | ||
1245 | extern int xfrm_output_resume(struct sk_buff *skb, int err); | ||
1053 | extern int xfrm_output(struct sk_buff *skb); | 1246 | extern int xfrm_output(struct sk_buff *skb); |
1247 | extern int xfrm4_extract_header(struct sk_buff *skb); | ||
1248 | extern int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb); | ||
1054 | extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, | 1249 | extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, |
1055 | int encap_type); | 1250 | int encap_type); |
1251 | extern int xfrm4_transport_finish(struct sk_buff *skb, int async); | ||
1056 | extern int xfrm4_rcv(struct sk_buff *skb); | 1252 | extern int xfrm4_rcv(struct sk_buff *skb); |
1057 | 1253 | ||
1058 | static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) | 1254 | static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) |
@@ -1060,10 +1256,15 @@ static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) | |||
1060 | return xfrm4_rcv_encap(skb, nexthdr, spi, 0); | 1256 | return xfrm4_rcv_encap(skb, nexthdr, spi, 0); |
1061 | } | 1257 | } |
1062 | 1258 | ||
1259 | extern int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); | ||
1260 | extern int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | ||
1063 | extern int xfrm4_output(struct sk_buff *skb); | 1261 | extern int xfrm4_output(struct sk_buff *skb); |
1064 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); | 1262 | extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); |
1065 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); | 1263 | extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); |
1264 | extern int xfrm6_extract_header(struct sk_buff *skb); | ||
1265 | extern int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); | ||
1066 | extern int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); | 1266 | extern int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); |
1267 | extern int xfrm6_transport_finish(struct sk_buff *skb, int async); | ||
1067 | extern int xfrm6_rcv(struct sk_buff *skb); | 1268 | extern int xfrm6_rcv(struct sk_buff *skb); |
1068 | extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | 1269 | extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, |
1069 | xfrm_address_t *saddr, u8 proto); | 1270 | xfrm_address_t *saddr, u8 proto); |
@@ -1072,6 +1273,8 @@ extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short | |||
1072 | extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); | 1273 | extern __be32 xfrm6_tunnel_alloc_spi(xfrm_address_t *saddr); |
1073 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); | 1274 | extern void xfrm6_tunnel_free_spi(xfrm_address_t *saddr); |
1074 | extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); | 1275 | extern __be32 xfrm6_tunnel_spi_lookup(xfrm_address_t *saddr); |
1276 | extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); | ||
1277 | extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | ||
1075 | extern int xfrm6_output(struct sk_buff *skb); | 1278 | extern int xfrm6_output(struct sk_buff *skb); |
1076 | extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, | 1279 | extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, |
1077 | u8 **prevhdr); | 1280 | u8 **prevhdr); |
@@ -1079,7 +1282,6 @@ extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, | |||
1079 | #ifdef CONFIG_XFRM | 1282 | #ifdef CONFIG_XFRM |
1080 | extern int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb); | 1283 | extern int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb); |
1081 | extern int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen); | 1284 | extern int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen); |
1082 | extern int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsigned short family); | ||
1083 | #else | 1285 | #else |
1084 | static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen) | 1286 | static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen) |
1085 | { | 1287 | { |
@@ -1092,11 +1294,6 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) | |||
1092 | kfree_skb(skb); | 1294 | kfree_skb(skb); |
1093 | return 0; | 1295 | return 0; |
1094 | } | 1296 | } |
1095 | |||
1096 | static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsigned short family) | ||
1097 | { | ||
1098 | return -EINVAL; | ||
1099 | } | ||
1100 | #endif | 1297 | #endif |
1101 | 1298 | ||
1102 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); | 1299 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); |
@@ -1113,11 +1310,9 @@ extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); | |||
1113 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, | 1310 | struct xfrm_state * xfrm_find_acq(u8 mode, u32 reqid, u8 proto, |
1114 | xfrm_address_t *daddr, xfrm_address_t *saddr, | 1311 | xfrm_address_t *daddr, xfrm_address_t *saddr, |
1115 | int create, unsigned short family); | 1312 | int create, unsigned short family); |
1116 | extern int xfrm_policy_flush(u8 type, struct xfrm_audit *audit_info); | ||
1117 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); | 1313 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); |
1118 | extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, | 1314 | extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, |
1119 | struct flowi *fl, int family, int strict); | 1315 | struct flowi *fl, int family, int strict); |
1120 | extern void xfrm_init_pmtu(struct dst_entry *dst); | ||
1121 | 1316 | ||
1122 | #ifdef CONFIG_XFRM_MIGRATE | 1317 | #ifdef CONFIG_XFRM_MIGRATE |
1123 | extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | 1318 | extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, |
@@ -1214,4 +1409,9 @@ static inline void xfrm_states_delete(struct xfrm_state **states, int n) | |||
1214 | } | 1409 | } |
1215 | #endif | 1410 | #endif |
1216 | 1411 | ||
1412 | static inline struct xfrm_state *xfrm_input_state(struct sk_buff *skb) | ||
1413 | { | ||
1414 | return skb->sp->xvec[skb->sp->len - 1]; | ||
1415 | } | ||
1416 | |||
1217 | #endif /* _NET_XFRM_H */ | 1417 | #endif /* _NET_XFRM_H */ |