diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-20 16:43:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-20 16:43:21 -0400 |
commit | 06f4e926d256d902dd9a53dcb400fd74974ce087 (patch) | |
tree | 0b438b67f5f0eff6fd617bc497a9dace6164a488 /include/net | |
parent | 8e7bfcbab3825d1b404d615cb1b54f44ff81f981 (diff) | |
parent | d93515611bbc70c2fe4db232e5feb448ed8e4cc9 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1446 commits)
macvlan: fix panic if lowerdev in a bond
tg3: Add braces around 5906 workaround.
tg3: Fix NETIF_F_LOOPBACK error
macvlan: remove one synchronize_rcu() call
networking: NET_CLS_ROUTE4 depends on INET
irda: Fix error propagation in ircomm_lmp_connect_response()
irda: Kill set but unused variable 'bytes' in irlan_check_command_param()
irda: Kill set but unused variable 'clen' in ircomm_connect_indication()
rxrpc: Fix set but unused variable 'usage' in rxrpc_get_transport()
be2net: Kill set but unused variable 'req' in lancer_fw_download()
irda: Kill set but unused vars 'saddr' and 'daddr' in irlan_provider_connect_indication()
atl1c: atl1c_resume() is only used when CONFIG_PM_SLEEP is defined.
rxrpc: Fix set but unused variable 'usage' in rxrpc_get_peer().
rxrpc: Kill set but unused variable 'local' in rxrpc_UDP_error_handler()
rxrpc: Kill set but unused variable 'sp' in rxrpc_process_connection()
rxrpc: Kill set but unused variable 'sp' in rxrpc_rotate_tx_window()
pkt_sched: Kill set but unused variable 'protocol' in tc_classify()
isdn: capi: Use pr_debug() instead of ifdefs.
tg3: Update version to 3.119
tg3: Apply rx_discards fix to 5719/5720
...
Fix up trivial conflicts in arch/x86/Kconfig and net/mac80211/agg-tx.c
as per Davem.
Diffstat (limited to 'include/net')
55 files changed, 1100 insertions, 561 deletions
diff --git a/include/net/addrconf.h b/include/net/addrconf.h index 23710aa6a181..582e4ae70753 100644 --- a/include/net/addrconf.h +++ b/include/net/addrconf.h | |||
@@ -42,8 +42,6 @@ struct prefix_info { | |||
42 | }; | 42 | }; |
43 | 43 | ||
44 | 44 | ||
45 | #ifdef __KERNEL__ | ||
46 | |||
47 | #include <linux/netdevice.h> | 45 | #include <linux/netdevice.h> |
48 | #include <net/if_inet6.h> | 46 | #include <net/if_inet6.h> |
49 | #include <net/ipv6.h> | 47 | #include <net/ipv6.h> |
@@ -61,16 +59,16 @@ extern int addrconf_set_dstaddr(struct net *net, | |||
61 | void __user *arg); | 59 | void __user *arg); |
62 | 60 | ||
63 | extern int ipv6_chk_addr(struct net *net, | 61 | extern int ipv6_chk_addr(struct net *net, |
64 | struct in6_addr *addr, | 62 | const struct in6_addr *addr, |
65 | struct net_device *dev, | 63 | struct net_device *dev, |
66 | int strict); | 64 | int strict); |
67 | 65 | ||
68 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) | 66 | #if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) |
69 | extern int ipv6_chk_home_addr(struct net *net, | 67 | extern int ipv6_chk_home_addr(struct net *net, |
70 | struct in6_addr *addr); | 68 | const struct in6_addr *addr); |
71 | #endif | 69 | #endif |
72 | 70 | ||
73 | extern int ipv6_chk_prefix(struct in6_addr *addr, | 71 | extern int ipv6_chk_prefix(const struct in6_addr *addr, |
74 | struct net_device *dev); | 72 | struct net_device *dev); |
75 | 73 | ||
76 | extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, | 74 | extern struct inet6_ifaddr *ipv6_get_ifaddr(struct net *net, |
@@ -89,9 +87,9 @@ extern int ipv6_get_lladdr(struct net_device *dev, | |||
89 | extern int ipv6_rcv_saddr_equal(const struct sock *sk, | 87 | extern int ipv6_rcv_saddr_equal(const struct sock *sk, |
90 | const struct sock *sk2); | 88 | const struct sock *sk2); |
91 | extern void addrconf_join_solict(struct net_device *dev, | 89 | extern void addrconf_join_solict(struct net_device *dev, |
92 | struct in6_addr *addr); | 90 | const struct in6_addr *addr); |
93 | extern void addrconf_leave_solict(struct inet6_dev *idev, | 91 | extern void addrconf_leave_solict(struct inet6_dev *idev, |
94 | struct in6_addr *addr); | 92 | const struct in6_addr *addr); |
95 | 93 | ||
96 | static inline unsigned long addrconf_timeout_fixup(u32 timeout, | 94 | static inline unsigned long addrconf_timeout_fixup(u32 timeout, |
97 | unsigned unit) | 95 | unsigned unit) |
@@ -158,15 +156,15 @@ extern void addrconf_prefix_rcv(struct net_device *dev, u8 *opt, int len); | |||
158 | /* | 156 | /* |
159 | * anycast prototypes (anycast.c) | 157 | * anycast prototypes (anycast.c) |
160 | */ | 158 | */ |
161 | extern int ipv6_sock_ac_join(struct sock *sk,int ifindex,struct in6_addr *addr); | 159 | extern int ipv6_sock_ac_join(struct sock *sk,int ifindex, const struct in6_addr *addr); |
162 | extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex,struct in6_addr *addr); | 160 | extern int ipv6_sock_ac_drop(struct sock *sk,int ifindex, const struct in6_addr *addr); |
163 | extern void ipv6_sock_ac_close(struct sock *sk); | 161 | extern void ipv6_sock_ac_close(struct sock *sk); |
164 | extern int inet6_ac_check(struct sock *sk, struct in6_addr *addr, int ifindex); | 162 | extern int inet6_ac_check(struct sock *sk, const struct in6_addr *addr, int ifindex); |
165 | 163 | ||
166 | extern int ipv6_dev_ac_inc(struct net_device *dev, struct in6_addr *addr); | 164 | extern int ipv6_dev_ac_inc(struct net_device *dev, const struct in6_addr *addr); |
167 | extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, struct in6_addr *addr); | 165 | extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr); |
168 | extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, | 166 | extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev, |
169 | struct in6_addr *addr); | 167 | const struct in6_addr *addr); |
170 | 168 | ||
171 | 169 | ||
172 | /* Device notifier */ | 170 | /* Device notifier */ |
@@ -285,4 +283,3 @@ extern void if6_proc_exit(void); | |||
285 | #endif | 283 | #endif |
286 | 284 | ||
287 | #endif | 285 | #endif |
288 | #endif | ||
diff --git a/include/net/af_rxrpc.h b/include/net/af_rxrpc.h index 00c2eaa07c25..03e6e9453623 100644 --- a/include/net/af_rxrpc.h +++ b/include/net/af_rxrpc.h | |||
@@ -12,8 +12,6 @@ | |||
12 | #ifndef _NET_RXRPC_H | 12 | #ifndef _NET_RXRPC_H |
13 | #define _NET_RXRPC_H | 13 | #define _NET_RXRPC_H |
14 | 14 | ||
15 | #ifdef __KERNEL__ | ||
16 | |||
17 | #include <linux/rxrpc.h> | 15 | #include <linux/rxrpc.h> |
18 | 16 | ||
19 | struct rxrpc_call; | 17 | struct rxrpc_call; |
@@ -53,5 +51,4 @@ extern struct rxrpc_call *rxrpc_kernel_accept_call(struct socket *, | |||
53 | unsigned long); | 51 | unsigned long); |
54 | extern int rxrpc_kernel_reject_call(struct socket *); | 52 | extern int rxrpc_kernel_reject_call(struct socket *); |
55 | 53 | ||
56 | #endif /* __KERNEL__ */ | ||
57 | #endif /* _NET_RXRPC_H */ | 54 | #endif /* _NET_RXRPC_H */ |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 18e5c3f67580..91ab5b01678a 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -41,7 +41,6 @@ struct unix_skb_parms { | |||
41 | spin_lock_nested(&unix_sk(s)->lock, \ | 41 | spin_lock_nested(&unix_sk(s)->lock, \ |
42 | SINGLE_DEPTH_NESTING) | 42 | SINGLE_DEPTH_NESTING) |
43 | 43 | ||
44 | #ifdef __KERNEL__ | ||
45 | /* The AF_UNIX socket */ | 44 | /* The AF_UNIX socket */ |
46 | struct unix_sock { | 45 | struct unix_sock { |
47 | /* WARNING: sk has to be the first member */ | 46 | /* WARNING: sk has to be the first member */ |
@@ -72,4 +71,3 @@ static inline int unix_sysctl_register(struct net *net) { return 0; } | |||
72 | static inline void unix_sysctl_unregister(struct net *net) {} | 71 | static inline void unix_sysctl_unregister(struct net *net) {} |
73 | #endif | 72 | #endif |
74 | #endif | 73 | #endif |
75 | #endif | ||
diff --git a/include/net/atmclip.h b/include/net/atmclip.h index 467c531b8a7e..497ef6444a7a 100644 --- a/include/net/atmclip.h +++ b/include/net/atmclip.h | |||
@@ -54,8 +54,6 @@ struct clip_priv { | |||
54 | }; | 54 | }; |
55 | 55 | ||
56 | 56 | ||
57 | #ifdef __KERNEL__ | ||
58 | extern struct neigh_table *clip_tbl_hook; | 57 | extern struct neigh_table *clip_tbl_hook; |
59 | #endif | ||
60 | 58 | ||
61 | #endif | 59 | #endif |
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 2c0d309c7381..0c20227e57f6 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h | |||
@@ -246,6 +246,15 @@ enum { | |||
246 | #define HCI_AT_GENERAL_BONDING 0x04 | 246 | #define HCI_AT_GENERAL_BONDING 0x04 |
247 | #define HCI_AT_GENERAL_BONDING_MITM 0x05 | 247 | #define HCI_AT_GENERAL_BONDING_MITM 0x05 |
248 | 248 | ||
249 | /* Link Key types */ | ||
250 | #define HCI_LK_COMBINATION 0x00 | ||
251 | #define HCI_LK_LOCAL_UNIT 0x01 | ||
252 | #define HCI_LK_REMOTE_UNIT 0x02 | ||
253 | #define HCI_LK_DEBUG_COMBINATION 0x03 | ||
254 | #define HCI_LK_UNAUTH_COMBINATION 0x04 | ||
255 | #define HCI_LK_AUTH_COMBINATION 0x05 | ||
256 | #define HCI_LK_CHANGED_COMBINATION 0x06 | ||
257 | |||
249 | /* ----- HCI Commands ---- */ | 258 | /* ----- HCI Commands ---- */ |
250 | #define HCI_OP_NOP 0x0000 | 259 | #define HCI_OP_NOP 0x0000 |
251 | 260 | ||
@@ -428,6 +437,18 @@ struct hci_rp_user_confirm_reply { | |||
428 | 437 | ||
429 | #define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d | 438 | #define HCI_OP_USER_CONFIRM_NEG_REPLY 0x042d |
430 | 439 | ||
440 | #define HCI_OP_REMOTE_OOB_DATA_REPLY 0x0430 | ||
441 | struct hci_cp_remote_oob_data_reply { | ||
442 | bdaddr_t bdaddr; | ||
443 | __u8 hash[16]; | ||
444 | __u8 randomizer[16]; | ||
445 | } __packed; | ||
446 | |||
447 | #define HCI_OP_REMOTE_OOB_DATA_NEG_REPLY 0x0433 | ||
448 | struct hci_cp_remote_oob_data_neg_reply { | ||
449 | bdaddr_t bdaddr; | ||
450 | } __packed; | ||
451 | |||
431 | #define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 | 452 | #define HCI_OP_IO_CAPABILITY_NEG_REPLY 0x0434 |
432 | struct hci_cp_io_capability_neg_reply { | 453 | struct hci_cp_io_capability_neg_reply { |
433 | bdaddr_t bdaddr; | 454 | bdaddr_t bdaddr; |
@@ -537,15 +558,17 @@ struct hci_cp_delete_stored_link_key { | |||
537 | __u8 delete_all; | 558 | __u8 delete_all; |
538 | } __packed; | 559 | } __packed; |
539 | 560 | ||
561 | #define HCI_MAX_NAME_LENGTH 248 | ||
562 | |||
540 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 | 563 | #define HCI_OP_WRITE_LOCAL_NAME 0x0c13 |
541 | struct hci_cp_write_local_name { | 564 | struct hci_cp_write_local_name { |
542 | __u8 name[248]; | 565 | __u8 name[HCI_MAX_NAME_LENGTH]; |
543 | } __packed; | 566 | } __packed; |
544 | 567 | ||
545 | #define HCI_OP_READ_LOCAL_NAME 0x0c14 | 568 | #define HCI_OP_READ_LOCAL_NAME 0x0c14 |
546 | struct hci_rp_read_local_name { | 569 | struct hci_rp_read_local_name { |
547 | __u8 status; | 570 | __u8 status; |
548 | __u8 name[248]; | 571 | __u8 name[HCI_MAX_NAME_LENGTH]; |
549 | } __packed; | 572 | } __packed; |
550 | 573 | ||
551 | #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 | 574 | #define HCI_OP_WRITE_CA_TIMEOUT 0x0c16 |
@@ -602,6 +625,14 @@ struct hci_cp_host_buffer_size { | |||
602 | 625 | ||
603 | #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 | 626 | #define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 |
604 | 627 | ||
628 | #define HCI_MAX_EIR_LENGTH 240 | ||
629 | |||
630 | #define HCI_OP_WRITE_EIR 0x0c52 | ||
631 | struct hci_cp_write_eir { | ||
632 | uint8_t fec; | ||
633 | uint8_t data[HCI_MAX_EIR_LENGTH]; | ||
634 | } __packed; | ||
635 | |||
605 | #define HCI_OP_READ_SSP_MODE 0x0c55 | 636 | #define HCI_OP_READ_SSP_MODE 0x0c55 |
606 | struct hci_rp_read_ssp_mode { | 637 | struct hci_rp_read_ssp_mode { |
607 | __u8 status; | 638 | __u8 status; |
@@ -613,6 +644,13 @@ struct hci_cp_write_ssp_mode { | |||
613 | __u8 mode; | 644 | __u8 mode; |
614 | } __packed; | 645 | } __packed; |
615 | 646 | ||
647 | #define HCI_OP_READ_LOCAL_OOB_DATA 0x0c57 | ||
648 | struct hci_rp_read_local_oob_data { | ||
649 | __u8 status; | ||
650 | __u8 hash[16]; | ||
651 | __u8 randomizer[16]; | ||
652 | } __packed; | ||
653 | |||
616 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 | 654 | #define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58 |
617 | 655 | ||
618 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 | 656 | #define HCI_OP_READ_LOCAL_VERSION 0x1001 |
@@ -747,7 +785,7 @@ struct hci_ev_auth_complete { | |||
747 | struct hci_ev_remote_name { | 785 | struct hci_ev_remote_name { |
748 | __u8 status; | 786 | __u8 status; |
749 | bdaddr_t bdaddr; | 787 | bdaddr_t bdaddr; |
750 | __u8 name[248]; | 788 | __u8 name[HCI_MAX_NAME_LENGTH]; |
751 | } __packed; | 789 | } __packed; |
752 | 790 | ||
753 | #define HCI_EV_ENCRYPT_CHANGE 0x08 | 791 | #define HCI_EV_ENCRYPT_CHANGE 0x08 |
@@ -955,6 +993,11 @@ struct hci_ev_user_confirm_req { | |||
955 | __le32 passkey; | 993 | __le32 passkey; |
956 | } __packed; | 994 | } __packed; |
957 | 995 | ||
996 | #define HCI_EV_REMOTE_OOB_DATA_REQUEST 0x35 | ||
997 | struct hci_ev_remote_oob_data_request { | ||
998 | bdaddr_t bdaddr; | ||
999 | } __packed; | ||
1000 | |||
958 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 | 1001 | #define HCI_EV_SIMPLE_PAIR_COMPLETE 0x36 |
959 | struct hci_ev_simple_pair_complete { | 1002 | struct hci_ev_simple_pair_complete { |
960 | __u8 status; | 1003 | __u8 status; |
@@ -1033,7 +1076,6 @@ struct hci_sco_hdr { | |||
1033 | __u8 dlen; | 1076 | __u8 dlen; |
1034 | } __packed; | 1077 | } __packed; |
1035 | 1078 | ||
1036 | #ifdef __KERNEL__ | ||
1037 | #include <linux/skbuff.h> | 1079 | #include <linux/skbuff.h> |
1038 | static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) | 1080 | static inline struct hci_event_hdr *hci_event_hdr(const struct sk_buff *skb) |
1039 | { | 1081 | { |
@@ -1049,7 +1091,6 @@ static inline struct hci_sco_hdr *hci_sco_hdr(const struct sk_buff *skb) | |||
1049 | { | 1091 | { |
1050 | return (struct hci_sco_hdr *) skb->data; | 1092 | return (struct hci_sco_hdr *) skb->data; |
1051 | } | 1093 | } |
1052 | #endif | ||
1053 | 1094 | ||
1054 | /* Command opcode pack/unpack */ | 1095 | /* Command opcode pack/unpack */ |
1055 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) | 1096 | #define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10)) |
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 441dadbf6a89..6c994c004d15 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -82,6 +82,13 @@ struct link_key { | |||
82 | u8 pin_len; | 82 | u8 pin_len; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | struct oob_data { | ||
86 | struct list_head list; | ||
87 | bdaddr_t bdaddr; | ||
88 | u8 hash[16]; | ||
89 | u8 randomizer[16]; | ||
90 | }; | ||
91 | |||
85 | #define NUM_REASSEMBLY 4 | 92 | #define NUM_REASSEMBLY 4 |
86 | struct hci_dev { | 93 | struct hci_dev { |
87 | struct list_head list; | 94 | struct list_head list; |
@@ -94,7 +101,8 @@ struct hci_dev { | |||
94 | __u8 bus; | 101 | __u8 bus; |
95 | __u8 dev_type; | 102 | __u8 dev_type; |
96 | bdaddr_t bdaddr; | 103 | bdaddr_t bdaddr; |
97 | __u8 dev_name[248]; | 104 | __u8 dev_name[HCI_MAX_NAME_LENGTH]; |
105 | __u8 eir[HCI_MAX_EIR_LENGTH]; | ||
98 | __u8 dev_class[3]; | 106 | __u8 dev_class[3]; |
99 | __u8 major_class; | 107 | __u8 major_class; |
100 | __u8 minor_class; | 108 | __u8 minor_class; |
@@ -118,6 +126,8 @@ struct hci_dev { | |||
118 | __u16 sniff_min_interval; | 126 | __u16 sniff_min_interval; |
119 | __u16 sniff_max_interval; | 127 | __u16 sniff_max_interval; |
120 | 128 | ||
129 | unsigned int auto_accept_delay; | ||
130 | |||
121 | unsigned long quirks; | 131 | unsigned long quirks; |
122 | 132 | ||
123 | atomic_t cmd_cnt; | 133 | atomic_t cmd_cnt; |
@@ -169,6 +179,8 @@ struct hci_dev { | |||
169 | 179 | ||
170 | struct list_head link_keys; | 180 | struct list_head link_keys; |
171 | 181 | ||
182 | struct list_head remote_oob_data; | ||
183 | |||
172 | struct hci_dev_stats stat; | 184 | struct hci_dev_stats stat; |
173 | 185 | ||
174 | struct sk_buff_head driver_init; | 186 | struct sk_buff_head driver_init; |
@@ -216,6 +228,7 @@ struct hci_conn { | |||
216 | __u16 pkt_type; | 228 | __u16 pkt_type; |
217 | __u16 link_policy; | 229 | __u16 link_policy; |
218 | __u32 link_mode; | 230 | __u32 link_mode; |
231 | __u8 key_type; | ||
219 | __u8 auth_type; | 232 | __u8 auth_type; |
220 | __u8 sec_level; | 233 | __u8 sec_level; |
221 | __u8 pending_sec_level; | 234 | __u8 pending_sec_level; |
@@ -235,6 +248,7 @@ struct hci_conn { | |||
235 | 248 | ||
236 | struct timer_list disc_timer; | 249 | struct timer_list disc_timer; |
237 | struct timer_list idle_timer; | 250 | struct timer_list idle_timer; |
251 | struct timer_list auto_accept_timer; | ||
238 | 252 | ||
239 | struct work_struct work_add; | 253 | struct work_struct work_add; |
240 | struct work_struct work_del; | 254 | struct work_struct work_del; |
@@ -408,6 +422,7 @@ void hci_conn_check_pending(struct hci_dev *hdev); | |||
408 | 422 | ||
409 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type); | 423 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8 sec_level, __u8 auth_type); |
410 | int hci_conn_check_link_mode(struct hci_conn *conn); | 424 | int hci_conn_check_link_mode(struct hci_conn *conn); |
425 | int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level); | ||
411 | int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); | 426 | int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type); |
412 | int hci_conn_change_link_key(struct hci_conn *conn); | 427 | int hci_conn_change_link_key(struct hci_conn *conn); |
413 | int hci_conn_switch_role(struct hci_conn *conn, __u8 role); | 428 | int hci_conn_switch_role(struct hci_conn *conn, __u8 role); |
@@ -501,10 +516,17 @@ int hci_uuids_clear(struct hci_dev *hdev); | |||
501 | 516 | ||
502 | int hci_link_keys_clear(struct hci_dev *hdev); | 517 | int hci_link_keys_clear(struct hci_dev *hdev); |
503 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 518 | struct link_key *hci_find_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
504 | int hci_add_link_key(struct hci_dev *hdev, int new_key, bdaddr_t *bdaddr, | 519 | int hci_add_link_key(struct hci_dev *hdev, struct hci_conn *conn, int new_key, |
505 | u8 *key, u8 type, u8 pin_len); | 520 | bdaddr_t *bdaddr, u8 *val, u8 type, u8 pin_len); |
506 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); | 521 | int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr); |
507 | 522 | ||
523 | int hci_remote_oob_data_clear(struct hci_dev *hdev); | ||
524 | struct oob_data *hci_find_remote_oob_data(struct hci_dev *hdev, | ||
525 | bdaddr_t *bdaddr); | ||
526 | int hci_add_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 *hash, | ||
527 | u8 *randomizer); | ||
528 | int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr); | ||
529 | |||
508 | void hci_del_off_timer(struct hci_dev *hdev); | 530 | void hci_del_off_timer(struct hci_dev *hdev); |
509 | 531 | ||
510 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); | 532 | void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); |
@@ -754,19 +776,27 @@ int mgmt_index_removed(u16 index); | |||
754 | int mgmt_powered(u16 index, u8 powered); | 776 | int mgmt_powered(u16 index, u8 powered); |
755 | int mgmt_discoverable(u16 index, u8 discoverable); | 777 | int mgmt_discoverable(u16 index, u8 discoverable); |
756 | int mgmt_connectable(u16 index, u8 connectable); | 778 | int mgmt_connectable(u16 index, u8 connectable); |
757 | int mgmt_new_key(u16 index, struct link_key *key, u8 old_key_type); | 779 | int mgmt_new_key(u16 index, struct link_key *key, u8 persistent); |
758 | int mgmt_connected(u16 index, bdaddr_t *bdaddr); | 780 | int mgmt_connected(u16 index, bdaddr_t *bdaddr); |
759 | int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); | 781 | int mgmt_disconnected(u16 index, bdaddr_t *bdaddr); |
760 | int mgmt_disconnect_failed(u16 index); | 782 | int mgmt_disconnect_failed(u16 index); |
761 | int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); | 783 | int mgmt_connect_failed(u16 index, bdaddr_t *bdaddr, u8 status); |
762 | int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr); | 784 | int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr, u8 secure); |
763 | int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | 785 | int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); |
764 | int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | 786 | int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); |
765 | int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value); | 787 | int mgmt_user_confirm_request(u16 index, bdaddr_t *bdaddr, __le32 value, |
788 | u8 confirm_hint); | ||
766 | int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); | 789 | int mgmt_user_confirm_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status); |
767 | int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr, | 790 | int mgmt_user_confirm_neg_reply_complete(u16 index, bdaddr_t *bdaddr, |
768 | u8 status); | 791 | u8 status); |
769 | int mgmt_auth_failed(u16 index, bdaddr_t *bdaddr, u8 status); | 792 | int mgmt_auth_failed(u16 index, bdaddr_t *bdaddr, u8 status); |
793 | int mgmt_set_local_name_complete(u16 index, u8 *name, u8 status); | ||
794 | int mgmt_read_local_oob_data_reply_complete(u16 index, u8 *hash, u8 *randomizer, | ||
795 | u8 status); | ||
796 | int mgmt_device_found(u16 index, bdaddr_t *bdaddr, u8 *dev_class, s8 rssi, | ||
797 | u8 *eir); | ||
798 | int mgmt_remote_name(u16 index, bdaddr_t *bdaddr, u8 *name); | ||
799 | int mgmt_discovering(u16 index, u8 discovering); | ||
770 | 800 | ||
771 | /* HCI info for socket */ | 801 | /* HCI info for socket */ |
772 | #define hci_pi(sk) ((struct hci_pinfo *) sk) | 802 | #define hci_pi(sk) ((struct hci_pinfo *) sk) |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 4f4bff1eaed6..d09c9b1118e3 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h | |||
@@ -276,63 +276,17 @@ struct l2cap_conn_param_update_rsp { | |||
276 | #define L2CAP_CONN_PARAM_ACCEPTED 0x0000 | 276 | #define L2CAP_CONN_PARAM_ACCEPTED 0x0000 |
277 | #define L2CAP_CONN_PARAM_REJECTED 0x0001 | 277 | #define L2CAP_CONN_PARAM_REJECTED 0x0001 |
278 | 278 | ||
279 | /* ----- L2CAP connections ----- */ | 279 | /* ----- L2CAP channels and connections ----- */ |
280 | struct l2cap_chan_list { | ||
281 | struct sock *head; | ||
282 | rwlock_t lock; | ||
283 | long num; | ||
284 | }; | ||
285 | |||
286 | struct l2cap_conn { | ||
287 | struct hci_conn *hcon; | ||
288 | |||
289 | bdaddr_t *dst; | ||
290 | bdaddr_t *src; | ||
291 | |||
292 | unsigned int mtu; | ||
293 | |||
294 | __u32 feat_mask; | ||
295 | |||
296 | __u8 info_state; | ||
297 | __u8 info_ident; | ||
298 | |||
299 | struct timer_list info_timer; | ||
300 | |||
301 | spinlock_t lock; | ||
302 | |||
303 | struct sk_buff *rx_skb; | ||
304 | __u32 rx_len; | ||
305 | __u8 rx_ident; | ||
306 | __u8 tx_ident; | ||
307 | |||
308 | __u8 disc_reason; | ||
309 | |||
310 | struct l2cap_chan_list chan_list; | ||
311 | }; | ||
312 | |||
313 | struct sock_del_list { | ||
314 | struct sock *sk; | ||
315 | struct list_head list; | ||
316 | }; | ||
317 | |||
318 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 | ||
319 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 | ||
320 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 | ||
321 | |||
322 | /* ----- L2CAP channel and socket info ----- */ | ||
323 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) | ||
324 | #define TX_QUEUE(sk) (&l2cap_pi(sk)->tx_queue) | ||
325 | #define SREJ_QUEUE(sk) (&l2cap_pi(sk)->srej_queue) | ||
326 | #define BUSY_QUEUE(sk) (&l2cap_pi(sk)->busy_queue) | ||
327 | #define SREJ_LIST(sk) (&l2cap_pi(sk)->srej_l.list) | ||
328 | |||
329 | struct srej_list { | 280 | struct srej_list { |
330 | __u8 tx_seq; | 281 | __u8 tx_seq; |
331 | struct list_head list; | 282 | struct list_head list; |
332 | }; | 283 | }; |
333 | 284 | ||
334 | struct l2cap_pinfo { | 285 | struct l2cap_chan { |
335 | struct bt_sock bt; | 286 | struct sock *sk; |
287 | |||
288 | struct l2cap_conn *conn; | ||
289 | |||
336 | __le16 psm; | 290 | __le16 psm; |
337 | __u16 dcid; | 291 | __u16 dcid; |
338 | __u16 scid; | 292 | __u16 scid; |
@@ -341,17 +295,29 @@ struct l2cap_pinfo { | |||
341 | __u16 omtu; | 295 | __u16 omtu; |
342 | __u16 flush_to; | 296 | __u16 flush_to; |
343 | __u8 mode; | 297 | __u8 mode; |
344 | __u8 num_conf_req; | ||
345 | __u8 num_conf_rsp; | ||
346 | 298 | ||
347 | __u8 fcs; | 299 | __le16 sport; |
300 | |||
348 | __u8 sec_level; | 301 | __u8 sec_level; |
349 | __u8 role_switch; | 302 | __u8 role_switch; |
350 | __u8 force_reliable; | 303 | __u8 force_reliable; |
351 | __u8 flushable; | 304 | __u8 flushable; |
352 | 305 | ||
306 | __u8 ident; | ||
307 | |||
353 | __u8 conf_req[64]; | 308 | __u8 conf_req[64]; |
354 | __u8 conf_len; | 309 | __u8 conf_len; |
310 | __u8 num_conf_req; | ||
311 | __u8 num_conf_rsp; | ||
312 | |||
313 | __u8 fcs; | ||
314 | |||
315 | __u8 tx_win; | ||
316 | __u8 max_tx; | ||
317 | __u16 retrans_timeout; | ||
318 | __u16 monitor_timeout; | ||
319 | __u16 mps; | ||
320 | |||
355 | __u8 conf_state; | 321 | __u8 conf_state; |
356 | __u16 conn_state; | 322 | __u16 conn_state; |
357 | 323 | ||
@@ -369,30 +335,61 @@ struct l2cap_pinfo { | |||
369 | __u16 partial_sdu_len; | 335 | __u16 partial_sdu_len; |
370 | struct sk_buff *sdu; | 336 | struct sk_buff *sdu; |
371 | 337 | ||
372 | __u8 ident; | ||
373 | |||
374 | __u8 tx_win; | ||
375 | __u8 max_tx; | ||
376 | __u8 remote_tx_win; | 338 | __u8 remote_tx_win; |
377 | __u8 remote_max_tx; | 339 | __u8 remote_max_tx; |
378 | __u16 retrans_timeout; | ||
379 | __u16 monitor_timeout; | ||
380 | __u16 remote_mps; | 340 | __u16 remote_mps; |
381 | __u16 mps; | ||
382 | |||
383 | __le16 sport; | ||
384 | 341 | ||
385 | struct timer_list retrans_timer; | 342 | struct timer_list retrans_timer; |
386 | struct timer_list monitor_timer; | 343 | struct timer_list monitor_timer; |
387 | struct timer_list ack_timer; | 344 | struct timer_list ack_timer; |
388 | struct sk_buff_head tx_queue; | 345 | struct sk_buff *tx_send_head; |
389 | struct sk_buff_head srej_queue; | 346 | struct sk_buff_head tx_q; |
390 | struct sk_buff_head busy_queue; | 347 | struct sk_buff_head srej_q; |
348 | struct sk_buff_head busy_q; | ||
391 | struct work_struct busy_work; | 349 | struct work_struct busy_work; |
392 | struct srej_list srej_l; | 350 | struct list_head srej_l; |
393 | struct l2cap_conn *conn; | 351 | |
394 | struct sock *next_c; | 352 | struct list_head list; |
395 | struct sock *prev_c; | 353 | struct list_head global_l; |
354 | }; | ||
355 | |||
356 | struct l2cap_conn { | ||
357 | struct hci_conn *hcon; | ||
358 | |||
359 | bdaddr_t *dst; | ||
360 | bdaddr_t *src; | ||
361 | |||
362 | unsigned int mtu; | ||
363 | |||
364 | __u32 feat_mask; | ||
365 | |||
366 | __u8 info_state; | ||
367 | __u8 info_ident; | ||
368 | |||
369 | struct timer_list info_timer; | ||
370 | |||
371 | spinlock_t lock; | ||
372 | |||
373 | struct sk_buff *rx_skb; | ||
374 | __u32 rx_len; | ||
375 | __u8 tx_ident; | ||
376 | |||
377 | __u8 disc_reason; | ||
378 | |||
379 | struct list_head chan_l; | ||
380 | rwlock_t chan_lock; | ||
381 | }; | ||
382 | |||
383 | #define L2CAP_INFO_CL_MTU_REQ_SENT 0x01 | ||
384 | #define L2CAP_INFO_FEAT_MASK_REQ_SENT 0x04 | ||
385 | #define L2CAP_INFO_FEAT_MASK_REQ_DONE 0x08 | ||
386 | |||
387 | /* ----- L2CAP socket info ----- */ | ||
388 | #define l2cap_pi(sk) ((struct l2cap_pinfo *) sk) | ||
389 | |||
390 | struct l2cap_pinfo { | ||
391 | struct bt_sock bt; | ||
392 | struct l2cap_chan *chan; | ||
396 | }; | 393 | }; |
397 | 394 | ||
398 | #define L2CAP_CONF_REQ_SENT 0x01 | 395 | #define L2CAP_CONF_REQ_SENT 0x01 |
@@ -419,24 +416,23 @@ struct l2cap_pinfo { | |||
419 | #define L2CAP_CONN_RNR_SENT 0x0200 | 416 | #define L2CAP_CONN_RNR_SENT 0x0200 |
420 | #define L2CAP_CONN_SAR_RETRY 0x0400 | 417 | #define L2CAP_CONN_SAR_RETRY 0x0400 |
421 | 418 | ||
422 | #define __mod_retrans_timer() mod_timer(&l2cap_pi(sk)->retrans_timer, \ | 419 | #define __mod_retrans_timer() mod_timer(&chan->retrans_timer, \ |
423 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); | 420 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO)); |
424 | #define __mod_monitor_timer() mod_timer(&l2cap_pi(sk)->monitor_timer, \ | 421 | #define __mod_monitor_timer() mod_timer(&chan->monitor_timer, \ |
425 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); | 422 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO)); |
426 | #define __mod_ack_timer() mod_timer(&l2cap_pi(sk)->ack_timer, \ | 423 | #define __mod_ack_timer() mod_timer(&chan->ack_timer, \ |
427 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); | 424 | jiffies + msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO)); |
428 | 425 | ||
429 | static inline int l2cap_tx_window_full(struct sock *sk) | 426 | static inline int l2cap_tx_window_full(struct l2cap_chan *ch) |
430 | { | 427 | { |
431 | struct l2cap_pinfo *pi = l2cap_pi(sk); | ||
432 | int sub; | 428 | int sub; |
433 | 429 | ||
434 | sub = (pi->next_tx_seq - pi->expected_ack_seq) % 64; | 430 | sub = (ch->next_tx_seq - ch->expected_ack_seq) % 64; |
435 | 431 | ||
436 | if (sub < 0) | 432 | if (sub < 0) |
437 | sub += 64; | 433 | sub += 64; |
438 | 434 | ||
439 | return sub == pi->remote_tx_win; | 435 | return sub == ch->remote_tx_win; |
440 | } | 436 | } |
441 | 437 | ||
442 | #define __get_txseq(ctrl) (((ctrl) & L2CAP_CTRL_TXSEQ) >> 1) | 438 | #define __get_txseq(ctrl) (((ctrl) & L2CAP_CTRL_TXSEQ) >> 1) |
@@ -446,24 +442,24 @@ static inline int l2cap_tx_window_full(struct sock *sk) | |||
446 | #define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) | 442 | #define __is_sar_start(ctrl) (((ctrl) & L2CAP_CTRL_SAR) == L2CAP_SDU_START) |
447 | 443 | ||
448 | extern int disable_ertm; | 444 | extern int disable_ertm; |
449 | extern const struct proto_ops l2cap_sock_ops; | ||
450 | extern struct bt_sock_list l2cap_sk_list; | ||
451 | 445 | ||
452 | int l2cap_init_sockets(void); | 446 | int l2cap_init_sockets(void); |
453 | void l2cap_cleanup_sockets(void); | 447 | void l2cap_cleanup_sockets(void); |
454 | 448 | ||
455 | u8 l2cap_get_ident(struct l2cap_conn *conn); | ||
456 | void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data); | 449 | void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data); |
457 | int l2cap_build_conf_req(struct sock *sk, void *data); | 450 | void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); |
458 | int __l2cap_wait_ack(struct sock *sk); | 451 | int __l2cap_wait_ack(struct sock *sk); |
459 | 452 | ||
460 | struct sk_buff *l2cap_create_connless_pdu(struct sock *sk, struct msghdr *msg, size_t len); | 453 | struct sk_buff *l2cap_create_connless_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); |
461 | struct sk_buff *l2cap_create_basic_pdu(struct sock *sk, struct msghdr *msg, size_t len); | 454 | struct sk_buff *l2cap_create_basic_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); |
462 | struct sk_buff *l2cap_create_iframe_pdu(struct sock *sk, struct msghdr *msg, size_t len, u16 control, u16 sdulen); | 455 | struct sk_buff *l2cap_create_iframe_pdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len, u16 control, u16 sdulen); |
463 | int l2cap_sar_segment_sdu(struct sock *sk, struct msghdr *msg, size_t len); | 456 | int l2cap_sar_segment_sdu(struct l2cap_chan *chan, struct msghdr *msg, size_t len); |
464 | void l2cap_do_send(struct sock *sk, struct sk_buff *skb); | 457 | void l2cap_do_send(struct l2cap_chan *chan, struct sk_buff *skb); |
465 | void l2cap_streaming_send(struct sock *sk); | 458 | void l2cap_streaming_send(struct l2cap_chan *chan); |
466 | int l2cap_ertm_send(struct sock *sk); | 459 | int l2cap_ertm_send(struct l2cap_chan *chan); |
460 | |||
461 | int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); | ||
462 | int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); | ||
467 | 463 | ||
468 | void l2cap_sock_set_timer(struct sock *sk, long timeout); | 464 | void l2cap_sock_set_timer(struct sock *sk, long timeout); |
469 | void l2cap_sock_clear_timer(struct sock *sk); | 465 | void l2cap_sock_clear_timer(struct sock *sk); |
@@ -472,8 +468,10 @@ void l2cap_sock_kill(struct sock *sk); | |||
472 | void l2cap_sock_init(struct sock *sk, struct sock *parent); | 468 | void l2cap_sock_init(struct sock *sk, struct sock *parent); |
473 | struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, | 469 | struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, |
474 | int proto, gfp_t prio); | 470 | int proto, gfp_t prio); |
475 | void l2cap_send_disconn_req(struct l2cap_conn *conn, struct sock *sk, int err); | 471 | void l2cap_send_disconn_req(struct l2cap_conn *conn, struct l2cap_chan *chan, int err); |
476 | void l2cap_chan_del(struct sock *sk, int err); | 472 | struct l2cap_chan *l2cap_chan_create(struct sock *sk); |
477 | int l2cap_do_connect(struct sock *sk); | 473 | void l2cap_chan_del(struct l2cap_chan *chan, int err); |
474 | void l2cap_chan_destroy(struct l2cap_chan *chan); | ||
475 | int l2cap_chan_connect(struct l2cap_chan *chan); | ||
478 | 476 | ||
479 | #endif /* __L2CAP_H */ | 477 | #endif /* __L2CAP_H */ |
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 5fabfa886b3e..4899286ed4e4 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -41,6 +41,10 @@ struct mgmt_rp_read_index_list { | |||
41 | __le16 index[0]; | 41 | __le16 index[0]; |
42 | } __packed; | 42 | } __packed; |
43 | 43 | ||
44 | /* Reserve one extra byte for names in management messages so that they | ||
45 | * are always guaranteed to be nul-terminated */ | ||
46 | #define MGMT_MAX_NAME_LENGTH (HCI_MAX_NAME_LENGTH + 1) | ||
47 | |||
44 | #define MGMT_OP_READ_INFO 0x0004 | 48 | #define MGMT_OP_READ_INFO 0x0004 |
45 | struct mgmt_rp_read_info { | 49 | struct mgmt_rp_read_info { |
46 | __u8 type; | 50 | __u8 type; |
@@ -55,6 +59,7 @@ struct mgmt_rp_read_info { | |||
55 | __u16 manufacturer; | 59 | __u16 manufacturer; |
56 | __u8 hci_ver; | 60 | __u8 hci_ver; |
57 | __u16 hci_rev; | 61 | __u16 hci_rev; |
62 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
58 | } __packed; | 63 | } __packed; |
59 | 64 | ||
60 | struct mgmt_mode { | 65 | struct mgmt_mode { |
@@ -167,6 +172,33 @@ struct mgmt_rp_user_confirm_reply { | |||
167 | 172 | ||
168 | #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016 | 173 | #define MGMT_OP_USER_CONFIRM_NEG_REPLY 0x0016 |
169 | 174 | ||
175 | #define MGMT_OP_SET_LOCAL_NAME 0x0017 | ||
176 | struct mgmt_cp_set_local_name { | ||
177 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
178 | } __packed; | ||
179 | |||
180 | #define MGMT_OP_READ_LOCAL_OOB_DATA 0x0018 | ||
181 | struct mgmt_rp_read_local_oob_data { | ||
182 | __u8 hash[16]; | ||
183 | __u8 randomizer[16]; | ||
184 | } __packed; | ||
185 | |||
186 | #define MGMT_OP_ADD_REMOTE_OOB_DATA 0x0019 | ||
187 | struct mgmt_cp_add_remote_oob_data { | ||
188 | bdaddr_t bdaddr; | ||
189 | __u8 hash[16]; | ||
190 | __u8 randomizer[16]; | ||
191 | } __packed; | ||
192 | |||
193 | #define MGMT_OP_REMOVE_REMOTE_OOB_DATA 0x001A | ||
194 | struct mgmt_cp_remove_remote_oob_data { | ||
195 | bdaddr_t bdaddr; | ||
196 | } __packed; | ||
197 | |||
198 | #define MGMT_OP_START_DISCOVERY 0x001B | ||
199 | |||
200 | #define MGMT_OP_STOP_DISCOVERY 0x001C | ||
201 | |||
170 | #define MGMT_EV_CMD_COMPLETE 0x0001 | 202 | #define MGMT_EV_CMD_COMPLETE 0x0001 |
171 | struct mgmt_ev_cmd_complete { | 203 | struct mgmt_ev_cmd_complete { |
172 | __le16 opcode; | 204 | __le16 opcode; |
@@ -198,8 +230,8 @@ struct mgmt_ev_controller_error { | |||
198 | 230 | ||
199 | #define MGMT_EV_NEW_KEY 0x000A | 231 | #define MGMT_EV_NEW_KEY 0x000A |
200 | struct mgmt_ev_new_key { | 232 | struct mgmt_ev_new_key { |
233 | __u8 store_hint; | ||
201 | struct mgmt_key_info key; | 234 | struct mgmt_key_info key; |
202 | __u8 old_key_type; | ||
203 | } __packed; | 235 | } __packed; |
204 | 236 | ||
205 | #define MGMT_EV_CONNECTED 0x000B | 237 | #define MGMT_EV_CONNECTED 0x000B |
@@ -221,11 +253,13 @@ struct mgmt_ev_connect_failed { | |||
221 | #define MGMT_EV_PIN_CODE_REQUEST 0x000E | 253 | #define MGMT_EV_PIN_CODE_REQUEST 0x000E |
222 | struct mgmt_ev_pin_code_request { | 254 | struct mgmt_ev_pin_code_request { |
223 | bdaddr_t bdaddr; | 255 | bdaddr_t bdaddr; |
256 | __u8 secure; | ||
224 | } __packed; | 257 | } __packed; |
225 | 258 | ||
226 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F | 259 | #define MGMT_EV_USER_CONFIRM_REQUEST 0x000F |
227 | struct mgmt_ev_user_confirm_request { | 260 | struct mgmt_ev_user_confirm_request { |
228 | bdaddr_t bdaddr; | 261 | bdaddr_t bdaddr; |
262 | __u8 confirm_hint; | ||
229 | __le32 value; | 263 | __le32 value; |
230 | } __packed; | 264 | } __packed; |
231 | 265 | ||
@@ -234,3 +268,24 @@ struct mgmt_ev_auth_failed { | |||
234 | bdaddr_t bdaddr; | 268 | bdaddr_t bdaddr; |
235 | __u8 status; | 269 | __u8 status; |
236 | } __packed; | 270 | } __packed; |
271 | |||
272 | #define MGMT_EV_LOCAL_NAME_CHANGED 0x0011 | ||
273 | struct mgmt_ev_local_name_changed { | ||
274 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
275 | } __packed; | ||
276 | |||
277 | #define MGMT_EV_DEVICE_FOUND 0x0012 | ||
278 | struct mgmt_ev_device_found { | ||
279 | bdaddr_t bdaddr; | ||
280 | __u8 dev_class[3]; | ||
281 | __s8 rssi; | ||
282 | __u8 eir[HCI_MAX_EIR_LENGTH]; | ||
283 | } __packed; | ||
284 | |||
285 | #define MGMT_EV_REMOTE_NAME 0x0013 | ||
286 | struct mgmt_ev_remote_name { | ||
287 | bdaddr_t bdaddr; | ||
288 | __u8 name[MGMT_MAX_NAME_LENGTH]; | ||
289 | } __packed; | ||
290 | |||
291 | #define MGMT_EV_DISCOVERING 0x0014 | ||
diff --git a/include/net/caif/caif_dev.h b/include/net/caif/caif_dev.h index 8eff83b95366..c011281d92c0 100644 --- a/include/net/caif/caif_dev.h +++ b/include/net/caif/caif_dev.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <net/caif/cfcnfg.h> | 11 | #include <net/caif/cfcnfg.h> |
12 | #include <linux/caif/caif_socket.h> | 12 | #include <linux/caif/caif_socket.h> |
13 | #include <linux/if.h> | 13 | #include <linux/if.h> |
14 | #include <linux/net.h> | ||
14 | 15 | ||
15 | /** | 16 | /** |
16 | * struct caif_param - CAIF parameters. | 17 | * struct caif_param - CAIF parameters. |
@@ -62,46 +63,45 @@ struct caif_connect_request { | |||
62 | * E.g. CAIF Socket will call this function for each socket it connects | 63 | * E.g. CAIF Socket will call this function for each socket it connects |
63 | * and have one client_layer instance for each socket. | 64 | * and have one client_layer instance for each socket. |
64 | */ | 65 | */ |
65 | int caif_connect_client(struct caif_connect_request *conn_req, | 66 | int caif_connect_client(struct net *net, |
67 | struct caif_connect_request *conn_req, | ||
66 | struct cflayer *client_layer, int *ifindex, | 68 | struct cflayer *client_layer, int *ifindex, |
67 | int *headroom, int *tailroom); | 69 | int *headroom, int *tailroom); |
68 | 70 | ||
69 | /** | 71 | /** |
70 | * caif_disconnect_client - Disconnects a client from the CAIF stack. | 72 | * caif_disconnect_client - Disconnects a client from the CAIF stack. |
71 | * | 73 | * |
72 | * @client_layer: Client layer to be removed. | 74 | * @client_layer: Client layer to be disconnected. |
73 | */ | 75 | */ |
74 | int caif_disconnect_client(struct cflayer *client_layer); | 76 | int caif_disconnect_client(struct net *net, struct cflayer *client_layer); |
77 | |||
75 | 78 | ||
76 | /** | 79 | /** |
77 | * caif_release_client - Release adaptation layer reference to client. | 80 | * caif_client_register_refcnt - register ref-count functions provided by client. |
78 | * | 81 | * |
79 | * @client_layer: Client layer. | 82 | * @adapt_layer: Client layer using CAIF Stack. |
83 | * @hold: Function provided by client layer increasing ref-count | ||
84 | * @put: Function provided by client layer decreasing ref-count | ||
80 | * | 85 | * |
81 | * Releases a client/adaptation layer use of the caif stack. | 86 | * Client of the CAIF Stack must register functions for reference counting. |
82 | * This function must be used after caif_disconnect_client to | 87 | * These functions are called by the CAIF Stack for every upstream packet, |
83 | * decrease the reference count of the service layer. | 88 | * and must therefore be implemented efficiently. |
84 | */ | ||
85 | void caif_release_client(struct cflayer *client_layer); | ||
86 | |||
87 | /** | ||
88 | * connect_req_to_link_param - Translate configuration parameters | ||
89 | * from socket format to internal format. | ||
90 | * @cnfg: Pointer to configuration handler | ||
91 | * @con_req: Configuration parameters supplied in function | ||
92 | * caif_connect_client | ||
93 | * @channel_setup_param: Parameters supplied to the CAIF Core stack for | ||
94 | * setting up channels. | ||
95 | * | 89 | * |
90 | * Client should call caif_free_client when reference count degrease to zero. | ||
96 | */ | 91 | */ |
97 | int connect_req_to_link_param(struct cfcnfg *cnfg, | ||
98 | struct caif_connect_request *con_req, | ||
99 | struct cfctrl_link_param *channel_setup_param); | ||
100 | 92 | ||
93 | void caif_client_register_refcnt(struct cflayer *adapt_layer, | ||
94 | void (*hold)(struct cflayer *lyr), | ||
95 | void (*put)(struct cflayer *lyr)); | ||
101 | /** | 96 | /** |
102 | * get_caif_conf() - Get the configuration handler. | 97 | * caif_free_client - Free memory used to manage the client in the CAIF Stack. |
98 | * | ||
99 | * @client_layer: Client layer to be removed. | ||
100 | * | ||
101 | * This function must be called from client layer in order to free memory. | ||
102 | * Caller must guarantee that no packets are in flight upstream when calling | ||
103 | * this function. | ||
103 | */ | 104 | */ |
104 | struct cfcnfg *get_caif_conf(void); | 105 | void caif_free_client(struct cflayer *adap_layer); |
105 | |||
106 | 106 | ||
107 | #endif /* CAIF_DEV_H_ */ | 107 | #endif /* CAIF_DEV_H_ */ |
diff --git a/include/net/caif/cfcnfg.h b/include/net/caif/cfcnfg.h index f33d36341132..3e93a4a4b677 100644 --- a/include/net/caif/cfcnfg.h +++ b/include/net/caif/cfcnfg.h | |||
@@ -46,6 +46,12 @@ enum cfcnfg_phy_preference { | |||
46 | }; | 46 | }; |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * cfcnfg_create() - Get the CAIF configuration object given network. | ||
50 | * @net: Network for the CAIF configuration object. | ||
51 | */ | ||
52 | struct cfcnfg *get_cfcnfg(struct net *net); | ||
53 | |||
54 | /** | ||
49 | * cfcnfg_create() - Create the CAIF configuration object. | 55 | * cfcnfg_create() - Create the CAIF configuration object. |
50 | */ | 56 | */ |
51 | struct cfcnfg *cfcnfg_create(void); | 57 | struct cfcnfg *cfcnfg_create(void); |
@@ -65,17 +71,15 @@ void cfcnfg_remove(struct cfcnfg *cfg); | |||
65 | * @dev: Pointer to link layer device | 71 | * @dev: Pointer to link layer device |
66 | * @phy_layer: Specify the physical layer. The transmit function | 72 | * @phy_layer: Specify the physical layer. The transmit function |
67 | * MUST be set in the structure. | 73 | * MUST be set in the structure. |
68 | * @phyid: The assigned physical ID for this layer, used in | ||
69 | * cfcnfg_add_adapt_layer to specify PHY for the link. | ||
70 | * @pref: The phy (link layer) preference. | 74 | * @pref: The phy (link layer) preference. |
71 | * @fcs: Specify if checksum is used in CAIF Framing Layer. | 75 | * @fcs: Specify if checksum is used in CAIF Framing Layer. |
72 | * @stx: Specify if Start Of Frame extension is used. | 76 | * @stx: Specify if Start Of Frame eXtention is used. |
73 | */ | 77 | */ |
74 | 78 | ||
75 | void | 79 | void |
76 | cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, | 80 | cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, |
77 | struct net_device *dev, struct cflayer *phy_layer, | 81 | struct net_device *dev, struct cflayer *phy_layer, |
78 | u16 *phyid, enum cfcnfg_phy_preference pref, | 82 | enum cfcnfg_phy_preference pref, |
79 | bool fcs, bool stx); | 83 | bool fcs, bool stx); |
80 | 84 | ||
81 | /** | 85 | /** |
@@ -88,61 +92,12 @@ cfcnfg_add_phy_layer(struct cfcnfg *cnfg, enum cfcnfg_phy_type phy_type, | |||
88 | int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer); | 92 | int cfcnfg_del_phy_layer(struct cfcnfg *cnfg, struct cflayer *phy_layer); |
89 | 93 | ||
90 | /** | 94 | /** |
91 | * cfcnfg_disconn_adapt_layer - Disconnects an adaptation layer. | 95 | * cfcnfg_set_phy_state() - Set the state of the physical interface device. |
92 | * | ||
93 | * @cnfg: Pointer to a CAIF configuration object, created by | ||
94 | * cfcnfg_create(). | ||
95 | * @adap_layer: Adaptation layer to be removed. | ||
96 | */ | ||
97 | int cfcnfg_disconn_adapt_layer(struct cfcnfg *cnfg, | ||
98 | struct cflayer *adap_layer); | ||
99 | |||
100 | /** | ||
101 | * cfcnfg_release_adap_layer - Used by client to release the adaptation layer. | ||
102 | * | ||
103 | * @adap_layer: Adaptation layer. | ||
104 | */ | ||
105 | void cfcnfg_release_adap_layer(struct cflayer *adap_layer); | ||
106 | |||
107 | /** | ||
108 | * cfcnfg_add_adaptation_layer - Add an adaptation layer to the CAIF stack. | ||
109 | * | ||
110 | * The adaptation Layer is where the interface to application or higher-level | ||
111 | * driver functionality is implemented. | ||
112 | * | ||
113 | * @cnfg: Pointer to a CAIF configuration object, created by | ||
114 | * cfcnfg_create(). | ||
115 | * @param: Link setup parameters. | ||
116 | * @adap_layer: Specify the adaptation layer; the receive and | ||
117 | * flow-control functions MUST be set in the structure. | ||
118 | * @ifindex: Link layer interface index used for this connection. | ||
119 | * @proto_head: Protocol head-space needed by CAIF protocol, | ||
120 | * excluding link layer. | ||
121 | * @proto_tail: Protocol tail-space needed by CAIF protocol, | ||
122 | * excluding link layer. | ||
123 | */ | ||
124 | int cfcnfg_add_adaptation_layer(struct cfcnfg *cnfg, | ||
125 | struct cfctrl_link_param *param, | ||
126 | struct cflayer *adap_layer, | ||
127 | int *ifindex, | ||
128 | int *proto_head, | ||
129 | int *proto_tail); | ||
130 | |||
131 | /** | ||
132 | * cfcnfg_get_phyid() - Get physical ID, given type. | ||
133 | * Returns one of the physical interfaces matching the given type. | ||
134 | * Zero if no match is found. | ||
135 | * @cnfg: Configuration object | 96 | * @cnfg: Configuration object |
136 | * @phy_pref: Caif Link Layer preference | 97 | * @phy_layer: Physical Layer representation |
98 | * @up: State of device | ||
137 | */ | 99 | */ |
138 | struct dev_info *cfcnfg_get_phyid(struct cfcnfg *cnfg, | 100 | int cfcnfg_set_phy_state(struct cfcnfg *cnfg, struct cflayer *phy_layer, |
139 | enum cfcnfg_phy_preference phy_pref); | 101 | bool up); |
140 | 102 | ||
141 | /** | ||
142 | * cfcnfg_get_id_from_ifi() - Get the Physical Identifier of ifindex, | ||
143 | * it matches caif physical id with the kernel interface id. | ||
144 | * @cnfg: Configuration object | ||
145 | * @ifi: ifindex obtained from socket.c bindtodevice. | ||
146 | */ | ||
147 | int cfcnfg_get_id_from_ifi(struct cfcnfg *cnfg, int ifi); | ||
148 | #endif /* CFCNFG_H_ */ | 103 | #endif /* CFCNFG_H_ */ |
diff --git a/include/net/caif/cfctrl.h b/include/net/caif/cfctrl.h index e54f6396fa4c..9e5425b4a1d7 100644 --- a/include/net/caif/cfctrl.h +++ b/include/net/caif/cfctrl.h | |||
@@ -121,19 +121,10 @@ int cfctrl_linkup_request(struct cflayer *cfctrl, | |||
121 | struct cflayer *user_layer); | 121 | struct cflayer *user_layer); |
122 | int cfctrl_linkdown_req(struct cflayer *cfctrl, u8 linkid, | 122 | int cfctrl_linkdown_req(struct cflayer *cfctrl, u8 linkid, |
123 | struct cflayer *client); | 123 | struct cflayer *client); |
124 | void cfctrl_sleep_req(struct cflayer *cfctrl); | 124 | |
125 | void cfctrl_wake_req(struct cflayer *cfctrl); | ||
126 | void cfctrl_getstartreason_req(struct cflayer *cfctrl); | ||
127 | struct cflayer *cfctrl_create(void); | 125 | struct cflayer *cfctrl_create(void); |
128 | void cfctrl_set_dnlayer(struct cflayer *this, struct cflayer *dn); | ||
129 | void cfctrl_set_uplayer(struct cflayer *this, struct cflayer *up); | ||
130 | struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer); | 126 | struct cfctrl_rsp *cfctrl_get_respfuncs(struct cflayer *layer); |
131 | bool cfctrl_req_eq(struct cfctrl_request_info *r1, | 127 | int cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer); |
132 | struct cfctrl_request_info *r2); | 128 | void cfctrl_remove(struct cflayer *layr); |
133 | void cfctrl_insert_req(struct cfctrl *ctrl, | ||
134 | struct cfctrl_request_info *req); | ||
135 | struct cfctrl_request_info *cfctrl_remove_req(struct cfctrl *ctrl, | ||
136 | struct cfctrl_request_info *req); | ||
137 | void cfctrl_cancel_req(struct cflayer *layr, struct cflayer *adap_layer); | ||
138 | 129 | ||
139 | #endif /* CFCTRL_H_ */ | 130 | #endif /* CFCTRL_H_ */ |
diff --git a/include/net/caif/cffrml.h b/include/net/caif/cffrml.h index 3f14d2e1ce61..afac1a48cce7 100644 --- a/include/net/caif/cffrml.h +++ b/include/net/caif/cffrml.h | |||
@@ -7,10 +7,15 @@ | |||
7 | #ifndef CFFRML_H_ | 7 | #ifndef CFFRML_H_ |
8 | #define CFFRML_H_ | 8 | #define CFFRML_H_ |
9 | #include <net/caif/caif_layer.h> | 9 | #include <net/caif/caif_layer.h> |
10 | #include <linux/netdevice.h> | ||
10 | 11 | ||
11 | struct cffrml; | 12 | struct cffrml; |
12 | struct cflayer *cffrml_create(u16 phyid, bool DoFCS); | 13 | struct cflayer *cffrml_create(u16 phyid, bool use_fcs); |
14 | void cffrml_free(struct cflayer *layr); | ||
13 | void cffrml_set_uplayer(struct cflayer *this, struct cflayer *up); | 15 | void cffrml_set_uplayer(struct cflayer *this, struct cflayer *up); |
14 | void cffrml_set_dnlayer(struct cflayer *this, struct cflayer *dn); | 16 | void cffrml_set_dnlayer(struct cflayer *this, struct cflayer *dn); |
17 | void cffrml_put(struct cflayer *layr); | ||
18 | void cffrml_hold(struct cflayer *layr); | ||
19 | int cffrml_refcnt_read(struct cflayer *layr); | ||
15 | 20 | ||
16 | #endif /* CFFRML_H_ */ | 21 | #endif /* CFFRML_H_ */ |
diff --git a/include/net/caif/cfmuxl.h b/include/net/caif/cfmuxl.h index 4e1b4f33423e..5847a196b8ad 100644 --- a/include/net/caif/cfmuxl.h +++ b/include/net/caif/cfmuxl.h | |||
@@ -16,7 +16,5 @@ int cfmuxl_set_uplayer(struct cflayer *layr, struct cflayer *up, u8 linkid); | |||
16 | struct cflayer *cfmuxl_remove_dnlayer(struct cflayer *layr, u8 phyid); | 16 | struct cflayer *cfmuxl_remove_dnlayer(struct cflayer *layr, u8 phyid); |
17 | int cfmuxl_set_dnlayer(struct cflayer *layr, struct cflayer *up, u8 phyid); | 17 | int cfmuxl_set_dnlayer(struct cflayer *layr, struct cflayer *up, u8 phyid); |
18 | struct cflayer *cfmuxl_remove_uplayer(struct cflayer *layr, u8 linkid); | 18 | struct cflayer *cfmuxl_remove_uplayer(struct cflayer *layr, u8 linkid); |
19 | bool cfmuxl_is_phy_inuse(struct cflayer *layr, u8 phyid); | ||
20 | u8 cfmuxl_get_phyid(struct cflayer *layr, u8 channel_id); | ||
21 | 19 | ||
22 | #endif /* CFMUXL_H_ */ | 20 | #endif /* CFMUXL_H_ */ |
diff --git a/include/net/caif/cfpkt.h b/include/net/caif/cfpkt.h index fbc681beff52..6bd200a4754a 100644 --- a/include/net/caif/cfpkt.h +++ b/include/net/caif/cfpkt.h | |||
@@ -16,12 +16,6 @@ struct cfpkt; | |||
16 | */ | 16 | */ |
17 | struct cfpkt *cfpkt_create(u16 len); | 17 | struct cfpkt *cfpkt_create(u16 len); |
18 | 18 | ||
19 | /* Create a CAIF packet. | ||
20 | * data Data to copy. | ||
21 | * len Length of packet to be created | ||
22 | * @return New packet. | ||
23 | */ | ||
24 | struct cfpkt *cfpkt_create_uplink(const unsigned char *data, unsigned int len); | ||
25 | /* | 19 | /* |
26 | * Destroy a CAIF Packet. | 20 | * Destroy a CAIF Packet. |
27 | * pkt Packet to be destoyed. | 21 | * pkt Packet to be destoyed. |
@@ -181,22 +175,6 @@ u16 cfpkt_iterate(struct cfpkt *pkt, | |||
181 | u16 (*iter_func)(u16 chks, void *buf, u16 len), | 175 | u16 (*iter_func)(u16 chks, void *buf, u16 len), |
182 | u16 data); | 176 | u16 data); |
183 | 177 | ||
184 | /* Append by giving user access to packet buffer | ||
185 | * cfpkt Packet to append to | ||
186 | * buf Buffer inside pkt that user shall copy data into | ||
187 | * buflen Length of buffer and number of bytes added to packet | ||
188 | * @return 0 on error, 1 on success | ||
189 | */ | ||
190 | int cfpkt_raw_append(struct cfpkt *cfpkt, void **buf, unsigned int buflen); | ||
191 | |||
192 | /* Extract by giving user access to packet buffer | ||
193 | * cfpkt Packet to extract from | ||
194 | * buf Buffer inside pkt that user shall copy data from | ||
195 | * buflen Length of buffer and number of bytes removed from packet | ||
196 | * @return 0 on error, 1 on success | ||
197 | */ | ||
198 | int cfpkt_raw_extract(struct cfpkt *cfpkt, void **buf, unsigned int buflen); | ||
199 | |||
200 | /* Map from a "native" packet (e.g. Linux Socket Buffer) to a CAIF packet. | 178 | /* Map from a "native" packet (e.g. Linux Socket Buffer) to a CAIF packet. |
201 | * dir - Direction indicating whether this packet is to be sent or received. | 179 | * dir - Direction indicating whether this packet is to be sent or received. |
202 | * nativepkt - The native packet to be transformed to a CAIF packet | 180 | * nativepkt - The native packet to be transformed to a CAIF packet |
@@ -210,59 +188,6 @@ struct cfpkt *cfpkt_fromnative(enum caif_direction dir, void *nativepkt); | |||
210 | */ | 188 | */ |
211 | void *cfpkt_tonative(struct cfpkt *pkt); | 189 | void *cfpkt_tonative(struct cfpkt *pkt); |
212 | 190 | ||
213 | /* | ||
214 | * Insert a packet in the packet queue. | ||
215 | * pktq Packet queue to insert into | ||
216 | * pkt Packet to be inserted in queue | ||
217 | * prio Priority of packet | ||
218 | */ | ||
219 | void cfpkt_queue(struct cfpktq *pktq, struct cfpkt *pkt, | ||
220 | unsigned short prio); | ||
221 | |||
222 | /* | ||
223 | * Remove a packet from the packet queue. | ||
224 | * pktq Packet queue to fetch packets from. | ||
225 | * @return Dequeued packet. | ||
226 | */ | ||
227 | struct cfpkt *cfpkt_dequeue(struct cfpktq *pktq); | ||
228 | |||
229 | /* | ||
230 | * Peek into a packet from the packet queue. | ||
231 | * pktq Packet queue to fetch packets from. | ||
232 | * @return Peeked packet. | ||
233 | */ | ||
234 | struct cfpkt *cfpkt_qpeek(struct cfpktq *pktq); | ||
235 | |||
236 | /* | ||
237 | * Initiates the packet queue. | ||
238 | * @return Pointer to new packet queue. | ||
239 | */ | ||
240 | struct cfpktq *cfpktq_create(void); | ||
241 | |||
242 | /* | ||
243 | * Get the number of packets in the queue. | ||
244 | * pktq Packet queue to fetch count from. | ||
245 | * @return Number of packets in queue. | ||
246 | */ | ||
247 | int cfpkt_qcount(struct cfpktq *pktq); | ||
248 | |||
249 | /* | ||
250 | * Put content of packet into buffer for debuging purposes. | ||
251 | * pkt Packet to copy data from | ||
252 | * buf Buffer to copy data into | ||
253 | * buflen Length of data to copy | ||
254 | * @return Pointer to copied data | ||
255 | */ | ||
256 | char *cfpkt_log_pkt(struct cfpkt *pkt, char *buf, int buflen); | ||
257 | |||
258 | /* | ||
259 | * Clones a packet and releases the original packet. | ||
260 | * This is used for taking ownership of a packet e.g queueing. | ||
261 | * pkt Packet to clone and release. | ||
262 | * @return Cloned packet. | ||
263 | */ | ||
264 | struct cfpkt *cfpkt_clone_release(struct cfpkt *pkt); | ||
265 | |||
266 | 191 | ||
267 | /* | 192 | /* |
268 | * Returns packet information for a packet. | 193 | * Returns packet information for a packet. |
@@ -270,5 +195,4 @@ struct cfpkt *cfpkt_clone_release(struct cfpkt *pkt); | |||
270 | * @return Packet information | 195 | * @return Packet information |
271 | */ | 196 | */ |
272 | struct caif_payload_info *cfpkt_info(struct cfpkt *pkt); | 197 | struct caif_payload_info *cfpkt_info(struct cfpkt *pkt); |
273 | /*! @} */ | ||
274 | #endif /* CFPKT_H_ */ | 198 | #endif /* CFPKT_H_ */ |
diff --git a/include/net/caif/cfsrvl.h b/include/net/caif/cfsrvl.h index b1fa87ee0992..0f5905241843 100644 --- a/include/net/caif/cfsrvl.h +++ b/include/net/caif/cfsrvl.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/stddef.h> | 10 | #include <linux/stddef.h> |
11 | #include <linux/types.h> | 11 | #include <linux/types.h> |
12 | #include <linux/kref.h> | 12 | #include <linux/kref.h> |
13 | #include <linux/rculist.h> | ||
13 | 14 | ||
14 | struct cfsrvl { | 15 | struct cfsrvl { |
15 | struct cflayer layer; | 16 | struct cflayer layer; |
@@ -17,12 +18,13 @@ struct cfsrvl { | |||
17 | bool phy_flow_on; | 18 | bool phy_flow_on; |
18 | bool modem_flow_on; | 19 | bool modem_flow_on; |
19 | bool supports_flowctrl; | 20 | bool supports_flowctrl; |
20 | void (*release)(struct kref *); | 21 | void (*release)(struct cflayer *layer); |
21 | struct dev_info dev_info; | 22 | struct dev_info dev_info; |
22 | struct kref ref; | 23 | void (*hold)(struct cflayer *lyr); |
24 | void (*put)(struct cflayer *lyr); | ||
25 | struct rcu_head rcu; | ||
23 | }; | 26 | }; |
24 | 27 | ||
25 | void cfsrvl_release(struct kref *kref); | ||
26 | struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info); | 28 | struct cflayer *cfvei_create(u8 linkid, struct dev_info *dev_info); |
27 | struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info); | 29 | struct cflayer *cfdgml_create(u8 linkid, struct dev_info *dev_info); |
28 | struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info); | 30 | struct cflayer *cfutill_create(u8 linkid, struct dev_info *dev_info); |
@@ -30,8 +32,12 @@ struct cflayer *cfvidl_create(u8 linkid, struct dev_info *dev_info); | |||
30 | struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info, | 32 | struct cflayer *cfrfml_create(u8 linkid, struct dev_info *dev_info, |
31 | int mtu_size); | 33 | int mtu_size); |
32 | struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info); | 34 | struct cflayer *cfdbgl_create(u8 linkid, struct dev_info *dev_info); |
35 | |||
36 | void cfsrvl_ctrlcmd(struct cflayer *layr, enum caif_ctrlcmd ctrl, | ||
37 | int phyid); | ||
38 | |||
33 | bool cfsrvl_phyid_match(struct cflayer *layer, int phyid); | 39 | bool cfsrvl_phyid_match(struct cflayer *layer, int phyid); |
34 | void cfservl_destroy(struct cflayer *layer); | 40 | |
35 | void cfsrvl_init(struct cfsrvl *service, | 41 | void cfsrvl_init(struct cfsrvl *service, |
36 | u8 channel_id, | 42 | u8 channel_id, |
37 | struct dev_info *dev_info, | 43 | struct dev_info *dev_info, |
@@ -41,23 +47,19 @@ u8 cfsrvl_getphyid(struct cflayer *layer); | |||
41 | 47 | ||
42 | static inline void cfsrvl_get(struct cflayer *layr) | 48 | static inline void cfsrvl_get(struct cflayer *layr) |
43 | { | 49 | { |
44 | struct cfsrvl *s; | 50 | struct cfsrvl *s = container_of(layr, struct cfsrvl, layer); |
45 | if (layr == NULL) | 51 | if (layr == NULL || layr->up == NULL || s->hold == NULL) |
46 | return; | 52 | return; |
47 | s = container_of(layr, struct cfsrvl, layer); | 53 | |
48 | kref_get(&s->ref); | 54 | s->hold(layr->up); |
49 | } | 55 | } |
50 | 56 | ||
51 | static inline void cfsrvl_put(struct cflayer *layr) | 57 | static inline void cfsrvl_put(struct cflayer *layr) |
52 | { | 58 | { |
53 | struct cfsrvl *s; | 59 | struct cfsrvl *s = container_of(layr, struct cfsrvl, layer); |
54 | if (layr == NULL) | 60 | if (layr == NULL || layr->up == NULL || s->hold == NULL) |
55 | return; | 61 | return; |
56 | s = container_of(layr, struct cfsrvl, layer); | ||
57 | 62 | ||
58 | WARN_ON(!s->release); | 63 | s->put(layr->up); |
59 | if (s->release) | ||
60 | kref_put(&s->ref, s->release); | ||
61 | } | 64 | } |
62 | |||
63 | #endif /* CFSRVL_H_ */ | 65 | #endif /* CFSRVL_H_ */ |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index b2b9d28cb4ab..bfd6557946be 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -387,6 +387,7 @@ enum plink_actions { | |||
387 | * @listen_interval: listen interval or -1 for no change | 387 | * @listen_interval: listen interval or -1 for no change |
388 | * @aid: AID or zero for no change | 388 | * @aid: AID or zero for no change |
389 | * @plink_action: plink action to take | 389 | * @plink_action: plink action to take |
390 | * @plink_state: set the peer link state for a station | ||
390 | * @ht_capa: HT capabilities of station | 391 | * @ht_capa: HT capabilities of station |
391 | */ | 392 | */ |
392 | struct station_parameters { | 393 | struct station_parameters { |
@@ -397,6 +398,7 @@ struct station_parameters { | |||
397 | u16 aid; | 398 | u16 aid; |
398 | u8 supported_rates_len; | 399 | u8 supported_rates_len; |
399 | u8 plink_action; | 400 | u8 plink_action; |
401 | u8 plink_state; | ||
400 | struct ieee80211_ht_cap *ht_capa; | 402 | struct ieee80211_ht_cap *ht_capa; |
401 | }; | 403 | }; |
402 | 404 | ||
@@ -422,6 +424,8 @@ struct station_parameters { | |||
422 | * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled | 424 | * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled |
423 | * @STATION_INFO_SIGNAL_AVG: @signal_avg filled | 425 | * @STATION_INFO_SIGNAL_AVG: @signal_avg filled |
424 | * @STATION_INFO_RX_BITRATE: @rxrate fields are filled | 426 | * @STATION_INFO_RX_BITRATE: @rxrate fields are filled |
427 | * @STATION_INFO_BSS_PARAM: @bss_param filled | ||
428 | * @STATION_INFO_CONNECTED_TIME: @connected_time filled | ||
425 | */ | 429 | */ |
426 | enum station_info_flags { | 430 | enum station_info_flags { |
427 | STATION_INFO_INACTIVE_TIME = 1<<0, | 431 | STATION_INFO_INACTIVE_TIME = 1<<0, |
@@ -439,6 +443,8 @@ enum station_info_flags { | |||
439 | STATION_INFO_RX_DROP_MISC = 1<<12, | 443 | STATION_INFO_RX_DROP_MISC = 1<<12, |
440 | STATION_INFO_SIGNAL_AVG = 1<<13, | 444 | STATION_INFO_SIGNAL_AVG = 1<<13, |
441 | STATION_INFO_RX_BITRATE = 1<<14, | 445 | STATION_INFO_RX_BITRATE = 1<<14, |
446 | STATION_INFO_BSS_PARAM = 1<<15, | ||
447 | STATION_INFO_CONNECTED_TIME = 1<<16 | ||
442 | }; | 448 | }; |
443 | 449 | ||
444 | /** | 450 | /** |
@@ -473,11 +479,43 @@ struct rate_info { | |||
473 | }; | 479 | }; |
474 | 480 | ||
475 | /** | 481 | /** |
482 | * enum station_info_rate_flags - bitrate info flags | ||
483 | * | ||
484 | * Used by the driver to indicate the specific rate transmission | ||
485 | * type for 802.11n transmissions. | ||
486 | * | ||
487 | * @BSS_PARAM_FLAGS_CTS_PROT: whether CTS protection is enabled | ||
488 | * @BSS_PARAM_FLAGS_SHORT_PREAMBLE: whether short preamble is enabled | ||
489 | * @BSS_PARAM_FLAGS_SHORT_SLOT_TIME: whether short slot time is enabled | ||
490 | */ | ||
491 | enum bss_param_flags { | ||
492 | BSS_PARAM_FLAGS_CTS_PROT = 1<<0, | ||
493 | BSS_PARAM_FLAGS_SHORT_PREAMBLE = 1<<1, | ||
494 | BSS_PARAM_FLAGS_SHORT_SLOT_TIME = 1<<2, | ||
495 | }; | ||
496 | |||
497 | /** | ||
498 | * struct sta_bss_parameters - BSS parameters for the attached station | ||
499 | * | ||
500 | * Information about the currently associated BSS | ||
501 | * | ||
502 | * @flags: bitflag of flags from &enum bss_param_flags | ||
503 | * @dtim_period: DTIM period for the BSS | ||
504 | * @beacon_interval: beacon interval | ||
505 | */ | ||
506 | struct sta_bss_parameters { | ||
507 | u8 flags; | ||
508 | u8 dtim_period; | ||
509 | u16 beacon_interval; | ||
510 | }; | ||
511 | |||
512 | /** | ||
476 | * struct station_info - station information | 513 | * struct station_info - station information |
477 | * | 514 | * |
478 | * Station information filled by driver for get_station() and dump_station. | 515 | * Station information filled by driver for get_station() and dump_station. |
479 | * | 516 | * |
480 | * @filled: bitflag of flags from &enum station_info_flags | 517 | * @filled: bitflag of flags from &enum station_info_flags |
518 | * @connected_time: time(in secs) since a station is last connected | ||
481 | * @inactive_time: time since last station activity (tx/rx) in milliseconds | 519 | * @inactive_time: time since last station activity (tx/rx) in milliseconds |
482 | * @rx_bytes: bytes received from this station | 520 | * @rx_bytes: bytes received from this station |
483 | * @tx_bytes: bytes transmitted to this station | 521 | * @tx_bytes: bytes transmitted to this station |
@@ -500,6 +538,7 @@ struct rate_info { | |||
500 | */ | 538 | */ |
501 | struct station_info { | 539 | struct station_info { |
502 | u32 filled; | 540 | u32 filled; |
541 | u32 connected_time; | ||
503 | u32 inactive_time; | 542 | u32 inactive_time; |
504 | u32 rx_bytes; | 543 | u32 rx_bytes; |
505 | u32 tx_bytes; | 544 | u32 tx_bytes; |
@@ -515,6 +554,7 @@ struct station_info { | |||
515 | u32 tx_retries; | 554 | u32 tx_retries; |
516 | u32 tx_failed; | 555 | u32 tx_failed; |
517 | u32 rx_dropped_misc; | 556 | u32 rx_dropped_misc; |
557 | struct sta_bss_parameters bss_param; | ||
518 | 558 | ||
519 | int generation; | 559 | int generation; |
520 | }; | 560 | }; |
@@ -655,8 +695,10 @@ struct mesh_config { | |||
655 | * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes | 695 | * @mesh_id_len: length of the mesh ID, at least 1 and at most 32 bytes |
656 | * @path_sel_proto: which path selection protocol to use | 696 | * @path_sel_proto: which path selection protocol to use |
657 | * @path_metric: which metric to use | 697 | * @path_metric: which metric to use |
658 | * @vendor_ie: vendor information elements (optional) | 698 | * @ie: vendor information elements (optional) |
659 | * @vendor_ie_len: length of vendor information elements | 699 | * @ie_len: length of vendor information elements |
700 | * @is_authenticated: this mesh requires authentication | ||
701 | * @is_secure: this mesh uses security | ||
660 | * | 702 | * |
661 | * These parameters are fixed when the mesh is created. | 703 | * These parameters are fixed when the mesh is created. |
662 | */ | 704 | */ |
@@ -665,8 +707,10 @@ struct mesh_setup { | |||
665 | u8 mesh_id_len; | 707 | u8 mesh_id_len; |
666 | u8 path_sel_proto; | 708 | u8 path_sel_proto; |
667 | u8 path_metric; | 709 | u8 path_metric; |
668 | const u8 *vendor_ie; | 710 | const u8 *ie; |
669 | u8 vendor_ie_len; | 711 | u8 ie_len; |
712 | bool is_authenticated; | ||
713 | bool is_secure; | ||
670 | }; | 714 | }; |
671 | 715 | ||
672 | /** | 716 | /** |
@@ -753,6 +797,35 @@ struct cfg80211_scan_request { | |||
753 | }; | 797 | }; |
754 | 798 | ||
755 | /** | 799 | /** |
800 | * struct cfg80211_sched_scan_request - scheduled scan request description | ||
801 | * | ||
802 | * @ssids: SSIDs to scan for (passed in the probe_reqs in active scans) | ||
803 | * @n_ssids: number of SSIDs | ||
804 | * @n_channels: total number of channels to scan | ||
805 | * @interval: interval between each scheduled scan cycle | ||
806 | * @ie: optional information element(s) to add into Probe Request or %NULL | ||
807 | * @ie_len: length of ie in octets | ||
808 | * @wiphy: the wiphy this was for | ||
809 | * @dev: the interface | ||
810 | * @channels: channels to scan | ||
811 | */ | ||
812 | struct cfg80211_sched_scan_request { | ||
813 | struct cfg80211_ssid *ssids; | ||
814 | int n_ssids; | ||
815 | u32 n_channels; | ||
816 | u32 interval; | ||
817 | const u8 *ie; | ||
818 | size_t ie_len; | ||
819 | |||
820 | /* internal */ | ||
821 | struct wiphy *wiphy; | ||
822 | struct net_device *dev; | ||
823 | |||
824 | /* keep last */ | ||
825 | struct ieee80211_channel *channels[0]; | ||
826 | }; | ||
827 | |||
828 | /** | ||
756 | * enum cfg80211_signal_type - signal type | 829 | * enum cfg80211_signal_type - signal type |
757 | * | 830 | * |
758 | * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available | 831 | * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available |
@@ -1048,6 +1121,38 @@ struct cfg80211_pmksa { | |||
1048 | }; | 1121 | }; |
1049 | 1122 | ||
1050 | /** | 1123 | /** |
1124 | * struct cfg80211_wowlan_trig_pkt_pattern - packet pattern | ||
1125 | * @mask: bitmask where to match pattern and where to ignore bytes, | ||
1126 | * one bit per byte, in same format as nl80211 | ||
1127 | * @pattern: bytes to match where bitmask is 1 | ||
1128 | * @pattern_len: length of pattern (in bytes) | ||
1129 | * | ||
1130 | * Internal note: @mask and @pattern are allocated in one chunk of | ||
1131 | * memory, free @mask only! | ||
1132 | */ | ||
1133 | struct cfg80211_wowlan_trig_pkt_pattern { | ||
1134 | u8 *mask, *pattern; | ||
1135 | int pattern_len; | ||
1136 | }; | ||
1137 | |||
1138 | /** | ||
1139 | * struct cfg80211_wowlan - Wake on Wireless-LAN support info | ||
1140 | * | ||
1141 | * This structure defines the enabled WoWLAN triggers for the device. | ||
1142 | * @any: wake up on any activity -- special trigger if device continues | ||
1143 | * operating as normal during suspend | ||
1144 | * @disconnect: wake up if getting disconnected | ||
1145 | * @magic_pkt: wake up on receiving magic packet | ||
1146 | * @patterns: wake up on receiving packet matching a pattern | ||
1147 | * @n_patterns: number of patterns | ||
1148 | */ | ||
1149 | struct cfg80211_wowlan { | ||
1150 | bool any, disconnect, magic_pkt; | ||
1151 | struct cfg80211_wowlan_trig_pkt_pattern *patterns; | ||
1152 | int n_patterns; | ||
1153 | }; | ||
1154 | |||
1155 | /** | ||
1051 | * struct cfg80211_ops - backend description for wireless configuration | 1156 | * struct cfg80211_ops - backend description for wireless configuration |
1052 | * | 1157 | * |
1053 | * This struct is registered by fullmac card drivers and/or wireless stacks | 1158 | * This struct is registered by fullmac card drivers and/or wireless stacks |
@@ -1060,7 +1165,9 @@ struct cfg80211_pmksa { | |||
1060 | * wireless extensions but this is subject to reevaluation as soon as this | 1165 | * wireless extensions but this is subject to reevaluation as soon as this |
1061 | * code is used more widely and we have a first user without wext. | 1166 | * code is used more widely and we have a first user without wext. |
1062 | * | 1167 | * |
1063 | * @suspend: wiphy device needs to be suspended | 1168 | * @suspend: wiphy device needs to be suspended. The variable @wow will |
1169 | * be %NULL or contain the enabled Wake-on-Wireless triggers that are | ||
1170 | * configured for the device. | ||
1064 | * @resume: wiphy device needs to be resumed | 1171 | * @resume: wiphy device needs to be resumed |
1065 | * | 1172 | * |
1066 | * @add_virtual_intf: create a new virtual interface with the given name, | 1173 | * @add_virtual_intf: create a new virtual interface with the given name, |
@@ -1187,6 +1294,10 @@ struct cfg80211_pmksa { | |||
1187 | * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 | 1294 | * @set_power_mgmt: Configure WLAN power management. A timeout value of -1 |
1188 | * allows the driver to adjust the dynamic ps timeout value. | 1295 | * allows the driver to adjust the dynamic ps timeout value. |
1189 | * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. | 1296 | * @set_cqm_rssi_config: Configure connection quality monitor RSSI threshold. |
1297 | * @sched_scan_start: Tell the driver to start a scheduled scan. | ||
1298 | * @sched_scan_stop: Tell the driver to stop an ongoing scheduled | ||
1299 | * scan. The driver_initiated flag specifies whether the driver | ||
1300 | * itself has informed that the scan has stopped. | ||
1190 | * | 1301 | * |
1191 | * @mgmt_frame_register: Notify driver that a management frame type was | 1302 | * @mgmt_frame_register: Notify driver that a management frame type was |
1192 | * registered. Note that this callback may not sleep, and cannot run | 1303 | * registered. Note that this callback may not sleep, and cannot run |
@@ -1204,7 +1315,7 @@ struct cfg80211_pmksa { | |||
1204 | * @get_ringparam: Get tx and rx ring current and maximum sizes. | 1315 | * @get_ringparam: Get tx and rx ring current and maximum sizes. |
1205 | */ | 1316 | */ |
1206 | struct cfg80211_ops { | 1317 | struct cfg80211_ops { |
1207 | int (*suspend)(struct wiphy *wiphy); | 1318 | int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow); |
1208 | int (*resume)(struct wiphy *wiphy); | 1319 | int (*resume)(struct wiphy *wiphy); |
1209 | 1320 | ||
1210 | struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, | 1321 | struct net_device * (*add_virtual_intf)(struct wiphy *wiphy, |
@@ -1373,6 +1484,11 @@ struct cfg80211_ops { | |||
1373 | int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); | 1484 | int (*set_ringparam)(struct wiphy *wiphy, u32 tx, u32 rx); |
1374 | void (*get_ringparam)(struct wiphy *wiphy, | 1485 | void (*get_ringparam)(struct wiphy *wiphy, |
1375 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); | 1486 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); |
1487 | |||
1488 | int (*sched_scan_start)(struct wiphy *wiphy, | ||
1489 | struct net_device *dev, | ||
1490 | struct cfg80211_sched_scan_request *request); | ||
1491 | int (*sched_scan_stop)(struct wiphy *wiphy, struct net_device *dev); | ||
1376 | }; | 1492 | }; |
1377 | 1493 | ||
1378 | /* | 1494 | /* |
@@ -1404,6 +1520,10 @@ struct cfg80211_ops { | |||
1404 | * hints read the documenation for regulatory_hint_found_beacon() | 1520 | * hints read the documenation for regulatory_hint_found_beacon() |
1405 | * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this | 1521 | * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this |
1406 | * wiphy at all | 1522 | * wiphy at all |
1523 | * @WIPHY_FLAG_ENFORCE_COMBINATIONS: Set this flag to enforce interface | ||
1524 | * combinations for this device. This flag is used for backward | ||
1525 | * compatibility only until all drivers advertise combinations and | ||
1526 | * they will always be enforced. | ||
1407 | * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled | 1527 | * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled |
1408 | * by default -- this flag will be set depending on the kernel's default | 1528 | * by default -- this flag will be set depending on the kernel's default |
1409 | * on wiphy_new(), but can be changed by the driver if it has a good | 1529 | * on wiphy_new(), but can be changed by the driver if it has a good |
@@ -1415,8 +1535,9 @@ struct cfg80211_ops { | |||
1415 | * control port protocol ethertype. The device also honours the | 1535 | * control port protocol ethertype. The device also honours the |
1416 | * control_port_no_encrypt flag. | 1536 | * control_port_no_encrypt flag. |
1417 | * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. | 1537 | * @WIPHY_FLAG_IBSS_RSN: The device supports IBSS RSN. |
1418 | * @WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS: The device supports separate | 1538 | * @WIPHY_FLAG_MESH_AUTH: The device supports mesh authentication by routing |
1419 | * unicast and multicast TX keys. | 1539 | * auth frames to userspace. See @NL80211_MESH_SETUP_USERSPACE_AUTH. |
1540 | * @WIPHY_FLAG_SCHED_SCAN: The device supports scheduled scans. | ||
1420 | */ | 1541 | */ |
1421 | enum wiphy_flags { | 1542 | enum wiphy_flags { |
1422 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), | 1543 | WIPHY_FLAG_CUSTOM_REGULATORY = BIT(0), |
@@ -1428,7 +1549,83 @@ enum wiphy_flags { | |||
1428 | WIPHY_FLAG_4ADDR_STATION = BIT(6), | 1549 | WIPHY_FLAG_4ADDR_STATION = BIT(6), |
1429 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), | 1550 | WIPHY_FLAG_CONTROL_PORT_PROTOCOL = BIT(7), |
1430 | WIPHY_FLAG_IBSS_RSN = BIT(8), | 1551 | WIPHY_FLAG_IBSS_RSN = BIT(8), |
1431 | WIPHY_FLAG_SUPPORTS_SEPARATE_DEFAULT_KEYS= BIT(9), | 1552 | WIPHY_FLAG_MESH_AUTH = BIT(10), |
1553 | WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), | ||
1554 | WIPHY_FLAG_ENFORCE_COMBINATIONS = BIT(12), | ||
1555 | }; | ||
1556 | |||
1557 | /** | ||
1558 | * struct ieee80211_iface_limit - limit on certain interface types | ||
1559 | * @max: maximum number of interfaces of these types | ||
1560 | * @types: interface types (bits) | ||
1561 | */ | ||
1562 | struct ieee80211_iface_limit { | ||
1563 | u16 max; | ||
1564 | u16 types; | ||
1565 | }; | ||
1566 | |||
1567 | /** | ||
1568 | * struct ieee80211_iface_combination - possible interface combination | ||
1569 | * @limits: limits for the given interface types | ||
1570 | * @n_limits: number of limitations | ||
1571 | * @num_different_channels: can use up to this many different channels | ||
1572 | * @max_interfaces: maximum number of interfaces in total allowed in this | ||
1573 | * group | ||
1574 | * @beacon_int_infra_match: In this combination, the beacon intervals | ||
1575 | * between infrastructure and AP types must match. This is required | ||
1576 | * only in special cases. | ||
1577 | * | ||
1578 | * These examples can be expressed as follows: | ||
1579 | * | ||
1580 | * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: | ||
1581 | * | ||
1582 | * struct ieee80211_iface_limit limits1[] = { | ||
1583 | * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, | ||
1584 | * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, | ||
1585 | * }; | ||
1586 | * struct ieee80211_iface_combination combination1 = { | ||
1587 | * .limits = limits1, | ||
1588 | * .n_limits = ARRAY_SIZE(limits1), | ||
1589 | * .max_interfaces = 2, | ||
1590 | * .beacon_int_infra_match = true, | ||
1591 | * }; | ||
1592 | * | ||
1593 | * | ||
1594 | * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: | ||
1595 | * | ||
1596 | * struct ieee80211_iface_limit limits2[] = { | ||
1597 | * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | | ||
1598 | * BIT(NL80211_IFTYPE_P2P_GO), }, | ||
1599 | * }; | ||
1600 | * struct ieee80211_iface_combination combination2 = { | ||
1601 | * .limits = limits2, | ||
1602 | * .n_limits = ARRAY_SIZE(limits2), | ||
1603 | * .max_interfaces = 8, | ||
1604 | * .num_different_channels = 1, | ||
1605 | * }; | ||
1606 | * | ||
1607 | * | ||
1608 | * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. | ||
1609 | * This allows for an infrastructure connection and three P2P connections. | ||
1610 | * | ||
1611 | * struct ieee80211_iface_limit limits3[] = { | ||
1612 | * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, | ||
1613 | * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | | ||
1614 | * BIT(NL80211_IFTYPE_P2P_CLIENT), }, | ||
1615 | * }; | ||
1616 | * struct ieee80211_iface_combination combination3 = { | ||
1617 | * .limits = limits3, | ||
1618 | * .n_limits = ARRAY_SIZE(limits3), | ||
1619 | * .max_interfaces = 4, | ||
1620 | * .num_different_channels = 2, | ||
1621 | * }; | ||
1622 | */ | ||
1623 | struct ieee80211_iface_combination { | ||
1624 | const struct ieee80211_iface_limit *limits; | ||
1625 | u32 num_different_channels; | ||
1626 | u16 max_interfaces; | ||
1627 | u8 n_limits; | ||
1628 | bool beacon_int_infra_match; | ||
1432 | }; | 1629 | }; |
1433 | 1630 | ||
1434 | struct mac_address { | 1631 | struct mac_address { |
@@ -1440,6 +1637,38 @@ struct ieee80211_txrx_stypes { | |||
1440 | }; | 1637 | }; |
1441 | 1638 | ||
1442 | /** | 1639 | /** |
1640 | * enum wiphy_wowlan_support_flags - WoWLAN support flags | ||
1641 | * @WIPHY_WOWLAN_ANY: supports wakeup for the special "any" | ||
1642 | * trigger that keeps the device operating as-is and | ||
1643 | * wakes up the host on any activity, for example a | ||
1644 | * received packet that passed filtering; note that the | ||
1645 | * packet should be preserved in that case | ||
1646 | * @WIPHY_WOWLAN_MAGIC_PKT: supports wakeup on magic packet | ||
1647 | * (see nl80211.h) | ||
1648 | * @WIPHY_WOWLAN_DISCONNECT: supports wakeup on disconnect | ||
1649 | */ | ||
1650 | enum wiphy_wowlan_support_flags { | ||
1651 | WIPHY_WOWLAN_ANY = BIT(0), | ||
1652 | WIPHY_WOWLAN_MAGIC_PKT = BIT(1), | ||
1653 | WIPHY_WOWLAN_DISCONNECT = BIT(2), | ||
1654 | }; | ||
1655 | |||
1656 | /** | ||
1657 | * struct wiphy_wowlan_support - WoWLAN support data | ||
1658 | * @flags: see &enum wiphy_wowlan_support_flags | ||
1659 | * @n_patterns: number of supported wakeup patterns | ||
1660 | * (see nl80211.h for the pattern definition) | ||
1661 | * @pattern_max_len: maximum length of each pattern | ||
1662 | * @pattern_min_len: minimum length of each pattern | ||
1663 | */ | ||
1664 | struct wiphy_wowlan_support { | ||
1665 | u32 flags; | ||
1666 | int n_patterns; | ||
1667 | int pattern_max_len; | ||
1668 | int pattern_min_len; | ||
1669 | }; | ||
1670 | |||
1671 | /** | ||
1443 | * struct wiphy - wireless hardware description | 1672 | * struct wiphy - wireless hardware description |
1444 | * @reg_notifier: the driver's regulatory notification callback, | 1673 | * @reg_notifier: the driver's regulatory notification callback, |
1445 | * note that if your driver uses wiphy_apply_custom_regulatory() | 1674 | * note that if your driver uses wiphy_apply_custom_regulatory() |
@@ -1476,6 +1705,11 @@ struct ieee80211_txrx_stypes { | |||
1476 | * @priv: driver private data (sized according to wiphy_new() parameter) | 1705 | * @priv: driver private data (sized according to wiphy_new() parameter) |
1477 | * @interface_modes: bitmask of interfaces types valid for this wiphy, | 1706 | * @interface_modes: bitmask of interfaces types valid for this wiphy, |
1478 | * must be set by driver | 1707 | * must be set by driver |
1708 | * @iface_combinations: Valid interface combinations array, should not | ||
1709 | * list single interface types. | ||
1710 | * @n_iface_combinations: number of entries in @iface_combinations array. | ||
1711 | * @software_iftypes: bitmask of software interface types, these are not | ||
1712 | * subject to any restrictions since they are purely managed in SW. | ||
1479 | * @flags: wiphy flags, see &enum wiphy_flags | 1713 | * @flags: wiphy flags, see &enum wiphy_flags |
1480 | * @bss_priv_size: each BSS struct has private data allocated with it, | 1714 | * @bss_priv_size: each BSS struct has private data allocated with it, |
1481 | * this variable determines its size | 1715 | * this variable determines its size |
@@ -1506,6 +1740,8 @@ struct ieee80211_txrx_stypes { | |||
1506 | * | 1740 | * |
1507 | * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation | 1741 | * @max_remain_on_channel_duration: Maximum time a remain-on-channel operation |
1508 | * may request, if implemented. | 1742 | * may request, if implemented. |
1743 | * | ||
1744 | * @wowlan: WoWLAN support information | ||
1509 | */ | 1745 | */ |
1510 | struct wiphy { | 1746 | struct wiphy { |
1511 | /* assign these fields before you register the wiphy */ | 1747 | /* assign these fields before you register the wiphy */ |
@@ -1518,6 +1754,10 @@ struct wiphy { | |||
1518 | 1754 | ||
1519 | const struct ieee80211_txrx_stypes *mgmt_stypes; | 1755 | const struct ieee80211_txrx_stypes *mgmt_stypes; |
1520 | 1756 | ||
1757 | const struct ieee80211_iface_combination *iface_combinations; | ||
1758 | int n_iface_combinations; | ||
1759 | u16 software_iftypes; | ||
1760 | |||
1521 | u16 n_addresses; | 1761 | u16 n_addresses; |
1522 | 1762 | ||
1523 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ | 1763 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ |
@@ -1543,6 +1783,8 @@ struct wiphy { | |||
1543 | char fw_version[ETHTOOL_BUSINFO_LEN]; | 1783 | char fw_version[ETHTOOL_BUSINFO_LEN]; |
1544 | u32 hw_version; | 1784 | u32 hw_version; |
1545 | 1785 | ||
1786 | struct wiphy_wowlan_support wowlan; | ||
1787 | |||
1546 | u16 max_remain_on_channel_duration; | 1788 | u16 max_remain_on_channel_duration; |
1547 | 1789 | ||
1548 | u8 max_num_pmkids; | 1790 | u8 max_num_pmkids; |
@@ -1726,6 +1968,8 @@ struct cfg80211_cached_keys; | |||
1726 | * @mgmt_registrations_lock: lock for the list | 1968 | * @mgmt_registrations_lock: lock for the list |
1727 | * @mtx: mutex used to lock data in this struct | 1969 | * @mtx: mutex used to lock data in this struct |
1728 | * @cleanup_work: work struct used for cleanup that can't be done directly | 1970 | * @cleanup_work: work struct used for cleanup that can't be done directly |
1971 | * @beacon_interval: beacon interval used on this device for transmitting | ||
1972 | * beacons, 0 when not valid | ||
1729 | */ | 1973 | */ |
1730 | struct wireless_dev { | 1974 | struct wireless_dev { |
1731 | struct wiphy *wiphy; | 1975 | struct wiphy *wiphy; |
@@ -1766,6 +2010,8 @@ struct wireless_dev { | |||
1766 | bool ps; | 2010 | bool ps; |
1767 | int ps_timeout; | 2011 | int ps_timeout; |
1768 | 2012 | ||
2013 | int beacon_interval; | ||
2014 | |||
1769 | #ifdef CONFIG_CFG80211_WEXT | 2015 | #ifdef CONFIG_CFG80211_WEXT |
1770 | /* wext data */ | 2016 | /* wext data */ |
1771 | struct { | 2017 | struct { |
@@ -1991,10 +2237,12 @@ int ieee80211_data_from_8023(struct sk_buff *skb, const u8 *addr, | |||
1991 | * @addr: The device MAC address. | 2237 | * @addr: The device MAC address. |
1992 | * @iftype: The device interface type. | 2238 | * @iftype: The device interface type. |
1993 | * @extra_headroom: The hardware extra headroom for SKBs in the @list. | 2239 | * @extra_headroom: The hardware extra headroom for SKBs in the @list. |
2240 | * @has_80211_header: Set it true if SKB is with IEEE 802.11 header. | ||
1994 | */ | 2241 | */ |
1995 | void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, | 2242 | void ieee80211_amsdu_to_8023s(struct sk_buff *skb, struct sk_buff_head *list, |
1996 | const u8 *addr, enum nl80211_iftype iftype, | 2243 | const u8 *addr, enum nl80211_iftype iftype, |
1997 | const unsigned int extra_headroom); | 2244 | const unsigned int extra_headroom, |
2245 | bool has_80211_header); | ||
1998 | 2246 | ||
1999 | /** | 2247 | /** |
2000 | * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame | 2248 | * cfg80211_classify8021d - determine the 802.1p/1d tag for a data frame |
@@ -2214,6 +2462,24 @@ int cfg80211_wext_siwpmksa(struct net_device *dev, | |||
2214 | void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); | 2462 | void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted); |
2215 | 2463 | ||
2216 | /** | 2464 | /** |
2465 | * cfg80211_sched_scan_results - notify that new scan results are available | ||
2466 | * | ||
2467 | * @wiphy: the wiphy which got scheduled scan results | ||
2468 | */ | ||
2469 | void cfg80211_sched_scan_results(struct wiphy *wiphy); | ||
2470 | |||
2471 | /** | ||
2472 | * cfg80211_sched_scan_stopped - notify that the scheduled scan has stopped | ||
2473 | * | ||
2474 | * @wiphy: the wiphy on which the scheduled scan stopped | ||
2475 | * | ||
2476 | * The driver can call this function to inform cfg80211 that the | ||
2477 | * scheduled scan had to be stopped, for whatever reason. The driver | ||
2478 | * is then called back via the sched_scan_stop operation when done. | ||
2479 | */ | ||
2480 | void cfg80211_sched_scan_stopped(struct wiphy *wiphy); | ||
2481 | |||
2482 | /** | ||
2217 | * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame | 2483 | * cfg80211_inform_bss_frame - inform cfg80211 of a received BSS frame |
2218 | * | 2484 | * |
2219 | * @wiphy: the wiphy reporting the BSS | 2485 | * @wiphy: the wiphy reporting the BSS |
@@ -2450,6 +2716,22 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr, | |||
2450 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); | 2716 | void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp); |
2451 | 2717 | ||
2452 | /** | 2718 | /** |
2719 | * cfg80211_notify_new_candidate - notify cfg80211 of a new mesh peer candidate | ||
2720 | * | ||
2721 | * @dev: network device | ||
2722 | * @macaddr: the MAC address of the new candidate | ||
2723 | * @ie: information elements advertised by the peer candidate | ||
2724 | * @ie_len: lenght of the information elements buffer | ||
2725 | * @gfp: allocation flags | ||
2726 | * | ||
2727 | * This function notifies cfg80211 that the mesh peer candidate has been | ||
2728 | * detected, most likely via a beacon or, less likely, via a probe response. | ||
2729 | * cfg80211 then sends a notification to userspace. | ||
2730 | */ | ||
2731 | void cfg80211_notify_new_peer_candidate(struct net_device *dev, | ||
2732 | const u8 *macaddr, const u8 *ie, u8 ie_len, gfp_t gfp); | ||
2733 | |||
2734 | /** | ||
2453 | * DOC: RFkill integration | 2735 | * DOC: RFkill integration |
2454 | * | 2736 | * |
2455 | * RFkill integration in cfg80211 is almost invisible to drivers, | 2737 | * RFkill integration in cfg80211 is almost invisible to drivers, |
@@ -2667,6 +2949,15 @@ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr, | |||
2667 | struct station_info *sinfo, gfp_t gfp); | 2949 | struct station_info *sinfo, gfp_t gfp); |
2668 | 2950 | ||
2669 | /** | 2951 | /** |
2952 | * cfg80211_del_sta - notify userspace about deletion of a station | ||
2953 | * | ||
2954 | * @dev: the netdev | ||
2955 | * @mac_addr: the station's address | ||
2956 | * @gfp: allocation flags | ||
2957 | */ | ||
2958 | void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp); | ||
2959 | |||
2960 | /** | ||
2670 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame | 2961 | * cfg80211_rx_mgmt - notification of received, unprocessed management frame |
2671 | * @dev: network device | 2962 | * @dev: network device |
2672 | * @freq: Frequency on which the frame was received in MHz | 2963 | * @freq: Frequency on which the frame was received in MHz |
diff --git a/include/net/compat.h b/include/net/compat.h index 28d5428ec6a2..9ee75edcc295 100644 --- a/include/net/compat.h +++ b/include/net/compat.h | |||
@@ -43,6 +43,8 @@ extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *); | |||
43 | extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); | 43 | extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); |
44 | extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); | 44 | extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr *, int); |
45 | extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); | 45 | extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned); |
46 | extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, | ||
47 | unsigned, unsigned); | ||
46 | extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); | 48 | extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned); |
47 | extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, | 49 | extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, |
48 | unsigned, unsigned, | 50 | unsigned, unsigned, |
diff --git a/include/net/dst.h b/include/net/dst.h index 75b95df4afe7..07a0402c52e6 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -16,13 +16,6 @@ | |||
16 | #include <net/neighbour.h> | 16 | #include <net/neighbour.h> |
17 | #include <asm/processor.h> | 17 | #include <asm/processor.h> |
18 | 18 | ||
19 | /* | ||
20 | * 0 - no debugging messages | ||
21 | * 1 - rare events and bugs (default) | ||
22 | * 2 - trace mode. | ||
23 | */ | ||
24 | #define RT_CACHE_DEBUG 0 | ||
25 | |||
26 | #define DST_GC_MIN (HZ/10) | 19 | #define DST_GC_MIN (HZ/10) |
27 | #define DST_GC_INC (HZ/2) | 20 | #define DST_GC_INC (HZ/2) |
28 | #define DST_GC_MAX (120*HZ) | 21 | #define DST_GC_MAX (120*HZ) |
@@ -92,8 +85,6 @@ struct dst_entry { | |||
92 | }; | 85 | }; |
93 | }; | 86 | }; |
94 | 87 | ||
95 | #ifdef __KERNEL__ | ||
96 | |||
97 | extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); | 88 | extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); |
98 | extern const u32 dst_default_metrics[RTAX_MAX]; | 89 | extern const u32 dst_default_metrics[RTAX_MAX]; |
99 | 90 | ||
@@ -352,7 +343,8 @@ static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb) | |||
352 | } | 343 | } |
353 | 344 | ||
354 | extern int dst_discard(struct sk_buff *skb); | 345 | extern int dst_discard(struct sk_buff *skb); |
355 | extern void *dst_alloc(struct dst_ops * ops, int initial_ref); | 346 | extern void *dst_alloc(struct dst_ops * ops, struct net_device *dev, |
347 | int initial_ref, int initial_obsolete, int flags); | ||
356 | extern void __dst_free(struct dst_entry * dst); | 348 | extern void __dst_free(struct dst_entry * dst); |
357 | extern struct dst_entry *dst_destroy(struct dst_entry * dst); | 349 | extern struct dst_entry *dst_destroy(struct dst_entry * dst); |
358 | 350 | ||
@@ -438,6 +430,5 @@ extern struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig | |||
438 | const struct flowi *fl, struct sock *sk, | 430 | const struct flowi *fl, struct sock *sk, |
439 | int flags); | 431 | int flags); |
440 | #endif | 432 | #endif |
441 | #endif | ||
442 | 433 | ||
443 | #endif /* _NET_DST_H */ | 434 | #endif /* _NET_DST_H */ |
diff --git a/include/net/flow.h b/include/net/flow.h index 7fe5a0f9483a..c6d5fe5ec1bf 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -26,8 +26,8 @@ struct flowi_common { | |||
26 | 26 | ||
27 | union flowi_uli { | 27 | union flowi_uli { |
28 | struct { | 28 | struct { |
29 | __be16 sport; | ||
30 | __be16 dport; | 29 | __be16 dport; |
30 | __be16 sport; | ||
31 | } ports; | 31 | } ports; |
32 | 32 | ||
33 | struct { | 33 | struct { |
@@ -36,8 +36,8 @@ union flowi_uli { | |||
36 | } icmpt; | 36 | } icmpt; |
37 | 37 | ||
38 | struct { | 38 | struct { |
39 | __le16 sport; | ||
40 | __le16 dport; | 39 | __le16 dport; |
40 | __le16 sport; | ||
41 | } dnports; | 41 | } dnports; |
42 | 42 | ||
43 | __be32 spi; | 43 | __be32 spi; |
@@ -70,6 +70,27 @@ struct flowi4 { | |||
70 | #define fl4_gre_key uli.gre_key | 70 | #define fl4_gre_key uli.gre_key |
71 | }; | 71 | }; |
72 | 72 | ||
73 | static inline void flowi4_init_output(struct flowi4 *fl4, int oif, | ||
74 | __u32 mark, __u8 tos, __u8 scope, | ||
75 | __u8 proto, __u8 flags, | ||
76 | __be32 daddr, __be32 saddr, | ||
77 | __be16 dport, __be32 sport) | ||
78 | { | ||
79 | fl4->flowi4_oif = oif; | ||
80 | fl4->flowi4_iif = 0; | ||
81 | fl4->flowi4_mark = mark; | ||
82 | fl4->flowi4_tos = tos; | ||
83 | fl4->flowi4_scope = scope; | ||
84 | fl4->flowi4_proto = proto; | ||
85 | fl4->flowi4_flags = flags; | ||
86 | fl4->flowi4_secid = 0; | ||
87 | fl4->daddr = daddr; | ||
88 | fl4->saddr = saddr; | ||
89 | fl4->fl4_dport = dport; | ||
90 | fl4->fl4_sport = sport; | ||
91 | } | ||
92 | |||
93 | |||
73 | struct flowi6 { | 94 | struct flowi6 { |
74 | struct flowi_common __fl_common; | 95 | struct flowi_common __fl_common; |
75 | #define flowi6_oif __fl_common.flowic_oif | 96 | #define flowi6_oif __fl_common.flowic_oif |
diff --git a/include/net/garp.h b/include/net/garp.h index f4c295984c45..834d8add9e5f 100644 --- a/include/net/garp.h +++ b/include/net/garp.h | |||
@@ -104,10 +104,12 @@ struct garp_applicant { | |||
104 | struct sk_buff_head queue; | 104 | struct sk_buff_head queue; |
105 | struct sk_buff *pdu; | 105 | struct sk_buff *pdu; |
106 | struct rb_root gid; | 106 | struct rb_root gid; |
107 | struct rcu_head rcu; | ||
107 | }; | 108 | }; |
108 | 109 | ||
109 | struct garp_port { | 110 | struct garp_port { |
110 | struct garp_applicant __rcu *applicants[GARP_APPLICATION_MAX + 1]; | 111 | struct garp_applicant __rcu *applicants[GARP_APPLICATION_MAX + 1]; |
112 | struct rcu_head rcu; | ||
111 | }; | 113 | }; |
112 | 114 | ||
113 | extern int garp_register_application(struct garp_application *app); | 115 | extern int garp_register_application(struct garp_application *app); |
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h index fccc2180c61b..11cf373970a9 100644 --- a/include/net/if_inet6.h +++ b/include/net/if_inet6.h | |||
@@ -30,8 +30,6 @@ | |||
30 | #define IF_PREFIX_ONLINK 0x01 | 30 | #define IF_PREFIX_ONLINK 0x01 |
31 | #define IF_PREFIX_AUTOCONF 0x02 | 31 | #define IF_PREFIX_AUTOCONF 0x02 |
32 | 32 | ||
33 | #ifdef __KERNEL__ | ||
34 | |||
35 | enum { | 33 | enum { |
36 | INET6_IFADDR_STATE_DAD, | 34 | INET6_IFADDR_STATE_DAD, |
37 | INET6_IFADDR_STATE_POSTDAD, | 35 | INET6_IFADDR_STATE_POSTDAD, |
@@ -156,8 +154,8 @@ struct ifacaddr6 { | |||
156 | struct ipv6_devstat { | 154 | struct ipv6_devstat { |
157 | struct proc_dir_entry *proc_dir_entry; | 155 | struct proc_dir_entry *proc_dir_entry; |
158 | DEFINE_SNMP_STAT(struct ipstats_mib, ipv6); | 156 | DEFINE_SNMP_STAT(struct ipstats_mib, ipv6); |
159 | DEFINE_SNMP_STAT(struct icmpv6_mib, icmpv6); | 157 | DEFINE_SNMP_STAT_ATOMIC(struct icmpv6_mib_device, icmpv6dev); |
160 | DEFINE_SNMP_STAT(struct icmpv6msg_mib, icmpv6msg); | 158 | DEFINE_SNMP_STAT_ATOMIC(struct icmpv6msg_mib_device, icmpv6msgdev); |
161 | }; | 159 | }; |
162 | 160 | ||
163 | struct inet6_dev { | 161 | struct inet6_dev { |
@@ -196,7 +194,7 @@ struct inet6_dev { | |||
196 | struct rcu_head rcu; | 194 | struct rcu_head rcu; |
197 | }; | 195 | }; |
198 | 196 | ||
199 | static inline void ipv6_eth_mc_map(struct in6_addr *addr, char *buf) | 197 | static inline void ipv6_eth_mc_map(const struct in6_addr *addr, char *buf) |
200 | { | 198 | { |
201 | /* | 199 | /* |
202 | * +-------+-------+-------+-------+-------+-------+ | 200 | * +-------+-------+-------+-------+-------+-------+ |
@@ -210,7 +208,7 @@ static inline void ipv6_eth_mc_map(struct in6_addr *addr, char *buf) | |||
210 | memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32)); | 208 | memcpy(buf + 2, &addr->s6_addr32[3], sizeof(__u32)); |
211 | } | 209 | } |
212 | 210 | ||
213 | static inline void ipv6_tr_mc_map(struct in6_addr *addr, char *buf) | 211 | static inline void ipv6_tr_mc_map(const struct in6_addr *addr, char *buf) |
214 | { | 212 | { |
215 | /* All nodes FF01::1, FF02::1, FF02::1:FFxx:xxxx */ | 213 | /* All nodes FF01::1, FF02::1, FF02::1:FFxx:xxxx */ |
216 | 214 | ||
@@ -303,4 +301,3 @@ static inline int ipv6_ipgre_mc_map(const struct in6_addr *addr, | |||
303 | } | 301 | } |
304 | 302 | ||
305 | #endif | 303 | #endif |
306 | #endif | ||
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h index ff013505236b..3207e58ee019 100644 --- a/include/net/inet6_connection_sock.h +++ b/include/net/inet6_connection_sock.h | |||
@@ -41,5 +41,5 @@ extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk, | |||
41 | 41 | ||
42 | extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); | 42 | extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); |
43 | 43 | ||
44 | extern int inet6_csk_xmit(struct sk_buff *skb); | 44 | extern int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl); |
45 | #endif /* _INET6_CONNECTION_SOCK_H */ | 45 | #endif /* _INET6_CONNECTION_SOCK_H */ |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 6ac4e3b5007f..e6db62e756dc 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -36,7 +36,7 @@ struct tcp_congestion_ops; | |||
36 | * (i.e. things that depend on the address family) | 36 | * (i.e. things that depend on the address family) |
37 | */ | 37 | */ |
38 | struct inet_connection_sock_af_ops { | 38 | struct inet_connection_sock_af_ops { |
39 | int (*queue_xmit)(struct sk_buff *skb); | 39 | int (*queue_xmit)(struct sk_buff *skb, struct flowi *fl); |
40 | void (*send_check)(struct sock *sk, struct sk_buff *skb); | 40 | void (*send_check)(struct sock *sk, struct sk_buff *skb); |
41 | int (*rebuild_header)(struct sock *sk); | 41 | int (*rebuild_header)(struct sock *sk); |
42 | int (*conn_request)(struct sock *sk, struct sk_buff *skb); | 42 | int (*conn_request)(struct sock *sk, struct sk_buff *skb); |
@@ -249,7 +249,11 @@ extern int inet_csk_bind_conflict(const struct sock *sk, | |||
249 | extern int inet_csk_get_port(struct sock *sk, unsigned short snum); | 249 | extern int inet_csk_get_port(struct sock *sk, unsigned short snum); |
250 | 250 | ||
251 | extern struct dst_entry* inet_csk_route_req(struct sock *sk, | 251 | extern struct dst_entry* inet_csk_route_req(struct sock *sk, |
252 | struct flowi4 *fl4, | ||
252 | const struct request_sock *req); | 253 | const struct request_sock *req); |
254 | extern struct dst_entry* inet_csk_route_child_sock(struct sock *sk, | ||
255 | struct sock *newsk, | ||
256 | const struct request_sock *req); | ||
253 | 257 | ||
254 | static inline void inet_csk_reqsk_queue_add(struct sock *sk, | 258 | static inline void inet_csk_reqsk_queue_add(struct sock *sk, |
255 | struct request_sock *req, | 259 | struct request_sock *req, |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index 7a37369f8ea3..caaff5f5f39f 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h | |||
@@ -57,7 +57,15 @@ struct ip_options { | |||
57 | unsigned char __data[0]; | 57 | unsigned char __data[0]; |
58 | }; | 58 | }; |
59 | 59 | ||
60 | #define optlength(opt) (sizeof(struct ip_options) + opt->optlen) | 60 | struct ip_options_rcu { |
61 | struct rcu_head rcu; | ||
62 | struct ip_options opt; | ||
63 | }; | ||
64 | |||
65 | struct ip_options_data { | ||
66 | struct ip_options_rcu opt; | ||
67 | char data[40]; | ||
68 | }; | ||
61 | 69 | ||
62 | struct inet_request_sock { | 70 | struct inet_request_sock { |
63 | struct request_sock req; | 71 | struct request_sock req; |
@@ -78,7 +86,7 @@ struct inet_request_sock { | |||
78 | acked : 1, | 86 | acked : 1, |
79 | no_srccheck: 1; | 87 | no_srccheck: 1; |
80 | kmemcheck_bitfield_end(flags); | 88 | kmemcheck_bitfield_end(flags); |
81 | struct ip_options *opt; | 89 | struct ip_options_rcu *opt; |
82 | }; | 90 | }; |
83 | 91 | ||
84 | static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) | 92 | static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) |
@@ -88,17 +96,21 @@ static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) | |||
88 | 96 | ||
89 | struct inet_cork { | 97 | struct inet_cork { |
90 | unsigned int flags; | 98 | unsigned int flags; |
91 | unsigned int fragsize; | 99 | __be32 addr; |
92 | struct ip_options *opt; | 100 | struct ip_options *opt; |
101 | unsigned int fragsize; | ||
93 | struct dst_entry *dst; | 102 | struct dst_entry *dst; |
94 | int length; /* Total length of all frames */ | 103 | int length; /* Total length of all frames */ |
95 | __be32 addr; | ||
96 | struct flowi fl; | ||
97 | struct page *page; | 104 | struct page *page; |
98 | u32 off; | 105 | u32 off; |
99 | u8 tx_flags; | 106 | u8 tx_flags; |
100 | }; | 107 | }; |
101 | 108 | ||
109 | struct inet_cork_full { | ||
110 | struct inet_cork base; | ||
111 | struct flowi fl; | ||
112 | }; | ||
113 | |||
102 | struct ip_mc_socklist; | 114 | struct ip_mc_socklist; |
103 | struct ipv6_pinfo; | 115 | struct ipv6_pinfo; |
104 | struct rtable; | 116 | struct rtable; |
@@ -140,7 +152,7 @@ struct inet_sock { | |||
140 | __be16 inet_sport; | 152 | __be16 inet_sport; |
141 | __u16 inet_id; | 153 | __u16 inet_id; |
142 | 154 | ||
143 | struct ip_options *opt; | 155 | struct ip_options_rcu __rcu *inet_opt; |
144 | __u8 tos; | 156 | __u8 tos; |
145 | __u8 min_ttl; | 157 | __u8 min_ttl; |
146 | __u8 mc_ttl; | 158 | __u8 mc_ttl; |
@@ -156,7 +168,7 @@ struct inet_sock { | |||
156 | int mc_index; | 168 | int mc_index; |
157 | __be32 mc_addr; | 169 | __be32 mc_addr; |
158 | struct ip_mc_socklist __rcu *mc_list; | 170 | struct ip_mc_socklist __rcu *mc_list; |
159 | struct inet_cork cork; | 171 | struct inet_cork_full cork; |
160 | }; | 172 | }; |
161 | 173 | ||
162 | #define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ | 174 | #define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index e6dd8da6b2ad..8a159cc3d68b 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -80,7 +80,7 @@ static inline struct inet_peer *inet_getpeer_v4(__be32 v4daddr, int create) | |||
80 | return inet_getpeer(&daddr, create); | 80 | return inet_getpeer(&daddr, create); |
81 | } | 81 | } |
82 | 82 | ||
83 | static inline struct inet_peer *inet_getpeer_v6(struct in6_addr *v6daddr, int create) | 83 | static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr, int create) |
84 | { | 84 | { |
85 | struct inetpeer_addr daddr; | 85 | struct inetpeer_addr daddr; |
86 | 86 | ||
diff --git a/include/net/ip.h b/include/net/ip.h index 7c416583b710..66dd49149208 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -52,7 +52,7 @@ static inline unsigned int ip_hdrlen(const struct sk_buff *skb) | |||
52 | struct ipcm_cookie { | 52 | struct ipcm_cookie { |
53 | __be32 addr; | 53 | __be32 addr; |
54 | int oif; | 54 | int oif; |
55 | struct ip_options *opt; | 55 | struct ip_options_rcu *opt; |
56 | __u8 tx_flags; | 56 | __u8 tx_flags; |
57 | }; | 57 | }; |
58 | 58 | ||
@@ -92,7 +92,7 @@ extern int igmp_mc_proc_init(void); | |||
92 | 92 | ||
93 | extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, | 93 | extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, |
94 | __be32 saddr, __be32 daddr, | 94 | __be32 saddr, __be32 daddr, |
95 | struct ip_options *opt); | 95 | struct ip_options_rcu *opt); |
96 | extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, | 96 | extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, |
97 | struct packet_type *pt, struct net_device *orig_dev); | 97 | struct packet_type *pt, struct net_device *orig_dev); |
98 | extern int ip_local_deliver(struct sk_buff *skb); | 98 | extern int ip_local_deliver(struct sk_buff *skb); |
@@ -104,9 +104,9 @@ extern int ip_do_nat(struct sk_buff *skb); | |||
104 | extern void ip_send_check(struct iphdr *ip); | 104 | extern void ip_send_check(struct iphdr *ip); |
105 | extern int __ip_local_out(struct sk_buff *skb); | 105 | extern int __ip_local_out(struct sk_buff *skb); |
106 | extern int ip_local_out(struct sk_buff *skb); | 106 | extern int ip_local_out(struct sk_buff *skb); |
107 | extern int ip_queue_xmit(struct sk_buff *skb); | 107 | extern int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl); |
108 | extern void ip_init(void); | 108 | extern void ip_init(void); |
109 | extern int ip_append_data(struct sock *sk, | 109 | extern int ip_append_data(struct sock *sk, struct flowi4 *fl4, |
110 | int getfrag(void *from, char *to, int offset, int len, | 110 | int getfrag(void *from, char *to, int offset, int len, |
111 | int odd, struct sk_buff *skb), | 111 | int odd, struct sk_buff *skb), |
112 | void *from, int len, int protolen, | 112 | void *from, int len, int protolen, |
@@ -114,15 +114,17 @@ extern int ip_append_data(struct sock *sk, | |||
114 | struct rtable **rt, | 114 | struct rtable **rt, |
115 | unsigned int flags); | 115 | unsigned int flags); |
116 | extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); | 116 | extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); |
117 | extern ssize_t ip_append_page(struct sock *sk, struct page *page, | 117 | extern ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, |
118 | int offset, size_t size, int flags); | 118 | int offset, size_t size, int flags); |
119 | extern struct sk_buff *__ip_make_skb(struct sock *sk, | 119 | extern struct sk_buff *__ip_make_skb(struct sock *sk, |
120 | struct flowi4 *fl4, | ||
120 | struct sk_buff_head *queue, | 121 | struct sk_buff_head *queue, |
121 | struct inet_cork *cork); | 122 | struct inet_cork *cork); |
122 | extern int ip_send_skb(struct sk_buff *skb); | 123 | extern int ip_send_skb(struct sk_buff *skb); |
123 | extern int ip_push_pending_frames(struct sock *sk); | 124 | extern int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4); |
124 | extern void ip_flush_pending_frames(struct sock *sk); | 125 | extern void ip_flush_pending_frames(struct sock *sk); |
125 | extern struct sk_buff *ip_make_skb(struct sock *sk, | 126 | extern struct sk_buff *ip_make_skb(struct sock *sk, |
127 | struct flowi4 *fl4, | ||
126 | int getfrag(void *from, char *to, int offset, int len, | 128 | int getfrag(void *from, char *to, int offset, int len, |
127 | int odd, struct sk_buff *skb), | 129 | int odd, struct sk_buff *skb), |
128 | void *from, int length, int transhdrlen, | 130 | void *from, int length, int transhdrlen, |
@@ -130,9 +132,9 @@ extern struct sk_buff *ip_make_skb(struct sock *sk, | |||
130 | struct rtable **rtp, | 132 | struct rtable **rtp, |
131 | unsigned int flags); | 133 | unsigned int flags); |
132 | 134 | ||
133 | static inline struct sk_buff *ip_finish_skb(struct sock *sk) | 135 | static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4) |
134 | { | 136 | { |
135 | return __ip_make_skb(sk, &sk->sk_write_queue, &inet_sk(sk)->cork); | 137 | return __ip_make_skb(sk, fl4, &sk->sk_write_queue, &inet_sk(sk)->cork.base); |
136 | } | 138 | } |
137 | 139 | ||
138 | /* datagram.c */ | 140 | /* datagram.c */ |
@@ -172,8 +174,8 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg) | |||
172 | return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; | 174 | return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; |
173 | } | 175 | } |
174 | 176 | ||
175 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg, | 177 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, |
176 | unsigned int len); | 178 | struct ip_reply_arg *arg, unsigned int len); |
177 | 179 | ||
178 | struct ipv4_config { | 180 | struct ipv4_config { |
179 | int log_martians; | 181 | int log_martians; |
@@ -416,14 +418,15 @@ extern int ip_forward(struct sk_buff *skb); | |||
416 | * Functions provided by ip_options.c | 418 | * Functions provided by ip_options.c |
417 | */ | 419 | */ |
418 | 420 | ||
419 | extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag); | 421 | extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, |
422 | __be32 daddr, struct rtable *rt, int is_frag); | ||
420 | extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); | 423 | extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); |
421 | extern void ip_options_fragment(struct sk_buff *skb); | 424 | extern void ip_options_fragment(struct sk_buff *skb); |
422 | extern int ip_options_compile(struct net *net, | 425 | extern int ip_options_compile(struct net *net, |
423 | struct ip_options *opt, struct sk_buff *skb); | 426 | struct ip_options *opt, struct sk_buff *skb); |
424 | extern int ip_options_get(struct net *net, struct ip_options **optp, | 427 | extern int ip_options_get(struct net *net, struct ip_options_rcu **optp, |
425 | unsigned char *data, int optlen); | 428 | unsigned char *data, int optlen); |
426 | extern int ip_options_get_from_user(struct net *net, struct ip_options **optp, | 429 | extern int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp, |
427 | unsigned char __user *data, int optlen); | 430 | unsigned char __user *data, int optlen); |
428 | extern void ip_options_undo(struct ip_options * opt); | 431 | extern void ip_options_undo(struct ip_options * opt); |
429 | extern void ip_forward_options(struct sk_buff *skb); | 432 | extern void ip_forward_options(struct sk_buff *skb); |
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index bc3cde0a810c..477ef75f3873 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h | |||
@@ -13,8 +13,6 @@ | |||
13 | #ifndef _IP6_FIB_H | 13 | #ifndef _IP6_FIB_H |
14 | #define _IP6_FIB_H | 14 | #define _IP6_FIB_H |
15 | 15 | ||
16 | #ifdef __KERNEL__ | ||
17 | |||
18 | #include <linux/ipv6_route.h> | 16 | #include <linux/ipv6_route.h> |
19 | #include <linux/rtnetlink.h> | 17 | #include <linux/rtnetlink.h> |
20 | #include <linux/spinlock.h> | 18 | #include <linux/spinlock.h> |
@@ -42,6 +40,7 @@ struct fib6_config { | |||
42 | 40 | ||
43 | struct in6_addr fc_dst; | 41 | struct in6_addr fc_dst; |
44 | struct in6_addr fc_src; | 42 | struct in6_addr fc_src; |
43 | struct in6_addr fc_prefsrc; | ||
45 | struct in6_addr fc_gateway; | 44 | struct in6_addr fc_gateway; |
46 | 45 | ||
47 | unsigned long fc_expires; | 46 | unsigned long fc_expires; |
@@ -107,6 +106,7 @@ struct rt6_info { | |||
107 | struct rt6key rt6i_dst ____cacheline_aligned_in_smp; | 106 | struct rt6key rt6i_dst ____cacheline_aligned_in_smp; |
108 | u32 rt6i_flags; | 107 | u32 rt6i_flags; |
109 | struct rt6key rt6i_src; | 108 | struct rt6key rt6i_src; |
109 | struct rt6key rt6i_prefsrc; | ||
110 | u32 rt6i_metric; | 110 | u32 rt6i_metric; |
111 | u32 rt6i_peer_genid; | 111 | u32 rt6i_peer_genid; |
112 | 112 | ||
@@ -196,12 +196,12 @@ extern struct dst_entry *fib6_rule_lookup(struct net *net, | |||
196 | pol_lookup_t lookup); | 196 | pol_lookup_t lookup); |
197 | 197 | ||
198 | extern struct fib6_node *fib6_lookup(struct fib6_node *root, | 198 | extern struct fib6_node *fib6_lookup(struct fib6_node *root, |
199 | struct in6_addr *daddr, | 199 | const struct in6_addr *daddr, |
200 | struct in6_addr *saddr); | 200 | const struct in6_addr *saddr); |
201 | 201 | ||
202 | struct fib6_node *fib6_locate(struct fib6_node *root, | 202 | struct fib6_node *fib6_locate(struct fib6_node *root, |
203 | struct in6_addr *daddr, int dst_len, | 203 | const struct in6_addr *daddr, int dst_len, |
204 | struct in6_addr *saddr, int src_len); | 204 | const struct in6_addr *saddr, int src_len); |
205 | 205 | ||
206 | extern void fib6_clean_all(struct net *net, | 206 | extern void fib6_clean_all(struct net *net, |
207 | int (*func)(struct rt6_info *, void *arg), | 207 | int (*func)(struct rt6_info *, void *arg), |
@@ -238,4 +238,3 @@ static inline void fib6_rules_cleanup(void) | |||
238 | } | 238 | } |
239 | #endif | 239 | #endif |
240 | #endif | 240 | #endif |
241 | #endif | ||
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h index c850e5fb967c..5e91b72fc718 100644 --- a/include/net/ip6_route.h +++ b/include/net/ip6_route.h | |||
@@ -21,8 +21,6 @@ struct route_info { | |||
21 | __u8 prefix[0]; /* 0,8 or 16 */ | 21 | __u8 prefix[0]; /* 0,8 or 16 */ |
22 | }; | 22 | }; |
23 | 23 | ||
24 | #ifdef __KERNEL__ | ||
25 | |||
26 | #include <net/flow.h> | 24 | #include <net/flow.h> |
27 | #include <net/ip6_fib.h> | 25 | #include <net/ip6_fib.h> |
28 | #include <net/sock.h> | 26 | #include <net/sock.h> |
@@ -84,6 +82,12 @@ extern int ip6_route_add(struct fib6_config *cfg); | |||
84 | extern int ip6_ins_rt(struct rt6_info *); | 82 | extern int ip6_ins_rt(struct rt6_info *); |
85 | extern int ip6_del_rt(struct rt6_info *); | 83 | extern int ip6_del_rt(struct rt6_info *); |
86 | 84 | ||
85 | extern int ip6_route_get_saddr(struct net *net, | ||
86 | struct rt6_info *rt, | ||
87 | const struct in6_addr *daddr, | ||
88 | unsigned int prefs, | ||
89 | struct in6_addr *saddr); | ||
90 | |||
87 | extern struct rt6_info *rt6_lookup(struct net *net, | 91 | extern struct rt6_info *rt6_lookup(struct net *net, |
88 | const struct in6_addr *daddr, | 92 | const struct in6_addr *daddr, |
89 | const struct in6_addr *saddr, | 93 | const struct in6_addr *saddr, |
@@ -106,9 +110,9 @@ extern int ip6_dst_hoplimit(struct dst_entry *dst); | |||
106 | * support functions for ND | 110 | * support functions for ND |
107 | * | 111 | * |
108 | */ | 112 | */ |
109 | extern struct rt6_info * rt6_get_dflt_router(struct in6_addr *addr, | 113 | extern struct rt6_info * rt6_get_dflt_router(const struct in6_addr *addr, |
110 | struct net_device *dev); | 114 | struct net_device *dev); |
111 | extern struct rt6_info * rt6_add_dflt_router(struct in6_addr *gwaddr, | 115 | extern struct rt6_info * rt6_add_dflt_router(const struct in6_addr *gwaddr, |
112 | struct net_device *dev, | 116 | struct net_device *dev, |
113 | unsigned int pref); | 117 | unsigned int pref); |
114 | 118 | ||
@@ -116,17 +120,17 @@ extern void rt6_purge_dflt_routers(struct net *net); | |||
116 | 120 | ||
117 | extern int rt6_route_rcv(struct net_device *dev, | 121 | extern int rt6_route_rcv(struct net_device *dev, |
118 | u8 *opt, int len, | 122 | u8 *opt, int len, |
119 | struct in6_addr *gwaddr); | 123 | const struct in6_addr *gwaddr); |
120 | 124 | ||
121 | extern void rt6_redirect(struct in6_addr *dest, | 125 | extern void rt6_redirect(const struct in6_addr *dest, |
122 | struct in6_addr *src, | 126 | const struct in6_addr *src, |
123 | struct in6_addr *saddr, | 127 | const struct in6_addr *saddr, |
124 | struct neighbour *neigh, | 128 | struct neighbour *neigh, |
125 | u8 *lladdr, | 129 | u8 *lladdr, |
126 | int on_link); | 130 | int on_link); |
127 | 131 | ||
128 | extern void rt6_pmtu_discovery(struct in6_addr *daddr, | 132 | extern void rt6_pmtu_discovery(const struct in6_addr *daddr, |
129 | struct in6_addr *saddr, | 133 | const struct in6_addr *saddr, |
130 | struct net_device *dev, | 134 | struct net_device *dev, |
131 | u32 pmtu); | 135 | u32 pmtu); |
132 | 136 | ||
@@ -141,6 +145,7 @@ struct rt6_rtnl_dump_arg { | |||
141 | extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); | 145 | extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); |
142 | extern void rt6_ifdown(struct net *net, struct net_device *dev); | 146 | extern void rt6_ifdown(struct net *net, struct net_device *dev); |
143 | extern void rt6_mtu_change(struct net_device *dev, unsigned mtu); | 147 | extern void rt6_mtu_change(struct net_device *dev, unsigned mtu); |
148 | extern void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); | ||
144 | 149 | ||
145 | 150 | ||
146 | /* | 151 | /* |
@@ -186,4 +191,3 @@ static inline int ip6_skb_dst_mtu(struct sk_buff *skb) | |||
186 | } | 191 | } |
187 | 192 | ||
188 | #endif | 193 | #endif |
189 | #endif | ||
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index e5d66ec88cf6..10422ef14e28 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -160,7 +160,8 @@ struct fib_table { | |||
160 | struct hlist_node tb_hlist; | 160 | struct hlist_node tb_hlist; |
161 | u32 tb_id; | 161 | u32 tb_id; |
162 | int tb_default; | 162 | int tb_default; |
163 | unsigned char tb_data[0]; | 163 | int tb_num_default; |
164 | unsigned long tb_data[0]; | ||
164 | }; | 165 | }; |
165 | 166 | ||
166 | extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, | 167 | extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, |
@@ -227,9 +228,9 @@ extern struct fib_table *fib_get_table(struct net *net, u32 id); | |||
227 | /* Exported by fib_frontend.c */ | 228 | /* Exported by fib_frontend.c */ |
228 | extern const struct nla_policy rtm_ipv4_policy[]; | 229 | extern const struct nla_policy rtm_ipv4_policy[]; |
229 | extern void ip_fib_init(void); | 230 | extern void ip_fib_init(void); |
230 | extern int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif, | 231 | extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, |
231 | struct net_device *dev, __be32 *spec_dst, | 232 | u8 tos, int oif, struct net_device *dev, |
232 | u32 *itag, u32 mark); | 233 | __be32 *spec_dst, u32 *itag); |
233 | extern void fib_select_default(struct fib_result *res); | 234 | extern void fib_select_default(struct fib_result *res); |
234 | 235 | ||
235 | /* Exported by fib_semantics.c */ | 236 | /* Exported by fib_semantics.c */ |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 86aefed6140b..4fff432aeade 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -8,9 +8,6 @@ | |||
8 | 8 | ||
9 | #include <linux/ip_vs.h> /* definitions shared with userland */ | 9 | #include <linux/ip_vs.h> /* definitions shared with userland */ |
10 | 10 | ||
11 | /* old ipvsadm versions still include this file directly */ | ||
12 | #ifdef __KERNEL__ | ||
13 | |||
14 | #include <asm/types.h> /* for __uXX types */ | 11 | #include <asm/types.h> /* for __uXX types */ |
15 | 12 | ||
16 | #include <linux/sysctl.h> /* for ctl_path */ | 13 | #include <linux/sysctl.h> /* for ctl_path */ |
@@ -668,9 +665,7 @@ struct ip_vs_dest { | |||
668 | struct dst_entry *dst_cache; /* destination cache entry */ | 665 | struct dst_entry *dst_cache; /* destination cache entry */ |
669 | u32 dst_rtos; /* RT_TOS(tos) for dst */ | 666 | u32 dst_rtos; /* RT_TOS(tos) for dst */ |
670 | u32 dst_cookie; | 667 | u32 dst_cookie; |
671 | #ifdef CONFIG_IP_VS_IPV6 | 668 | union nf_inet_addr dst_saddr; |
672 | struct in6_addr dst_saddr; | ||
673 | #endif | ||
674 | 669 | ||
675 | /* for virtual service */ | 670 | /* for virtual service */ |
676 | struct ip_vs_service *svc; /* service it belongs to */ | 671 | struct ip_vs_service *svc; /* service it belongs to */ |
@@ -1256,7 +1251,8 @@ extern int ip_vs_tunnel_xmit | |||
1256 | extern int ip_vs_dr_xmit | 1251 | extern int ip_vs_dr_xmit |
1257 | (struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); | 1252 | (struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
1258 | extern int ip_vs_icmp_xmit | 1253 | extern int ip_vs_icmp_xmit |
1259 | (struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, int offset); | 1254 | (struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, |
1255 | int offset, unsigned int hooknum); | ||
1260 | extern void ip_vs_dst_reset(struct ip_vs_dest *dest); | 1256 | extern void ip_vs_dst_reset(struct ip_vs_dest *dest); |
1261 | 1257 | ||
1262 | #ifdef CONFIG_IP_VS_IPV6 | 1258 | #ifdef CONFIG_IP_VS_IPV6 |
@@ -1270,7 +1266,7 @@ extern int ip_vs_dr_xmit_v6 | |||
1270 | (struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); | 1266 | (struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp); |
1271 | extern int ip_vs_icmp_xmit_v6 | 1267 | extern int ip_vs_icmp_xmit_v6 |
1272 | (struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, | 1268 | (struct sk_buff *skb, struct ip_vs_conn *cp, struct ip_vs_protocol *pp, |
1273 | int offset); | 1269 | int offset, unsigned int hooknum); |
1274 | #endif | 1270 | #endif |
1275 | 1271 | ||
1276 | #ifdef CONFIG_SYSCTL | 1272 | #ifdef CONFIG_SYSCTL |
@@ -1432,6 +1428,4 @@ ip_vs_dest_conn_overhead(struct ip_vs_dest *dest) | |||
1432 | atomic_read(&dest->inactconns); | 1428 | atomic_read(&dest->inactconns); |
1433 | } | 1429 | } |
1434 | 1430 | ||
1435 | #endif /* __KERNEL__ */ | ||
1436 | |||
1437 | #endif /* _NET_IP_VS_H */ | 1431 | #endif /* _NET_IP_VS_H */ |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 34200f9e6805..c033ed00df7d 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -77,11 +77,9 @@ | |||
77 | /* | 77 | /* |
78 | * Addr scopes | 78 | * Addr scopes |
79 | */ | 79 | */ |
80 | #ifdef __KERNEL__ | ||
81 | #define IPV6_ADDR_MC_SCOPE(a) \ | 80 | #define IPV6_ADDR_MC_SCOPE(a) \ |
82 | ((a)->s6_addr[1] & 0x0f) /* nonstandard */ | 81 | ((a)->s6_addr[1] & 0x0f) /* nonstandard */ |
83 | #define __IPV6_ADDR_SCOPE_INVALID -1 | 82 | #define __IPV6_ADDR_SCOPE_INVALID -1 |
84 | #endif | ||
85 | #define IPV6_ADDR_SCOPE_NODELOCAL 0x01 | 83 | #define IPV6_ADDR_SCOPE_NODELOCAL 0x01 |
86 | #define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 | 84 | #define IPV6_ADDR_SCOPE_LINKLOCAL 0x02 |
87 | #define IPV6_ADDR_SCOPE_SITELOCAL 0x05 | 85 | #define IPV6_ADDR_SCOPE_SITELOCAL 0x05 |
@@ -91,14 +89,12 @@ | |||
91 | /* | 89 | /* |
92 | * Addr flags | 90 | * Addr flags |
93 | */ | 91 | */ |
94 | #ifdef __KERNEL__ | ||
95 | #define IPV6_ADDR_MC_FLAG_TRANSIENT(a) \ | 92 | #define IPV6_ADDR_MC_FLAG_TRANSIENT(a) \ |
96 | ((a)->s6_addr[1] & 0x10) | 93 | ((a)->s6_addr[1] & 0x10) |
97 | #define IPV6_ADDR_MC_FLAG_PREFIX(a) \ | 94 | #define IPV6_ADDR_MC_FLAG_PREFIX(a) \ |
98 | ((a)->s6_addr[1] & 0x20) | 95 | ((a)->s6_addr[1] & 0x20) |
99 | #define IPV6_ADDR_MC_FLAG_RENDEZVOUS(a) \ | 96 | #define IPV6_ADDR_MC_FLAG_RENDEZVOUS(a) \ |
100 | ((a)->s6_addr[1] & 0x40) | 97 | ((a)->s6_addr[1] & 0x40) |
101 | #endif | ||
102 | 98 | ||
103 | /* | 99 | /* |
104 | * fragmentation header | 100 | * fragmentation header |
@@ -113,8 +109,6 @@ struct frag_hdr { | |||
113 | 109 | ||
114 | #define IP6_MF 0x0001 | 110 | #define IP6_MF 0x0001 |
115 | 111 | ||
116 | #ifdef __KERNEL__ | ||
117 | |||
118 | #include <net/sock.h> | 112 | #include <net/sock.h> |
119 | 113 | ||
120 | /* sysctls */ | 114 | /* sysctls */ |
@@ -129,6 +123,15 @@ extern struct ctl_path net_ipv6_ctl_path[]; | |||
129 | SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ | 123 | SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ |
130 | }) | 124 | }) |
131 | 125 | ||
126 | /* per device counters are atomic_long_t */ | ||
127 | #define _DEVINCATOMIC(net, statname, modifier, idev, field) \ | ||
128 | ({ \ | ||
129 | struct inet6_dev *_idev = (idev); \ | ||
130 | if (likely(_idev != NULL)) \ | ||
131 | SNMP_INC_STATS_ATOMIC_LONG((_idev)->stats.statname##dev, (field)); \ | ||
132 | SNMP_INC_STATS##modifier((net)->mib.statname##_statistics, (field));\ | ||
133 | }) | ||
134 | |||
132 | #define _DEVADD(net, statname, modifier, idev, field, val) \ | 135 | #define _DEVADD(net, statname, modifier, idev, field, val) \ |
133 | ({ \ | 136 | ({ \ |
134 | struct inet6_dev *_idev = (idev); \ | 137 | struct inet6_dev *_idev = (idev); \ |
@@ -160,16 +163,16 @@ extern struct ctl_path net_ipv6_ctl_path[]; | |||
160 | #define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ | 163 | #define IP6_UPD_PO_STATS_BH(net, idev,field,val) \ |
161 | _DEVUPD(net, ipv6, 64_BH, idev, field, val) | 164 | _DEVUPD(net, ipv6, 64_BH, idev, field, val) |
162 | #define ICMP6_INC_STATS(net, idev, field) \ | 165 | #define ICMP6_INC_STATS(net, idev, field) \ |
163 | _DEVINC(net, icmpv6, , idev, field) | 166 | _DEVINCATOMIC(net, icmpv6, , idev, field) |
164 | #define ICMP6_INC_STATS_BH(net, idev, field) \ | 167 | #define ICMP6_INC_STATS_BH(net, idev, field) \ |
165 | _DEVINC(net, icmpv6, _BH, idev, field) | 168 | _DEVINCATOMIC(net, icmpv6, _BH, idev, field) |
166 | 169 | ||
167 | #define ICMP6MSGOUT_INC_STATS(net, idev, field) \ | 170 | #define ICMP6MSGOUT_INC_STATS(net, idev, field) \ |
168 | _DEVINC(net, icmpv6msg, , idev, field +256) | 171 | _DEVINCATOMIC(net, icmpv6msg, , idev, field +256) |
169 | #define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \ | 172 | #define ICMP6MSGOUT_INC_STATS_BH(net, idev, field) \ |
170 | _DEVINC(net, icmpv6msg, _BH, idev, field +256) | 173 | _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field +256) |
171 | #define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ | 174 | #define ICMP6MSGIN_INC_STATS_BH(net, idev, field) \ |
172 | _DEVINC(net, icmpv6msg, _BH, idev, field) | 175 | _DEVINCATOMIC(net, icmpv6msg, _BH, idev, field) |
173 | 176 | ||
174 | struct ip6_ra_chain { | 177 | struct ip6_ra_chain { |
175 | struct ip6_ra_chain *next; | 178 | struct ip6_ra_chain *next; |
@@ -376,8 +379,8 @@ enum ip6_defrag_users { | |||
376 | struct ip6_create_arg { | 379 | struct ip6_create_arg { |
377 | __be32 id; | 380 | __be32 id; |
378 | u32 user; | 381 | u32 user; |
379 | struct in6_addr *src; | 382 | const struct in6_addr *src; |
380 | struct in6_addr *dst; | 383 | const struct in6_addr *dst; |
381 | }; | 384 | }; |
382 | 385 | ||
383 | void ip6_frag_init(struct inet_frag_queue *q, void *a); | 386 | void ip6_frag_init(struct inet_frag_queue *q, void *a); |
@@ -667,5 +670,4 @@ extern int ipv6_static_sysctl_register(void); | |||
667 | extern void ipv6_static_sysctl_unregister(void); | 670 | extern void ipv6_static_sysctl_unregister(void); |
668 | #endif | 671 | #endif |
669 | 672 | ||
670 | #endif /* __KERNEL__ */ | ||
671 | #endif /* _NET_IPV6_H */ | 673 | #endif /* _NET_IPV6_H */ |
diff --git a/include/net/ipx.h b/include/net/ipx.h index 05d7e4a88b49..c1fec6b464cc 100644 --- a/include/net/ipx.h +++ b/include/net/ipx.h | |||
@@ -80,7 +80,6 @@ struct ipx_route { | |||
80 | atomic_t refcnt; | 80 | atomic_t refcnt; |
81 | }; | 81 | }; |
82 | 82 | ||
83 | #ifdef __KERNEL__ | ||
84 | struct ipx_cb { | 83 | struct ipx_cb { |
85 | u8 ipx_tctrl; | 84 | u8 ipx_tctrl; |
86 | __be32 ipx_dest_net; | 85 | __be32 ipx_dest_net; |
@@ -116,7 +115,6 @@ static inline struct ipx_sock *ipx_sk(struct sock *sk) | |||
116 | } | 115 | } |
117 | 116 | ||
118 | #define IPX_SKB_CB(__skb) ((struct ipx_cb *)&((__skb)->cb[0])) | 117 | #define IPX_SKB_CB(__skb) ((struct ipx_cb *)&((__skb)->cb[0])) |
119 | #endif | ||
120 | 118 | ||
121 | #define IPX_MIN_EPHEMERAL_SOCKET 0x4000 | 119 | #define IPX_MIN_EPHEMERAL_SOCKET 0x4000 |
122 | #define IPX_MAX_EPHEMERAL_SOCKET 0x7fff | 120 | #define IPX_MAX_EPHEMERAL_SOCKET 0x7fff |
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 025d4cc7bbf8..8c7189c3f6ed 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -537,6 +537,21 @@ struct ieee80211_tx_info { | |||
537 | }; | 537 | }; |
538 | }; | 538 | }; |
539 | 539 | ||
540 | /** | ||
541 | * ieee80211_sched_scan_ies - scheduled scan IEs | ||
542 | * | ||
543 | * This structure is used to pass the appropriate IEs to be used in scheduled | ||
544 | * scans for all bands. It contains both the IEs passed from the userspace | ||
545 | * and the ones generated by mac80211. | ||
546 | * | ||
547 | * @ie: array with the IEs for each supported band | ||
548 | * @len: array with the total length of the IEs for each band | ||
549 | */ | ||
550 | struct ieee80211_sched_scan_ies { | ||
551 | u8 *ie[IEEE80211_NUM_BANDS]; | ||
552 | size_t len[IEEE80211_NUM_BANDS]; | ||
553 | }; | ||
554 | |||
540 | static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb) | 555 | static inline struct ieee80211_tx_info *IEEE80211_SKB_CB(struct sk_buff *skb) |
541 | { | 556 | { |
542 | return (struct ieee80211_tx_info *)skb->cb; | 557 | return (struct ieee80211_tx_info *)skb->cb; |
@@ -1606,6 +1621,18 @@ enum ieee80211_ampdu_mlme_action { | |||
1606 | * you should ensure to cancel it on this callback. | 1621 | * you should ensure to cancel it on this callback. |
1607 | * Must be implemented and can sleep. | 1622 | * Must be implemented and can sleep. |
1608 | * | 1623 | * |
1624 | * @suspend: Suspend the device; mac80211 itself will quiesce before and | ||
1625 | * stop transmitting and doing any other configuration, and then | ||
1626 | * ask the device to suspend. This is only invoked when WoWLAN is | ||
1627 | * configured, otherwise the device is deconfigured completely and | ||
1628 | * reconfigured at resume time. | ||
1629 | * | ||
1630 | * @resume: If WoWLAN was configured, this indicates that mac80211 is | ||
1631 | * now resuming its operation, after this the device must be fully | ||
1632 | * functional again. If this returns an error, the only way out is | ||
1633 | * to also unregister the device. If it returns 1, then mac80211 | ||
1634 | * will also go through the regular complete restart on resume. | ||
1635 | * | ||
1609 | * @add_interface: Called when a netdevice attached to the hardware is | 1636 | * @add_interface: Called when a netdevice attached to the hardware is |
1610 | * enabled. Because it is not called for monitor mode devices, @start | 1637 | * enabled. Because it is not called for monitor mode devices, @start |
1611 | * and @stop must be implemented. | 1638 | * and @stop must be implemented. |
@@ -1681,6 +1708,13 @@ enum ieee80211_ampdu_mlme_action { | |||
1681 | * any error unless this callback returned a negative error code. | 1708 | * any error unless this callback returned a negative error code. |
1682 | * The callback can sleep. | 1709 | * The callback can sleep. |
1683 | * | 1710 | * |
1711 | * @sched_scan_start: Ask the hardware to start scanning repeatedly at | ||
1712 | * specific intervals. The driver must call the | ||
1713 | * ieee80211_sched_scan_results() function whenever it finds results. | ||
1714 | * This process will continue until sched_scan_stop is called. | ||
1715 | * | ||
1716 | * @sched_scan_stop: Tell the hardware to stop an ongoing scheduled scan. | ||
1717 | * | ||
1684 | * @sw_scan_start: Notifier function that is called just before a software scan | 1718 | * @sw_scan_start: Notifier function that is called just before a software scan |
1685 | * is started. Can be NULL, if the driver doesn't need this notification. | 1719 | * is started. Can be NULL, if the driver doesn't need this notification. |
1686 | * The callback can sleep. | 1720 | * The callback can sleep. |
@@ -1819,11 +1853,22 @@ enum ieee80211_ampdu_mlme_action { | |||
1819 | * @set_ringparam: Set tx and rx ring sizes. | 1853 | * @set_ringparam: Set tx and rx ring sizes. |
1820 | * | 1854 | * |
1821 | * @get_ringparam: Get tx and rx ring current and maximum sizes. | 1855 | * @get_ringparam: Get tx and rx ring current and maximum sizes. |
1856 | * | ||
1857 | * @tx_frames_pending: Check if there is any pending frame in the hardware | ||
1858 | * queues before entering power save. | ||
1859 | * | ||
1860 | * @set_bitrate_mask: Set a mask of rates to be used for rate control selection | ||
1861 | * when transmitting a frame. Currently only legacy rates are handled. | ||
1862 | * The callback can sleep. | ||
1822 | */ | 1863 | */ |
1823 | struct ieee80211_ops { | 1864 | struct ieee80211_ops { |
1824 | void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); | 1865 | void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb); |
1825 | int (*start)(struct ieee80211_hw *hw); | 1866 | int (*start)(struct ieee80211_hw *hw); |
1826 | void (*stop)(struct ieee80211_hw *hw); | 1867 | void (*stop)(struct ieee80211_hw *hw); |
1868 | #ifdef CONFIG_PM | ||
1869 | int (*suspend)(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan); | ||
1870 | int (*resume)(struct ieee80211_hw *hw); | ||
1871 | #endif | ||
1827 | int (*add_interface)(struct ieee80211_hw *hw, | 1872 | int (*add_interface)(struct ieee80211_hw *hw, |
1828 | struct ieee80211_vif *vif); | 1873 | struct ieee80211_vif *vif); |
1829 | int (*change_interface)(struct ieee80211_hw *hw, | 1874 | int (*change_interface)(struct ieee80211_hw *hw, |
@@ -1854,6 +1899,12 @@ struct ieee80211_ops { | |||
1854 | u32 iv32, u16 *phase1key); | 1899 | u32 iv32, u16 *phase1key); |
1855 | int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | 1900 | int (*hw_scan)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, |
1856 | struct cfg80211_scan_request *req); | 1901 | struct cfg80211_scan_request *req); |
1902 | int (*sched_scan_start)(struct ieee80211_hw *hw, | ||
1903 | struct ieee80211_vif *vif, | ||
1904 | struct cfg80211_sched_scan_request *req, | ||
1905 | struct ieee80211_sched_scan_ies *ies); | ||
1906 | void (*sched_scan_stop)(struct ieee80211_hw *hw, | ||
1907 | struct ieee80211_vif *vif); | ||
1857 | void (*sw_scan_start)(struct ieee80211_hw *hw); | 1908 | void (*sw_scan_start)(struct ieee80211_hw *hw); |
1858 | void (*sw_scan_complete)(struct ieee80211_hw *hw); | 1909 | void (*sw_scan_complete)(struct ieee80211_hw *hw); |
1859 | int (*get_stats)(struct ieee80211_hw *hw, | 1910 | int (*get_stats)(struct ieee80211_hw *hw, |
@@ -1906,6 +1957,9 @@ struct ieee80211_ops { | |||
1906 | int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); | 1957 | int (*set_ringparam)(struct ieee80211_hw *hw, u32 tx, u32 rx); |
1907 | void (*get_ringparam)(struct ieee80211_hw *hw, | 1958 | void (*get_ringparam)(struct ieee80211_hw *hw, |
1908 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); | 1959 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); |
1960 | bool (*tx_frames_pending)(struct ieee80211_hw *hw); | ||
1961 | int (*set_bitrate_mask)(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | ||
1962 | const struct cfg80211_bitrate_mask *mask); | ||
1909 | }; | 1963 | }; |
1910 | 1964 | ||
1911 | /** | 1965 | /** |
@@ -2223,6 +2277,18 @@ static inline int ieee80211_sta_ps_transition_ni(struct ieee80211_sta *sta, | |||
2223 | #define IEEE80211_TX_STATUS_HEADROOM 13 | 2277 | #define IEEE80211_TX_STATUS_HEADROOM 13 |
2224 | 2278 | ||
2225 | /** | 2279 | /** |
2280 | * ieee80211_sta_set_tim - set the TIM bit for a sleeping station | ||
2281 | * | ||
2282 | * If a driver buffers frames for a powersave station instead of passing | ||
2283 | * them back to mac80211 for retransmission, the station needs to be told | ||
2284 | * to wake up using the TIM bitmap in the beacon. | ||
2285 | * | ||
2286 | * This function sets the station's TIM bit - it will be cleared when the | ||
2287 | * station wakes up. | ||
2288 | */ | ||
2289 | void ieee80211_sta_set_tim(struct ieee80211_sta *sta); | ||
2290 | |||
2291 | /** | ||
2226 | * ieee80211_tx_status - transmit status callback | 2292 | * ieee80211_tx_status - transmit status callback |
2227 | * | 2293 | * |
2228 | * Call this function for all transmitted frames after they have been | 2294 | * Call this function for all transmitted frames after they have been |
@@ -2276,6 +2342,17 @@ void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, | |||
2276 | struct sk_buff *skb); | 2342 | struct sk_buff *skb); |
2277 | 2343 | ||
2278 | /** | 2344 | /** |
2345 | * ieee80211_report_low_ack - report non-responding station | ||
2346 | * | ||
2347 | * When operating in AP-mode, call this function to report a non-responding | ||
2348 | * connected STA. | ||
2349 | * | ||
2350 | * @sta: the non-responding connected sta | ||
2351 | * @num_packets: number of packets sent to @sta without a response | ||
2352 | */ | ||
2353 | void ieee80211_report_low_ack(struct ieee80211_sta *sta, u32 num_packets); | ||
2354 | |||
2355 | /** | ||
2279 | * ieee80211_beacon_get_tim - beacon generation function | 2356 | * ieee80211_beacon_get_tim - beacon generation function |
2280 | * @hw: pointer obtained from ieee80211_alloc_hw(). | 2357 | * @hw: pointer obtained from ieee80211_alloc_hw(). |
2281 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. | 2358 | * @vif: &struct ieee80211_vif pointer from the add_interface callback. |
@@ -2545,6 +2622,28 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw); | |||
2545 | void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted); | 2622 | void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted); |
2546 | 2623 | ||
2547 | /** | 2624 | /** |
2625 | * ieee80211_sched_scan_results - got results from scheduled scan | ||
2626 | * | ||
2627 | * When a scheduled scan is running, this function needs to be called by the | ||
2628 | * driver whenever there are new scan results available. | ||
2629 | * | ||
2630 | * @hw: the hardware that is performing scheduled scans | ||
2631 | */ | ||
2632 | void ieee80211_sched_scan_results(struct ieee80211_hw *hw); | ||
2633 | |||
2634 | /** | ||
2635 | * ieee80211_sched_scan_stopped - inform that the scheduled scan has stopped | ||
2636 | * | ||
2637 | * When a scheduled scan is running, this function can be called by | ||
2638 | * the driver if it needs to stop the scan to perform another task. | ||
2639 | * Usual scenarios are drivers that cannot continue the scheduled scan | ||
2640 | * while associating, for instance. | ||
2641 | * | ||
2642 | * @hw: the hardware that is performing scheduled scans | ||
2643 | */ | ||
2644 | void ieee80211_sched_scan_stopped(struct ieee80211_hw *hw); | ||
2645 | |||
2646 | /** | ||
2548 | * ieee80211_iterate_active_interfaces - iterate active interfaces | 2647 | * ieee80211_iterate_active_interfaces - iterate active interfaces |
2549 | * | 2648 | * |
2550 | * This function iterates over the interfaces associated with a given | 2649 | * This function iterates over the interfaces associated with a given |
diff --git a/include/net/ndisc.h b/include/net/ndisc.h index e0e594f8e9d9..62beeb97c4b1 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h | |||
@@ -42,8 +42,6 @@ enum { | |||
42 | #define ND_REACHABLE_TIME (30*HZ) | 42 | #define ND_REACHABLE_TIME (30*HZ) |
43 | #define ND_RETRANS_TIMER HZ | 43 | #define ND_RETRANS_TIMER HZ |
44 | 44 | ||
45 | #ifdef __KERNEL__ | ||
46 | |||
47 | #include <linux/compiler.h> | 45 | #include <linux/compiler.h> |
48 | #include <linux/icmpv6.h> | 46 | #include <linux/icmpv6.h> |
49 | #include <linux/in6.h> | 47 | #include <linux/in6.h> |
@@ -102,7 +100,8 @@ extern void ndisc_send_redirect(struct sk_buff *skb, | |||
102 | struct neighbour *neigh, | 100 | struct neighbour *neigh, |
103 | const struct in6_addr *target); | 101 | const struct in6_addr *target); |
104 | 102 | ||
105 | extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir); | 103 | extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, |
104 | struct net_device *dev, int dir); | ||
106 | 105 | ||
107 | extern struct sk_buff *ndisc_build_skb(struct net_device *dev, | 106 | extern struct sk_buff *ndisc_build_skb(struct net_device *dev, |
108 | const struct in6_addr *daddr, | 107 | const struct in6_addr *daddr, |
@@ -155,8 +154,4 @@ static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, const s | |||
155 | return ERR_PTR(-ENODEV); | 154 | return ERR_PTR(-ENODEV); |
156 | } | 155 | } |
157 | 156 | ||
158 | |||
159 | #endif /* __KERNEL__ */ | ||
160 | |||
161 | |||
162 | #endif | 157 | #endif |
diff --git a/include/net/netevent.h b/include/net/netevent.h index 22b239c17eaa..086f8a5b59dc 100644 --- a/include/net/netevent.h +++ b/include/net/netevent.h | |||
@@ -10,7 +10,6 @@ | |||
10 | * | 10 | * |
11 | * Changes: | 11 | * Changes: |
12 | */ | 12 | */ |
13 | #ifdef __KERNEL__ | ||
14 | 13 | ||
15 | struct dst_entry; | 14 | struct dst_entry; |
16 | 15 | ||
@@ -29,4 +28,3 @@ extern int unregister_netevent_notifier(struct notifier_block *nb); | |||
29 | extern int call_netevent_notifiers(unsigned long val, void *v); | 28 | extern int call_netevent_notifiers(unsigned long val, void *v); |
30 | 29 | ||
31 | #endif | 30 | #endif |
32 | #endif | ||
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index d0d13378991e..c7c42e7acc31 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -14,7 +14,6 @@ | |||
14 | 14 | ||
15 | #include <linux/netfilter/nf_conntrack_common.h> | 15 | #include <linux/netfilter/nf_conntrack_common.h> |
16 | 16 | ||
17 | #ifdef __KERNEL__ | ||
18 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
19 | #include <linux/compiler.h> | 18 | #include <linux/compiler.h> |
20 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
@@ -326,5 +325,4 @@ do { \ | |||
326 | #define MODULE_ALIAS_NFCT_HELPER(helper) \ | 325 | #define MODULE_ALIAS_NFCT_HELPER(helper) \ |
327 | MODULE_ALIAS("nfct-helper-" helper) | 326 | MODULE_ALIAS("nfct-helper-" helper) |
328 | 327 | ||
329 | #endif /* __KERNEL__ */ | ||
330 | #endif /* _NF_CONNTRACK_H */ | 328 | #endif /* _NF_CONNTRACK_H */ |
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h index 4ee44c84a304..7ca6bdd5bae6 100644 --- a/include/net/netfilter/nf_conntrack_tuple.h +++ b/include/net/netfilter/nf_conntrack_tuple.h | |||
@@ -104,8 +104,6 @@ struct nf_conntrack_tuple_mask { | |||
104 | } src; | 104 | } src; |
105 | }; | 105 | }; |
106 | 106 | ||
107 | #ifdef __KERNEL__ | ||
108 | |||
109 | static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t) | 107 | static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t) |
110 | { | 108 | { |
111 | #ifdef DEBUG | 109 | #ifdef DEBUG |
@@ -148,8 +146,6 @@ struct nf_conntrack_tuple_hash { | |||
148 | struct nf_conntrack_tuple tuple; | 146 | struct nf_conntrack_tuple tuple; |
149 | }; | 147 | }; |
150 | 148 | ||
151 | #endif /* __KERNEL__ */ | ||
152 | |||
153 | static inline bool __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, | 149 | static inline bool __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, |
154 | const struct nf_conntrack_tuple *t2) | 150 | const struct nf_conntrack_tuple *t2) |
155 | { | 151 | { |
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h index aff80b190c12..0346b0070864 100644 --- a/include/net/netfilter/nf_nat.h +++ b/include/net/netfilter/nf_nat.h | |||
@@ -48,7 +48,6 @@ struct nf_nat_multi_range_compat { | |||
48 | struct nf_nat_range range[1]; | 48 | struct nf_nat_range range[1]; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | #ifdef __KERNEL__ | ||
52 | #include <linux/list.h> | 51 | #include <linux/list.h> |
53 | #include <linux/netfilter/nf_conntrack_pptp.h> | 52 | #include <linux/netfilter/nf_conntrack_pptp.h> |
54 | #include <net/netfilter/nf_conntrack_extend.h> | 53 | #include <net/netfilter/nf_conntrack_extend.h> |
@@ -93,7 +92,4 @@ static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct) | |||
93 | #endif | 92 | #endif |
94 | } | 93 | } |
95 | 94 | ||
96 | #else /* !__KERNEL__: iptables wants this to compile. */ | ||
97 | #define nf_nat_multi_range nf_nat_multi_range_compat | ||
98 | #endif /*__KERNEL__*/ | ||
99 | #endif | 95 | #endif |
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 542195d9469e..d786b4fc02a4 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h | |||
@@ -54,6 +54,8 @@ struct netns_ipv4 { | |||
54 | int sysctl_rt_cache_rebuild_count; | 54 | int sysctl_rt_cache_rebuild_count; |
55 | int current_rt_cache_rebuild_count; | 55 | int current_rt_cache_rebuild_count; |
56 | 56 | ||
57 | unsigned int sysctl_ping_group_range[2]; | ||
58 | |||
57 | atomic_t rt_genid; | 59 | atomic_t rt_genid; |
58 | atomic_t dev_addr_genid; | 60 | atomic_t dev_addr_genid; |
59 | 61 | ||
diff --git a/include/net/phonet/pn_dev.h b/include/net/phonet/pn_dev.h index 13649eb57413..8639de5750f6 100644 --- a/include/net/phonet/pn_dev.h +++ b/include/net/phonet/pn_dev.h | |||
@@ -51,7 +51,7 @@ void phonet_address_notify(int event, struct net_device *dev, u8 addr); | |||
51 | int phonet_route_add(struct net_device *dev, u8 daddr); | 51 | int phonet_route_add(struct net_device *dev, u8 daddr); |
52 | int phonet_route_del(struct net_device *dev, u8 daddr); | 52 | int phonet_route_del(struct net_device *dev, u8 daddr); |
53 | void rtm_phonet_notify(int event, struct net_device *dev, u8 dst); | 53 | void rtm_phonet_notify(int event, struct net_device *dev, u8 dst); |
54 | struct net_device *phonet_route_get(struct net *net, u8 daddr); | 54 | struct net_device *phonet_route_get_rcu(struct net *net, u8 daddr); |
55 | struct net_device *phonet_route_output(struct net *net, u8 daddr); | 55 | struct net_device *phonet_route_output(struct net *net, u8 daddr); |
56 | 56 | ||
57 | #define PN_NO_ADDR 0xff | 57 | #define PN_NO_ADDR 0xff |
diff --git a/include/net/ping.h b/include/net/ping.h new file mode 100644 index 000000000000..682b5ae9af51 --- /dev/null +++ b/include/net/ping.h | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | ||
3 | * operating system. INET is implemented using the BSD Socket | ||
4 | * interface as the means of communication with the user level. | ||
5 | * | ||
6 | * Definitions for the "ping" module. | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | #ifndef _PING_H | ||
14 | #define _PING_H | ||
15 | |||
16 | #include <net/netns/hash.h> | ||
17 | |||
18 | /* PING_HTABLE_SIZE must be power of 2 */ | ||
19 | #define PING_HTABLE_SIZE 64 | ||
20 | #define PING_HTABLE_MASK (PING_HTABLE_SIZE-1) | ||
21 | |||
22 | #define ping_portaddr_for_each_entry(__sk, node, list) \ | ||
23 | hlist_nulls_for_each_entry(__sk, node, list, sk_nulls_node) | ||
24 | |||
25 | /* | ||
26 | * gid_t is either uint or ushort. We want to pass it to | ||
27 | * proc_dointvec_minmax(), so it must not be larger than MAX_INT | ||
28 | */ | ||
29 | #define GID_T_MAX (((gid_t)~0U) >> 1) | ||
30 | |||
31 | struct ping_table { | ||
32 | struct hlist_nulls_head hash[PING_HTABLE_SIZE]; | ||
33 | rwlock_t lock; | ||
34 | }; | ||
35 | |||
36 | struct ping_iter_state { | ||
37 | struct seq_net_private p; | ||
38 | int bucket; | ||
39 | }; | ||
40 | |||
41 | extern struct proto ping_prot; | ||
42 | |||
43 | |||
44 | extern void ping_rcv(struct sk_buff *); | ||
45 | extern void ping_err(struct sk_buff *, u32 info); | ||
46 | |||
47 | #ifdef CONFIG_PROC_FS | ||
48 | extern int __init ping_proc_init(void); | ||
49 | extern void ping_proc_exit(void); | ||
50 | #endif | ||
51 | |||
52 | void __init ping_init(void); | ||
53 | |||
54 | |||
55 | #endif /* _PING_H */ | ||
diff --git a/include/net/rawv6.h b/include/net/rawv6.h index f6b9b830df8c..cf7577234457 100644 --- a/include/net/rawv6.h +++ b/include/net/rawv6.h | |||
@@ -1,8 +1,6 @@ | |||
1 | #ifndef _NET_RAWV6_H | 1 | #ifndef _NET_RAWV6_H |
2 | #define _NET_RAWV6_H | 2 | #define _NET_RAWV6_H |
3 | 3 | ||
4 | #ifdef __KERNEL__ | ||
5 | |||
6 | #include <net/protocol.h> | 4 | #include <net/protocol.h> |
7 | 5 | ||
8 | void raw6_icmp_error(struct sk_buff *, int nexthdr, | 6 | void raw6_icmp_error(struct sk_buff *, int nexthdr, |
@@ -20,5 +18,3 @@ int rawv6_mh_filter_unregister(int (*filter)(struct sock *sock, | |||
20 | #endif | 18 | #endif |
21 | 19 | ||
22 | #endif | 20 | #endif |
23 | |||
24 | #endif | ||
diff --git a/include/net/route.h b/include/net/route.h index 8fce0621cad1..db7b3432f07c 100644 --- a/include/net/route.h +++ b/include/net/route.h | |||
@@ -35,16 +35,8 @@ | |||
35 | #include <linux/cache.h> | 35 | #include <linux/cache.h> |
36 | #include <linux/security.h> | 36 | #include <linux/security.h> |
37 | 37 | ||
38 | #ifndef __KERNEL__ | ||
39 | #warning This file is not supposed to be used outside of kernel. | ||
40 | #endif | ||
41 | |||
42 | #define RTO_ONLINK 0x01 | 38 | #define RTO_ONLINK 0x01 |
43 | 39 | ||
44 | #define RTO_CONN 0 | ||
45 | /* RTO_CONN is not used (being alias for 0), but preserved not to break | ||
46 | * some modules referring to it. */ | ||
47 | |||
48 | #define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE)) | 40 | #define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE)) |
49 | 41 | ||
50 | struct fib_nh; | 42 | struct fib_nh; |
@@ -60,7 +52,7 @@ struct rtable { | |||
60 | int rt_genid; | 52 | int rt_genid; |
61 | unsigned rt_flags; | 53 | unsigned rt_flags; |
62 | __u16 rt_type; | 54 | __u16 rt_type; |
63 | __u8 rt_tos; | 55 | __u8 rt_key_tos; |
64 | 56 | ||
65 | __be32 rt_dst; /* Path destination */ | 57 | __be32 rt_dst; /* Path destination */ |
66 | __be32 rt_src; /* Path source */ | 58 | __be32 rt_src; /* Path source */ |
@@ -123,7 +115,7 @@ extern void ip_rt_redirect(__be32 old_gw, __be32 dst, __be32 new_gw, | |||
123 | __be32 src, struct net_device *dev); | 115 | __be32 src, struct net_device *dev); |
124 | extern void rt_cache_flush(struct net *net, int how); | 116 | extern void rt_cache_flush(struct net *net, int how); |
125 | extern void rt_cache_flush_batch(struct net *net); | 117 | extern void rt_cache_flush_batch(struct net *net); |
126 | extern struct rtable *__ip_route_output_key(struct net *, const struct flowi4 *flp); | 118 | extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp); |
127 | extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, | 119 | extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, |
128 | struct sock *sk); | 120 | struct sock *sk); |
129 | extern struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig); | 121 | extern struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig); |
@@ -145,40 +137,33 @@ static inline struct rtable *ip_route_output(struct net *net, __be32 daddr, | |||
145 | return ip_route_output_key(net, &fl4); | 137 | return ip_route_output_key(net, &fl4); |
146 | } | 138 | } |
147 | 139 | ||
148 | static inline struct rtable *ip_route_output_ports(struct net *net, struct sock *sk, | 140 | static inline struct rtable *ip_route_output_ports(struct net *net, struct flowi4 *fl4, |
141 | struct sock *sk, | ||
149 | __be32 daddr, __be32 saddr, | 142 | __be32 daddr, __be32 saddr, |
150 | __be16 dport, __be16 sport, | 143 | __be16 dport, __be16 sport, |
151 | __u8 proto, __u8 tos, int oif) | 144 | __u8 proto, __u8 tos, int oif) |
152 | { | 145 | { |
153 | struct flowi4 fl4 = { | 146 | flowi4_init_output(fl4, oif, sk ? sk->sk_mark : 0, tos, |
154 | .flowi4_oif = oif, | 147 | RT_SCOPE_UNIVERSE, proto, |
155 | .flowi4_flags = sk ? inet_sk_flowi_flags(sk) : 0, | 148 | sk ? inet_sk_flowi_flags(sk) : 0, |
156 | .flowi4_mark = sk ? sk->sk_mark : 0, | 149 | daddr, saddr, dport, sport); |
157 | .daddr = daddr, | ||
158 | .saddr = saddr, | ||
159 | .flowi4_tos = tos, | ||
160 | .flowi4_proto = proto, | ||
161 | .fl4_dport = dport, | ||
162 | .fl4_sport = sport, | ||
163 | }; | ||
164 | if (sk) | 150 | if (sk) |
165 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); | 151 | security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); |
166 | return ip_route_output_flow(net, &fl4, sk); | 152 | return ip_route_output_flow(net, fl4, sk); |
167 | } | 153 | } |
168 | 154 | ||
169 | static inline struct rtable *ip_route_output_gre(struct net *net, | 155 | static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4 *fl4, |
170 | __be32 daddr, __be32 saddr, | 156 | __be32 daddr, __be32 saddr, |
171 | __be32 gre_key, __u8 tos, int oif) | 157 | __be32 gre_key, __u8 tos, int oif) |
172 | { | 158 | { |
173 | struct flowi4 fl4 = { | 159 | memset(fl4, 0, sizeof(*fl4)); |
174 | .flowi4_oif = oif, | 160 | fl4->flowi4_oif = oif; |
175 | .daddr = daddr, | 161 | fl4->daddr = daddr; |
176 | .saddr = saddr, | 162 | fl4->saddr = saddr; |
177 | .flowi4_tos = tos, | 163 | fl4->flowi4_tos = tos; |
178 | .flowi4_proto = IPPROTO_GRE, | 164 | fl4->flowi4_proto = IPPROTO_GRE; |
179 | .fl4_gre_key = gre_key, | 165 | fl4->fl4_gre_key = gre_key; |
180 | }; | 166 | return ip_route_output_key(net, fl4); |
181 | return ip_route_output_key(net, &fl4); | ||
182 | } | 167 | } |
183 | 168 | ||
184 | extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, | 169 | extern int ip_route_input_common(struct sk_buff *skb, __be32 dst, __be32 src, |
@@ -196,14 +181,15 @@ static inline int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 s | |||
196 | return ip_route_input_common(skb, dst, src, tos, devin, true); | 181 | return ip_route_input_common(skb, dst, src, tos, devin, true); |
197 | } | 182 | } |
198 | 183 | ||
199 | extern unsigned short ip_rt_frag_needed(struct net *net, struct iphdr *iph, unsigned short new_mtu, struct net_device *dev); | 184 | extern unsigned short ip_rt_frag_needed(struct net *net, const struct iphdr *iph, |
185 | unsigned short new_mtu, struct net_device *dev); | ||
200 | extern void ip_rt_send_redirect(struct sk_buff *skb); | 186 | extern void ip_rt_send_redirect(struct sk_buff *skb); |
201 | 187 | ||
202 | extern unsigned inet_addr_type(struct net *net, __be32 addr); | 188 | extern unsigned inet_addr_type(struct net *net, __be32 addr); |
203 | extern unsigned inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); | 189 | extern unsigned inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); |
204 | extern void ip_rt_multicast_event(struct in_device *); | 190 | extern void ip_rt_multicast_event(struct in_device *); |
205 | extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); | 191 | extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); |
206 | extern void ip_rt_get_source(u8 *src, struct rtable *rt); | 192 | extern void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); |
207 | extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); | 193 | extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); |
208 | 194 | ||
209 | struct in_ifaddr; | 195 | struct in_ifaddr; |
@@ -225,78 +211,93 @@ static inline char rt_tos2priority(u8 tos) | |||
225 | return ip_tos2prio[IPTOS_TOS(tos)>>1]; | 211 | return ip_tos2prio[IPTOS_TOS(tos)>>1]; |
226 | } | 212 | } |
227 | 213 | ||
228 | static inline struct rtable *ip_route_connect(__be32 dst, __be32 src, u32 tos, | 214 | /* ip_route_connect() and ip_route_newports() work in tandem whilst |
215 | * binding a socket for a new outgoing connection. | ||
216 | * | ||
217 | * In order to use IPSEC properly, we must, in the end, have a | ||
218 | * route that was looked up using all available keys including source | ||
219 | * and destination ports. | ||
220 | * | ||
221 | * However, if a source port needs to be allocated (the user specified | ||
222 | * a wildcard source port) we need to obtain addressing information | ||
223 | * in order to perform that allocation. | ||
224 | * | ||
225 | * So ip_route_connect() looks up a route using wildcarded source and | ||
226 | * destination ports in the key, simply so that we can get a pair of | ||
227 | * addresses to use for port allocation. | ||
228 | * | ||
229 | * Later, once the ports are allocated, ip_route_newports() will make | ||
230 | * another route lookup if needed to make sure we catch any IPSEC | ||
231 | * rules keyed on the port information. | ||
232 | * | ||
233 | * The callers allocate the flow key on their stack, and must pass in | ||
234 | * the same flowi4 object to both the ip_route_connect() and the | ||
235 | * ip_route_newports() calls. | ||
236 | */ | ||
237 | |||
238 | static inline void ip_route_connect_init(struct flowi4 *fl4, __be32 dst, __be32 src, | ||
239 | u32 tos, int oif, u8 protocol, | ||
240 | __be16 sport, __be16 dport, | ||
241 | struct sock *sk, bool can_sleep) | ||
242 | { | ||
243 | __u8 flow_flags = 0; | ||
244 | |||
245 | if (inet_sk(sk)->transparent) | ||
246 | flow_flags |= FLOWI_FLAG_ANYSRC; | ||
247 | if (protocol == IPPROTO_TCP) | ||
248 | flow_flags |= FLOWI_FLAG_PRECOW_METRICS; | ||
249 | if (can_sleep) | ||
250 | flow_flags |= FLOWI_FLAG_CAN_SLEEP; | ||
251 | |||
252 | flowi4_init_output(fl4, oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE, | ||
253 | protocol, flow_flags, dst, src, dport, sport); | ||
254 | } | ||
255 | |||
256 | static inline struct rtable *ip_route_connect(struct flowi4 *fl4, | ||
257 | __be32 dst, __be32 src, u32 tos, | ||
229 | int oif, u8 protocol, | 258 | int oif, u8 protocol, |
230 | __be16 sport, __be16 dport, | 259 | __be16 sport, __be16 dport, |
231 | struct sock *sk, bool can_sleep) | 260 | struct sock *sk, bool can_sleep) |
232 | { | 261 | { |
233 | struct flowi4 fl4 = { | ||
234 | .flowi4_oif = oif, | ||
235 | .flowi4_mark = sk->sk_mark, | ||
236 | .daddr = dst, | ||
237 | .saddr = src, | ||
238 | .flowi4_tos = tos, | ||
239 | .flowi4_proto = protocol, | ||
240 | .fl4_sport = sport, | ||
241 | .fl4_dport = dport, | ||
242 | }; | ||
243 | struct net *net = sock_net(sk); | 262 | struct net *net = sock_net(sk); |
244 | struct rtable *rt; | 263 | struct rtable *rt; |
245 | 264 | ||
246 | if (inet_sk(sk)->transparent) | 265 | ip_route_connect_init(fl4, dst, src, tos, oif, protocol, |
247 | fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC; | 266 | sport, dport, sk, can_sleep); |
248 | if (protocol == IPPROTO_TCP) | ||
249 | fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS; | ||
250 | if (can_sleep) | ||
251 | fl4.flowi4_flags |= FLOWI_FLAG_CAN_SLEEP; | ||
252 | 267 | ||
253 | if (!dst || !src) { | 268 | if (!dst || !src) { |
254 | rt = __ip_route_output_key(net, &fl4); | 269 | rt = __ip_route_output_key(net, fl4); |
255 | if (IS_ERR(rt)) | 270 | if (IS_ERR(rt)) |
256 | return rt; | 271 | return rt; |
257 | fl4.daddr = rt->rt_dst; | ||
258 | fl4.saddr = rt->rt_src; | ||
259 | ip_rt_put(rt); | 272 | ip_rt_put(rt); |
260 | } | 273 | } |
261 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); | 274 | security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); |
262 | return ip_route_output_flow(net, &fl4, sk); | 275 | return ip_route_output_flow(net, fl4, sk); |
263 | } | 276 | } |
264 | 277 | ||
265 | static inline struct rtable *ip_route_newports(struct rtable *rt, | 278 | static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable *rt, |
266 | u8 protocol, __be16 orig_sport, | 279 | __be16 orig_sport, __be16 orig_dport, |
267 | __be16 orig_dport, __be16 sport, | 280 | __be16 sport, __be16 dport, |
268 | __be16 dport, struct sock *sk) | 281 | struct sock *sk) |
269 | { | 282 | { |
270 | if (sport != orig_sport || dport != orig_dport) { | 283 | if (sport != orig_sport || dport != orig_dport) { |
271 | struct flowi4 fl4 = { | 284 | fl4->fl4_dport = dport; |
272 | .flowi4_oif = rt->rt_oif, | 285 | fl4->fl4_sport = sport; |
273 | .flowi4_mark = rt->rt_mark, | ||
274 | .daddr = rt->rt_dst, | ||
275 | .saddr = rt->rt_src, | ||
276 | .flowi4_tos = rt->rt_tos, | ||
277 | .flowi4_proto = protocol, | ||
278 | .fl4_sport = sport, | ||
279 | .fl4_dport = dport | ||
280 | }; | ||
281 | if (inet_sk(sk)->transparent) | ||
282 | fl4.flowi4_flags |= FLOWI_FLAG_ANYSRC; | ||
283 | if (protocol == IPPROTO_TCP) | ||
284 | fl4.flowi4_flags |= FLOWI_FLAG_PRECOW_METRICS; | ||
285 | ip_rt_put(rt); | 286 | ip_rt_put(rt); |
286 | security_sk_classify_flow(sk, flowi4_to_flowi(&fl4)); | 287 | security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); |
287 | return ip_route_output_flow(sock_net(sk), &fl4, sk); | 288 | return ip_route_output_flow(sock_net(sk), fl4, sk); |
288 | } | 289 | } |
289 | return rt; | 290 | return rt; |
290 | } | 291 | } |
291 | 292 | ||
292 | extern void rt_bind_peer(struct rtable *rt, int create); | 293 | extern void rt_bind_peer(struct rtable *rt, __be32 daddr, int create); |
293 | 294 | ||
294 | static inline struct inet_peer *rt_get_peer(struct rtable *rt) | 295 | static inline struct inet_peer *rt_get_peer(struct rtable *rt, __be32 daddr) |
295 | { | 296 | { |
296 | if (rt->peer) | 297 | if (rt->peer) |
297 | return rt->peer; | 298 | return rt->peer; |
298 | 299 | ||
299 | rt_bind_peer(rt, 0); | 300 | rt_bind_peer(rt, daddr, 0); |
300 | return rt->peer; | 301 | return rt->peer; |
301 | } | 302 | } |
302 | 303 | ||
diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index c01dc99def07..2b447646ce4b 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h | |||
@@ -73,7 +73,6 @@ typedef enum { | |||
73 | SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */ | 73 | SCTP_CMD_INIT_FAILED, /* High level, do init failure work. */ |
74 | SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */ | 74 | SCTP_CMD_REPORT_DUP, /* Report a duplicate TSN. */ |
75 | SCTP_CMD_STRIKE, /* Mark a strike against a transport. */ | 75 | SCTP_CMD_STRIKE, /* Mark a strike against a transport. */ |
76 | SCTP_CMD_TRANSMIT, /* Transmit the outqueue. */ | ||
77 | SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */ | 76 | SCTP_CMD_HB_TIMERS_START, /* Start the heartbeat timers. */ |
78 | SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */ | 77 | SCTP_CMD_HB_TIMER_UPDATE, /* Update a heartbeat timers. */ |
79 | SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */ | 78 | SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */ |
diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index c70d8ccc55cb..942b864f6135 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h | |||
@@ -150,7 +150,6 @@ SCTP_SUBTYPE_CONSTRUCTOR(OTHER, sctp_event_other_t, other) | |||
150 | SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive) | 150 | SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive) |
151 | 151 | ||
152 | 152 | ||
153 | #define sctp_chunk_is_control(a) (a->chunk_hdr->type != SCTP_CID_DATA) | ||
154 | #define sctp_chunk_is_data(a) (a->chunk_hdr->type == SCTP_CID_DATA) | 153 | #define sctp_chunk_is_data(a) (a->chunk_hdr->type == SCTP_CID_DATA) |
155 | 154 | ||
156 | /* Calculate the actual data size in a data chunk */ | 155 | /* Calculate the actual data size in a data chunk */ |
@@ -188,15 +187,14 @@ typedef enum { | |||
188 | /* SCTP state defines for internal state machine */ | 187 | /* SCTP state defines for internal state machine */ |
189 | typedef enum { | 188 | typedef enum { |
190 | 189 | ||
191 | SCTP_STATE_EMPTY = 0, | 190 | SCTP_STATE_CLOSED = 0, |
192 | SCTP_STATE_CLOSED = 1, | 191 | SCTP_STATE_COOKIE_WAIT = 1, |
193 | SCTP_STATE_COOKIE_WAIT = 2, | 192 | SCTP_STATE_COOKIE_ECHOED = 2, |
194 | SCTP_STATE_COOKIE_ECHOED = 3, | 193 | SCTP_STATE_ESTABLISHED = 3, |
195 | SCTP_STATE_ESTABLISHED = 4, | 194 | SCTP_STATE_SHUTDOWN_PENDING = 4, |
196 | SCTP_STATE_SHUTDOWN_PENDING = 5, | 195 | SCTP_STATE_SHUTDOWN_SENT = 5, |
197 | SCTP_STATE_SHUTDOWN_SENT = 6, | 196 | SCTP_STATE_SHUTDOWN_RECEIVED = 6, |
198 | SCTP_STATE_SHUTDOWN_RECEIVED = 7, | 197 | SCTP_STATE_SHUTDOWN_ACK_SENT = 7, |
199 | SCTP_STATE_SHUTDOWN_ACK_SENT = 8, | ||
200 | 198 | ||
201 | } sctp_state_t; | 199 | } sctp_state_t; |
202 | 200 | ||
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 01e094c6d0ae..b2c2366676a7 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h | |||
@@ -530,7 +530,6 @@ _sctp_walk_params((pos), (chunk), ntohs((chunk)->chunk_hdr.length), member) | |||
530 | 530 | ||
531 | #define _sctp_walk_params(pos, chunk, end, member)\ | 531 | #define _sctp_walk_params(pos, chunk, end, member)\ |
532 | for (pos.v = chunk->member;\ | 532 | for (pos.v = chunk->member;\ |
533 | pos.v <= (void *)chunk + end - sizeof(sctp_paramhdr_t) &&\ | ||
534 | pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ | 533 | pos.v <= (void *)chunk + end - ntohs(pos.p->length) &&\ |
535 | ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ | 534 | ntohs(pos.p->length) >= sizeof(sctp_paramhdr_t);\ |
536 | pos.v += WORD_ROUND(ntohs(pos.p->length))) | 535 | pos.v += WORD_ROUND(ntohs(pos.p->length))) |
@@ -541,7 +540,6 @@ _sctp_walk_errors((err), (chunk_hdr), ntohs((chunk_hdr)->length)) | |||
541 | #define _sctp_walk_errors(err, chunk_hdr, end)\ | 540 | #define _sctp_walk_errors(err, chunk_hdr, end)\ |
542 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ | 541 | for (err = (sctp_errhdr_t *)((void *)chunk_hdr + \ |
543 | sizeof(sctp_chunkhdr_t));\ | 542 | sizeof(sctp_chunkhdr_t));\ |
544 | (void *)err <= (void *)chunk_hdr + end - sizeof(sctp_errhdr_t) &&\ | ||
545 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ | 543 | (void *)err <= (void *)chunk_hdr + end - ntohs(err->length) &&\ |
546 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ | 544 | ntohs(err->length) >= sizeof(sctp_errhdr_t); \ |
547 | err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length)))) | 545 | err = (sctp_errhdr_t *)((void *)err + WORD_ROUND(ntohs(err->length)))) |
diff --git a/include/net/sctp/sm.h b/include/net/sctp/sm.h index 9352d12f02de..9148632b8204 100644 --- a/include/net/sctp/sm.h +++ b/include/net/sctp/sm.h | |||
@@ -165,6 +165,7 @@ sctp_state_fn_t sctp_sf_do_prm_requestheartbeat; | |||
165 | sctp_state_fn_t sctp_sf_do_prm_asconf; | 165 | sctp_state_fn_t sctp_sf_do_prm_asconf; |
166 | 166 | ||
167 | /* Prototypes for other event state functions. */ | 167 | /* Prototypes for other event state functions. */ |
168 | sctp_state_fn_t sctp_sf_do_no_pending_tsn; | ||
168 | sctp_state_fn_t sctp_sf_do_9_2_start_shutdown; | 169 | sctp_state_fn_t sctp_sf_do_9_2_start_shutdown; |
169 | sctp_state_fn_t sctp_sf_do_9_2_shutdown_ack; | 170 | sctp_state_fn_t sctp_sf_do_9_2_shutdown_ack; |
170 | sctp_state_fn_t sctp_sf_ignore_other; | 171 | sctp_state_fn_t sctp_sf_ignore_other; |
@@ -232,9 +233,7 @@ struct sctp_chunk *sctp_make_violation_paramlen(const struct sctp_association *, | |||
232 | const struct sctp_chunk *, | 233 | const struct sctp_chunk *, |
233 | struct sctp_paramhdr *); | 234 | struct sctp_paramhdr *); |
234 | struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *, | 235 | struct sctp_chunk *sctp_make_heartbeat(const struct sctp_association *, |
235 | const struct sctp_transport *, | 236 | const struct sctp_transport *); |
236 | const void *payload, | ||
237 | const size_t paylen); | ||
238 | struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *, | 237 | struct sctp_chunk *sctp_make_heartbeat_ack(const struct sctp_association *, |
239 | const struct sctp_chunk *, | 238 | const struct sctp_chunk *, |
240 | const void *payload, | 239 | const void *payload, |
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 0f6e60a9c308..795f4886e111 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -564,19 +564,15 @@ struct sctp_af { | |||
564 | int optname, | 564 | int optname, |
565 | char __user *optval, | 565 | char __user *optval, |
566 | int __user *optlen); | 566 | int __user *optlen); |
567 | struct dst_entry *(*get_dst) (struct sctp_association *asoc, | 567 | void (*get_dst) (struct sctp_transport *t, |
568 | union sctp_addr *daddr, | 568 | union sctp_addr *saddr, |
569 | union sctp_addr *saddr); | 569 | struct flowi *fl, |
570 | struct sock *sk); | ||
570 | void (*get_saddr) (struct sctp_sock *sk, | 571 | void (*get_saddr) (struct sctp_sock *sk, |
571 | struct sctp_association *asoc, | 572 | struct sctp_transport *t, |
572 | struct dst_entry *dst, | 573 | struct flowi *fl); |
573 | union sctp_addr *daddr, | ||
574 | union sctp_addr *saddr); | ||
575 | void (*copy_addrlist) (struct list_head *, | 574 | void (*copy_addrlist) (struct list_head *, |
576 | struct net_device *); | 575 | struct net_device *); |
577 | void (*dst_saddr) (union sctp_addr *saddr, | ||
578 | struct dst_entry *dst, | ||
579 | __be16 port); | ||
580 | int (*cmp_addr) (const union sctp_addr *addr1, | 576 | int (*cmp_addr) (const union sctp_addr *addr1, |
581 | const union sctp_addr *addr2); | 577 | const union sctp_addr *addr2); |
582 | void (*addr_copy) (union sctp_addr *dst, | 578 | void (*addr_copy) (union sctp_addr *dst, |
@@ -898,6 +894,7 @@ struct sctp_transport { | |||
898 | /* Is this structure kfree()able? */ | 894 | /* Is this structure kfree()able? */ |
899 | malloced:1; | 895 | malloced:1; |
900 | 896 | ||
897 | struct flowi fl; | ||
901 | 898 | ||
902 | /* This is the peer's IP address and port. */ | 899 | /* This is the peer's IP address and port. */ |
903 | union sctp_addr ipaddr; | 900 | union sctp_addr ipaddr; |
@@ -1061,7 +1058,7 @@ void sctp_transport_set_owner(struct sctp_transport *, | |||
1061 | struct sctp_association *); | 1058 | struct sctp_association *); |
1062 | void sctp_transport_route(struct sctp_transport *, union sctp_addr *, | 1059 | void sctp_transport_route(struct sctp_transport *, union sctp_addr *, |
1063 | struct sctp_sock *); | 1060 | struct sctp_sock *); |
1064 | void sctp_transport_pmtu(struct sctp_transport *); | 1061 | void sctp_transport_pmtu(struct sctp_transport *, struct sock *sk); |
1065 | void sctp_transport_free(struct sctp_transport *); | 1062 | void sctp_transport_free(struct sctp_transport *); |
1066 | void sctp_transport_reset_timers(struct sctp_transport *); | 1063 | void sctp_transport_reset_timers(struct sctp_transport *); |
1067 | void sctp_transport_hold(struct sctp_transport *); | 1064 | void sctp_transport_hold(struct sctp_transport *); |
@@ -1400,7 +1397,7 @@ int sctp_has_association(const union sctp_addr *laddr, | |||
1400 | int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t, | 1397 | int sctp_verify_init(const struct sctp_association *asoc, sctp_cid_t, |
1401 | sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk, | 1398 | sctp_init_chunk_t *peer_init, struct sctp_chunk *chunk, |
1402 | struct sctp_chunk **err_chunk); | 1399 | struct sctp_chunk **err_chunk); |
1403 | int sctp_process_init(struct sctp_association *, sctp_cid_t cid, | 1400 | int sctp_process_init(struct sctp_association *, struct sctp_chunk *chunk, |
1404 | const union sctp_addr *peer, | 1401 | const union sctp_addr *peer, |
1405 | sctp_init_chunk_t *init, gfp_t gfp); | 1402 | sctp_init_chunk_t *init, gfp_t gfp); |
1406 | __u32 sctp_generate_tag(const struct sctp_endpoint *); | 1403 | __u32 sctp_generate_tag(const struct sctp_endpoint *); |
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h index 7ea12e8e6676..99b027b2adce 100644 --- a/include/net/sctp/ulpevent.h +++ b/include/net/sctp/ulpevent.h | |||
@@ -132,6 +132,9 @@ struct sctp_ulpevent *sctp_ulpevent_make_authkey( | |||
132 | const struct sctp_association *asoc, __u16 key_id, | 132 | const struct sctp_association *asoc, __u16 key_id, |
133 | __u32 indication, gfp_t gfp); | 133 | __u32 indication, gfp_t gfp); |
134 | 134 | ||
135 | struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event( | ||
136 | const struct sctp_association *asoc, gfp_t gfp); | ||
137 | |||
135 | void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, | 138 | void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, |
136 | struct msghdr *); | 139 | struct msghdr *); |
137 | __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event); | 140 | __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event); |
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index e73ebdae323d..32fd51274037 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
@@ -91,6 +91,7 @@ typedef __s32 sctp_assoc_t; | |||
91 | #define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ | 91 | #define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ |
92 | #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ | 92 | #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ |
93 | #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ | 93 | #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ |
94 | #define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ | ||
94 | 95 | ||
95 | /* Internal Socket Options. Some of the sctp library functions are | 96 | /* Internal Socket Options. Some of the sctp library functions are |
96 | * implemented using these socket options. | 97 | * implemented using these socket options. |
@@ -353,6 +354,20 @@ struct sctp_authkey_event { | |||
353 | 354 | ||
354 | enum { SCTP_AUTH_NEWKEY = 0, }; | 355 | enum { SCTP_AUTH_NEWKEY = 0, }; |
355 | 356 | ||
357 | /* | ||
358 | * 6.1.9. SCTP_SENDER_DRY_EVENT | ||
359 | * | ||
360 | * When the SCTP stack has no more user data to send or retransmit, this | ||
361 | * notification is given to the user. Also, at the time when a user app | ||
362 | * subscribes to this event, if there is no data to be sent or | ||
363 | * retransmit, the stack will immediately send up this notification. | ||
364 | */ | ||
365 | struct sctp_sender_dry_event { | ||
366 | __u16 sender_dry_type; | ||
367 | __u16 sender_dry_flags; | ||
368 | __u32 sender_dry_length; | ||
369 | sctp_assoc_t sender_dry_assoc_id; | ||
370 | }; | ||
356 | 371 | ||
357 | /* | 372 | /* |
358 | * Described in Section 7.3 | 373 | * Described in Section 7.3 |
@@ -368,6 +383,7 @@ struct sctp_event_subscribe { | |||
368 | __u8 sctp_partial_delivery_event; | 383 | __u8 sctp_partial_delivery_event; |
369 | __u8 sctp_adaptation_layer_event; | 384 | __u8 sctp_adaptation_layer_event; |
370 | __u8 sctp_authentication_event; | 385 | __u8 sctp_authentication_event; |
386 | __u8 sctp_sender_dry_event; | ||
371 | }; | 387 | }; |
372 | 388 | ||
373 | /* | 389 | /* |
@@ -391,6 +407,7 @@ union sctp_notification { | |||
391 | struct sctp_adaptation_event sn_adaptation_event; | 407 | struct sctp_adaptation_event sn_adaptation_event; |
392 | struct sctp_pdapi_event sn_pdapi_event; | 408 | struct sctp_pdapi_event sn_pdapi_event; |
393 | struct sctp_authkey_event sn_authkey_event; | 409 | struct sctp_authkey_event sn_authkey_event; |
410 | struct sctp_sender_dry_event sn_sender_dry_event; | ||
394 | }; | 411 | }; |
395 | 412 | ||
396 | /* Section 5.3.1 | 413 | /* Section 5.3.1 |
@@ -407,7 +424,9 @@ enum sctp_sn_type { | |||
407 | SCTP_SHUTDOWN_EVENT, | 424 | SCTP_SHUTDOWN_EVENT, |
408 | SCTP_PARTIAL_DELIVERY_EVENT, | 425 | SCTP_PARTIAL_DELIVERY_EVENT, |
409 | SCTP_ADAPTATION_INDICATION, | 426 | SCTP_ADAPTATION_INDICATION, |
410 | SCTP_AUTHENTICATION_INDICATION, | 427 | SCTP_AUTHENTICATION_EVENT, |
428 | #define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_EVENT | ||
429 | SCTP_SENDER_DRY_EVENT, | ||
411 | }; | 430 | }; |
412 | 431 | ||
413 | /* Notification error codes used to fill up the error fields in some | 432 | /* Notification error codes used to fill up the error fields in some |
@@ -669,6 +688,18 @@ struct sctp_authchunks { | |||
669 | }; | 688 | }; |
670 | 689 | ||
671 | /* | 690 | /* |
691 | * 8.2.6. Get the Current Identifiers of Associations | ||
692 | * (SCTP_GET_ASSOC_ID_LIST) | ||
693 | * | ||
694 | * This option gets the current list of SCTP association identifiers of | ||
695 | * the SCTP associations handled by a one-to-many style socket. | ||
696 | */ | ||
697 | struct sctp_assoc_ids { | ||
698 | __u32 gaids_number_of_ids; | ||
699 | sctp_assoc_t gaids_assoc_id[]; | ||
700 | }; | ||
701 | |||
702 | /* | ||
672 | * 8.3, 8.5 get all peer/local addresses in an association. | 703 | * 8.3, 8.5 get all peer/local addresses in an association. |
673 | * This parameter struct is used by SCTP_GET_PEER_ADDRS and | 704 | * This parameter struct is used by SCTP_GET_PEER_ADDRS and |
674 | * SCTP_GET_LOCAL_ADDRS socket options used internally to implement | 705 | * SCTP_GET_LOCAL_ADDRS socket options used internally to implement |
diff --git a/include/net/snmp.h b/include/net/snmp.h index 27461d6dd46f..479083a78b0c 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h | |||
@@ -72,14 +72,24 @@ struct icmpmsg_mib { | |||
72 | 72 | ||
73 | /* ICMP6 (IPv6-ICMP) */ | 73 | /* ICMP6 (IPv6-ICMP) */ |
74 | #define ICMP6_MIB_MAX __ICMP6_MIB_MAX | 74 | #define ICMP6_MIB_MAX __ICMP6_MIB_MAX |
75 | /* per network ns counters */ | ||
75 | struct icmpv6_mib { | 76 | struct icmpv6_mib { |
76 | unsigned long mibs[ICMP6_MIB_MAX]; | 77 | unsigned long mibs[ICMP6_MIB_MAX]; |
77 | }; | 78 | }; |
79 | /* per device counters, (shared on all cpus) */ | ||
80 | struct icmpv6_mib_device { | ||
81 | atomic_long_t mibs[ICMP6_MIB_MAX]; | ||
82 | }; | ||
78 | 83 | ||
79 | #define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX | 84 | #define ICMP6MSG_MIB_MAX __ICMP6MSG_MIB_MAX |
85 | /* per network ns counters */ | ||
80 | struct icmpv6msg_mib { | 86 | struct icmpv6msg_mib { |
81 | unsigned long mibs[ICMP6MSG_MIB_MAX]; | 87 | unsigned long mibs[ICMP6MSG_MIB_MAX]; |
82 | }; | 88 | }; |
89 | /* per device counters, (shared on all cpus) */ | ||
90 | struct icmpv6msg_mib_device { | ||
91 | atomic_long_t mibs[ICMP6MSG_MIB_MAX]; | ||
92 | }; | ||
83 | 93 | ||
84 | 94 | ||
85 | /* TCP */ | 95 | /* TCP */ |
@@ -114,6 +124,8 @@ struct linux_xfrm_mib { | |||
114 | */ | 124 | */ |
115 | #define DEFINE_SNMP_STAT(type, name) \ | 125 | #define DEFINE_SNMP_STAT(type, name) \ |
116 | __typeof__(type) __percpu *name[2] | 126 | __typeof__(type) __percpu *name[2] |
127 | #define DEFINE_SNMP_STAT_ATOMIC(type, name) \ | ||
128 | __typeof__(type) *name | ||
117 | #define DECLARE_SNMP_STAT(type, name) \ | 129 | #define DECLARE_SNMP_STAT(type, name) \ |
118 | extern __typeof__(type) __percpu *name[2] | 130 | extern __typeof__(type) __percpu *name[2] |
119 | 131 | ||
@@ -124,6 +136,8 @@ struct linux_xfrm_mib { | |||
124 | __this_cpu_inc(mib[0]->mibs[field]) | 136 | __this_cpu_inc(mib[0]->mibs[field]) |
125 | #define SNMP_INC_STATS_USER(mib, field) \ | 137 | #define SNMP_INC_STATS_USER(mib, field) \ |
126 | this_cpu_inc(mib[1]->mibs[field]) | 138 | this_cpu_inc(mib[1]->mibs[field]) |
139 | #define SNMP_INC_STATS_ATOMIC_LONG(mib, field) \ | ||
140 | atomic_long_inc(&mib->mibs[field]) | ||
127 | #define SNMP_INC_STATS(mib, field) \ | 141 | #define SNMP_INC_STATS(mib, field) \ |
128 | this_cpu_inc(mib[!in_softirq()]->mibs[field]) | 142 | this_cpu_inc(mib[!in_softirq()]->mibs[field]) |
129 | #define SNMP_DEC_STATS(mib, field) \ | 143 | #define SNMP_DEC_STATS(mib, field) \ |
diff --git a/include/net/sock.h b/include/net/sock.h index 01810a3f19df..f2046e404a61 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/mm.h> | 52 | #include <linux/mm.h> |
53 | #include <linux/security.h> | 53 | #include <linux/security.h> |
54 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
55 | #include <linux/uaccess.h> | ||
55 | 56 | ||
56 | #include <linux/filter.h> | 57 | #include <linux/filter.h> |
57 | #include <linux/rculist_nulls.h> | 58 | #include <linux/rculist_nulls.h> |
@@ -1389,6 +1390,59 @@ static inline void sk_nocaps_add(struct sock *sk, int flags) | |||
1389 | sk->sk_route_caps &= ~flags; | 1390 | sk->sk_route_caps &= ~flags; |
1390 | } | 1391 | } |
1391 | 1392 | ||
1393 | static inline int skb_do_copy_data_nocache(struct sock *sk, struct sk_buff *skb, | ||
1394 | char __user *from, char *to, | ||
1395 | int copy, int offset) | ||
1396 | { | ||
1397 | if (skb->ip_summed == CHECKSUM_NONE) { | ||
1398 | int err = 0; | ||
1399 | __wsum csum = csum_and_copy_from_user(from, to, copy, 0, &err); | ||
1400 | if (err) | ||
1401 | return err; | ||
1402 | skb->csum = csum_block_add(skb->csum, csum, offset); | ||
1403 | } else if (sk->sk_route_caps & NETIF_F_NOCACHE_COPY) { | ||
1404 | if (!access_ok(VERIFY_READ, from, copy) || | ||
1405 | __copy_from_user_nocache(to, from, copy)) | ||
1406 | return -EFAULT; | ||
1407 | } else if (copy_from_user(to, from, copy)) | ||
1408 | return -EFAULT; | ||
1409 | |||
1410 | return 0; | ||
1411 | } | ||
1412 | |||
1413 | static inline int skb_add_data_nocache(struct sock *sk, struct sk_buff *skb, | ||
1414 | char __user *from, int copy) | ||
1415 | { | ||
1416 | int err, offset = skb->len; | ||
1417 | |||
1418 | err = skb_do_copy_data_nocache(sk, skb, from, skb_put(skb, copy), | ||
1419 | copy, offset); | ||
1420 | if (err) | ||
1421 | __skb_trim(skb, offset); | ||
1422 | |||
1423 | return err; | ||
1424 | } | ||
1425 | |||
1426 | static inline int skb_copy_to_page_nocache(struct sock *sk, char __user *from, | ||
1427 | struct sk_buff *skb, | ||
1428 | struct page *page, | ||
1429 | int off, int copy) | ||
1430 | { | ||
1431 | int err; | ||
1432 | |||
1433 | err = skb_do_copy_data_nocache(sk, skb, from, page_address(page) + off, | ||
1434 | copy, skb->len); | ||
1435 | if (err) | ||
1436 | return err; | ||
1437 | |||
1438 | skb->len += copy; | ||
1439 | skb->data_len += copy; | ||
1440 | skb->truesize += copy; | ||
1441 | sk->sk_wmem_queued += copy; | ||
1442 | sk_mem_charge(sk, copy); | ||
1443 | return 0; | ||
1444 | } | ||
1445 | |||
1392 | static inline int skb_copy_to_page(struct sock *sk, char __user *from, | 1446 | static inline int skb_copy_to_page(struct sock *sk, char __user *from, |
1393 | struct sk_buff *skb, struct page *page, | 1447 | struct sk_buff *skb, struct page *page, |
1394 | int off, int copy) | 1448 | int off, int copy) |
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index a8122dc56410..5271a741c3a3 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h | |||
@@ -7,8 +7,6 @@ | |||
7 | * IPv6 transport protocols | 7 | * IPv6 transport protocols |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifdef __KERNEL__ | ||
11 | |||
12 | extern struct proto rawv6_prot; | 10 | extern struct proto rawv6_prot; |
13 | extern struct proto udpv6_prot; | 11 | extern struct proto udpv6_prot; |
14 | extern struct proto udplitev6_prot; | 12 | extern struct proto udplitev6_prot; |
@@ -57,5 +55,3 @@ extern const struct inet_connection_sock_af_ops ipv4_specific; | |||
57 | extern void inet6_destroy_sock(struct sock *sk); | 55 | extern void inet6_destroy_sock(struct sock *sk); |
58 | 56 | ||
59 | #endif | 57 | #endif |
60 | |||
61 | #endif | ||
diff --git a/include/net/wimax.h b/include/net/wimax.h index c799ba7b708b..7328d5019d88 100644 --- a/include/net/wimax.h +++ b/include/net/wimax.h | |||
@@ -250,7 +250,6 @@ | |||
250 | 250 | ||
251 | #ifndef __NET__WIMAX_H__ | 251 | #ifndef __NET__WIMAX_H__ |
252 | #define __NET__WIMAX_H__ | 252 | #define __NET__WIMAX_H__ |
253 | #ifdef __KERNEL__ | ||
254 | 253 | ||
255 | #include <linux/wimax.h> | 254 | #include <linux/wimax.h> |
256 | #include <net/genetlink.h> | 255 | #include <net/genetlink.h> |
@@ -518,8 +517,4 @@ extern ssize_t wimax_msg_len(struct sk_buff *); | |||
518 | extern int wimax_rfkill(struct wimax_dev *, enum wimax_rf_state); | 517 | extern int wimax_rfkill(struct wimax_dev *, enum wimax_rf_state); |
519 | extern int wimax_reset(struct wimax_dev *); | 518 | extern int wimax_reset(struct wimax_dev *); |
520 | 519 | ||
521 | #else | ||
522 | /* You might be looking for linux/wimax.h */ | ||
523 | #error This file should not be included from user space. | ||
524 | #endif /* #ifdef __KERNEL__ */ | ||
525 | #endif /* #ifndef __NET__WIMAX_H__ */ | 520 | #endif /* #ifndef __NET__WIMAX_H__ */ |
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 20afeaa39395..b203e14d26b7 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -958,6 +958,15 @@ struct sec_path { | |||
958 | struct xfrm_state *xvec[XFRM_MAX_DEPTH]; | 958 | struct xfrm_state *xvec[XFRM_MAX_DEPTH]; |
959 | }; | 959 | }; |
960 | 960 | ||
961 | static inline int secpath_exists(struct sk_buff *skb) | ||
962 | { | ||
963 | #ifdef CONFIG_XFRM | ||
964 | return skb->sp != NULL; | ||
965 | #else | ||
966 | return 0; | ||
967 | #endif | ||
968 | } | ||
969 | |||
961 | static inline struct sec_path * | 970 | static inline struct sec_path * |
962 | secpath_get(struct sec_path *sp) | 971 | secpath_get(struct sec_path *sp) |
963 | { | 972 | { |
@@ -1468,7 +1477,7 @@ extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, | |||
1468 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); | 1477 | extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); |
1469 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); | 1478 | extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); |
1470 | extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); | 1479 | extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); |
1471 | extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, xfrm_address_t *saddr); | 1480 | extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr); |
1472 | extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); | 1481 | extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); |
1473 | extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); | 1482 | extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); |
1474 | extern int xfrm6_output(struct sk_buff *skb); | 1483 | extern int xfrm6_output(struct sk_buff *skb); |
@@ -1563,8 +1572,8 @@ static inline int xfrm_addr_cmp(const xfrm_address_t *a, | |||
1563 | case AF_INET: | 1572 | case AF_INET: |
1564 | return (__force u32)a->a4 - (__force u32)b->a4; | 1573 | return (__force u32)a->a4 - (__force u32)b->a4; |
1565 | case AF_INET6: | 1574 | case AF_INET6: |
1566 | return ipv6_addr_cmp((struct in6_addr *)a, | 1575 | return ipv6_addr_cmp((const struct in6_addr *)a, |
1567 | (struct in6_addr *)b); | 1576 | (const struct in6_addr *)b); |
1568 | } | 1577 | } |
1569 | } | 1578 | } |
1570 | 1579 | ||