diff options
Diffstat (limited to 'include/net')
64 files changed, 1317 insertions, 415 deletions
diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h index a8de812ccbc8..071fd7a8d781 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h | |||
| @@ -86,6 +86,8 @@ do { \ | |||
| 86 | 86 | ||
| 87 | /** | 87 | /** |
| 88 | * enum p9_msg_t - 9P message types | 88 | * enum p9_msg_t - 9P message types |
| 89 | * @P9_TLERROR: not used | ||
| 90 | * @P9_RLERROR: response for any failed request for 9P2000.L | ||
| 89 | * @P9_TSTATFS: file system status request | 91 | * @P9_TSTATFS: file system status request |
| 90 | * @P9_RSTATFS: file system status response | 92 | * @P9_RSTATFS: file system status response |
| 91 | * @P9_TSYMLINK: make symlink request | 93 | * @P9_TSYMLINK: make symlink request |
| @@ -137,6 +139,8 @@ do { \ | |||
| 137 | */ | 139 | */ |
| 138 | 140 | ||
| 139 | enum p9_msg_t { | 141 | enum p9_msg_t { |
| 142 | P9_TLERROR = 6, | ||
| 143 | P9_RLERROR, | ||
| 140 | P9_TSTATFS = 8, | 144 | P9_TSTATFS = 8, |
| 141 | P9_RSTATFS, | 145 | P9_RSTATFS, |
| 142 | P9_TLOPEN = 12, | 146 | P9_TLOPEN = 12, |
| @@ -149,6 +153,8 @@ enum p9_msg_t { | |||
| 149 | P9_RMKNOD, | 153 | P9_RMKNOD, |
| 150 | P9_TRENAME = 20, | 154 | P9_TRENAME = 20, |
| 151 | P9_RRENAME, | 155 | P9_RRENAME, |
| 156 | P9_TREADLINK = 22, | ||
| 157 | P9_RREADLINK, | ||
| 152 | P9_TGETATTR = 24, | 158 | P9_TGETATTR = 24, |
| 153 | P9_RGETATTR, | 159 | P9_RGETATTR, |
| 154 | P9_TSETATTR = 26, | 160 | P9_TSETATTR = 26, |
| @@ -159,6 +165,12 @@ enum p9_msg_t { | |||
| 159 | P9_RXATTRCREATE, | 165 | P9_RXATTRCREATE, |
| 160 | P9_TREADDIR = 40, | 166 | P9_TREADDIR = 40, |
| 161 | P9_RREADDIR, | 167 | P9_RREADDIR, |
| 168 | P9_TFSYNC = 50, | ||
| 169 | P9_RFSYNC, | ||
| 170 | P9_TLOCK = 52, | ||
| 171 | P9_RLOCK, | ||
| 172 | P9_TGETLOCK = 54, | ||
| 173 | P9_RGETLOCK, | ||
| 162 | P9_TLINK = 70, | 174 | P9_TLINK = 70, |
| 163 | P9_RLINK, | 175 | P9_RLINK, |
| 164 | P9_TMKDIR = 72, | 176 | P9_TMKDIR = 72, |
| @@ -458,6 +470,48 @@ struct p9_iattr_dotl { | |||
| 458 | u64 mtime_nsec; | 470 | u64 mtime_nsec; |
| 459 | }; | 471 | }; |
| 460 | 472 | ||
| 473 | #define P9_LOCK_SUCCESS 0 | ||
| 474 | #define P9_LOCK_BLOCKED 1 | ||
| 475 | #define P9_LOCK_ERROR 2 | ||
| 476 | #define P9_LOCK_GRACE 3 | ||
| 477 | |||
| 478 | #define P9_LOCK_FLAGS_BLOCK 1 | ||
| 479 | #define P9_LOCK_FLAGS_RECLAIM 2 | ||
| 480 | |||
| 481 | /* struct p9_flock: POSIX lock structure | ||
| 482 | * @type - type of lock | ||
| 483 | * @flags - lock flags | ||
| 484 | * @start - starting offset of the lock | ||
| 485 | * @length - number of bytes | ||
| 486 | * @proc_id - process id which wants to take lock | ||
| 487 | * @client_id - client id | ||
| 488 | */ | ||
| 489 | |||
| 490 | struct p9_flock { | ||
| 491 | u8 type; | ||
| 492 | u32 flags; | ||
| 493 | u64 start; | ||
| 494 | u64 length; | ||
| 495 | u32 proc_id; | ||
| 496 | char *client_id; | ||
| 497 | }; | ||
| 498 | |||
| 499 | /* struct p9_getlock: getlock structure | ||
| 500 | * @type - type of lock | ||
| 501 | * @start - starting offset of the lock | ||
| 502 | * @length - number of bytes | ||
| 503 | * @proc_id - process id which wants to take lock | ||
| 504 | * @client_id - client id | ||
| 505 | */ | ||
| 506 | |||
| 507 | struct p9_getlock { | ||
| 508 | u8 type; | ||
| 509 | u64 start; | ||
| 510 | u64 length; | ||
| 511 | u32 proc_id; | ||
| 512 | char *client_id; | ||
| 513 | }; | ||
| 514 | |||
| 461 | /* Structures for Protocol Operations */ | 515 | /* Structures for Protocol Operations */ |
| 462 | struct p9_tstatfs { | 516 | struct p9_tstatfs { |
| 463 | u32 fid; | 517 | u32 fid; |
diff --git a/include/net/9p/client.h b/include/net/9p/client.h index d1aa2cfb30f0..83ba6a4d58a3 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h | |||
| @@ -212,15 +212,12 @@ struct p9_dirent { | |||
| 212 | 212 | ||
| 213 | int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); | 213 | int p9_client_statfs(struct p9_fid *fid, struct p9_rstatfs *sb); |
| 214 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name); | 214 | int p9_client_rename(struct p9_fid *fid, struct p9_fid *newdirfid, char *name); |
| 215 | int p9_client_version(struct p9_client *); | ||
| 216 | struct p9_client *p9_client_create(const char *dev_name, char *options); | 215 | struct p9_client *p9_client_create(const char *dev_name, char *options); |
| 217 | void p9_client_destroy(struct p9_client *clnt); | 216 | void p9_client_destroy(struct p9_client *clnt); |
| 218 | void p9_client_disconnect(struct p9_client *clnt); | 217 | void p9_client_disconnect(struct p9_client *clnt); |
| 219 | void p9_client_begin_disconnect(struct p9_client *clnt); | 218 | void p9_client_begin_disconnect(struct p9_client *clnt); |
| 220 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, | 219 | struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afid, |
| 221 | char *uname, u32 n_uname, char *aname); | 220 | char *uname, u32 n_uname, char *aname); |
| 222 | struct p9_fid *p9_client_auth(struct p9_client *clnt, char *uname, | ||
| 223 | u32 n_uname, char *aname); | ||
| 224 | struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, | 221 | struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, |
| 225 | int clone); | 222 | int clone); |
| 226 | int p9_client_open(struct p9_fid *fid, int mode); | 223 | int p9_client_open(struct p9_fid *fid, int mode); |
| @@ -232,6 +229,7 @@ int p9_client_symlink(struct p9_fid *fid, char *name, char *symname, gid_t gid, | |||
| 232 | int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode, | 229 | int p9_client_create_dotl(struct p9_fid *ofid, char *name, u32 flags, u32 mode, |
| 233 | gid_t gid, struct p9_qid *qid); | 230 | gid_t gid, struct p9_qid *qid); |
| 234 | int p9_client_clunk(struct p9_fid *fid); | 231 | int p9_client_clunk(struct p9_fid *fid); |
| 232 | int p9_client_fsync(struct p9_fid *fid, int datasync); | ||
| 235 | int p9_client_remove(struct p9_fid *fid); | 233 | int p9_client_remove(struct p9_fid *fid); |
| 236 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, | 234 | int p9_client_read(struct p9_fid *fid, char *data, char __user *udata, |
| 237 | u64 offset, u32 count); | 235 | u64 offset, u32 count); |
| @@ -251,6 +249,8 @@ int p9_client_mknod_dotl(struct p9_fid *oldfid, char *name, int mode, | |||
| 251 | dev_t rdev, gid_t gid, struct p9_qid *); | 249 | dev_t rdev, gid_t gid, struct p9_qid *); |
| 252 | int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode, | 250 | int p9_client_mkdir_dotl(struct p9_fid *fid, char *name, int mode, |
| 253 | gid_t gid, struct p9_qid *); | 251 | gid_t gid, struct p9_qid *); |
| 252 | int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *status); | ||
| 253 | int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *fl); | ||
| 254 | struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); | 254 | struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); |
| 255 | void p9_client_cb(struct p9_client *c, struct p9_req_t *req); | 255 | void p9_client_cb(struct p9_client *c, struct p9_req_t *req); |
| 256 | 256 | ||
| @@ -262,5 +262,6 @@ int p9_is_proto_dotu(struct p9_client *clnt); | |||
| 262 | int p9_is_proto_dotl(struct p9_client *clnt); | 262 | int p9_is_proto_dotl(struct p9_client *clnt); |
| 263 | struct p9_fid *p9_client_xattrwalk(struct p9_fid *, const char *, u64 *); | 263 | struct p9_fid *p9_client_xattrwalk(struct p9_fid *, const char *, u64 *); |
| 264 | int p9_client_xattrcreate(struct p9_fid *, const char *, u64, int); | 264 | int p9_client_xattrcreate(struct p9_fid *, const char *, u64, int); |
| 265 | int p9_client_readlink(struct p9_fid *fid, char **target); | ||
| 265 | 266 | ||
| 266 | #endif /* NET_9P_CLIENT_H */ | 267 | #endif /* NET_9P_CLIENT_H */ |
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 45375b41a2a0..a9441249306c 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
| @@ -121,6 +121,7 @@ static inline int addrconf_finite_timeout(unsigned long timeout) | |||
| 121 | * IPv6 Address Label subsystem (addrlabel.c) | 121 | * IPv6 Address Label subsystem (addrlabel.c) |
| 122 | */ | 122 | */ |
| 123 | extern int ipv6_addr_label_init(void); | 123 | extern int ipv6_addr_label_init(void); |
| 124 | extern void ipv6_addr_label_cleanup(void); | ||
| 124 | extern void ipv6_addr_label_rtnl_register(void); | 125 | extern void ipv6_addr_label_rtnl_register(void); |
| 125 | extern u32 ipv6_addr_label(struct net *net, | 126 | extern u32 ipv6_addr_label(struct net *net, |
| 126 | const struct in6_addr *addr, | 127 | const struct in6_addr *addr, |
| @@ -174,20 +175,32 @@ extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, | |||
| 174 | extern int register_inet6addr_notifier(struct notifier_block *nb); | 175 | extern int register_inet6addr_notifier(struct notifier_block *nb); |
| 175 | extern int unregister_inet6addr_notifier(struct notifier_block *nb); | 176 | extern int unregister_inet6addr_notifier(struct notifier_block *nb); |
| 176 | 177 | ||
| 177 | static inline struct inet6_dev * | 178 | /** |
| 178 | __in6_dev_get(struct net_device *dev) | 179 | * __in6_dev_get - get inet6_dev pointer from netdevice |
| 180 | * @dev: network device | ||
| 181 | * | ||
| 182 | * Caller must hold rcu_read_lock or RTNL, because this function | ||
| 183 | * does not take a reference on the inet6_dev. | ||
| 184 | */ | ||
| 185 | static inline struct inet6_dev *__in6_dev_get(const struct net_device *dev) | ||
| 179 | { | 186 | { |
| 180 | return rcu_dereference_check(dev->ip6_ptr, | 187 | return rcu_dereference_rtnl(dev->ip6_ptr); |
| 181 | rcu_read_lock_held() || | ||
| 182 | lockdep_rtnl_is_held()); | ||
| 183 | } | 188 | } |
| 184 | 189 | ||
| 185 | static inline struct inet6_dev * | 190 | /** |
| 186 | in6_dev_get(struct net_device *dev) | 191 | * in6_dev_get - get inet6_dev pointer from netdevice |
| 192 | * @dev: network device | ||
| 193 | * | ||
| 194 | * This version can be used in any context, and takes a reference | ||
| 195 | * on the inet6_dev. Callers must use in6_dev_put() later to | ||
| 196 | * release this reference. | ||
| 197 | */ | ||
| 198 | static inline struct inet6_dev *in6_dev_get(const struct net_device *dev) | ||
| 187 | { | 199 | { |
| 188 | struct inet6_dev *idev = NULL; | 200 | struct inet6_dev *idev; |
| 201 | |||
| 189 | rcu_read_lock(); | 202 | rcu_read_lock(); |
| 190 | idev = __in6_dev_get(dev); | 203 | idev = rcu_dereference(dev->ip6_ptr); |
| 191 | if (idev) | 204 | if (idev) |
| 192 | atomic_inc(&idev->refcnt); | 205 | atomic_inc(&idev->refcnt); |
| 193 | rcu_read_unlock(); | 206 | rcu_read_unlock(); |
| @@ -196,16 +209,21 @@ in6_dev_get(struct net_device *dev) | |||
| 196 | 209 | ||
| 197 | extern void in6_dev_finish_destroy(struct inet6_dev *idev); | 210 | extern void in6_dev_finish_destroy(struct inet6_dev *idev); |
| 198 | 211 | ||
| 199 | static inline void | 212 | static inline void in6_dev_put(struct inet6_dev *idev) |
| 200 | in6_dev_put(struct inet6_dev *idev) | ||
| 201 | { | 213 | { |
| 202 | if (atomic_dec_and_test(&idev->refcnt)) | 214 | if (atomic_dec_and_test(&idev->refcnt)) |
| 203 | in6_dev_finish_destroy(idev); | 215 | in6_dev_finish_destroy(idev); |
| 204 | } | 216 | } |
| 205 | 217 | ||
| 206 | #define __in6_dev_put(idev) atomic_dec(&(idev)->refcnt) | 218 | static inline void __in6_dev_put(struct inet6_dev *idev) |
| 207 | #define in6_dev_hold(idev) atomic_inc(&(idev)->refcnt) | 219 | { |
| 220 | atomic_dec(&idev->refcnt); | ||
| 221 | } | ||
| 208 | 222 | ||
| 223 | static inline void in6_dev_hold(struct inet6_dev *idev) | ||
| 224 | { | ||
| 225 | atomic_inc(&idev->refcnt); | ||
| 226 | } | ||
| 209 | 227 | ||
| 210 | extern void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp); | 228 | extern void inet6_ifa_finish_destroy(struct inet6_ifaddr *ifp); |
| 211 | 229 | ||
| @@ -215,9 +233,15 @@ static inline void in6_ifa_put(struct inet6_ifaddr *ifp) | |||
| 215 | inet6_ifa_finish_destroy(ifp); | 233 | inet6_ifa_finish_destroy(ifp); |
| 216 | } | 234 | } |
| 217 | 235 | ||
| 218 | #define __in6_ifa_put(ifp) atomic_dec(&(ifp)->refcnt) | 236 | static inline void __in6_ifa_put(struct inet6_ifaddr *ifp) |
| 219 | #define in6_ifa_hold(ifp) atomic_inc(&(ifp)->refcnt) | 237 | { |
| 238 | atomic_dec(&ifp->refcnt); | ||
| 239 | } | ||
| 220 | 240 | ||
| 241 | static inline void in6_ifa_hold(struct inet6_ifaddr *ifp) | ||
| 242 | { | ||
| 243 | atomic_inc(&ifp->refcnt); | ||
| 244 | } | ||
| 221 | 245 | ||
| 222 | 246 | ||
| 223 | /* | 247 | /* |
| @@ -240,23 +264,21 @@ static inline int ipv6_addr_is_multicast(const struct in6_addr *addr) | |||
| 240 | 264 | ||
| 241 | static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) | 265 | static inline int ipv6_addr_is_ll_all_nodes(const struct in6_addr *addr) |
| 242 | { | 266 | { |
| 243 | return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | | 267 | return ((addr->s6_addr32[0] ^ htonl(0xff020000)) | |
| 244 | addr->s6_addr32[1] | addr->s6_addr32[2] | | 268 | addr->s6_addr32[1] | addr->s6_addr32[2] | |
| 245 | (addr->s6_addr32[3] ^ htonl(0x00000001))) == 0); | 269 | (addr->s6_addr32[3] ^ htonl(0x00000001))) == 0; |
| 246 | } | 270 | } |
| 247 | 271 | ||
| 248 | static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) | 272 | static inline int ipv6_addr_is_ll_all_routers(const struct in6_addr *addr) |
| 249 | { | 273 | { |
| 250 | return (((addr->s6_addr32[0] ^ htonl(0xff020000)) | | 274 | return ((addr->s6_addr32[0] ^ htonl(0xff020000)) | |
| 251 | addr->s6_addr32[1] | addr->s6_addr32[2] | | 275 | addr->s6_addr32[1] | addr->s6_addr32[2] | |
| 252 | (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0); | 276 | (addr->s6_addr32[3] ^ htonl(0x00000002))) == 0; |
| 253 | } | 277 | } |
| 254 | 278 | ||
| 255 | extern int __ipv6_isatap_ifid(u8 *eui, __be32 addr); | ||
| 256 | |||
| 257 | static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) | 279 | static inline int ipv6_addr_is_isatap(const struct in6_addr *addr) |
| 258 | { | 280 | { |
| 259 | return ((addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE)); | 281 | return (addr->s6_addr32[2] | htonl(0x02000000)) == htonl(0x02005EFE); |
| 260 | } | 282 | } |
| 261 | 283 | ||
| 262 | #ifdef CONFIG_PROC_FS | 284 | #ifdef CONFIG_PROC_FS |
diff --git a/include/net/arp.h b/include/net/arp.h index 716f43c5c98e..f4cf6ce66586 100644 --- a/include/net/arp.h +++ b/include/net/arp.h | |||
| @@ -26,6 +26,4 @@ extern struct sk_buff *arp_create(int type, int ptype, __be32 dest_ip, | |||
| 26 | const unsigned char *target_hw); | 26 | const unsigned char *target_hw); |
| 27 | extern void arp_xmit(struct sk_buff *skb); | 27 | extern void arp_xmit(struct sk_buff *skb); |
| 28 | 28 | ||
| 29 | extern const struct neigh_ops arp_broken_ops; | ||
| 30 | |||
| 31 | #endif /* _ARP_H */ | 29 | #endif /* _ARP_H */ |
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h index 27a902d9b3a9..d81ea7997701 100644 --- a/include/net/bluetooth/bluetooth.h +++ b/include/net/bluetooth/bluetooth.h | |||
| @@ -126,6 +126,8 @@ int bt_sock_unregister(int proto); | |||
| 126 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); | 126 | void bt_sock_link(struct bt_sock_list *l, struct sock *s); |
| 127 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); | 127 | void bt_sock_unlink(struct bt_sock_list *l, struct sock *s); |
| 128 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags); | 128 | int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags); |
| 129 | int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | ||
| 130 | struct msghdr *msg, size_t len, int flags); | ||
| 129 | uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); | 131 | uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait); |
| 130 | int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); | 132 | int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
| 131 | int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); | 133 | int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); |
| @@ -161,12 +163,30 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk, unsigned long l | |||
| 161 | { | 163 | { |
| 162 | struct sk_buff *skb; | 164 | struct sk_buff *skb; |
| 163 | 165 | ||
| 166 | release_sock(sk); | ||
| 164 | if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { | 167 | if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) { |
| 165 | skb_reserve(skb, BT_SKB_RESERVE); | 168 | skb_reserve(skb, BT_SKB_RESERVE); |
| 166 | bt_cb(skb)->incoming = 0; | 169 | bt_cb(skb)->incoming = 0; |
| 167 | } | 170 | } |
| 171 | lock_sock(sk); | ||
| 172 | |||
| 173 | if (!skb && *err) | ||
| 174 | return NULL; | ||
| 175 | |||
| 176 | *err = sock_error(sk); | ||
| 177 | if (*err) | ||
| 178 | goto out; | ||
| 179 | |||
| 180 | if (sk->sk_shutdown) { | ||
| 181 | *err = -ECONNRESET; | ||
| 182 | goto out; | ||
| 183 | } | ||
| 168 | 184 | ||
| 169 | return skb; | 185 | return skb; |
| 186 | |||
| 187 | out: | ||
| 188 | kfree_skb(skb); | ||
| 189 | return NULL; | ||
| 170 | } | 190 | } |
| 171 | 191 | ||
| 172 | int bt_err(__u16 code); | 192 | int bt_err(__u16 code); |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index bcbdd6d4e6dd..e30e00834340 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
| @@ -54,7 +54,7 @@ | |||
| 54 | 54 | ||
| 55 | /* HCI controller types */ | 55 | /* HCI controller types */ |
| 56 | #define HCI_BREDR 0x00 | 56 | #define HCI_BREDR 0x00 |
| 57 | #define HCI_80211 0x01 | 57 | #define HCI_AMP 0x01 |
| 58 | 58 | ||
| 59 | /* HCI device quirks */ | 59 | /* HCI device quirks */ |
| 60 | enum { | 60 | enum { |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 4568b938ca35..ebec8c9a929d 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -233,7 +233,7 @@ static inline void inquiry_cache_init(struct hci_dev *hdev) | |||
| 233 | static inline int inquiry_cache_empty(struct hci_dev *hdev) | 233 | static inline int inquiry_cache_empty(struct hci_dev *hdev) |
| 234 | { | 234 | { |
| 235 | struct inquiry_cache *c = &hdev->inq_cache; | 235 | struct inquiry_cache *c = &hdev->inq_cache; |
| 236 | return (c->list == NULL); | 236 | return c->list == NULL; |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | static inline long inquiry_cache_age(struct hci_dev *hdev) | 239 | static inline long inquiry_cache_age(struct hci_dev *hdev) |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 6c241444f902..c819c8bf9b68 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
| @@ -414,7 +414,7 @@ static inline int l2cap_tx_window_full(struct sock *sk) | |||
| 414 | if (sub < 0) | 414 | if (sub < 0) |
| 415 | sub += 64; | 415 | sub += 64; |
| 416 | 416 | ||
| 417 | return (sub == pi->remote_tx_win); | 417 | return sub == pi->remote_tx_win; |
| 418 | } | 418 | } |
| 419 | 419 | ||
| 420 | #define __get_txseq(ctrl) ((ctrl) & L2CAP_CTRL_TXSEQ) >> 1 | 420 | #define __get_txseq(ctrl) ((ctrl) & L2CAP_CTRL_TXSEQ) >> 1 |
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h index a140847d622c..71047bc0af84 100644 --- a/include/net/bluetooth/rfcomm.h +++ b/include/net/bluetooth/rfcomm.h | |||
| @@ -213,11 +213,6 @@ struct rfcomm_dlc { | |||
| 213 | #define RFCOMM_DEFER_SETUP 8 | 213 | #define RFCOMM_DEFER_SETUP 8 |
| 214 | 214 | ||
| 215 | /* Scheduling flags and events */ | 215 | /* Scheduling flags and events */ |
| 216 | #define RFCOMM_SCHED_STATE 0 | ||
| 217 | #define RFCOMM_SCHED_RX 1 | ||
| 218 | #define RFCOMM_SCHED_TX 2 | ||
| 219 | #define RFCOMM_SCHED_TIMEO 3 | ||
| 220 | #define RFCOMM_SCHED_AUTH 4 | ||
| 221 | #define RFCOMM_SCHED_WAKEUP 31 | 216 | #define RFCOMM_SCHED_WAKEUP 31 |
| 222 | 217 | ||
| 223 | /* MSC exchange flags */ | 218 | /* MSC exchange flags */ |
diff --git a/include/net/caif/caif_shm.h b/include/net/caif/caif_shm.h new file mode 100644 index 000000000000..5bcce55438cf --- /dev/null +++ b/include/net/caif/caif_shm.h | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) ST-Ericsson AB 2010 | ||
| 3 | * Contact: Sjur Brendeland / sjur.brandeland@stericsson.com | ||
| 4 | * Author: Amarnath Revanna / amarnath.bangalore.revanna@stericsson.com | ||
| 5 | * License terms: GNU General Public License (GPL) version 2 | ||
| 6 | */ | ||
| 7 | |||
| 8 | #ifndef CAIF_SHM_H_ | ||
| 9 | #define CAIF_SHM_H_ | ||
| 10 | |||
| 11 | struct shmdev_layer { | ||
| 12 | u32 shm_base_addr; | ||
| 13 | u32 shm_total_sz; | ||
| 14 | u32 shm_id; | ||
| 15 | u32 shm_loopback; | ||
| 16 | void *hmbx; | ||
| 17 | int (*pshmdev_mbxsend) (u32 shm_id, u32 mbx_msg); | ||
| 18 | int (*pshmdev_mbxsetup) (void *pshmdrv_cb, | ||
| 19 | struct shmdev_layer *pshm_dev, void *pshm_drv); | ||
| 20 | struct net_device *pshm_netdev; | ||
| 21 | }; | ||
| 22 | |||
| 23 | extern int caif_shmcore_probe(struct shmdev_layer *pshm_dev); | ||
| 24 | extern void caif_shmcore_remove(struct net_device *pshm_netdev); | ||
| 25 | |||
| 26 | #endif | ||
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 2fd06c60ffbb..2a7936d7851d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
| @@ -25,6 +25,43 @@ | |||
| 25 | #include <linux/wireless.h> | 25 | #include <linux/wireless.h> |
| 26 | 26 | ||
| 27 | 27 | ||
| 28 | /** | ||
| 29 | * DOC: Introduction | ||
| 30 | * | ||
| 31 | * cfg80211 is the configuration API for 802.11 devices in Linux. It bridges | ||
| 32 | * userspace and drivers, and offers some utility functionality associated | ||
| 33 | * with 802.11. cfg80211 must, directly or indirectly via mac80211, be used | ||
| 34 | * by all modern wireless drivers in Linux, so that they offer a consistent | ||
| 35 | * API through nl80211. For backward compatibility, cfg80211 also offers | ||
| 36 | * wireless extensions to userspace, but hides them from drivers completely. | ||
| 37 | * | ||
| 38 | * Additionally, cfg80211 contains code to help enforce regulatory spectrum | ||
| 39 | * use restrictions. | ||
| 40 | */ | ||
| 41 | |||
| 42 | |||
| 43 | /** | ||
| 44 | * DOC: Device registration | ||
| 45 | * | ||
| 46 | * In order for a driver to use cfg80211, it must register the hardware device | ||
| 47 | * with cfg80211. This happens through a number of hardware capability structs | ||
| 48 | * described below. | ||
| 49 | * | ||
| 50 | * The fundamental structure for each device is the 'wiphy', of which each | ||
| 51 | * instance describes a physical wireless device connected to the system. Each | ||
| 52 | * such wiphy can have zero, one, or many virtual interfaces associated with | ||
| 53 | * it, which need to be identified as such by pointing the network interface's | ||
| 54 | * @ieee80211_ptr pointer to a &struct wireless_dev which further describes | ||
| 55 | * the wireless part of the interface, normally this struct is embedded in the | ||
| 56 | * network interface's private data area. Drivers can optionally allow creating | ||
| 57 | * or destroying virtual interfaces on the fly, but without at least one or the | ||
| 58 | * ability to create some the wireless device isn't useful. | ||
| 59 | * | ||
| 60 | * Each wiphy structure contains device capability information, and also has | ||
| 61 | * a pointer to the various operations the driver offers. The definitions and | ||
| 62 | * structures here describe these capabilities in detail. | ||
| 63 | */ | ||
| 64 | |||
| 28 | /* | 65 | /* |
| 29 | * wireless hardware capability structures | 66 | * wireless hardware capability structures |
| 30 | */ | 67 | */ |
| @@ -205,6 +242,21 @@ struct ieee80211_supported_band { | |||
| 205 | */ | 242 | */ |
| 206 | 243 | ||
| 207 | /** | 244 | /** |
| 245 | * DOC: Actions and configuration | ||
| 246 | * | ||
| 247 | * Each wireless device and each virtual interface offer a set of configuration | ||
| 248 | * operations and other actions that are invoked by userspace. Each of these | ||
| 249 | * actions is described in the operations structure, and the parameters these | ||
| 250 | * operations use are described separately. | ||
| 251 | * | ||
| 252 | * Additionally, some operations are asynchronous and expect to get status | ||
| 253 | * information via some functions that drivers need to call. | ||
| 254 | * | ||
| 255 | * Scanning and BSS list handling with its associated functionality is described | ||
| 256 | * in a separate chapter. | ||
| 257 | */ | ||
| 258 | |||
| 259 | /** | ||
| 208 | * struct vif_params - describes virtual interface parameters | 260 | * struct vif_params - describes virtual interface parameters |
| 209 | * @mesh_id: mesh ID to use | 261 | * @mesh_id: mesh ID to use |
| 210 | * @mesh_id_len: length of the mesh ID | 262 | * @mesh_id_len: length of the mesh ID |
| @@ -241,12 +293,24 @@ struct key_params { | |||
| 241 | * enum survey_info_flags - survey information flags | 293 | * enum survey_info_flags - survey information flags |
| 242 | * | 294 | * |
| 243 | * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in | 295 | * @SURVEY_INFO_NOISE_DBM: noise (in dBm) was filled in |
| 296 | * @SURVEY_INFO_IN_USE: channel is currently being used | ||
| 297 | * @SURVEY_INFO_CHANNEL_TIME: channel active time (in ms) was filled in | ||
| 298 | * @SURVEY_INFO_CHANNEL_TIME_BUSY: channel busy time was filled in | ||
| 299 | * @SURVEY_INFO_CHANNEL_TIME_EXT_BUSY: extension channel busy time was filled in | ||
| 300 | * @SURVEY_INFO_CHANNEL_TIME_RX: channel receive time was filled in | ||
| 301 | * @SURVEY_INFO_CHANNEL_TIME_TX: channel transmit time was filled in | ||
| 244 | * | 302 | * |
| 245 | * Used by the driver to indicate which info in &struct survey_info | 303 | * Used by the driver to indicate which info in &struct survey_info |
| 246 | * it has filled in during the get_survey(). | 304 | * it has filled in during the get_survey(). |
| 247 | */ | 305 | */ |
| 248 | enum survey_info_flags { | 306 | enum survey_info_flags { |
| 249 | SURVEY_INFO_NOISE_DBM = 1<<0, | 307 | SURVEY_INFO_NOISE_DBM = 1<<0, |
| 308 | SURVEY_INFO_IN_USE = 1<<1, | ||
| 309 | SURVEY_INFO_CHANNEL_TIME = 1<<2, | ||
| 310 | SURVEY_INFO_CHANNEL_TIME_BUSY = 1<<3, | ||
| 311 | SURVEY_INFO_CHANNEL_TIME_EXT_BUSY = 1<<4, | ||
| 312 | SURVEY_INFO_CHANNEL_TIME_RX = 1<<5, | ||
| 313 | SURVEY_INFO_CHANNEL_TIME_TX = 1<<6, | ||
| 250 | }; | 314 | }; |
| 251 | 315 | ||
| 252 | /** | 316 | /** |
| @@ -256,6 +320,11 @@ enum survey_info_flags { | |||
| 256 | * @filled: bitflag of flags from &enum survey_info_flags | 320 | * @filled: bitflag of flags from &enum survey_info_flags |
| 257 | * @noise: channel noise in dBm. This and all following fields are | 321 | * @noise: channel noise in dBm. This and all following fields are |
| 258 | * optional | 322 | * optional |
| 323 | * @channel_time: amount of time in ms the radio spent on the channel | ||
| 324 | * @channel_time_busy: amount of time the primary channel was sensed busy | ||
| 325 | * @channel_time_ext_busy: amount of time the extension channel was sensed busy | ||
| 326 | * @channel_time_rx: amount of time the radio spent receiving data | ||
| 327 | * @channel_time_tx: amount of time the radio spent transmitting data | ||
| 259 | * | 328 | * |
| 260 | * Used by dump_survey() to report back per-channel survey information. | 329 | * Used by dump_survey() to report back per-channel survey information. |
| 261 | * | 330 | * |
| @@ -264,6 +333,11 @@ enum survey_info_flags { | |||
| 264 | */ | 333 | */ |
| 265 | struct survey_info { | 334 | struct survey_info { |
| 266 | struct ieee80211_channel *channel; | 335 | struct ieee80211_channel *channel; |
| 336 | u64 channel_time; | ||
| 337 | u64 channel_time_busy; | ||
| 338 | u64 channel_time_ext_busy; | ||
| 339 | u64 channel_time_rx; | ||
| 340 | u64 channel_time_tx; | ||
| 267 | u32 filled; | 341 | u32 filled; |
| 268 | s8 noise; | 342 | s8 noise; |
| 269 | }; | 343 | }; |
| @@ -347,6 +421,9 @@ struct station_parameters { | |||
| 347 | * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) | 421 | * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) |
| 348 | * @STATION_INFO_RX_PACKETS: @rx_packets filled | 422 | * @STATION_INFO_RX_PACKETS: @rx_packets filled |
| 349 | * @STATION_INFO_TX_PACKETS: @tx_packets filled | 423 | * @STATION_INFO_TX_PACKETS: @tx_packets filled |
| 424 | * @STATION_INFO_TX_RETRIES: @tx_retries filled | ||
| 425 | * @STATION_INFO_TX_FAILED: @tx_failed filled | ||
| 426 | * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled | ||
| 350 | */ | 427 | */ |
| 351 | enum station_info_flags { | 428 | enum station_info_flags { |
| 352 | STATION_INFO_INACTIVE_TIME = 1<<0, | 429 | STATION_INFO_INACTIVE_TIME = 1<<0, |
| @@ -359,6 +436,9 @@ enum station_info_flags { | |||
| 359 | STATION_INFO_TX_BITRATE = 1<<7, | 436 | STATION_INFO_TX_BITRATE = 1<<7, |
| 360 | STATION_INFO_RX_PACKETS = 1<<8, | 437 | STATION_INFO_RX_PACKETS = 1<<8, |
| 361 | STATION_INFO_TX_PACKETS = 1<<9, | 438 | STATION_INFO_TX_PACKETS = 1<<9, |
| 439 | STATION_INFO_TX_RETRIES = 1<<10, | ||
| 440 | STATION_INFO_TX_FAILED = 1<<11, | ||
| 441 | STATION_INFO_RX_DROP_MISC = 1<<12, | ||
| 362 | }; | 442 | }; |
| 363 | 443 | ||
| 364 | /** | 444 | /** |
| @@ -408,6 +488,9 @@ struct rate_info { | |||
| 408 | * @txrate: current unicast bitrate to this station | 488 | * @txrate: current unicast bitrate to this station |
| 409 | * @rx_packets: packets received from this station | 489 | * @rx_packets: packets received from this station |
| 410 | * @tx_packets: packets transmitted to this station | 490 | * @tx_packets: packets transmitted to this station |
| 491 | * @tx_retries: cumulative retry counts | ||
| 492 | * @tx_failed: number of failed transmissions (retries exceeded, no ACK) | ||
| 493 | * @rx_dropped_misc: Dropped for un-specified reason. | ||
| 411 | * @generation: generation number for nl80211 dumps. | 494 | * @generation: generation number for nl80211 dumps. |
| 412 | * This number should increase every time the list of stations | 495 | * This number should increase every time the list of stations |
| 413 | * changes, i.e. when a station is added or removed, so that | 496 | * changes, i.e. when a station is added or removed, so that |
| @@ -425,6 +508,9 @@ struct station_info { | |||
| 425 | struct rate_info txrate; | 508 | struct rate_info txrate; |
| 426 | u32 rx_packets; | 509 | u32 rx_packets; |
| 427 | u32 tx_packets; | 510 | u32 tx_packets; |
| 511 | u32 tx_retries; | ||
| 512 | u32 tx_failed; | ||
| 513 | u32 rx_dropped_misc; | ||
| 428 | 514 | ||
| 429 | int generation; | 515 | int generation; |
| 430 | }; | 516 | }; |
| @@ -570,8 +656,28 @@ struct ieee80211_txq_params { | |||
| 570 | /* from net/wireless.h */ | 656 | /* from net/wireless.h */ |
| 571 | struct wiphy; | 657 | struct wiphy; |
| 572 | 658 | ||
| 573 | /* from net/ieee80211.h */ | 659 | /** |
| 574 | struct ieee80211_channel; | 660 | * DOC: Scanning and BSS list handling |
| 661 | * | ||
| 662 | * The scanning process itself is fairly simple, but cfg80211 offers quite | ||
| 663 | * a bit of helper functionality. To start a scan, the scan operation will | ||
| 664 | * be invoked with a scan definition. This scan definition contains the | ||
| 665 | * channels to scan, and the SSIDs to send probe requests for (including the | ||
| 666 | * wildcard, if desired). A passive scan is indicated by having no SSIDs to | ||
| 667 | * probe. Additionally, a scan request may contain extra information elements | ||
| 668 | * that should be added to the probe request. The IEs are guaranteed to be | ||
| 669 | * well-formed, and will not exceed the maximum length the driver advertised | ||
| 670 | * in the wiphy structure. | ||
| 671 | * | ||
| 672 | * When scanning finds a BSS, cfg80211 needs to be notified of that, because | ||
| 673 | * it is responsible for maintaining the BSS list; the driver should not | ||
| 674 | * maintain a list itself. For this notification, various functions exist. | ||
| 675 | * | ||
| 676 | * Since drivers do not maintain a BSS list, there are also a number of | ||
| 677 | * functions to search for a BSS and obtain information about it from the | ||
| 678 | * BSS structure cfg80211 maintains. The BSS list is also made available | ||
| 679 | * to userspace. | ||
| 680 | */ | ||
| 575 | 681 | ||
| 576 | /** | 682 | /** |
| 577 | * struct cfg80211_ssid - SSID description | 683 | * struct cfg80211_ssid - SSID description |
| @@ -691,6 +797,10 @@ const u8 *ieee80211_bss_get_ie(struct cfg80211_bss *bss, u8 ie); | |||
| 691 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is | 797 | * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is |
| 692 | * required to assume that the port is unauthorized until authorized by | 798 | * required to assume that the port is unauthorized until authorized by |
| 693 | * user space. Otherwise, port is marked authorized by default. | 799 | * user space. Otherwise, port is marked authorized by default. |
| 800 | * @control_port_ethertype: the control port protocol that should be | ||
| 801 | * allowed through even on unauthorized ports | ||
| 802 | * @control_port_no_encrypt: TRUE to prevent encryption of control port | ||
| 803 | * protocol frames. | ||
| 694 | */ | 804 | */ |
| 695 | struct cfg80211_crypto_settings { | 805 | struct cfg80211_crypto_settings { |
| 696 | u32 wpa_versions; | 806 | u32 wpa_versions; |
| @@ -700,6 +810,8 @@ struct cfg80211_crypto_settings { | |||
| 700 | int n_akm_suites; | 810 | int n_akm_suites; |
| 701 | u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; | 811 | u32 akm_suites[NL80211_MAX_NR_AKM_SUITES]; |
| 702 | bool control_port; | 812 | bool control_port; |
| 813 | __be16 control_port_ethertype; | ||
| 814 | bool control_port_no_encrypt; | ||
| 703 | }; | 815 | }; |
| 704 | 816 | ||
| 705 | /** | 817 | /** |
| @@ -1020,7 +1132,7 @@ struct cfg80211_pmksa { | |||
| 1020 | * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. | 1132 | * @cancel_remain_on_channel: Cancel an on-going remain-on-channel operation. |
| 1021 | * This allows the operation to be terminated prior to timeout based on | 1133 | * This allows the operation to be terminated prior to timeout based on |
| 1022 | * the duration value. | 1134 | * the duration value. |
| 1023 | * @action: Transmit an action frame | 1135 | * @mgmt_tx: Transmit a management frame |
| 1024 | * | 1136 | * |
| 1025 | * @testmode_cmd: run a test mode command | 1137 | * @testmode_cmd: run a test mode command |
| 1026 | * | 1138 | * |
| @@ -1035,6 +1147,9 @@ struct cfg80211_pmksa { | |||
| 1035 | * allows the driver to adjust the dynamic ps timeout value. | 1147 | * allows the driver to adjust the dynamic ps timeout value. |
| 1036 | * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. | 1148 | * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. |
| 1037 | * | 1149 | * |
| 1150 | * @mgmt_frame_register: Notify driver that a management frame type was | ||
| 1151 | * registered. Note that this callback may not sleep, and cannot run | ||
| 1152 | * concurrently with itself. | ||
| 1038 | */ | 1153 | */ |
| 1039 | struct cfg80211_ops { | 1154 | struct cfg80211_ops { |
| 1040 | int (*suspend)(struct wiphy *wiphy); | 1155 | int (*suspend)(struct wiphy *wiphy); |
| @@ -1050,13 +1165,14 @@ struct cfg80211_ops { | |||
| 1050 | struct vif_params *params); | 1165 | struct vif_params *params); |
| 1051 | 1166 | ||
| 1052 | int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, | 1167 | int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, |
| 1053 | u8 key_index, const u8 *mac_addr, | 1168 | u8 key_index, bool pairwise, const u8 *mac_addr, |
| 1054 | struct key_params *params); | 1169 | struct key_params *params); |
| 1055 | int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, | 1170 | int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, |
| 1056 | u8 key_index, const u8 *mac_addr, void *cookie, | 1171 | u8 key_index, bool pairwise, const u8 *mac_addr, |
| 1172 | void *cookie, | ||
| 1057 | void (*callback)(void *cookie, struct key_params*)); | 1173 | void (*callback)(void *cookie, struct key_params*)); |
| 1058 | int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, | 1174 | int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, |
| 1059 | u8 key_index, const u8 *mac_addr); | 1175 | u8 key_index, bool pairwise, const u8 *mac_addr); |
| 1060 | int (*set_default_key)(struct wiphy *wiphy, | 1176 | int (*set_default_key)(struct wiphy *wiphy, |
| 1061 | struct net_device *netdev, | 1177 | struct net_device *netdev, |
| 1062 | u8 key_index); | 1178 | u8 key_index); |
| @@ -1140,7 +1256,7 @@ struct cfg80211_ops { | |||
| 1140 | int (*get_tx_power)(struct wiphy *wiphy, int *dbm); | 1256 | int (*get_tx_power)(struct wiphy *wiphy, int *dbm); |
| 1141 | 1257 | ||
| 1142 | int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, | 1258 | int (*set_wds_peer)(struct wiphy *wiphy, struct net_device *dev, |
| 1143 | u8 *addr); | 1259 | const u8 *addr); |
| 1144 | 1260 | ||
| 1145 | void (*rfkill_poll)(struct wiphy *wiphy); | 1261 | void (*rfkill_poll)(struct wiphy *wiphy); |
| 1146 | 1262 | ||
| @@ -1172,7 +1288,7 @@ struct cfg80211_ops { | |||
| 1172 | struct net_device *dev, | 1288 | struct net_device *dev, |
| 1173 | u64 cookie); | 1289 | u64 cookie); |
| 1174 | 1290 | ||
| 1175 | int (*action)(struct wiphy *wiphy, struct net_device *dev, | 1291 | int (*mgmt_tx)(struct wiphy *wiphy, struct net_device *dev, |
| 1176 | struct ieee80211_channel *chan, | 1292 | struct ieee80211_channel *chan, |
| 1177 | enum nl80211_channel_type channel_type, | 1293 | enum nl80211_channel_type channel_type, |
| 1178 | bool channel_type_valid, | 1294 | bool channel_type_valid, |
| @@ -1184,6 +1300,10 @@ struct cfg80211_ops { | |||
| 1184 | int (*set_cqm_rssi_config)(struct wiphy *wiphy, | 1300 | int (*set_cqm_rssi_config)(struct wiphy *wiphy, |
| 1185 | struct net_device *dev, | 1301 | struct net_device *dev, |
| 1186 | s32 rssi_thold, u32 rssi_hyst); | 1302 | s32 rssi_thold, u32 rssi_hyst); |
| 1303 | |||
| 1304 | void (*mgmt_frame_register)(struct wiphy *wiphy, | ||
| 1305 | struct net_device *dev, | ||
| 1306 | u16 frame_type, bool reg); | ||
| 1187 | }; | 1307 | }; |
| 1188 | 1308 | ||
| 1189 | /* | 1309 | /* |
| @@ -1221,21 +1341,31 @@ struct cfg80211_ops { | |||
| 1221 | * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station | 1341 | * @WIPHY_FLAG_4ADDR_AP: supports 4addr mode even on AP (with a single station |
| 1222 | * on a VLAN interface) | 1342 | * on a VLAN interface) |
| 1223 | * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station | 1343 | * @WIPHY_FLAG_4ADDR_STATION: supports 4addr mode even as a station |
| 1344 | * @WIPHY_FLAG_CONTROL_PORT_PROTOCOL: This device supports setting the | ||
| 1345 | * control port protocol ethertype. The device also honours the | ||
| 1346 | * control_port_no_encrypt flag. | ||
| 1347 | * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. | ||
| 1224 | */ | 1348 | */ |
| 1225 | enum wiphy_flags { | 1349 | enum wiphy_flags { |
| 1226 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), | 1350 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), |
| 1227 | WIPHY_FLAG_STRICT_REGULATORY = BIT(1), | 1351 | WIPHY_FLAG_STRICT_REGULATORY = BIT(1), |
| 1228 | WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), | 1352 | WIPHY_FLAG_DISABLE_BEACON_HINTS = BIT(2), |
| 1229 | WIPHY_FLAG_NETNS_OK = BIT(3), | 1353 | WIPHY_FLAG_NETNS_OK = BIT(3), |
| 1230 | WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), | 1354 | WIPHY_FLAG_PS_ON_BY_DEFAULT = BIT(4), |
| 1231 | WIPHY_FLAG_4ADDR_AP = BIT(5), | 1355 | WIPHY_FLAG_4ADDR_AP = BIT(5), |
| 1232 | WIPHY_FLAG_4ADDR_STATION = BIT(6), | 1356 | WIPHY_FLAG_4ADDR_STATION = BIT(6), |
| 1357 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), | ||
| 1358 | WIPHY_FLAG_IBSS_RSN = BIT(7), | ||
| 1233 | }; | 1359 | }; |
| 1234 | 1360 | ||
| 1235 | struct mac_address { | 1361 | struct mac_address { |
| 1236 | u8 addr[ETH_ALEN]; | 1362 | u8 addr[ETH_ALEN]; |
| 1237 | }; | 1363 | }; |
| 1238 | 1364 | ||
| 1365 | struct ieee80211_txrx_stypes { | ||
| 1366 | u16 tx, rx; | ||
| 1367 | }; | ||
| 1368 | |||
| 1239 | /** | 1369 | /** |
| 1240 | * struct wiphy - wireless hardware description | 1370 | * struct wiphy - wireless hardware description |
| 1241 | * @reg_notifier: the driver's regulatory notification callback | 1371 | * @reg_notifier: the driver's regulatory notification callback |
| @@ -1286,6 +1416,10 @@ struct mac_address { | |||
| 1286 | * @privid: a pointer that drivers can use to identify if an arbitrary | 1416 | * @privid: a pointer that drivers can use to identify if an arbitrary |
| 1287 | * wiphy is theirs, e.g. in global notifiers | 1417 | * wiphy is theirs, e.g. in global notifiers |
| 1288 | * @bands: information about bands/channels supported by this device | 1418 | * @bands: information about bands/channels supported by this device |
| 1419 | * | ||
| 1420 | * @mgmt_stypes: bitmasks of frame subtypes that can be subscribed to or | ||
| 1421 | * transmitted through nl80211, points to an array indexed by interface | ||
| 1422 | * type | ||
| 1289 | */ | 1423 | */ |
| 1290 | struct wiphy { | 1424 | struct wiphy { |
| 1291 | /* assign these fields before you register the wiphy */ | 1425 | /* assign these fields before you register the wiphy */ |
| @@ -1294,9 +1428,12 @@ struct wiphy { | |||
| 1294 | u8 perm_addr[ETH_ALEN]; | 1428 | u8 perm_addr[ETH_ALEN]; |
| 1295 | u8 addr_mask[ETH_ALEN]; | 1429 | u8 addr_mask[ETH_ALEN]; |
| 1296 | 1430 | ||
| 1297 | u16 n_addresses; | ||
| 1298 | struct mac_address *addresses; | 1431 | struct mac_address *addresses; |
| 1299 | 1432 | ||
| 1433 | const struct ieee80211_txrx_stypes *mgmt_stypes; | ||
| 1434 | |||
| 1435 | u16 n_addresses; | ||
| 1436 | |||
| 1300 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ | 1437 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ |
| 1301 | u16 interface_modes; | 1438 | u16 interface_modes; |
| 1302 | 1439 | ||
| @@ -1492,8 +1629,8 @@ struct cfg80211_cached_keys; | |||
| 1492 | * set by driver (if supported) on add_interface BEFORE registering the | 1629 | * set by driver (if supported) on add_interface BEFORE registering the |
| 1493 | * netdev and may otherwise be used by driver read-only, will be update | 1630 | * netdev and may otherwise be used by driver read-only, will be update |
| 1494 | * by cfg80211 on change_interface | 1631 | * by cfg80211 on change_interface |
| 1495 | * @action_registrations: list of registrations for action frames | 1632 | * @mgmt_registrations: list of registrations for management frames |
| 1496 | * @action_registrations_lock: lock for the list | 1633 | * @mgmt_registrations_lock: lock for the list |
| 1497 | * @mtx: mutex used to lock data in this struct | 1634 | * @mtx: mutex used to lock data in this struct |
| 1498 | * @cleanup_work: work struct used for cleanup that can't be done directly | 1635 | * @cleanup_work: work struct used for cleanup that can't be done directly |
| 1499 | */ | 1636 | */ |
| @@ -1505,8 +1642,8 @@ struct wireless_dev { | |||
| 1505 | struct list_head list; | 1642 | struct list_head list; |
| 1506 | struct net_device *netdev; | 1643 | struct net_device *netdev; |
| 1507 | 1644 | ||
| 1508 | struct list_head action_registrations; | 1645 | struct list_head mgmt_registrations; |
| 1509 | spinlock_t action_registrations_lock; | 1646 | spinlock_t mgmt_registrations_lock; |
| 1510 | 1647 | ||
| 1511 | struct mutex mtx; | 1648 | struct mutex mtx; |
| 1512 | 1649 | ||
| @@ -1563,8 +1700,10 @@ static inline void *wdev_priv(struct wireless_dev *wdev) | |||
| 1563 | return wiphy_priv(wdev->wiphy); | 1700 | return wiphy_priv(wdev->wiphy); |
| 1564 | } | 1701 | } |
| 1565 | 1702 | ||
| 1566 | /* | 1703 | /** |
| 1567 | * Utility functions | 1704 | * DOC: Utility functions |
| 1705 | * | ||
| 1706 | * cfg80211 offers a number of utility functions that can be useful. | ||
| 1568 | */ | 1707 | */ |
| 1569 | 1708 | ||
| 1570 | /** | 1709 | /** |
| @@ -1715,7 +1854,15 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); | |||
| 1715 | * ieee80211_hdrlen - get header length in bytes from frame control | 1854 | * ieee80211_hdrlen - get header length in bytes from frame control |
| 1716 | * @fc: frame control field in little-endian format | 1855 | * @fc: frame control field in little-endian format |
| 1717 | */ | 1856 | */ |
| 1718 | unsigned int ieee80211_hdrlen(__le16 fc); | 1857 | unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc); |
| 1858 | |||
| 1859 | /** | ||
| 1860 | * DOC: Data path helpers | ||
| 1861 | * | ||
| 1862 | * In addition to generic utilities, cfg80211 also offers | ||
| 1863 | * functions that help implement the data path for devices | ||
| 1864 | * that do not do the 802.11/802.3 conversion on the device. | ||
| 1865 | */ | ||
| 1719 | 1866 | ||
| 1720 | /** | 1867 | /** |
| 1721 | * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 | 1868 | * ieee80211_data_to_8023 - convert an 802.11 data frame to 802.3 |
| @@ -1777,8 +1924,10 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb); | |||
| 1777 | */ | 1924 | */ |
| 1778 | const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); | 1925 | const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len); |
| 1779 | 1926 | ||
| 1780 | /* | 1927 | /** |
| 1781 | * Regulatory helper functions for wiphys | 1928 | * DOC: Regulatory enforcement infrastructure |
| 1929 | * | ||
| 1930 | * TODO | ||
| 1782 | */ | 1931 | */ |
| 1783 | 1932 | ||
| 1784 | /** | 1933 | /** |
| @@ -2181,6 +2330,20 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, | |||
| 2181 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); | 2330 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); |
| 2182 | 2331 | ||
| 2183 | /** | 2332 | /** |
| 2333 | * DOC: RFkill integration | ||
| 2334 | * | ||
| 2335 | * RFkill integration in cfg80211 is almost invisible to drivers, | ||
| 2336 | * as cfg80211 automatically registers an rfkill instance for each | ||
| 2337 | * wireless device it knows about. Soft kill is also translated | ||
| 2338 | * into disconnecting and turning all interfaces off, drivers are | ||
| 2339 | * expected to turn off the device when all interfaces are down. | ||
| 2340 | * | ||
| 2341 | * However, devices may have a hard RFkill line, in which case they | ||
| 2342 | * also need to interact with the rfkill subsystem, via cfg80211. | ||
| 2343 | * They can do this with a few helper functions documented here. | ||
| 2344 | */ | ||
| 2345 | |||
| 2346 | /** | ||
| 2184 | * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state | 2347 | * wiphy_rfkill_set_hw_state - notify cfg80211 about hw block state |
| 2185 | * @wiphy: the wiphy | 2348 | * @wiphy: the wiphy |
| 2186 | * @blocked: block status | 2349 | * @blocked: block status |
| @@ -2201,6 +2364,17 @@ void wiphy_rfkill_stop_polling(struct wiphy *wiphy); | |||
| 2201 | 2364 | ||
| 2202 | #ifdef CONFIG_NL80211_TESTMODE | 2365 | #ifdef CONFIG_NL80211_TESTMODE |
| 2203 | /** | 2366 | /** |
| 2367 | * DOC: Test mode | ||
| 2368 | * | ||
| 2369 | * Test mode is a set of utility functions to allow drivers to | ||
| 2370 | * interact with driver-specific tools to aid, for instance, | ||
| 2371 | * factory programming. | ||
| 2372 | * | ||
| 2373 | * This chapter describes how drivers interact with it, for more | ||
| 2374 | * information see the nl80211 book's chapter on it. | ||
| 2375 | */ | ||
| 2376 | |||
| 2377 | /** | ||
| 2204 | * cfg80211_testmode_alloc_reply_skb - allocate testmode reply | 2378 | * cfg80211_testmode_alloc_reply_skb - allocate testmode reply |
| 2205 | * @wiphy: the wiphy | 2379 | * @wiphy: the wiphy |
| 2206 | * @approxlen: an upper bound of the length of the data that will | 2380 | * @approxlen: an upper bound of the length of the data that will |
| @@ -2373,38 +2547,39 @@ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, | |||
| 2373 | struct station_info *sinfo, gfp_t gfp); | 2547 | struct station_info *sinfo, gfp_t gfp); |
| 2374 | 2548 | ||
| 2375 | /** | 2549 | /** |
| 2376 | * cfg80211_rx_action - notification of received, unprocessed Action frame | 2550 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame |
| 2377 | * @dev: network device | 2551 | * @dev: network device |
| 2378 | * @freq: Frequency on which the frame was received in MHz | 2552 | * @freq: Frequency on which the frame was received in MHz |
| 2379 | * @buf: Action frame (header + body) | 2553 | * @buf: Management frame (header + body) |
| 2380 | * @len: length of the frame data | 2554 | * @len: length of the frame data |
| 2381 | * @gfp: context flags | 2555 | * @gfp: context flags |
| 2382 | * Returns %true if a user space application is responsible for rejecting the | 2556 | * |
| 2383 | * unrecognized Action frame; %false if no such application is registered | 2557 | * Returns %true if a user space application has registered for this frame. |
| 2384 | * (i.e., the driver is responsible for rejecting the unrecognized Action | 2558 | * For action frames, that makes it responsible for rejecting unrecognized |
| 2385 | * frame) | 2559 | * action frames; %false otherwise, in which case for action frames the |
| 2560 | * driver is responsible for rejecting the frame. | ||
| 2386 | * | 2561 | * |
| 2387 | * This function is called whenever an Action frame is received for a station | 2562 | * This function is called whenever an Action frame is received for a station |
| 2388 | * mode interface, but is not processed in kernel. | 2563 | * mode interface, but is not processed in kernel. |
| 2389 | */ | 2564 | */ |
| 2390 | bool cfg80211_rx_action(struct net_device *dev, int freq, const u8 *buf, | 2565 | bool cfg80211_rx_mgmt(struct net_device *dev, int freq, const u8 *buf, |
| 2391 | size_t len, gfp_t gfp); | 2566 | size_t len, gfp_t gfp); |
| 2392 | 2567 | ||
| 2393 | /** | 2568 | /** |
| 2394 | * cfg80211_action_tx_status - notification of TX status for Action frame | 2569 | * cfg80211_mgmt_tx_status - notification of TX status for management frame |
| 2395 | * @dev: network device | 2570 | * @dev: network device |
| 2396 | * @cookie: Cookie returned by cfg80211_ops::action() | 2571 | * @cookie: Cookie returned by cfg80211_ops::mgmt_tx() |
| 2397 | * @buf: Action frame (header + body) | 2572 | * @buf: Management frame (header + body) |
| 2398 | * @len: length of the frame data | 2573 | * @len: length of the frame data |
| 2399 | * @ack: Whether frame was acknowledged | 2574 | * @ack: Whether frame was acknowledged |
| 2400 | * @gfp: context flags | 2575 | * @gfp: context flags |
| 2401 | * | 2576 | * |
| 2402 | * This function is called whenever an Action frame was requested to be | 2577 | * This function is called whenever a management frame was requested to be |
| 2403 | * transmitted with cfg80211_ops::action() to report the TX status of the | 2578 | * transmitted with cfg80211_ops::mgmt_tx() to report the TX status of the |
| 2404 | * transmission attempt. | 2579 | * transmission attempt. |
| 2405 | */ | 2580 | */ |
| 2406 | void cfg80211_action_tx_status(struct net_device *dev, u64 cookie, | 2581 | void cfg80211_mgmt_tx_status(struct net_device *dev, u64 cookie, |
| 2407 | const u8 *buf, size_t len, bool ack, gfp_t gfp); | 2582 | const u8 *buf, size_t len, bool ack, gfp_t gfp); |
| 2408 | 2583 | ||
| 2409 | 2584 | ||
| 2410 | /** | 2585 | /** |
| @@ -2420,56 +2595,41 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, | |||
| 2420 | enum nl80211_cqm_rssi_threshold_event rssi_event, | 2595 | enum nl80211_cqm_rssi_threshold_event rssi_event, |
| 2421 | gfp_t gfp); | 2596 | gfp_t gfp); |
| 2422 | 2597 | ||
| 2423 | #ifdef __KERNEL__ | ||
| 2424 | |||
| 2425 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | 2598 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ |
| 2426 | 2599 | ||
| 2427 | /* wiphy_printk helpers, similar to dev_printk */ | 2600 | /* wiphy_printk helpers, similar to dev_printk */ |
| 2428 | 2601 | ||
| 2429 | #define wiphy_printk(level, wiphy, format, args...) \ | 2602 | #define wiphy_printk(level, wiphy, format, args...) \ |
| 2430 | printk(level "%s: " format, wiphy_name(wiphy), ##args) | 2603 | dev_printk(level, &(wiphy)->dev, format, ##args) |
| 2431 | #define wiphy_emerg(wiphy, format, args...) \ | 2604 | #define wiphy_emerg(wiphy, format, args...) \ |
| 2432 | wiphy_printk(KERN_EMERG, wiphy, format, ##args) | 2605 | dev_emerg(&(wiphy)->dev, format, ##args) |
| 2433 | #define wiphy_alert(wiphy, format, args...) \ | 2606 | #define wiphy_alert(wiphy, format, args...) \ |
| 2434 | wiphy_printk(KERN_ALERT, wiphy, format, ##args) | 2607 | dev_alert(&(wiphy)->dev, format, ##args) |
| 2435 | #define wiphy_crit(wiphy, format, args...) \ | 2608 | #define wiphy_crit(wiphy, format, args...) \ |
| 2436 | wiphy_printk(KERN_CRIT, wiphy, format, ##args) | 2609 | dev_crit(&(wiphy)->dev, format, ##args) |
| 2437 | #define wiphy_err(wiphy, format, args...) \ | 2610 | #define wiphy_err(wiphy, format, args...) \ |
| 2438 | wiphy_printk(KERN_ERR, wiphy, format, ##args) | 2611 | dev_err(&(wiphy)->dev, format, ##args) |
| 2439 | #define wiphy_warn(wiphy, format, args...) \ | 2612 | #define wiphy_warn(wiphy, format, args...) \ |
| 2440 | wiphy_printk(KERN_WARNING, wiphy, format, ##args) | 2613 | dev_warn(&(wiphy)->dev, format, ##args) |
| 2441 | #define wiphy_notice(wiphy, format, args...) \ | 2614 | #define wiphy_notice(wiphy, format, args...) \ |
| 2442 | wiphy_printk(KERN_NOTICE, wiphy, format, ##args) | 2615 | dev_notice(&(wiphy)->dev, format, ##args) |
| 2443 | #define wiphy_info(wiphy, format, args...) \ | 2616 | #define wiphy_info(wiphy, format, args...) \ |
| 2444 | wiphy_printk(KERN_INFO, wiphy, format, ##args) | 2617 | dev_info(&(wiphy)->dev, format, ##args) |
| 2445 | 2618 | ||
| 2446 | int wiphy_debug(const struct wiphy *wiphy, const char *format, ...) | 2619 | #define wiphy_debug(wiphy, format, args...) \ |
| 2447 | __attribute__ ((format (printf, 2, 3))); | ||
| 2448 | |||
| 2449 | #if defined(DEBUG) | ||
| 2450 | #define wiphy_dbg(wiphy, format, args...) \ | ||
| 2451 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args) | 2620 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args) |
| 2452 | #elif defined(CONFIG_DYNAMIC_DEBUG) | 2621 | |
| 2453 | #define wiphy_dbg(wiphy, format, args...) \ | 2622 | #define wiphy_dbg(wiphy, format, args...) \ |
| 2454 | dynamic_pr_debug("%s: " format, wiphy_name(wiphy), ##args) | 2623 | dev_dbg(&(wiphy)->dev, format, ##args) |
| 2455 | #else | ||
| 2456 | #define wiphy_dbg(wiphy, format, args...) \ | ||
| 2457 | ({ \ | ||
| 2458 | if (0) \ | ||
| 2459 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ | ||
| 2460 | 0; \ | ||
| 2461 | }) | ||
| 2462 | #endif | ||
| 2463 | 2624 | ||
| 2464 | #if defined(VERBOSE_DEBUG) | 2625 | #if defined(VERBOSE_DEBUG) |
| 2465 | #define wiphy_vdbg wiphy_dbg | 2626 | #define wiphy_vdbg wiphy_dbg |
| 2466 | #else | 2627 | #else |
| 2467 | |||
| 2468 | #define wiphy_vdbg(wiphy, format, args...) \ | 2628 | #define wiphy_vdbg(wiphy, format, args...) \ |
| 2469 | ({ \ | 2629 | ({ \ |
| 2470 | if (0) \ | 2630 | if (0) \ |
| 2471 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ | 2631 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ |
| 2472 | 0; \ | 2632 | 0; \ |
| 2473 | }) | 2633 | }) |
| 2474 | #endif | 2634 | #endif |
| 2475 | 2635 | ||
| @@ -2481,6 +2641,4 @@ int wiphy_debug(const struct wiphy *wiphy, const char *format, ...) | |||
| 2481 | #define wiphy_WARN(wiphy, format, args...) \ | 2641 | #define wiphy_WARN(wiphy, format, args...) \ |
| 2482 | WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); | 2642 | WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); |
| 2483 | 2643 | ||
| 2484 | #endif | ||
| 2485 | |||
| 2486 | #endif /* __NET_CFG80211_H */ | 2644 | #endif /* __NET_CFG80211_H */ |
diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h index 726cc3536409..a4dc5b027bd9 100644 --- a/include/net/cls_cgroup.h +++ b/include/net/cls_cgroup.h | |||
| @@ -27,11 +27,17 @@ struct cgroup_cls_state | |||
| 27 | #ifdef CONFIG_NET_CLS_CGROUP | 27 | #ifdef CONFIG_NET_CLS_CGROUP |
| 28 | static inline u32 task_cls_classid(struct task_struct *p) | 28 | static inline u32 task_cls_classid(struct task_struct *p) |
| 29 | { | 29 | { |
| 30 | int classid; | ||
| 31 | |||
| 30 | if (in_interrupt()) | 32 | if (in_interrupt()) |
| 31 | return 0; | 33 | return 0; |
| 32 | 34 | ||
| 33 | return container_of(task_subsys_state(p, net_cls_subsys_id), | 35 | rcu_read_lock(); |
| 34 | struct cgroup_cls_state, css)->classid; | 36 | classid = container_of(task_subsys_state(p, net_cls_subsys_id), |
| 37 | struct cgroup_cls_state, css)->classid; | ||
| 38 | rcu_read_unlock(); | ||
| 39 | |||
| 40 | return classid; | ||
| 35 | } | 41 | } |
| 36 | #else | 42 | #else |
| 37 | extern int net_cls_subsys_id; | 43 | extern int net_cls_subsys_id; |
| @@ -45,7 +51,8 @@ static inline u32 task_cls_classid(struct task_struct *p) | |||
| 45 | return 0; | 51 | return 0; |
| 46 | 52 | ||
| 47 | rcu_read_lock(); | 53 | rcu_read_lock(); |
| 48 | id = rcu_dereference(net_cls_subsys_id); | 54 | id = rcu_dereference_index_check(net_cls_subsys_id, |
| 55 | rcu_read_lock_held()); | ||
| 49 | if (id >= 0) | 56 | if (id >= 0) |
| 50 | classid = container_of(task_subsys_state(p, id), | 57 | classid = container_of(task_subsys_state(p, id), |
| 51 | struct cgroup_cls_state, css)->classid; | 58 | struct cgroup_cls_state, css)->classid; |
diff --git a/include/net/dst.h b/include/net/dst.h index 81d1413a8701..ffe9cb719c0e 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
| @@ -43,10 +43,11 @@ struct dst_entry { | |||
| 43 | short error; | 43 | short error; |
| 44 | short obsolete; | 44 | short obsolete; |
| 45 | int flags; | 45 | int flags; |
| 46 | #define DST_HOST 1 | 46 | #define DST_HOST 0x0001 |
| 47 | #define DST_NOXFRM 2 | 47 | #define DST_NOXFRM 0x0002 |
| 48 | #define DST_NOPOLICY 4 | 48 | #define DST_NOPOLICY 0x0004 |
| 49 | #define DST_NOHASH 8 | 49 | #define DST_NOHASH 0x0008 |
| 50 | #define DST_NOCACHE 0x0010 | ||
| 50 | unsigned long expires; | 51 | unsigned long expires; |
| 51 | 52 | ||
| 52 | unsigned short header_len; /* more space at head required */ | 53 | unsigned short header_len; /* more space at head required */ |
| @@ -94,7 +95,7 @@ struct dst_entry { | |||
| 94 | unsigned long lastuse; | 95 | unsigned long lastuse; |
| 95 | union { | 96 | union { |
| 96 | struct dst_entry *next; | 97 | struct dst_entry *next; |
| 97 | struct rtable *rt_next; | 98 | struct rtable __rcu *rt_next; |
| 98 | struct rt6_info *rt6_next; | 99 | struct rt6_info *rt6_next; |
| 99 | struct dn_route *dn_next; | 100 | struct dn_route *dn_next; |
| 100 | }; | 101 | }; |
| @@ -228,22 +229,37 @@ static inline void skb_dst_force(struct sk_buff *skb) | |||
| 228 | 229 | ||
| 229 | 230 | ||
| 230 | /** | 231 | /** |
| 232 | * __skb_tunnel_rx - prepare skb for rx reinsert | ||
| 233 | * @skb: buffer | ||
| 234 | * @dev: tunnel device | ||
| 235 | * | ||
| 236 | * After decapsulation, packet is going to re-enter (netif_rx()) our stack, | ||
| 237 | * so make some cleanups. (no accounting done) | ||
| 238 | */ | ||
| 239 | static inline void __skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev) | ||
| 240 | { | ||
| 241 | skb->dev = dev; | ||
| 242 | skb->rxhash = 0; | ||
| 243 | skb_set_queue_mapping(skb, 0); | ||
| 244 | skb_dst_drop(skb); | ||
| 245 | nf_reset(skb); | ||
| 246 | } | ||
| 247 | |||
| 248 | /** | ||
| 231 | * skb_tunnel_rx - prepare skb for rx reinsert | 249 | * skb_tunnel_rx - prepare skb for rx reinsert |
| 232 | * @skb: buffer | 250 | * @skb: buffer |
| 233 | * @dev: tunnel device | 251 | * @dev: tunnel device |
| 234 | * | 252 | * |
| 235 | * After decapsulation, packet is going to re-enter (netif_rx()) our stack, | 253 | * After decapsulation, packet is going to re-enter (netif_rx()) our stack, |
| 236 | * so make some cleanups, and perform accounting. | 254 | * so make some cleanups, and perform accounting. |
| 255 | * Note: this accounting is not SMP safe. | ||
| 237 | */ | 256 | */ |
| 238 | static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev) | 257 | static inline void skb_tunnel_rx(struct sk_buff *skb, struct net_device *dev) |
| 239 | { | 258 | { |
| 240 | skb->dev = dev; | ||
| 241 | /* TODO : stats should be SMP safe */ | 259 | /* TODO : stats should be SMP safe */ |
| 242 | dev->stats.rx_packets++; | 260 | dev->stats.rx_packets++; |
| 243 | dev->stats.rx_bytes += skb->len; | 261 | dev->stats.rx_bytes += skb->len; |
| 244 | skb->rxhash = 0; | 262 | __skb_tunnel_rx(skb, dev); |
| 245 | skb_dst_drop(skb); | ||
| 246 | nf_reset(skb); | ||
| 247 | } | 263 | } |
| 248 | 264 | ||
| 249 | /* Children define the path of the packet through the | 265 | /* Children define the path of the packet through the |
diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h index d1ff9b7e99b8..1fa5306e3e23 100644 --- a/include/net/dst_ops.h +++ b/include/net/dst_ops.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | #ifndef _NET_DST_OPS_H | 1 | #ifndef _NET_DST_OPS_H |
| 2 | #define _NET_DST_OPS_H | 2 | #define _NET_DST_OPS_H |
| 3 | #include <linux/types.h> | 3 | #include <linux/types.h> |
| 4 | #include <linux/percpu_counter.h> | ||
| 4 | 5 | ||
| 5 | struct dst_entry; | 6 | struct dst_entry; |
| 6 | struct kmem_cachep; | 7 | struct kmem_cachep; |
| @@ -22,7 +23,41 @@ struct dst_ops { | |||
| 22 | void (*update_pmtu)(struct dst_entry *dst, u32 mtu); | 23 | void (*update_pmtu)(struct dst_entry *dst, u32 mtu); |
| 23 | int (*local_out)(struct sk_buff *skb); | 24 | int (*local_out)(struct sk_buff *skb); |
| 24 | 25 | ||
| 25 | atomic_t entries; | ||
| 26 | struct kmem_cache *kmem_cachep; | 26 | struct kmem_cache *kmem_cachep; |
| 27 | |||
| 28 | struct percpu_counter pcpuc_entries ____cacheline_aligned_in_smp; | ||
| 27 | }; | 29 | }; |
| 30 | |||
| 31 | static inline int dst_entries_get_fast(struct dst_ops *dst) | ||
| 32 | { | ||
| 33 | return percpu_counter_read_positive(&dst->pcpuc_entries); | ||
| 34 | } | ||
| 35 | |||
| 36 | static inline int dst_entries_get_slow(struct dst_ops *dst) | ||
| 37 | { | ||
| 38 | int res; | ||
| 39 | |||
| 40 | local_bh_disable(); | ||
| 41 | res = percpu_counter_sum_positive(&dst->pcpuc_entries); | ||
| 42 | local_bh_enable(); | ||
| 43 | return res; | ||
| 44 | } | ||
| 45 | |||
| 46 | static inline void dst_entries_add(struct dst_ops *dst, int val) | ||
| 47 | { | ||
| 48 | local_bh_disable(); | ||
| 49 | percpu_counter_add(&dst->pcpuc_entries, val); | ||
| 50 | local_bh_enable(); | ||
| 51 | } | ||
| 52 | |||
| 53 | static inline int dst_entries_init(struct dst_ops *dst) | ||
| 54 | { | ||
| 55 | return percpu_counter_init(&dst->pcpuc_entries, 0); | ||
| 56 | } | ||
| 57 | |||
| 58 | static inline void dst_entries_destroy(struct dst_ops *dst) | ||
| 59 | { | ||
| 60 | percpu_counter_destroy(&dst->pcpuc_entries); | ||
| 61 | } | ||
| 62 | |||
| 28 | #endif | 63 | #endif |
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index e8923bc20f9f..075f1e3a0fed 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h | |||
| @@ -20,7 +20,7 @@ struct fib_rule { | |||
| 20 | u32 table; | 20 | u32 table; |
| 21 | u8 action; | 21 | u8 action; |
| 22 | u32 target; | 22 | u32 target; |
| 23 | struct fib_rule * ctarget; | 23 | struct fib_rule __rcu *ctarget; |
| 24 | char iifname[IFNAMSIZ]; | 24 | char iifname[IFNAMSIZ]; |
| 25 | char oifname[IFNAMSIZ]; | 25 | char oifname[IFNAMSIZ]; |
| 26 | struct rcu_head rcu; | 26 | struct rcu_head rcu; |
| @@ -31,6 +31,8 @@ struct fib_lookup_arg { | |||
| 31 | void *lookup_ptr; | 31 | void *lookup_ptr; |
| 32 | void *result; | 32 | void *result; |
| 33 | struct fib_rule *rule; | 33 | struct fib_rule *rule; |
| 34 | int flags; | ||
| 35 | #define FIB_LOOKUP_NOREF 1 | ||
| 34 | }; | 36 | }; |
| 35 | 37 | ||
| 36 | struct fib_rules_ops { | 38 | struct fib_rules_ops { |
| @@ -106,7 +108,6 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla) | |||
| 106 | 108 | ||
| 107 | extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *); | 109 | extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *); |
| 108 | extern void fib_rules_unregister(struct fib_rules_ops *); | 110 | extern void fib_rules_unregister(struct fib_rules_ops *); |
| 109 | extern void fib_rules_cleanup_ops(struct fib_rules_ops *); | ||
| 110 | 111 | ||
| 111 | extern int fib_rules_lookup(struct fib_rules_ops *, | 112 | extern int fib_rules_lookup(struct fib_rules_ops *, |
| 112 | struct flowi *, int flags, | 113 | struct flowi *, int flags, |
diff --git a/include/net/flow.h b/include/net/flow.h index bb08692a20b0..0ac3fb5e0973 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
| @@ -49,6 +49,7 @@ struct flowi { | |||
| 49 | __u8 proto; | 49 | __u8 proto; |
| 50 | __u8 flags; | 50 | __u8 flags; |
| 51 | #define FLOWI_FLAG_ANYSRC 0x01 | 51 | #define FLOWI_FLAG_ANYSRC 0x01 |
| 52 | #define FLOWI_FLAG_MATCH_ANY_IIF 0x02 | ||
| 52 | union { | 53 | union { |
| 53 | struct { | 54 | struct { |
| 54 | __be16 sport; | 55 | __be16 sport; |
diff --git a/include/net/garp.h b/include/net/garp.h index 825f172caba9..f4c295984c45 100644 --- a/include/net/garp.h +++ b/include/net/garp.h | |||
| @@ -107,7 +107,7 @@ struct garp_applicant { | |||
| 107 | }; | 107 | }; |
| 108 | 108 | ||
| 109 | struct garp_port { | 109 | struct garp_port { |
| 110 | struct garp_applicant *applicants[GARP_APPLICATION_MAX + 1]; | 110 | struct garp_applicant __rcu *applicants[GARP_APPLICATION_MAX + 1]; |
| 111 | }; | 111 | }; |
| 112 | 112 | ||
| 113 | extern int garp_register_application(struct garp_application *app); | 113 | extern int garp_register_application(struct garp_application *app); |
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index f7dcd2c70412..8a64b811a39a 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
| @@ -20,6 +20,9 @@ struct genl_multicast_group { | |||
| 20 | u32 id; | 20 | u32 id; |
| 21 | }; | 21 | }; |
| 22 | 22 | ||
| 23 | struct genl_ops; | ||
| 24 | struct genl_info; | ||
| 25 | |||
| 23 | /** | 26 | /** |
| 24 | * struct genl_family - generic netlink family | 27 | * struct genl_family - generic netlink family |
| 25 | * @id: protocol family idenfitier | 28 | * @id: protocol family idenfitier |
| @@ -29,6 +32,10 @@ struct genl_multicast_group { | |||
| 29 | * @maxattr: maximum number of attributes supported | 32 | * @maxattr: maximum number of attributes supported |
| 30 | * @netnsok: set to true if the family can handle network | 33 | * @netnsok: set to true if the family can handle network |
| 31 | * namespaces and should be presented in all of them | 34 | * namespaces and should be presented in all of them |
| 35 | * @pre_doit: called before an operation's doit callback, it may | ||
| 36 | * do additional, common, filtering and return an error | ||
| 37 | * @post_doit: called after an operation's doit callback, it may | ||
| 38 | * undo operations done by pre_doit, for example release locks | ||
| 32 | * @attrbuf: buffer to store parsed attributes | 39 | * @attrbuf: buffer to store parsed attributes |
| 33 | * @ops_list: list of all assigned operations | 40 | * @ops_list: list of all assigned operations |
| 34 | * @family_list: family list | 41 | * @family_list: family list |
| @@ -41,6 +48,12 @@ struct genl_family { | |||
| 41 | unsigned int version; | 48 | unsigned int version; |
| 42 | unsigned int maxattr; | 49 | unsigned int maxattr; |
| 43 | bool netnsok; | 50 | bool netnsok; |
| 51 | int (*pre_doit)(struct genl_ops *ops, | ||
| 52 | struct sk_buff *skb, | ||
| 53 | struct genl_info *info); | ||
| 54 | void (*post_doit)(struct genl_ops *ops, | ||
| 55 | struct sk_buff *skb, | ||
| 56 | struct genl_info *info); | ||
| 44 | struct nlattr ** attrbuf; /* private */ | 57 | struct nlattr ** attrbuf; /* private */ |
| 45 | struct list_head ops_list; /* private */ | 58 | struct list_head ops_list; /* private */ |
| 46 | struct list_head family_list; /* private */ | 59 | struct list_head family_list; /* private */ |
| @@ -55,6 +68,8 @@ struct genl_family { | |||
| 55 | * @genlhdr: generic netlink message header | 68 | * @genlhdr: generic netlink message header |
| 56 | * @userhdr: user specific header | 69 | * @userhdr: user specific header |
| 57 | * @attrs: netlink attributes | 70 | * @attrs: netlink attributes |
| 71 | * @_net: network namespace | ||
| 72 | * @user_ptr: user pointers | ||
| 58 | */ | 73 | */ |
| 59 | struct genl_info { | 74 | struct genl_info { |
| 60 | u32 snd_seq; | 75 | u32 snd_seq; |
| @@ -66,6 +81,7 @@ struct genl_info { | |||
| 66 | #ifdef CONFIG_NET_NS | 81 | #ifdef CONFIG_NET_NS |
| 67 | struct net * _net; | 82 | struct net * _net; |
| 68 | #endif | 83 | #endif |
| 84 | void * user_ptr[2]; | ||
| 69 | }; | 85 | }; |
| 70 | 86 | ||
| 71 | static inline struct net *genl_info_net(struct genl_info *info) | 87 | static inline struct net *genl_info_net(struct genl_info *info) |
| @@ -81,6 +97,7 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net) | |||
| 81 | /** | 97 | /** |
| 82 | * struct genl_ops - generic netlink operations | 98 | * struct genl_ops - generic netlink operations |
| 83 | * @cmd: command identifier | 99 | * @cmd: command identifier |
| 100 | * @internal_flags: flags used by the family | ||
| 84 | * @flags: flags | 101 | * @flags: flags |
| 85 | * @policy: attribute validation policy | 102 | * @policy: attribute validation policy |
| 86 | * @doit: standard command callback | 103 | * @doit: standard command callback |
| @@ -90,6 +107,7 @@ static inline void genl_info_net_set(struct genl_info *info, struct net *net) | |||
| 90 | */ | 107 | */ |
| 91 | struct genl_ops { | 108 | struct genl_ops { |
| 92 | u8 cmd; | 109 | u8 cmd; |
| 110 | u8 internal_flags; | ||
| 93 | unsigned int flags; | 111 | unsigned int flags; |
| 94 | const struct nla_policy *policy; | 112 | const struct nla_policy *policy; |
| 95 | int (*doit)(struct sk_buff *skb, | 113 | int (*doit)(struct sk_buff *skb, |
diff --git a/include/net/gre.h b/include/net/gre.h new file mode 100644 index 000000000000..82665474bcb7 --- /dev/null +++ b/include/net/gre.h | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | #ifndef __LINUX_GRE_H | ||
| 2 | #define __LINUX_GRE_H | ||
| 3 | |||
| 4 | #include <linux/skbuff.h> | ||
| 5 | |||
| 6 | #define GREPROTO_CISCO 0 | ||
| 7 | #define GREPROTO_PPTP 1 | ||
| 8 | #define GREPROTO_MAX 2 | ||
| 9 | |||
| 10 | struct gre_protocol { | ||
| 11 | int (*handler)(struct sk_buff *skb); | ||
| 12 | void (*err_handler)(struct sk_buff *skb, u32 info); | ||
| 13 | }; | ||
| 14 | |||
| 15 | int gre_add_protocol(const struct gre_protocol *proto, u8 version); | ||
| 16 | int gre_del_protocol(const struct gre_protocol *proto, u8 version); | ||
| 17 | |||
| 18 | #endif | ||
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index b6d3b55da19b..e4f494b42e06 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
| @@ -125,6 +125,7 @@ struct inet_connection_sock { | |||
| 125 | int probe_size; | 125 | int probe_size; |
| 126 | } icsk_mtup; | 126 | } icsk_mtup; |
| 127 | u32 icsk_ca_priv[16]; | 127 | u32 icsk_ca_priv[16]; |
| 128 | u32 icsk_user_timeout; | ||
| 128 | #define ICSK_CA_PRIV_SIZE (16 * sizeof(u32)) | 129 | #define ICSK_CA_PRIV_SIZE (16 * sizeof(u32)) |
| 129 | }; | 130 | }; |
| 130 | 131 | ||
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index 9b5d08f4f6e8..88bdd010d65d 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h | |||
| @@ -27,7 +27,7 @@ static inline int INET_ECN_is_not_ect(__u8 dsfield) | |||
| 27 | 27 | ||
| 28 | static inline int INET_ECN_is_capable(__u8 dsfield) | 28 | static inline int INET_ECN_is_capable(__u8 dsfield) |
| 29 | { | 29 | { |
| 30 | return (dsfield & INET_ECN_ECT_0); | 30 | return dsfield & INET_ECN_ECT_0; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner) | 33 | static inline __u8 INET_ECN_encapsulate(__u8 outer, __u8 inner) |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 74358d1b3f43..e9c2ed8af864 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
| @@ -245,7 +245,7 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk) | |||
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | /* Caller must disable local BH processing. */ | 247 | /* Caller must disable local BH processing. */ |
| 248 | extern void __inet_inherit_port(struct sock *sk, struct sock *child); | 248 | extern int __inet_inherit_port(struct sock *sk, struct sock *child); |
| 249 | 249 | ||
| 250 | extern void inet_put_port(struct sock *sk); | 250 | extern void inet_put_port(struct sock *sk); |
| 251 | 251 | ||
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 417d0c894f29..fe239bfe5f7f 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | struct inet_peer { | 16 | struct inet_peer { |
| 17 | /* group together avl_left,avl_right,v4daddr to speedup lookups */ | 17 | /* group together avl_left,avl_right,v4daddr to speedup lookups */ |
| 18 | struct inet_peer *avl_left, *avl_right; | 18 | struct inet_peer __rcu *avl_left, *avl_right; |
| 19 | __be32 v4daddr; /* peer's address */ | 19 | __be32 v4daddr; /* peer's address */ |
| 20 | __u32 avl_height; | 20 | __u32 avl_height; |
| 21 | struct list_head unused; | 21 | struct list_head unused; |
diff --git a/include/net/ip.h b/include/net/ip.h index 890f9725d681..86e2b182a0c0 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
| @@ -53,13 +53,13 @@ struct ipcm_cookie { | |||
| 53 | __be32 addr; | 53 | __be32 addr; |
| 54 | int oif; | 54 | int oif; |
| 55 | struct ip_options *opt; | 55 | struct ip_options *opt; |
| 56 | union skb_shared_tx shtx; | 56 | __u8 tx_flags; |
| 57 | }; | 57 | }; |
| 58 | 58 | ||
| 59 | #define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) | 59 | #define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) |
| 60 | 60 | ||
| 61 | struct ip_ra_chain { | 61 | struct ip_ra_chain { |
| 62 | struct ip_ra_chain *next; | 62 | struct ip_ra_chain __rcu *next; |
| 63 | struct sock *sk; | 63 | struct sock *sk; |
| 64 | union { | 64 | union { |
| 65 | void (*destructor)(struct sock *); | 65 | void (*destructor)(struct sock *); |
| @@ -68,7 +68,7 @@ struct ip_ra_chain { | |||
| 68 | struct rcu_head rcu; | 68 | struct rcu_head rcu; |
| 69 | }; | 69 | }; |
| 70 | 70 | ||
| 71 | extern struct ip_ra_chain *ip_ra_chain; | 71 | extern struct ip_ra_chain __rcu *ip_ra_chain; |
| 72 | 72 | ||
| 73 | /* IP flags. */ | 73 | /* IP flags. */ |
| 74 | #define IP_CE 0x8000 /* Flag: "Congestion" */ | 74 | #define IP_CE 0x8000 /* Flag: "Congestion" */ |
| @@ -238,9 +238,9 @@ int ip_decrease_ttl(struct iphdr *iph) | |||
| 238 | static inline | 238 | static inline |
| 239 | int ip_dont_fragment(struct sock *sk, struct dst_entry *dst) | 239 | int ip_dont_fragment(struct sock *sk, struct dst_entry *dst) |
| 240 | { | 240 | { |
| 241 | return (inet_sk(sk)->pmtudisc == IP_PMTUDISC_DO || | 241 | return inet_sk(sk)->pmtudisc == IP_PMTUDISC_DO || |
| 242 | (inet_sk(sk)->pmtudisc == IP_PMTUDISC_WANT && | 242 | (inet_sk(sk)->pmtudisc == IP_PMTUDISC_WANT && |
| 243 | !(dst_metric_locked(dst, RTAX_MTU)))); | 243 | !(dst_metric_locked(dst, RTAX_MTU))); |
| 244 | } | 244 | } |
| 245 | 245 | ||
| 246 | extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); | 246 | extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); |
diff --git a/include/net/ip6_tunnel.h b/include/net/ip6_tunnel.h index fc94ec568a50..fc73e667b50e 100644 --- a/include/net/ip6_tunnel.h +++ b/include/net/ip6_tunnel.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | /* IPv6 tunnel */ | 13 | /* IPv6 tunnel */ |
| 14 | 14 | ||
| 15 | struct ip6_tnl { | 15 | struct ip6_tnl { |
| 16 | struct ip6_tnl *next; /* next tunnel in list */ | 16 | struct ip6_tnl __rcu *next; /* next tunnel in list */ |
| 17 | struct net_device *dev; /* virtual device associated with tunnel */ | 17 | struct net_device *dev; /* virtual device associated with tunnel */ |
| 18 | struct ip6_tnl_parm parms; /* tunnel configuration parameters */ | 18 | struct ip6_tnl_parm parms; /* tunnel configuration parameters */ |
| 19 | struct flowi fl; /* flowi template for xmit */ | 19 | struct flowi fl; /* flowi template for xmit */ |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index c93f94edc610..07bdb5e9e8ac 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
| @@ -86,6 +86,7 @@ struct fib_info { | |||
| 86 | #ifdef CONFIG_IP_ROUTE_MULTIPATH | 86 | #ifdef CONFIG_IP_ROUTE_MULTIPATH |
| 87 | int fib_power; | 87 | int fib_power; |
| 88 | #endif | 88 | #endif |
| 89 | struct rcu_head rcu; | ||
| 89 | struct fib_nh fib_nh[0]; | 90 | struct fib_nh fib_nh[0]; |
| 90 | #define fib_dev fib_nh[0].nh_dev | 91 | #define fib_dev fib_nh[0].nh_dev |
| 91 | }; | 92 | }; |
| @@ -148,7 +149,7 @@ struct fib_table { | |||
| 148 | }; | 149 | }; |
| 149 | 150 | ||
| 150 | extern int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, | 151 | extern int fib_table_lookup(struct fib_table *tb, const struct flowi *flp, |
| 151 | struct fib_result *res); | 152 | struct fib_result *res, int fib_flags); |
| 152 | extern int fib_table_insert(struct fib_table *, struct fib_config *); | 153 | extern int fib_table_insert(struct fib_table *, struct fib_config *); |
| 153 | extern int fib_table_delete(struct fib_table *, struct fib_config *); | 154 | extern int fib_table_delete(struct fib_table *, struct fib_config *); |
| 154 | extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb, | 155 | extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb, |
| @@ -157,6 +158,8 @@ extern int fib_table_flush(struct fib_table *table); | |||
| 157 | extern void fib_table_select_default(struct fib_table *table, | 158 | extern void fib_table_select_default(struct fib_table *table, |
| 158 | const struct flowi *flp, | 159 | const struct flowi *flp, |
| 159 | struct fib_result *res); | 160 | struct fib_result *res); |
| 161 | extern void fib_free_table(struct fib_table *tb); | ||
| 162 | |||
| 160 | 163 | ||
| 161 | 164 | ||
| 162 | #ifndef CONFIG_IP_MULTIPLE_TABLES | 165 | #ifndef CONFIG_IP_MULTIPLE_TABLES |
| @@ -185,11 +188,11 @@ static inline int fib_lookup(struct net *net, const struct flowi *flp, | |||
| 185 | struct fib_table *table; | 188 | struct fib_table *table; |
| 186 | 189 | ||
| 187 | table = fib_get_table(net, RT_TABLE_LOCAL); | 190 | table = fib_get_table(net, RT_TABLE_LOCAL); |
| 188 | if (!fib_table_lookup(table, flp, res)) | 191 | if (!fib_table_lookup(table, flp, res, FIB_LOOKUP_NOREF)) |
| 189 | return 0; | 192 | return 0; |
| 190 | 193 | ||
| 191 | table = fib_get_table(net, RT_TABLE_MAIN); | 194 | table = fib_get_table(net, RT_TABLE_MAIN); |
| 192 | if (!fib_table_lookup(table, flp, res)) | 195 | if (!fib_table_lookup(table, flp, res, FIB_LOOKUP_NOREF)) |
| 193 | return 0; | 196 | return 0; |
| 194 | return -ENETUNREACH; | 197 | return -ENETUNREACH; |
| 195 | } | 198 | } |
| @@ -254,16 +257,6 @@ static inline void fib_info_put(struct fib_info *fi) | |||
| 254 | free_fib_info(fi); | 257 | free_fib_info(fi); |
| 255 | } | 258 | } |
| 256 | 259 | ||
| 257 | static inline void fib_res_put(struct fib_result *res) | ||
| 258 | { | ||
| 259 | if (res->fi) | ||
| 260 | fib_info_put(res->fi); | ||
| 261 | #ifdef CONFIG_IP_MULTIPLE_TABLES | ||
| 262 | if (res->r) | ||
| 263 | fib_rule_put(res->r); | ||
| 264 | #endif | ||
| 265 | } | ||
| 266 | |||
| 267 | #ifdef CONFIG_PROC_FS | 260 | #ifdef CONFIG_PROC_FS |
| 268 | extern int __net_init fib_proc_init(struct net *net); | 261 | extern int __net_init fib_proc_init(struct net *net); |
| 269 | extern void __net_exit fib_proc_exit(struct net *net); | 262 | extern void __net_exit fib_proc_exit(struct net *net); |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index a4747a0f7303..b7bbd6c28cfa 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
| @@ -25,7 +25,9 @@ | |||
| 25 | #include <linux/ip.h> | 25 | #include <linux/ip.h> |
| 26 | #include <linux/ipv6.h> /* for struct ipv6hdr */ | 26 | #include <linux/ipv6.h> /* for struct ipv6hdr */ |
| 27 | #include <net/ipv6.h> /* for ipv6_addr_copy */ | 27 | #include <net/ipv6.h> /* for ipv6_addr_copy */ |
| 28 | 28 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | |
| 29 | #include <net/netfilter/nf_conntrack.h> | ||
| 30 | #endif | ||
| 29 | 31 | ||
| 30 | /* Connections' size value needed by ip_vs_ctl.c */ | 32 | /* Connections' size value needed by ip_vs_ctl.c */ |
| 31 | extern int ip_vs_conn_tab_size; | 33 | extern int ip_vs_conn_tab_size; |
| @@ -134,24 +136,24 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, | |||
| 134 | if (net_ratelimit()) \ | 136 | if (net_ratelimit()) \ |
| 135 | printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \ | 137 | printk(KERN_DEBUG pr_fmt(msg), ##__VA_ARGS__); \ |
| 136 | } while (0) | 138 | } while (0) |
| 137 | #define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) \ | 139 | #define IP_VS_DBG_PKT(level, af, pp, skb, ofs, msg) \ |
| 138 | do { \ | 140 | do { \ |
| 139 | if (level <= ip_vs_get_debug_level()) \ | 141 | if (level <= ip_vs_get_debug_level()) \ |
| 140 | pp->debug_packet(pp, skb, ofs, msg); \ | 142 | pp->debug_packet(af, pp, skb, ofs, msg); \ |
| 141 | } while (0) | 143 | } while (0) |
| 142 | #define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) \ | 144 | #define IP_VS_DBG_RL_PKT(level, af, pp, skb, ofs, msg) \ |
| 143 | do { \ | 145 | do { \ |
| 144 | if (level <= ip_vs_get_debug_level() && \ | 146 | if (level <= ip_vs_get_debug_level() && \ |
| 145 | net_ratelimit()) \ | 147 | net_ratelimit()) \ |
| 146 | pp->debug_packet(pp, skb, ofs, msg); \ | 148 | pp->debug_packet(af, pp, skb, ofs, msg); \ |
| 147 | } while (0) | 149 | } while (0) |
| 148 | #else /* NO DEBUGGING at ALL */ | 150 | #else /* NO DEBUGGING at ALL */ |
| 149 | #define IP_VS_DBG_BUF(level, msg...) do {} while (0) | 151 | #define IP_VS_DBG_BUF(level, msg...) do {} while (0) |
| 150 | #define IP_VS_ERR_BUF(msg...) do {} while (0) | 152 | #define IP_VS_ERR_BUF(msg...) do {} while (0) |
| 151 | #define IP_VS_DBG(level, msg...) do {} while (0) | 153 | #define IP_VS_DBG(level, msg...) do {} while (0) |
| 152 | #define IP_VS_DBG_RL(msg...) do {} while (0) | 154 | #define IP_VS_DBG_RL(msg...) do {} while (0) |
| 153 | #define IP_VS_DBG_PKT(level, pp, skb, ofs, msg) do {} while (0) | 155 | #define IP_VS_DBG_PKT(level, af, pp, skb, ofs, msg) do {} while (0) |
| 154 | #define IP_VS_DBG_RL_PKT(level, pp, skb, ofs, msg) do {} while (0) | 156 | #define IP_VS_DBG_RL_PKT(level, af, pp, skb, ofs, msg) do {} while (0) |
| 155 | #endif | 157 | #endif |
| 156 | 158 | ||
| 157 | #define IP_VS_BUG() BUG() | 159 | #define IP_VS_BUG() BUG() |
| @@ -343,7 +345,7 @@ struct ip_vs_protocol { | |||
| 343 | 345 | ||
| 344 | int (*app_conn_bind)(struct ip_vs_conn *cp); | 346 | int (*app_conn_bind)(struct ip_vs_conn *cp); |
| 345 | 347 | ||
| 346 | void (*debug_packet)(struct ip_vs_protocol *pp, | 348 | void (*debug_packet)(int af, struct ip_vs_protocol *pp, |
| 347 | const struct sk_buff *skb, | 349 | const struct sk_buff *skb, |
| 348 | int offset, | 350 | int offset, |
| 349 | const char *msg); | 351 | const char *msg); |
| @@ -355,6 +357,19 @@ struct ip_vs_protocol { | |||
| 355 | 357 | ||
| 356 | extern struct ip_vs_protocol * ip_vs_proto_get(unsigned short proto); | 358 | extern struct ip_vs_protocol * ip_vs_proto_get(unsigned short proto); |
| 357 | 359 | ||
| 360 | struct ip_vs_conn_param { | ||
| 361 | const union nf_inet_addr *caddr; | ||
| 362 | const union nf_inet_addr *vaddr; | ||
| 363 | __be16 cport; | ||
| 364 | __be16 vport; | ||
| 365 | __u16 protocol; | ||
| 366 | u16 af; | ||
| 367 | |||
| 368 | const struct ip_vs_pe *pe; | ||
| 369 | char *pe_data; | ||
| 370 | __u8 pe_data_len; | ||
| 371 | }; | ||
| 372 | |||
| 358 | /* | 373 | /* |
| 359 | * IP_VS structure allocated for each dynamically scheduled connection | 374 | * IP_VS structure allocated for each dynamically scheduled connection |
| 360 | */ | 375 | */ |
| @@ -366,6 +381,7 @@ struct ip_vs_conn { | |||
| 366 | union nf_inet_addr caddr; /* client address */ | 381 | union nf_inet_addr caddr; /* client address */ |
| 367 | union nf_inet_addr vaddr; /* virtual address */ | 382 | union nf_inet_addr vaddr; /* virtual address */ |
| 368 | union nf_inet_addr daddr; /* destination address */ | 383 | union nf_inet_addr daddr; /* destination address */ |
| 384 | volatile __u32 flags; /* status flags */ | ||
| 369 | __be16 cport; | 385 | __be16 cport; |
| 370 | __be16 vport; | 386 | __be16 vport; |
| 371 | __be16 dport; | 387 | __be16 dport; |
| @@ -378,7 +394,6 @@ struct ip_vs_conn { | |||
| 378 | 394 | ||
| 379 | /* Flags and state transition */ | 395 | /* Flags and state transition */ |
| 380 | spinlock_t lock; /* lock for state transition */ | 396 | spinlock_t lock; /* lock for state transition */ |
| 381 | volatile __u16 flags; /* status flags */ | ||
| 382 | volatile __u16 state; /* state info */ | 397 | volatile __u16 state; /* state info */ |
| 383 | volatile __u16 old_state; /* old state, to be used for | 398 | volatile __u16 old_state; /* old state, to be used for |
| 384 | * state transition triggerd | 399 | * state transition triggerd |
| @@ -394,6 +409,7 @@ struct ip_vs_conn { | |||
| 394 | /* packet transmitter for different forwarding methods. If it | 409 | /* packet transmitter for different forwarding methods. If it |
| 395 | mangles the packet, it must return NF_DROP or better NF_STOLEN, | 410 | mangles the packet, it must return NF_DROP or better NF_STOLEN, |
| 396 | otherwise this must be changed to a sk_buff **. | 411 | otherwise this must be changed to a sk_buff **. |
| 412 | NF_ACCEPT can be returned when destination is local. | ||
| 397 | */ | 413 | */ |
| 398 | int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp, | 414 | int (*packet_xmit)(struct sk_buff *skb, struct ip_vs_conn *cp, |
| 399 | struct ip_vs_protocol *pp); | 415 | struct ip_vs_protocol *pp); |
| @@ -405,6 +421,9 @@ struct ip_vs_conn { | |||
| 405 | void *app_data; /* Application private data */ | 421 | void *app_data; /* Application private data */ |
| 406 | struct ip_vs_seq in_seq; /* incoming seq. struct */ | 422 | struct ip_vs_seq in_seq; /* incoming seq. struct */ |
| 407 | struct ip_vs_seq out_seq; /* outgoing seq. struct */ | 423 | struct ip_vs_seq out_seq; /* outgoing seq. struct */ |
| 424 | |||
| 425 | char *pe_data; | ||
| 426 | __u8 pe_data_len; | ||
| 408 | }; | 427 | }; |
| 409 | 428 | ||
| 410 | 429 | ||
| @@ -426,6 +445,7 @@ struct ip_vs_service_user_kern { | |||
| 426 | 445 | ||
| 427 | /* virtual service options */ | 446 | /* virtual service options */ |
| 428 | char *sched_name; | 447 | char *sched_name; |
| 448 | char *pe_name; | ||
| 429 | unsigned flags; /* virtual service flags */ | 449 | unsigned flags; /* virtual service flags */ |
| 430 | unsigned timeout; /* persistent timeout in sec */ | 450 | unsigned timeout; /* persistent timeout in sec */ |
| 431 | u32 netmask; /* persistent netmask */ | 451 | u32 netmask; /* persistent netmask */ |
| @@ -475,6 +495,9 @@ struct ip_vs_service { | |||
| 475 | struct ip_vs_scheduler *scheduler; /* bound scheduler object */ | 495 | struct ip_vs_scheduler *scheduler; /* bound scheduler object */ |
| 476 | rwlock_t sched_lock; /* lock sched_data */ | 496 | rwlock_t sched_lock; /* lock sched_data */ |
| 477 | void *sched_data; /* scheduler application data */ | 497 | void *sched_data; /* scheduler application data */ |
| 498 | |||
| 499 | /* alternate persistence engine */ | ||
| 500 | struct ip_vs_pe *pe; | ||
| 478 | }; | 501 | }; |
| 479 | 502 | ||
| 480 | 503 | ||
| @@ -507,6 +530,10 @@ struct ip_vs_dest { | |||
| 507 | spinlock_t dst_lock; /* lock of dst_cache */ | 530 | spinlock_t dst_lock; /* lock of dst_cache */ |
| 508 | struct dst_entry *dst_cache; /* destination cache entry */ | 531 | struct dst_entry *dst_cache; /* destination cache entry */ |
| 509 | u32 dst_rtos; /* RT_TOS(tos) for dst */ | 532 | u32 dst_rtos; /* RT_TOS(tos) for dst */ |
| 533 | u32 dst_cookie; | ||
| 534 | #ifdef CONFIG_IP_VS_IPV6 | ||
| 535 | struct in6_addr dst_saddr; | ||
| 536 | #endif | ||
| 510 | 537 | ||
| 511 | /* for virtual service */ | 538 | /* for virtual service */ |
| 512 | struct ip_vs_service *svc; /* service it belongs to */ | 539 | struct ip_vs_service *svc; /* service it belongs to */ |
| @@ -538,6 +565,21 @@ struct ip_vs_scheduler { | |||
| 538 | const struct sk_buff *skb); | 565 | const struct sk_buff *skb); |
| 539 | }; | 566 | }; |
| 540 | 567 | ||
| 568 | /* The persistence engine object */ | ||
| 569 | struct ip_vs_pe { | ||
| 570 | struct list_head n_list; /* d-linked list head */ | ||
| 571 | char *name; /* scheduler name */ | ||
| 572 | atomic_t refcnt; /* reference counter */ | ||
| 573 | struct module *module; /* THIS_MODULE/NULL */ | ||
| 574 | |||
| 575 | /* get the connection template, if any */ | ||
| 576 | int (*fill_param)(struct ip_vs_conn_param *p, struct sk_buff *skb); | ||
| 577 | bool (*ct_match)(const struct ip_vs_conn_param *p, | ||
| 578 | struct ip_vs_conn *ct); | ||
| 579 | u32 (*hashkey_raw)(const struct ip_vs_conn_param *p, u32 initval, | ||
| 580 | bool inverse); | ||
| 581 | int (*show_pe_data)(const struct ip_vs_conn *cp, char *buf); | ||
| 582 | }; | ||
| 541 | 583 | ||
| 542 | /* | 584 | /* |
| 543 | * The application module object (a.k.a. app incarnation) | 585 | * The application module object (a.k.a. app incarnation) |
| @@ -556,11 +598,19 @@ struct ip_vs_app { | |||
| 556 | __be16 port; /* port number in net order */ | 598 | __be16 port; /* port number in net order */ |
| 557 | atomic_t usecnt; /* usage counter */ | 599 | atomic_t usecnt; /* usage counter */ |
| 558 | 600 | ||
| 559 | /* output hook: return false if can't linearize. diff set for TCP. */ | 601 | /* |
| 602 | * output hook: Process packet in inout direction, diff set for TCP. | ||
| 603 | * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok, | ||
| 604 | * 2=Mangled but checksum was not updated | ||
| 605 | */ | ||
| 560 | int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *, | 606 | int (*pkt_out)(struct ip_vs_app *, struct ip_vs_conn *, |
| 561 | struct sk_buff *, int *diff); | 607 | struct sk_buff *, int *diff); |
| 562 | 608 | ||
| 563 | /* input hook: return false if can't linearize. diff set for TCP. */ | 609 | /* |
| 610 | * input hook: Process packet in outin direction, diff set for TCP. | ||
| 611 | * Return: 0=Error, 1=Payload Not Mangled/Mangled but checksum is ok, | ||
| 612 | * 2=Mangled but checksum was not updated | ||
| 613 | */ | ||
| 564 | int (*pkt_in)(struct ip_vs_app *, struct ip_vs_conn *, | 614 | int (*pkt_in)(struct ip_vs_app *, struct ip_vs_conn *, |
| 565 | struct sk_buff *, int *diff); | 615 | struct sk_buff *, int *diff); |
| 566 | 616 | ||
| @@ -624,13 +674,25 @@ enum { | |||
| 624 | IP_VS_DIR_LAST, | 674 | IP_VS_DIR_LAST, |
| 625 | }; | 675 | }; |
| 626 | 676 | ||
| 627 | extern struct ip_vs_conn *ip_vs_conn_in_get | 677 | static inline void ip_vs_conn_fill_param(int af, int protocol, |
| 628 | (int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, | 678 | const union nf_inet_addr *caddr, |
| 629 | const union nf_inet_addr *d_addr, __be16 d_port); | 679 | __be16 cport, |
| 680 | const union nf_inet_addr *vaddr, | ||
| 681 | __be16 vport, | ||
| 682 | struct ip_vs_conn_param *p) | ||
| 683 | { | ||
| 684 | p->af = af; | ||
| 685 | p->protocol = protocol; | ||
| 686 | p->caddr = caddr; | ||
| 687 | p->cport = cport; | ||
| 688 | p->vaddr = vaddr; | ||
| 689 | p->vport = vport; | ||
| 690 | p->pe = NULL; | ||
| 691 | p->pe_data = NULL; | ||
| 692 | } | ||
| 630 | 693 | ||
| 631 | extern struct ip_vs_conn *ip_vs_ct_in_get | 694 | struct ip_vs_conn *ip_vs_conn_in_get(const struct ip_vs_conn_param *p); |
| 632 | (int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, | 695 | struct ip_vs_conn *ip_vs_ct_in_get(const struct ip_vs_conn_param *p); |
| 633 | const union nf_inet_addr *d_addr, __be16 d_port); | ||
| 634 | 696 | ||
| 635 | struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, | 697 | struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, |
| 636 | struct ip_vs_protocol *pp, | 698 | struct ip_vs_protocol *pp, |
| @@ -638,9 +700,7 @@ struct ip_vs_conn * ip_vs_conn_in_get_proto(int af, const struct sk_buff *skb, | |||
| 638 | unsigned int proto_off, | 700 | unsigned int proto_off, |
| 639 | int inverse); | 701 | int inverse); |
| 640 | 702 | ||
| 641 | extern struct ip_vs_conn *ip_vs_conn_out_get | 703 | struct ip_vs_conn *ip_vs_conn_out_get(const struct ip_vs_conn_param *p); |
| 642 | (int af, int protocol, const union nf_inet_addr *s_addr, __be16 s_port, | ||
| 643 | const union nf_inet_addr *d_addr, __be16 d_port); | ||
| 644 | 704 | ||
| 645 | struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, | 705 | struct ip_vs_conn * ip_vs_conn_out_get_proto(int af, const struct sk_buff *skb, |
| 646 | struct ip_vs_protocol *pp, | 706 | struct ip_vs_protocol *pp, |
| @@ -656,11 +716,10 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp) | |||
| 656 | extern void ip_vs_conn_put(struct ip_vs_conn *cp); | 716 | extern void ip_vs_conn_put(struct ip_vs_conn *cp); |
| 657 | extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); | 717 | extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); |
| 658 | 718 | ||
| 659 | extern struct ip_vs_conn * | 719 | struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, |
| 660 | ip_vs_conn_new(int af, int proto, const union nf_inet_addr *caddr, __be16 cport, | 720 | const union nf_inet_addr *daddr, |
| 661 | const union nf_inet_addr *vaddr, __be16 vport, | 721 | __be16 dport, unsigned flags, |
| 662 | const union nf_inet_addr *daddr, __be16 dport, unsigned flags, | 722 | struct ip_vs_dest *dest); |
| 663 | struct ip_vs_dest *dest); | ||
| 664 | extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); | 723 | extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); |
| 665 | 724 | ||
| 666 | extern const char * ip_vs_state_name(__u16 proto, int state); | 725 | extern const char * ip_vs_state_name(__u16 proto, int state); |
| @@ -751,6 +810,12 @@ extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb); | |||
| 751 | extern int ip_vs_app_init(void); | 810 | extern int ip_vs_app_init(void); |
| 752 | extern void ip_vs_app_cleanup(void); | 811 | extern void ip_vs_app_cleanup(void); |
| 753 | 812 | ||
| 813 | void ip_vs_bind_pe(struct ip_vs_service *svc, struct ip_vs_pe *pe); | ||
| 814 | void ip_vs_unbind_pe(struct ip_vs_service *svc); | ||
| 815 | int register_ip_vs_pe(struct ip_vs_pe *pe); | ||
| 816 | int unregister_ip_vs_pe(struct ip_vs_pe *pe); | ||
| 817 | extern struct ip_vs_pe *ip_vs_pe_get(const char *name); | ||
| 818 | extern void ip_vs_pe_put(struct ip_vs_pe *pe); | ||
| 754 | 819 | ||
| 755 | /* | 820 | /* |
| 756 | * IPVS protocol functions (from ip_vs_proto.c) | 821 | * IPVS protocol functions (from ip_vs_proto.c) |
| @@ -763,7 +828,8 @@ extern int | |||
| 763 | ip_vs_set_state_timeout(int *table, int num, const char *const *names, | 828 | ip_vs_set_state_timeout(int *table, int num, const char *const *names, |
| 764 | const char *name, int to); | 829 | const char *name, int to); |
| 765 | extern void | 830 | extern void |
| 766 | ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, const struct sk_buff *skb, | 831 | ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, |
| 832 | const struct sk_buff *skb, | ||
| 767 | int offset, const char *msg); | 833 | int offset, const char *msg); |
| 768 | 834 | ||
| 769 | extern struct ip_vs_protocol ip_vs_protocol_tcp; | 835 | extern struct ip_vs_protocol ip_vs_protocol_tcp; |
| @@ -785,7 +851,8 @@ extern int ip_vs_unbind_scheduler(struct ip_vs_service *svc); | |||
| 785 | extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); | 851 | extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); |
| 786 | extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); | 852 | extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); |
| 787 | extern struct ip_vs_conn * | 853 | extern struct ip_vs_conn * |
| 788 | ip_vs_schedule(struct ip_vs_service *svc, const struct sk_buff *skb); | 854 | ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, |
| 855 | struct ip_vs_protocol *pp, int *ignored); | ||
| 789 | extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, | 856 | extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, |
| 790 | struct ip_vs_protocol *pp); | 857 | struct ip_vs_protocol *pp); |
| 791 | 858 | ||
| @@ -798,6 +865,8 @@ extern int sysctl_ip_vs_expire_nodest_conn; | |||
| 798 | extern int sysctl_ip_vs_expire_quiescent_template; | 865 | extern int sysctl_ip_vs_expire_quiescent_template; |
| 799 | extern int sysctl_ip_vs_sync_threshold[2]; | 866 | extern int sysctl_ip_vs_sync_threshold[2]; |
| 800 | extern int sysctl_ip_vs_nat_icmp_send; | 867 | extern int sysctl_ip_vs_nat_icmp_send; |
| 868 | extern int sysctl_ip_vs_conntrack; | ||
| 869 | extern int sysctl_ip_vs_snat_reroute; | ||
| 801 | extern struct ip_vs_stats ip_vs_stats; | 870 | extern struct ip_vs_stats ip_vs_stats; |
| 802 | extern const struct ctl_path net_vs_ctl_path[]; | 871 | extern const struct ctl_path net_vs_ctl_path[]; |
| 803 | 872 | ||
| @@ -955,6 +1024,66 @@ static inline __wsum ip_vs_check_diff2(__be16 old, __be16 new, __wsum oldsum) | |||
| 955 | return csum_partial(diff, sizeof(diff), oldsum); | 1024 | return csum_partial(diff, sizeof(diff), oldsum); |
| 956 | } | 1025 | } |
| 957 | 1026 | ||
| 1027 | /* | ||
| 1028 | * Forget current conntrack (unconfirmed) and attach notrack entry | ||
| 1029 | */ | ||
| 1030 | static inline void ip_vs_notrack(struct sk_buff *skb) | ||
| 1031 | { | ||
| 1032 | #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) | ||
| 1033 | enum ip_conntrack_info ctinfo; | ||
| 1034 | struct nf_conn *ct = ct = nf_ct_get(skb, &ctinfo); | ||
| 1035 | |||
| 1036 | if (!ct || !nf_ct_is_untracked(ct)) { | ||
| 1037 | nf_reset(skb); | ||
| 1038 | skb->nfct = &nf_ct_untracked_get()->ct_general; | ||
| 1039 | skb->nfctinfo = IP_CT_NEW; | ||
| 1040 | nf_conntrack_get(skb->nfct); | ||
| 1041 | } | ||
| 1042 | #endif | ||
| 1043 | } | ||
| 1044 | |||
| 1045 | #ifdef CONFIG_IP_VS_NFCT | ||
| 1046 | /* | ||
| 1047 | * Netfilter connection tracking | ||
| 1048 | * (from ip_vs_nfct.c) | ||
| 1049 | */ | ||
| 1050 | static inline int ip_vs_conntrack_enabled(void) | ||
| 1051 | { | ||
| 1052 | return sysctl_ip_vs_conntrack; | ||
| 1053 | } | ||
| 1054 | |||
| 1055 | extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, | ||
| 1056 | int outin); | ||
| 1057 | extern int ip_vs_confirm_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp); | ||
| 1058 | extern void ip_vs_nfct_expect_related(struct sk_buff *skb, struct nf_conn *ct, | ||
| 1059 | struct ip_vs_conn *cp, u_int8_t proto, | ||
| 1060 | const __be16 port, int from_rs); | ||
| 1061 | extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp); | ||
| 1062 | |||
| 1063 | #else | ||
| 1064 | |||
| 1065 | static inline int ip_vs_conntrack_enabled(void) | ||
| 1066 | { | ||
| 1067 | return 0; | ||
| 1068 | } | ||
| 1069 | |||
| 1070 | static inline void ip_vs_update_conntrack(struct sk_buff *skb, | ||
| 1071 | struct ip_vs_conn *cp, int outin) | ||
| 1072 | { | ||
| 1073 | } | ||
| 1074 | |||
| 1075 | static inline int ip_vs_confirm_conntrack(struct sk_buff *skb, | ||
| 1076 | struct ip_vs_conn *cp) | ||
| 1077 | { | ||
| 1078 | return NF_ACCEPT; | ||
| 1079 | } | ||
| 1080 | |||
| 1081 | static inline void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp) | ||
| 1082 | { | ||
| 1083 | } | ||
| 1084 | /* CONFIG_IP_VS_NFCT */ | ||
| 1085 | #endif | ||
| 1086 | |||
| 958 | #endif /* __KERNEL__ */ | 1087 | #endif /* __KERNEL__ */ |
| 959 | 1088 | ||
| 960 | #endif /* _NET_IP_VS_H */ | 1089 | #endif /* _NET_IP_VS_H */ |
diff --git a/include/net/ipip.h b/include/net/ipip.h index 65caea8b414f..a32654d52730 100644 --- a/include/net/ipip.h +++ b/include/net/ipip.h | |||
| @@ -16,7 +16,7 @@ struct ip_tunnel_6rd_parm { | |||
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | struct ip_tunnel { | 18 | struct ip_tunnel { |
| 19 | struct ip_tunnel *next; | 19 | struct ip_tunnel __rcu *next; |
| 20 | struct net_device *dev; | 20 | struct net_device *dev; |
| 21 | 21 | ||
| 22 | int err_count; /* Number of arrived ICMP errors */ | 22 | int err_count; /* Number of arrived ICMP errors */ |
| @@ -34,18 +34,18 @@ struct ip_tunnel { | |||
| 34 | #ifdef CONFIG_IPV6_SIT_6RD | 34 | #ifdef CONFIG_IPV6_SIT_6RD |
| 35 | struct ip_tunnel_6rd_parm ip6rd; | 35 | struct ip_tunnel_6rd_parm ip6rd; |
| 36 | #endif | 36 | #endif |
| 37 | struct ip_tunnel_prl_entry *prl; /* potential router list */ | 37 | struct ip_tunnel_prl_entry __rcu *prl; /* potential router list */ |
| 38 | unsigned int prl_count; /* # of entries in PRL */ | 38 | unsigned int prl_count; /* # of entries in PRL */ |
| 39 | }; | 39 | }; |
| 40 | 40 | ||
| 41 | struct ip_tunnel_prl_entry { | 41 | struct ip_tunnel_prl_entry { |
| 42 | struct ip_tunnel_prl_entry *next; | 42 | struct ip_tunnel_prl_entry __rcu *next; |
| 43 | __be32 addr; | 43 | __be32 addr; |
| 44 | u16 flags; | 44 | u16 flags; |
| 45 | struct rcu_head rcu_head; | 45 | struct rcu_head rcu_head; |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | #define IPTUNNEL_XMIT() do { \ | 48 | #define __IPTUNNEL_XMIT(stats1, stats2) do { \ |
| 49 | int err; \ | 49 | int err; \ |
| 50 | int pkt_len = skb->len - skb_transport_offset(skb); \ | 50 | int pkt_len = skb->len - skb_transport_offset(skb); \ |
| 51 | \ | 51 | \ |
| @@ -54,12 +54,14 @@ struct ip_tunnel_prl_entry { | |||
| 54 | \ | 54 | \ |
| 55 | err = ip_local_out(skb); \ | 55 | err = ip_local_out(skb); \ |
| 56 | if (likely(net_xmit_eval(err) == 0)) { \ | 56 | if (likely(net_xmit_eval(err) == 0)) { \ |
| 57 | txq->tx_bytes += pkt_len; \ | 57 | (stats1)->tx_bytes += pkt_len; \ |
| 58 | txq->tx_packets++; \ | 58 | (stats1)->tx_packets++; \ |
| 59 | } else { \ | 59 | } else { \ |
| 60 | stats->tx_errors++; \ | 60 | (stats2)->tx_errors++; \ |
| 61 | stats->tx_aborted_errors++; \ | 61 | (stats2)->tx_aborted_errors++; \ |
| 62 | } \ | 62 | } \ |
| 63 | } while (0) | 63 | } while (0) |
| 64 | 64 | ||
| 65 | #define IPTUNNEL_XMIT() __IPTUNNEL_XMIT(txq, stats) | ||
| 66 | |||
| 65 | #endif | 67 | #endif |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 1f8412410998..4a3cd2cd2f5e 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
| @@ -262,7 +262,7 @@ static inline int ipv6_addr_scope(const struct in6_addr *addr) | |||
| 262 | 262 | ||
| 263 | static inline int __ipv6_addr_src_scope(int type) | 263 | static inline int __ipv6_addr_src_scope(int type) |
| 264 | { | 264 | { |
| 265 | return (type == IPV6_ADDR_ANY ? __IPV6_ADDR_SCOPE_INVALID : (type >> 16)); | 265 | return (type == IPV6_ADDR_ANY) ? __IPV6_ADDR_SCOPE_INVALID : (type >> 16); |
| 266 | } | 266 | } |
| 267 | 267 | ||
| 268 | static inline int ipv6_addr_src_scope(const struct in6_addr *addr) | 268 | static inline int ipv6_addr_src_scope(const struct in6_addr *addr) |
| @@ -279,10 +279,10 @@ static inline int | |||
| 279 | ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m, | 279 | ipv6_masked_addr_cmp(const struct in6_addr *a1, const struct in6_addr *m, |
| 280 | const struct in6_addr *a2) | 280 | const struct in6_addr *a2) |
| 281 | { | 281 | { |
| 282 | return (!!(((a1->s6_addr32[0] ^ a2->s6_addr32[0]) & m->s6_addr32[0]) | | 282 | return !!(((a1->s6_addr32[0] ^ a2->s6_addr32[0]) & m->s6_addr32[0]) | |
| 283 | ((a1->s6_addr32[1] ^ a2->s6_addr32[1]) & m->s6_addr32[1]) | | 283 | ((a1->s6_addr32[1] ^ a2->s6_addr32[1]) & m->s6_addr32[1]) | |
| 284 | ((a1->s6_addr32[2] ^ a2->s6_addr32[2]) & m->s6_addr32[2]) | | 284 | ((a1->s6_addr32[2] ^ a2->s6_addr32[2]) & m->s6_addr32[2]) | |
| 285 | ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3]))); | 285 | ((a1->s6_addr32[3] ^ a2->s6_addr32[3]) & m->s6_addr32[3])); |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2) | 288 | static inline void ipv6_addr_copy(struct in6_addr *a1, const struct in6_addr *a2) |
| @@ -317,10 +317,10 @@ static inline void ipv6_addr_set(struct in6_addr *addr, | |||
| 317 | static inline int ipv6_addr_equal(const struct in6_addr *a1, | 317 | static inline int ipv6_addr_equal(const struct in6_addr *a1, |
| 318 | const struct in6_addr *a2) | 318 | const struct in6_addr *a2) |
| 319 | { | 319 | { |
| 320 | return (((a1->s6_addr32[0] ^ a2->s6_addr32[0]) | | 320 | return ((a1->s6_addr32[0] ^ a2->s6_addr32[0]) | |
| 321 | (a1->s6_addr32[1] ^ a2->s6_addr32[1]) | | 321 | (a1->s6_addr32[1] ^ a2->s6_addr32[1]) | |
| 322 | (a1->s6_addr32[2] ^ a2->s6_addr32[2]) | | 322 | (a1->s6_addr32[2] ^ a2->s6_addr32[2]) | |
| 323 | (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0); | 323 | (a1->s6_addr32[3] ^ a2->s6_addr32[3])) == 0; |
| 324 | } | 324 | } |
| 325 | 325 | ||
| 326 | static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, | 326 | static inline int __ipv6_prefix_equal(const __be32 *a1, const __be32 *a2, |
| @@ -373,20 +373,20 @@ int ip6_frag_match(struct inet_frag_queue *q, void *a); | |||
| 373 | 373 | ||
| 374 | static inline int ipv6_addr_any(const struct in6_addr *a) | 374 | static inline int ipv6_addr_any(const struct in6_addr *a) |
| 375 | { | 375 | { |
| 376 | return ((a->s6_addr32[0] | a->s6_addr32[1] | | 376 | return (a->s6_addr32[0] | a->s6_addr32[1] | |
| 377 | a->s6_addr32[2] | a->s6_addr32[3] ) == 0); | 377 | a->s6_addr32[2] | a->s6_addr32[3]) == 0; |
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | static inline int ipv6_addr_loopback(const struct in6_addr *a) | 380 | static inline int ipv6_addr_loopback(const struct in6_addr *a) |
| 381 | { | 381 | { |
| 382 | return ((a->s6_addr32[0] | a->s6_addr32[1] | | 382 | return (a->s6_addr32[0] | a->s6_addr32[1] | |
| 383 | a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0); | 383 | a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0; |
| 384 | } | 384 | } |
| 385 | 385 | ||
| 386 | static inline int ipv6_addr_v4mapped(const struct in6_addr *a) | 386 | static inline int ipv6_addr_v4mapped(const struct in6_addr *a) |
| 387 | { | 387 | { |
| 388 | return ((a->s6_addr32[0] | a->s6_addr32[1] | | 388 | return (a->s6_addr32[0] | a->s6_addr32[1] | |
| 389 | (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0); | 389 | (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0; |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | /* | 392 | /* |
| @@ -395,8 +395,7 @@ static inline int ipv6_addr_v4mapped(const struct in6_addr *a) | |||
| 395 | */ | 395 | */ |
| 396 | static inline int ipv6_addr_orchid(const struct in6_addr *a) | 396 | static inline int ipv6_addr_orchid(const struct in6_addr *a) |
| 397 | { | 397 | { |
| 398 | return ((a->s6_addr32[0] & htonl(0xfffffff0)) | 398 | return (a->s6_addr32[0] & htonl(0xfffffff0)) == htonl(0x20010010); |
| 399 | == htonl(0x20010010)); | ||
| 400 | } | 399 | } |
| 401 | 400 | ||
| 402 | static inline void ipv6_addr_set_v4mapped(const __be32 addr, | 401 | static inline void ipv6_addr_set_v4mapped(const __be32 addr, |
| @@ -441,7 +440,7 @@ static inline int __ipv6_addr_diff(const void *token1, const void *token2, int a | |||
| 441 | * if returned value is greater than prefix length. | 440 | * if returned value is greater than prefix length. |
| 442 | * --ANK (980803) | 441 | * --ANK (980803) |
| 443 | */ | 442 | */ |
| 444 | return (addrlen << 5); | 443 | return addrlen << 5; |
| 445 | } | 444 | } |
| 446 | 445 | ||
| 447 | static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_addr *a2) | 446 | static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_addr *a2) |
diff --git a/include/net/irda/irlan_common.h b/include/net/irda/irlan_common.h index 73cacb3ac16c..0af8b8dfbc22 100644 --- a/include/net/irda/irlan_common.h +++ b/include/net/irda/irlan_common.h | |||
| @@ -171,7 +171,6 @@ struct irlan_cb { | |||
| 171 | int magic; | 171 | int magic; |
| 172 | struct list_head dev_list; | 172 | struct list_head dev_list; |
| 173 | struct net_device *dev; /* Ethernet device structure*/ | 173 | struct net_device *dev; /* Ethernet device structure*/ |
| 174 | struct net_device_stats stats; | ||
| 175 | 174 | ||
| 176 | __u32 saddr; /* Source device address */ | 175 | __u32 saddr; /* Source device address */ |
| 177 | __u32 daddr; /* Destination device address */ | 176 | __u32 daddr; /* Destination device address */ |
diff --git a/include/net/irda/irlan_event.h b/include/net/irda/irlan_event.h index 6d9539f05806..018b5a77e610 100644 --- a/include/net/irda/irlan_event.h +++ b/include/net/irda/irlan_event.h | |||
| @@ -67,7 +67,7 @@ typedef enum { | |||
| 67 | IRLAN_WATCHDOG_TIMEOUT, | 67 | IRLAN_WATCHDOG_TIMEOUT, |
| 68 | } IRLAN_EVENT; | 68 | } IRLAN_EVENT; |
| 69 | 69 | ||
| 70 | extern char *irlan_state[]; | 70 | extern const char * const irlan_state[]; |
| 71 | 71 | ||
| 72 | void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, | 72 | void irlan_do_client_event(struct irlan_cb *self, IRLAN_EVENT event, |
| 73 | struct sk_buff *skb); | 73 | struct sk_buff *skb); |
diff --git a/include/net/irda/irlap.h b/include/net/irda/irlap.h index 9d0c78ea92f5..17fcd964f9d9 100644 --- a/include/net/irda/irlap.h +++ b/include/net/irda/irlap.h | |||
| @@ -282,7 +282,7 @@ static inline int irlap_is_primary(struct irlap_cb *self) | |||
| 282 | default: | 282 | default: |
| 283 | ret = -1; | 283 | ret = -1; |
| 284 | } | 284 | } |
| 285 | return(ret); | 285 | return ret; |
| 286 | } | 286 | } |
| 287 | 287 | ||
| 288 | /* Clear a pending IrLAP disconnect. - Jean II */ | 288 | /* Clear a pending IrLAP disconnect. - Jean II */ |
diff --git a/include/net/irda/irlmp.h b/include/net/irda/irlmp.h index 3ffc1d0f93d6..fff11b7fe8a4 100644 --- a/include/net/irda/irlmp.h +++ b/include/net/irda/irlmp.h | |||
| @@ -274,7 +274,7 @@ static inline int irlmp_lap_tx_queue_full(struct lsap_cb *self) | |||
| 274 | if (self->lap->irlap == NULL) | 274 | if (self->lap->irlap == NULL) |
| 275 | return 0; | 275 | return 0; |
| 276 | 276 | ||
| 277 | return(IRLAP_GET_TX_QUEUE_LEN(self->lap->irlap) >= LAP_HIGH_THRESHOLD); | 277 | return IRLAP_GET_TX_QUEUE_LEN(self->lap->irlap) >= LAP_HIGH_THRESHOLD; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | /* After doing a irlmp_dup(), this get one of the two socket back into | 280 | /* After doing a irlmp_dup(), this get one of the two socket back into |
diff --git a/include/net/irda/irttp.h b/include/net/irda/irttp.h index 11aee7a2972a..af4b87721d13 100644 --- a/include/net/irda/irttp.h +++ b/include/net/irda/irttp.h | |||
| @@ -204,7 +204,7 @@ static inline int irttp_is_primary(struct tsap_cb *self) | |||
| 204 | (self->lsap->lap == NULL) || | 204 | (self->lsap->lap == NULL) || |
| 205 | (self->lsap->lap->irlap == NULL)) | 205 | (self->lsap->lap->irlap == NULL)) |
| 206 | return -2; | 206 | return -2; |
| 207 | return(irlap_is_primary(self->lsap->lap->irlap)); | 207 | return irlap_is_primary(self->lsap->lap->irlap); |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | #endif /* IRTTP_H */ | 210 | #endif /* IRTTP_H */ |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index b0787a1dea90..9fdf982d1286 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
| @@ -149,6 +149,7 @@ struct ieee80211_low_level_stats { | |||
| 149 | * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed. | 149 | * @BSS_CHANGED_ARP_FILTER: Hardware ARP filter address list or state changed. |
| 150 | * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note | 150 | * @BSS_CHANGED_QOS: QoS for this association was enabled/disabled. Note |
| 151 | * that it is only ever disabled for station mode. | 151 | * that it is only ever disabled for station mode. |
| 152 | * @BSS_CHANGED_IDLE: Idle changed for this BSS/interface. | ||
| 152 | */ | 153 | */ |
| 153 | enum ieee80211_bss_change { | 154 | enum ieee80211_bss_change { |
| 154 | BSS_CHANGED_ASSOC = 1<<0, | 155 | BSS_CHANGED_ASSOC = 1<<0, |
| @@ -165,6 +166,7 @@ enum ieee80211_bss_change { | |||
| 165 | BSS_CHANGED_IBSS = 1<<11, | 166 | BSS_CHANGED_IBSS = 1<<11, |
| 166 | BSS_CHANGED_ARP_FILTER = 1<<12, | 167 | BSS_CHANGED_ARP_FILTER = 1<<12, |
| 167 | BSS_CHANGED_QOS = 1<<13, | 168 | BSS_CHANGED_QOS = 1<<13, |
| 169 | BSS_CHANGED_IDLE = 1<<14, | ||
| 168 | 170 | ||
| 169 | /* when adding here, make sure to change ieee80211_reconfig */ | 171 | /* when adding here, make sure to change ieee80211_reconfig */ |
| 170 | }; | 172 | }; |
| @@ -223,6 +225,9 @@ enum ieee80211_bss_change { | |||
| 223 | * hardware must not perform any ARP filtering. Note, that the filter will | 225 | * hardware must not perform any ARP filtering. Note, that the filter will |
| 224 | * be enabled also in promiscuous mode. | 226 | * be enabled also in promiscuous mode. |
| 225 | * @qos: This is a QoS-enabled BSS. | 227 | * @qos: This is a QoS-enabled BSS. |
| 228 | * @idle: This interface is idle. There's also a global idle flag in the | ||
| 229 | * hardware config which may be more appropriate depending on what | ||
| 230 | * your driver/device needs to do. | ||
| 226 | */ | 231 | */ |
| 227 | struct ieee80211_bss_conf { | 232 | struct ieee80211_bss_conf { |
| 228 | const u8 *bssid; | 233 | const u8 *bssid; |
| @@ -247,6 +252,7 @@ struct ieee80211_bss_conf { | |||
| 247 | u8 arp_addr_cnt; | 252 | u8 arp_addr_cnt; |
| 248 | bool arp_filter_enabled; | 253 | bool arp_filter_enabled; |
| 249 | bool qos; | 254 | bool qos; |
| 255 | bool idle; | ||
| 250 | }; | 256 | }; |
| 251 | 257 | ||
| 252 | /** | 258 | /** |
| @@ -315,6 +321,9 @@ struct ieee80211_bss_conf { | |||
| 315 | * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame | 321 | * @IEEE80211_TX_CTL_LDPC: tells the driver to use LDPC for this frame |
| 316 | * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this | 322 | * @IEEE80211_TX_CTL_STBC: Enables Space-Time Block Coding (STBC) for this |
| 317 | * frame and selects the maximum number of streams that it can use. | 323 | * frame and selects the maximum number of streams that it can use. |
| 324 | * | ||
| 325 | * Note: If you have to add new flags to the enumeration, then don't | ||
| 326 | * forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary. | ||
| 318 | */ | 327 | */ |
| 319 | enum mac80211_tx_control_flags { | 328 | enum mac80211_tx_control_flags { |
| 320 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), | 329 | IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0), |
| @@ -344,6 +353,19 @@ enum mac80211_tx_control_flags { | |||
| 344 | 353 | ||
| 345 | #define IEEE80211_TX_CTL_STBC_SHIFT 23 | 354 | #define IEEE80211_TX_CTL_STBC_SHIFT 23 |
| 346 | 355 | ||
| 356 | /* | ||
| 357 | * This definition is used as a mask to clear all temporary flags, which are | ||
| 358 | * set by the tx handlers for each transmission attempt by the mac80211 stack. | ||
| 359 | */ | ||
| 360 | #define IEEE80211_TX_TEMPORARY_FLAGS (IEEE80211_TX_CTL_NO_ACK | \ | ||
| 361 | IEEE80211_TX_CTL_CLEAR_PS_FILT | IEEE80211_TX_CTL_FIRST_FRAGMENT | \ | ||
| 362 | IEEE80211_TX_CTL_SEND_AFTER_DTIM | IEEE80211_TX_CTL_AMPDU | \ | ||
| 363 | IEEE80211_TX_STAT_TX_FILTERED | IEEE80211_TX_STAT_ACK | \ | ||
| 364 | IEEE80211_TX_STAT_AMPDU | IEEE80211_TX_STAT_AMPDU_NO_BACK | \ | ||
| 365 | IEEE80211_TX_CTL_RATE_CTRL_PROBE | IEEE80211_TX_CTL_PSPOLL_RESPONSE | \ | ||
| 366 | IEEE80211_TX_CTL_MORE_FRAMES | IEEE80211_TX_CTL_LDPC | \ | ||
| 367 | IEEE80211_TX_CTL_STBC) | ||
| 368 | |||
| 347 | /** | 369 | /** |
| 348 | * enum mac80211_rate_control_flags - per-rate flags set by the | 370 | * enum mac80211_rate_control_flags - per-rate flags set by the |
| 349 | * Rate Control algorithm. | 371 | * Rate Control algorithm. |
| @@ -559,9 +581,6 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info) | |||
| 559 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index | 581 | * @RX_FLAG_HT: HT MCS was used and rate_idx is MCS index |
| 560 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used | 582 | * @RX_FLAG_40MHZ: HT40 (40 MHz) was used |
| 561 | * @RX_FLAG_SHORT_GI: Short guard interval was used | 583 | * @RX_FLAG_SHORT_GI: Short guard interval was used |
| 562 | * @RX_FLAG_INTERNAL_CMTR: set internally after frame was reported | ||
| 563 | * on cooked monitor to avoid double-reporting it for multiple | ||
| 564 | * virtual interfaces | ||
| 565 | */ | 584 | */ |
| 566 | enum mac80211_rx_flags { | 585 | enum mac80211_rx_flags { |
| 567 | RX_FLAG_MMIC_ERROR = 1<<0, | 586 | RX_FLAG_MMIC_ERROR = 1<<0, |
| @@ -575,7 +594,6 @@ enum mac80211_rx_flags { | |||
| 575 | RX_FLAG_HT = 1<<9, | 594 | RX_FLAG_HT = 1<<9, |
| 576 | RX_FLAG_40MHZ = 1<<10, | 595 | RX_FLAG_40MHZ = 1<<10, |
| 577 | RX_FLAG_SHORT_GI = 1<<11, | 596 | RX_FLAG_SHORT_GI = 1<<11, |
| 578 | RX_FLAG_INTERNAL_CMTR = 1<<12, | ||
| 579 | }; | 597 | }; |
| 580 | 598 | ||
| 581 | /** | 599 | /** |
| @@ -596,6 +614,7 @@ enum mac80211_rx_flags { | |||
| 596 | * @rate_idx: index of data rate into band's supported rates or MCS index if | 614 | * @rate_idx: index of data rate into band's supported rates or MCS index if |
| 597 | * HT rates are use (RX_FLAG_HT) | 615 | * HT rates are use (RX_FLAG_HT) |
| 598 | * @flag: %RX_FLAG_* | 616 | * @flag: %RX_FLAG_* |
| 617 | * @rx_flags: internal RX flags for mac80211 | ||
| 599 | */ | 618 | */ |
| 600 | struct ieee80211_rx_status { | 619 | struct ieee80211_rx_status { |
| 601 | u64 mactime; | 620 | u64 mactime; |
| @@ -605,6 +624,7 @@ struct ieee80211_rx_status { | |||
| 605 | int antenna; | 624 | int antenna; |
| 606 | int rate_idx; | 625 | int rate_idx; |
| 607 | int flag; | 626 | int flag; |
| 627 | unsigned int rx_flags; | ||
| 608 | }; | 628 | }; |
| 609 | 629 | ||
| 610 | /** | 630 | /** |
| @@ -763,6 +783,8 @@ struct ieee80211_channel_switch { | |||
| 763 | * @bss_conf: BSS configuration for this interface, either our own | 783 | * @bss_conf: BSS configuration for this interface, either our own |
| 764 | * or the BSS we're associated to | 784 | * or the BSS we're associated to |
| 765 | * @addr: address of this interface | 785 | * @addr: address of this interface |
| 786 | * @p2p: indicates whether this AP or STA interface is a p2p | ||
| 787 | * interface, i.e. a GO or p2p-sta respectively | ||
| 766 | * @drv_priv: data area for driver use, will always be aligned to | 788 | * @drv_priv: data area for driver use, will always be aligned to |
| 767 | * sizeof(void *). | 789 | * sizeof(void *). |
| 768 | */ | 790 | */ |
| @@ -770,6 +792,7 @@ struct ieee80211_vif { | |||
| 770 | enum nl80211_iftype type; | 792 | enum nl80211_iftype type; |
| 771 | struct ieee80211_bss_conf bss_conf; | 793 | struct ieee80211_bss_conf bss_conf; |
| 772 | u8 addr[ETH_ALEN]; | 794 | u8 addr[ETH_ALEN]; |
| 795 | bool p2p; | ||
| 773 | /* must be last */ | 796 | /* must be last */ |
| 774 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); | 797 | u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *)))); |
| 775 | }; | 798 | }; |
| @@ -783,20 +806,6 @@ static inline bool ieee80211_vif_is_mesh(struct ieee80211_vif *vif) | |||
| 783 | } | 806 | } |
| 784 | 807 | ||
| 785 | /** | 808 | /** |
| 786 | * enum ieee80211_key_alg - key algorithm | ||
| 787 | * @ALG_WEP: WEP40 or WEP104 | ||
| 788 | * @ALG_TKIP: TKIP | ||
| 789 | * @ALG_CCMP: CCMP (AES) | ||
| 790 | * @ALG_AES_CMAC: AES-128-CMAC | ||
| 791 | */ | ||
| 792 | enum ieee80211_key_alg { | ||
| 793 | ALG_WEP, | ||
| 794 | ALG_TKIP, | ||
| 795 | ALG_CCMP, | ||
| 796 | ALG_AES_CMAC, | ||
| 797 | }; | ||
| 798 | |||
| 799 | /** | ||
| 800 | * enum ieee80211_key_flags - key flags | 809 | * enum ieee80211_key_flags - key flags |
| 801 | * | 810 | * |
| 802 | * These flags are used for communication about keys between the driver | 811 | * These flags are used for communication about keys between the driver |
| @@ -833,7 +842,7 @@ enum ieee80211_key_flags { | |||
| 833 | * @hw_key_idx: To be set by the driver, this is the key index the driver | 842 | * @hw_key_idx: To be set by the driver, this is the key index the driver |
| 834 | * wants to be given when a frame is transmitted and needs to be | 843 | * wants to be given when a frame is transmitted and needs to be |
| 835 | * encrypted in hardware. | 844 | * encrypted in hardware. |
| 836 | * @alg: The key algorithm. | 845 | * @cipher: The key's cipher suite selector. |
| 837 | * @flags: key flags, see &enum ieee80211_key_flags. | 846 | * @flags: key flags, see &enum ieee80211_key_flags. |
| 838 | * @keyidx: the key index (0-3) | 847 | * @keyidx: the key index (0-3) |
| 839 | * @keylen: key material length | 848 | * @keylen: key material length |
| @@ -846,7 +855,7 @@ enum ieee80211_key_flags { | |||
| 846 | * @iv_len: The IV length for this key type | 855 | * @iv_len: The IV length for this key type |
| 847 | */ | 856 | */ |
| 848 | struct ieee80211_key_conf { | 857 | struct ieee80211_key_conf { |
| 849 | enum ieee80211_key_alg alg; | 858 | u32 cipher; |
| 850 | u8 icv_len; | 859 | u8 icv_len; |
| 851 | u8 iv_len; | 860 | u8 iv_len; |
| 852 | u8 hw_key_idx; | 861 | u8 hw_key_idx; |
| @@ -1032,6 +1041,13 @@ enum ieee80211_tkip_key_type { | |||
| 1032 | * @IEEE80211_HW_NEED_DTIM_PERIOD: | 1041 | * @IEEE80211_HW_NEED_DTIM_PERIOD: |
| 1033 | * This device needs to know the DTIM period for the BSS before | 1042 | * This device needs to know the DTIM period for the BSS before |
| 1034 | * associating. | 1043 | * associating. |
| 1044 | * | ||
| 1045 | * @IEEE80211_HW_SUPPORTS_PER_STA_GTK: The device's crypto engine supports | ||
| 1046 | * per-station GTKs as used by IBSS RSN or during fast transition. If | ||
| 1047 | * the device doesn't support per-station GTKs, but can be asked not | ||
| 1048 | * to decrypt group addressed frames, then IBSS RSN support is still | ||
| 1049 | * possible but software crypto will be used. Advertise the wiphy flag | ||
| 1050 | * only in that case. | ||
| 1035 | */ | 1051 | */ |
| 1036 | enum ieee80211_hw_flags { | 1052 | enum ieee80211_hw_flags { |
| 1037 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, | 1053 | IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, |
| @@ -1055,6 +1071,7 @@ enum ieee80211_hw_flags { | |||
| 1055 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, | 1071 | IEEE80211_HW_REPORTS_TX_ACK_STATUS = 1<<18, |
| 1056 | IEEE80211_HW_CONNECTION_MONITOR = 1<<19, | 1072 | IEEE80211_HW_CONNECTION_MONITOR = 1<<19, |
| 1057 | IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, | 1073 | IEEE80211_HW_SUPPORTS_CQM_RSSI = 1<<20, |
| 1074 | IEEE80211_HW_SUPPORTS_PER_STA_GTK = 1<<21, | ||
| 1058 | }; | 1075 | }; |
| 1059 | 1076 | ||
| 1060 | /** | 1077 | /** |
| @@ -1100,8 +1117,15 @@ enum ieee80211_hw_flags { | |||
| 1100 | * @sta_data_size: size (in bytes) of the drv_priv data area | 1117 | * @sta_data_size: size (in bytes) of the drv_priv data area |
| 1101 | * within &struct ieee80211_sta. | 1118 | * within &struct ieee80211_sta. |
| 1102 | * | 1119 | * |
| 1103 | * @max_rates: maximum number of alternate rate retry stages | 1120 | * @max_rates: maximum number of alternate rate retry stages the hw |
| 1121 | * can handle. | ||
| 1122 | * @max_report_rates: maximum number of alternate rate retry stages | ||
| 1123 | * the hw can report back. | ||
| 1104 | * @max_rate_tries: maximum number of tries for each stage | 1124 | * @max_rate_tries: maximum number of tries for each stage |
| 1125 | * | ||
| 1126 | * @napi_weight: weight used for NAPI polling. You must specify an | ||
| 1127 | * appropriate value here if a napi_poll operation is provided | ||
| 1128 | * by your driver. | ||
| 1105 | */ | 1129 | */ |
| 1106 | struct ieee80211_hw { | 1130 | struct ieee80211_hw { |
| 1107 | struct ieee80211_conf conf; | 1131 | struct ieee80211_conf conf; |
| @@ -1113,10 +1137,12 @@ struct ieee80211_hw { | |||
| 1113 | int channel_change_time; | 1137 | int channel_change_time; |
| 1114 | int vif_data_size; | 1138 | int vif_data_size; |
| 1115 | int sta_data_size; | 1139 | int sta_data_size; |
| 1140 | int napi_weight; | ||
| 1116 | u16 queues; | 1141 | u16 queues; |
| 1117 | u16 max_listen_interval; | 1142 | u16 max_listen_interval; |
| 1118 | s8 max_signal; | 1143 | s8 max_signal; |
| 1119 | u8 max_rates; | 1144 | u8 max_rates; |
| 1145 | u8 max_report_rates; | ||
| 1120 | u8 max_rate_tries; | 1146 | u8 max_rate_tries; |
| 1121 | }; | 1147 | }; |
| 1122 | 1148 | ||
| @@ -1245,8 +1271,8 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
| 1245 | * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in | 1271 | * %IEEE80211_CONF_PS flag enabled means that the powersave mode defined in |
| 1246 | * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused | 1272 | * IEEE 802.11-2007 section 11.2 is enabled. This is not to be confused |
| 1247 | * with hardware wakeup and sleep states. Driver is responsible for waking | 1273 | * with hardware wakeup and sleep states. Driver is responsible for waking |
| 1248 | * up the hardware before issueing commands to the hardware and putting it | 1274 | * up the hardware before issuing commands to the hardware and putting it |
| 1249 | * back to sleep at approriate times. | 1275 | * back to sleep at appropriate times. |
| 1250 | * | 1276 | * |
| 1251 | * When PS is enabled, hardware needs to wakeup for beacons and receive the | 1277 | * When PS is enabled, hardware needs to wakeup for beacons and receive the |
| 1252 | * buffered multicast/broadcast frames after the beacon. Also it must be | 1278 | * buffered multicast/broadcast frames after the beacon. Also it must be |
| @@ -1267,7 +1293,7 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
| 1267 | * there's data traffic and still saving significantly power in idle | 1293 | * there's data traffic and still saving significantly power in idle |
| 1268 | * periods. | 1294 | * periods. |
| 1269 | * | 1295 | * |
| 1270 | * Dynamic powersave is supported by simply mac80211 enabling and disabling | 1296 | * Dynamic powersave is simply supported by mac80211 enabling and disabling |
| 1271 | * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS | 1297 | * PS based on traffic. Driver needs to only set %IEEE80211_HW_SUPPORTS_PS |
| 1272 | * flag and mac80211 will handle everything automatically. Additionally, | 1298 | * flag and mac80211 will handle everything automatically. Additionally, |
| 1273 | * hardware having support for the dynamic PS feature may set the | 1299 | * hardware having support for the dynamic PS feature may set the |
| @@ -1452,12 +1478,14 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw, | |||
| 1452 | * honour this flag if possible. | 1478 | * honour this flag if possible. |
| 1453 | * | 1479 | * |
| 1454 | * @FIF_CONTROL: pass control frames (except for PS Poll), if PROMISC_IN_BSS | 1480 | * @FIF_CONTROL: pass control frames (except for PS Poll), if PROMISC_IN_BSS |
| 1455 | * is not set then only those addressed to this station. | 1481 | * is not set then only those addressed to this station. |
| 1456 | * | 1482 | * |
| 1457 | * @FIF_OTHER_BSS: pass frames destined to other BSSes | 1483 | * @FIF_OTHER_BSS: pass frames destined to other BSSes |
| 1458 | * | 1484 | * |
| 1459 | * @FIF_PSPOLL: pass PS Poll frames, if PROMISC_IN_BSS is not set then only | 1485 | * @FIF_PSPOLL: pass PS Poll frames, if PROMISC_IN_BSS is not set then only |
| 1460 | * those addressed to this station. | 1486 | * those addressed to this station. |
| 1487 | * | ||
| 1488 | * @FIF_PROBE_REQ: pass probe request frames | ||
| 1461 | */ | 1489 | */ |
| 1462 | enum ieee80211_filter_flags { | 1490 | enum ieee80211_filter_flags { |
| 1463 | FIF_PROMISC_IN_BSS = 1<<0, | 1491 | FIF_PROMISC_IN_BSS = 1<<0, |
| @@ -1468,6 +1496,7 @@ enum ieee80211_filter_flags { | |||
| 1468 | FIF_CONTROL = 1<<5, | 1496 | FIF_CONTROL = 1<<5, |
| 1469 | FIF_OTHER_BSS = 1<<6, | 1497 | FIF_OTHER_BSS = 1<<6, |
| 1470 | FIF_PSPOLL = 1<<7, | 1498 | FIF_PSPOLL = 1<<7, |
| 1499 | FIF_PROBE_REQ = 1<<8, | ||
| 1471 | }; | 1500 | }; |
| 1472 | 1501 | ||
| 1473 | /** | 1502 | /** |
| @@ -1540,6 +1569,12 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1540 | * negative error code (which will be seen in userspace.) | 1569 | * negative error code (which will be seen in userspace.) |
| 1541 | * Must be implemented and can sleep. | 1570 | * Must be implemented and can sleep. |
| 1542 | * | 1571 | * |
| 1572 | * @change_interface: Called when a netdevice changes type. This callback | ||
| 1573 | * is optional, but only if it is supported can interface types be | ||
| 1574 | * switched while the interface is UP. The callback may sleep. | ||
| 1575 | * Note that while an interface is being switched, it will not be | ||
| 1576 | * found by the interface iteration callbacks. | ||
| 1577 | * | ||
| 1543 | * @remove_interface: Notifies a driver that an interface is going down. | 1578 | * @remove_interface: Notifies a driver that an interface is going down. |
| 1544 | * The @stop callback is called after this if it is the last interface | 1579 | * The @stop callback is called after this if it is the last interface |
| 1545 | * and no monitor interfaces are present. | 1580 | * and no monitor interfaces are present. |
| @@ -1687,6 +1722,8 @@ enum ieee80211_ampdu_mlme_action { | |||
| 1687 | * switch operation for CSAs received from the AP may implement this | 1722 | * switch operation for CSAs received from the AP may implement this |
| 1688 | * callback. They must then call ieee80211_chswitch_done() to indicate | 1723 | * callback. They must then call ieee80211_chswitch_done() to indicate |
| 1689 | * completion of the channel switch. | 1724 | * completion of the channel switch. |
| 1725 | * | ||
| 1726 | * @napi_poll: Poll Rx queue for incoming data frames. | ||
| 1690 | */ | 1727 | */ |
| 1691 | struct ieee80211_ops { | 1728 | struct ieee80211_ops { |
| 1692 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); | 1729 | int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); |
| @@ -1694,6 +1731,9 @@ struct ieee80211_ops { | |||
| 1694 | void (*stop)(struct ieee80211_hw *hw); | 1731 | void (*stop)(struct ieee80211_hw *hw); |
| 1695 | int (*add_interface)(struct ieee80211_hw *hw, | 1732 | int (*add_interface)(struct ieee80211_hw *hw, |
| 1696 | struct ieee80211_vif *vif); | 1733 | struct ieee80211_vif *vif); |
| 1734 | int (*change_interface)(struct ieee80211_hw *hw, | ||
| 1735 | struct ieee80211_vif *vif, | ||
| 1736 | enum nl80211_iftype new_type, bool p2p); | ||
| 1697 | void (*remove_interface)(struct ieee80211_hw *hw, | 1737 | void (*remove_interface)(struct ieee80211_hw *hw, |
| 1698 | struct ieee80211_vif *vif); | 1738 | struct ieee80211_vif *vif); |
| 1699 | int (*config)(struct ieee80211_hw *hw, u32 changed); | 1739 | int (*config)(struct ieee80211_hw *hw, u32 changed); |
| @@ -1752,6 +1792,7 @@ struct ieee80211_ops { | |||
| 1752 | void (*flush)(struct ieee80211_hw *hw, bool drop); | 1792 | void (*flush)(struct ieee80211_hw *hw, bool drop); |
| 1753 | void (*channel_switch)(struct ieee80211_hw *hw, | 1793 | void (*channel_switch)(struct ieee80211_hw *hw, |
| 1754 | struct ieee80211_channel_switch *ch_switch); | 1794 | struct ieee80211_channel_switch *ch_switch); |
| 1795 | int (*napi_poll)(struct ieee80211_hw *hw, int budget); | ||
| 1755 | }; | 1796 | }; |
| 1756 | 1797 | ||
| 1757 | /** | 1798 | /** |
| @@ -1897,6 +1938,22 @@ void ieee80211_free_hw(struct ieee80211_hw *hw); | |||
| 1897 | */ | 1938 | */ |
| 1898 | void ieee80211_restart_hw(struct ieee80211_hw *hw); | 1939 | void ieee80211_restart_hw(struct ieee80211_hw *hw); |
| 1899 | 1940 | ||
| 1941 | /** ieee80211_napi_schedule - schedule NAPI poll | ||
| 1942 | * | ||
| 1943 | * Use this function to schedule NAPI polling on a device. | ||
| 1944 | * | ||
| 1945 | * @hw: the hardware to start polling | ||
| 1946 | */ | ||
| 1947 | void ieee80211_napi_schedule(struct ieee80211_hw *hw); | ||
| 1948 | |||
| 1949 | /** ieee80211_napi_complete - complete NAPI polling | ||
| 1950 | * | ||
| 1951 | * Use this function to finish NAPI polling on a device. | ||
| 1952 | * | ||
| 1953 | * @hw: the hardware to stop polling | ||
| 1954 | */ | ||
| 1955 | void ieee80211_napi_complete(struct ieee80211_hw *hw); | ||
| 1956 | |||
| 1900 | /** | 1957 | /** |
| 1901 | * ieee80211_rx - receive frame | 1958 | * ieee80211_rx - receive frame |
| 1902 | * | 1959 | * |
| @@ -2252,7 +2309,8 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw); | |||
| 2252 | * | 2309 | * |
| 2253 | * When hardware scan offload is used (i.e. the hw_scan() callback is | 2310 | * When hardware scan offload is used (i.e. the hw_scan() callback is |
| 2254 | * assigned) this function needs to be called by the driver to notify | 2311 | * assigned) this function needs to be called by the driver to notify |
| 2255 | * mac80211 that the scan finished. | 2312 | * mac80211 that the scan finished. This function can be called from |
| 2313 | * any context, including hardirq context. | ||
| 2256 | * | 2314 | * |
| 2257 | * @hw: the hardware that finished the scan | 2315 | * @hw: the hardware that finished the scan |
| 2258 | * @aborted: set to true if scan was aborted | 2316 | * @aborted: set to true if scan was aborted |
| @@ -2267,6 +2325,7 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted); | |||
| 2267 | * This function allows the iterator function to sleep, when the iterator | 2325 | * This function allows the iterator function to sleep, when the iterator |
| 2268 | * function is atomic @ieee80211_iterate_active_interfaces_atomic can | 2326 | * function is atomic @ieee80211_iterate_active_interfaces_atomic can |
| 2269 | * be used. | 2327 | * be used. |
| 2328 | * Does not iterate over a new interface during add_interface() | ||
| 2270 | * | 2329 | * |
| 2271 | * @hw: the hardware struct of which the interfaces should be iterated over | 2330 | * @hw: the hardware struct of which the interfaces should be iterated over |
| 2272 | * @iterator: the iterator function to call | 2331 | * @iterator: the iterator function to call |
| @@ -2284,6 +2343,7 @@ void ieee80211_iterate_active_interfaces(struct ieee80211_hw *hw, | |||
| 2284 | * hardware that are currently active and calls the callback for them. | 2343 | * hardware that are currently active and calls the callback for them. |
| 2285 | * This function requires the iterator callback function to be atomic, | 2344 | * This function requires the iterator callback function to be atomic, |
| 2286 | * if that is not desired, use @ieee80211_iterate_active_interfaces instead. | 2345 | * if that is not desired, use @ieee80211_iterate_active_interfaces instead. |
| 2346 | * Does not iterate over a new interface during add_interface() | ||
| 2287 | * | 2347 | * |
| 2288 | * @hw: the hardware struct of which the interfaces should be iterated over | 2348 | * @hw: the hardware struct of which the interfaces should be iterated over |
| 2289 | * @iterator: the iterator function to call, cannot sleep | 2349 | * @iterator: the iterator function to call, cannot sleep |
| @@ -2385,25 +2445,28 @@ struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_vif *vif, | |||
| 2385 | const u8 *addr); | 2445 | const u8 *addr); |
| 2386 | 2446 | ||
| 2387 | /** | 2447 | /** |
| 2388 | * ieee80211_find_sta_by_hw - find a station on hardware | 2448 | * ieee80211_find_sta_by_ifaddr - find a station on hardware |
| 2389 | * | 2449 | * |
| 2390 | * @hw: pointer as obtained from ieee80211_alloc_hw() | 2450 | * @hw: pointer as obtained from ieee80211_alloc_hw() |
| 2391 | * @addr: station's address | 2451 | * @addr: remote station's address |
| 2452 | * @localaddr: local address (vif->sdata->vif.addr). Use NULL for 'any'. | ||
| 2392 | * | 2453 | * |
| 2393 | * This function must be called under RCU lock and the | 2454 | * This function must be called under RCU lock and the |
| 2394 | * resulting pointer is only valid under RCU lock as well. | 2455 | * resulting pointer is only valid under RCU lock as well. |
| 2395 | * | 2456 | * |
| 2396 | * NOTE: This function should not be used! When mac80211 is converted | 2457 | * NOTE: You may pass NULL for localaddr, but then you will just get |
| 2397 | * internally to properly keep track of stations on multiple | 2458 | * the first STA that matches the remote address 'addr'. |
| 2398 | * virtual interfaces, it will not always know which station to | 2459 | * We can have multiple STA associated with multiple |
| 2399 | * return here since a single address might be used by multiple | 2460 | * logical stations (e.g. consider a station connecting to another |
| 2400 | * logical stations (e.g. consider a station connecting to another | 2461 | * BSSID on the same AP hardware without disconnecting first). |
| 2401 | * BSSID on the same AP hardware without disconnecting first). | 2462 | * In this case, the result of this method with localaddr NULL |
| 2463 | * is not reliable. | ||
| 2402 | * | 2464 | * |
| 2403 | * DO NOT USE THIS FUNCTION. | 2465 | * DO NOT USE THIS FUNCTION with localaddr NULL if at all possible. |
| 2404 | */ | 2466 | */ |
| 2405 | struct ieee80211_sta *ieee80211_find_sta_by_hw(struct ieee80211_hw *hw, | 2467 | struct ieee80211_sta *ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw, |
| 2406 | const u8 *addr); | 2468 | const u8 *addr, |
| 2469 | const u8 *localaddr); | ||
| 2407 | 2470 | ||
| 2408 | /** | 2471 | /** |
| 2409 | * ieee80211_sta_block_awake - block station from waking up | 2472 | * ieee80211_sta_block_awake - block station from waking up |
| @@ -2442,7 +2505,7 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw, | |||
| 2442 | * | 2505 | * |
| 2443 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 2506 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 2444 | * | 2507 | * |
| 2445 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING and | 2508 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER and |
| 2446 | * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the | 2509 | * %IEEE80211_CONF_PS is set, the driver needs to inform whenever the |
| 2447 | * hardware is not receiving beacons with this function. | 2510 | * hardware is not receiving beacons with this function. |
| 2448 | */ | 2511 | */ |
| @@ -2453,7 +2516,7 @@ void ieee80211_beacon_loss(struct ieee80211_vif *vif); | |||
| 2453 | * | 2516 | * |
| 2454 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 2517 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
| 2455 | * | 2518 | * |
| 2456 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTERING, and | 2519 | * When beacon filtering is enabled with %IEEE80211_HW_BEACON_FILTER, and |
| 2457 | * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver | 2520 | * %IEEE80211_CONF_PS and %IEEE80211_HW_CONNECTION_MONITOR are set, the driver |
| 2458 | * needs to inform if the connection to the AP has been lost. | 2521 | * needs to inform if the connection to the AP has been lost. |
| 2459 | * | 2522 | * |
| @@ -2518,6 +2581,34 @@ void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif, | |||
| 2518 | */ | 2581 | */ |
| 2519 | void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success); | 2582 | void ieee80211_chswitch_done(struct ieee80211_vif *vif, bool success); |
| 2520 | 2583 | ||
| 2584 | /** | ||
| 2585 | * ieee80211_request_smps - request SM PS transition | ||
| 2586 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | ||
| 2587 | * @smps_mode: new SM PS mode | ||
| 2588 | * | ||
| 2589 | * This allows the driver to request an SM PS transition in managed | ||
| 2590 | * mode. This is useful when the driver has more information than | ||
| 2591 | * the stack about possible interference, for example by bluetooth. | ||
| 2592 | */ | ||
| 2593 | void ieee80211_request_smps(struct ieee80211_vif *vif, | ||
| 2594 | enum ieee80211_smps_mode smps_mode); | ||
| 2595 | |||
| 2596 | /** | ||
| 2597 | * ieee80211_key_removed - disable hw acceleration for key | ||
| 2598 | * @key_conf: The key hw acceleration should be disabled for | ||
| 2599 | * | ||
| 2600 | * This allows drivers to indicate that the given key has been | ||
| 2601 | * removed from hardware acceleration, due to a new key that | ||
| 2602 | * was added. Don't use this if the key can continue to be used | ||
| 2603 | * for TX, if the key restriction is on RX only it is permitted | ||
| 2604 | * to keep the key for TX only and not call this function. | ||
| 2605 | * | ||
| 2606 | * Due to locking constraints, it may only be called during | ||
| 2607 | * @set_key. This function must be allowed to sleep, and the | ||
| 2608 | * key it tries to disable may still be used until it returns. | ||
| 2609 | */ | ||
| 2610 | void ieee80211_key_removed(struct ieee80211_key_conf *key_conf); | ||
| 2611 | |||
| 2521 | /* Rate control API */ | 2612 | /* Rate control API */ |
| 2522 | 2613 | ||
| 2523 | /** | 2614 | /** |
| @@ -2681,4 +2772,26 @@ conf_is_ht(struct ieee80211_conf *conf) | |||
| 2681 | return conf->channel_type != NL80211_CHAN_NO_HT; | 2772 | return conf->channel_type != NL80211_CHAN_NO_HT; |
| 2682 | } | 2773 | } |
| 2683 | 2774 | ||
| 2775 | static inline enum nl80211_iftype | ||
| 2776 | ieee80211_iftype_p2p(enum nl80211_iftype type, bool p2p) | ||
| 2777 | { | ||
| 2778 | if (p2p) { | ||
| 2779 | switch (type) { | ||
| 2780 | case NL80211_IFTYPE_STATION: | ||
| 2781 | return NL80211_IFTYPE_P2P_CLIENT; | ||
| 2782 | case NL80211_IFTYPE_AP: | ||
| 2783 | return NL80211_IFTYPE_P2P_GO; | ||
| 2784 | default: | ||
| 2785 | break; | ||
| 2786 | } | ||
| 2787 | } | ||
| 2788 | return type; | ||
| 2789 | } | ||
| 2790 | |||
| 2791 | static inline enum nl80211_iftype | ||
| 2792 | ieee80211_vif_type_p2p(struct ieee80211_vif *vif) | ||
| 2793 | { | ||
| 2794 | return ieee80211_iftype_p2p(vif->type, vif->p2p); | ||
| 2795 | } | ||
| 2796 | |||
| 2684 | #endif /* MAC80211_H */ | 2797 | #endif /* MAC80211_H */ |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 242879b6c4df..55590ab16b3e 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
| @@ -91,26 +91,28 @@ struct neigh_statistics { | |||
| 91 | #define NEIGH_CACHE_STAT_INC(tbl, field) this_cpu_inc((tbl)->stats->field) | 91 | #define NEIGH_CACHE_STAT_INC(tbl, field) this_cpu_inc((tbl)->stats->field) |
| 92 | 92 | ||
| 93 | struct neighbour { | 93 | struct neighbour { |
| 94 | struct neighbour *next; | 94 | struct neighbour __rcu *next; |
| 95 | struct neigh_table *tbl; | 95 | struct neigh_table *tbl; |
| 96 | struct neigh_parms *parms; | 96 | struct neigh_parms *parms; |
| 97 | struct net_device *dev; | ||
| 98 | unsigned long used; | ||
| 99 | unsigned long confirmed; | 97 | unsigned long confirmed; |
| 100 | unsigned long updated; | 98 | unsigned long updated; |
| 101 | __u8 flags; | 99 | __u8 flags; |
| 102 | __u8 nud_state; | 100 | __u8 nud_state; |
| 103 | __u8 type; | 101 | __u8 type; |
| 104 | __u8 dead; | 102 | __u8 dead; |
| 103 | atomic_t refcnt; | ||
| 104 | struct sk_buff_head arp_queue; | ||
| 105 | struct timer_list timer; | ||
| 106 | unsigned long used; | ||
| 105 | atomic_t probes; | 107 | atomic_t probes; |
| 106 | rwlock_t lock; | 108 | rwlock_t lock; |
| 109 | seqlock_t ha_lock; | ||
| 107 | unsigned char ha[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))]; | 110 | unsigned char ha[ALIGN(MAX_ADDR_LEN, sizeof(unsigned long))]; |
| 108 | struct hh_cache *hh; | 111 | struct hh_cache *hh; |
| 109 | atomic_t refcnt; | ||
| 110 | int (*output)(struct sk_buff *skb); | 112 | int (*output)(struct sk_buff *skb); |
| 111 | struct sk_buff_head arp_queue; | ||
| 112 | struct timer_list timer; | ||
| 113 | const struct neigh_ops *ops; | 113 | const struct neigh_ops *ops; |
| 114 | struct rcu_head rcu; | ||
| 115 | struct net_device *dev; | ||
| 114 | u8 primary_key[0]; | 116 | u8 primary_key[0]; |
| 115 | }; | 117 | }; |
| 116 | 118 | ||
| @@ -138,13 +140,22 @@ struct pneigh_entry { | |||
| 138 | * neighbour table manipulation | 140 | * neighbour table manipulation |
| 139 | */ | 141 | */ |
| 140 | 142 | ||
| 143 | struct neigh_hash_table { | ||
| 144 | struct neighbour __rcu **hash_buckets; | ||
| 145 | unsigned int hash_mask; | ||
| 146 | __u32 hash_rnd; | ||
| 147 | struct rcu_head rcu; | ||
| 148 | }; | ||
| 149 | |||
| 141 | 150 | ||
| 142 | struct neigh_table { | 151 | struct neigh_table { |
| 143 | struct neigh_table *next; | 152 | struct neigh_table *next; |
| 144 | int family; | 153 | int family; |
| 145 | int entry_size; | 154 | int entry_size; |
| 146 | int key_len; | 155 | int key_len; |
| 147 | __u32 (*hash)(const void *pkey, const struct net_device *); | 156 | __u32 (*hash)(const void *pkey, |
| 157 | const struct net_device *dev, | ||
| 158 | __u32 hash_rnd); | ||
| 148 | int (*constructor)(struct neighbour *); | 159 | int (*constructor)(struct neighbour *); |
| 149 | int (*pconstructor)(struct pneigh_entry *); | 160 | int (*pconstructor)(struct pneigh_entry *); |
| 150 | void (*pdestructor)(struct pneigh_entry *); | 161 | void (*pdestructor)(struct pneigh_entry *); |
| @@ -163,11 +174,9 @@ struct neigh_table { | |||
| 163 | atomic_t entries; | 174 | atomic_t entries; |
| 164 | rwlock_t lock; | 175 | rwlock_t lock; |
| 165 | unsigned long last_rand; | 176 | unsigned long last_rand; |
| 166 | struct kmem_cache *kmem_cachep; | 177 | struct kmem_cache *kmem_cachep; |
| 167 | struct neigh_statistics __percpu *stats; | 178 | struct neigh_statistics __percpu *stats; |
| 168 | struct neighbour **hash_buckets; | 179 | struct neigh_hash_table __rcu *nht; |
| 169 | unsigned int hash_mask; | ||
| 170 | __u32 hash_rnd; | ||
| 171 | struct pneigh_entry **phash_buckets; | 180 | struct pneigh_entry **phash_buckets; |
| 172 | }; | 181 | }; |
| 173 | 182 | ||
| @@ -237,6 +246,7 @@ extern void pneigh_for_each(struct neigh_table *tbl, void (*cb)(struct pneigh_en | |||
| 237 | struct neigh_seq_state { | 246 | struct neigh_seq_state { |
| 238 | struct seq_net_private p; | 247 | struct seq_net_private p; |
| 239 | struct neigh_table *tbl; | 248 | struct neigh_table *tbl; |
| 249 | struct neigh_hash_table *nht; | ||
| 240 | void *(*neigh_sub_iter)(struct neigh_seq_state *state, | 250 | void *(*neigh_sub_iter)(struct neigh_seq_state *state, |
| 241 | struct neighbour *n, loff_t *pos); | 251 | struct neighbour *n, loff_t *pos); |
| 242 | unsigned int bucket; | 252 | unsigned int bucket; |
| @@ -293,7 +303,10 @@ static inline void neigh_confirm(struct neighbour *neigh) | |||
| 293 | 303 | ||
| 294 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) | 304 | static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) |
| 295 | { | 305 | { |
| 296 | neigh->used = jiffies; | 306 | unsigned long now = ACCESS_ONCE(jiffies); |
| 307 | |||
| 308 | if (neigh->used != now) | ||
| 309 | neigh->used = now; | ||
| 297 | if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE))) | 310 | if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE))) |
| 298 | return __neigh_event_send(neigh, skb); | 311 | return __neigh_event_send(neigh, skb); |
| 299 | return 0; | 312 | return 0; |
| @@ -364,4 +377,14 @@ struct neighbour_cb { | |||
| 364 | 377 | ||
| 365 | #define NEIGH_CB(skb) ((struct neighbour_cb *)(skb)->cb) | 378 | #define NEIGH_CB(skb) ((struct neighbour_cb *)(skb)->cb) |
| 366 | 379 | ||
| 380 | static inline void neigh_ha_snapshot(char *dst, const struct neighbour *n, | ||
| 381 | const struct net_device *dev) | ||
| 382 | { | ||
| 383 | unsigned int seq; | ||
| 384 | |||
| 385 | do { | ||
| 386 | seq = read_seqbegin(&n->ha_lock); | ||
| 387 | memcpy(dst, n->ha, dev->addr_len); | ||
| 388 | } while (read_seqretry(&n->ha_lock, seq)); | ||
| 389 | } | ||
| 367 | #endif | 390 | #endif |
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index bd10a7908993..1bf812b21fb7 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h | |||
| @@ -41,6 +41,8 @@ struct net { | |||
| 41 | * destroy on demand | 41 | * destroy on demand |
| 42 | */ | 42 | */ |
| 43 | #endif | 43 | #endif |
| 44 | spinlock_t rules_mod_lock; | ||
| 45 | |||
| 44 | struct list_head list; /* list of network namespaces */ | 46 | struct list_head list; /* list of network namespaces */ |
| 45 | struct list_head cleanup_list; /* namespaces on death row */ | 47 | struct list_head cleanup_list; /* namespaces on death row */ |
| 46 | struct list_head exit_list; /* Use only net_mutex */ | 48 | struct list_head exit_list; /* Use only net_mutex */ |
| @@ -52,7 +54,8 @@ struct net { | |||
| 52 | struct ctl_table_set sysctls; | 54 | struct ctl_table_set sysctls; |
| 53 | #endif | 55 | #endif |
| 54 | 56 | ||
| 55 | struct net_device *loopback_dev; /* The loopback */ | 57 | struct sock *rtnl; /* rtnetlink socket */ |
| 58 | struct sock *genl_sock; | ||
| 56 | 59 | ||
| 57 | struct list_head dev_base_head; | 60 | struct list_head dev_base_head; |
| 58 | struct hlist_head *dev_name_head; | 61 | struct hlist_head *dev_name_head; |
| @@ -60,11 +63,9 @@ struct net { | |||
| 60 | 63 | ||
| 61 | /* core fib_rules */ | 64 | /* core fib_rules */ |
| 62 | struct list_head rules_ops; | 65 | struct list_head rules_ops; |
| 63 | spinlock_t rules_mod_lock; | ||
| 64 | 66 | ||
| 65 | struct sock *rtnl; /* rtnetlink socket */ | ||
| 66 | struct sock *genl_sock; | ||
| 67 | 67 | ||
| 68 | struct net_device *loopback_dev; /* The loopback */ | ||
| 68 | struct netns_core core; | 69 | struct netns_core core; |
| 69 | struct netns_mib mib; | 70 | struct netns_mib mib; |
| 70 | struct netns_packet packet; | 71 | struct netns_packet packet; |
| @@ -84,13 +85,15 @@ struct net { | |||
| 84 | struct sock *nfnl; | 85 | struct sock *nfnl; |
| 85 | struct sock *nfnl_stash; | 86 | struct sock *nfnl_stash; |
| 86 | #endif | 87 | #endif |
| 87 | #ifdef CONFIG_XFRM | ||
| 88 | struct netns_xfrm xfrm; | ||
| 89 | #endif | ||
| 90 | #ifdef CONFIG_WEXT_CORE | 88 | #ifdef CONFIG_WEXT_CORE |
| 91 | struct sk_buff_head wext_nlevents; | 89 | struct sk_buff_head wext_nlevents; |
| 92 | #endif | 90 | #endif |
| 93 | struct net_generic *gen; | 91 | struct net_generic __rcu *gen; |
| 92 | |||
| 93 | /* Note : following structs are cache line aligned */ | ||
| 94 | #ifdef CONFIG_XFRM | ||
| 95 | struct netns_xfrm xfrm; | ||
| 96 | #endif | ||
| 94 | }; | 97 | }; |
| 95 | 98 | ||
| 96 | 99 | ||
diff --git a/include/net/netfilter/ipv6/nf_defrag_ipv6.h b/include/net/netfilter/ipv6/nf_defrag_ipv6.h new file mode 100644 index 000000000000..94dd54d76b48 --- /dev/null +++ b/include/net/netfilter/ipv6/nf_defrag_ipv6.h | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #ifndef _NF_DEFRAG_IPV6_H | ||
| 2 | #define _NF_DEFRAG_IPV6_H | ||
| 3 | |||
| 4 | extern void nf_defrag_ipv6_enable(void); | ||
| 5 | |||
| 6 | #endif /* _NF_DEFRAG_IPV6_H */ | ||
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index e624dae54fa4..caf17db87dbc 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
| @@ -75,7 +75,7 @@ struct nf_conntrack_helper; | |||
| 75 | /* nf_conn feature for connections that have a helper */ | 75 | /* nf_conn feature for connections that have a helper */ |
| 76 | struct nf_conn_help { | 76 | struct nf_conn_help { |
| 77 | /* Helper. if any */ | 77 | /* Helper. if any */ |
| 78 | struct nf_conntrack_helper *helper; | 78 | struct nf_conntrack_helper __rcu *helper; |
| 79 | 79 | ||
| 80 | union nf_conntrack_help help; | 80 | union nf_conntrack_help help; |
| 81 | 81 | ||
diff --git a/include/net/netfilter/nf_conntrack_expect.h b/include/net/netfilter/nf_conntrack_expect.h index 11e815084fcf..0f8a8c587532 100644 --- a/include/net/netfilter/nf_conntrack_expect.h +++ b/include/net/netfilter/nf_conntrack_expect.h | |||
| @@ -67,9 +67,6 @@ struct nf_conntrack_expect_policy { | |||
| 67 | 67 | ||
| 68 | #define NF_CT_EXPECT_CLASS_DEFAULT 0 | 68 | #define NF_CT_EXPECT_CLASS_DEFAULT 0 |
| 69 | 69 | ||
| 70 | #define NF_CT_EXPECT_PERMANENT 0x1 | ||
| 71 | #define NF_CT_EXPECT_INACTIVE 0x2 | ||
| 72 | |||
| 73 | int nf_conntrack_expect_init(struct net *net); | 70 | int nf_conntrack_expect_init(struct net *net); |
| 74 | void nf_conntrack_expect_fini(struct net *net); | 71 | void nf_conntrack_expect_fini(struct net *net); |
| 75 | 72 | ||
| @@ -85,9 +82,16 @@ struct nf_conntrack_expect * | |||
| 85 | nf_ct_find_expectation(struct net *net, u16 zone, | 82 | nf_ct_find_expectation(struct net *net, u16 zone, |
| 86 | const struct nf_conntrack_tuple *tuple); | 83 | const struct nf_conntrack_tuple *tuple); |
| 87 | 84 | ||
| 88 | void nf_ct_unlink_expect(struct nf_conntrack_expect *exp); | 85 | void nf_ct_unlink_expect_report(struct nf_conntrack_expect *exp, |
| 86 | u32 pid, int report); | ||
| 87 | static inline void nf_ct_unlink_expect(struct nf_conntrack_expect *exp) | ||
| 88 | { | ||
| 89 | nf_ct_unlink_expect_report(exp, 0, 0); | ||
| 90 | } | ||
| 91 | |||
| 89 | void nf_ct_remove_expectations(struct nf_conn *ct); | 92 | void nf_ct_remove_expectations(struct nf_conn *ct); |
| 90 | void nf_ct_unexpect_related(struct nf_conntrack_expect *exp); | 93 | void nf_ct_unexpect_related(struct nf_conntrack_expect *exp); |
| 94 | void nf_ct_remove_userspace_expectations(void); | ||
| 91 | 95 | ||
| 92 | /* Allocate space for an expectation: this is mandatory before calling | 96 | /* Allocate space for an expectation: this is mandatory before calling |
| 93 | nf_ct_expect_related. You will have to call put afterwards. */ | 97 | nf_ct_expect_related. You will have to call put afterwards. */ |
diff --git a/include/net/netfilter/nf_nat_protocol.h b/include/net/netfilter/nf_nat_protocol.h index df17bac46bf5..93cc90d28e66 100644 --- a/include/net/netfilter/nf_nat_protocol.h +++ b/include/net/netfilter/nf_nat_protocol.h | |||
| @@ -45,9 +45,6 @@ struct nf_nat_protocol { | |||
| 45 | extern int nf_nat_protocol_register(const struct nf_nat_protocol *proto); | 45 | extern int nf_nat_protocol_register(const struct nf_nat_protocol *proto); |
| 46 | extern void nf_nat_protocol_unregister(const struct nf_nat_protocol *proto); | 46 | extern void nf_nat_protocol_unregister(const struct nf_nat_protocol *proto); |
| 47 | 47 | ||
| 48 | extern const struct nf_nat_protocol *nf_nat_proto_find_get(u_int8_t protocol); | ||
| 49 | extern void nf_nat_proto_put(const struct nf_nat_protocol *proto); | ||
| 50 | |||
| 51 | /* Built-in protocols. */ | 48 | /* Built-in protocols. */ |
| 52 | extern const struct nf_nat_protocol nf_nat_protocol_tcp; | 49 | extern const struct nf_nat_protocol nf_nat_protocol_tcp; |
| 53 | extern const struct nf_nat_protocol nf_nat_protocol_udp; | 50 | extern const struct nf_nat_protocol nf_nat_protocol_udp; |
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h index 208b46f4d6d2..cd85b3bc8327 100644 --- a/include/net/netfilter/nf_tproxy_core.h +++ b/include/net/netfilter/nf_tproxy_core.h | |||
| @@ -5,15 +5,201 @@ | |||
| 5 | #include <linux/in.h> | 5 | #include <linux/in.h> |
| 6 | #include <linux/skbuff.h> | 6 | #include <linux/skbuff.h> |
| 7 | #include <net/sock.h> | 7 | #include <net/sock.h> |
| 8 | #include <net/inet_sock.h> | 8 | #include <net/inet_hashtables.h> |
| 9 | #include <net/inet6_hashtables.h> | ||
| 9 | #include <net/tcp.h> | 10 | #include <net/tcp.h> |
| 10 | 11 | ||
| 12 | #define NFT_LOOKUP_ANY 0 | ||
| 13 | #define NFT_LOOKUP_LISTENER 1 | ||
| 14 | #define NFT_LOOKUP_ESTABLISHED 2 | ||
| 15 | |||
| 11 | /* look up and get a reference to a matching socket */ | 16 | /* look up and get a reference to a matching socket */ |
| 12 | extern struct sock * | 17 | |
| 18 | |||
| 19 | /* This function is used by the 'TPROXY' target and the 'socket' | ||
| 20 | * match. The following lookups are supported: | ||
| 21 | * | ||
| 22 | * Explicit TProxy target rule | ||
| 23 | * =========================== | ||
| 24 | * | ||
| 25 | * This is used when the user wants to intercept a connection matching | ||
| 26 | * an explicit iptables rule. In this case the sockets are assumed | ||
| 27 | * matching in preference order: | ||
| 28 | * | ||
| 29 | * - match: if there's a fully established connection matching the | ||
| 30 | * _packet_ tuple, it is returned, assuming the redirection | ||
| 31 | * already took place and we process a packet belonging to an | ||
| 32 | * established connection | ||
| 33 | * | ||
| 34 | * - match: if there's a listening socket matching the redirection | ||
| 35 | * (e.g. on-port & on-ip of the connection), it is returned, | ||
| 36 | * regardless if it was bound to 0.0.0.0 or an explicit | ||
| 37 | * address. The reasoning is that if there's an explicit rule, it | ||
| 38 | * does not really matter if the listener is bound to an interface | ||
| 39 | * or to 0. The user already stated that he wants redirection | ||
| 40 | * (since he added the rule). | ||
| 41 | * | ||
| 42 | * "socket" match based redirection (no specific rule) | ||
| 43 | * =================================================== | ||
| 44 | * | ||
| 45 | * There are connections with dynamic endpoints (e.g. FTP data | ||
| 46 | * connection) that the user is unable to add explicit rules | ||
| 47 | * for. These are taken care of by a generic "socket" rule. It is | ||
| 48 | * assumed that the proxy application is trusted to open such | ||
| 49 | * connections without explicit iptables rule (except of course the | ||
| 50 | * generic 'socket' rule). In this case the following sockets are | ||
| 51 | * matched in preference order: | ||
| 52 | * | ||
| 53 | * - match: if there's a fully established connection matching the | ||
| 54 | * _packet_ tuple | ||
| 55 | * | ||
| 56 | * - match: if there's a non-zero bound listener (possibly with a | ||
| 57 | * non-local address) We don't accept zero-bound listeners, since | ||
| 58 | * then local services could intercept traffic going through the | ||
| 59 | * box. | ||
| 60 | * | ||
| 61 | * Please note that there's an overlap between what a TPROXY target | ||
| 62 | * and a socket match will match. Normally if you have both rules the | ||
| 63 | * "socket" match will be the first one, effectively all packets | ||
| 64 | * belonging to established connections going through that one. | ||
| 65 | */ | ||
| 66 | static inline struct sock * | ||
| 13 | nf_tproxy_get_sock_v4(struct net *net, const u8 protocol, | 67 | nf_tproxy_get_sock_v4(struct net *net, const u8 protocol, |
| 14 | const __be32 saddr, const __be32 daddr, | 68 | const __be32 saddr, const __be32 daddr, |
| 15 | const __be16 sport, const __be16 dport, | 69 | const __be16 sport, const __be16 dport, |
| 16 | const struct net_device *in, bool listening); | 70 | const struct net_device *in, int lookup_type) |
| 71 | { | ||
| 72 | struct sock *sk; | ||
| 73 | |||
| 74 | /* look up socket */ | ||
| 75 | switch (protocol) { | ||
| 76 | case IPPROTO_TCP: | ||
| 77 | switch (lookup_type) { | ||
| 78 | case NFT_LOOKUP_ANY: | ||
| 79 | sk = __inet_lookup(net, &tcp_hashinfo, | ||
| 80 | saddr, sport, daddr, dport, | ||
| 81 | in->ifindex); | ||
| 82 | break; | ||
| 83 | case NFT_LOOKUP_LISTENER: | ||
| 84 | sk = inet_lookup_listener(net, &tcp_hashinfo, | ||
| 85 | daddr, dport, | ||
| 86 | in->ifindex); | ||
| 87 | |||
| 88 | /* NOTE: we return listeners even if bound to | ||
| 89 | * 0.0.0.0, those are filtered out in | ||
| 90 | * xt_socket, since xt_TPROXY needs 0 bound | ||
| 91 | * listeners too */ | ||
| 92 | |||
| 93 | break; | ||
| 94 | case NFT_LOOKUP_ESTABLISHED: | ||
| 95 | sk = inet_lookup_established(net, &tcp_hashinfo, | ||
| 96 | saddr, sport, daddr, dport, | ||
| 97 | in->ifindex); | ||
| 98 | break; | ||
| 99 | default: | ||
| 100 | WARN_ON(1); | ||
| 101 | sk = NULL; | ||
| 102 | break; | ||
| 103 | } | ||
| 104 | break; | ||
| 105 | case IPPROTO_UDP: | ||
| 106 | sk = udp4_lib_lookup(net, saddr, sport, daddr, dport, | ||
| 107 | in->ifindex); | ||
| 108 | if (sk && lookup_type != NFT_LOOKUP_ANY) { | ||
| 109 | int connected = (sk->sk_state == TCP_ESTABLISHED); | ||
| 110 | int wildcard = (inet_sk(sk)->inet_rcv_saddr == 0); | ||
| 111 | |||
| 112 | /* NOTE: we return listeners even if bound to | ||
| 113 | * 0.0.0.0, those are filtered out in | ||
| 114 | * xt_socket, since xt_TPROXY needs 0 bound | ||
| 115 | * listeners too */ | ||
| 116 | if ((lookup_type == NFT_LOOKUP_ESTABLISHED && (!connected || wildcard)) || | ||
| 117 | (lookup_type == NFT_LOOKUP_LISTENER && connected)) { | ||
| 118 | sock_put(sk); | ||
| 119 | sk = NULL; | ||
| 120 | } | ||
| 121 | } | ||
| 122 | break; | ||
| 123 | default: | ||
| 124 | WARN_ON(1); | ||
| 125 | sk = NULL; | ||
| 126 | } | ||
| 127 | |||
| 128 | pr_debug("tproxy socket lookup: proto %u %08x:%u -> %08x:%u, lookup type: %d, sock %p\n", | ||
| 129 | protocol, ntohl(saddr), ntohs(sport), ntohl(daddr), ntohs(dport), lookup_type, sk); | ||
| 130 | |||
| 131 | return sk; | ||
| 132 | } | ||
| 133 | |||
| 134 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
| 135 | static inline struct sock * | ||
| 136 | nf_tproxy_get_sock_v6(struct net *net, const u8 protocol, | ||
| 137 | const struct in6_addr *saddr, const struct in6_addr *daddr, | ||
| 138 | const __be16 sport, const __be16 dport, | ||
| 139 | const struct net_device *in, int lookup_type) | ||
| 140 | { | ||
| 141 | struct sock *sk; | ||
| 142 | |||
| 143 | /* look up socket */ | ||
| 144 | switch (protocol) { | ||
| 145 | case IPPROTO_TCP: | ||
| 146 | switch (lookup_type) { | ||
| 147 | case NFT_LOOKUP_ANY: | ||
| 148 | sk = inet6_lookup(net, &tcp_hashinfo, | ||
| 149 | saddr, sport, daddr, dport, | ||
| 150 | in->ifindex); | ||
| 151 | break; | ||
| 152 | case NFT_LOOKUP_LISTENER: | ||
| 153 | sk = inet6_lookup_listener(net, &tcp_hashinfo, | ||
| 154 | daddr, ntohs(dport), | ||
| 155 | in->ifindex); | ||
| 156 | |||
| 157 | /* NOTE: we return listeners even if bound to | ||
| 158 | * 0.0.0.0, those are filtered out in | ||
| 159 | * xt_socket, since xt_TPROXY needs 0 bound | ||
| 160 | * listeners too */ | ||
| 161 | |||
| 162 | break; | ||
| 163 | case NFT_LOOKUP_ESTABLISHED: | ||
| 164 | sk = __inet6_lookup_established(net, &tcp_hashinfo, | ||
| 165 | saddr, sport, daddr, ntohs(dport), | ||
| 166 | in->ifindex); | ||
| 167 | break; | ||
| 168 | default: | ||
| 169 | WARN_ON(1); | ||
| 170 | sk = NULL; | ||
| 171 | break; | ||
| 172 | } | ||
| 173 | break; | ||
| 174 | case IPPROTO_UDP: | ||
| 175 | sk = udp6_lib_lookup(net, saddr, sport, daddr, dport, | ||
| 176 | in->ifindex); | ||
| 177 | if (sk && lookup_type != NFT_LOOKUP_ANY) { | ||
| 178 | int connected = (sk->sk_state == TCP_ESTABLISHED); | ||
| 179 | int wildcard = ipv6_addr_any(&inet6_sk(sk)->rcv_saddr); | ||
| 180 | |||
| 181 | /* NOTE: we return listeners even if bound to | ||
| 182 | * 0.0.0.0, those are filtered out in | ||
| 183 | * xt_socket, since xt_TPROXY needs 0 bound | ||
| 184 | * listeners too */ | ||
| 185 | if ((lookup_type == NFT_LOOKUP_ESTABLISHED && (!connected || wildcard)) || | ||
| 186 | (lookup_type == NFT_LOOKUP_LISTENER && connected)) { | ||
| 187 | sock_put(sk); | ||
| 188 | sk = NULL; | ||
| 189 | } | ||
| 190 | } | ||
| 191 | break; | ||
| 192 | default: | ||
| 193 | WARN_ON(1); | ||
| 194 | sk = NULL; | ||
| 195 | } | ||
| 196 | |||
| 197 | pr_debug("tproxy socket lookup: proto %u %pI6:%u -> %pI6:%u, lookup type: %d, sock %p\n", | ||
| 198 | protocol, saddr, ntohs(sport), daddr, ntohs(dport), lookup_type, sk); | ||
| 199 | |||
| 200 | return sk; | ||
| 201 | } | ||
| 202 | #endif | ||
| 17 | 203 | ||
| 18 | static inline void | 204 | static inline void |
| 19 | nf_tproxy_put_sock(struct sock *sk) | 205 | nf_tproxy_put_sock(struct sock *sk) |
diff --git a/include/net/netfilter/xt_log.h b/include/net/netfilter/xt_log.h new file mode 100644 index 000000000000..0dfb34a5b53c --- /dev/null +++ b/include/net/netfilter/xt_log.h | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | #define S_SIZE (1024 - (sizeof(unsigned int) + 1)) | ||
| 2 | |||
| 3 | struct sbuff { | ||
| 4 | unsigned int count; | ||
| 5 | char buf[S_SIZE + 1]; | ||
| 6 | }; | ||
| 7 | static struct sbuff emergency, *emergency_ptr = &emergency; | ||
| 8 | |||
| 9 | static int sb_add(struct sbuff *m, const char *f, ...) | ||
| 10 | { | ||
| 11 | va_list args; | ||
| 12 | int len; | ||
| 13 | |||
| 14 | if (likely(m->count < S_SIZE)) { | ||
| 15 | va_start(args, f); | ||
| 16 | len = vsnprintf(m->buf + m->count, S_SIZE - m->count, f, args); | ||
| 17 | va_end(args); | ||
| 18 | if (likely(m->count + len < S_SIZE)) { | ||
| 19 | m->count += len; | ||
| 20 | return 0; | ||
| 21 | } | ||
| 22 | } | ||
| 23 | m->count = S_SIZE; | ||
| 24 | printk_once(KERN_ERR KBUILD_MODNAME " please increase S_SIZE\n"); | ||
| 25 | return -1; | ||
| 26 | } | ||
| 27 | |||
| 28 | static struct sbuff *sb_open(void) | ||
| 29 | { | ||
| 30 | struct sbuff *m = kmalloc(sizeof(*m), GFP_ATOMIC); | ||
| 31 | |||
| 32 | if (unlikely(!m)) { | ||
| 33 | local_bh_disable(); | ||
| 34 | do { | ||
| 35 | m = xchg(&emergency_ptr, NULL); | ||
| 36 | } while (!m); | ||
| 37 | } | ||
| 38 | m->count = 0; | ||
| 39 | return m; | ||
| 40 | } | ||
| 41 | |||
| 42 | static void sb_close(struct sbuff *m) | ||
| 43 | { | ||
| 44 | m->buf[m->count] = 0; | ||
| 45 | printk("%s\n", m->buf); | ||
| 46 | |||
| 47 | if (likely(m != &emergency)) | ||
| 48 | kfree(m); | ||
| 49 | else { | ||
| 50 | xchg(&emergency_ptr, m); | ||
| 51 | local_bh_enable(); | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h index 74f119a2829a..748f91f87cd5 100644 --- a/include/net/netns/xfrm.h +++ b/include/net/netns/xfrm.h | |||
| @@ -43,10 +43,6 @@ struct netns_xfrm { | |||
| 43 | unsigned int policy_count[XFRM_POLICY_MAX * 2]; | 43 | unsigned int policy_count[XFRM_POLICY_MAX * 2]; |
| 44 | struct work_struct policy_hash_work; | 44 | struct work_struct policy_hash_work; |
| 45 | 45 | ||
| 46 | struct dst_ops xfrm4_dst_ops; | ||
| 47 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
| 48 | struct dst_ops xfrm6_dst_ops; | ||
| 49 | #endif | ||
| 50 | 46 | ||
| 51 | struct sock *nlsk; | 47 | struct sock *nlsk; |
| 52 | struct sock *nlsk_stash; | 48 | struct sock *nlsk_stash; |
| @@ -58,6 +54,11 @@ struct netns_xfrm { | |||
| 58 | #ifdef CONFIG_SYSCTL | 54 | #ifdef CONFIG_SYSCTL |
| 59 | struct ctl_table_header *sysctl_hdr; | 55 | struct ctl_table_header *sysctl_hdr; |
| 60 | #endif | 56 | #endif |
| 57 | |||
| 58 | struct dst_ops xfrm4_dst_ops; | ||
| 59 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
| 60 | struct dst_ops xfrm6_dst_ops; | ||
| 61 | #endif | ||
| 61 | }; | 62 | }; |
| 62 | 63 | ||
| 63 | #endif | 64 | #endif |
diff --git a/include/net/phonet/pep.h b/include/net/phonet/pep.h index 35672b1cf44a..b60b28c99e87 100644 --- a/include/net/phonet/pep.h +++ b/include/net/phonet/pep.h | |||
| @@ -45,6 +45,10 @@ struct pep_sock { | |||
| 45 | u8 tx_fc; /* TX flow control */ | 45 | u8 tx_fc; /* TX flow control */ |
| 46 | u8 init_enable; /* auto-enable at creation */ | 46 | u8 init_enable; /* auto-enable at creation */ |
| 47 | u8 aligned; | 47 | u8 aligned; |
| 48 | #ifdef CONFIG_PHONET_PIPECTRLR | ||
| 49 | u8 pipe_state; | ||
| 50 | struct sockaddr_pn remote_pep; | ||
| 51 | #endif | ||
| 48 | }; | 52 | }; |
| 49 | 53 | ||
| 50 | static inline struct pep_sock *pep_sk(struct sock *sk) | 54 | static inline struct pep_sock *pep_sk(struct sock *sk) |
| @@ -77,6 +81,11 @@ static inline struct pnpipehdr *pnp_hdr(struct sk_buff *skb) | |||
| 77 | #define MAX_PNPIPE_HEADER (MAX_PHONET_HEADER + 4) | 81 | #define MAX_PNPIPE_HEADER (MAX_PHONET_HEADER + 4) |
| 78 | 82 | ||
| 79 | enum { | 83 | enum { |
| 84 | PNS_PIPE_CREATE_REQ = 0x00, | ||
| 85 | PNS_PIPE_CREATE_RESP, | ||
| 86 | PNS_PIPE_REMOVE_REQ, | ||
| 87 | PNS_PIPE_REMOVE_RESP, | ||
| 88 | |||
| 80 | PNS_PIPE_DATA = 0x20, | 89 | PNS_PIPE_DATA = 0x20, |
| 81 | PNS_PIPE_ALIGNED_DATA, | 90 | PNS_PIPE_ALIGNED_DATA, |
| 82 | 91 | ||
| @@ -160,4 +169,21 @@ enum { | |||
| 160 | PEP_IND_READY, | 169 | PEP_IND_READY, |
| 161 | }; | 170 | }; |
| 162 | 171 | ||
| 172 | #ifdef CONFIG_PHONET_PIPECTRLR | ||
| 173 | #define PNS_PEP_CONNECT_UTID 0x02 | ||
| 174 | #define PNS_PIPE_CREATED_IND_UTID 0x04 | ||
| 175 | #define PNS_PIPE_ENABLE_UTID 0x0A | ||
| 176 | #define PNS_PIPE_ENABLED_IND_UTID 0x0C | ||
| 177 | #define PNS_PIPE_DISABLE_UTID 0x0F | ||
| 178 | #define PNS_PIPE_DISABLED_IND_UTID 0x11 | ||
| 179 | #define PNS_PEP_DISCONNECT_UTID 0x06 | ||
| 180 | |||
| 181 | /* Used for tracking state of a pipe */ | ||
| 182 | enum { | ||
| 183 | PIPE_IDLE, | ||
| 184 | PIPE_DISABLED, | ||
| 185 | PIPE_ENABLED, | ||
| 186 | }; | ||
| 187 | #endif /* CONFIG_PHONET_PIPECTRLR */ | ||
| 188 | |||
| 163 | #endif | 189 | #endif |
diff --git a/include/net/phonet/phonet.h b/include/net/phonet/phonet.h index 7b114079a51b..d5df797f9540 100644 --- a/include/net/phonet/phonet.h +++ b/include/net/phonet/phonet.h | |||
| @@ -54,6 +54,11 @@ void pn_sock_hash(struct sock *sk); | |||
| 54 | void pn_sock_unhash(struct sock *sk); | 54 | void pn_sock_unhash(struct sock *sk); |
| 55 | int pn_sock_get_port(struct sock *sk, unsigned short sport); | 55 | int pn_sock_get_port(struct sock *sk, unsigned short sport); |
| 56 | 56 | ||
| 57 | struct sock *pn_find_sock_by_res(struct net *net, u8 res); | ||
| 58 | int pn_sock_bind_res(struct sock *sock, u8 res); | ||
| 59 | int pn_sock_unbind_res(struct sock *sk, u8 res); | ||
| 60 | void pn_sock_unbind_all_res(struct sock *sk); | ||
| 61 | |||
| 57 | int pn_skb_send(struct sock *sk, struct sk_buff *skb, | 62 | int pn_skb_send(struct sock *sk, struct sk_buff *skb, |
| 58 | const struct sockaddr_pn *target); | 63 | const struct sockaddr_pn *target); |
| 59 | 64 | ||
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h index 2d16783d5e20..13649eb57413 100644 --- a/include/net/phonet/pn_dev.h +++ b/include/net/phonet/pn_dev.h | |||
| @@ -57,5 +57,6 @@ struct net_device *phonet_route_output(struct net *net, u8 daddr); | |||
| 57 | #define PN_NO_ADDR 0xff | 57 | #define PN_NO_ADDR 0xff |
| 58 | 58 | ||
| 59 | extern const struct file_operations pn_sock_seq_fops; | 59 | extern const struct file_operations pn_sock_seq_fops; |
| 60 | extern const struct file_operations pn_res_seq_fops; | ||
| 60 | 61 | ||
| 61 | #endif | 62 | #endif |
diff --git a/include/net/protocol.h b/include/net/protocol.h index f1effdd3c265..dc07495bce4c 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
| @@ -89,10 +89,10 @@ struct inet_protosw { | |||
| 89 | #define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */ | 89 | #define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */ |
| 90 | #define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */ | 90 | #define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */ |
| 91 | 91 | ||
| 92 | extern const struct net_protocol *inet_protos[MAX_INET_PROTOS]; | 92 | extern const struct net_protocol __rcu *inet_protos[MAX_INET_PROTOS]; |
| 93 | 93 | ||
| 94 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) | 94 | #if defined(CONFIG_IPV6) || defined (CONFIG_IPV6_MODULE) |
| 95 | extern const struct inet6_protocol *inet6_protos[MAX_INET_PROTOS]; | 95 | extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS]; |
| 96 | #endif | 96 | #endif |
| 97 | 97 | ||
| 98 | extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num); | 98 | extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num); |
diff --git a/include/net/raw.h b/include/net/raw.h index 43c57502659b..42ce6fe7a2d5 100644 --- a/include/net/raw.h +++ b/include/net/raw.h | |||
| @@ -45,7 +45,10 @@ struct raw_iter_state { | |||
| 45 | struct raw_hashinfo *h; | 45 | struct raw_hashinfo *h; |
| 46 | }; | 46 | }; |
| 47 | 47 | ||
| 48 | #define raw_seq_private(seq) ((struct raw_iter_state *)(seq)->private) | 48 | static inline struct raw_iter_state *raw_seq_private(struct seq_file *seq) |
| 49 | { | ||
| 50 | return seq->private; | ||
| 51 | } | ||
| 49 | void *raw_seq_start(struct seq_file *seq, loff_t *pos); | 52 | 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); | 53 | void *raw_seq_next(struct seq_file *seq, void *v, loff_t *pos); |
| 51 | void raw_seq_stop(struct seq_file *seq, void *v); | 54 | void raw_seq_stop(struct seq_file *seq, void *v); |
diff --git a/include/net/route.h b/include/net/route.h index bd732d62e1c3..7e5e73bfa4de 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
| @@ -199,6 +199,8 @@ static inline int ip_route_newports(struct rtable **rp, u8 protocol, | |||
| 199 | fl.fl_ip_sport = sport; | 199 | fl.fl_ip_sport = sport; |
| 200 | fl.fl_ip_dport = dport; | 200 | fl.fl_ip_dport = dport; |
| 201 | fl.proto = protocol; | 201 | fl.proto = protocol; |
| 202 | if (inet_sk(sk)->transparent) | ||
| 203 | fl.flags |= FLOWI_FLAG_ANYSRC; | ||
| 202 | ip_rt_put(*rp); | 204 | ip_rt_put(*rp); |
| 203 | *rp = NULL; | 205 | *rp = NULL; |
| 204 | security_sk_classify_flow(sk, &fl); | 206 | security_sk_classify_flow(sk, &fl); |
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index af60fd050844..e013c68bfb00 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h | |||
| @@ -79,7 +79,6 @@ struct rtnl_link_ops { | |||
| 79 | 79 | ||
| 80 | extern int __rtnl_link_register(struct rtnl_link_ops *ops); | 80 | extern int __rtnl_link_register(struct rtnl_link_ops *ops); |
| 81 | extern void __rtnl_link_unregister(struct rtnl_link_ops *ops); | 81 | extern void __rtnl_link_unregister(struct rtnl_link_ops *ops); |
| 82 | extern void rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops); | ||
| 83 | 82 | ||
| 84 | extern int rtnl_link_register(struct rtnl_link_ops *ops); | 83 | extern int rtnl_link_register(struct rtnl_link_ops *ops); |
| 85 | extern void rtnl_link_unregister(struct rtnl_link_ops *ops); | 84 | extern void rtnl_link_unregister(struct rtnl_link_ops *ops); |
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 3c8728aaab4e..ea1f8a83160d 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
| @@ -328,8 +328,7 @@ extern void qdisc_destroy(struct Qdisc *qdisc); | |||
| 328 | extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n); | 328 | extern void qdisc_tree_decrease_qlen(struct Qdisc *qdisc, unsigned int n); |
| 329 | extern struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, | 329 | extern struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, |
| 330 | struct Qdisc_ops *ops); | 330 | struct Qdisc_ops *ops); |
| 331 | extern struct Qdisc *qdisc_create_dflt(struct net_device *dev, | 331 | extern struct Qdisc *qdisc_create_dflt(struct netdev_queue *dev_queue, |
| 332 | struct netdev_queue *dev_queue, | ||
| 333 | struct Qdisc_ops *ops, u32 parentid); | 332 | struct Qdisc_ops *ops, u32 parentid); |
| 334 | extern void qdisc_calculate_pkt_len(struct sk_buff *skb, | 333 | extern void qdisc_calculate_pkt_len(struct sk_buff *skb, |
| 335 | struct qdisc_size_table *stab); | 334 | struct qdisc_size_table *stab); |
| @@ -601,7 +600,7 @@ static inline u32 qdisc_l2t(struct qdisc_rate_table* rtab, unsigned int pktlen) | |||
| 601 | slot = 0; | 600 | slot = 0; |
| 602 | slot >>= rtab->rate.cell_log; | 601 | slot >>= rtab->rate.cell_log; |
| 603 | if (slot > 255) | 602 | if (slot > 255) |
| 604 | return (rtab->data[255]*(slot >> 8) + rtab->data[slot & 0xFF]); | 603 | return rtab->data[255]*(slot >> 8) + rtab->data[slot & 0xFF]; |
| 605 | return rtab->data[slot]; | 604 | return rtab->data[slot]; |
| 606 | } | 605 | } |
| 607 | 606 | ||
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 65946bc43d00..505845ddb0be 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
| @@ -275,24 +275,35 @@ struct sctp_mib { | |||
| 275 | /* Print debugging messages. */ | 275 | /* Print debugging messages. */ |
| 276 | #if SCTP_DEBUG | 276 | #if SCTP_DEBUG |
| 277 | extern int sctp_debug_flag; | 277 | extern int sctp_debug_flag; |
| 278 | #define SCTP_DEBUG_PRINTK(whatever...) \ | 278 | #define SCTP_DEBUG_PRINTK(fmt, args...) \ |
| 279 | ((void) (sctp_debug_flag && printk(KERN_DEBUG whatever))) | 279 | do { \ |
| 280 | #define SCTP_DEBUG_PRINTK_IPADDR(lead, trail, leadparm, saddr, otherparms...) \ | 280 | if (sctp_debug_flag) \ |
| 281 | if (sctp_debug_flag) { \ | 281 | printk(KERN_DEBUG pr_fmt(fmt), ##args); \ |
| 282 | if (saddr->sa.sa_family == AF_INET6) { \ | 282 | } while (0) |
| 283 | printk(KERN_DEBUG \ | 283 | #define SCTP_DEBUG_PRINTK_CONT(fmt, args...) \ |
| 284 | lead "%pI6" trail, \ | 284 | do { \ |
| 285 | leadparm, \ | 285 | if (sctp_debug_flag) \ |
| 286 | &saddr->v6.sin6_addr, \ | 286 | pr_cont(fmt, ##args); \ |
| 287 | otherparms); \ | 287 | } while (0) |
| 288 | } else { \ | 288 | #define SCTP_DEBUG_PRINTK_IPADDR(fmt_lead, fmt_trail, \ |
| 289 | printk(KERN_DEBUG \ | 289 | args_lead, saddr, args_trail...) \ |
| 290 | lead "%pI4" trail, \ | 290 | do { \ |
| 291 | leadparm, \ | 291 | if (sctp_debug_flag) { \ |
| 292 | &saddr->v4.sin_addr.s_addr, \ | 292 | if (saddr->sa.sa_family == AF_INET6) { \ |
| 293 | otherparms); \ | 293 | printk(KERN_DEBUG \ |
| 294 | } \ | 294 | pr_fmt(fmt_lead "%pI6" fmt_trail), \ |
| 295 | } | 295 | args_lead, \ |
| 296 | &saddr->v6.sin6_addr, \ | ||
| 297 | args_trail); \ | ||
| 298 | } else { \ | ||
| 299 | printk(KERN_DEBUG \ | ||
| 300 | pr_fmt(fmt_lead "%pI4" fmt_trail), \ | ||
| 301 | args_lead, \ | ||
| 302 | &saddr->v4.sin_addr.s_addr, \ | ||
| 303 | args_trail); \ | ||
| 304 | } \ | ||
| 305 | } \ | ||
| 306 | } while (0) | ||
| 296 | #define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } | 307 | #define SCTP_ENABLE_DEBUG { sctp_debug_flag = 1; } |
| 297 | #define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } | 308 | #define SCTP_DISABLE_DEBUG { sctp_debug_flag = 0; } |
| 298 | 309 | ||
| @@ -306,6 +317,7 @@ extern int sctp_debug_flag; | |||
| 306 | #else /* SCTP_DEBUG */ | 317 | #else /* SCTP_DEBUG */ |
| 307 | 318 | ||
| 308 | #define SCTP_DEBUG_PRINTK(whatever...) | 319 | #define SCTP_DEBUG_PRINTK(whatever...) |
| 320 | #define SCTP_DEBUG_PRINTK_CONT(fmt, args...) | ||
| 309 | #define SCTP_DEBUG_PRINTK_IPADDR(whatever...) | 321 | #define SCTP_DEBUG_PRINTK_IPADDR(whatever...) |
| 310 | #define SCTP_ENABLE_DEBUG | 322 | #define SCTP_ENABLE_DEBUG |
| 311 | #define SCTP_DISABLE_DEBUG | 323 | #define SCTP_DISABLE_DEBUG |
| @@ -393,7 +405,7 @@ static inline void sctp_v6_del_protocol(void) { return; } | |||
| 393 | /* Map an association to an assoc_id. */ | 405 | /* Map an association to an assoc_id. */ |
| 394 | static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) | 406 | static inline sctp_assoc_t sctp_assoc2id(const struct sctp_association *asoc) |
| 395 | { | 407 | { |
| 396 | return (asoc?asoc->assoc_id:0); | 408 | return asoc ? asoc->assoc_id : 0; |
| 397 | } | 409 | } |
| 398 | 410 | ||
| 399 | /* Look up the association by its id. */ | 411 | /* Look up the association by its id. */ |
| @@ -461,7 +473,7 @@ static inline void sctp_skb_set_owner_r(struct sk_buff *skb, struct sock *sk) | |||
| 461 | /* Tests if the list has one and only one entry. */ | 473 | /* Tests if the list has one and only one entry. */ |
| 462 | static inline int sctp_list_single_entry(struct list_head *head) | 474 | static inline int sctp_list_single_entry(struct list_head *head) |
| 463 | { | 475 | { |
| 464 | return ((head->next != head) && (head->next == head->prev)); | 476 | return (head->next != head) && (head->next == head->prev); |
| 465 | } | 477 | } |
| 466 | 478 | ||
| 467 | /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ | 479 | /* Generate a random jitter in the range of -50% ~ +50% of input RTO. */ |
| @@ -619,13 +631,13 @@ static inline int sctp_sanity_check(void) | |||
| 619 | /* This is the hash function for the SCTP port hash table. */ | 631 | /* This is the hash function for the SCTP port hash table. */ |
| 620 | static inline int sctp_phashfn(__u16 lport) | 632 | static inline int sctp_phashfn(__u16 lport) |
| 621 | { | 633 | { |
| 622 | return (lport & (sctp_port_hashsize - 1)); | 634 | return lport & (sctp_port_hashsize - 1); |
| 623 | } | 635 | } |
| 624 | 636 | ||
| 625 | /* This is the hash function for the endpoint hash table. */ | 637 | /* This is the hash function for the endpoint hash table. */ |
| 626 | static inline int sctp_ep_hashfn(__u16 lport) | 638 | static inline int sctp_ep_hashfn(__u16 lport) |
| 627 | { | 639 | { |
| 628 | return (lport & (sctp_ep_hashsize - 1)); | 640 | return lport & (sctp_ep_hashsize - 1); |
| 629 | } | 641 | } |
| 630 | 642 | ||
| 631 | /* This is the hash function for the association hash table. */ | 643 | /* This is the hash function for the association hash table. */ |
| @@ -633,7 +645,7 @@ static inline int sctp_assoc_hashfn(__u16 lport, __u16 rport) | |||
| 633 | { | 645 | { |
| 634 | int h = (lport << 16) + rport; | 646 | int h = (lport << 16) + rport; |
| 635 | h ^= h>>8; | 647 | h ^= h>>8; |
| 636 | return (h & (sctp_assoc_hashsize - 1)); | 648 | return h & (sctp_assoc_hashsize - 1); |
| 637 | } | 649 | } |
| 638 | 650 | ||
| 639 | /* This is the hash function for the association hash table. This is | 651 | /* This is the hash function for the association hash table. This is |
| @@ -644,7 +656,7 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) | |||
| 644 | { | 656 | { |
| 645 | int h = (lport << 16) + rport; | 657 | int h = (lport << 16) + rport; |
| 646 | h ^= vtag; | 658 | h ^= vtag; |
| 647 | return (h & (sctp_assoc_hashsize-1)); | 659 | return h & (sctp_assoc_hashsize - 1); |
| 648 | } | 660 | } |
| 649 | 661 | ||
| 650 | #define sctp_for_each_hentry(epb, node, head) \ | 662 | #define sctp_for_each_hentry(epb, node, head) \ |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 4088c89a9055..9352d12f02de 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
| @@ -345,12 +345,12 @@ enum { | |||
| 345 | 345 | ||
| 346 | static inline int TSN_lt(__u32 s, __u32 t) | 346 | static inline int TSN_lt(__u32 s, __u32 t) |
| 347 | { | 347 | { |
| 348 | return (((s) - (t)) & TSN_SIGN_BIT); | 348 | return ((s) - (t)) & TSN_SIGN_BIT; |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | static inline int TSN_lte(__u32 s, __u32 t) | 351 | static inline int TSN_lte(__u32 s, __u32 t) |
| 352 | { | 352 | { |
| 353 | return (((s) == (t)) || (((s) - (t)) & TSN_SIGN_BIT)); | 353 | return ((s) == (t)) || (((s) - (t)) & TSN_SIGN_BIT); |
| 354 | } | 354 | } |
| 355 | 355 | ||
| 356 | /* Compare two SSNs */ | 356 | /* Compare two SSNs */ |
| @@ -369,12 +369,12 @@ enum { | |||
| 369 | 369 | ||
| 370 | static inline int SSN_lt(__u16 s, __u16 t) | 370 | static inline int SSN_lt(__u16 s, __u16 t) |
| 371 | { | 371 | { |
| 372 | return (((s) - (t)) & SSN_SIGN_BIT); | 372 | return ((s) - (t)) & SSN_SIGN_BIT; |
| 373 | } | 373 | } |
| 374 | 374 | ||
| 375 | static inline int SSN_lte(__u16 s, __u16 t) | 375 | static inline int SSN_lte(__u16 s, __u16 t) |
| 376 | { | 376 | { |
| 377 | return (((s) == (t)) || (((s) - (t)) & SSN_SIGN_BIT)); | 377 | return ((s) == (t)) || (((s) - (t)) & SSN_SIGN_BIT); |
| 378 | } | 378 | } |
| 379 | 379 | ||
| 380 | /* | 380 | /* |
| @@ -388,7 +388,7 @@ enum { | |||
| 388 | 388 | ||
| 389 | static inline int ADDIP_SERIAL_gte(__u16 s, __u16 t) | 389 | static inline int ADDIP_SERIAL_gte(__u16 s, __u16 t) |
| 390 | { | 390 | { |
| 391 | return (((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT)); | 391 | return ((s) == (t)) || (((t) - (s)) & ADDIP_SERIAL_SIGN_BIT); |
| 392 | } | 392 | } |
| 393 | 393 | ||
| 394 | /* Check VTAG of the packet matches the sender's own tag. */ | 394 | /* Check VTAG of the packet matches the sender's own tag. */ |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index f9e7473613bd..69fef4fb79c0 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
| @@ -847,7 +847,7 @@ void sctp_packet_free(struct sctp_packet *); | |||
| 847 | 847 | ||
| 848 | static inline int sctp_packet_empty(struct sctp_packet *packet) | 848 | static inline int sctp_packet_empty(struct sctp_packet *packet) |
| 849 | { | 849 | { |
| 850 | return (packet->size == packet->overhead); | 850 | return packet->size == packet->overhead; |
| 851 | } | 851 | } |
| 852 | 852 | ||
| 853 | /* This represents a remote transport address. | 853 | /* This represents a remote transport address. |
diff --git a/include/net/sctp/tsnmap.h b/include/net/sctp/tsnmap.h index 4aabc5a96cf6..e7728bc14ccf 100644 --- a/include/net/sctp/tsnmap.h +++ b/include/net/sctp/tsnmap.h | |||
| @@ -157,7 +157,7 @@ __u16 sctp_tsnmap_pending(struct sctp_tsnmap *map); | |||
| 157 | /* Is there a gap in the TSN map? */ | 157 | /* Is there a gap in the TSN map? */ |
| 158 | static inline int sctp_tsnmap_has_gap(const struct sctp_tsnmap *map) | 158 | static inline int sctp_tsnmap_has_gap(const struct sctp_tsnmap *map) |
| 159 | { | 159 | { |
| 160 | return (map->cumulative_tsn_ack_point != map->max_tsn_seen); | 160 | return map->cumulative_tsn_ack_point != map->max_tsn_seen; |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | /* Mark a duplicate TSN. Note: limit the storage of duplicate TSN | 163 | /* Mark a duplicate TSN. Note: limit the storage of duplicate TSN |
diff --git a/include/net/sock.h b/include/net/sock.h index ac53bfbdfe16..c7a736228ca2 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
| @@ -301,7 +301,7 @@ struct sock { | |||
| 301 | const struct cred *sk_peer_cred; | 301 | const struct cred *sk_peer_cred; |
| 302 | long sk_rcvtimeo; | 302 | long sk_rcvtimeo; |
| 303 | long sk_sndtimeo; | 303 | long sk_sndtimeo; |
| 304 | struct sk_filter *sk_filter; | 304 | struct sk_filter __rcu *sk_filter; |
| 305 | void *sk_protinfo; | 305 | void *sk_protinfo; |
| 306 | struct timer_list sk_timer; | 306 | struct timer_list sk_timer; |
| 307 | ktime_t sk_stamp; | 307 | ktime_t sk_stamp; |
| @@ -752,6 +752,7 @@ struct proto { | |||
| 752 | /* Keeping track of sk's, looking them up, and port selection methods. */ | 752 | /* Keeping track of sk's, looking them up, and port selection methods. */ |
| 753 | void (*hash)(struct sock *sk); | 753 | void (*hash)(struct sock *sk); |
| 754 | void (*unhash)(struct sock *sk); | 754 | void (*unhash)(struct sock *sk); |
| 755 | void (*rehash)(struct sock *sk); | ||
| 755 | int (*get_port)(struct sock *sk, unsigned short snum); | 756 | int (*get_port)(struct sock *sk, unsigned short snum); |
| 756 | 757 | ||
| 757 | /* Keeping track of sockets in use */ | 758 | /* Keeping track of sockets in use */ |
| @@ -1557,7 +1558,11 @@ static inline void sk_wake_async(struct sock *sk, int how, int band) | |||
| 1557 | } | 1558 | } |
| 1558 | 1559 | ||
| 1559 | #define SOCK_MIN_SNDBUF 2048 | 1560 | #define SOCK_MIN_SNDBUF 2048 |
| 1560 | #define SOCK_MIN_RCVBUF 256 | 1561 | /* |
| 1562 | * Since sk_rmem_alloc sums skb->truesize, even a small frame might need | ||
| 1563 | * sizeof(sk_buff) + MTU + padding, unless net driver perform copybreak | ||
| 1564 | */ | ||
| 1565 | #define SOCK_MIN_RCVBUF (2048 + sizeof(struct sk_buff)) | ||
| 1561 | 1566 | ||
| 1562 | static inline void sk_stream_moderate_sndbuf(struct sock *sk) | 1567 | static inline void sk_stream_moderate_sndbuf(struct sock *sk) |
| 1563 | { | 1568 | { |
| @@ -1669,17 +1674,13 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, | |||
| 1669 | 1674 | ||
| 1670 | /** | 1675 | /** |
| 1671 | * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped | 1676 | * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped |
| 1672 | * @msg: outgoing packet | ||
| 1673 | * @sk: socket sending this packet | 1677 | * @sk: socket sending this packet |
| 1674 | * @shtx: filled with instructions for time stamping | 1678 | * @tx_flags: filled with instructions for time stamping |
| 1675 | * | 1679 | * |
| 1676 | * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if | 1680 | * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if |
| 1677 | * parameters are invalid. | 1681 | * parameters are invalid. |
| 1678 | */ | 1682 | */ |
| 1679 | extern int sock_tx_timestamp(struct msghdr *msg, | 1683 | extern int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); |
| 1680 | struct sock *sk, | ||
| 1681 | union skb_shared_tx *shtx); | ||
| 1682 | |||
| 1683 | 1684 | ||
| 1684 | /** | 1685 | /** |
| 1685 | * sk_eat_skb - Release a skb if it is no longer needed | 1686 | * sk_eat_skb - Release a skb if it is no longer needed |
diff --git a/include/net/tc_act/tc_csum.h b/include/net/tc_act/tc_csum.h new file mode 100644 index 000000000000..9e8710be7a04 --- /dev/null +++ b/include/net/tc_act/tc_csum.h | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | #ifndef __NET_TC_CSUM_H | ||
| 2 | #define __NET_TC_CSUM_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | #include <net/act_api.h> | ||
| 6 | |||
| 7 | struct tcf_csum { | ||
| 8 | struct tcf_common common; | ||
| 9 | |||
| 10 | u32 update_flags; | ||
| 11 | }; | ||
| 12 | #define to_tcf_csum(pc) \ | ||
| 13 | container_of(pc,struct tcf_csum,common) | ||
| 14 | |||
| 15 | #endif /* __NET_TC_CSUM_H */ | ||
diff --git a/include/net/tcp.h b/include/net/tcp.h index df6a2eb20193..4fee0424af7e 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
| @@ -268,11 +268,21 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3) | |||
| 268 | return seq3 - seq2 >= seq1 - seq2; | 268 | return seq3 - seq2 >= seq1 - seq2; |
| 269 | } | 269 | } |
| 270 | 270 | ||
| 271 | static inline int tcp_too_many_orphans(struct sock *sk, int num) | 271 | static inline bool tcp_too_many_orphans(struct sock *sk, int shift) |
| 272 | { | 272 | { |
| 273 | return (num > sysctl_tcp_max_orphans) || | 273 | struct percpu_counter *ocp = sk->sk_prot->orphan_count; |
| 274 | (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | 274 | int orphans = percpu_counter_read_positive(ocp); |
| 275 | atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]); | 275 | |
| 276 | if (orphans << shift > sysctl_tcp_max_orphans) { | ||
| 277 | orphans = percpu_counter_sum_positive(ocp); | ||
| 278 | if (orphans << shift > sysctl_tcp_max_orphans) | ||
| 279 | return true; | ||
| 280 | } | ||
| 281 | |||
| 282 | if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF && | ||
| 283 | atomic_read(&tcp_memory_allocated) > sysctl_tcp_mem[2]) | ||
| 284 | return true; | ||
| 285 | return false; | ||
| 276 | } | 286 | } |
| 277 | 287 | ||
| 278 | /* syncookies: remember time of last synqueue overflow */ | 288 | /* syncookies: remember time of last synqueue overflow */ |
| @@ -336,8 +346,6 @@ static inline void tcp_dec_quickack_mode(struct sock *sk, | |||
| 336 | } | 346 | } |
| 337 | } | 347 | } |
| 338 | 348 | ||
| 339 | extern void tcp_enter_quickack_mode(struct sock *sk); | ||
| 340 | |||
| 341 | #define TCP_ECN_OK 1 | 349 | #define TCP_ECN_OK 1 |
| 342 | #define TCP_ECN_QUEUE_CWR 2 | 350 | #define TCP_ECN_QUEUE_CWR 2 |
| 343 | #define TCP_ECN_DEMAND_CWR 4 | 351 | #define TCP_ECN_DEMAND_CWR 4 |
| @@ -465,8 +473,22 @@ extern unsigned int tcp_current_mss(struct sock *sk); | |||
| 465 | /* Bound MSS / TSO packet size with the half of the window */ | 473 | /* Bound MSS / TSO packet size with the half of the window */ |
| 466 | static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) | 474 | static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) |
| 467 | { | 475 | { |
| 468 | if (tp->max_window && pktsize > (tp->max_window >> 1)) | 476 | int cutoff; |
| 469 | return max(tp->max_window >> 1, 68U - tp->tcp_header_len); | 477 | |
| 478 | /* When peer uses tiny windows, there is no use in packetizing | ||
| 479 | * to sub-MSS pieces for the sake of SWS or making sure there | ||
| 480 | * are enough packets in the pipe for fast recovery. | ||
| 481 | * | ||
| 482 | * On the other hand, for extremely large MSS devices, handling | ||
| 483 | * smaller than MSS windows in this way does make sense. | ||
| 484 | */ | ||
| 485 | if (tp->max_window >= 512) | ||
| 486 | cutoff = (tp->max_window >> 1); | ||
| 487 | else | ||
| 488 | cutoff = tp->max_window; | ||
| 489 | |||
| 490 | if (cutoff && pktsize > cutoff) | ||
| 491 | return max_t(int, cutoff, 68U - tp->tcp_header_len); | ||
| 470 | else | 492 | else |
| 471 | return pktsize; | 493 | return pktsize; |
| 472 | } | 494 | } |
| @@ -779,6 +801,15 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk) | |||
| 779 | /* Use define here intentionally to get WARN_ON location shown at the caller */ | 801 | /* Use define here intentionally to get WARN_ON location shown at the caller */ |
| 780 | #define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) | 802 | #define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) |
| 781 | 803 | ||
| 804 | /* | ||
| 805 | * Convert RFC 3390 larger initial window into an equivalent number of packets. | ||
| 806 | * This is based on the numbers specified in RFC 5681, 3.1. | ||
| 807 | */ | ||
| 808 | static inline u32 rfc3390_bytes_to_packets(const u32 smss) | ||
| 809 | { | ||
| 810 | return smss <= 1095 ? 4 : (smss > 2190 ? 2 : 3); | ||
| 811 | } | ||
| 812 | |||
| 782 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); | 813 | extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); |
| 783 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); | 814 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); |
| 784 | 815 | ||
diff --git a/include/net/tipc/tipc.h b/include/net/tipc/tipc.h index 15af6dca0b49..1e0645e1eed2 100644 --- a/include/net/tipc/tipc.h +++ b/include/net/tipc/tipc.h | |||
| @@ -50,8 +50,6 @@ | |||
| 50 | * TIPC operating mode routines | 50 | * TIPC operating mode routines |
| 51 | */ | 51 | */ |
| 52 | 52 | ||
| 53 | u32 tipc_get_addr(void); | ||
| 54 | |||
| 55 | #define TIPC_NOT_RUNNING 0 | 53 | #define TIPC_NOT_RUNNING 0 |
| 56 | #define TIPC_NODE_MODE 1 | 54 | #define TIPC_NODE_MODE 1 |
| 57 | #define TIPC_NET_MODE 2 | 55 | #define TIPC_NET_MODE 2 |
| @@ -62,8 +60,6 @@ int tipc_attach(unsigned int *userref, tipc_mode_event, void *usr_handle); | |||
| 62 | 60 | ||
| 63 | void tipc_detach(unsigned int userref); | 61 | void tipc_detach(unsigned int userref); |
| 64 | 62 | ||
| 65 | int tipc_get_mode(void); | ||
| 66 | |||
| 67 | /* | 63 | /* |
| 68 | * TIPC port manipulation routines | 64 | * TIPC port manipulation routines |
| 69 | */ | 65 | */ |
| @@ -153,12 +149,6 @@ int tipc_disconnect(u32 portref); | |||
| 153 | 149 | ||
| 154 | int tipc_shutdown(u32 ref); | 150 | int tipc_shutdown(u32 ref); |
| 155 | 151 | ||
| 156 | int tipc_isconnected(u32 portref, int *isconnected); | ||
| 157 | |||
| 158 | int tipc_peer(u32 portref, struct tipc_portid *peer); | ||
| 159 | |||
| 160 | int tipc_ref_valid(u32 portref); | ||
| 161 | |||
| 162 | /* | 152 | /* |
| 163 | * TIPC messaging routines | 153 | * TIPC messaging routines |
| 164 | */ | 154 | */ |
| @@ -170,38 +160,12 @@ int tipc_send(u32 portref, | |||
| 170 | unsigned int num_sect, | 160 | unsigned int num_sect, |
| 171 | struct iovec const *msg_sect); | 161 | struct iovec const *msg_sect); |
| 172 | 162 | ||
| 173 | int tipc_send_buf(u32 portref, | ||
| 174 | struct sk_buff *buf, | ||
| 175 | unsigned int dsz); | ||
| 176 | |||
| 177 | int tipc_send2name(u32 portref, | 163 | int tipc_send2name(u32 portref, |
| 178 | struct tipc_name const *name, | 164 | struct tipc_name const *name, |
| 179 | u32 domain, | 165 | u32 domain, |
| 180 | unsigned int num_sect, | 166 | unsigned int num_sect, |
| 181 | struct iovec const *msg_sect); | 167 | struct iovec const *msg_sect); |
| 182 | 168 | ||
| 183 | int tipc_send_buf2name(u32 portref, | ||
| 184 | struct tipc_name const *name, | ||
| 185 | u32 domain, | ||
| 186 | struct sk_buff *buf, | ||
| 187 | unsigned int dsz); | ||
| 188 | |||
| 189 | int tipc_forward2name(u32 portref, | ||
| 190 | struct tipc_name const *name, | ||
| 191 | u32 domain, | ||
| 192 | unsigned int section_count, | ||
| 193 | struct iovec const *msg_sect, | ||
| 194 | struct tipc_portid const *origin, | ||
| 195 | unsigned int importance); | ||
| 196 | |||
| 197 | int tipc_forward_buf2name(u32 portref, | ||
| 198 | struct tipc_name const *name, | ||
| 199 | u32 domain, | ||
| 200 | struct sk_buff *buf, | ||
| 201 | unsigned int dsz, | ||
| 202 | struct tipc_portid const *orig, | ||
| 203 | unsigned int importance); | ||
| 204 | |||
| 205 | int tipc_send2port(u32 portref, | 169 | int tipc_send2port(u32 portref, |
| 206 | struct tipc_portid const *dest, | 170 | struct tipc_portid const *dest, |
| 207 | unsigned int num_sect, | 171 | unsigned int num_sect, |
| @@ -212,46 +176,11 @@ int tipc_send_buf2port(u32 portref, | |||
| 212 | struct sk_buff *buf, | 176 | struct sk_buff *buf, |
| 213 | unsigned int dsz); | 177 | unsigned int dsz); |
| 214 | 178 | ||
| 215 | int tipc_forward2port(u32 portref, | ||
| 216 | struct tipc_portid const *dest, | ||
| 217 | unsigned int num_sect, | ||
| 218 | struct iovec const *msg_sect, | ||
| 219 | struct tipc_portid const *origin, | ||
| 220 | unsigned int importance); | ||
| 221 | |||
| 222 | int tipc_forward_buf2port(u32 portref, | ||
| 223 | struct tipc_portid const *dest, | ||
| 224 | struct sk_buff *buf, | ||
| 225 | unsigned int dsz, | ||
| 226 | struct tipc_portid const *orig, | ||
| 227 | unsigned int importance); | ||
| 228 | |||
| 229 | int tipc_multicast(u32 portref, | 179 | int tipc_multicast(u32 portref, |
| 230 | struct tipc_name_seq const *seq, | 180 | struct tipc_name_seq const *seq, |
| 231 | u32 domain, /* currently unused */ | 181 | u32 domain, /* currently unused */ |
| 232 | unsigned int section_count, | 182 | unsigned int section_count, |
| 233 | struct iovec const *msg); | 183 | struct iovec const *msg); |
| 234 | |||
| 235 | #if 0 | ||
| 236 | int tipc_multicast_buf(u32 portref, | ||
| 237 | struct tipc_name_seq const *seq, | ||
| 238 | u32 domain, | ||
| 239 | void *buf, | ||
| 240 | unsigned int size); | ||
| 241 | #endif | ||
| 242 | |||
| 243 | /* | ||
| 244 | * TIPC subscription routines | ||
| 245 | */ | ||
| 246 | |||
| 247 | int tipc_ispublished(struct tipc_name const *name); | ||
| 248 | |||
| 249 | /* | ||
| 250 | * Get number of available nodes within specified domain (excluding own node) | ||
| 251 | */ | ||
| 252 | |||
| 253 | unsigned int tipc_available_nodes(const u32 domain); | ||
| 254 | |||
| 255 | #endif | 184 | #endif |
| 256 | 185 | ||
| 257 | #endif | 186 | #endif |
diff --git a/include/net/tipc/tipc_msg.h b/include/net/tipc/tipc_msg.h index 2e159a812f83..ffe50b4e7b93 100644 --- a/include/net/tipc/tipc_msg.h +++ b/include/net/tipc/tipc_msg.h | |||
| @@ -107,7 +107,7 @@ static inline u32 msg_hdr_sz(struct tipc_msg *m) | |||
| 107 | 107 | ||
| 108 | static inline int msg_short(struct tipc_msg *m) | 108 | static inline int msg_short(struct tipc_msg *m) |
| 109 | { | 109 | { |
| 110 | return (msg_hdr_sz(m) == 24); | 110 | return msg_hdr_sz(m) == 24; |
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | static inline u32 msg_size(struct tipc_msg *m) | 113 | static inline u32 msg_size(struct tipc_msg *m) |
| @@ -117,7 +117,7 @@ static inline u32 msg_size(struct tipc_msg *m) | |||
| 117 | 117 | ||
| 118 | static inline u32 msg_data_sz(struct tipc_msg *m) | 118 | static inline u32 msg_data_sz(struct tipc_msg *m) |
| 119 | { | 119 | { |
| 120 | return (msg_size(m) - msg_hdr_sz(m)); | 120 | return msg_size(m) - msg_hdr_sz(m); |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | static inline unchar *msg_data(struct tipc_msg *m) | 123 | static inline unchar *msg_data(struct tipc_msg *m) |
| @@ -132,17 +132,17 @@ static inline u32 msg_type(struct tipc_msg *m) | |||
| 132 | 132 | ||
| 133 | static inline u32 msg_named(struct tipc_msg *m) | 133 | static inline u32 msg_named(struct tipc_msg *m) |
| 134 | { | 134 | { |
| 135 | return (msg_type(m) == TIPC_NAMED_MSG); | 135 | return msg_type(m) == TIPC_NAMED_MSG; |
| 136 | } | 136 | } |
| 137 | 137 | ||
| 138 | static inline u32 msg_mcast(struct tipc_msg *m) | 138 | static inline u32 msg_mcast(struct tipc_msg *m) |
| 139 | { | 139 | { |
| 140 | return (msg_type(m) == TIPC_MCAST_MSG); | 140 | return msg_type(m) == TIPC_MCAST_MSG; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | static inline u32 msg_connected(struct tipc_msg *m) | 143 | static inline u32 msg_connected(struct tipc_msg *m) |
| 144 | { | 144 | { |
| 145 | return (msg_type(m) == TIPC_CONN_MSG); | 145 | return msg_type(m) == TIPC_CONN_MSG; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | static inline u32 msg_errcode(struct tipc_msg *m) | 148 | static inline u32 msg_errcode(struct tipc_msg *m) |
diff --git a/include/net/tipc/tipc_port.h b/include/net/tipc/tipc_port.h index c54917cbfa48..1893aaf49426 100644 --- a/include/net/tipc/tipc_port.h +++ b/include/net/tipc/tipc_port.h | |||
| @@ -88,8 +88,6 @@ void tipc_acknowledge(u32 port_ref,u32 ack); | |||
| 88 | 88 | ||
| 89 | struct tipc_port *tipc_get_port(const u32 ref); | 89 | struct tipc_port *tipc_get_port(const u32 ref); |
| 90 | 90 | ||
| 91 | void *tipc_get_handle(const u32 ref); | ||
| 92 | |||
| 93 | /* | 91 | /* |
| 94 | * The following routines require that the port be locked on entry | 92 | * The following routines require that the port be locked on entry |
| 95 | */ | 93 | */ |
diff --git a/include/net/udp.h b/include/net/udp.h index 7abdf305da50..200b82848c9a 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
| @@ -151,6 +151,7 @@ static inline void udp_lib_hash(struct sock *sk) | |||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | extern void udp_lib_unhash(struct sock *sk); | 153 | extern void udp_lib_unhash(struct sock *sk); |
| 154 | extern void udp_lib_rehash(struct sock *sk, u16 new_hash); | ||
| 154 | 155 | ||
| 155 | static inline void udp_lib_close(struct sock *sk, long timeout) | 156 | static inline void udp_lib_close(struct sock *sk, long timeout) |
| 156 | { | 157 | { |
| @@ -182,6 +183,9 @@ extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, | |||
| 182 | extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, | 183 | extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, |
| 183 | __be32 daddr, __be16 dport, | 184 | __be32 daddr, __be16 dport, |
| 184 | int dif); | 185 | int dif); |
| 186 | extern struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be16 sport, | ||
| 187 | const struct in6_addr *daddr, __be16 dport, | ||
| 188 | int dif); | ||
| 185 | 189 | ||
| 186 | /* | 190 | /* |
| 187 | * SNMP statistics for UDP and UDP-Lite | 191 | * SNMP statistics for UDP and UDP-Lite |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index fc8f36dd0f5c..bcfb6b24b019 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
| @@ -298,8 +298,8 @@ struct xfrm_state_afinfo { | |||
| 298 | const struct xfrm_type *type_map[IPPROTO_MAX]; | 298 | const struct xfrm_type *type_map[IPPROTO_MAX]; |
| 299 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; | 299 | struct xfrm_mode *mode_map[XFRM_MODE_MAX]; |
| 300 | int (*init_flags)(struct xfrm_state *x); | 300 | int (*init_flags)(struct xfrm_state *x); |
| 301 | void (*init_tempsel)(struct xfrm_state *x, struct flowi *fl, | 301 | void (*init_tempsel)(struct xfrm_selector *sel, struct flowi *fl); |
| 302 | struct xfrm_tmpl *tmpl, | 302 | void (*init_temprop)(struct xfrm_state *x, struct xfrm_tmpl *tmpl, |
| 303 | xfrm_address_t *daddr, xfrm_address_t *saddr); | 303 | xfrm_address_t *daddr, xfrm_address_t *saddr); |
| 304 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); | 304 | int (*tmpl_sort)(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n); |
| 305 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); | 305 | int (*state_sort)(struct xfrm_state **dst, struct xfrm_state **src, int n); |
| @@ -1264,7 +1264,7 @@ struct xfrm_tunnel { | |||
| 1264 | int (*handler)(struct sk_buff *skb); | 1264 | int (*handler)(struct sk_buff *skb); |
| 1265 | int (*err_handler)(struct sk_buff *skb, u32 info); | 1265 | int (*err_handler)(struct sk_buff *skb, u32 info); |
| 1266 | 1266 | ||
| 1267 | struct xfrm_tunnel *next; | 1267 | struct xfrm_tunnel __rcu *next; |
| 1268 | int priority; | 1268 | int priority; |
| 1269 | }; | 1269 | }; |
| 1270 | 1270 | ||
| @@ -1272,7 +1272,7 @@ struct xfrm6_tunnel { | |||
| 1272 | int (*handler)(struct sk_buff *skb); | 1272 | int (*handler)(struct sk_buff *skb); |
| 1273 | int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, | 1273 | int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, |
| 1274 | u8 type, u8 code, int offset, __be32 info); | 1274 | u8 type, u8 code, int offset, __be32 info); |
| 1275 | struct xfrm6_tunnel *next; | 1275 | struct xfrm6_tunnel __rcu *next; |
| 1276 | int priority; | 1276 | int priority; |
| 1277 | }; | 1277 | }; |
| 1278 | 1278 | ||
| @@ -1419,7 +1419,6 @@ extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | |||
| 1419 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); | 1419 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); |
| 1420 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); | 1420 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); |
| 1421 | extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); | 1421 | extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); |
| 1422 | extern void xfrm6_tunnel_free_spi(struct net *net, xfrm_address_t *saddr); | ||
| 1423 | extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr); | 1422 | extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr); |
| 1424 | extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); | 1423 | extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
| 1425 | extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | 1424 | extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); |
| @@ -1466,8 +1465,6 @@ struct xfrm_state *xfrm_find_acq(struct net *net, struct xfrm_mark *mark, | |||
| 1466 | xfrm_address_t *saddr, int create, | 1465 | xfrm_address_t *saddr, int create, |
| 1467 | unsigned short family); | 1466 | unsigned short family); |
| 1468 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); | 1467 | extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); |
| 1469 | extern int xfrm_bundle_ok(struct xfrm_policy *pol, struct xfrm_dst *xdst, | ||
| 1470 | struct flowi *fl, int family, int strict); | ||
| 1471 | 1468 | ||
| 1472 | #ifdef CONFIG_XFRM_MIGRATE | 1469 | #ifdef CONFIG_XFRM_MIGRATE |
| 1473 | extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, | 1470 | extern int km_migrate(struct xfrm_selector *sel, u8 dir, u8 type, |
