aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bluetooth/a2mp.h150
-rw-r--r--include/net/bluetooth/amp.h54
-rw-r--r--include/net/bluetooth/bluetooth.h27
-rw-r--r--include/net/bluetooth/hci.h155
-rw-r--r--include/net/bluetooth/hci_core.h193
-rw-r--r--include/net/bluetooth/l2cap.h35
-rw-r--r--include/net/bluetooth/mgmt.h18
-rw-r--r--include/net/bluetooth/rfcomm.h6
-rw-r--r--include/net/bluetooth/sco.h5
-rw-r--r--include/net/bluetooth/smp.h146
-rw-r--r--include/net/caif/caif_hsi.h2
-rw-r--r--include/net/cfg80211.h32
-rw-r--r--include/net/checksum.h11
-rw-r--r--include/net/codel.h19
-rw-r--r--include/net/compat.h48
-rw-r--r--include/net/dcbevent.h6
-rw-r--r--include/net/dn.h20
-rw-r--r--include/net/dn_dev.h30
-rw-r--r--include/net/dn_fib.h47
-rw-r--r--include/net/dn_neigh.h12
-rw-r--r--include/net/dn_nsp.h49
-rw-r--r--include/net/dn_route.h13
-rw-r--r--include/net/dst.h25
-rw-r--r--include/net/esp.h12
-rw-r--r--include/net/fib_rules.h17
-rw-r--r--include/net/flow.h11
-rw-r--r--include/net/flow_keys.h3
-rw-r--r--include/net/garp.h27
-rw-r--r--include/net/gen_stats.h51
-rw-r--r--include/net/genetlink.h26
-rw-r--r--include/net/gre.h8
-rw-r--r--include/net/icmp.h10
-rw-r--r--include/net/if_inet6.h5
-rw-r--r--include/net/inet6_connection_sock.h32
-rw-r--r--include/net/inet6_hashtables.h67
-rw-r--r--include/net/inet_common.h48
-rw-r--r--include/net/inet_connection_sock.h79
-rw-r--r--include/net/inet_frag.h4
-rw-r--r--include/net/inet_hashtables.h99
-rw-r--r--include/net/inet_sock.h49
-rw-r--r--include/net/inet_timewait_sock.h69
-rw-r--r--include/net/inetpeer.h12
-rw-r--r--include/net/ip.h189
-rw-r--r--include/net/ip6_checksum.h4
-rw-r--r--include/net/ip6_fib.h52
-rw-r--r--include/net/ip6_route.h98
-rw-r--r--include/net/ip_fib.h61
-rw-r--r--include/net/ip_tunnels.h3
-rw-r--r--include/net/ip_vs.h283
-rw-r--r--include/net/ipv6.h271
-rw-r--r--include/net/ipx.h12
-rw-r--r--include/net/irda/ircomm_tty.h14
-rw-r--r--include/net/irda/irda.h21
-rw-r--r--include/net/irda/irda_device.h2
-rw-r--r--include/net/irda/irlap_event.h2
-rw-r--r--include/net/irda/irlap_frame.h4
-rw-r--r--include/net/iw_handler.h38
-rw-r--r--include/net/lapb.h52
-rw-r--r--include/net/llc.h50
-rw-r--r--include/net/llc_c_ac.h190
-rw-r--r--include/net/llc_c_ev.h207
-rw-r--r--include/net/llc_conn.h36
-rw-r--r--include/net/llc_if.h7
-rw-r--r--include/net/llc_pdu.h33
-rw-r--r--include/net/llc_s_ac.h20
-rw-r--r--include/net/llc_s_ev.h21
-rw-r--r--include/net/llc_sap.h22
-rw-r--r--include/net/mac80211.h60
-rw-r--r--include/net/mrp.h26
-rw-r--r--include/net/ndisc.h61
-rw-r--r--include/net/net_namespace.h32
-rw-r--r--include/net/netevent.h6
-rw-r--r--include/net/netfilter/ipv4/nf_conntrack_ipv4.h6
-rw-r--r--include/net/netfilter/ipv4/nf_defrag_ipv4.h2
-rw-r--r--include/net/netfilter/ipv6/nf_defrag_ipv6.h13
-rw-r--r--include/net/netfilter/nf_conntrack.h69
-rw-r--r--include/net/netfilter/nf_conntrack_acct.h22
-rw-r--r--include/net/netfilter/nf_conntrack_core.h69
-rw-r--r--include/net/netfilter/nf_conntrack_ecache.h22
-rw-r--r--include/net/netfilter/nf_conntrack_extend.h4
-rw-r--r--include/net/netfilter/nf_conntrack_helper.h40
-rw-r--r--include/net/netfilter/nf_conntrack_l3proto.h16
-rw-r--r--include/net/netfilter/nf_conntrack_l4proto.h32
-rw-r--r--include/net/netfilter/nf_conntrack_seqadj.h30
-rw-r--r--include/net/netfilter/nf_conntrack_synproxy.h28
-rw-r--r--include/net/netfilter/nf_conntrack_timeout.h4
-rw-r--r--include/net/netfilter/nf_conntrack_timestamp.h8
-rw-r--r--include/net/netfilter/nf_nat.h13
-rw-r--r--include/net/netfilter/nf_nat_core.h8
-rw-r--r--include/net/netfilter/nf_nat_helper.h29
-rw-r--r--include/net/netfilter/nf_nat_l3proto.h23
-rw-r--r--include/net/netfilter/nf_nat_l4proto.h30
-rw-r--r--include/net/netfilter/nf_queue.h2
-rw-r--r--include/net/netfilter/nf_tables.h519
-rw-r--r--include/net/netfilter/nf_tables_core.h42
-rw-r--r--include/net/netfilter/nf_tables_ipv4.h23
-rw-r--r--include/net/netfilter/nf_tables_ipv6.h30
-rw-r--r--include/net/netfilter/xt_rateest.h4
-rw-r--r--include/net/netlink.h63
-rw-r--r--include/net/netns/ipv4.h7
-rw-r--r--include/net/netns/nftables.h19
-rw-r--r--include/net/netrom.h89
-rw-r--r--include/net/nfc/digital.h227
-rw-r--r--include/net/nfc/hci.h6
-rw-r--r--include/net/nfc/nci.h4
-rw-r--r--include/net/nfc/nci_core.h46
-rw-r--r--include/net/nfc/nfc.h25
-rw-r--r--include/net/p8022.h18
-rw-r--r--include/net/ping.h4
-rw-r--r--include/net/protocol.h24
-rw-r--r--include/net/psnap.h4
-rw-r--r--include/net/raw.h6
-rw-r--r--include/net/rawv6.h3
-rw-r--r--include/net/request_sock.h15
-rw-r--r--include/net/rose.h114
-rw-r--r--include/net/route.h78
-rw-r--r--include/net/rtnetlink.h40
-rw-r--r--include/net/sch_generic.h11
-rw-r--r--include/net/scm.h10
-rw-r--r--include/net/sctp/checksum.h56
-rw-r--r--include/net/sctp/sctp.h13
-rw-r--r--include/net/secure_seq.h26
-rw-r--r--include/net/sock.h276
-rw-r--r--include/net/stp.h4
-rw-r--r--include/net/tcp.h452
-rw-r--r--include/net/tcp_memcontrol.h12
-rw-r--r--include/net/udp.h109
-rw-r--r--include/net/udplite.h6
-rw-r--r--include/net/vxlan.h11
-rw-r--r--include/net/wext.h16
-rw-r--r--include/net/wimax.h33
-rw-r--r--include/net/x25.h141
-rw-r--r--include/net/xfrm.h382
133 files changed, 3754 insertions, 3293 deletions
diff --git a/include/net/bluetooth/a2mp.h b/include/net/bluetooth/a2mp.h
deleted file mode 100644
index 487b54c1308f..000000000000
--- a/include/net/bluetooth/a2mp.h
+++ /dev/null
@@ -1,150 +0,0 @@
1/*
2 Copyright (c) 2010,2011 Code Aurora Forum. All rights reserved.
3 Copyright (c) 2011,2012 Intel Corp.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 and
7 only version 2 as published by the Free Software Foundation.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13*/
14
15#ifndef __A2MP_H
16#define __A2MP_H
17
18#include <net/bluetooth/l2cap.h>
19
20#define A2MP_FEAT_EXT 0x8000
21
22enum amp_mgr_state {
23 READ_LOC_AMP_INFO,
24 READ_LOC_AMP_ASSOC,
25 READ_LOC_AMP_ASSOC_FINAL,
26 WRITE_REMOTE_AMP_ASSOC,
27};
28
29struct amp_mgr {
30 struct list_head list;
31 struct l2cap_conn *l2cap_conn;
32 struct l2cap_chan *a2mp_chan;
33 struct l2cap_chan *bredr_chan;
34 struct kref kref;
35 __u8 ident;
36 __u8 handle;
37 unsigned long state;
38 unsigned long flags;
39
40 struct list_head amp_ctrls;
41 struct mutex amp_ctrls_lock;
42};
43
44struct a2mp_cmd {
45 __u8 code;
46 __u8 ident;
47 __le16 len;
48 __u8 data[0];
49} __packed;
50
51/* A2MP command codes */
52#define A2MP_COMMAND_REJ 0x01
53struct a2mp_cmd_rej {
54 __le16 reason;
55 __u8 data[0];
56} __packed;
57
58#define A2MP_DISCOVER_REQ 0x02
59struct a2mp_discov_req {
60 __le16 mtu;
61 __le16 ext_feat;
62} __packed;
63
64struct a2mp_cl {
65 __u8 id;
66 __u8 type;
67 __u8 status;
68} __packed;
69
70#define A2MP_DISCOVER_RSP 0x03
71struct a2mp_discov_rsp {
72 __le16 mtu;
73 __le16 ext_feat;
74 struct a2mp_cl cl[0];
75} __packed;
76
77#define A2MP_CHANGE_NOTIFY 0x04
78#define A2MP_CHANGE_RSP 0x05
79
80#define A2MP_GETINFO_REQ 0x06
81struct a2mp_info_req {
82 __u8 id;
83} __packed;
84
85#define A2MP_GETINFO_RSP 0x07
86struct a2mp_info_rsp {
87 __u8 id;
88 __u8 status;
89 __le32 total_bw;
90 __le32 max_bw;
91 __le32 min_latency;
92 __le16 pal_cap;
93 __le16 assoc_size;
94} __packed;
95
96#define A2MP_GETAMPASSOC_REQ 0x08
97struct a2mp_amp_assoc_req {
98 __u8 id;
99} __packed;
100
101#define A2MP_GETAMPASSOC_RSP 0x09
102struct a2mp_amp_assoc_rsp {
103 __u8 id;
104 __u8 status;
105 __u8 amp_assoc[0];
106} __packed;
107
108#define A2MP_CREATEPHYSLINK_REQ 0x0A
109#define A2MP_DISCONNPHYSLINK_REQ 0x0C
110struct a2mp_physlink_req {
111 __u8 local_id;
112 __u8 remote_id;
113 __u8 amp_assoc[0];
114} __packed;
115
116#define A2MP_CREATEPHYSLINK_RSP 0x0B
117#define A2MP_DISCONNPHYSLINK_RSP 0x0D
118struct a2mp_physlink_rsp {
119 __u8 local_id;
120 __u8 remote_id;
121 __u8 status;
122} __packed;
123
124/* A2MP response status */
125#define A2MP_STATUS_SUCCESS 0x00
126#define A2MP_STATUS_INVALID_CTRL_ID 0x01
127#define A2MP_STATUS_UNABLE_START_LINK_CREATION 0x02
128#define A2MP_STATUS_NO_PHYSICAL_LINK_EXISTS 0x02
129#define A2MP_STATUS_COLLISION_OCCURED 0x03
130#define A2MP_STATUS_DISCONN_REQ_RECVD 0x04
131#define A2MP_STATUS_PHYS_LINK_EXISTS 0x05
132#define A2MP_STATUS_SECURITY_VIOLATION 0x06
133
134extern struct list_head amp_mgr_list;
135extern struct mutex amp_mgr_list_lock;
136
137struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr);
138int amp_mgr_put(struct amp_mgr *mgr);
139u8 __next_ident(struct amp_mgr *mgr);
140struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
141 struct sk_buff *skb);
142struct amp_mgr *amp_mgr_lookup_by_state(u8 state);
143void a2mp_send(struct amp_mgr *mgr, u8 code, u8 ident, u16 len, void *data);
144void a2mp_discover_amp(struct l2cap_chan *chan);
145void a2mp_send_getinfo_rsp(struct hci_dev *hdev);
146void a2mp_send_getampassoc_rsp(struct hci_dev *hdev, u8 status);
147void a2mp_send_create_phy_link_req(struct hci_dev *hdev, u8 status);
148void a2mp_send_create_phy_link_rsp(struct hci_dev *hdev, u8 status);
149
150#endif /* __A2MP_H */
diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
deleted file mode 100644
index 7ea3db77ba89..000000000000
--- a/include/net/bluetooth/amp.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 Copyright (c) 2011,2012 Intel Corp.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License version 2 and
6 only version 2 as published by the Free Software Foundation.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12*/
13
14#ifndef __AMP_H
15#define __AMP_H
16
17struct amp_ctrl {
18 struct list_head list;
19 struct kref kref;
20 __u8 id;
21 __u16 assoc_len_so_far;
22 __u16 assoc_rem_len;
23 __u16 assoc_len;
24 __u8 *assoc;
25};
26
27int amp_ctrl_put(struct amp_ctrl *ctrl);
28void amp_ctrl_get(struct amp_ctrl *ctrl);
29struct amp_ctrl *amp_ctrl_add(struct amp_mgr *mgr, u8 id);
30struct amp_ctrl *amp_ctrl_lookup(struct amp_mgr *mgr, u8 id);
31void amp_ctrl_list_flush(struct amp_mgr *mgr);
32
33struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
34 u8 remote_id, bool out);
35
36int phylink_gen_key(struct hci_conn *hcon, u8 *data, u8 *len, u8 *type);
37
38void amp_read_loc_info(struct hci_dev *hdev, struct amp_mgr *mgr);
39void amp_read_loc_assoc_frag(struct hci_dev *hdev, u8 phy_handle);
40void amp_read_loc_assoc(struct hci_dev *hdev, struct amp_mgr *mgr);
41void amp_read_loc_assoc_final_data(struct hci_dev *hdev,
42 struct hci_conn *hcon);
43void amp_create_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
44 struct hci_conn *hcon);
45void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
46 struct hci_conn *hcon);
47void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle);
48void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle);
49void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon);
50void amp_create_logical_link(struct l2cap_chan *chan);
51void amp_disconnect_logical_link(struct hci_chan *hchan);
52void amp_destroy_logical_link(struct hci_chan *hchan, u8 reason);
53
54#endif /* __AMP_H */
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index 10d43d8c7037..2a628b28249f 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -197,8 +197,8 @@ static inline bool bdaddr_type_is_le(__u8 type)
197 return false; 197 return false;
198} 198}
199 199
200#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0} }) 200#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
201#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} }) 201#define BDADDR_NONE (&(bdaddr_t) {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}})
202 202
203/* Copy, swap, convert BD Address */ 203/* Copy, swap, convert BD Address */
204static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2) 204static inline int bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2)
@@ -218,11 +218,10 @@ void baswap(bdaddr_t *dst, bdaddr_t *src);
218 218
219struct bt_sock { 219struct bt_sock {
220 struct sock sk; 220 struct sock sk;
221 bdaddr_t src;
222 bdaddr_t dst;
223 struct list_head accept_q; 221 struct list_head accept_q;
224 struct sock *parent; 222 struct sock *parent;
225 unsigned long flags; 223 unsigned long flags;
224 void (*skb_msg_name)(struct sk_buff *, void *, int *);
226}; 225};
227 226
228enum { 227enum {
@@ -249,6 +248,7 @@ int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
249uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait); 248uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait);
250int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 249int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
251int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo); 250int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
251int bt_sock_wait_ready(struct sock *sk, unsigned long flags);
252 252
253void bt_accept_enqueue(struct sock *parent, struct sock *sk); 253void bt_accept_enqueue(struct sock *parent, struct sock *sk);
254void bt_accept_unlink(struct sock *sk); 254void bt_accept_unlink(struct sock *sk);
@@ -282,8 +282,11 @@ struct bt_skb_cb {
282 __u8 incoming; 282 __u8 incoming;
283 __u16 expect; 283 __u16 expect;
284 __u8 force_active; 284 __u8 force_active;
285 struct l2cap_chan *chan;
285 struct l2cap_ctrl control; 286 struct l2cap_ctrl control;
286 struct hci_req_ctrl req; 287 struct hci_req_ctrl req;
288 bdaddr_t bdaddr;
289 __le16 psm;
287}; 290};
288#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb)) 291#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
289 292
@@ -331,16 +334,16 @@ out:
331 334
332int bt_to_errno(__u16 code); 335int bt_to_errno(__u16 code);
333 336
334extern int hci_sock_init(void); 337int hci_sock_init(void);
335extern void hci_sock_cleanup(void); 338void hci_sock_cleanup(void);
336 339
337extern int bt_sysfs_init(void); 340int bt_sysfs_init(void);
338extern void bt_sysfs_cleanup(void); 341void bt_sysfs_cleanup(void);
339 342
340extern int bt_procfs_init(struct net *net, const char *name, 343int bt_procfs_init(struct net *net, const char *name,
341 struct bt_sock_list* sk_list, 344 struct bt_sock_list *sk_list,
342 int (* seq_show)(struct seq_file *, void *)); 345 int (*seq_show)(struct seq_file *, void *));
343extern void bt_procfs_cleanup(struct net *net, const char *name); 346void bt_procfs_cleanup(struct net *net, const char *name);
344 347
345extern struct dentry *bt_debugfs; 348extern struct dentry *bt_debugfs;
346 349
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 15f10841e2b5..1784c48699f0 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -35,6 +35,8 @@
35 35
36#define HCI_MAX_AMP_ASSOC_SIZE 672 36#define HCI_MAX_AMP_ASSOC_SIZE 672
37 37
38#define HCI_MAX_CSB_DATA_SIZE 252
39
38/* HCI dev events */ 40/* HCI dev events */
39#define HCI_DEV_REG 1 41#define HCI_DEV_REG 1
40#define HCI_DEV_UNREG 2 42#define HCI_DEV_UNREG 2
@@ -62,16 +64,20 @@
62#define HCI_AMP 0x01 64#define HCI_AMP 0x01
63 65
64/* First BR/EDR Controller shall have ID = 0 */ 66/* First BR/EDR Controller shall have ID = 0 */
65#define HCI_BREDR_ID 0 67#define AMP_ID_BREDR 0x00
68
69/* AMP controller types */
70#define AMP_TYPE_BREDR 0x00
71#define AMP_TYPE_80211 0x01
66 72
67/* AMP controller status */ 73/* AMP controller status */
68#define AMP_CTRL_POWERED_DOWN 0x00 74#define AMP_STATUS_POWERED_DOWN 0x00
69#define AMP_CTRL_BLUETOOTH_ONLY 0x01 75#define AMP_STATUS_BLUETOOTH_ONLY 0x01
70#define AMP_CTRL_NO_CAPACITY 0x02 76#define AMP_STATUS_NO_CAPACITY 0x02
71#define AMP_CTRL_LOW_CAPACITY 0x03 77#define AMP_STATUS_LOW_CAPACITY 0x03
72#define AMP_CTRL_MEDIUM_CAPACITY 0x04 78#define AMP_STATUS_MEDIUM_CAPACITY 0x04
73#define AMP_CTRL_HIGH_CAPACITY 0x05 79#define AMP_STATUS_HIGH_CAPACITY 0x05
74#define AMP_CTRL_FULL_CAPACITY 0x06 80#define AMP_STATUS_FULL_CAPACITY 0x06
75 81
76/* HCI device quirks */ 82/* HCI device quirks */
77enum { 83enum {
@@ -109,18 +115,22 @@ enum {
109 HCI_PAIRABLE, 115 HCI_PAIRABLE,
110 HCI_SERVICE_CACHE, 116 HCI_SERVICE_CACHE,
111 HCI_DEBUG_KEYS, 117 HCI_DEBUG_KEYS,
118 HCI_DUT_MODE,
112 HCI_UNREGISTER, 119 HCI_UNREGISTER,
120 HCI_USER_CHANNEL,
113 121
114 HCI_LE_SCAN, 122 HCI_LE_SCAN,
115 HCI_SSP_ENABLED, 123 HCI_SSP_ENABLED,
116 HCI_HS_ENABLED, 124 HCI_HS_ENABLED,
117 HCI_LE_ENABLED, 125 HCI_LE_ENABLED,
118 HCI_LE_PERIPHERAL, 126 HCI_ADVERTISING,
119 HCI_CONNECTABLE, 127 HCI_CONNECTABLE,
120 HCI_DISCOVERABLE, 128 HCI_DISCOVERABLE,
129 HCI_LIMITED_DISCOVERABLE,
121 HCI_LINK_SECURITY, 130 HCI_LINK_SECURITY,
122 HCI_PERIODIC_INQ, 131 HCI_PERIODIC_INQ,
123 HCI_FAST_CONNECTABLE, 132 HCI_FAST_CONNECTABLE,
133 HCI_BREDR_ENABLED,
124}; 134};
125 135
126/* A mask for the flags that are supposed to remain when a reset happens 136/* A mask for the flags that are supposed to remain when a reset happens
@@ -624,6 +634,24 @@ struct hci_rp_logical_link_cancel {
624 __u8 flow_spec_id; 634 __u8 flow_spec_id;
625} __packed; 635} __packed;
626 636
637#define HCI_OP_SET_CSB 0x0441
638struct hci_cp_set_csb {
639 __u8 enable;
640 __u8 lt_addr;
641 __u8 lpo_allowed;
642 __le16 packet_type;
643 __le16 interval_min;
644 __le16 interval_max;
645 __le16 csb_sv_tout;
646} __packed;
647struct hci_rp_set_csb {
648 __u8 status;
649 __u8 lt_addr;
650 __le16 interval;
651} __packed;
652
653#define HCI_OP_START_SYNC_TRAIN 0x0443
654
627#define HCI_OP_SNIFF_MODE 0x0803 655#define HCI_OP_SNIFF_MODE 0x0803
628struct hci_cp_sniff_mode { 656struct hci_cp_sniff_mode {
629 __le16 handle; 657 __le16 handle;
@@ -694,9 +722,6 @@ struct hci_cp_sniff_subrate {
694} __packed; 722} __packed;
695 723
696#define HCI_OP_SET_EVENT_MASK 0x0c01 724#define HCI_OP_SET_EVENT_MASK 0x0c01
697struct hci_cp_set_event_mask {
698 __u8 mask[8];
699} __packed;
700 725
701#define HCI_OP_RESET 0x0c03 726#define HCI_OP_RESET 0x0c03
702 727
@@ -792,6 +817,20 @@ struct hci_cp_host_buffer_size {
792 __le16 sco_max_pkt; 817 __le16 sco_max_pkt;
793} __packed; 818} __packed;
794 819
820#define HCI_OP_READ_NUM_SUPPORTED_IAC 0x0c38
821struct hci_rp_read_num_supported_iac {
822 __u8 status;
823 __u8 num_iac;
824} __packed;
825
826#define HCI_OP_READ_CURRENT_IAC_LAP 0x0c39
827
828#define HCI_OP_WRITE_CURRENT_IAC_LAP 0x0c3a
829struct hci_cp_write_current_iac_lap {
830 __u8 num_iac;
831 __u8 iac_lap[6];
832} __packed;
833
795#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45 834#define HCI_OP_WRITE_INQUIRY_MODE 0x0c45
796 835
797#define HCI_MAX_EIR_LENGTH 240 836#define HCI_MAX_EIR_LENGTH 240
@@ -826,6 +865,10 @@ struct hci_rp_read_inq_rsp_tx_power {
826 __s8 tx_power; 865 __s8 tx_power;
827} __packed; 866} __packed;
828 867
868#define HCI_OP_SET_EVENT_MASK_PAGE_2 0x0c63
869
870#define HCI_OP_READ_LOCATION_DATA 0x0c64
871
829#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66 872#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
830struct hci_rp_read_flow_control_mode { 873struct hci_rp_read_flow_control_mode {
831 __u8 status; 874 __u8 status;
@@ -838,6 +881,50 @@ struct hci_cp_write_le_host_supported {
838 __u8 simul; 881 __u8 simul;
839} __packed; 882} __packed;
840 883
884#define HCI_OP_SET_RESERVED_LT_ADDR 0x0c74
885struct hci_cp_set_reserved_lt_addr {
886 __u8 lt_addr;
887} __packed;
888struct hci_rp_set_reserved_lt_addr {
889 __u8 status;
890 __u8 lt_addr;
891} __packed;
892
893#define HCI_OP_DELETE_RESERVED_LT_ADDR 0x0c75
894struct hci_cp_delete_reserved_lt_addr {
895 __u8 lt_addr;
896} __packed;
897struct hci_rp_delete_reserved_lt_addr {
898 __u8 status;
899 __u8 lt_addr;
900} __packed;
901
902#define HCI_OP_SET_CSB_DATA 0x0c76
903struct hci_cp_set_csb_data {
904 __u8 lt_addr;
905 __u8 fragment;
906 __u8 data_length;
907 __u8 data[HCI_MAX_CSB_DATA_SIZE];
908} __packed;
909struct hci_rp_set_csb_data {
910 __u8 status;
911 __u8 lt_addr;
912} __packed;
913
914#define HCI_OP_READ_SYNC_TRAIN_PARAMS 0x0c77
915
916#define HCI_OP_WRITE_SYNC_TRAIN_PARAMS 0x0c78
917struct hci_cp_write_sync_train_params {
918 __le16 interval_min;
919 __le16 interval_max;
920 __le32 sync_train_tout;
921 __u8 service_data;
922} __packed;
923struct hci_rp_write_sync_train_params {
924 __u8 status;
925 __le16 sync_train_int;
926} __packed;
927
841#define HCI_OP_READ_LOCAL_VERSION 0x1001 928#define HCI_OP_READ_LOCAL_VERSION 0x1001
842struct hci_rp_read_local_version { 929struct hci_rp_read_local_version {
843 __u8 status; 930 __u8 status;
@@ -957,6 +1044,10 @@ struct hci_rp_write_remote_amp_assoc {
957 __u8 phy_handle; 1044 __u8 phy_handle;
958} __packed; 1045} __packed;
959 1046
1047#define HCI_OP_ENABLE_DUT_MODE 0x1803
1048
1049#define HCI_OP_WRITE_SSP_DEBUG_MODE 0x1804
1050
960#define HCI_OP_LE_SET_EVENT_MASK 0x2001 1051#define HCI_OP_LE_SET_EVENT_MASK 0x2001
961struct hci_cp_le_set_event_mask { 1052struct hci_cp_le_set_event_mask {
962 __u8 mask[8]; 1053 __u8 mask[8];
@@ -975,6 +1066,20 @@ struct hci_rp_le_read_local_features {
975 __u8 features[8]; 1066 __u8 features[8];
976} __packed; 1067} __packed;
977 1068
1069#define HCI_OP_LE_SET_RANDOM_ADDR 0x2005
1070
1071#define HCI_OP_LE_SET_ADV_PARAM 0x2006
1072struct hci_cp_le_set_adv_param {
1073 __le16 min_interval;
1074 __le16 max_interval;
1075 __u8 type;
1076 __u8 own_address_type;
1077 __u8 direct_addr_type;
1078 bdaddr_t direct_addr;
1079 __u8 channel_map;
1080 __u8 filter_policy;
1081} __packed;
1082
978#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007 1083#define HCI_OP_LE_READ_ADV_TX_POWER 0x2007
979struct hci_rp_le_read_adv_tx_power { 1084struct hci_rp_le_read_adv_tx_power {
980 __u8 status; 1085 __u8 status;
@@ -989,6 +1094,12 @@ struct hci_cp_le_set_adv_data {
989 __u8 data[HCI_MAX_AD_LENGTH]; 1094 __u8 data[HCI_MAX_AD_LENGTH];
990} __packed; 1095} __packed;
991 1096
1097#define HCI_OP_LE_SET_SCAN_RSP_DATA 0x2009
1098struct hci_cp_le_set_scan_rsp_data {
1099 __u8 length;
1100 __u8 data[HCI_MAX_AD_LENGTH];
1101} __packed;
1102
992#define HCI_OP_LE_SET_ADV_ENABLE 0x200a 1103#define HCI_OP_LE_SET_ADV_ENABLE 0x200a
993 1104
994#define LE_SCAN_PASSIVE 0x00 1105#define LE_SCAN_PASSIVE 0x00
@@ -1438,6 +1549,13 @@ struct hci_ev_num_comp_blocks {
1438 struct hci_comp_blocks_info handles[0]; 1549 struct hci_comp_blocks_info handles[0];
1439} __packed; 1550} __packed;
1440 1551
1552#define HCI_EV_SYNC_TRAIN_COMPLETE 0x4F
1553struct hci_ev_sync_train_complete {
1554 __u8 status;
1555} __packed;
1556
1557#define HCI_EV_SLAVE_PAGE_RESP_TIMEOUT 0x54
1558
1441/* Low energy meta events */ 1559/* Low energy meta events */
1442#define LE_CONN_ROLE_MASTER 0x00 1560#define LE_CONN_ROLE_MASTER 0x00
1443 1561
@@ -1462,11 +1580,11 @@ struct hci_ev_le_ltk_req {
1462} __packed; 1580} __packed;
1463 1581
1464/* Advertising report event types */ 1582/* Advertising report event types */
1465#define ADV_IND 0x00 1583#define LE_ADV_IND 0x00
1466#define ADV_DIRECT_IND 0x01 1584#define LE_ADV_DIRECT_IND 0x01
1467#define ADV_SCAN_IND 0x02 1585#define LE_ADV_SCAN_IND 0x02
1468#define ADV_NONCONN_IND 0x03 1586#define LE_ADV_NONCONN_IND 0x03
1469#define ADV_SCAN_RSP 0x04 1587#define LE_ADV_SCAN_RSP 0x04
1470 1588
1471#define ADDR_LE_DEV_PUBLIC 0x00 1589#define ADDR_LE_DEV_PUBLIC 0x00
1472#define ADDR_LE_DEV_RANDOM 0x01 1590#define ADDR_LE_DEV_RANDOM 0x01
@@ -1571,6 +1689,7 @@ struct sockaddr_hci {
1571#define HCI_DEV_NONE 0xffff 1689#define HCI_DEV_NONE 0xffff
1572 1690
1573#define HCI_CHANNEL_RAW 0 1691#define HCI_CHANNEL_RAW 0
1692#define HCI_CHANNEL_USER 1
1574#define HCI_CHANNEL_MONITOR 2 1693#define HCI_CHANNEL_MONITOR 2
1575#define HCI_CHANNEL_CONTROL 3 1694#define HCI_CHANNEL_CONTROL 3
1576 1695
@@ -1673,6 +1792,4 @@ struct hci_inquiry_req {
1673}; 1792};
1674#define IREQ_CACHE_FLUSH 0x0001 1793#define IREQ_CACHE_FLUSH 0x0001
1675 1794
1676extern bool enable_hs;
1677
1678#endif /* __HCI_H */ 1795#endif /* __HCI_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 3ede820d328f..f8555ad7b104 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -81,6 +81,7 @@ struct hci_conn_hash {
81struct bdaddr_list { 81struct bdaddr_list {
82 struct list_head list; 82 struct list_head list;
83 bdaddr_t bdaddr; 83 bdaddr_t bdaddr;
84 u8 bdaddr_type;
84}; 85};
85 86
86struct bt_uuid { 87struct bt_uuid {
@@ -140,6 +141,8 @@ struct hci_dev {
140 __u8 bus; 141 __u8 bus;
141 __u8 dev_type; 142 __u8 dev_type;
142 bdaddr_t bdaddr; 143 bdaddr_t bdaddr;
144 bdaddr_t static_addr;
145 __u8 own_addr_type;
143 __u8 dev_name[HCI_MAX_NAME_LENGTH]; 146 __u8 dev_name[HCI_MAX_NAME_LENGTH];
144 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH]; 147 __u8 short_name[HCI_MAX_SHORT_NAME_LENGTH];
145 __u8 eir[HCI_MAX_EIR_LENGTH]; 148 __u8 eir[HCI_MAX_EIR_LENGTH];
@@ -158,11 +161,17 @@ struct hci_dev {
158 __u16 manufacturer; 161 __u16 manufacturer;
159 __u16 lmp_subver; 162 __u16 lmp_subver;
160 __u16 voice_setting; 163 __u16 voice_setting;
164 __u8 num_iac;
161 __u8 io_capability; 165 __u8 io_capability;
162 __s8 inq_tx_power; 166 __s8 inq_tx_power;
163 __u16 page_scan_interval; 167 __u16 page_scan_interval;
164 __u16 page_scan_window; 168 __u16 page_scan_window;
165 __u8 page_scan_type; 169 __u8 page_scan_type;
170 __u16 le_scan_interval;
171 __u16 le_scan_window;
172 __u16 le_conn_min_interval;
173 __u16 le_conn_max_interval;
174 __u8 ssp_debug_mode;
166 175
167 __u16 devid_source; 176 __u16 devid_source;
168 __u16 devid_vendor; 177 __u16 devid_vendor;
@@ -279,14 +288,15 @@ struct hci_dev {
279 __s8 adv_tx_power; 288 __s8 adv_tx_power;
280 __u8 adv_data[HCI_MAX_AD_LENGTH]; 289 __u8 adv_data[HCI_MAX_AD_LENGTH];
281 __u8 adv_data_len; 290 __u8 adv_data_len;
291 __u8 scan_rsp_data[HCI_MAX_AD_LENGTH];
292 __u8 scan_rsp_data_len;
282 293
283 int (*open)(struct hci_dev *hdev); 294 int (*open)(struct hci_dev *hdev);
284 int (*close)(struct hci_dev *hdev); 295 int (*close)(struct hci_dev *hdev);
285 int (*flush)(struct hci_dev *hdev); 296 int (*flush)(struct hci_dev *hdev);
286 int (*setup)(struct hci_dev *hdev); 297 int (*setup)(struct hci_dev *hdev);
287 int (*send)(struct sk_buff *skb); 298 int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
288 void (*notify)(struct hci_dev *hdev, unsigned int evt); 299 void (*notify)(struct hci_dev *hdev, unsigned int evt);
289 int (*ioctl)(struct hci_dev *hdev, unsigned int cmd, unsigned long arg);
290}; 300};
291 301
292#define HCI_PHY_HANDLE(handle) (handle & 0xff) 302#define HCI_PHY_HANDLE(handle) (handle & 0xff)
@@ -298,6 +308,8 @@ struct hci_conn {
298 308
299 bdaddr_t dst; 309 bdaddr_t dst;
300 __u8 dst_type; 310 __u8 dst_type;
311 bdaddr_t src;
312 __u8 src_type;
301 __u16 handle; 313 __u16 handle;
302 __u16 state; 314 __u16 state;
303 __u8 mode; 315 __u8 mode;
@@ -306,7 +318,6 @@ struct hci_conn {
306 __u8 attempt; 318 __u8 attempt;
307 __u8 dev_class[3]; 319 __u8 dev_class[3];
308 __u8 features[HCI_MAX_PAGES][8]; 320 __u8 features[HCI_MAX_PAGES][8];
309 __u16 interval;
310 __u16 pkt_type; 321 __u16 pkt_type;
311 __u16 link_policy; 322 __u16 link_policy;
312 __u32 link_mode; 323 __u32 link_mode;
@@ -334,8 +345,8 @@ struct hci_conn {
334 struct list_head chan_list; 345 struct list_head chan_list;
335 346
336 struct delayed_work disc_work; 347 struct delayed_work disc_work;
337 struct timer_list idle_timer; 348 struct delayed_work auto_accept_work;
338 struct timer_list auto_accept_timer; 349 struct delayed_work idle_work;
339 350
340 struct device dev; 351 struct device dev;
341 352
@@ -367,18 +378,17 @@ extern rwlock_t hci_dev_list_lock;
367extern rwlock_t hci_cb_list_lock; 378extern rwlock_t hci_cb_list_lock;
368 379
369/* ----- HCI interface to upper protocols ----- */ 380/* ----- HCI interface to upper protocols ----- */
370extern int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr); 381int l2cap_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr);
371extern void l2cap_connect_cfm(struct hci_conn *hcon, u8 status); 382void l2cap_connect_cfm(struct hci_conn *hcon, u8 status);
372extern int l2cap_disconn_ind(struct hci_conn *hcon); 383int l2cap_disconn_ind(struct hci_conn *hcon);
373extern void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason); 384void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason);
374extern int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt); 385int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt);
375extern int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, 386int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags);
376 u16 flags); 387
377 388int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags);
378extern int sco_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags); 389void sco_connect_cfm(struct hci_conn *hcon, __u8 status);
379extern void sco_connect_cfm(struct hci_conn *hcon, __u8 status); 390void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason);
380extern void sco_disconn_cfm(struct hci_conn *hcon, __u8 reason); 391int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
381extern int sco_recv_scodata(struct hci_conn *hcon, struct sk_buff *skb);
382 392
383/* ----- Inquiry cache ----- */ 393/* ----- Inquiry cache ----- */
384#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */ 394#define INQUIRY_CACHE_AGE_MAX (HZ*30) /* 30 seconds */
@@ -644,7 +654,7 @@ static inline void hci_conn_drop(struct hci_conn *conn)
644 switch (conn->type) { 654 switch (conn->type) {
645 case ACL_LINK: 655 case ACL_LINK:
646 case LE_LINK: 656 case LE_LINK:
647 del_timer(&conn->idle_timer); 657 cancel_delayed_work(&conn->idle_work);
648 if (conn->state == BT_CONNECTED) { 658 if (conn->state == BT_CONNECTED) {
649 timeo = conn->disc_timeout; 659 timeo = conn->disc_timeout;
650 if (!conn->out) 660 if (!conn->out)
@@ -703,19 +713,6 @@ static inline void hci_set_drvdata(struct hci_dev *hdev, void *data)
703 dev_set_drvdata(&hdev->dev, data); 713 dev_set_drvdata(&hdev->dev, data);
704} 714}
705 715
706/* hci_dev_list shall be locked */
707static inline uint8_t __hci_num_ctrl(void)
708{
709 uint8_t count = 0;
710 struct list_head *p;
711
712 list_for_each(p, &hci_dev_list) {
713 count++;
714 }
715
716 return count;
717}
718
719struct hci_dev *hci_dev_get(int index); 716struct hci_dev *hci_dev_get(int index);
720struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src); 717struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src);
721 718
@@ -738,7 +735,7 @@ int hci_get_auth_info(struct hci_dev *hdev, void __user *arg);
738int hci_inquiry(void __user *arg); 735int hci_inquiry(void __user *arg);
739 736
740struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev, 737struct bdaddr_list *hci_blacklist_lookup(struct hci_dev *hdev,
741 bdaddr_t *bdaddr); 738 bdaddr_t *bdaddr, u8 type);
742int hci_blacklist_clear(struct hci_dev *hdev); 739int hci_blacklist_clear(struct hci_dev *hdev);
743int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 740int hci_blacklist_add(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
744int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 741int hci_blacklist_del(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
@@ -768,13 +765,11 @@ int hci_remove_remote_oob_data(struct hci_dev *hdev, bdaddr_t *bdaddr);
768 765
769void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); 766void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb);
770 767
771int hci_recv_frame(struct sk_buff *skb); 768int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb);
772int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); 769int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count);
773int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); 770int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count);
774 771
775void hci_init_sysfs(struct hci_dev *hdev); 772void hci_init_sysfs(struct hci_dev *hdev);
776int hci_add_sysfs(struct hci_dev *hdev);
777void hci_del_sysfs(struct hci_dev *hdev);
778void hci_conn_init_sysfs(struct hci_conn *conn); 773void hci_conn_init_sysfs(struct hci_conn *conn);
779void hci_conn_add_sysfs(struct hci_conn *conn); 774void hci_conn_add_sysfs(struct hci_conn *conn);
780void hci_conn_del_sysfs(struct hci_conn *conn); 775void hci_conn_del_sysfs(struct hci_conn *conn);
@@ -807,22 +802,6 @@ void hci_conn_del_sysfs(struct hci_conn *conn);
807#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE)) 802#define lmp_host_le_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE))
808#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR)) 803#define lmp_host_le_br_capable(dev) (!!((dev)->features[1][0] & LMP_HOST_LE_BREDR))
809 804
810/* returns true if at least one AMP active */
811static inline bool hci_amp_capable(void)
812{
813 struct hci_dev *hdev;
814 bool ret = false;
815
816 read_lock(&hci_dev_list_lock);
817 list_for_each_entry(hdev, &hci_dev_list, list)
818 if (hdev->amp_type == HCI_AMP &&
819 test_bit(HCI_UP, &hdev->flags))
820 ret = true;
821 read_unlock(&hci_dev_list_lock);
822
823 return ret;
824}
825
826/* ----- HCI protocols ----- */ 805/* ----- HCI protocols ----- */
827#define HCI_PROTO_DEFER 0x01 806#define HCI_PROTO_DEFER 0x01
828 807
@@ -1033,34 +1012,6 @@ static inline bool eir_has_data_type(u8 *data, size_t data_len, u8 type)
1033 return false; 1012 return false;
1034} 1013}
1035 1014
1036static inline size_t eir_get_length(u8 *eir, size_t eir_len)
1037{
1038 size_t parsed = 0;
1039
1040 while (parsed < eir_len) {
1041 u8 field_len = eir[0];
1042
1043 if (field_len == 0)
1044 return parsed;
1045
1046 parsed += field_len + 1;
1047 eir += field_len + 1;
1048 }
1049
1050 return eir_len;
1051}
1052
1053static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
1054 u8 data_len)
1055{
1056 eir[eir_len++] = sizeof(type) + data_len;
1057 eir[eir_len++] = type;
1058 memcpy(&eir[eir_len], data, data_len);
1059 eir_len += data_len;
1060
1061 return eir_len;
1062}
1063
1064int hci_register_cb(struct hci_cb *hcb); 1015int hci_register_cb(struct hci_cb *hcb);
1065int hci_unregister_cb(struct hci_cb *hcb); 1016int hci_unregister_cb(struct hci_cb *hcb);
1066 1017
@@ -1120,29 +1071,30 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event);
1120#define DISCOV_BREDR_INQUIRY_LEN 0x08 1071#define DISCOV_BREDR_INQUIRY_LEN 0x08
1121 1072
1122int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len); 1073int mgmt_control(struct sock *sk, struct msghdr *msg, size_t len);
1123int mgmt_index_added(struct hci_dev *hdev); 1074void mgmt_index_added(struct hci_dev *hdev);
1124int mgmt_index_removed(struct hci_dev *hdev); 1075void mgmt_index_removed(struct hci_dev *hdev);
1125int mgmt_set_powered_failed(struct hci_dev *hdev, int err); 1076void mgmt_set_powered_failed(struct hci_dev *hdev, int err);
1126int mgmt_powered(struct hci_dev *hdev, u8 powered); 1077int mgmt_powered(struct hci_dev *hdev, u8 powered);
1127int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable); 1078void mgmt_discoverable_timeout(struct hci_dev *hdev);
1128int mgmt_connectable(struct hci_dev *hdev, u8 connectable); 1079void mgmt_discoverable(struct hci_dev *hdev, u8 discoverable);
1129int mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status); 1080void mgmt_connectable(struct hci_dev *hdev, u8 connectable);
1130int mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key, 1081void mgmt_write_scan_failed(struct hci_dev *hdev, u8 scan, u8 status);
1131 bool persistent); 1082void mgmt_new_link_key(struct hci_dev *hdev, struct link_key *key,
1132int mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1083 bool persistent);
1133 u8 addr_type, u32 flags, u8 *name, u8 name_len, 1084void mgmt_device_connected(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1134 u8 *dev_class); 1085 u8 addr_type, u32 flags, u8 *name, u8 name_len,
1135int mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr, 1086 u8 *dev_class);
1136 u8 link_type, u8 addr_type, u8 reason); 1087void mgmt_device_disconnected(struct hci_dev *hdev, bdaddr_t *bdaddr,
1137int mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, 1088 u8 link_type, u8 addr_type, u8 reason);
1138 u8 link_type, u8 addr_type, u8 status); 1089void mgmt_disconnect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr,
1139int mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1090 u8 link_type, u8 addr_type, u8 status);
1140 u8 addr_type, u8 status); 1091void mgmt_connect_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1141int mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure); 1092 u8 addr_type, u8 status);
1142int mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1093void mgmt_pin_code_request(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 secure);
1143 u8 status); 1094void mgmt_pin_code_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1144int mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr, 1095 u8 status);
1145 u8 status); 1096void mgmt_pin_code_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1097 u8 status);
1146int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr, 1098int mgmt_user_confirm_request(struct hci_dev *hdev, bdaddr_t *bdaddr,
1147 u8 link_type, u8 addr_type, __le32 value, 1099 u8 link_type, u8 addr_type, __le32 value,
1148 u8 confirm_hint); 1100 u8 confirm_hint);
@@ -1159,26 +1111,25 @@ int mgmt_user_passkey_neg_reply_complete(struct hci_dev *hdev, bdaddr_t *bdaddr,
1159int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr, 1111int mgmt_user_passkey_notify(struct hci_dev *hdev, bdaddr_t *bdaddr,
1160 u8 link_type, u8 addr_type, u32 passkey, 1112 u8 link_type, u8 addr_type, u32 passkey,
1161 u8 entered); 1113 u8 entered);
1162int mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1114void mgmt_auth_failed(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1163 u8 addr_type, u8 status); 1115 u8 addr_type, u8 status);
1164int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status); 1116void mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status);
1165int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1117void mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 enable, u8 status);
1166int mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class, 1118void mgmt_set_class_of_dev_complete(struct hci_dev *hdev, u8 *dev_class,
1167 u8 status); 1119 u8 status);
1168int mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status); 1120void mgmt_set_local_name_complete(struct hci_dev *hdev, u8 *name, u8 status);
1169int mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash, 1121void mgmt_read_local_oob_data_reply_complete(struct hci_dev *hdev, u8 *hash,
1170 u8 *randomizer, u8 status); 1122 u8 *randomizer, u8 status);
1171int mgmt_le_enable_complete(struct hci_dev *hdev, u8 enable, u8 status); 1123void mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1172int mgmt_device_found(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1124 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name,
1173 u8 addr_type, u8 *dev_class, s8 rssi, u8 cfm_name, 1125 u8 ssp, u8 *eir, u16 eir_len);
1174 u8 ssp, u8 *eir, u16 eir_len); 1126void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1175int mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type, 1127 u8 addr_type, s8 rssi, u8 *name, u8 name_len);
1176 u8 addr_type, s8 rssi, u8 *name, u8 name_len); 1128void mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1177int mgmt_discovering(struct hci_dev *hdev, u8 discovering);
1178int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1129int mgmt_device_blocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1179int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type); 1130int mgmt_device_unblocked(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type);
1180bool mgmt_valid_hdev(struct hci_dev *hdev); 1131void mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent);
1181int mgmt_new_ltk(struct hci_dev *hdev, struct smp_ltk *key, u8 persistent); 1132void mgmt_reenable_advertising(struct hci_dev *hdev);
1182 1133
1183/* HCI info for socket */ 1134/* HCI info for socket */
1184#define hci_pi(sk) ((struct hci_pinfo *) sk) 1135#define hci_pi(sk) ((struct hci_pinfo *) sk)
@@ -1208,15 +1159,11 @@ struct hci_sec_filter {
1208#define hci_req_lock(d) mutex_lock(&d->req_lock) 1159#define hci_req_lock(d) mutex_lock(&d->req_lock)
1209#define hci_req_unlock(d) mutex_unlock(&d->req_lock) 1160#define hci_req_unlock(d) mutex_unlock(&d->req_lock)
1210 1161
1211void hci_update_ad(struct hci_request *req);
1212
1213void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max, 1162void hci_le_conn_update(struct hci_conn *conn, u16 min, u16 max,
1214 u16 latency, u16 to_multiplier); 1163 u16 latency, u16 to_multiplier);
1215void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8], 1164void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
1216 __u8 ltk[16]); 1165 __u8 ltk[16]);
1217 1166
1218u8 bdaddr_to_le(u8 bdaddr_type);
1219
1220#define SCO_AIRMODE_MASK 0x0003 1167#define SCO_AIRMODE_MASK 0x0003
1221#define SCO_AIRMODE_CVSD 0x0000 1168#define SCO_AIRMODE_CVSD 0x0000
1222#define SCO_AIRMODE_TRANSP 0x0003 1169#define SCO_AIRMODE_TRANSP 0x0003
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 1a966afbbfa8..51329905bfaa 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -131,6 +131,7 @@ struct l2cap_conninfo {
131 131
132/* L2CAP fixed channels */ 132/* L2CAP fixed channels */
133#define L2CAP_FC_L2CAP 0x02 133#define L2CAP_FC_L2CAP 0x02
134#define L2CAP_FC_CONNLESS 0x04
134#define L2CAP_FC_A2MP 0x08 135#define L2CAP_FC_A2MP 0x08
135 136
136/* L2CAP Control Field bit masks */ 137/* L2CAP Control Field bit masks */
@@ -237,6 +238,7 @@ struct l2cap_conn_rsp {
237/* protocol/service multiplexer (PSM) */ 238/* protocol/service multiplexer (PSM) */
238#define L2CAP_PSM_SDP 0x0001 239#define L2CAP_PSM_SDP 0x0001
239#define L2CAP_PSM_RFCOMM 0x0003 240#define L2CAP_PSM_RFCOMM 0x0003
241#define L2CAP_PSM_3DSP 0x0021
240 242
241/* channel indentifier */ 243/* channel indentifier */
242#define L2CAP_CID_SIGNALING 0x0001 244#define L2CAP_CID_SIGNALING 0x0001
@@ -433,8 +435,6 @@ struct l2cap_seq_list {
433#define L2CAP_SEQ_LIST_TAIL 0x8000 435#define L2CAP_SEQ_LIST_TAIL 0x8000
434 436
435struct l2cap_chan { 437struct l2cap_chan {
436 struct sock *sk;
437
438 struct l2cap_conn *conn; 438 struct l2cap_conn *conn;
439 struct hci_conn *hs_hcon; 439 struct hci_conn *hs_hcon;
440 struct hci_chan *hs_hchan; 440 struct hci_chan *hs_hchan;
@@ -442,7 +442,12 @@ struct l2cap_chan {
442 442
443 __u8 state; 443 __u8 state;
444 444
445 bdaddr_t dst;
446 __u8 dst_type;
447 bdaddr_t src;
448 __u8 src_type;
445 __le16 psm; 449 __le16 psm;
450 __le16 sport;
446 __u16 dcid; 451 __u16 dcid;
447 __u16 scid; 452 __u16 scid;
448 453
@@ -453,8 +458,6 @@ struct l2cap_chan {
453 __u8 chan_type; 458 __u8 chan_type;
454 __u8 chan_policy; 459 __u8 chan_policy;
455 460
456 __le16 sport;
457
458 __u8 sec_level; 461 __u8 sec_level;
459 462
460 __u8 ident; 463 __u8 ident;
@@ -546,9 +549,12 @@ struct l2cap_ops {
546 void (*teardown) (struct l2cap_chan *chan, int err); 549 void (*teardown) (struct l2cap_chan *chan, int err);
547 void (*close) (struct l2cap_chan *chan); 550 void (*close) (struct l2cap_chan *chan);
548 void (*state_change) (struct l2cap_chan *chan, 551 void (*state_change) (struct l2cap_chan *chan,
549 int state); 552 int state, int err);
550 void (*ready) (struct l2cap_chan *chan); 553 void (*ready) (struct l2cap_chan *chan);
551 void (*defer) (struct l2cap_chan *chan); 554 void (*defer) (struct l2cap_chan *chan);
555 void (*resume) (struct l2cap_chan *chan);
556 void (*set_shutdown) (struct l2cap_chan *chan);
557 long (*get_sndtimeo) (struct l2cap_chan *chan);
552 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan, 558 struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
553 unsigned long len, int nb); 559 unsigned long len, int nb);
554}; 560};
@@ -557,13 +563,11 @@ struct l2cap_conn {
557 struct hci_conn *hcon; 563 struct hci_conn *hcon;
558 struct hci_chan *hchan; 564 struct hci_chan *hchan;
559 565
560 bdaddr_t *dst;
561 bdaddr_t *src;
562
563 unsigned int mtu; 566 unsigned int mtu;
564 567
565 __u32 feat_mask; 568 __u32 feat_mask;
566 __u8 fixed_chan_mask; 569 __u8 fixed_chan_mask;
570 bool hs_enabled;
567 571
568 __u8 info_state; 572 __u8 info_state;
569 __u8 info_ident; 573 __u8 info_ident;
@@ -649,6 +653,7 @@ enum {
649 FLAG_FLUSHABLE, 653 FLAG_FLUSHABLE,
650 FLAG_EXT_CTRL, 654 FLAG_EXT_CTRL,
651 FLAG_EFS_ENABLE, 655 FLAG_EFS_ENABLE,
656 FLAG_DEFER_SETUP,
652}; 657};
653 658
654enum { 659enum {
@@ -790,6 +795,19 @@ static inline void l2cap_chan_no_defer(struct l2cap_chan *chan)
790{ 795{
791} 796}
792 797
798static inline void l2cap_chan_no_resume(struct l2cap_chan *chan)
799{
800}
801
802static inline void l2cap_chan_no_set_shutdown(struct l2cap_chan *chan)
803{
804}
805
806static inline long l2cap_chan_no_get_sndtimeo(struct l2cap_chan *chan)
807{
808 return 0;
809}
810
793extern bool disable_ertm; 811extern bool disable_ertm;
794 812
795int l2cap_init_sockets(void); 813int l2cap_init_sockets(void);
@@ -797,7 +815,6 @@ void l2cap_cleanup_sockets(void);
797bool l2cap_is_socket(struct socket *sock); 815bool l2cap_is_socket(struct socket *sock);
798 816
799void __l2cap_connect_rsp_defer(struct l2cap_chan *chan); 817void __l2cap_connect_rsp_defer(struct l2cap_chan *chan);
800int __l2cap_wait_ack(struct sock *sk);
801 818
802int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm); 819int l2cap_add_psm(struct l2cap_chan *chan, bdaddr_t *src, __le16 psm);
803int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid); 820int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h
index 9944c3e68c5d..518c5c84e39a 100644
--- a/include/net/bluetooth/mgmt.h
+++ b/include/net/bluetooth/mgmt.h
@@ -93,6 +93,7 @@ struct mgmt_rp_read_index_list {
93#define MGMT_SETTING_BREDR 0x00000080 93#define MGMT_SETTING_BREDR 0x00000080
94#define MGMT_SETTING_HS 0x00000100 94#define MGMT_SETTING_HS 0x00000100
95#define MGMT_SETTING_LE 0x00000200 95#define MGMT_SETTING_LE 0x00000200
96#define MGMT_SETTING_ADVERTISING 0x00000400
96 97
97#define MGMT_OP_READ_INFO 0x0004 98#define MGMT_OP_READ_INFO 0x0004
98#define MGMT_READ_INFO_SIZE 0 99#define MGMT_READ_INFO_SIZE 0
@@ -351,6 +352,23 @@ struct mgmt_cp_set_device_id {
351} __packed; 352} __packed;
352#define MGMT_SET_DEVICE_ID_SIZE 8 353#define MGMT_SET_DEVICE_ID_SIZE 8
353 354
355#define MGMT_OP_SET_ADVERTISING 0x0029
356
357#define MGMT_OP_SET_BREDR 0x002A
358
359#define MGMT_OP_SET_STATIC_ADDRESS 0x002B
360struct mgmt_cp_set_static_address {
361 bdaddr_t bdaddr;
362} __packed;
363#define MGMT_SET_STATIC_ADDRESS_SIZE 6
364
365#define MGMT_OP_SET_SCAN_PARAMS 0x002C
366struct mgmt_cp_set_scan_params {
367 __le16 interval;
368 __le16 window;
369} __packed;
370#define MGMT_SET_SCAN_PARAMS_SIZE 4
371
354#define MGMT_EV_CMD_COMPLETE 0x0001 372#define MGMT_EV_CMD_COMPLETE 0x0001
355struct mgmt_ev_cmd_complete { 373struct mgmt_ev_cmd_complete {
356 __le16 opcode; 374 __le16 opcode;
diff --git a/include/net/bluetooth/rfcomm.h b/include/net/bluetooth/rfcomm.h
index 7afd4199d6b6..486213a1aed8 100644
--- a/include/net/bluetooth/rfcomm.h
+++ b/include/net/bluetooth/rfcomm.h
@@ -256,8 +256,8 @@ static inline void rfcomm_dlc_put(struct rfcomm_dlc *d)
256 rfcomm_dlc_free(d); 256 rfcomm_dlc_free(d);
257} 257}
258 258
259extern void __rfcomm_dlc_throttle(struct rfcomm_dlc *d); 259void __rfcomm_dlc_throttle(struct rfcomm_dlc *d);
260extern void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d); 260void __rfcomm_dlc_unthrottle(struct rfcomm_dlc *d);
261 261
262static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d) 262static inline void rfcomm_dlc_throttle(struct rfcomm_dlc *d)
263{ 263{
@@ -300,6 +300,8 @@ struct rfcomm_conninfo {
300 300
301struct rfcomm_pinfo { 301struct rfcomm_pinfo {
302 struct bt_sock bt; 302 struct bt_sock bt;
303 bdaddr_t src;
304 bdaddr_t dst;
303 struct rfcomm_dlc *dlc; 305 struct rfcomm_dlc *dlc;
304 u8 channel; 306 u8 channel;
305 u8 sec_level; 307 u8 sec_level;
diff --git a/include/net/bluetooth/sco.h b/include/net/bluetooth/sco.h
index e252a31ee6b6..2019d1a0996a 100644
--- a/include/net/bluetooth/sco.h
+++ b/include/net/bluetooth/sco.h
@@ -55,9 +55,6 @@ struct sco_conninfo {
55struct sco_conn { 55struct sco_conn {
56 struct hci_conn *hcon; 56 struct hci_conn *hcon;
57 57
58 bdaddr_t *dst;
59 bdaddr_t *src;
60
61 spinlock_t lock; 58 spinlock_t lock;
62 struct sock *sk; 59 struct sock *sk;
63 60
@@ -72,6 +69,8 @@ struct sco_conn {
72 69
73struct sco_pinfo { 70struct sco_pinfo {
74 struct bt_sock bt; 71 struct bt_sock bt;
72 bdaddr_t src;
73 bdaddr_t dst;
75 __u32 flags; 74 __u32 flags;
76 __u16 setting; 75 __u16 setting;
77 struct sco_conn *conn; 76 struct sco_conn *conn;
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
deleted file mode 100644
index f8ba07f3e5fa..000000000000
--- a/include/net/bluetooth/smp.h
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 BlueZ - Bluetooth protocol stack for Linux
3 Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License version 2 as
7 published by the Free Software Foundation;
8
9 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
10 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
12 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
13 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
14 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
18 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
19 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
20 SOFTWARE IS DISCLAIMED.
21*/
22
23#ifndef __SMP_H
24#define __SMP_H
25
26struct smp_command_hdr {
27 __u8 code;
28} __packed;
29
30#define SMP_CMD_PAIRING_REQ 0x01
31#define SMP_CMD_PAIRING_RSP 0x02
32struct smp_cmd_pairing {
33 __u8 io_capability;
34 __u8 oob_flag;
35 __u8 auth_req;
36 __u8 max_key_size;
37 __u8 init_key_dist;
38 __u8 resp_key_dist;
39} __packed;
40
41#define SMP_IO_DISPLAY_ONLY 0x00
42#define SMP_IO_DISPLAY_YESNO 0x01
43#define SMP_IO_KEYBOARD_ONLY 0x02
44#define SMP_IO_NO_INPUT_OUTPUT 0x03
45#define SMP_IO_KEYBOARD_DISPLAY 0x04
46
47#define SMP_OOB_NOT_PRESENT 0x00
48#define SMP_OOB_PRESENT 0x01
49
50#define SMP_DIST_ENC_KEY 0x01
51#define SMP_DIST_ID_KEY 0x02
52#define SMP_DIST_SIGN 0x04
53
54#define SMP_AUTH_NONE 0x00
55#define SMP_AUTH_BONDING 0x01
56#define SMP_AUTH_MITM 0x04
57
58#define SMP_CMD_PAIRING_CONFIRM 0x03
59struct smp_cmd_pairing_confirm {
60 __u8 confirm_val[16];
61} __packed;
62
63#define SMP_CMD_PAIRING_RANDOM 0x04
64struct smp_cmd_pairing_random {
65 __u8 rand_val[16];
66} __packed;
67
68#define SMP_CMD_PAIRING_FAIL 0x05
69struct smp_cmd_pairing_fail {
70 __u8 reason;
71} __packed;
72
73#define SMP_CMD_ENCRYPT_INFO 0x06
74struct smp_cmd_encrypt_info {
75 __u8 ltk[16];
76} __packed;
77
78#define SMP_CMD_MASTER_IDENT 0x07
79struct smp_cmd_master_ident {
80 __le16 ediv;
81 __u8 rand[8];
82} __packed;
83
84#define SMP_CMD_IDENT_INFO 0x08
85struct smp_cmd_ident_info {
86 __u8 irk[16];
87} __packed;
88
89#define SMP_CMD_IDENT_ADDR_INFO 0x09
90struct smp_cmd_ident_addr_info {
91 __u8 addr_type;
92 bdaddr_t bdaddr;
93} __packed;
94
95#define SMP_CMD_SIGN_INFO 0x0a
96struct smp_cmd_sign_info {
97 __u8 csrk[16];
98} __packed;
99
100#define SMP_CMD_SECURITY_REQ 0x0b
101struct smp_cmd_security_req {
102 __u8 auth_req;
103} __packed;
104
105#define SMP_PASSKEY_ENTRY_FAILED 0x01
106#define SMP_OOB_NOT_AVAIL 0x02
107#define SMP_AUTH_REQUIREMENTS 0x03
108#define SMP_CONFIRM_FAILED 0x04
109#define SMP_PAIRING_NOTSUPP 0x05
110#define SMP_ENC_KEY_SIZE 0x06
111#define SMP_CMD_NOTSUPP 0x07
112#define SMP_UNSPECIFIED 0x08
113#define SMP_REPEATED_ATTEMPTS 0x09
114
115#define SMP_MIN_ENC_KEY_SIZE 7
116#define SMP_MAX_ENC_KEY_SIZE 16
117
118#define SMP_FLAG_TK_VALID 1
119#define SMP_FLAG_CFM_PENDING 2
120#define SMP_FLAG_MITM_AUTH 3
121
122struct smp_chan {
123 struct l2cap_conn *conn;
124 u8 preq[7]; /* SMP Pairing Request */
125 u8 prsp[7]; /* SMP Pairing Response */
126 u8 prnd[16]; /* SMP Pairing Random (local) */
127 u8 rrnd[16]; /* SMP Pairing Random (remote) */
128 u8 pcnf[16]; /* SMP Pairing Confirm */
129 u8 tk[16]; /* SMP Temporary Key */
130 u8 enc_key_size;
131 unsigned long smp_flags;
132 struct crypto_blkcipher *tfm;
133 struct work_struct confirm;
134 struct work_struct random;
135
136};
137
138/* SMP Commands */
139int smp_conn_security(struct hci_conn *hcon, __u8 sec_level);
140int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb);
141int smp_distribute_keys(struct l2cap_conn *conn, __u8 force);
142int smp_user_confirm_reply(struct hci_conn *conn, u16 mgmt_op, __le32 passkey);
143
144void smp_chan_destroy(struct l2cap_conn *conn);
145
146#endif /* __SMP_H */
diff --git a/include/net/caif/caif_hsi.h b/include/net/caif/caif_hsi.h
index 4795e817afe5..097f69cfaa75 100644
--- a/include/net/caif/caif_hsi.h
+++ b/include/net/caif/caif_hsi.h
@@ -195,6 +195,6 @@ enum ifla_caif_hsi {
195 __IFLA_CAIF_HSI_MAX 195 __IFLA_CAIF_HSI_MAX
196}; 196};
197 197
198extern struct cfhsi_ops *cfhsi_get_ops(void); 198struct cfhsi_ops *cfhsi_get_ops(void);
199 199
200#endif /* CAIF_HSI_H_ */ 200#endif /* CAIF_HSI_H_ */
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index cb710913d5c8..3eae46cb1acf 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -437,6 +437,15 @@ bool cfg80211_chandef_usable(struct wiphy *wiphy,
437 u32 prohibited_flags); 437 u32 prohibited_flags);
438 438
439/** 439/**
440 * cfg80211_chandef_dfs_required - checks if radar detection is required
441 * @wiphy: the wiphy to validate against
442 * @chandef: the channel definition to check
443 * Return: 1 if radar detection is required, 0 if it is not, < 0 on error
444 */
445int cfg80211_chandef_dfs_required(struct wiphy *wiphy,
446 const struct cfg80211_chan_def *chandef);
447
448/**
440 * ieee80211_chandef_rate_flags - returns rate flags for a channel 449 * ieee80211_chandef_rate_flags - returns rate flags for a channel
441 * 450 *
442 * In some channel types, not all rates may be used - for example CCK 451 * In some channel types, not all rates may be used - for example CCK
@@ -735,6 +744,10 @@ enum station_parameters_apply_mask {
735 * @capability: station capability 744 * @capability: station capability
736 * @ext_capab: extended capabilities of the station 745 * @ext_capab: extended capabilities of the station
737 * @ext_capab_len: number of extended capabilities 746 * @ext_capab_len: number of extended capabilities
747 * @supported_channels: supported channels in IEEE 802.11 format
748 * @supported_channels_len: number of supported channels
749 * @supported_oper_classes: supported oper classes in IEEE 802.11 format
750 * @supported_oper_classes_len: number of supported operating classes
738 */ 751 */
739struct station_parameters { 752struct station_parameters {
740 const u8 *supported_rates; 753 const u8 *supported_rates;
@@ -754,6 +767,10 @@ struct station_parameters {
754 u16 capability; 767 u16 capability;
755 const u8 *ext_capab; 768 const u8 *ext_capab;
756 u8 ext_capab_len; 769 u8 ext_capab_len;
770 const u8 *supported_channels;
771 u8 supported_channels_len;
772 const u8 *supported_oper_classes;
773 u8 supported_oper_classes_len;
757}; 774};
758 775
759/** 776/**
@@ -1647,6 +1664,9 @@ struct cfg80211_disassoc_request {
1647 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 1664 * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is
1648 * required to assume that the port is unauthorized until authorized by 1665 * required to assume that the port is unauthorized until authorized by
1649 * user space. Otherwise, port is marked authorized by default. 1666 * user space. Otherwise, port is marked authorized by default.
1667 * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
1668 * changes the channel when a radar is detected. This is required
1669 * to operate on DFS channels.
1650 * @basic_rates: bitmap of basic rates to use when creating the IBSS 1670 * @basic_rates: bitmap of basic rates to use when creating the IBSS
1651 * @mcast_rate: per-band multicast rate index + 1 (0: disabled) 1671 * @mcast_rate: per-band multicast rate index + 1 (0: disabled)
1652 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask 1672 * @ht_capa: HT Capabilities over-rides. Values set in ht_capa_mask
@@ -1664,6 +1684,7 @@ struct cfg80211_ibss_params {
1664 bool channel_fixed; 1684 bool channel_fixed;
1665 bool privacy; 1685 bool privacy;
1666 bool control_port; 1686 bool control_port;
1687 bool userspace_handles_dfs;
1667 int mcast_rate[IEEE80211_NUM_BANDS]; 1688 int mcast_rate[IEEE80211_NUM_BANDS];
1668 struct ieee80211_ht_cap ht_capa; 1689 struct ieee80211_ht_cap ht_capa;
1669 struct ieee80211_ht_cap ht_capa_mask; 1690 struct ieee80211_ht_cap ht_capa_mask;
@@ -3044,6 +3065,7 @@ struct cfg80211_cached_keys;
3044 * @conn: (private) cfg80211 software SME connection state machine data 3065 * @conn: (private) cfg80211 software SME connection state machine data
3045 * @connect_keys: (private) keys to set after connection is established 3066 * @connect_keys: (private) keys to set after connection is established
3046 * @ibss_fixed: (private) IBSS is using fixed BSSID 3067 * @ibss_fixed: (private) IBSS is using fixed BSSID
3068 * @ibss_dfs_possible: (private) IBSS may change to a DFS channel
3047 * @event_list: (private) list for internal event processing 3069 * @event_list: (private) list for internal event processing
3048 * @event_lock: (private) lock for event list 3070 * @event_lock: (private) lock for event list
3049 */ 3071 */
@@ -3082,6 +3104,7 @@ struct wireless_dev {
3082 struct ieee80211_channel *channel; 3104 struct ieee80211_channel *channel;
3083 3105
3084 bool ibss_fixed; 3106 bool ibss_fixed;
3107 bool ibss_dfs_possible;
3085 3108
3086 bool ps; 3109 bool ps;
3087 int ps_timeout; 3110 int ps_timeout;
@@ -3474,6 +3497,15 @@ void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
3474const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy, 3497const struct ieee80211_reg_rule *freq_reg_info(struct wiphy *wiphy,
3475 u32 center_freq); 3498 u32 center_freq);
3476 3499
3500/**
3501 * reg_initiator_name - map regulatory request initiator enum to name
3502 * @initiator: the regulatory request initiator
3503 *
3504 * You can use this to map the regulatory request initiator enum to a
3505 * proper string representation.
3506 */
3507const char *reg_initiator_name(enum nl80211_reg_initiator initiator);
3508
3477/* 3509/*
3478 * callbacks for asynchronous cfg80211 methods, notification 3510 * callbacks for asynchronous cfg80211 methods, notification
3479 * functions and BSS handling helpers 3511 * functions and BSS handling helpers
diff --git a/include/net/checksum.h b/include/net/checksum.h
index 8f59ca50477c..37a0e24adbe7 100644
--- a/include/net/checksum.h
+++ b/include/net/checksum.h
@@ -79,6 +79,12 @@ csum_block_add(__wsum csum, __wsum csum2, int offset)
79} 79}
80 80
81static inline __wsum 81static inline __wsum
82csum_block_add_ext(__wsum csum, __wsum csum2, int offset, int len)
83{
84 return csum_block_add(csum, csum2, offset);
85}
86
87static inline __wsum
82csum_block_sub(__wsum csum, __wsum csum2, int offset) 88csum_block_sub(__wsum csum, __wsum csum2, int offset)
83{ 89{
84 u32 sum = (__force u32)csum2; 90 u32 sum = (__force u32)csum2;
@@ -92,6 +98,11 @@ static inline __wsum csum_unfold(__sum16 n)
92 return (__force __wsum)n; 98 return (__force __wsum)n;
93} 99}
94 100
101static inline __wsum csum_partial_ext(const void *buff, int len, __wsum sum)
102{
103 return csum_partial(buff, len, sum);
104}
105
95#define CSUM_MANGLED_0 ((__force __sum16)0xffff) 106#define CSUM_MANGLED_0 ((__force __sum16)0xffff)
96 107
97static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to) 108static inline void csum_replace4(__sum16 *sum, __be32 from, __be32 to)
diff --git a/include/net/codel.h b/include/net/codel.h
index 389cf621161d..3b04ff5f6f8d 100644
--- a/include/net/codel.h
+++ b/include/net/codel.h
@@ -72,10 +72,21 @@ static inline codel_time_t codel_get_time(void)
72 return ns >> CODEL_SHIFT; 72 return ns >> CODEL_SHIFT;
73} 73}
74 74
75#define codel_time_after(a, b) ((s32)(a) - (s32)(b) > 0) 75/* Dealing with timer wrapping, according to RFC 1982, as desc in wikipedia:
76#define codel_time_after_eq(a, b) ((s32)(a) - (s32)(b) >= 0) 76 * https://en.wikipedia.org/wiki/Serial_number_arithmetic#General_Solution
77#define codel_time_before(a, b) ((s32)(a) - (s32)(b) < 0) 77 * codel_time_after(a,b) returns true if the time a is after time b.
78#define codel_time_before_eq(a, b) ((s32)(a) - (s32)(b) <= 0) 78 */
79#define codel_time_after(a, b) \
80 (typecheck(codel_time_t, a) && \
81 typecheck(codel_time_t, b) && \
82 ((s32)((a) - (b)) > 0))
83#define codel_time_before(a, b) codel_time_after(b, a)
84
85#define codel_time_after_eq(a, b) \
86 (typecheck(codel_time_t, a) && \
87 typecheck(codel_time_t, b) && \
88 ((s32)((a) - (b)) >= 0))
89#define codel_time_before_eq(a, b) codel_time_after_eq(b, a)
79 90
80/* Qdiscs using codel plugin must use codel_skb_cb in their own cb[] */ 91/* Qdiscs using codel plugin must use codel_skb_cb in their own cb[] */
81struct codel_skb_cb { 92struct codel_skb_cb {
diff --git a/include/net/compat.h b/include/net/compat.h
index 6e9565324989..3b603b199c01 100644
--- a/include/net/compat.h
+++ b/include/net/compat.h
@@ -29,8 +29,8 @@ struct compat_cmsghdr {
29 compat_int_t cmsg_type; 29 compat_int_t cmsg_type;
30}; 30};
31 31
32extern int compat_sock_get_timestamp(struct sock *, struct timeval __user *); 32int compat_sock_get_timestamp(struct sock *, struct timeval __user *);
33extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *); 33int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
34 34
35#else /* defined(CONFIG_COMPAT) */ 35#else /* defined(CONFIG_COMPAT) */
36/* 36/*
@@ -40,24 +40,30 @@ extern int compat_sock_get_timestampns(struct sock *, struct timespec __user *);
40#define compat_mmsghdr mmsghdr 40#define compat_mmsghdr mmsghdr
41#endif /* defined(CONFIG_COMPAT) */ 41#endif /* defined(CONFIG_COMPAT) */
42 42
43extern int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *); 43int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *);
44extern int verify_compat_iovec(struct msghdr *, struct iovec *, struct sockaddr_storage *, int); 44int verify_compat_iovec(struct msghdr *, struct iovec *,
45extern asmlinkage long compat_sys_sendmsg(int,struct compat_msghdr __user *,unsigned int); 45 struct sockaddr_storage *, int);
46extern asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *, 46asmlinkage long compat_sys_sendmsg(int, struct compat_msghdr __user *,
47 unsigned int, unsigned int); 47 unsigned int);
48extern asmlinkage long compat_sys_recvmsg(int,struct compat_msghdr __user *,unsigned int); 48asmlinkage long compat_sys_sendmmsg(int, struct compat_mmsghdr __user *,
49extern asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *, 49 unsigned int, unsigned int);
50 unsigned int, unsigned int, 50asmlinkage long compat_sys_recvmsg(int, struct compat_msghdr __user *,
51 struct compat_timespec __user *); 51 unsigned int);
52extern asmlinkage long compat_sys_getsockopt(int, int, int, char __user *, int __user *); 52asmlinkage long compat_sys_recvmmsg(int, struct compat_mmsghdr __user *,
53extern int put_cmsg_compat(struct msghdr*, int, int, int, void *); 53 unsigned int, unsigned int,
54 54 struct compat_timespec __user *);
55extern int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, unsigned char *, int); 55asmlinkage long compat_sys_getsockopt(int, int, int, char __user *,
56 56 int __user *);
57extern int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int, 57int put_cmsg_compat(struct msghdr*, int, int, int, void *);
58 int (*)(struct sock *, int, int, char __user *, unsigned int)); 58
59extern int compat_mc_getsockopt(struct sock *, int, int, char __user *, 59int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *,
60 int __user *, int (*)(struct sock *, int, int, char __user *, 60 unsigned char *, int);
61 int __user *)); 61
62int compat_mc_setsockopt(struct sock *, int, int, char __user *, unsigned int,
63 int (*)(struct sock *, int, int, char __user *,
64 unsigned int));
65int compat_mc_getsockopt(struct sock *, int, int, char __user *, int __user *,
66 int (*)(struct sock *, int, int, char __user *,
67 int __user *));
62 68
63#endif /* NET_COMPAT_H */ 69#endif /* NET_COMPAT_H */
diff --git a/include/net/dcbevent.h b/include/net/dcbevent.h
index 443626ed4cbc..d2f3041c0dfa 100644
--- a/include/net/dcbevent.h
+++ b/include/net/dcbevent.h
@@ -25,9 +25,9 @@ enum dcbevent_notif_type {
25}; 25};
26 26
27#ifdef CONFIG_DCB 27#ifdef CONFIG_DCB
28extern int register_dcbevent_notifier(struct notifier_block *nb); 28int register_dcbevent_notifier(struct notifier_block *nb);
29extern int unregister_dcbevent_notifier(struct notifier_block *nb); 29int unregister_dcbevent_notifier(struct notifier_block *nb);
30extern int call_dcbevent_notifiers(unsigned long val, void *v); 30int call_dcbevent_notifiers(unsigned long val, void *v);
31#else 31#else
32static inline int 32static inline int
33register_dcbevent_notifier(struct notifier_block *nb) 33register_dcbevent_notifier(struct notifier_block *nb)
diff --git a/include/net/dn.h b/include/net/dn.h
index c88bf4ebd330..ccc15588d108 100644
--- a/include/net/dn.h
+++ b/include/net/dn.h
@@ -199,24 +199,26 @@ static inline void dn_sk_ports_copy(struct flowidn *fld, struct dn_scp *scp)
199 fld->fld_dport = scp->addrrem; 199 fld->fld_dport = scp->addrrem;
200} 200}
201 201
202extern unsigned int dn_mss_from_pmtu(struct net_device *dev, int mtu); 202unsigned int dn_mss_from_pmtu(struct net_device *dev, int mtu);
203 203
204#define DN_MENUVER_ACC 0x01 204#define DN_MENUVER_ACC 0x01
205#define DN_MENUVER_USR 0x02 205#define DN_MENUVER_USR 0x02
206#define DN_MENUVER_PRX 0x04 206#define DN_MENUVER_PRX 0x04
207#define DN_MENUVER_UIC 0x08 207#define DN_MENUVER_UIC 0x08
208 208
209extern struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr); 209struct sock *dn_sklist_find_listener(struct sockaddr_dn *addr);
210extern struct sock *dn_find_by_skb(struct sk_buff *skb); 210struct sock *dn_find_by_skb(struct sk_buff *skb);
211#define DN_ASCBUF_LEN 9 211#define DN_ASCBUF_LEN 9
212extern char *dn_addr2asc(__u16, char *); 212char *dn_addr2asc(__u16, char *);
213extern int dn_destroy_timer(struct sock *sk); 213int dn_destroy_timer(struct sock *sk);
214 214
215extern int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf, unsigned char type); 215int dn_sockaddr2username(struct sockaddr_dn *addr, unsigned char *buf,
216extern int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *addr, unsigned char *type); 216 unsigned char type);
217int dn_username2sockaddr(unsigned char *data, int len, struct sockaddr_dn *addr,
218 unsigned char *type);
217 219
218extern void dn_start_slow_timer(struct sock *sk); 220void dn_start_slow_timer(struct sock *sk);
219extern void dn_stop_slow_timer(struct sock *sk); 221void dn_stop_slow_timer(struct sock *sk);
220 222
221extern __le16 decnet_address; 223extern __le16 decnet_address;
222extern int decnet_debug_level; 224extern int decnet_debug_level;
diff --git a/include/net/dn_dev.h b/include/net/dn_dev.h
index b9e32db03f20..20b5ab06032d 100644
--- a/include/net/dn_dev.h
+++ b/include/net/dn_dev.h
@@ -148,27 +148,27 @@ struct rtnode_hello_message {
148} __packed; 148} __packed;
149 149
150 150
151extern void dn_dev_init(void); 151void dn_dev_init(void);
152extern void dn_dev_cleanup(void); 152void dn_dev_cleanup(void);
153 153
154extern int dn_dev_ioctl(unsigned int cmd, void __user *arg); 154int dn_dev_ioctl(unsigned int cmd, void __user *arg);
155 155
156extern void dn_dev_devices_off(void); 156void dn_dev_devices_off(void);
157extern void dn_dev_devices_on(void); 157void dn_dev_devices_on(void);
158 158
159extern void dn_dev_init_pkt(struct sk_buff *skb); 159void dn_dev_init_pkt(struct sk_buff *skb);
160extern void dn_dev_veri_pkt(struct sk_buff *skb); 160void dn_dev_veri_pkt(struct sk_buff *skb);
161extern void dn_dev_hello(struct sk_buff *skb); 161void dn_dev_hello(struct sk_buff *skb);
162 162
163extern void dn_dev_up(struct net_device *); 163void dn_dev_up(struct net_device *);
164extern void dn_dev_down(struct net_device *); 164void dn_dev_down(struct net_device *);
165 165
166extern int dn_dev_set_default(struct net_device *dev, int force); 166int dn_dev_set_default(struct net_device *dev, int force);
167extern struct net_device *dn_dev_get_default(void); 167struct net_device *dn_dev_get_default(void);
168extern int dn_dev_bind_default(__le16 *addr); 168int dn_dev_bind_default(__le16 *addr);
169 169
170extern int register_dnaddr_notifier(struct notifier_block *nb); 170int register_dnaddr_notifier(struct notifier_block *nb);
171extern int unregister_dnaddr_notifier(struct notifier_block *nb); 171int unregister_dnaddr_notifier(struct notifier_block *nb);
172 172
173static inline int dn_dev_islocal(struct net_device *dev, __le16 addr) 173static inline int dn_dev_islocal(struct net_device *dev, __le16 addr)
174{ 174{
diff --git a/include/net/dn_fib.h b/include/net/dn_fib.h
index 74004af31c48..f2ca135ddcc9 100644
--- a/include/net/dn_fib.h
+++ b/include/net/dn_fib.h
@@ -95,41 +95,38 @@ struct dn_fib_table {
95/* 95/*
96 * dn_fib.c 96 * dn_fib.c
97 */ 97 */
98extern void dn_fib_init(void); 98void dn_fib_init(void);
99extern void dn_fib_cleanup(void); 99void dn_fib_cleanup(void);
100 100
101extern int dn_fib_ioctl(struct socket *sock, unsigned int cmd, 101int dn_fib_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
102 unsigned long arg); 102struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r,
103extern struct dn_fib_info *dn_fib_create_info(const struct rtmsg *r, 103 struct nlattr *attrs[],
104 struct nlattr *attrs[], 104 const struct nlmsghdr *nlh, int *errp);
105 const struct nlmsghdr *nlh, int *errp); 105int dn_fib_semantic_match(int type, struct dn_fib_info *fi,
106extern int dn_fib_semantic_match(int type, struct dn_fib_info *fi, 106 const struct flowidn *fld, struct dn_fib_res *res);
107 const struct flowidn *fld, 107void dn_fib_release_info(struct dn_fib_info *fi);
108 struct dn_fib_res *res); 108void dn_fib_flush(void);
109extern void dn_fib_release_info(struct dn_fib_info *fi); 109void dn_fib_select_multipath(const struct flowidn *fld, struct dn_fib_res *res);
110extern void dn_fib_flush(void);
111extern void dn_fib_select_multipath(const struct flowidn *fld,
112 struct dn_fib_res *res);
113 110
114/* 111/*
115 * dn_tables.c 112 * dn_tables.c
116 */ 113 */
117extern struct dn_fib_table *dn_fib_get_table(u32 n, int creat); 114struct dn_fib_table *dn_fib_get_table(u32 n, int creat);
118extern struct dn_fib_table *dn_fib_empty_table(void); 115struct dn_fib_table *dn_fib_empty_table(void);
119extern void dn_fib_table_init(void); 116void dn_fib_table_init(void);
120extern void dn_fib_table_cleanup(void); 117void dn_fib_table_cleanup(void);
121 118
122/* 119/*
123 * dn_rules.c 120 * dn_rules.c
124 */ 121 */
125extern void dn_fib_rules_init(void); 122void dn_fib_rules_init(void);
126extern void dn_fib_rules_cleanup(void); 123void dn_fib_rules_cleanup(void);
127extern unsigned int dnet_addr_type(__le16 addr); 124unsigned int dnet_addr_type(__le16 addr);
128extern int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res); 125int dn_fib_lookup(struct flowidn *fld, struct dn_fib_res *res);
129 126
130extern int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb); 127int dn_fib_dump(struct sk_buff *skb, struct netlink_callback *cb);
131 128
132extern void dn_fib_free_info(struct dn_fib_info *fi); 129void dn_fib_free_info(struct dn_fib_info *fi);
133 130
134static inline void dn_fib_info_put(struct dn_fib_info *fi) 131static inline void dn_fib_info_put(struct dn_fib_info *fi)
135{ 132{
diff --git a/include/net/dn_neigh.h b/include/net/dn_neigh.h
index 4cb4ae7fb81f..fac4e3f4a6d3 100644
--- a/include/net/dn_neigh.h
+++ b/include/net/dn_neigh.h
@@ -16,12 +16,12 @@ struct dn_neigh {
16 __u8 priority; 16 __u8 priority;
17}; 17};
18 18
19extern void dn_neigh_init(void); 19void dn_neigh_init(void);
20extern void dn_neigh_cleanup(void); 20void dn_neigh_cleanup(void);
21extern int dn_neigh_router_hello(struct sk_buff *skb); 21int dn_neigh_router_hello(struct sk_buff *skb);
22extern int dn_neigh_endnode_hello(struct sk_buff *skb); 22int dn_neigh_endnode_hello(struct sk_buff *skb);
23extern void dn_neigh_pointopoint_hello(struct sk_buff *skb); 23void dn_neigh_pointopoint_hello(struct sk_buff *skb);
24extern int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n); 24int dn_neigh_elist(struct net_device *dev, unsigned char *ptr, int n);
25 25
26extern struct neigh_table dn_neigh_table; 26extern struct neigh_table dn_neigh_table;
27 27
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h
index e43a2893f132..3a3e33d18456 100644
--- a/include/net/dn_nsp.h
+++ b/include/net/dn_nsp.h
@@ -15,29 +15,32 @@
15*******************************************************************************/ 15*******************************************************************************/
16/* dn_nsp.c functions prototyping */ 16/* dn_nsp.c functions prototyping */
17 17
18extern void dn_nsp_send_data_ack(struct sock *sk); 18void dn_nsp_send_data_ack(struct sock *sk);
19extern void dn_nsp_send_oth_ack(struct sock *sk); 19void dn_nsp_send_oth_ack(struct sock *sk);
20extern void dn_nsp_delayed_ack(struct sock *sk); 20void dn_nsp_delayed_ack(struct sock *sk);
21extern void dn_send_conn_ack(struct sock *sk); 21void dn_send_conn_ack(struct sock *sk);
22extern void dn_send_conn_conf(struct sock *sk, gfp_t gfp); 22void dn_send_conn_conf(struct sock *sk, gfp_t gfp);
23extern void dn_nsp_send_disc(struct sock *sk, unsigned char type, 23void dn_nsp_send_disc(struct sock *sk, unsigned char type,
24 unsigned short reason, gfp_t gfp); 24 unsigned short reason, gfp_t gfp);
25extern void dn_nsp_return_disc(struct sk_buff *skb, unsigned char type, 25void dn_nsp_return_disc(struct sk_buff *skb, unsigned char type,
26 unsigned short reason); 26 unsigned short reason);
27extern void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval); 27void dn_nsp_send_link(struct sock *sk, unsigned char lsflags, char fcval);
28extern void dn_nsp_send_conninit(struct sock *sk, unsigned char flags); 28void dn_nsp_send_conninit(struct sock *sk, unsigned char flags);
29 29
30extern void dn_nsp_output(struct sock *sk); 30void dn_nsp_output(struct sock *sk);
31extern int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb, struct sk_buff_head *q, unsigned short acknum); 31int dn_nsp_check_xmit_queue(struct sock *sk, struct sk_buff *skb,
32extern void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, gfp_t gfp, int oob); 32 struct sk_buff_head *q, unsigned short acknum);
33extern unsigned long dn_nsp_persist(struct sock *sk); 33void dn_nsp_queue_xmit(struct sock *sk, struct sk_buff *skb, gfp_t gfp,
34extern int dn_nsp_xmit_timeout(struct sock *sk); 34 int oob);
35 35unsigned long dn_nsp_persist(struct sock *sk);
36extern int dn_nsp_rx(struct sk_buff *); 36int dn_nsp_xmit_timeout(struct sock *sk);
37extern int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb); 37
38 38int dn_nsp_rx(struct sk_buff *);
39extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 39int dn_nsp_backlog_rcv(struct sock *sk, struct sk_buff *skb);
40extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int noblock, long timeo, int *err); 40
41struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
42struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int noblock,
43 long timeo, int *err);
41 44
42#define NSP_REASON_OK 0 /* No error */ 45#define NSP_REASON_OK 0 /* No error */
43#define NSP_REASON_NR 1 /* No resources */ 46#define NSP_REASON_NR 1 /* No resources */
diff --git a/include/net/dn_route.h b/include/net/dn_route.h
index 2e9d317c82dc..b409ad6b8d7a 100644
--- a/include/net/dn_route.h
+++ b/include/net/dn_route.h
@@ -15,10 +15,11 @@
15 GNU General Public License for more details. 15 GNU General Public License for more details.
16*******************************************************************************/ 16*******************************************************************************/
17 17
18extern struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri); 18struct sk_buff *dn_alloc_skb(struct sock *sk, int size, gfp_t pri);
19extern int dn_route_output_sock(struct dst_entry __rcu **pprt, struct flowidn *, struct sock *sk, int flags); 19int dn_route_output_sock(struct dst_entry __rcu **pprt, struct flowidn *,
20extern int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb); 20 struct sock *sk, int flags);
21extern void dn_rt_cache_flush(int delay); 21int dn_cache_dump(struct sk_buff *skb, struct netlink_callback *cb);
22void dn_rt_cache_flush(int delay);
22 23
23/* Masks for flags field */ 24/* Masks for flags field */
24#define DN_RT_F_PID 0x07 /* Mask for packet type */ 25#define DN_RT_F_PID 0x07 /* Mask for packet type */
@@ -92,8 +93,8 @@ static inline bool dn_is_output_route(struct dn_route *rt)
92 return rt->fld.flowidn_iif == 0; 93 return rt->fld.flowidn_iif == 0;
93} 94}
94 95
95extern void dn_route_init(void); 96void dn_route_init(void);
96extern void dn_route_cleanup(void); 97void dn_route_cleanup(void);
97 98
98#include <net/sock.h> 99#include <net/sock.h>
99#include <linux/if_arp.h> 100#include <linux/if_arp.h>
diff --git a/include/net/dst.h b/include/net/dst.h
index 3c4c944096c9..44995c13e941 100644
--- a/include/net/dst.h
+++ b/include/net/dst.h
@@ -106,7 +106,7 @@ struct dst_entry {
106 }; 106 };
107}; 107};
108 108
109extern u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old); 109u32 *dst_cow_metrics_generic(struct dst_entry *dst, unsigned long old);
110extern const u32 dst_default_metrics[]; 110extern const u32 dst_default_metrics[];
111 111
112#define DST_METRICS_READ_ONLY 0x1UL 112#define DST_METRICS_READ_ONLY 0x1UL
@@ -119,7 +119,7 @@ static inline bool dst_metrics_read_only(const struct dst_entry *dst)
119 return dst->_metrics & DST_METRICS_READ_ONLY; 119 return dst->_metrics & DST_METRICS_READ_ONLY;
120} 120}
121 121
122extern void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old); 122void __dst_destroy_metrics_generic(struct dst_entry *dst, unsigned long old);
123 123
124static inline void dst_destroy_metrics_generic(struct dst_entry *dst) 124static inline void dst_destroy_metrics_generic(struct dst_entry *dst)
125{ 125{
@@ -262,7 +262,7 @@ static inline struct dst_entry *dst_clone(struct dst_entry *dst)
262 return dst; 262 return dst;
263} 263}
264 264
265extern void dst_release(struct dst_entry *dst); 265void dst_release(struct dst_entry *dst);
266 266
267static inline void refdst_drop(unsigned long refdst) 267static inline void refdst_drop(unsigned long refdst)
268{ 268{
@@ -362,12 +362,11 @@ static inline struct dst_entry *skb_dst_pop(struct sk_buff *skb)
362 return child; 362 return child;
363} 363}
364 364
365extern int dst_discard(struct sk_buff *skb); 365int dst_discard(struct sk_buff *skb);
366extern void *dst_alloc(struct dst_ops *ops, struct net_device *dev, 366void *dst_alloc(struct dst_ops *ops, struct net_device *dev, int initial_ref,
367 int initial_ref, int initial_obsolete, 367 int initial_obsolete, unsigned short flags);
368 unsigned short flags); 368void __dst_free(struct dst_entry *dst);
369extern void __dst_free(struct dst_entry *dst); 369struct dst_entry *dst_destroy(struct dst_entry *dst);
370extern struct dst_entry *dst_destroy(struct dst_entry *dst);
371 370
372static inline void dst_free(struct dst_entry *dst) 371static inline void dst_free(struct dst_entry *dst)
373{ 372{
@@ -463,7 +462,7 @@ static inline struct dst_entry *dst_check(struct dst_entry *dst, u32 cookie)
463 return dst; 462 return dst;
464} 463}
465 464
466extern void dst_init(void); 465void dst_init(void);
467 466
468/* Flags for xfrm_lookup flags argument. */ 467/* Flags for xfrm_lookup flags argument. */
469enum { 468enum {
@@ -486,9 +485,9 @@ static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
486} 485}
487 486
488#else 487#else
489extern struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig, 488struct dst_entry *xfrm_lookup(struct net *net, struct dst_entry *dst_orig,
490 const struct flowi *fl, struct sock *sk, 489 const struct flowi *fl, struct sock *sk,
491 int flags); 490 int flags);
492 491
493/* skb attached with this dst needs transformation if dst->xfrm is valid */ 492/* skb attached with this dst needs transformation if dst->xfrm is valid */
494static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst) 493static inline struct xfrm_state *dst_xfrm(const struct dst_entry *dst)
diff --git a/include/net/esp.h b/include/net/esp.h
index d58451331dbd..a43be85aedc4 100644
--- a/include/net/esp.h
+++ b/include/net/esp.h
@@ -3,18 +3,6 @@
3 3
4#include <linux/skbuff.h> 4#include <linux/skbuff.h>
5 5
6struct crypto_aead;
7
8struct esp_data {
9 /* 0..255 */
10 int padlen;
11
12 /* Confidentiality & Integrity */
13 struct crypto_aead *aead;
14};
15
16extern void *pskb_put(struct sk_buff *skb, struct sk_buff *tail, int len);
17
18struct ip_esp_hdr; 6struct ip_esp_hdr;
19 7
20static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb) 8static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb)
diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h
index 4b2b557fb0e8..e584de16e4c3 100644
--- a/include/net/fib_rules.h
+++ b/include/net/fib_rules.h
@@ -115,14 +115,13 @@ static inline u32 frh_get_table(struct fib_rule_hdr *frh, struct nlattr **nla)
115 return frh->table; 115 return frh->table;
116} 116}
117 117
118extern struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *, struct net *); 118struct fib_rules_ops *fib_rules_register(const struct fib_rules_ops *,
119extern void fib_rules_unregister(struct fib_rules_ops *); 119 struct net *);
120void fib_rules_unregister(struct fib_rules_ops *);
120 121
121extern int fib_rules_lookup(struct fib_rules_ops *, 122int fib_rules_lookup(struct fib_rules_ops *, struct flowi *, int flags,
122 struct flowi *, int flags, 123 struct fib_lookup_arg *);
123 struct fib_lookup_arg *); 124int fib_default_rule_add(struct fib_rules_ops *, u32 pref, u32 table,
124extern int fib_default_rule_add(struct fib_rules_ops *, 125 u32 flags);
125 u32 pref, u32 table, 126u32 fib_default_rule_pref(struct fib_rules_ops *ops);
126 u32 flags);
127extern u32 fib_default_rule_pref(struct fib_rules_ops *ops);
128#endif 127#endif
diff --git a/include/net/flow.h b/include/net/flow.h
index 628e11b98c58..65ce471d2ab5 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -215,12 +215,13 @@ typedef struct flow_cache_object *(*flow_resolve_t)(
215 struct net *net, const struct flowi *key, u16 family, 215 struct net *net, const struct flowi *key, u16 family,
216 u8 dir, struct flow_cache_object *oldobj, void *ctx); 216 u8 dir, struct flow_cache_object *oldobj, void *ctx);
217 217
218extern struct flow_cache_object *flow_cache_lookup( 218struct flow_cache_object *flow_cache_lookup(struct net *net,
219 struct net *net, const struct flowi *key, u16 family, 219 const struct flowi *key, u16 family,
220 u8 dir, flow_resolve_t resolver, void *ctx); 220 u8 dir, flow_resolve_t resolver,
221 void *ctx);
221 222
222extern void flow_cache_flush(void); 223void flow_cache_flush(void);
223extern void flow_cache_flush_deferred(void); 224void flow_cache_flush_deferred(void);
224extern atomic_t flow_cache_genid; 225extern atomic_t flow_cache_genid;
225 226
226#endif 227#endif
diff --git a/include/net/flow_keys.h b/include/net/flow_keys.h
index bb8271d487b7..7e64bd8bbda9 100644
--- a/include/net/flow_keys.h
+++ b/include/net/flow_keys.h
@@ -13,5 +13,6 @@ struct flow_keys {
13 u8 ip_proto; 13 u8 ip_proto;
14}; 14};
15 15
16extern bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow); 16bool skb_flow_dissect(const struct sk_buff *skb, struct flow_keys *flow);
17__be32 skb_flow_get_ports(const struct sk_buff *skb, int thoff, u8 ip_proto);
17#endif 18#endif
diff --git a/include/net/garp.h b/include/net/garp.h
index 834d8add9e5f..abf33bbd2e6a 100644
--- a/include/net/garp.h
+++ b/include/net/garp.h
@@ -112,19 +112,18 @@ struct garp_port {
112 struct rcu_head rcu; 112 struct rcu_head rcu;
113}; 113};
114 114
115extern int garp_register_application(struct garp_application *app); 115int garp_register_application(struct garp_application *app);
116extern void garp_unregister_application(struct garp_application *app); 116void garp_unregister_application(struct garp_application *app);
117 117
118extern int garp_init_applicant(struct net_device *dev, 118int garp_init_applicant(struct net_device *dev, struct garp_application *app);
119 struct garp_application *app); 119void garp_uninit_applicant(struct net_device *dev,
120extern void garp_uninit_applicant(struct net_device *dev, 120 struct garp_application *app);
121 struct garp_application *app); 121
122 122int garp_request_join(const struct net_device *dev,
123extern int garp_request_join(const struct net_device *dev, 123 const struct garp_application *app, const void *data,
124 const struct garp_application *app, 124 u8 len, u8 type);
125 const void *data, u8 len, u8 type); 125void garp_request_leave(const struct net_device *dev,
126extern void garp_request_leave(const struct net_device *dev, 126 const struct garp_application *app,
127 const struct garp_application *app, 127 const void *data, u8 len, u8 type);
128 const void *data, u8 len, u8 type);
129 128
130#endif /* _NET_GARP_H */ 129#endif /* _NET_GARP_H */
diff --git a/include/net/gen_stats.h b/include/net/gen_stats.h
index cf8439ba4d11..ea4271dceff0 100644
--- a/include/net/gen_stats.h
+++ b/include/net/gen_stats.h
@@ -19,32 +19,31 @@ struct gnet_dump {
19 struct tc_stats tc_stats; 19 struct tc_stats tc_stats;
20}; 20};
21 21
22extern int gnet_stats_start_copy(struct sk_buff *skb, int type, 22int gnet_stats_start_copy(struct sk_buff *skb, int type, spinlock_t *lock,
23 struct gnet_dump *d);
24
25int gnet_stats_start_copy_compat(struct sk_buff *skb, int type,
26 int tc_stats_type, int xstats_type,
23 spinlock_t *lock, struct gnet_dump *d); 27 spinlock_t *lock, struct gnet_dump *d);
24 28
25extern int gnet_stats_start_copy_compat(struct sk_buff *skb, int type, 29int gnet_stats_copy_basic(struct gnet_dump *d,
26 int tc_stats_type,int xstats_type, 30 struct gnet_stats_basic_packed *b);
27 spinlock_t *lock, struct gnet_dump *d); 31int gnet_stats_copy_rate_est(struct gnet_dump *d,
28 32 const struct gnet_stats_basic_packed *b,
29extern int gnet_stats_copy_basic(struct gnet_dump *d, 33 struct gnet_stats_rate_est64 *r);
30 struct gnet_stats_basic_packed *b); 34int gnet_stats_copy_queue(struct gnet_dump *d, struct gnet_stats_queue *q);
31extern int gnet_stats_copy_rate_est(struct gnet_dump *d, 35int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len);
32 const struct gnet_stats_basic_packed *b, 36
33 struct gnet_stats_rate_est64 *r); 37int gnet_stats_finish_copy(struct gnet_dump *d);
34extern int gnet_stats_copy_queue(struct gnet_dump *d, 38
35 struct gnet_stats_queue *q); 39int gen_new_estimator(struct gnet_stats_basic_packed *bstats,
36extern int gnet_stats_copy_app(struct gnet_dump *d, void *st, int len); 40 struct gnet_stats_rate_est64 *rate_est,
37 41 spinlock_t *stats_lock, struct nlattr *opt);
38extern int gnet_stats_finish_copy(struct gnet_dump *d); 42void gen_kill_estimator(struct gnet_stats_basic_packed *bstats,
39 43 struct gnet_stats_rate_est64 *rate_est);
40extern int gen_new_estimator(struct gnet_stats_basic_packed *bstats, 44int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
41 struct gnet_stats_rate_est64 *rate_est, 45 struct gnet_stats_rate_est64 *rate_est,
42 spinlock_t *stats_lock, struct nlattr *opt); 46 spinlock_t *stats_lock, struct nlattr *opt);
43extern void gen_kill_estimator(struct gnet_stats_basic_packed *bstats, 47bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
44 struct gnet_stats_rate_est64 *rate_est); 48 const struct gnet_stats_rate_est64 *rate_est);
45extern int gen_replace_estimator(struct gnet_stats_basic_packed *bstats,
46 struct gnet_stats_rate_est64 *rate_est,
47 spinlock_t *stats_lock, struct nlattr *opt);
48extern bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats,
49 const struct gnet_stats_rate_est64 *rate_est);
50#endif 49#endif
diff --git a/include/net/genetlink.h b/include/net/genetlink.h
index 8e0b6c856a13..9b787b62cf16 100644
--- a/include/net/genetlink.h
+++ b/include/net/genetlink.h
@@ -122,7 +122,7 @@ struct genl_ops {
122 struct list_head ops_list; 122 struct list_head ops_list;
123}; 123};
124 124
125extern int __genl_register_family(struct genl_family *family); 125int __genl_register_family(struct genl_family *family);
126 126
127static inline int genl_register_family(struct genl_family *family) 127static inline int genl_register_family(struct genl_family *family)
128{ 128{
@@ -130,8 +130,8 @@ static inline int genl_register_family(struct genl_family *family)
130 return __genl_register_family(family); 130 return __genl_register_family(family);
131} 131}
132 132
133extern int __genl_register_family_with_ops(struct genl_family *family, 133int __genl_register_family_with_ops(struct genl_family *family,
134 struct genl_ops *ops, size_t n_ops); 134 struct genl_ops *ops, size_t n_ops);
135 135
136static inline int genl_register_family_with_ops(struct genl_family *family, 136static inline int genl_register_family_with_ops(struct genl_family *family,
137 struct genl_ops *ops, size_t n_ops) 137 struct genl_ops *ops, size_t n_ops)
@@ -140,18 +140,18 @@ static inline int genl_register_family_with_ops(struct genl_family *family,
140 return __genl_register_family_with_ops(family, ops, n_ops); 140 return __genl_register_family_with_ops(family, ops, n_ops);
141} 141}
142 142
143extern int genl_unregister_family(struct genl_family *family); 143int genl_unregister_family(struct genl_family *family);
144extern int genl_register_ops(struct genl_family *, struct genl_ops *ops); 144int genl_register_ops(struct genl_family *, struct genl_ops *ops);
145extern int genl_unregister_ops(struct genl_family *, struct genl_ops *ops); 145int genl_unregister_ops(struct genl_family *, struct genl_ops *ops);
146extern int genl_register_mc_group(struct genl_family *family, 146int genl_register_mc_group(struct genl_family *family,
147 struct genl_multicast_group *grp); 147 struct genl_multicast_group *grp);
148extern void genl_unregister_mc_group(struct genl_family *family, 148void genl_unregister_mc_group(struct genl_family *family,
149 struct genl_multicast_group *grp); 149 struct genl_multicast_group *grp);
150extern void genl_notify(struct sk_buff *skb, struct net *net, u32 portid, 150void genl_notify(struct sk_buff *skb, struct net *net, u32 portid,
151 u32 group, struct nlmsghdr *nlh, gfp_t flags); 151 u32 group, struct nlmsghdr *nlh, gfp_t flags);
152 152
153void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq, 153void *genlmsg_put(struct sk_buff *skb, u32 portid, u32 seq,
154 struct genl_family *family, int flags, u8 cmd); 154 struct genl_family *family, int flags, u8 cmd);
155 155
156/** 156/**
157 * genlmsg_nlhdr - Obtain netlink header from user specified header 157 * genlmsg_nlhdr - Obtain netlink header from user specified header
diff --git a/include/net/gre.h b/include/net/gre.h
index 57e4afdf7879..dcd9ae3270d3 100644
--- a/include/net/gre.h
+++ b/include/net/gre.h
@@ -38,7 +38,13 @@ void gre_offload_exit(void);
38 38
39void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi, 39void gre_build_header(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
40 int hdr_len); 40 int hdr_len);
41struct sk_buff *gre_handle_offloads(struct sk_buff *skb, bool gre_csum); 41
42static inline struct sk_buff *gre_handle_offloads(struct sk_buff *skb,
43 bool gre_csum)
44{
45 return iptunnel_handle_offloads(skb, gre_csum, SKB_GSO_GRE);
46}
47
42 48
43static inline int ip_gre_calc_hlen(__be16 o_flags) 49static inline int ip_gre_calc_hlen(__be16 o_flags)
44{ 50{
diff --git a/include/net/icmp.h b/include/net/icmp.h
index 081439fd070e..970028e13382 100644
--- a/include/net/icmp.h
+++ b/include/net/icmp.h
@@ -39,10 +39,10 @@ struct net_proto_family;
39struct sk_buff; 39struct sk_buff;
40struct net; 40struct net;
41 41
42extern void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info); 42void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info);
43extern int icmp_rcv(struct sk_buff *skb); 43int icmp_rcv(struct sk_buff *skb);
44extern void icmp_err(struct sk_buff *, u32 info); 44void icmp_err(struct sk_buff *skb, u32 info);
45extern int icmp_init(void); 45int icmp_init(void);
46extern void icmp_out_count(struct net *net, unsigned char type); 46void icmp_out_count(struct net *net, unsigned char type);
47 47
48#endif /* _ICMP_H */ 48#endif /* _ICMP_H */
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 02ef7727bb55..76d54270f2e2 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -66,11 +66,10 @@ struct inet6_ifaddr {
66 struct hlist_node addr_lst; 66 struct hlist_node addr_lst;
67 struct list_head if_list; 67 struct list_head if_list;
68 68
69#ifdef CONFIG_IPV6_PRIVACY
70 struct list_head tmp_list; 69 struct list_head tmp_list;
71 struct inet6_ifaddr *ifpub; 70 struct inet6_ifaddr *ifpub;
72 int regen_count; 71 int regen_count;
73#endif 72
74 bool tokenized; 73 bool tokenized;
75 74
76 struct rcu_head rcu; 75 struct rcu_head rcu;
@@ -192,11 +191,9 @@ struct inet6_dev {
192 __u32 if_flags; 191 __u32 if_flags;
193 int dead; 192 int dead;
194 193
195#ifdef CONFIG_IPV6_PRIVACY
196 u8 rndid[8]; 194 u8 rndid[8];
197 struct timer_list regen_timer; 195 struct timer_list regen_timer;
198 struct list_head tempaddr_list; 196 struct list_head tempaddr_list;
199#endif
200 197
201 struct in6_addr token; 198 struct in6_addr token;
202 199
diff --git a/include/net/inet6_connection_sock.h b/include/net/inet6_connection_sock.h
index 04642c920431..f981ba7adeed 100644
--- a/include/net/inet6_connection_sock.h
+++ b/include/net/inet6_connection_sock.h
@@ -22,27 +22,25 @@ struct sk_buff;
22struct sock; 22struct sock;
23struct sockaddr; 23struct sockaddr;
24 24
25extern int inet6_csk_bind_conflict(const struct sock *sk, 25int inet6_csk_bind_conflict(const struct sock *sk,
26 const struct inet_bind_bucket *tb, bool relax); 26 const struct inet_bind_bucket *tb, bool relax);
27 27
28extern struct dst_entry* inet6_csk_route_req(struct sock *sk, 28struct dst_entry *inet6_csk_route_req(struct sock *sk, struct flowi6 *fl6,
29 struct flowi6 *fl6, 29 const struct request_sock *req);
30 const struct request_sock *req);
31 30
32extern struct request_sock *inet6_csk_search_req(const struct sock *sk, 31struct request_sock *inet6_csk_search_req(const struct sock *sk,
33 struct request_sock ***prevp, 32 struct request_sock ***prevp,
34 const __be16 rport, 33 const __be16 rport,
35 const struct in6_addr *raddr, 34 const struct in6_addr *raddr,
36 const struct in6_addr *laddr, 35 const struct in6_addr *laddr,
37 const int iif); 36 const int iif);
38 37
39extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk, 38void inet6_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,
40 struct request_sock *req, 39 const unsigned long timeout);
41 const unsigned long timeout);
42 40
43extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 41void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
44 42
45extern int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl); 43int inet6_csk_xmit(struct sk_buff *skb, struct flowi *fl);
46 44
47extern struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu); 45struct dst_entry *inet6_csk_update_pmtu(struct sock *sk, u32 mtu);
48#endif /* _INET6_CONNECTION_SOCK_H */ 46#endif /* _INET6_CONNECTION_SOCK_H */
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h
index fd4ee016ba5c..ae0613544308 100644
--- a/include/net/inet6_hashtables.h
+++ b/include/net/inet6_hashtables.h
@@ -28,32 +28,17 @@
28 28
29struct inet_hashinfo; 29struct inet_hashinfo;
30 30
31static inline unsigned int inet6_ehashfn(struct net *net, 31static inline unsigned int __inet6_ehashfn(const u32 lhash,
32 const struct in6_addr *laddr, const u16 lport, 32 const u16 lport,
33 const struct in6_addr *faddr, const __be16 fport) 33 const u32 fhash,
34 const __be16 fport,
35 const u32 initval)
34{ 36{
35 u32 ports = (((u32)lport) << 16) | (__force u32)fport; 37 const u32 ports = (((u32)lport) << 16) | (__force u32)fport;
36 38 return jhash_3words(lhash, fhash, ports, initval);
37 return jhash_3words((__force u32)laddr->s6_addr32[3],
38 ipv6_addr_jhash(faddr),
39 ports,
40 inet_ehash_secret + net_hash_mix(net));
41}
42
43static inline int inet6_sk_ehashfn(const struct sock *sk)
44{
45 const struct inet_sock *inet = inet_sk(sk);
46 const struct ipv6_pinfo *np = inet6_sk(sk);
47 const struct in6_addr *laddr = &np->rcv_saddr;
48 const struct in6_addr *faddr = &np->daddr;
49 const __u16 lport = inet->inet_num;
50 const __be16 fport = inet->inet_dport;
51 struct net *net = sock_net(sk);
52
53 return inet6_ehashfn(net, laddr, lport, faddr, fport);
54} 39}
55 40
56extern int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp); 41int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp);
57 42
58/* 43/*
59 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so 44 * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so
@@ -61,21 +46,19 @@ extern int __inet6_hash(struct sock *sk, struct inet_timewait_sock *twp);
61 * 46 *
62 * The sockhash lock must be held as a reader here. 47 * The sockhash lock must be held as a reader here.
63 */ 48 */
64extern struct sock *__inet6_lookup_established(struct net *net, 49struct sock *__inet6_lookup_established(struct net *net,
65 struct inet_hashinfo *hashinfo, 50 struct inet_hashinfo *hashinfo,
66 const struct in6_addr *saddr, 51 const struct in6_addr *saddr,
67 const __be16 sport, 52 const __be16 sport,
68 const struct in6_addr *daddr, 53 const struct in6_addr *daddr,
69 const u16 hnum, 54 const u16 hnum, const int dif);
70 const int dif); 55
71 56struct sock *inet6_lookup_listener(struct net *net,
72extern struct sock *inet6_lookup_listener(struct net *net, 57 struct inet_hashinfo *hashinfo,
73 struct inet_hashinfo *hashinfo, 58 const struct in6_addr *saddr,
74 const struct in6_addr *saddr, 59 const __be16 sport,
75 const __be16 sport, 60 const struct in6_addr *daddr,
76 const struct in6_addr *daddr, 61 const unsigned short hnum, const int dif);
77 const unsigned short hnum,
78 const int dif);
79 62
80static inline struct sock *__inet6_lookup(struct net *net, 63static inline struct sock *__inet6_lookup(struct net *net,
81 struct inet_hashinfo *hashinfo, 64 struct inet_hashinfo *hashinfo,
@@ -110,9 +93,9 @@ static inline struct sock *__inet6_lookup_skb(struct inet_hashinfo *hashinfo,
110 inet6_iif(skb)); 93 inet6_iif(skb));
111} 94}
112 95
113extern struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo, 96struct sock *inet6_lookup(struct net *net, struct inet_hashinfo *hashinfo,
114 const struct in6_addr *saddr, const __be16 sport, 97 const struct in6_addr *saddr, const __be16 sport,
115 const struct in6_addr *daddr, const __be16 dport, 98 const struct in6_addr *daddr, const __be16 dport,
116 const int dif); 99 const int dif);
117#endif /* IS_ENABLED(CONFIG_IPV6) */ 100#endif /* IS_ENABLED(CONFIG_IPV6) */
118#endif /* _INET6_HASHTABLES_H */ 101#endif /* _INET6_HASHTABLES_H */
diff --git a/include/net/inet_common.h b/include/net/inet_common.h
index 234008782c8c..fe7994c48b75 100644
--- a/include/net/inet_common.h
+++ b/include/net/inet_common.h
@@ -13,30 +13,30 @@ struct sock;
13struct sockaddr; 13struct sockaddr;
14struct socket; 14struct socket;
15 15
16extern int inet_release(struct socket *sock); 16int inet_release(struct socket *sock);
17extern int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, 17int inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
18 int addr_len, int flags); 18 int addr_len, int flags);
19extern int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr, 19int __inet_stream_connect(struct socket *sock, struct sockaddr *uaddr,
20 int addr_len, int flags); 20 int addr_len, int flags);
21extern int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr, 21int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr,
22 int addr_len, int flags); 22 int addr_len, int flags);
23extern int inet_accept(struct socket *sock, struct socket *newsock, int flags); 23int inet_accept(struct socket *sock, struct socket *newsock, int flags);
24extern int inet_sendmsg(struct kiocb *iocb, struct socket *sock, 24int inet_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
25 struct msghdr *msg, size_t size); 25 size_t size);
26extern ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset, 26ssize_t inet_sendpage(struct socket *sock, struct page *page, int offset,
27 size_t size, int flags); 27 size_t size, int flags);
28extern int inet_recvmsg(struct kiocb *iocb, struct socket *sock, 28int inet_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
29 struct msghdr *msg, size_t size, int flags); 29 size_t size, int flags);
30extern int inet_shutdown(struct socket *sock, int how); 30int inet_shutdown(struct socket *sock, int how);
31extern int inet_listen(struct socket *sock, int backlog); 31int inet_listen(struct socket *sock, int backlog);
32extern void inet_sock_destruct(struct sock *sk); 32void inet_sock_destruct(struct sock *sk);
33extern int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len); 33int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
34extern int inet_getname(struct socket *sock, struct sockaddr *uaddr, 34int inet_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len,
35 int *uaddr_len, int peer); 35 int peer);
36extern int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); 36int inet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
37extern int inet_ctl_sock_create(struct sock **sk, unsigned short family, 37int inet_ctl_sock_create(struct sock **sk, unsigned short family,
38 unsigned short type, unsigned char protocol, 38 unsigned short type, unsigned char protocol,
39 struct net *net); 39 struct net *net);
40 40
41static inline void inet_ctl_sock_destroy(struct sock *sk) 41static inline void inet_ctl_sock_destroy(struct sock *sk)
42{ 42{
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h
index de2c78529afa..c55aeed41ace 100644
--- a/include/net/inet_connection_sock.h
+++ b/include/net/inet_connection_sock.h
@@ -146,9 +146,9 @@ static inline void *inet_csk_ca(const struct sock *sk)
146 return (void *)inet_csk(sk)->icsk_ca_priv; 146 return (void *)inet_csk(sk)->icsk_ca_priv;
147} 147}
148 148
149extern struct sock *inet_csk_clone_lock(const struct sock *sk, 149struct sock *inet_csk_clone_lock(const struct sock *sk,
150 const struct request_sock *req, 150 const struct request_sock *req,
151 const gfp_t priority); 151 const gfp_t priority);
152 152
153enum inet_csk_ack_state_t { 153enum inet_csk_ack_state_t {
154 ICSK_ACK_SCHED = 1, 154 ICSK_ACK_SCHED = 1,
@@ -157,11 +157,11 @@ enum inet_csk_ack_state_t {
157 ICSK_ACK_PUSHED2 = 8 157 ICSK_ACK_PUSHED2 = 8
158}; 158};
159 159
160extern void inet_csk_init_xmit_timers(struct sock *sk, 160void inet_csk_init_xmit_timers(struct sock *sk,
161 void (*retransmit_handler)(unsigned long), 161 void (*retransmit_handler)(unsigned long),
162 void (*delack_handler)(unsigned long), 162 void (*delack_handler)(unsigned long),
163 void (*keepalive_handler)(unsigned long)); 163 void (*keepalive_handler)(unsigned long));
164extern void inet_csk_clear_xmit_timers(struct sock *sk); 164void inet_csk_clear_xmit_timers(struct sock *sk);
165 165
166static inline void inet_csk_schedule_ack(struct sock *sk) 166static inline void inet_csk_schedule_ack(struct sock *sk)
167{ 167{
@@ -178,8 +178,8 @@ static inline void inet_csk_delack_init(struct sock *sk)
178 memset(&inet_csk(sk)->icsk_ack, 0, sizeof(inet_csk(sk)->icsk_ack)); 178 memset(&inet_csk(sk)->icsk_ack, 0, sizeof(inet_csk(sk)->icsk_ack));
179} 179}
180 180
181extern void inet_csk_delete_keepalive_timer(struct sock *sk); 181void inet_csk_delete_keepalive_timer(struct sock *sk);
182extern void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long timeout); 182void inet_csk_reset_keepalive_timer(struct sock *sk, unsigned long timeout);
183 183
184#ifdef INET_CSK_DEBUG 184#ifdef INET_CSK_DEBUG
185extern const char inet_csk_timer_bug_msg[]; 185extern const char inet_csk_timer_bug_msg[];
@@ -241,23 +241,21 @@ static inline void inet_csk_reset_xmit_timer(struct sock *sk, const int what,
241#endif 241#endif
242} 242}
243 243
244extern struct sock *inet_csk_accept(struct sock *sk, int flags, int *err); 244struct sock *inet_csk_accept(struct sock *sk, int flags, int *err);
245 245
246extern struct request_sock *inet_csk_search_req(const struct sock *sk, 246struct request_sock *inet_csk_search_req(const struct sock *sk,
247 struct request_sock ***prevp, 247 struct request_sock ***prevp,
248 const __be16 rport, 248 const __be16 rport,
249 const __be32 raddr, 249 const __be32 raddr,
250 const __be32 laddr); 250 const __be32 laddr);
251extern int inet_csk_bind_conflict(const struct sock *sk, 251int inet_csk_bind_conflict(const struct sock *sk,
252 const struct inet_bind_bucket *tb, bool relax); 252 const struct inet_bind_bucket *tb, bool relax);
253extern int inet_csk_get_port(struct sock *sk, unsigned short snum); 253int inet_csk_get_port(struct sock *sk, unsigned short snum);
254 254
255extern struct dst_entry* inet_csk_route_req(struct sock *sk, 255struct dst_entry *inet_csk_route_req(struct sock *sk, struct flowi4 *fl4,
256 struct flowi4 *fl4, 256 const struct request_sock *req);
257struct dst_entry *inet_csk_route_child_sock(struct sock *sk, struct sock *newsk,
257 const struct request_sock *req); 258 const struct request_sock *req);
258extern struct dst_entry* inet_csk_route_child_sock(struct sock *sk,
259 struct sock *newsk,
260 const struct request_sock *req);
261 259
262static inline void inet_csk_reqsk_queue_add(struct sock *sk, 260static inline void inet_csk_reqsk_queue_add(struct sock *sk,
263 struct request_sock *req, 261 struct request_sock *req,
@@ -266,9 +264,8 @@ static inline void inet_csk_reqsk_queue_add(struct sock *sk,
266 reqsk_queue_add(&inet_csk(sk)->icsk_accept_queue, req, sk, child); 264 reqsk_queue_add(&inet_csk(sk)->icsk_accept_queue, req, sk, child);
267} 265}
268 266
269extern void inet_csk_reqsk_queue_hash_add(struct sock *sk, 267void inet_csk_reqsk_queue_hash_add(struct sock *sk, struct request_sock *req,
270 struct request_sock *req, 268 unsigned long timeout);
271 unsigned long timeout);
272 269
273static inline void inet_csk_reqsk_queue_removed(struct sock *sk, 270static inline void inet_csk_reqsk_queue_removed(struct sock *sk,
274 struct request_sock *req) 271 struct request_sock *req)
@@ -315,13 +312,13 @@ static inline void inet_csk_reqsk_queue_drop(struct sock *sk,
315 reqsk_free(req); 312 reqsk_free(req);
316} 313}
317 314
318extern void inet_csk_reqsk_queue_prune(struct sock *parent, 315void inet_csk_reqsk_queue_prune(struct sock *parent,
319 const unsigned long interval, 316 const unsigned long interval,
320 const unsigned long timeout, 317 const unsigned long timeout,
321 const unsigned long max_rto); 318 const unsigned long max_rto);
322 319
323extern void inet_csk_destroy_sock(struct sock *sk); 320void inet_csk_destroy_sock(struct sock *sk);
324extern void inet_csk_prepare_forced_close(struct sock *sk); 321void inet_csk_prepare_forced_close(struct sock *sk);
325 322
326/* 323/*
327 * LISTEN is a special case for poll.. 324 * LISTEN is a special case for poll..
@@ -332,15 +329,15 @@ static inline unsigned int inet_csk_listen_poll(const struct sock *sk)
332 (POLLIN | POLLRDNORM) : 0; 329 (POLLIN | POLLRDNORM) : 0;
333} 330}
334 331
335extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries); 332int inet_csk_listen_start(struct sock *sk, const int nr_table_entries);
336extern void inet_csk_listen_stop(struct sock *sk); 333void inet_csk_listen_stop(struct sock *sk);
337 334
338extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); 335void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
339 336
340extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, 337int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
341 char __user *optval, int __user *optlen); 338 char __user *optval, int __user *optlen);
342extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, 339int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
343 char __user *optval, unsigned int optlen); 340 char __user *optval, unsigned int optlen);
344 341
345extern struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu); 342struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu);
346#endif /* _INET_CONNECTION_SOCK_H */ 343#endif /* _INET_CONNECTION_SOCK_H */
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h
index bfcbc0017950..6f59de98dabd 100644
--- a/include/net/inet_frag.h
+++ b/include/net/inet_frag.h
@@ -64,6 +64,10 @@ struct inet_frags {
64 rwlock_t lock ____cacheline_aligned_in_smp; 64 rwlock_t lock ____cacheline_aligned_in_smp;
65 int secret_interval; 65 int secret_interval;
66 struct timer_list secret_timer; 66 struct timer_list secret_timer;
67
68 /* The first call to hashfn is responsible to initialize
69 * rnd. This is best done with net_get_random_once.
70 */
67 u32 rnd; 71 u32 rnd;
68 int qsize; 72 int qsize;
69 73
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index ef83d9e844b5..1bdb47715def 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -37,12 +37,11 @@
37#include <asm/byteorder.h> 37#include <asm/byteorder.h>
38 38
39/* This is for all connections with a full identity, no wildcards. 39/* This is for all connections with a full identity, no wildcards.
40 * One chain is dedicated to TIME_WAIT sockets. 40 * The 'e' prefix stands for Establish, but we really put all sockets
41 * I'll experiment with dynamic table growth later. 41 * but LISTEN ones.
42 */ 42 */
43struct inet_ehash_bucket { 43struct inet_ehash_bucket {
44 struct hlist_nulls_head chain; 44 struct hlist_nulls_head chain;
45 struct hlist_nulls_head twchain;
46}; 45};
47 46
48/* There are a few simple rules, which allow for local port reuse by 47/* There are a few simple rules, which allow for local port reuse by
@@ -123,7 +122,6 @@ struct inet_hashinfo {
123 * 122 *
124 * TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSE 123 * TCP_ESTABLISHED <= sk->sk_state < TCP_CLOSE
125 * 124 *
126 * TIME_WAIT sockets use a separate chain (twchain).
127 */ 125 */
128 struct inet_ehash_bucket *ehash; 126 struct inet_ehash_bucket *ehash;
129 spinlock_t *ehash_locks; 127 spinlock_t *ehash_locks;
@@ -218,22 +216,21 @@ static inline void inet_ehash_locks_free(struct inet_hashinfo *hashinfo)
218 } 216 }
219} 217}
220 218
221extern struct inet_bind_bucket * 219struct inet_bind_bucket *
222 inet_bind_bucket_create(struct kmem_cache *cachep, 220inet_bind_bucket_create(struct kmem_cache *cachep, struct net *net,
223 struct net *net, 221 struct inet_bind_hashbucket *head,
224 struct inet_bind_hashbucket *head, 222 const unsigned short snum);
225 const unsigned short snum); 223void inet_bind_bucket_destroy(struct kmem_cache *cachep,
226extern void inet_bind_bucket_destroy(struct kmem_cache *cachep, 224 struct inet_bind_bucket *tb);
227 struct inet_bind_bucket *tb);
228 225
229static inline int inet_bhashfn(struct net *net, 226static inline int inet_bhashfn(struct net *net, const __u16 lport,
230 const __u16 lport, const int bhash_size) 227 const int bhash_size)
231{ 228{
232 return (lport + net_hash_mix(net)) & (bhash_size - 1); 229 return (lport + net_hash_mix(net)) & (bhash_size - 1);
233} 230}
234 231
235extern void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, 232void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
236 const unsigned short snum); 233 const unsigned short snum);
237 234
238/* These can have wildcards, don't try too hard. */ 235/* These can have wildcards, don't try too hard. */
239static inline int inet_lhashfn(struct net *net, const unsigned short num) 236static inline int inet_lhashfn(struct net *net, const unsigned short num)
@@ -247,23 +244,22 @@ static inline int inet_sk_listen_hashfn(const struct sock *sk)
247} 244}
248 245
249/* Caller must disable local BH processing. */ 246/* Caller must disable local BH processing. */
250extern int __inet_inherit_port(struct sock *sk, struct sock *child); 247int __inet_inherit_port(struct sock *sk, struct sock *child);
251 248
252extern void inet_put_port(struct sock *sk); 249void inet_put_port(struct sock *sk);
253 250
254void inet_hashinfo_init(struct inet_hashinfo *h); 251void inet_hashinfo_init(struct inet_hashinfo *h);
255 252
256extern int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw); 253int __inet_hash_nolisten(struct sock *sk, struct inet_timewait_sock *tw);
257extern void inet_hash(struct sock *sk); 254void inet_hash(struct sock *sk);
258extern void inet_unhash(struct sock *sk); 255void inet_unhash(struct sock *sk);
259 256
260extern struct sock *__inet_lookup_listener(struct net *net, 257struct sock *__inet_lookup_listener(struct net *net,
261 struct inet_hashinfo *hashinfo, 258 struct inet_hashinfo *hashinfo,
262 const __be32 saddr, 259 const __be32 saddr, const __be16 sport,
263 const __be16 sport, 260 const __be32 daddr,
264 const __be32 daddr, 261 const unsigned short hnum,
265 const unsigned short hnum, 262 const int dif);
266 const int dif);
267 263
268static inline struct sock *inet_lookup_listener(struct net *net, 264static inline struct sock *inet_lookup_listener(struct net *net,
269 struct inet_hashinfo *hashinfo, 265 struct inet_hashinfo *hashinfo,
@@ -304,30 +300,17 @@ static inline struct sock *inet_lookup_listener(struct net *net,
304 ((__force __u64)(__be32)(__saddr))); 300 ((__force __u64)(__be32)(__saddr)));
305#endif /* __BIG_ENDIAN */ 301#endif /* __BIG_ENDIAN */
306#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ 302#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
307 ((inet_sk(__sk)->inet_portpair == (__ports)) && \ 303 (((__sk)->sk_portpair == (__ports)) && \
308 (inet_sk(__sk)->inet_addrpair == (__cookie)) && \ 304 ((__sk)->sk_addrpair == (__cookie)) && \
309 (!(__sk)->sk_bound_dev_if || \ 305 (!(__sk)->sk_bound_dev_if || \
310 ((__sk)->sk_bound_dev_if == (__dif))) && \ 306 ((__sk)->sk_bound_dev_if == (__dif))) && \
311 net_eq(sock_net(__sk), (__net))) 307 net_eq(sock_net(__sk), (__net)))
312#define INET_TW_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif)\
313 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
314 (inet_twsk(__sk)->tw_addrpair == (__cookie)) && \
315 (!(__sk)->sk_bound_dev_if || \
316 ((__sk)->sk_bound_dev_if == (__dif))) && \
317 net_eq(sock_net(__sk), (__net)))
318#else /* 32-bit arch */ 308#else /* 32-bit arch */
319#define INET_ADDR_COOKIE(__name, __saddr, __daddr) 309#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
320#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \ 310#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
321 ((inet_sk(__sk)->inet_portpair == (__ports)) && \ 311 (((__sk)->sk_portpair == (__ports)) && \
322 (inet_sk(__sk)->inet_daddr == (__saddr)) && \ 312 ((__sk)->sk_daddr == (__saddr)) && \
323 (inet_sk(__sk)->inet_rcv_saddr == (__daddr)) && \ 313 ((__sk)->sk_rcv_saddr == (__daddr)) && \
324 (!(__sk)->sk_bound_dev_if || \
325 ((__sk)->sk_bound_dev_if == (__dif))) && \
326 net_eq(sock_net(__sk), (__net)))
327#define INET_TW_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif) \
328 ((inet_twsk(__sk)->tw_portpair == (__ports)) && \
329 (inet_twsk(__sk)->tw_daddr == (__saddr)) && \
330 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
331 (!(__sk)->sk_bound_dev_if || \ 314 (!(__sk)->sk_bound_dev_if || \
332 ((__sk)->sk_bound_dev_if == (__dif))) && \ 315 ((__sk)->sk_bound_dev_if == (__dif))) && \
333 net_eq(sock_net(__sk), (__net))) 316 net_eq(sock_net(__sk), (__net)))
@@ -339,10 +322,11 @@ static inline struct sock *inet_lookup_listener(struct net *net,
339 * 322 *
340 * Local BH must be disabled here. 323 * Local BH must be disabled here.
341 */ 324 */
342extern struct sock * __inet_lookup_established(struct net *net, 325struct sock *__inet_lookup_established(struct net *net,
343 struct inet_hashinfo *hashinfo, 326 struct inet_hashinfo *hashinfo,
344 const __be32 saddr, const __be16 sport, 327 const __be32 saddr, const __be16 sport,
345 const __be32 daddr, const u16 hnum, const int dif); 328 const __be32 daddr, const u16 hnum,
329 const int dif);
346 330
347static inline struct sock * 331static inline struct sock *
348 inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo, 332 inet_lookup_established(struct net *net, struct inet_hashinfo *hashinfo,
@@ -399,13 +383,14 @@ static inline struct sock *__inet_lookup_skb(struct inet_hashinfo *hashinfo,
399 iph->daddr, dport, inet_iif(skb)); 383 iph->daddr, dport, inet_iif(skb));
400} 384}
401 385
402extern int __inet_hash_connect(struct inet_timewait_death_row *death_row, 386int __inet_hash_connect(struct inet_timewait_death_row *death_row,
403 struct sock *sk, 387 struct sock *sk, u32 port_offset,
404 u32 port_offset, 388 int (*check_established)(struct inet_timewait_death_row *,
405 int (*check_established)(struct inet_timewait_death_row *, 389 struct sock *, __u16,
406 struct sock *, __u16, struct inet_timewait_sock **), 390 struct inet_timewait_sock **),
407 int (*hash)(struct sock *sk, struct inet_timewait_sock *twp)); 391 int (*hash)(struct sock *sk,
392 struct inet_timewait_sock *twp));
408 393
409extern int inet_hash_connect(struct inet_timewait_death_row *death_row, 394int inet_hash_connect(struct inet_timewait_death_row *death_row,
410 struct sock *sk); 395 struct sock *sk);
411#endif /* _INET_HASHTABLES_H */ 396#endif /* _INET_HASHTABLES_H */
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index b21a7f06d6a4..1833c3f389ee 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -70,13 +70,14 @@ struct ip_options_data {
70 70
71struct inet_request_sock { 71struct inet_request_sock {
72 struct request_sock req; 72 struct request_sock req;
73#if IS_ENABLED(CONFIG_IPV6) 73#define ir_loc_addr req.__req_common.skc_rcv_saddr
74 u16 inet6_rsk_offset; 74#define ir_rmt_addr req.__req_common.skc_daddr
75#endif 75#define ir_num req.__req_common.skc_num
76 __be16 loc_port; 76#define ir_rmt_port req.__req_common.skc_dport
77 __be32 loc_addr; 77#define ir_v6_rmt_addr req.__req_common.skc_v6_daddr
78 __be32 rmt_addr; 78#define ir_v6_loc_addr req.__req_common.skc_v6_rcv_saddr
79 __be16 rmt_port; 79#define ir_iif req.__req_common.skc_bound_dev_if
80
80 kmemcheck_bitfield_begin(flags); 81 kmemcheck_bitfield_begin(flags);
81 u16 snd_wscale : 4, 82 u16 snd_wscale : 4,
82 rcv_wscale : 4, 83 rcv_wscale : 4,
@@ -88,6 +89,7 @@ struct inet_request_sock {
88 no_srccheck: 1; 89 no_srccheck: 1;
89 kmemcheck_bitfield_end(flags); 90 kmemcheck_bitfield_end(flags);
90 struct ip_options_rcu *opt; 91 struct ip_options_rcu *opt;
92 struct sk_buff *pktopts;
91}; 93};
92 94
93static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) 95static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
@@ -103,6 +105,9 @@ struct inet_cork {
103 int length; /* Total length of all frames */ 105 int length; /* Total length of all frames */
104 struct dst_entry *dst; 106 struct dst_entry *dst;
105 u8 tx_flags; 107 u8 tx_flags;
108 __u8 ttl;
109 __s16 tos;
110 char priority;
106}; 111};
107 112
108struct inet_cork_full { 113struct inet_cork_full {
@@ -143,10 +148,8 @@ struct inet_sock {
143 /* Socket demultiplex comparisons on incoming packets. */ 148 /* Socket demultiplex comparisons on incoming packets. */
144#define inet_daddr sk.__sk_common.skc_daddr 149#define inet_daddr sk.__sk_common.skc_daddr
145#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr 150#define inet_rcv_saddr sk.__sk_common.skc_rcv_saddr
146#define inet_addrpair sk.__sk_common.skc_addrpair
147#define inet_dport sk.__sk_common.skc_dport 151#define inet_dport sk.__sk_common.skc_dport
148#define inet_num sk.__sk_common.skc_num 152#define inet_num sk.__sk_common.skc_num
149#define inet_portpair sk.__sk_common.skc_portpair
150 153
151 __be32 inet_saddr; 154 __be32 inet_saddr;
152 __s16 uc_ttl; 155 __s16 uc_ttl;
@@ -199,32 +202,18 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
199} 202}
200#endif 203#endif
201 204
202extern int inet_sk_rebuild_header(struct sock *sk); 205int inet_sk_rebuild_header(struct sock *sk);
203
204extern u32 inet_ehash_secret;
205extern u32 ipv6_hash_secret;
206extern void build_ehash_secret(void);
207 206
208static inline unsigned int inet_ehashfn(struct net *net, 207static inline unsigned int __inet_ehashfn(const __be32 laddr,
209 const __be32 laddr, const __u16 lport, 208 const __u16 lport,
210 const __be32 faddr, const __be16 fport) 209 const __be32 faddr,
210 const __be16 fport,
211 u32 initval)
211{ 212{
212 return jhash_3words((__force __u32) laddr, 213 return jhash_3words((__force __u32) laddr,
213 (__force __u32) faddr, 214 (__force __u32) faddr,
214 ((__u32) lport) << 16 | (__force __u32)fport, 215 ((__u32) lport) << 16 | (__force __u32)fport,
215 inet_ehash_secret + net_hash_mix(net)); 216 initval);
216}
217
218static inline int inet_sk_ehashfn(const struct sock *sk)
219{
220 const struct inet_sock *inet = inet_sk(sk);
221 const __be32 laddr = inet->inet_rcv_saddr;
222 const __u16 lport = inet->inet_num;
223 const __be32 faddr = inet->inet_daddr;
224 const __be16 fport = inet->inet_dport;
225 struct net *net = sock_net(sk);
226
227 return inet_ehashfn(net, laddr, lport, faddr, fport);
228} 217}
229 218
230static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops) 219static inline struct request_sock *inet_reqsk_alloc(struct request_sock_ops *ops)
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index f908dfc06505..71c6e264e5b5 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -58,6 +58,11 @@ struct inet_hashinfo;
58# define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG) 58# define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG)
59#endif 59#endif
60 60
61static inline u32 inet_tw_time_stamp(void)
62{
63 return jiffies;
64}
65
61/* TIME_WAIT reaping mechanism. */ 66/* TIME_WAIT reaping mechanism. */
62#define INET_TWDR_TWKILL_SLOTS 8 /* Please keep this a power of 2. */ 67#define INET_TWDR_TWKILL_SLOTS 8 /* Please keep this a power of 2. */
63 68
@@ -83,9 +88,9 @@ struct inet_timewait_death_row {
83 int sysctl_max_tw_buckets; 88 int sysctl_max_tw_buckets;
84}; 89};
85 90
86extern void inet_twdr_hangman(unsigned long data); 91void inet_twdr_hangman(unsigned long data);
87extern void inet_twdr_twkill_work(struct work_struct *work); 92void inet_twdr_twkill_work(struct work_struct *work);
88extern void inet_twdr_twcal_tick(unsigned long data); 93void inet_twdr_twcal_tick(unsigned long data);
89 94
90struct inet_bind_bucket; 95struct inet_bind_bucket;
91 96
@@ -111,11 +116,11 @@ struct inet_timewait_sock {
111#define tw_prot __tw_common.skc_prot 116#define tw_prot __tw_common.skc_prot
112#define tw_net __tw_common.skc_net 117#define tw_net __tw_common.skc_net
113#define tw_daddr __tw_common.skc_daddr 118#define tw_daddr __tw_common.skc_daddr
119#define tw_v6_daddr __tw_common.skc_v6_daddr
114#define tw_rcv_saddr __tw_common.skc_rcv_saddr 120#define tw_rcv_saddr __tw_common.skc_rcv_saddr
115#define tw_addrpair __tw_common.skc_addrpair 121#define tw_v6_rcv_saddr __tw_common.skc_v6_rcv_saddr
116#define tw_dport __tw_common.skc_dport 122#define tw_dport __tw_common.skc_dport
117#define tw_num __tw_common.skc_num 123#define tw_num __tw_common.skc_num
118#define tw_portpair __tw_common.skc_portpair
119 124
120 int tw_timeout; 125 int tw_timeout;
121 volatile unsigned char tw_substate; 126 volatile unsigned char tw_substate;
@@ -130,26 +135,14 @@ struct inet_timewait_sock {
130 tw_transparent : 1, 135 tw_transparent : 1,
131 tw_pad : 6, /* 6 bits hole */ 136 tw_pad : 6, /* 6 bits hole */
132 tw_tos : 8, 137 tw_tos : 8,
133 tw_ipv6_offset : 16; 138 tw_pad2 : 16; /* 16 bits hole */
134 kmemcheck_bitfield_end(flags); 139 kmemcheck_bitfield_end(flags);
135 unsigned long tw_ttd; 140 u32 tw_ttd;
136 struct inet_bind_bucket *tw_tb; 141 struct inet_bind_bucket *tw_tb;
137 struct hlist_node tw_death_node; 142 struct hlist_node tw_death_node;
138}; 143};
139#define tw_tclass tw_tos 144#define tw_tclass tw_tos
140 145
141static inline void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw,
142 struct hlist_nulls_head *list)
143{
144 hlist_nulls_add_head_rcu(&tw->tw_node, list);
145}
146
147static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw,
148 struct hlist_head *list)
149{
150 hlist_add_head(&tw->tw_bind_node, list);
151}
152
153static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw) 146static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw)
154{ 147{
155 return !hlist_unhashed(&tw->tw_death_node); 148 return !hlist_unhashed(&tw->tw_death_node);
@@ -189,34 +182,28 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
189 return (struct inet_timewait_sock *)sk; 182 return (struct inet_timewait_sock *)sk;
190} 183}
191 184
192static inline __be32 sk_rcv_saddr(const struct sock *sk) 185void inet_twsk_free(struct inet_timewait_sock *tw);
193{ 186void inet_twsk_put(struct inet_timewait_sock *tw);
194/* both inet_sk() and inet_twsk() store rcv_saddr in skc_rcv_saddr */
195 return sk->__sk_common.skc_rcv_saddr;
196}
197
198extern void inet_twsk_put(struct inet_timewait_sock *tw);
199 187
200extern int inet_twsk_unhash(struct inet_timewait_sock *tw); 188int inet_twsk_unhash(struct inet_timewait_sock *tw);
201 189
202extern int inet_twsk_bind_unhash(struct inet_timewait_sock *tw, 190int inet_twsk_bind_unhash(struct inet_timewait_sock *tw,
203 struct inet_hashinfo *hashinfo); 191 struct inet_hashinfo *hashinfo);
204 192
205extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, 193struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
206 const int state); 194 const int state);
207 195
208extern void __inet_twsk_hashdance(struct inet_timewait_sock *tw, 196void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
209 struct sock *sk, 197 struct inet_hashinfo *hashinfo);
210 struct inet_hashinfo *hashinfo);
211 198
212extern void inet_twsk_schedule(struct inet_timewait_sock *tw, 199void inet_twsk_schedule(struct inet_timewait_sock *tw,
213 struct inet_timewait_death_row *twdr, 200 struct inet_timewait_death_row *twdr,
214 const int timeo, const int timewait_len); 201 const int timeo, const int timewait_len);
215extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, 202void inet_twsk_deschedule(struct inet_timewait_sock *tw,
216 struct inet_timewait_death_row *twdr); 203 struct inet_timewait_death_row *twdr);
217 204
218extern void inet_twsk_purge(struct inet_hashinfo *hashinfo, 205void inet_twsk_purge(struct inet_hashinfo *hashinfo,
219 struct inet_timewait_death_row *twdr, int family); 206 struct inet_timewait_death_row *twdr, int family);
220 207
221static inline 208static inline
222struct net *twsk_net(const struct inet_timewait_sock *twsk) 209struct net *twsk_net(const struct inet_timewait_sock *twsk)
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 53f464d7cddc..f4e127af4e17 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -120,9 +120,9 @@ static inline void inetpeer_transfer_peer(unsigned long *to, unsigned long *from
120 } 120 }
121} 121}
122 122
123extern void inet_peer_base_init(struct inet_peer_base *); 123void inet_peer_base_init(struct inet_peer_base *);
124 124
125void inet_initpeers(void) __init; 125void inet_initpeers(void) __init;
126 126
127#define INETPEER_METRICS_NEW (~(u32) 0) 127#define INETPEER_METRICS_NEW (~(u32) 0)
128 128
@@ -159,11 +159,11 @@ static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base,
159} 159}
160 160
161/* can be called from BH context or outside */ 161/* can be called from BH context or outside */
162extern void inet_putpeer(struct inet_peer *p); 162void inet_putpeer(struct inet_peer *p);
163extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); 163bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
164 164
165extern void inetpeer_invalidate_tree(struct inet_peer_base *); 165void inetpeer_invalidate_tree(struct inet_peer_base *);
166extern void inetpeer_invalidate_family(int family); 166void inetpeer_invalidate_family(int family);
167 167
168/* 168/*
169 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 169 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
diff --git a/include/net/ip.h b/include/net/ip.h
index 5e5268807a1c..217bc5bfc6c6 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -28,6 +28,7 @@
28#include <linux/skbuff.h> 28#include <linux/skbuff.h>
29 29
30#include <net/inet_sock.h> 30#include <net/inet_sock.h>
31#include <net/route.h>
31#include <net/snmp.h> 32#include <net/snmp.h>
32#include <net/flow.h> 33#include <net/flow.h>
33 34
@@ -56,6 +57,9 @@ struct ipcm_cookie {
56 int oif; 57 int oif;
57 struct ip_options_rcu *opt; 58 struct ip_options_rcu *opt;
58 __u8 tx_flags; 59 __u8 tx_flags;
60 __u8 ttl;
61 __s16 tos;
62 char priority;
59}; 63};
60 64
61#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) 65#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb))
@@ -86,64 +90,71 @@ struct packet_type;
86struct rtable; 90struct rtable;
87struct sockaddr; 91struct sockaddr;
88 92
89extern int igmp_mc_proc_init(void); 93int igmp_mc_proc_init(void);
90 94
91/* 95/*
92 * Functions provided by ip.c 96 * Functions provided by ip.c
93 */ 97 */
94 98
95extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, 99int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
96 __be32 saddr, __be32 daddr, 100 __be32 saddr, __be32 daddr,
97 struct ip_options_rcu *opt); 101 struct ip_options_rcu *opt);
98extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, 102int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
99 struct packet_type *pt, struct net_device *orig_dev); 103 struct net_device *orig_dev);
100extern int ip_local_deliver(struct sk_buff *skb); 104int ip_local_deliver(struct sk_buff *skb);
101extern int ip_mr_input(struct sk_buff *skb); 105int ip_mr_input(struct sk_buff *skb);
102extern int ip_output(struct sk_buff *skb); 106int ip_output(struct sk_buff *skb);
103extern int ip_mc_output(struct sk_buff *skb); 107int ip_mc_output(struct sk_buff *skb);
104extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)); 108int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
105extern int ip_do_nat(struct sk_buff *skb); 109int ip_do_nat(struct sk_buff *skb);
106extern void ip_send_check(struct iphdr *ip); 110void ip_send_check(struct iphdr *ip);
107extern int __ip_local_out(struct sk_buff *skb); 111int __ip_local_out(struct sk_buff *skb);
108extern int ip_local_out(struct sk_buff *skb); 112int ip_local_out(struct sk_buff *skb);
109extern int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl); 113int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl);
110extern void ip_init(void); 114void ip_init(void);
111extern int ip_append_data(struct sock *sk, struct flowi4 *fl4, 115int ip_append_data(struct sock *sk, struct flowi4 *fl4,
112 int getfrag(void *from, char *to, int offset, int len, 116 int getfrag(void *from, char *to, int offset, int len,
113 int odd, struct sk_buff *skb), 117 int odd, struct sk_buff *skb),
114 void *from, int len, int protolen, 118 void *from, int len, int protolen,
115 struct ipcm_cookie *ipc, 119 struct ipcm_cookie *ipc,
116 struct rtable **rt, 120 struct rtable **rt,
117 unsigned int flags); 121 unsigned int flags);
118extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); 122int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd,
119extern ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, 123 struct sk_buff *skb);
120 int offset, size_t size, int flags); 124ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
121extern struct sk_buff *__ip_make_skb(struct sock *sk, 125 int offset, size_t size, int flags);
122 struct flowi4 *fl4, 126struct sk_buff *__ip_make_skb(struct sock *sk, struct flowi4 *fl4,
123 struct sk_buff_head *queue, 127 struct sk_buff_head *queue,
124 struct inet_cork *cork); 128 struct inet_cork *cork);
125extern int ip_send_skb(struct net *net, struct sk_buff *skb); 129int ip_send_skb(struct net *net, struct sk_buff *skb);
126extern int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4); 130int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4);
127extern void ip_flush_pending_frames(struct sock *sk); 131void ip_flush_pending_frames(struct sock *sk);
128extern struct sk_buff *ip_make_skb(struct sock *sk, 132struct sk_buff *ip_make_skb(struct sock *sk, struct flowi4 *fl4,
129 struct flowi4 *fl4, 133 int getfrag(void *from, char *to, int offset,
130 int getfrag(void *from, char *to, int offset, int len, 134 int len, int odd, struct sk_buff *skb),
131 int odd, struct sk_buff *skb), 135 void *from, int length, int transhdrlen,
132 void *from, int length, int transhdrlen, 136 struct ipcm_cookie *ipc, struct rtable **rtp,
133 struct ipcm_cookie *ipc, 137 unsigned int flags);
134 struct rtable **rtp,
135 unsigned int flags);
136 138
137static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4) 139static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
138{ 140{
139 return __ip_make_skb(sk, fl4, &sk->sk_write_queue, &inet_sk(sk)->cork.base); 141 return __ip_make_skb(sk, fl4, &sk->sk_write_queue, &inet_sk(sk)->cork.base);
140} 142}
141 143
144static inline __u8 get_rttos(struct ipcm_cookie* ipc, struct inet_sock *inet)
145{
146 return (ipc->tos != -1) ? RT_TOS(ipc->tos) : RT_TOS(inet->tos);
147}
148
149static inline __u8 get_rtconn_flags(struct ipcm_cookie* ipc, struct sock* sk)
150{
151 return (ipc->tos != -1) ? RT_CONN_FLAGS_TOS(sk, ipc->tos) : RT_CONN_FLAGS(sk);
152}
153
142/* datagram.c */ 154/* datagram.c */
143extern int ip4_datagram_connect(struct sock *sk, 155int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
144 struct sockaddr *uaddr, int addr_len);
145 156
146extern void ip4_datagram_release_cb(struct sock *sk); 157void ip4_datagram_release_cb(struct sock *sk);
147 158
148struct ip_reply_arg { 159struct ip_reply_arg {
149 struct kvec iov[1]; 160 struct kvec iov[1];
@@ -184,16 +195,16 @@ extern struct ipv4_config ipv4_config;
184#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) 195#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
185#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 196#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
186 197
187extern unsigned long snmp_fold_field(void __percpu *mib[], int offt); 198unsigned long snmp_fold_field(void __percpu *mib[], int offt);
188#if BITS_PER_LONG==32 199#if BITS_PER_LONG==32
189extern u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off); 200u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off);
190#else 201#else
191static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off) 202static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off)
192{ 203{
193 return snmp_fold_field(mib, offt); 204 return snmp_fold_field(mib, offt);
194} 205}
195#endif 206#endif
196extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align); 207int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
197 208
198static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ]) 209static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
199{ 210{
@@ -206,11 +217,7 @@ static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
206 } 217 }
207} 218}
208 219
209extern struct local_ports { 220void inet_get_local_port_range(struct net *net, int *low, int *high);
210 seqlock_t lock;
211 int range[2];
212} sysctl_local_ports;
213extern void inet_get_local_port_range(int *low, int *high);
214 221
215extern unsigned long *sysctl_local_reserved_ports; 222extern unsigned long *sysctl_local_reserved_ports;
216static inline int inet_is_reserved_local_port(int port) 223static inline int inet_is_reserved_local_port(int port)
@@ -231,9 +238,9 @@ extern int sysctl_ip_early_demux;
231/* From ip_output.c */ 238/* From ip_output.c */
232extern int sysctl_ip_dynaddr; 239extern int sysctl_ip_dynaddr;
233 240
234extern void ipfrag_init(void); 241void ipfrag_init(void);
235 242
236extern void ip_static_sysctl_init(void); 243void ip_static_sysctl_init(void);
237 244
238static inline bool ip_is_fragment(const struct iphdr *iph) 245static inline bool ip_is_fragment(const struct iphdr *iph)
239{ 246{
@@ -262,7 +269,7 @@ int ip_dont_fragment(struct sock *sk, struct dst_entry *dst)
262 !(dst_metric_locked(dst, RTAX_MTU))); 269 !(dst_metric_locked(dst, RTAX_MTU)));
263} 270}
264 271
265extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); 272void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more);
266 273
267static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk) 274static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk)
268{ 275{
@@ -367,7 +374,7 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
367 struct ipv6_pinfo *np = inet6_sk(sk); 374 struct ipv6_pinfo *np = inet6_sk(sk);
368 375
369 memset(&np->saddr, 0, sizeof(np->saddr)); 376 memset(&np->saddr, 0, sizeof(np->saddr));
370 memset(&np->rcv_saddr, 0, sizeof(np->rcv_saddr)); 377 memset(&sk->sk_v6_rcv_saddr, 0, sizeof(sk->sk_v6_rcv_saddr));
371 } 378 }
372#endif 379#endif
373} 380}
@@ -390,7 +397,7 @@ static inline int sk_mc_loop(struct sock *sk)
390 return 1; 397 return 1;
391} 398}
392 399
393extern bool ip_call_ra_chain(struct sk_buff *skb); 400bool ip_call_ra_chain(struct sk_buff *skb);
394 401
395/* 402/*
396 * Functions provided by ip_fragment.c 403 * Functions provided by ip_fragment.c
@@ -428,50 +435,52 @@ int ip_frag_nqueues(struct net *net);
428 * Functions provided by ip_forward.c 435 * Functions provided by ip_forward.c
429 */ 436 */
430 437
431extern int ip_forward(struct sk_buff *skb); 438int ip_forward(struct sk_buff *skb);
432 439
433/* 440/*
434 * Functions provided by ip_options.c 441 * Functions provided by ip_options.c
435 */ 442 */
436 443
437extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, 444void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
438 __be32 daddr, struct rtable *rt, int is_frag); 445 __be32 daddr, struct rtable *rt, int is_frag);
439extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); 446int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
440extern void ip_options_fragment(struct sk_buff *skb); 447void ip_options_fragment(struct sk_buff *skb);
441extern int ip_options_compile(struct net *net, 448int ip_options_compile(struct net *net, struct ip_options *opt,
442 struct ip_options *opt, struct sk_buff *skb); 449 struct sk_buff *skb);
443extern int ip_options_get(struct net *net, struct ip_options_rcu **optp, 450int ip_options_get(struct net *net, struct ip_options_rcu **optp,
444 unsigned char *data, int optlen); 451 unsigned char *data, int optlen);
445extern int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp, 452int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp,
446 unsigned char __user *data, int optlen); 453 unsigned char __user *data, int optlen);
447extern void ip_options_undo(struct ip_options * opt); 454void ip_options_undo(struct ip_options *opt);
448extern void ip_forward_options(struct sk_buff *skb); 455void ip_forward_options(struct sk_buff *skb);
449extern int ip_options_rcv_srr(struct sk_buff *skb); 456int ip_options_rcv_srr(struct sk_buff *skb);
450 457
451/* 458/*
452 * Functions provided by ip_sockglue.c 459 * Functions provided by ip_sockglue.c
453 */ 460 */
454 461
455extern void ipv4_pktinfo_prepare(struct sk_buff *skb); 462void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb);
456extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); 463void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
457extern int ip_cmsg_send(struct net *net, 464int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc);
458 struct msghdr *msg, struct ipcm_cookie *ipc); 465int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
459extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen); 466 unsigned int optlen);
460extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); 467int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
461extern int compat_ip_setsockopt(struct sock *sk, int level, 468 int __user *optlen);
462 int optname, char __user *optval, unsigned int optlen); 469int compat_ip_setsockopt(struct sock *sk, int level, int optname,
463extern int compat_ip_getsockopt(struct sock *sk, int level, 470 char __user *optval, unsigned int optlen);
464 int optname, char __user *optval, int __user *optlen); 471int compat_ip_getsockopt(struct sock *sk, int level, int optname,
465extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *)); 472 char __user *optval, int __user *optlen);
466 473int ip_ra_control(struct sock *sk, unsigned char on,
467extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); 474 void (*destructor)(struct sock *));
468extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, 475
469 __be16 port, u32 info, u8 *payload); 476int ip_recv_error(struct sock *sk, struct msghdr *msg, int len);
470extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, 477void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
471 u32 info); 478 u32 info, u8 *payload);
479void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
480 u32 info);
472 481
473#ifdef CONFIG_PROC_FS 482#ifdef CONFIG_PROC_FS
474extern int ip_misc_proc_init(void); 483int ip_misc_proc_init(void);
475#endif 484#endif
476 485
477#endif /* _IP_H */ 486#endif /* _IP_H */
diff --git a/include/net/ip6_checksum.h b/include/net/ip6_checksum.h
index 7686e3f5033d..9e3c540c1b11 100644
--- a/include/net/ip6_checksum.h
+++ b/include/net/ip6_checksum.h
@@ -66,12 +66,14 @@ static inline void __tcp_v6_send_check(struct sk_buff *skb,
66 } 66 }
67} 67}
68 68
69#if IS_ENABLED(CONFIG_IPV6)
69static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb) 70static inline void tcp_v6_send_check(struct sock *sk, struct sk_buff *skb)
70{ 71{
71 struct ipv6_pinfo *np = inet6_sk(sk); 72 struct ipv6_pinfo *np = inet6_sk(sk);
72 73
73 __tcp_v6_send_check(skb, &np->saddr, &np->daddr); 74 __tcp_v6_send_check(skb, &np->saddr, &sk->sk_v6_daddr);
74} 75}
76#endif
75 77
76int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto); 78int udp6_csum_init(struct sk_buff *skb, struct udphdr *uh, int proto);
77#endif 79#endif
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 48ec25a7fcb6..2182525e4d74 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -165,6 +165,7 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
165static inline void rt6_clean_expires(struct rt6_info *rt) 165static inline void rt6_clean_expires(struct rt6_info *rt)
166{ 166{
167 rt->rt6i_flags &= ~RTF_EXPIRES; 167 rt->rt6i_flags &= ~RTF_EXPIRES;
168 rt->dst.expires = 0;
168} 169}
169 170
170static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires) 171static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires)
@@ -267,48 +268,39 @@ typedef struct rt6_info *(*pol_lookup_t)(struct net *,
267 * exported functions 268 * exported functions
268 */ 269 */
269 270
270extern struct fib6_table *fib6_get_table(struct net *net, u32 id); 271struct fib6_table *fib6_get_table(struct net *net, u32 id);
271extern struct fib6_table *fib6_new_table(struct net *net, u32 id); 272struct fib6_table *fib6_new_table(struct net *net, u32 id);
272extern struct dst_entry *fib6_rule_lookup(struct net *net, 273struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
273 struct flowi6 *fl6, int flags, 274 int flags, pol_lookup_t lookup);
274 pol_lookup_t lookup);
275 275
276extern struct fib6_node *fib6_lookup(struct fib6_node *root, 276struct fib6_node *fib6_lookup(struct fib6_node *root,
277 const struct in6_addr *daddr, 277 const struct in6_addr *daddr,
278 const struct in6_addr *saddr); 278 const struct in6_addr *saddr);
279 279
280struct fib6_node *fib6_locate(struct fib6_node *root, 280struct fib6_node *fib6_locate(struct fib6_node *root,
281 const struct in6_addr *daddr, int dst_len, 281 const struct in6_addr *daddr, int dst_len,
282 const struct in6_addr *saddr, int src_len); 282 const struct in6_addr *saddr, int src_len);
283 283
284extern void fib6_clean_all_ro(struct net *net, 284void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
285 int (*func)(struct rt6_info *, void *arg), 285 int prune, void *arg);
286 int prune, void *arg);
287 286
288extern void fib6_clean_all(struct net *net, 287int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info);
289 int (*func)(struct rt6_info *, void *arg),
290 int prune, void *arg);
291 288
292extern int fib6_add(struct fib6_node *root, 289int fib6_del(struct rt6_info *rt, struct nl_info *info);
293 struct rt6_info *rt,
294 struct nl_info *info);
295 290
296extern int fib6_del(struct rt6_info *rt, 291void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info);
297 struct nl_info *info);
298 292
299extern void inet6_rt_notify(int event, struct rt6_info *rt, 293void fib6_run_gc(unsigned long expires, struct net *net, bool force);
300 struct nl_info *info);
301 294
302extern void fib6_run_gc(unsigned long expires, 295void fib6_gc_cleanup(void);
303 struct net *net, bool force);
304 296
305extern void fib6_gc_cleanup(void); 297int fib6_init(void);
306 298
307extern int fib6_init(void); 299int ipv6_route_open(struct inode *inode, struct file *file);
308 300
309#ifdef CONFIG_IPV6_MULTIPLE_TABLES 301#ifdef CONFIG_IPV6_MULTIPLE_TABLES
310extern int fib6_rules_init(void); 302int fib6_rules_init(void);
311extern void fib6_rules_cleanup(void); 303void fib6_rules_cleanup(void);
312#else 304#else
313static inline int fib6_rules_init(void) 305static inline int fib6_rules_init(void)
314{ 306{
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index 2b786b7e3585..733747ce163c 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -51,7 +51,7 @@ static inline unsigned int rt6_flags2srcprefs(int flags)
51 return (flags >> 3) & 7; 51 return (flags >> 3) & 7;
52} 52}
53 53
54extern void rt6_bind_peer(struct rt6_info *rt, int create); 54void rt6_bind_peer(struct rt6_info *rt, int create);
55 55
56static inline struct inet_peer *__rt6_get_peer(struct rt6_info *rt, int create) 56static inline struct inet_peer *__rt6_get_peer(struct rt6_info *rt, int create)
57{ 57{
@@ -72,70 +72,58 @@ static inline struct inet_peer *rt6_get_peer_create(struct rt6_info *rt)
72 return __rt6_get_peer(rt, 1); 72 return __rt6_get_peer(rt, 1);
73} 73}
74 74
75extern void ip6_route_input(struct sk_buff *skb); 75void ip6_route_input(struct sk_buff *skb);
76 76
77extern struct dst_entry * ip6_route_output(struct net *net, 77struct dst_entry *ip6_route_output(struct net *net, const struct sock *sk,
78 const struct sock *sk, 78 struct flowi6 *fl6);
79 struct flowi6 *fl6); 79struct dst_entry *ip6_route_lookup(struct net *net, struct flowi6 *fl6,
80extern struct dst_entry * ip6_route_lookup(struct net *net, 80 int flags);
81 struct flowi6 *fl6, int flags);
82 81
83extern int ip6_route_init(void); 82int ip6_route_init(void);
84extern void ip6_route_cleanup(void); 83void ip6_route_cleanup(void);
85 84
86extern int ipv6_route_ioctl(struct net *net, 85int ipv6_route_ioctl(struct net *net, unsigned int cmd, void __user *arg);
87 unsigned int cmd,
88 void __user *arg);
89 86
90extern int ip6_route_add(struct fib6_config *cfg); 87int ip6_route_add(struct fib6_config *cfg);
91extern int ip6_ins_rt(struct rt6_info *); 88int ip6_ins_rt(struct rt6_info *);
92extern int ip6_del_rt(struct rt6_info *); 89int ip6_del_rt(struct rt6_info *);
93 90
94extern int ip6_route_get_saddr(struct net *net, 91int ip6_route_get_saddr(struct net *net, struct rt6_info *rt,
95 struct rt6_info *rt, 92 const struct in6_addr *daddr, unsigned int prefs,
96 const struct in6_addr *daddr, 93 struct in6_addr *saddr);
97 unsigned int prefs,
98 struct in6_addr *saddr);
99 94
100extern struct rt6_info *rt6_lookup(struct net *net, 95struct rt6_info *rt6_lookup(struct net *net, const struct in6_addr *daddr,
101 const struct in6_addr *daddr, 96 const struct in6_addr *saddr, int oif, int flags);
102 const struct in6_addr *saddr,
103 int oif, int flags);
104 97
105extern struct dst_entry *icmp6_dst_alloc(struct net_device *dev, 98struct dst_entry *icmp6_dst_alloc(struct net_device *dev, struct flowi6 *fl6);
106 struct flowi6 *fl6); 99int icmp6_dst_gc(void);
107extern int icmp6_dst_gc(void);
108 100
109extern void fib6_force_start_gc(struct net *net); 101void fib6_force_start_gc(struct net *net);
110 102
111extern struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev, 103struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
112 const struct in6_addr *addr, 104 const struct in6_addr *addr, bool anycast);
113 bool anycast);
114 105
115/* 106/*
116 * support functions for ND 107 * support functions for ND
117 * 108 *
118 */ 109 */
119extern struct rt6_info * rt6_get_dflt_router(const struct in6_addr *addr, 110struct rt6_info *rt6_get_dflt_router(const struct in6_addr *addr,
120 struct net_device *dev); 111 struct net_device *dev);
121extern struct rt6_info * rt6_add_dflt_router(const struct in6_addr *gwaddr, 112struct rt6_info *rt6_add_dflt_router(const struct in6_addr *gwaddr,
122 struct net_device *dev, 113 struct net_device *dev, unsigned int pref);
123 unsigned int pref); 114
124 115void rt6_purge_dflt_routers(struct net *net);
125extern void rt6_purge_dflt_routers(struct net *net); 116
126 117int rt6_route_rcv(struct net_device *dev, u8 *opt, int len,
127extern int rt6_route_rcv(struct net_device *dev, 118 const struct in6_addr *gwaddr);
128 u8 *opt, int len, 119
129 const struct in6_addr *gwaddr); 120void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, int oif,
130 121 u32 mark);
131extern void ip6_update_pmtu(struct sk_buff *skb, struct net *net, __be32 mtu, 122void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, __be32 mtu);
132 int oif, u32 mark); 123void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark);
133extern void ip6_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, 124void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
134 __be32 mtu); 125 u32 mark);
135extern void ip6_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark); 126void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
136extern void ip6_redirect_no_header(struct sk_buff *skb, struct net *net, int oif,
137 u32 mark);
138extern void ip6_sk_redirect(struct sk_buff *skb, struct sock *sk);
139 127
140struct netlink_callback; 128struct netlink_callback;
141 129
@@ -145,10 +133,10 @@ struct rt6_rtnl_dump_arg {
145 struct net *net; 133 struct net *net;
146}; 134};
147 135
148extern int rt6_dump_route(struct rt6_info *rt, void *p_arg); 136int rt6_dump_route(struct rt6_info *rt, void *p_arg);
149extern void rt6_ifdown(struct net *net, struct net_device *dev); 137void rt6_ifdown(struct net *net, struct net_device *dev);
150extern void rt6_mtu_change(struct net_device *dev, unsigned int mtu); 138void rt6_mtu_change(struct net_device *dev, unsigned int mtu);
151extern void rt6_remove_prefsrc(struct inet6_ifaddr *ifp); 139void rt6_remove_prefsrc(struct inet6_ifaddr *ifp);
152 140
153 141
154/* 142/*
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index cbf2be37c91a..9922093f575e 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -165,7 +165,7 @@ struct fib_result_nl {
165#define FIB_TABLE_HASHSZ 2 165#define FIB_TABLE_HASHSZ 2
166#endif 166#endif
167 167
168extern __be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh); 168__be32 fib_info_update_nh_saddr(struct net *net, struct fib_nh *nh);
169 169
170#define FIB_RES_SADDR(net, res) \ 170#define FIB_RES_SADDR(net, res) \
171 ((FIB_RES_NH(res).nh_saddr_genid == \ 171 ((FIB_RES_NH(res).nh_saddr_genid == \
@@ -187,14 +187,14 @@ struct fib_table {
187 unsigned long tb_data[0]; 187 unsigned long tb_data[0];
188}; 188};
189 189
190extern int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp, 190int fib_table_lookup(struct fib_table *tb, const struct flowi4 *flp,
191 struct fib_result *res, int fib_flags); 191 struct fib_result *res, int fib_flags);
192extern int fib_table_insert(struct fib_table *, struct fib_config *); 192int fib_table_insert(struct fib_table *, struct fib_config *);
193extern int fib_table_delete(struct fib_table *, struct fib_config *); 193int fib_table_delete(struct fib_table *, struct fib_config *);
194extern int fib_table_dump(struct fib_table *table, struct sk_buff *skb, 194int fib_table_dump(struct fib_table *table, struct sk_buff *skb,
195 struct netlink_callback *cb); 195 struct netlink_callback *cb);
196extern int fib_table_flush(struct fib_table *table); 196int fib_table_flush(struct fib_table *table);
197extern void fib_free_table(struct fib_table *tb); 197void fib_free_table(struct fib_table *tb);
198 198
199 199
200 200
@@ -234,14 +234,13 @@ static inline int fib_lookup(struct net *net, const struct flowi4 *flp,
234} 234}
235 235
236#else /* CONFIG_IP_MULTIPLE_TABLES */ 236#else /* CONFIG_IP_MULTIPLE_TABLES */
237extern int __net_init fib4_rules_init(struct net *net); 237int __net_init fib4_rules_init(struct net *net);
238extern void __net_exit fib4_rules_exit(struct net *net); 238void __net_exit fib4_rules_exit(struct net *net);
239 239
240extern struct fib_table *fib_new_table(struct net *net, u32 id); 240struct fib_table *fib_new_table(struct net *net, u32 id);
241extern struct fib_table *fib_get_table(struct net *net, u32 id); 241struct fib_table *fib_get_table(struct net *net, u32 id);
242 242
243extern int __fib_lookup(struct net *net, struct flowi4 *flp, 243int __fib_lookup(struct net *net, struct flowi4 *flp, struct fib_result *res);
244 struct fib_result *res);
245 244
246static inline int fib_lookup(struct net *net, struct flowi4 *flp, 245static inline int fib_lookup(struct net *net, struct flowi4 *flp,
247 struct fib_result *res) 246 struct fib_result *res)
@@ -269,12 +268,12 @@ static inline int fib_lookup(struct net *net, struct flowi4 *flp,
269 268
270/* Exported by fib_frontend.c */ 269/* Exported by fib_frontend.c */
271extern const struct nla_policy rtm_ipv4_policy[]; 270extern const struct nla_policy rtm_ipv4_policy[];
272extern void ip_fib_init(void); 271void ip_fib_init(void);
273extern __be32 fib_compute_spec_dst(struct sk_buff *skb); 272__be32 fib_compute_spec_dst(struct sk_buff *skb);
274extern int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, 273int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
275 u8 tos, int oif, struct net_device *dev, 274 u8 tos, int oif, struct net_device *dev,
276 struct in_device *idev, u32 *itag); 275 struct in_device *idev, u32 *itag);
277extern void fib_select_default(struct fib_result *res); 276void fib_select_default(struct fib_result *res);
278#ifdef CONFIG_IP_ROUTE_CLASSID 277#ifdef CONFIG_IP_ROUTE_CLASSID
279static inline int fib_num_tclassid_users(struct net *net) 278static inline int fib_num_tclassid_users(struct net *net)
280{ 279{
@@ -288,15 +287,15 @@ static inline int fib_num_tclassid_users(struct net *net)
288#endif 287#endif
289 288
290/* Exported by fib_semantics.c */ 289/* Exported by fib_semantics.c */
291extern int ip_fib_check_default(__be32 gw, struct net_device *dev); 290int ip_fib_check_default(__be32 gw, struct net_device *dev);
292extern int fib_sync_down_dev(struct net_device *dev, int force); 291int fib_sync_down_dev(struct net_device *dev, int force);
293extern int fib_sync_down_addr(struct net *net, __be32 local); 292int fib_sync_down_addr(struct net *net, __be32 local);
294extern int fib_sync_up(struct net_device *dev); 293int fib_sync_up(struct net_device *dev);
295extern void fib_select_multipath(struct fib_result *res); 294void fib_select_multipath(struct fib_result *res);
296 295
297/* Exported by fib_trie.c */ 296/* Exported by fib_trie.c */
298extern void fib_trie_init(void); 297void fib_trie_init(void);
299extern struct fib_table *fib_trie_table(u32 id); 298struct fib_table *fib_trie_table(u32 id);
300 299
301static inline void fib_combine_itag(u32 *itag, const struct fib_result *res) 300static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
302{ 301{
@@ -314,7 +313,7 @@ static inline void fib_combine_itag(u32 *itag, const struct fib_result *res)
314#endif 313#endif
315} 314}
316 315
317extern void free_fib_info(struct fib_info *fi); 316void free_fib_info(struct fib_info *fi);
318 317
319static inline void fib_info_put(struct fib_info *fi) 318static inline void fib_info_put(struct fib_info *fi)
320{ 319{
@@ -323,8 +322,8 @@ static inline void fib_info_put(struct fib_info *fi)
323} 322}
324 323
325#ifdef CONFIG_PROC_FS 324#ifdef CONFIG_PROC_FS
326extern int __net_init fib_proc_init(struct net *net); 325int __net_init fib_proc_init(struct net *net);
327extern void __net_exit fib_proc_exit(struct net *net); 326void __net_exit fib_proc_exit(struct net *net);
328#else 327#else
329static inline int fib_proc_init(struct net *net) 328static inline int fib_proc_init(struct net *net)
330{ 329{
diff --git a/include/net/ip_tunnels.h b/include/net/ip_tunnels.h
index a0a4a100f5c9..732f8c6ae975 100644
--- a/include/net/ip_tunnels.h
+++ b/include/net/ip_tunnels.h
@@ -150,6 +150,9 @@ int iptunnel_xmit(struct rtable *rt, struct sk_buff *skb,
150 __be32 src, __be32 dst, __u8 proto, 150 __be32 src, __be32 dst, __u8 proto,
151 __u8 tos, __u8 ttl, __be16 df, bool xnet); 151 __u8 tos, __u8 ttl, __be16 df, bool xnet);
152 152
153struct sk_buff *iptunnel_handle_offloads(struct sk_buff *skb, bool gre_csum,
154 int gso_type_mask);
155
153static inline void iptunnel_xmit_stats(int err, 156static inline void iptunnel_xmit_stats(int err,
154 struct net_device_stats *err_stats, 157 struct net_device_stats *err_stats,
155 struct pcpu_tstats __percpu *stats) 158 struct pcpu_tstats __percpu *stats)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 9c4d37ec45a1..5679d927562b 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -109,7 +109,6 @@ extern int ip_vs_conn_tab_size;
109struct ip_vs_iphdr { 109struct ip_vs_iphdr {
110 __u32 len; /* IPv4 simply where L4 starts 110 __u32 len; /* IPv4 simply where L4 starts
111 IPv6 where L4 Transport Header starts */ 111 IPv6 where L4 Transport Header starts */
112 __u32 thoff_reasm; /* Transport Header Offset in nfct_reasm skb */
113 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/ 112 __u16 fragoffs; /* IPv6 fragment offset, 0 if first frag (or not frag)*/
114 __s16 protocol; 113 __s16 protocol;
115 __s32 flags; 114 __s32 flags;
@@ -117,34 +116,12 @@ struct ip_vs_iphdr {
117 union nf_inet_addr daddr; 116 union nf_inet_addr daddr;
118}; 117};
119 118
120/* Dependency to module: nf_defrag_ipv6 */
121#if defined(CONFIG_NF_DEFRAG_IPV6) || defined(CONFIG_NF_DEFRAG_IPV6_MODULE)
122static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb)
123{
124 return skb->nfct_reasm;
125}
126static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset, 119static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
127 int len, void *buffer, 120 int len, void *buffer,
128 const struct ip_vs_iphdr *ipvsh) 121 const struct ip_vs_iphdr *ipvsh)
129{ 122{
130 if (unlikely(ipvsh->fragoffs && skb_nfct_reasm(skb)))
131 return skb_header_pointer(skb_nfct_reasm(skb),
132 ipvsh->thoff_reasm, len, buffer);
133
134 return skb_header_pointer(skb, offset, len, buffer); 123 return skb_header_pointer(skb, offset, len, buffer);
135} 124}
136#else
137static inline struct sk_buff *skb_nfct_reasm(const struct sk_buff *skb)
138{
139 return NULL;
140}
141static inline void *frag_safe_skb_hp(const struct sk_buff *skb, int offset,
142 int len, void *buffer,
143 const struct ip_vs_iphdr *ipvsh)
144{
145 return skb_header_pointer(skb, offset, len, buffer);
146}
147#endif
148 125
149static inline void 126static inline void
150ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr) 127ip_vs_fill_ip4hdr(const void *nh, struct ip_vs_iphdr *iphdr)
@@ -171,19 +148,12 @@ ip_vs_fill_iph_skb(int af, const struct sk_buff *skb, struct ip_vs_iphdr *iphdr)
171 (struct ipv6hdr *)skb_network_header(skb); 148 (struct ipv6hdr *)skb_network_header(skb);
172 iphdr->saddr.in6 = iph->saddr; 149 iphdr->saddr.in6 = iph->saddr;
173 iphdr->daddr.in6 = iph->daddr; 150 iphdr->daddr.in6 = iph->daddr;
174 /* ipv6_find_hdr() updates len, flags, thoff_reasm */ 151 /* ipv6_find_hdr() updates len, flags */
175 iphdr->thoff_reasm = 0;
176 iphdr->len = 0; 152 iphdr->len = 0;
177 iphdr->flags = 0; 153 iphdr->flags = 0;
178 iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1, 154 iphdr->protocol = ipv6_find_hdr(skb, &iphdr->len, -1,
179 &iphdr->fragoffs, 155 &iphdr->fragoffs,
180 &iphdr->flags); 156 &iphdr->flags);
181 /* get proto from re-assembled packet and it's offset */
182 if (skb_nfct_reasm(skb))
183 iphdr->protocol = ipv6_find_hdr(skb_nfct_reasm(skb),
184 &iphdr->thoff_reasm,
185 -1, NULL, NULL);
186
187 } else 157 } else
188#endif 158#endif
189 { 159 {
@@ -236,7 +206,7 @@ static inline int ip_vs_addr_equal(int af, const union nf_inet_addr *a,
236#ifdef CONFIG_IP_VS_DEBUG 206#ifdef CONFIG_IP_VS_DEBUG
237#include <linux/net.h> 207#include <linux/net.h>
238 208
239extern int ip_vs_get_debug_level(void); 209int ip_vs_get_debug_level(void);
240 210
241static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len, 211static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
242 const union nf_inet_addr *addr, 212 const union nf_inet_addr *addr,
@@ -532,9 +502,9 @@ struct ip_vs_proto_data {
532 struct tcp_states_t *tcp_state_table; 502 struct tcp_states_t *tcp_state_table;
533}; 503};
534 504
535extern struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto); 505struct ip_vs_protocol *ip_vs_proto_get(unsigned short proto);
536extern struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net, 506struct ip_vs_proto_data *ip_vs_proto_data_get(struct net *net,
537 unsigned short proto); 507 unsigned short proto);
538 508
539struct ip_vs_conn_param { 509struct ip_vs_conn_param {
540 struct net *net; 510 struct net *net;
@@ -1173,8 +1143,8 @@ static inline int sysctl_backup_only(struct netns_ipvs *ipvs)
1173 * IPVS core functions 1143 * IPVS core functions
1174 * (from ip_vs_core.c) 1144 * (from ip_vs_core.c)
1175 */ 1145 */
1176extern const char *ip_vs_proto_name(unsigned int proto); 1146const char *ip_vs_proto_name(unsigned int proto);
1177extern void ip_vs_init_hash_table(struct list_head *table, int rows); 1147void ip_vs_init_hash_table(struct list_head *table, int rows);
1178#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t))) 1148#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t)))
1179 1149
1180#define IP_VS_APP_TYPE_FTP 1 1150#define IP_VS_APP_TYPE_FTP 1
@@ -1237,22 +1207,22 @@ static inline void __ip_vs_conn_put(struct ip_vs_conn *cp)
1237 smp_mb__before_atomic_dec(); 1207 smp_mb__before_atomic_dec();
1238 atomic_dec(&cp->refcnt); 1208 atomic_dec(&cp->refcnt);
1239} 1209}
1240extern void ip_vs_conn_put(struct ip_vs_conn *cp); 1210void ip_vs_conn_put(struct ip_vs_conn *cp);
1241extern void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport); 1211void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport);
1242 1212
1243struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p, 1213struct ip_vs_conn *ip_vs_conn_new(const struct ip_vs_conn_param *p,
1244 const union nf_inet_addr *daddr, 1214 const union nf_inet_addr *daddr,
1245 __be16 dport, unsigned int flags, 1215 __be16 dport, unsigned int flags,
1246 struct ip_vs_dest *dest, __u32 fwmark); 1216 struct ip_vs_dest *dest, __u32 fwmark);
1247extern void ip_vs_conn_expire_now(struct ip_vs_conn *cp); 1217void ip_vs_conn_expire_now(struct ip_vs_conn *cp);
1248 1218
1249extern const char * ip_vs_state_name(__u16 proto, int state); 1219const char *ip_vs_state_name(__u16 proto, int state);
1250 1220
1251extern void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp); 1221void ip_vs_tcp_conn_listen(struct net *net, struct ip_vs_conn *cp);
1252extern int ip_vs_check_template(struct ip_vs_conn *ct); 1222int ip_vs_check_template(struct ip_vs_conn *ct);
1253extern void ip_vs_random_dropentry(struct net *net); 1223void ip_vs_random_dropentry(struct net *net);
1254extern int ip_vs_conn_init(void); 1224int ip_vs_conn_init(void);
1255extern void ip_vs_conn_cleanup(void); 1225void ip_vs_conn_cleanup(void);
1256 1226
1257static inline void ip_vs_control_del(struct ip_vs_conn *cp) 1227static inline void ip_vs_control_del(struct ip_vs_conn *cp)
1258{ 1228{
@@ -1317,37 +1287,36 @@ ip_vs_control_add(struct ip_vs_conn *cp, struct ip_vs_conn *ctl_cp)
1317/* 1287/*
1318 * IPVS netns init & cleanup functions 1288 * IPVS netns init & cleanup functions
1319 */ 1289 */
1320extern int ip_vs_estimator_net_init(struct net *net); 1290int ip_vs_estimator_net_init(struct net *net);
1321extern int ip_vs_control_net_init(struct net *net); 1291int ip_vs_control_net_init(struct net *net);
1322extern int ip_vs_protocol_net_init(struct net *net); 1292int ip_vs_protocol_net_init(struct net *net);
1323extern int ip_vs_app_net_init(struct net *net); 1293int ip_vs_app_net_init(struct net *net);
1324extern int ip_vs_conn_net_init(struct net *net); 1294int ip_vs_conn_net_init(struct net *net);
1325extern int ip_vs_sync_net_init(struct net *net); 1295int ip_vs_sync_net_init(struct net *net);
1326extern void ip_vs_conn_net_cleanup(struct net *net); 1296void ip_vs_conn_net_cleanup(struct net *net);
1327extern void ip_vs_app_net_cleanup(struct net *net); 1297void ip_vs_app_net_cleanup(struct net *net);
1328extern void ip_vs_protocol_net_cleanup(struct net *net); 1298void ip_vs_protocol_net_cleanup(struct net *net);
1329extern void ip_vs_control_net_cleanup(struct net *net); 1299void ip_vs_control_net_cleanup(struct net *net);
1330extern void ip_vs_estimator_net_cleanup(struct net *net); 1300void ip_vs_estimator_net_cleanup(struct net *net);
1331extern void ip_vs_sync_net_cleanup(struct net *net); 1301void ip_vs_sync_net_cleanup(struct net *net);
1332extern void ip_vs_service_net_cleanup(struct net *net); 1302void ip_vs_service_net_cleanup(struct net *net);
1333 1303
1334/* 1304/*
1335 * IPVS application functions 1305 * IPVS application functions
1336 * (from ip_vs_app.c) 1306 * (from ip_vs_app.c)
1337 */ 1307 */
1338#define IP_VS_APP_MAX_PORTS 8 1308#define IP_VS_APP_MAX_PORTS 8
1339extern struct ip_vs_app *register_ip_vs_app(struct net *net, 1309struct ip_vs_app *register_ip_vs_app(struct net *net, struct ip_vs_app *app);
1340 struct ip_vs_app *app); 1310void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app);
1341extern void unregister_ip_vs_app(struct net *net, struct ip_vs_app *app); 1311int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp);
1342extern int ip_vs_bind_app(struct ip_vs_conn *cp, struct ip_vs_protocol *pp); 1312void ip_vs_unbind_app(struct ip_vs_conn *cp);
1343extern void ip_vs_unbind_app(struct ip_vs_conn *cp); 1313int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, __u16 proto,
1344extern int register_ip_vs_app_inc(struct net *net, struct ip_vs_app *app, 1314 __u16 port);
1345 __u16 proto, __u16 port); 1315int ip_vs_app_inc_get(struct ip_vs_app *inc);
1346extern int ip_vs_app_inc_get(struct ip_vs_app *inc); 1316void ip_vs_app_inc_put(struct ip_vs_app *inc);
1347extern void ip_vs_app_inc_put(struct ip_vs_app *inc); 1317
1348 1318int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb);
1349extern int ip_vs_app_pkt_out(struct ip_vs_conn *, struct sk_buff *skb); 1319int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
1350extern int ip_vs_app_pkt_in(struct ip_vs_conn *, struct sk_buff *skb);
1351 1320
1352int register_ip_vs_pe(struct ip_vs_pe *pe); 1321int register_ip_vs_pe(struct ip_vs_pe *pe);
1353int unregister_ip_vs_pe(struct ip_vs_pe *pe); 1322int unregister_ip_vs_pe(struct ip_vs_pe *pe);
@@ -1368,17 +1337,15 @@ struct ip_vs_pe *__ip_vs_pe_getbyname(const char *pe_name);
1368/* 1337/*
1369 * IPVS protocol functions (from ip_vs_proto.c) 1338 * IPVS protocol functions (from ip_vs_proto.c)
1370 */ 1339 */
1371extern int ip_vs_protocol_init(void); 1340int ip_vs_protocol_init(void);
1372extern void ip_vs_protocol_cleanup(void); 1341void ip_vs_protocol_cleanup(void);
1373extern void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags); 1342void ip_vs_protocol_timeout_change(struct netns_ipvs *ipvs, int flags);
1374extern int *ip_vs_create_timeout_table(int *table, int size); 1343int *ip_vs_create_timeout_table(int *table, int size);
1375extern int 1344int ip_vs_set_state_timeout(int *table, int num, const char *const *names,
1376ip_vs_set_state_timeout(int *table, int num, const char *const *names, 1345 const char *name, int to);
1377 const char *name, int to); 1346void ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp,
1378extern void 1347 const struct sk_buff *skb, int offset,
1379ip_vs_tcpudp_debug_packet(int af, struct ip_vs_protocol *pp, 1348 const char *msg);
1380 const struct sk_buff *skb,
1381 int offset, const char *msg);
1382 1349
1383extern struct ip_vs_protocol ip_vs_protocol_tcp; 1350extern struct ip_vs_protocol ip_vs_protocol_tcp;
1384extern struct ip_vs_protocol ip_vs_protocol_udp; 1351extern struct ip_vs_protocol ip_vs_protocol_udp;
@@ -1391,22 +1358,22 @@ extern struct ip_vs_protocol ip_vs_protocol_sctp;
1391 * Registering/unregistering scheduler functions 1358 * Registering/unregistering scheduler functions
1392 * (from ip_vs_sched.c) 1359 * (from ip_vs_sched.c)
1393 */ 1360 */
1394extern int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1361int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1395extern int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler); 1362int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler);
1396extern int ip_vs_bind_scheduler(struct ip_vs_service *svc, 1363int ip_vs_bind_scheduler(struct ip_vs_service *svc,
1397 struct ip_vs_scheduler *scheduler); 1364 struct ip_vs_scheduler *scheduler);
1398extern void ip_vs_unbind_scheduler(struct ip_vs_service *svc, 1365void ip_vs_unbind_scheduler(struct ip_vs_service *svc,
1399 struct ip_vs_scheduler *sched); 1366 struct ip_vs_scheduler *sched);
1400extern struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name); 1367struct ip_vs_scheduler *ip_vs_scheduler_get(const char *sched_name);
1401extern void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler); 1368void ip_vs_scheduler_put(struct ip_vs_scheduler *scheduler);
1402extern struct ip_vs_conn * 1369struct ip_vs_conn *
1403ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb, 1370ip_vs_schedule(struct ip_vs_service *svc, struct sk_buff *skb,
1404 struct ip_vs_proto_data *pd, int *ignored, 1371 struct ip_vs_proto_data *pd, int *ignored,
1405 struct ip_vs_iphdr *iph); 1372 struct ip_vs_iphdr *iph);
1406extern int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb, 1373int ip_vs_leave(struct ip_vs_service *svc, struct sk_buff *skb,
1407 struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph); 1374 struct ip_vs_proto_data *pd, struct ip_vs_iphdr *iph);
1408 1375
1409extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg); 1376void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1410 1377
1411 1378
1412/* 1379/*
@@ -1415,25 +1382,24 @@ extern void ip_vs_scheduler_err(struct ip_vs_service *svc, const char *msg);
1415extern struct ip_vs_stats ip_vs_stats; 1382extern struct ip_vs_stats ip_vs_stats;
1416extern int sysctl_ip_vs_sync_ver; 1383extern int sysctl_ip_vs_sync_ver;
1417 1384
1418extern struct ip_vs_service * 1385struct ip_vs_service *
1419ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol, 1386ip_vs_service_find(struct net *net, int af, __u32 fwmark, __u16 protocol,
1420 const union nf_inet_addr *vaddr, __be16 vport); 1387 const union nf_inet_addr *vaddr, __be16 vport);
1421 1388
1422extern bool 1389bool ip_vs_has_real_service(struct net *net, int af, __u16 protocol,
1423ip_vs_has_real_service(struct net *net, int af, __u16 protocol, 1390 const union nf_inet_addr *daddr, __be16 dport);
1424 const union nf_inet_addr *daddr, __be16 dport); 1391
1425 1392int ip_vs_use_count_inc(void);
1426extern int ip_vs_use_count_inc(void); 1393void ip_vs_use_count_dec(void);
1427extern void ip_vs_use_count_dec(void); 1394int ip_vs_register_nl_ioctl(void);
1428extern int ip_vs_register_nl_ioctl(void); 1395void ip_vs_unregister_nl_ioctl(void);
1429extern void ip_vs_unregister_nl_ioctl(void); 1396int ip_vs_control_init(void);
1430extern int ip_vs_control_init(void); 1397void ip_vs_control_cleanup(void);
1431extern void ip_vs_control_cleanup(void); 1398struct ip_vs_dest *
1432extern struct ip_vs_dest *
1433ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr, 1399ip_vs_find_dest(struct net *net, int af, const union nf_inet_addr *daddr,
1434 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport, 1400 __be16 dport, const union nf_inet_addr *vaddr, __be16 vport,
1435 __u16 protocol, __u32 fwmark, __u32 flags); 1401 __u16 protocol, __u32 fwmark, __u32 flags);
1436extern void ip_vs_try_bind_dest(struct ip_vs_conn *cp); 1402void ip_vs_try_bind_dest(struct ip_vs_conn *cp);
1437 1403
1438static inline void ip_vs_dest_hold(struct ip_vs_dest *dest) 1404static inline void ip_vs_dest_hold(struct ip_vs_dest *dest)
1439{ 1405{
@@ -1446,60 +1412,59 @@ static inline void ip_vs_dest_put(struct ip_vs_dest *dest)
1446 atomic_dec(&dest->refcnt); 1412 atomic_dec(&dest->refcnt);
1447} 1413}
1448 1414
1415static inline void ip_vs_dest_put_and_free(struct ip_vs_dest *dest)
1416{
1417 if (atomic_dec_return(&dest->refcnt) < 0)
1418 kfree(dest);
1419}
1420
1449/* 1421/*
1450 * IPVS sync daemon data and function prototypes 1422 * IPVS sync daemon data and function prototypes
1451 * (from ip_vs_sync.c) 1423 * (from ip_vs_sync.c)
1452 */ 1424 */
1453extern int start_sync_thread(struct net *net, int state, char *mcast_ifn, 1425int start_sync_thread(struct net *net, int state, char *mcast_ifn, __u8 syncid);
1454 __u8 syncid); 1426int stop_sync_thread(struct net *net, int state);
1455extern int stop_sync_thread(struct net *net, int state); 1427void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1456extern void ip_vs_sync_conn(struct net *net, struct ip_vs_conn *cp, int pkts);
1457
1458 1428
1459/* 1429/*
1460 * IPVS rate estimator prototypes (from ip_vs_est.c) 1430 * IPVS rate estimator prototypes (from ip_vs_est.c)
1461 */ 1431 */
1462extern void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats); 1432void ip_vs_start_estimator(struct net *net, struct ip_vs_stats *stats);
1463extern void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats); 1433void ip_vs_stop_estimator(struct net *net, struct ip_vs_stats *stats);
1464extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); 1434void ip_vs_zero_estimator(struct ip_vs_stats *stats);
1465extern void ip_vs_read_estimator(struct ip_vs_stats_user *dst, 1435void ip_vs_read_estimator(struct ip_vs_stats_user *dst,
1466 struct ip_vs_stats *stats); 1436 struct ip_vs_stats *stats);
1467 1437
1468/* 1438/*
1469 * Various IPVS packet transmitters (from ip_vs_xmit.c) 1439 * Various IPVS packet transmitters (from ip_vs_xmit.c)
1470 */ 1440 */
1471extern int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1441int ip_vs_null_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1472 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1442 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1473extern int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1443int ip_vs_bypass_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1474 struct ip_vs_protocol *pp, 1444 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1475 struct ip_vs_iphdr *iph); 1445int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1476extern int ip_vs_nat_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1446 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1477 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1447int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1478extern int ip_vs_tunnel_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1448 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1479 struct ip_vs_protocol *pp, 1449int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1480 struct ip_vs_iphdr *iph); 1450 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1481extern int ip_vs_dr_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1451int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp,
1482 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1452 struct ip_vs_protocol *pp, int offset,
1483extern int ip_vs_icmp_xmit(struct sk_buff *skb, struct ip_vs_conn *cp, 1453 unsigned int hooknum, struct ip_vs_iphdr *iph);
1484 struct ip_vs_protocol *pp, int offset, 1454void ip_vs_dest_dst_rcu_free(struct rcu_head *head);
1485 unsigned int hooknum, struct ip_vs_iphdr *iph);
1486extern void ip_vs_dest_dst_rcu_free(struct rcu_head *head);
1487 1455
1488#ifdef CONFIG_IP_VS_IPV6 1456#ifdef CONFIG_IP_VS_IPV6
1489extern int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1457int ip_vs_bypass_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1490 struct ip_vs_protocol *pp, 1458 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1491 struct ip_vs_iphdr *iph); 1459int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1492extern int ip_vs_nat_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1460 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1493 struct ip_vs_protocol *pp, 1461int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1494 struct ip_vs_iphdr *iph); 1462 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1495extern int ip_vs_tunnel_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1463int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1496 struct ip_vs_protocol *pp, 1464 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph);
1497 struct ip_vs_iphdr *iph); 1465int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1498extern int ip_vs_dr_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp, 1466 struct ip_vs_protocol *pp, int offset,
1499 struct ip_vs_protocol *pp, struct ip_vs_iphdr *iph); 1467 unsigned int hooknum, struct ip_vs_iphdr *iph);
1500extern int ip_vs_icmp_xmit_v6(struct sk_buff *skb, struct ip_vs_conn *cp,
1501 struct ip_vs_protocol *pp, int offset,
1502 unsigned int hooknum, struct ip_vs_iphdr *iph);
1503#endif 1468#endif
1504 1469
1505#ifdef CONFIG_SYSCTL 1470#ifdef CONFIG_SYSCTL
@@ -1548,15 +1513,15 @@ static inline char ip_vs_fwd_tag(struct ip_vs_conn *cp)
1548 return fwd; 1513 return fwd;
1549} 1514}
1550 1515
1551extern void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp, 1516void ip_vs_nat_icmp(struct sk_buff *skb, struct ip_vs_protocol *pp,
1552 struct ip_vs_conn *cp, int dir); 1517 struct ip_vs_conn *cp, int dir);
1553 1518
1554#ifdef CONFIG_IP_VS_IPV6 1519#ifdef CONFIG_IP_VS_IPV6
1555extern void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp, 1520void ip_vs_nat_icmp_v6(struct sk_buff *skb, struct ip_vs_protocol *pp,
1556 struct ip_vs_conn *cp, int dir); 1521 struct ip_vs_conn *cp, int dir);
1557#endif 1522#endif
1558 1523
1559extern __sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset); 1524__sum16 ip_vs_checksum_complete(struct sk_buff *skb, int offset);
1560 1525
1561static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum) 1526static inline __wsum ip_vs_check_diff4(__be32 old, __be32 new, __wsum oldsum)
1562{ 1527{
@@ -1615,13 +1580,13 @@ static inline int ip_vs_conntrack_enabled(struct netns_ipvs *ipvs)
1615#endif 1580#endif
1616} 1581}
1617 1582
1618extern void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp, 1583void ip_vs_update_conntrack(struct sk_buff *skb, struct ip_vs_conn *cp,
1619 int outin); 1584 int outin);
1620extern int ip_vs_confirm_conntrack(struct sk_buff *skb); 1585int ip_vs_confirm_conntrack(struct sk_buff *skb);
1621extern void ip_vs_nfct_expect_related(struct sk_buff *skb, struct nf_conn *ct, 1586void ip_vs_nfct_expect_related(struct sk_buff *skb, struct nf_conn *ct,
1622 struct ip_vs_conn *cp, u_int8_t proto, 1587 struct ip_vs_conn *cp, u_int8_t proto,
1623 const __be16 port, int from_rs); 1588 const __be16 port, int from_rs);
1624extern void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp); 1589void ip_vs_conn_drop_conntrack(struct ip_vs_conn *cp);
1625 1590
1626#else 1591#else
1627 1592
diff --git a/include/net/ipv6.h b/include/net/ipv6.h
index bbf1c8fb8511..2a5f668cd683 100644
--- a/include/net/ipv6.h
+++ b/include/net/ipv6.h
@@ -244,14 +244,15 @@ struct ipv6_fl_socklist {
244 struct rcu_head rcu; 244 struct rcu_head rcu;
245}; 245};
246 246
247extern struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label); 247struct ip6_flowlabel *fl6_sock_lookup(struct sock *sk, __be32 label);
248extern struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions * opt_space, 248struct ipv6_txoptions *fl6_merge_options(struct ipv6_txoptions *opt_space,
249 struct ip6_flowlabel * fl, 249 struct ip6_flowlabel *fl,
250 struct ipv6_txoptions * fopt); 250 struct ipv6_txoptions *fopt);
251extern void fl6_free_socklist(struct sock *sk); 251void fl6_free_socklist(struct sock *sk);
252extern int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen); 252int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen);
253extern int ip6_flowlabel_init(void); 253int ipv6_flowlabel_opt_get(struct sock *sk, struct in6_flowlabel_req *freq);
254extern void ip6_flowlabel_cleanup(void); 254int ip6_flowlabel_init(void);
255void ip6_flowlabel_cleanup(void);
255 256
256static inline void fl6_sock_release(struct ip6_flowlabel *fl) 257static inline void fl6_sock_release(struct ip6_flowlabel *fl)
257{ 258{
@@ -259,7 +260,7 @@ static inline void fl6_sock_release(struct ip6_flowlabel *fl)
259 atomic_dec(&fl->users); 260 atomic_dec(&fl->users);
260} 261}
261 262
262extern void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info); 263void icmpv6_notify(struct sk_buff *skb, u8 type, u8 code, __be32 info);
263 264
264int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6, 265int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
265 struct icmp6hdr *thdr, int len); 266 struct icmp6hdr *thdr, int len);
@@ -267,19 +268,21 @@ int icmpv6_push_pending_frames(struct sock *sk, struct flowi6 *fl6,
267struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb, 268struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb,
268 struct sock *sk, struct flowi6 *fl6); 269 struct sock *sk, struct flowi6 *fl6);
269 270
270extern int ip6_ra_control(struct sock *sk, int sel); 271int ip6_ra_control(struct sock *sk, int sel);
271 272
272extern int ipv6_parse_hopopts(struct sk_buff *skb); 273int ipv6_parse_hopopts(struct sk_buff *skb);
273 274
274extern struct ipv6_txoptions * ipv6_dup_options(struct sock *sk, struct ipv6_txoptions *opt); 275struct ipv6_txoptions *ipv6_dup_options(struct sock *sk,
275extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_txoptions *opt, 276 struct ipv6_txoptions *opt);
276 int newtype, 277struct ipv6_txoptions *ipv6_renew_options(struct sock *sk,
277 struct ipv6_opt_hdr __user *newopt, 278 struct ipv6_txoptions *opt,
278 int newoptlen); 279 int newtype,
280 struct ipv6_opt_hdr __user *newopt,
281 int newoptlen);
279struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, 282struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space,
280 struct ipv6_txoptions *opt); 283 struct ipv6_txoptions *opt);
281 284
282extern bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb); 285bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb);
283 286
284static inline bool ipv6_accept_ra(struct inet6_dev *idev) 287static inline bool ipv6_accept_ra(struct inet6_dev *idev)
285{ 288{
@@ -306,7 +309,7 @@ static inline int ip6_frag_mem(struct net *net)
306#define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */ 309#define IPV6_FRAG_LOW_THRESH (3 * 1024*1024) /* 3145728 */
307#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */ 310#define IPV6_FRAG_TIMEOUT (60 * HZ) /* 60 seconds */
308 311
309extern int __ipv6_addr_type(const struct in6_addr *addr); 312int __ipv6_addr_type(const struct in6_addr *addr);
310static inline int ipv6_addr_type(const struct in6_addr *addr) 313static inline int ipv6_addr_type(const struct in6_addr *addr)
311{ 314{
312 return __ipv6_addr_type(addr) & 0xffff; 315 return __ipv6_addr_type(addr) & 0xffff;
@@ -537,14 +540,14 @@ static inline u32 ipv6_addr_hash(const struct in6_addr *a)
537} 540}
538 541
539/* more secured version of ipv6_addr_hash() */ 542/* more secured version of ipv6_addr_hash() */
540static inline u32 ipv6_addr_jhash(const struct in6_addr *a) 543static inline u32 __ipv6_addr_jhash(const struct in6_addr *a, const u32 initval)
541{ 544{
542 u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1]; 545 u32 v = (__force u32)a->s6_addr32[0] ^ (__force u32)a->s6_addr32[1];
543 546
544 return jhash_3words(v, 547 return jhash_3words(v,
545 (__force u32)a->s6_addr32[2], 548 (__force u32)a->s6_addr32[2],
546 (__force u32)a->s6_addr32[3], 549 (__force u32)a->s6_addr32[3],
547 ipv6_hash_secret); 550 initval);
548} 551}
549 552
550static inline bool ipv6_addr_loopback(const struct in6_addr *a) 553static inline bool ipv6_addr_loopback(const struct in6_addr *a)
@@ -656,9 +659,9 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
656 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr)); 659 return __ipv6_addr_diff(a1, a2, sizeof(struct in6_addr));
657} 660}
658 661
659extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt); 662void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
660 663
661extern int ip6_dst_hoplimit(struct dst_entry *dst); 664int ip6_dst_hoplimit(struct dst_entry *dst);
662 665
663/* 666/*
664 * Header manipulation 667 * Header manipulation
@@ -682,83 +685,65 @@ static inline __be32 ip6_flowinfo(const struct ipv6hdr *hdr)
682 * rcv function (called from netdevice level) 685 * rcv function (called from netdevice level)
683 */ 686 */
684 687
685extern int ipv6_rcv(struct sk_buff *skb, 688int ipv6_rcv(struct sk_buff *skb, struct net_device *dev,
686 struct net_device *dev, 689 struct packet_type *pt, struct net_device *orig_dev);
687 struct packet_type *pt,
688 struct net_device *orig_dev);
689 690
690extern int ip6_rcv_finish(struct sk_buff *skb); 691int ip6_rcv_finish(struct sk_buff *skb);
691 692
692/* 693/*
693 * upper-layer output functions 694 * upper-layer output functions
694 */ 695 */
695extern int ip6_xmit(struct sock *sk, 696int ip6_xmit(struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6,
696 struct sk_buff *skb, 697 struct ipv6_txoptions *opt, int tclass);
697 struct flowi6 *fl6, 698
698 struct ipv6_txoptions *opt, 699int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr);
699 int tclass); 700
700 701int ip6_append_data(struct sock *sk,
701extern int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nexthdr); 702 int getfrag(void *from, char *to, int offset, int len,
702 703 int odd, struct sk_buff *skb),
703extern int ip6_append_data(struct sock *sk, 704 void *from, int length, int transhdrlen, int hlimit,
704 int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), 705 int tclass, struct ipv6_txoptions *opt, struct flowi6 *fl6,
705 void *from, 706 struct rt6_info *rt, unsigned int flags, int dontfrag);
706 int length, 707
707 int transhdrlen, 708int ip6_push_pending_frames(struct sock *sk);
708 int hlimit, 709
709 int tclass, 710void ip6_flush_pending_frames(struct sock *sk);
710 struct ipv6_txoptions *opt, 711
711 struct flowi6 *fl6, 712int ip6_dst_lookup(struct sock *sk, struct dst_entry **dst, struct flowi6 *fl6);
712 struct rt6_info *rt, 713struct dst_entry *ip6_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
713 unsigned int flags, 714 const struct in6_addr *final_dst,
714 int dontfrag); 715 bool can_sleep);
715 716struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6,
716extern int ip6_push_pending_frames(struct sock *sk); 717 const struct in6_addr *final_dst,
717 718 bool can_sleep);
718extern void ip6_flush_pending_frames(struct sock *sk); 719struct dst_entry *ip6_blackhole_route(struct net *net,
719 720 struct dst_entry *orig_dst);
720extern int ip6_dst_lookup(struct sock *sk,
721 struct dst_entry **dst,
722 struct flowi6 *fl6);
723extern struct dst_entry * ip6_dst_lookup_flow(struct sock *sk,
724 struct flowi6 *fl6,
725 const struct in6_addr *final_dst,
726 bool can_sleep);
727extern struct dst_entry * ip6_sk_dst_lookup_flow(struct sock *sk,
728 struct flowi6 *fl6,
729 const struct in6_addr *final_dst,
730 bool can_sleep);
731extern struct dst_entry * ip6_blackhole_route(struct net *net,
732 struct dst_entry *orig_dst);
733 721
734/* 722/*
735 * skb processing functions 723 * skb processing functions
736 */ 724 */
737 725
738extern int ip6_output(struct sk_buff *skb); 726int ip6_output(struct sk_buff *skb);
739extern int ip6_forward(struct sk_buff *skb); 727int ip6_forward(struct sk_buff *skb);
740extern int ip6_input(struct sk_buff *skb); 728int ip6_input(struct sk_buff *skb);
741extern int ip6_mc_input(struct sk_buff *skb); 729int ip6_mc_input(struct sk_buff *skb);
742 730
743extern int __ip6_local_out(struct sk_buff *skb); 731int __ip6_local_out(struct sk_buff *skb);
744extern int ip6_local_out(struct sk_buff *skb); 732int ip6_local_out(struct sk_buff *skb);
745 733
746/* 734/*
747 * Extension header (options) processing 735 * Extension header (options) processing
748 */ 736 */
749 737
750extern void ipv6_push_nfrag_opts(struct sk_buff *skb, 738void ipv6_push_nfrag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt,
751 struct ipv6_txoptions *opt, 739 u8 *proto, struct in6_addr **daddr_p);
752 u8 *proto, 740void ipv6_push_frag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt,
753 struct in6_addr **daddr_p); 741 u8 *proto);
754extern void ipv6_push_frag_opts(struct sk_buff *skb,
755 struct ipv6_txoptions *opt,
756 u8 *proto);
757 742
758extern int ipv6_skip_exthdr(const struct sk_buff *, int start, 743int ipv6_skip_exthdr(const struct sk_buff *, int start, u8 *nexthdrp,
759 u8 *nexthdrp, __be16 *frag_offp); 744 __be16 *frag_offp);
760 745
761extern bool ipv6_ext_hdr(u8 nexthdr); 746bool ipv6_ext_hdr(u8 nexthdr);
762 747
763enum { 748enum {
764 IP6_FH_F_FRAG = (1 << 0), 749 IP6_FH_F_FRAG = (1 << 0),
@@ -767,57 +752,44 @@ enum {
767}; 752};
768 753
769/* find specified header and get offset to it */ 754/* find specified header and get offset to it */
770extern int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, 755int ipv6_find_hdr(const struct sk_buff *skb, unsigned int *offset, int target,
771 int target, unsigned short *fragoff, int *fragflg); 756 unsigned short *fragoff, int *fragflg);
772 757
773extern int ipv6_find_tlv(struct sk_buff *skb, int offset, int type); 758int ipv6_find_tlv(struct sk_buff *skb, int offset, int type);
774 759
775extern struct in6_addr *fl6_update_dst(struct flowi6 *fl6, 760struct in6_addr *fl6_update_dst(struct flowi6 *fl6,
776 const struct ipv6_txoptions *opt, 761 const struct ipv6_txoptions *opt,
777 struct in6_addr *orig); 762 struct in6_addr *orig);
778 763
779/* 764/*
780 * socket options (ipv6_sockglue.c) 765 * socket options (ipv6_sockglue.c)
781 */ 766 */
782 767
783extern int ipv6_setsockopt(struct sock *sk, int level, 768int ipv6_setsockopt(struct sock *sk, int level, int optname,
784 int optname, 769 char __user *optval, unsigned int optlen);
785 char __user *optval, 770int ipv6_getsockopt(struct sock *sk, int level, int optname,
786 unsigned int optlen); 771 char __user *optval, int __user *optlen);
787extern int ipv6_getsockopt(struct sock *sk, int level, 772int compat_ipv6_setsockopt(struct sock *sk, int level, int optname,
788 int optname, 773 char __user *optval, unsigned int optlen);
789 char __user *optval, 774int compat_ipv6_getsockopt(struct sock *sk, int level, int optname,
790 int __user *optlen); 775 char __user *optval, int __user *optlen);
791extern int compat_ipv6_setsockopt(struct sock *sk, 776
792 int level, 777int ip6_datagram_connect(struct sock *sk, struct sockaddr *addr, int addr_len);
793 int optname, 778
794 char __user *optval, 779int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len);
795 unsigned int optlen); 780int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len);
796extern int compat_ipv6_getsockopt(struct sock *sk, 781void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
797 int level, 782 u32 info, u8 *payload);
798 int optname, 783void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info);
799 char __user *optval, 784void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu);
800 int __user *optlen); 785
801 786int inet6_release(struct socket *sock);
802extern int ip6_datagram_connect(struct sock *sk, 787int inet6_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len);
803 struct sockaddr *addr, int addr_len); 788int inet6_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len,
804 789 int peer);
805extern int ipv6_recv_error(struct sock *sk, struct msghdr *msg, int len); 790int inet6_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
806extern int ipv6_recv_rxpmtu(struct sock *sk, struct msghdr *msg, int len); 791
807extern void ipv6_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port, 792int inet6_hash_connect(struct inet_timewait_death_row *death_row,
808 u32 info, u8 *payload);
809extern void ipv6_local_error(struct sock *sk, int err, struct flowi6 *fl6, u32 info);
810extern void ipv6_local_rxpmtu(struct sock *sk, struct flowi6 *fl6, u32 mtu);
811
812extern int inet6_release(struct socket *sock);
813extern int inet6_bind(struct socket *sock, struct sockaddr *uaddr,
814 int addr_len);
815extern int inet6_getname(struct socket *sock, struct sockaddr *uaddr,
816 int *uaddr_len, int peer);
817extern int inet6_ioctl(struct socket *sock, unsigned int cmd,
818 unsigned long arg);
819
820extern int inet6_hash_connect(struct inet_timewait_death_row *death_row,
821 struct sock *sk); 793 struct sock *sk);
822 794
823/* 795/*
@@ -829,30 +801,27 @@ extern const struct proto_ops inet6_dgram_ops;
829struct group_source_req; 801struct group_source_req;
830struct group_filter; 802struct group_filter;
831 803
832extern int ip6_mc_source(int add, int omode, struct sock *sk, 804int ip6_mc_source(int add, int omode, struct sock *sk,
833 struct group_source_req *pgsr); 805 struct group_source_req *pgsr);
834extern int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf); 806int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf);
835extern int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf, 807int ip6_mc_msfget(struct sock *sk, struct group_filter *gsf,
836 struct group_filter __user *optval, 808 struct group_filter __user *optval, int __user *optlen);
837 int __user *optlen);
838extern unsigned int inet6_hash_frag(__be32 id, const struct in6_addr *saddr,
839 const struct in6_addr *daddr, u32 rnd);
840 809
841#ifdef CONFIG_PROC_FS 810#ifdef CONFIG_PROC_FS
842extern int ac6_proc_init(struct net *net); 811int ac6_proc_init(struct net *net);
843extern void ac6_proc_exit(struct net *net); 812void ac6_proc_exit(struct net *net);
844extern int raw6_proc_init(void); 813int raw6_proc_init(void);
845extern void raw6_proc_exit(void); 814void raw6_proc_exit(void);
846extern int tcp6_proc_init(struct net *net); 815int tcp6_proc_init(struct net *net);
847extern void tcp6_proc_exit(struct net *net); 816void tcp6_proc_exit(struct net *net);
848extern int udp6_proc_init(struct net *net); 817int udp6_proc_init(struct net *net);
849extern void udp6_proc_exit(struct net *net); 818void udp6_proc_exit(struct net *net);
850extern int udplite6_proc_init(void); 819int udplite6_proc_init(void);
851extern void udplite6_proc_exit(void); 820void udplite6_proc_exit(void);
852extern int ipv6_misc_proc_init(void); 821int ipv6_misc_proc_init(void);
853extern void ipv6_misc_proc_exit(void); 822void ipv6_misc_proc_exit(void);
854extern int snmp6_register_dev(struct inet6_dev *idev); 823int snmp6_register_dev(struct inet6_dev *idev);
855extern int snmp6_unregister_dev(struct inet6_dev *idev); 824int snmp6_unregister_dev(struct inet6_dev *idev);
856 825
857#else 826#else
858static inline int ac6_proc_init(struct net *net) { return 0; } 827static inline int ac6_proc_init(struct net *net) { return 0; }
@@ -865,10 +834,10 @@ static inline int snmp6_unregister_dev(struct inet6_dev *idev) { return 0; }
865extern struct ctl_table ipv6_route_table_template[]; 834extern struct ctl_table ipv6_route_table_template[];
866extern struct ctl_table ipv6_icmp_table_template[]; 835extern struct ctl_table ipv6_icmp_table_template[];
867 836
868extern struct ctl_table *ipv6_icmp_sysctl_init(struct net *net); 837struct ctl_table *ipv6_icmp_sysctl_init(struct net *net);
869extern struct ctl_table *ipv6_route_sysctl_init(struct net *net); 838struct ctl_table *ipv6_route_sysctl_init(struct net *net);
870extern int ipv6_sysctl_register(void); 839int ipv6_sysctl_register(void);
871extern void ipv6_sysctl_unregister(void); 840void ipv6_sysctl_unregister(void);
872#endif 841#endif
873 842
874#endif /* _NET_IPV6_H */ 843#endif /* _NET_IPV6_H */
diff --git a/include/net/ipx.h b/include/net/ipx.h
index c1fec6b464cc..9e9e35465baf 100644
--- a/include/net/ipx.h
+++ b/include/net/ipx.h
@@ -123,23 +123,23 @@ extern struct list_head ipx_routes;
123extern rwlock_t ipx_routes_lock; 123extern rwlock_t ipx_routes_lock;
124 124
125extern struct list_head ipx_interfaces; 125extern struct list_head ipx_interfaces;
126extern struct ipx_interface *ipx_interfaces_head(void); 126struct ipx_interface *ipx_interfaces_head(void);
127extern spinlock_t ipx_interfaces_lock; 127extern spinlock_t ipx_interfaces_lock;
128 128
129extern struct ipx_interface *ipx_primary_net; 129extern struct ipx_interface *ipx_primary_net;
130 130
131extern int ipx_proc_init(void); 131int ipx_proc_init(void);
132extern void ipx_proc_exit(void); 132void ipx_proc_exit(void);
133 133
134extern const char *ipx_frame_name(__be16); 134const char *ipx_frame_name(__be16);
135extern const char *ipx_device_name(struct ipx_interface *intrfc); 135const char *ipx_device_name(struct ipx_interface *intrfc);
136 136
137static __inline__ void ipxitf_hold(struct ipx_interface *intrfc) 137static __inline__ void ipxitf_hold(struct ipx_interface *intrfc)
138{ 138{
139 atomic_inc(&intrfc->refcnt); 139 atomic_inc(&intrfc->refcnt);
140} 140}
141 141
142extern void ipxitf_down(struct ipx_interface *intrfc); 142void ipxitf_down(struct ipx_interface *intrfc);
143 143
144static __inline__ void ipxitf_put(struct ipx_interface *intrfc) 144static __inline__ void ipxitf_put(struct ipx_interface *intrfc)
145{ 145{
diff --git a/include/net/irda/ircomm_tty.h b/include/net/irda/ircomm_tty.h
index 80ffde3bb164..0224402260a7 100644
--- a/include/net/irda/ircomm_tty.h
+++ b/include/net/irda/ircomm_tty.h
@@ -105,13 +105,13 @@ struct ircomm_tty_cb {
105void ircomm_tty_start(struct tty_struct *tty); 105void ircomm_tty_start(struct tty_struct *tty);
106void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self); 106void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self);
107 107
108extern int ircomm_tty_tiocmget(struct tty_struct *tty); 108int ircomm_tty_tiocmget(struct tty_struct *tty);
109extern int ircomm_tty_tiocmset(struct tty_struct *tty, 109int ircomm_tty_tiocmset(struct tty_struct *tty, unsigned int set,
110 unsigned int set, unsigned int clear); 110 unsigned int clear);
111extern int ircomm_tty_ioctl(struct tty_struct *tty, 111int ircomm_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
112 unsigned int cmd, unsigned long arg); 112 unsigned long arg);
113extern void ircomm_tty_set_termios(struct tty_struct *tty, 113void ircomm_tty_set_termios(struct tty_struct *tty,
114 struct ktermios *old_termios); 114 struct ktermios *old_termios);
115 115
116#endif 116#endif
117 117
diff --git a/include/net/irda/irda.h b/include/net/irda/irda.h
index 3bed61d379a8..a059465101ff 100644
--- a/include/net/irda/irda.h
+++ b/include/net/irda/irda.h
@@ -112,20 +112,19 @@ do { if(!(expr)) { \
112struct net_device; 112struct net_device;
113struct packet_type; 113struct packet_type;
114 114
115extern void irda_proc_register(void); 115void irda_proc_register(void);
116extern void irda_proc_unregister(void); 116void irda_proc_unregister(void);
117 117
118extern int irda_sysctl_register(void); 118int irda_sysctl_register(void);
119extern void irda_sysctl_unregister(void); 119void irda_sysctl_unregister(void);
120 120
121extern int irsock_init(void); 121int irsock_init(void);
122extern void irsock_cleanup(void); 122void irsock_cleanup(void);
123 123
124extern int irda_nl_register(void); 124int irda_nl_register(void);
125extern void irda_nl_unregister(void); 125void irda_nl_unregister(void);
126 126
127extern int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, 127int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
128 struct packet_type *ptype, 128 struct packet_type *ptype, struct net_device *orig_dev);
129 struct net_device *orig_dev);
130 129
131#endif /* NET_IRDA_H */ 130#endif /* NET_IRDA_H */
diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h
index 94c852d47d0f..11417475a6c3 100644
--- a/include/net/irda/irda_device.h
+++ b/include/net/irda/irda_device.h
@@ -162,7 +162,7 @@ typedef struct {
162 int irq, irq2; /* Interrupts used */ 162 int irq, irq2; /* Interrupts used */
163 int dma, dma2; /* DMA channel(s) used */ 163 int dma, dma2; /* DMA channel(s) used */
164 int fifo_size; /* FIFO size */ 164 int fifo_size; /* FIFO size */
165 int irqflags; /* interrupt flags (ie, IRQF_SHARED|IRQF_DISABLED) */ 165 int irqflags; /* interrupt flags (ie, IRQF_SHARED) */
166 int direction; /* Link direction, used by some FIR drivers */ 166 int direction; /* Link direction, used by some FIR drivers */
167 int enabled; /* Powered on? */ 167 int enabled; /* Powered on? */
168 int suspended; /* Suspended by APM */ 168 int suspended; /* Suspended by APM */
diff --git a/include/net/irda/irlap_event.h b/include/net/irda/irlap_event.h
index 4c90824c50fb..f9d88da97af2 100644
--- a/include/net/irda/irlap_event.h
+++ b/include/net/irda/irlap_event.h
@@ -126,6 +126,6 @@ void irlap_do_event(struct irlap_cb *self, IRLAP_EVENT event,
126 struct sk_buff *skb, struct irlap_info *info); 126 struct sk_buff *skb, struct irlap_info *info);
127void irlap_print_event(IRLAP_EVENT event); 127void irlap_print_event(IRLAP_EVENT event);
128 128
129extern int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb); 129int irlap_qos_negotiate(struct irlap_cb *self, struct sk_buff *skb);
130 130
131#endif 131#endif
diff --git a/include/net/irda/irlap_frame.h b/include/net/irda/irlap_frame.h
index 6b1dc4f8eca5..57173ae398ae 100644
--- a/include/net/irda/irlap_frame.h
+++ b/include/net/irda/irlap_frame.h
@@ -163,7 +163,7 @@ void irlap_resend_rejected_frame(struct irlap_cb *self, int command);
163void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb, 163void irlap_send_ui_frame(struct irlap_cb *self, struct sk_buff *skb,
164 __u8 caddr, int command); 164 __u8 caddr, int command);
165 165
166extern int irlap_insert_qos_negotiation_params(struct irlap_cb *self, 166int irlap_insert_qos_negotiation_params(struct irlap_cb *self,
167 struct sk_buff *skb); 167 struct sk_buff *skb);
168 168
169#endif 169#endif
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h
index 5d5a6a4732ef..a830b01baba4 100644
--- a/include/net/iw_handler.h
+++ b/include/net/iw_handler.h
@@ -432,44 +432,32 @@ struct iw_public_data {
432/* First : function strictly used inside the kernel */ 432/* First : function strictly used inside the kernel */
433 433
434/* Handle /proc/net/wireless, called in net/code/dev.c */ 434/* Handle /proc/net/wireless, called in net/code/dev.c */
435extern int dev_get_wireless_info(char * buffer, char **start, off_t offset, 435int dev_get_wireless_info(char *buffer, char **start, off_t offset, int length);
436 int length);
437 436
438/* Second : functions that may be called by driver modules */ 437/* Second : functions that may be called by driver modules */
439 438
440/* Send a single event to user space */ 439/* Send a single event to user space */
441extern void wireless_send_event(struct net_device * dev, 440void wireless_send_event(struct net_device *dev, unsigned int cmd,
442 unsigned int cmd, 441 union iwreq_data *wrqu, const char *extra);
443 union iwreq_data * wrqu,
444 const char * extra);
445 442
446/* We may need a function to send a stream of events to user space. 443/* We may need a function to send a stream of events to user space.
447 * More on that later... */ 444 * More on that later... */
448 445
449/* Standard handler for SIOCSIWSPY */ 446/* Standard handler for SIOCSIWSPY */
450extern int iw_handler_set_spy(struct net_device * dev, 447int iw_handler_set_spy(struct net_device *dev, struct iw_request_info *info,
451 struct iw_request_info * info, 448 union iwreq_data *wrqu, char *extra);
452 union iwreq_data * wrqu,
453 char * extra);
454/* Standard handler for SIOCGIWSPY */ 449/* Standard handler for SIOCGIWSPY */
455extern int iw_handler_get_spy(struct net_device * dev, 450int iw_handler_get_spy(struct net_device *dev, struct iw_request_info *info,
456 struct iw_request_info * info, 451 union iwreq_data *wrqu, char *extra);
457 union iwreq_data * wrqu,
458 char * extra);
459/* Standard handler for SIOCSIWTHRSPY */ 452/* Standard handler for SIOCSIWTHRSPY */
460extern int iw_handler_set_thrspy(struct net_device * dev, 453int iw_handler_set_thrspy(struct net_device *dev, struct iw_request_info *info,
461 struct iw_request_info *info, 454 union iwreq_data *wrqu, char *extra);
462 union iwreq_data * wrqu,
463 char * extra);
464/* Standard handler for SIOCGIWTHRSPY */ 455/* Standard handler for SIOCGIWTHRSPY */
465extern int iw_handler_get_thrspy(struct net_device * dev, 456int iw_handler_get_thrspy(struct net_device *dev, struct iw_request_info *info,
466 struct iw_request_info *info, 457 union iwreq_data *wrqu, char *extra);
467 union iwreq_data * wrqu,
468 char * extra);
469/* Driver call to update spy records */ 458/* Driver call to update spy records */
470extern void wireless_spy_update(struct net_device * dev, 459void wireless_spy_update(struct net_device *dev, unsigned char *address,
471 unsigned char * address, 460 struct iw_quality *wstats);
472 struct iw_quality * wstats);
473 461
474/************************* INLINE FUNTIONS *************************/ 462/************************* INLINE FUNTIONS *************************/
475/* 463/*
diff --git a/include/net/lapb.h b/include/net/lapb.h
index df892a94f2c6..9510f8725f03 100644
--- a/include/net/lapb.h
+++ b/include/net/lapb.h
@@ -105,40 +105,40 @@ struct lapb_cb {
105}; 105};
106 106
107/* lapb_iface.c */ 107/* lapb_iface.c */
108extern void lapb_connect_confirmation(struct lapb_cb *lapb, int); 108void lapb_connect_confirmation(struct lapb_cb *lapb, int);
109extern void lapb_connect_indication(struct lapb_cb *lapb, int); 109void lapb_connect_indication(struct lapb_cb *lapb, int);
110extern void lapb_disconnect_confirmation(struct lapb_cb *lapb, int); 110void lapb_disconnect_confirmation(struct lapb_cb *lapb, int);
111extern void lapb_disconnect_indication(struct lapb_cb *lapb, int); 111void lapb_disconnect_indication(struct lapb_cb *lapb, int);
112extern int lapb_data_indication(struct lapb_cb *lapb, struct sk_buff *); 112int lapb_data_indication(struct lapb_cb *lapb, struct sk_buff *);
113extern int lapb_data_transmit(struct lapb_cb *lapb, struct sk_buff *); 113int lapb_data_transmit(struct lapb_cb *lapb, struct sk_buff *);
114 114
115/* lapb_in.c */ 115/* lapb_in.c */
116extern void lapb_data_input(struct lapb_cb *lapb, struct sk_buff *); 116void lapb_data_input(struct lapb_cb *lapb, struct sk_buff *);
117 117
118/* lapb_out.c */ 118/* lapb_out.c */
119extern void lapb_kick(struct lapb_cb *lapb); 119void lapb_kick(struct lapb_cb *lapb);
120extern void lapb_transmit_buffer(struct lapb_cb *lapb, struct sk_buff *, int); 120void lapb_transmit_buffer(struct lapb_cb *lapb, struct sk_buff *, int);
121extern void lapb_establish_data_link(struct lapb_cb *lapb); 121void lapb_establish_data_link(struct lapb_cb *lapb);
122extern void lapb_enquiry_response(struct lapb_cb *lapb); 122void lapb_enquiry_response(struct lapb_cb *lapb);
123extern void lapb_timeout_response(struct lapb_cb *lapb); 123void lapb_timeout_response(struct lapb_cb *lapb);
124extern void lapb_check_iframes_acked(struct lapb_cb *lapb, unsigned short); 124void lapb_check_iframes_acked(struct lapb_cb *lapb, unsigned short);
125extern void lapb_check_need_response(struct lapb_cb *lapb, int, int); 125void lapb_check_need_response(struct lapb_cb *lapb, int, int);
126 126
127/* lapb_subr.c */ 127/* lapb_subr.c */
128extern void lapb_clear_queues(struct lapb_cb *lapb); 128void lapb_clear_queues(struct lapb_cb *lapb);
129extern void lapb_frames_acked(struct lapb_cb *lapb, unsigned short); 129void lapb_frames_acked(struct lapb_cb *lapb, unsigned short);
130extern void lapb_requeue_frames(struct lapb_cb *lapb); 130void lapb_requeue_frames(struct lapb_cb *lapb);
131extern int lapb_validate_nr(struct lapb_cb *lapb, unsigned short); 131int lapb_validate_nr(struct lapb_cb *lapb, unsigned short);
132extern int lapb_decode(struct lapb_cb *lapb, struct sk_buff *, struct lapb_frame *); 132int lapb_decode(struct lapb_cb *lapb, struct sk_buff *, struct lapb_frame *);
133extern void lapb_send_control(struct lapb_cb *lapb, int, int, int); 133void lapb_send_control(struct lapb_cb *lapb, int, int, int);
134extern void lapb_transmit_frmr(struct lapb_cb *lapb); 134void lapb_transmit_frmr(struct lapb_cb *lapb);
135 135
136/* lapb_timer.c */ 136/* lapb_timer.c */
137extern void lapb_start_t1timer(struct lapb_cb *lapb); 137void lapb_start_t1timer(struct lapb_cb *lapb);
138extern void lapb_start_t2timer(struct lapb_cb *lapb); 138void lapb_start_t2timer(struct lapb_cb *lapb);
139extern void lapb_stop_t1timer(struct lapb_cb *lapb); 139void lapb_stop_t1timer(struct lapb_cb *lapb);
140extern void lapb_stop_t2timer(struct lapb_cb *lapb); 140void lapb_stop_t2timer(struct lapb_cb *lapb);
141extern int lapb_t1timer_running(struct lapb_cb *lapb); 141int lapb_t1timer_running(struct lapb_cb *lapb);
142 142
143/* 143/*
144 * Debug levels. 144 * Debug levels.
diff --git a/include/net/llc.h b/include/net/llc.h
index 9e7d7f08ef77..68490cbc8a65 100644
--- a/include/net/llc.h
+++ b/include/net/llc.h
@@ -95,29 +95,29 @@ struct hlist_nulls_head *llc_sk_laddr_hash(struct llc_sap *sap,
95extern struct list_head llc_sap_list; 95extern struct list_head llc_sap_list;
96extern spinlock_t llc_sap_list_lock; 96extern spinlock_t llc_sap_list_lock;
97 97
98extern int llc_rcv(struct sk_buff *skb, struct net_device *dev, 98int llc_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
99 struct packet_type *pt, struct net_device *orig_dev); 99 struct net_device *orig_dev);
100 100
101extern int llc_mac_hdr_init(struct sk_buff *skb, 101int llc_mac_hdr_init(struct sk_buff *skb, const unsigned char *sa,
102 const unsigned char *sa, const unsigned char *da); 102 const unsigned char *da);
103 103
104extern void llc_add_pack(int type, void (*handler)(struct llc_sap *sap, 104void llc_add_pack(int type,
105 struct sk_buff *skb)); 105 void (*handler)(struct llc_sap *sap, struct sk_buff *skb));
106extern void llc_remove_pack(int type); 106void llc_remove_pack(int type);
107 107
108extern void llc_set_station_handler(void (*handler)(struct sk_buff *skb)); 108void llc_set_station_handler(void (*handler)(struct sk_buff *skb));
109 109
110extern struct llc_sap *llc_sap_open(unsigned char lsap, 110struct llc_sap *llc_sap_open(unsigned char lsap,
111 int (*rcv)(struct sk_buff *skb, 111 int (*rcv)(struct sk_buff *skb,
112 struct net_device *dev, 112 struct net_device *dev,
113 struct packet_type *pt, 113 struct packet_type *pt,
114 struct net_device *orig_dev)); 114 struct net_device *orig_dev));
115static inline void llc_sap_hold(struct llc_sap *sap) 115static inline void llc_sap_hold(struct llc_sap *sap)
116{ 116{
117 atomic_inc(&sap->refcnt); 117 atomic_inc(&sap->refcnt);
118} 118}
119 119
120extern void llc_sap_close(struct llc_sap *sap); 120void llc_sap_close(struct llc_sap *sap);
121 121
122static inline void llc_sap_put(struct llc_sap *sap) 122static inline void llc_sap_put(struct llc_sap *sap)
123{ 123{
@@ -125,27 +125,27 @@ static inline void llc_sap_put(struct llc_sap *sap)
125 llc_sap_close(sap); 125 llc_sap_close(sap);
126} 126}
127 127
128extern struct llc_sap *llc_sap_find(unsigned char sap_value); 128struct llc_sap *llc_sap_find(unsigned char sap_value);
129 129
130extern int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb, 130int llc_build_and_send_ui_pkt(struct llc_sap *sap, struct sk_buff *skb,
131 unsigned char *dmac, unsigned char dsap); 131 unsigned char *dmac, unsigned char dsap);
132 132
133extern void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb); 133void llc_sap_handler(struct llc_sap *sap, struct sk_buff *skb);
134extern void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb); 134void llc_conn_handler(struct llc_sap *sap, struct sk_buff *skb);
135 135
136extern void llc_station_init(void); 136void llc_station_init(void);
137extern void llc_station_exit(void); 137void llc_station_exit(void);
138 138
139#ifdef CONFIG_PROC_FS 139#ifdef CONFIG_PROC_FS
140extern int llc_proc_init(void); 140int llc_proc_init(void);
141extern void llc_proc_exit(void); 141void llc_proc_exit(void);
142#else 142#else
143#define llc_proc_init() (0) 143#define llc_proc_init() (0)
144#define llc_proc_exit() do { } while(0) 144#define llc_proc_exit() do { } while(0)
145#endif /* CONFIG_PROC_FS */ 145#endif /* CONFIG_PROC_FS */
146#ifdef CONFIG_SYSCTL 146#ifdef CONFIG_SYSCTL
147extern int llc_sysctl_init(void); 147int llc_sysctl_init(void);
148extern void llc_sysctl_exit(void); 148void llc_sysctl_exit(void);
149 149
150extern int sysctl_llc2_ack_timeout; 150extern int sysctl_llc2_ack_timeout;
151extern int sysctl_llc2_busy_timeout; 151extern int sysctl_llc2_busy_timeout;
diff --git a/include/net/llc_c_ac.h b/include/net/llc_c_ac.h
index df83f69d2de4..f3be818e73c1 100644
--- a/include/net/llc_c_ac.h
+++ b/include/net/llc_c_ac.h
@@ -89,114 +89,92 @@
89 89
90typedef int (*llc_conn_action_t)(struct sock *sk, struct sk_buff *skb); 90typedef int (*llc_conn_action_t)(struct sock *sk, struct sk_buff *skb);
91 91
92extern int llc_conn_ac_clear_remote_busy(struct sock *sk, struct sk_buff *skb); 92int llc_conn_ac_clear_remote_busy(struct sock *sk, struct sk_buff *skb);
93extern int llc_conn_ac_conn_ind(struct sock *sk, struct sk_buff *skb); 93int llc_conn_ac_conn_ind(struct sock *sk, struct sk_buff *skb);
94extern int llc_conn_ac_conn_confirm(struct sock* sk, struct sk_buff *skb); 94int llc_conn_ac_conn_confirm(struct sock *sk, struct sk_buff *skb);
95extern int llc_conn_ac_data_ind(struct sock* sk, struct sk_buff *skb); 95int llc_conn_ac_data_ind(struct sock *sk, struct sk_buff *skb);
96extern int llc_conn_ac_disc_ind(struct sock* sk, struct sk_buff *skb); 96int llc_conn_ac_disc_ind(struct sock *sk, struct sk_buff *skb);
97extern int llc_conn_ac_rst_ind(struct sock* sk, struct sk_buff *skb); 97int llc_conn_ac_rst_ind(struct sock *sk, struct sk_buff *skb);
98extern int llc_conn_ac_rst_confirm(struct sock* sk, struct sk_buff *skb); 98int llc_conn_ac_rst_confirm(struct sock *sk, struct sk_buff *skb);
99extern int llc_conn_ac_clear_remote_busy_if_f_eq_1(struct sock* sk, 99int llc_conn_ac_clear_remote_busy_if_f_eq_1(struct sock *sk,
100 struct sk_buff *skb);
101extern int llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2(struct sock* sk,
102 struct sk_buff *skb);
103extern int llc_conn_ac_send_disc_cmd_p_set_x(struct sock* sk,
104 struct sk_buff *skb);
105extern int llc_conn_ac_send_dm_rsp_f_set_p(struct sock* sk,
106 struct sk_buff *skb);
107extern int llc_conn_ac_send_dm_rsp_f_set_1(struct sock* sk,
108 struct sk_buff *skb);
109extern int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock* sk,
110 struct sk_buff *skb);
111extern int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock* sk,
112 struct sk_buff *skb);
113extern int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock* sk,
114 struct sk_buff *skb);
115extern int llc_conn_ac_send_i_cmd_p_set_1(struct sock* sk, struct sk_buff *skb);
116extern int llc_conn_ac_send_i_xxx_x_set_0(struct sock* sk, struct sk_buff *skb);
117extern int llc_conn_ac_resend_i_xxx_x_set_0(struct sock* sk,
118 struct sk_buff *skb);
119extern int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock* sk,
120 struct sk_buff *skb);
121extern int llc_conn_ac_resend_i_rsp_f_set_1(struct sock* sk,
122 struct sk_buff *skb);
123extern int llc_conn_ac_send_rej_cmd_p_set_1(struct sock* sk,
124 struct sk_buff *skb);
125extern int llc_conn_ac_send_rej_rsp_f_set_1(struct sock* sk,
126 struct sk_buff *skb);
127extern int llc_conn_ac_send_rej_xxx_x_set_0(struct sock* sk,
128 struct sk_buff *skb); 100 struct sk_buff *skb);
129extern int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock* sk, 101int llc_conn_ac_stop_rej_tmr_if_data_flag_eq_2(struct sock *sk,
130 struct sk_buff *skb); 102 struct sk_buff *skb);
131extern int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock* sk, 103int llc_conn_ac_send_disc_cmd_p_set_x(struct sock *sk, struct sk_buff *skb);
132 struct sk_buff *skb); 104int llc_conn_ac_send_dm_rsp_f_set_p(struct sock *sk, struct sk_buff *skb);
133extern int llc_conn_ac_send_rnr_xxx_x_set_0(struct sock* sk, 105int llc_conn_ac_send_dm_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
134 struct sk_buff *skb); 106int llc_conn_ac_send_frmr_rsp_f_set_x(struct sock *sk, struct sk_buff *skb);
135extern int llc_conn_ac_set_remote_busy(struct sock* sk, struct sk_buff *skb); 107int llc_conn_ac_resend_frmr_rsp_f_set_0(struct sock *sk, struct sk_buff *skb);
136extern int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock* sk, 108int llc_conn_ac_resend_frmr_rsp_f_set_p(struct sock *sk, struct sk_buff *skb);
109int llc_conn_ac_send_i_cmd_p_set_1(struct sock *sk, struct sk_buff *skb);
110int llc_conn_ac_send_i_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
111int llc_conn_ac_resend_i_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
112int llc_conn_ac_resend_i_xxx_x_set_0_or_send_rr(struct sock *sk,
137 struct sk_buff *skb); 113 struct sk_buff *skb);
138extern int llc_conn_ac_send_rr_cmd_p_set_1(struct sock* sk, 114int llc_conn_ac_resend_i_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
139 struct sk_buff *skb); 115int llc_conn_ac_send_rej_cmd_p_set_1(struct sock *sk, struct sk_buff *skb);
140extern int llc_conn_ac_send_rr_rsp_f_set_1(struct sock* sk, 116int llc_conn_ac_send_rej_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
141 struct sk_buff *skb); 117int llc_conn_ac_send_rej_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
142extern int llc_conn_ac_send_ack_rsp_f_set_1(struct sock* sk, 118int llc_conn_ac_send_rnr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb);
143 struct sk_buff *skb); 119int llc_conn_ac_send_rnr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
144extern int llc_conn_ac_send_rr_xxx_x_set_0(struct sock* sk, 120int llc_conn_ac_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
145 struct sk_buff *skb); 121int llc_conn_ac_set_remote_busy(struct sock *sk, struct sk_buff *skb);
146extern int llc_conn_ac_send_ack_xxx_x_set_0(struct sock* sk, 122int llc_conn_ac_opt_send_rnr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
147 struct sk_buff *skb); 123int llc_conn_ac_send_rr_cmd_p_set_1(struct sock *sk, struct sk_buff *skb);
148extern int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock* sk, 124int llc_conn_ac_send_rr_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
149 struct sk_buff *skb); 125int llc_conn_ac_send_ack_rsp_f_set_1(struct sock *sk, struct sk_buff *skb);
150extern int llc_conn_ac_send_ua_rsp_f_set_p(struct sock* sk, 126int llc_conn_ac_send_rr_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
151 struct sk_buff *skb); 127int llc_conn_ac_send_ack_xxx_x_set_0(struct sock *sk, struct sk_buff *skb);
152extern int llc_conn_ac_set_s_flag_0(struct sock* sk, struct sk_buff *skb); 128int llc_conn_ac_send_sabme_cmd_p_set_x(struct sock *sk, struct sk_buff *skb);
153extern int llc_conn_ac_set_s_flag_1(struct sock* sk, struct sk_buff *skb); 129int llc_conn_ac_send_ua_rsp_f_set_p(struct sock *sk, struct sk_buff *skb);
154extern int llc_conn_ac_start_p_timer(struct sock* sk, struct sk_buff *skb); 130int llc_conn_ac_set_s_flag_0(struct sock *sk, struct sk_buff *skb);
155extern int llc_conn_ac_start_ack_timer(struct sock* sk, struct sk_buff *skb); 131int llc_conn_ac_set_s_flag_1(struct sock *sk, struct sk_buff *skb);
156extern int llc_conn_ac_start_rej_timer(struct sock* sk, struct sk_buff *skb); 132int llc_conn_ac_start_p_timer(struct sock *sk, struct sk_buff *skb);
157extern int llc_conn_ac_start_ack_tmr_if_not_running(struct sock* sk, 133int llc_conn_ac_start_ack_timer(struct sock *sk, struct sk_buff *skb);
158 struct sk_buff *skb); 134int llc_conn_ac_start_rej_timer(struct sock *sk, struct sk_buff *skb);
159extern int llc_conn_ac_stop_ack_timer(struct sock* sk, struct sk_buff *skb); 135int llc_conn_ac_start_ack_tmr_if_not_running(struct sock *sk,
160extern int llc_conn_ac_stop_p_timer(struct sock* sk, struct sk_buff *skb); 136 struct sk_buff *skb);
161extern int llc_conn_ac_stop_rej_timer(struct sock* sk, struct sk_buff *skb); 137int llc_conn_ac_stop_ack_timer(struct sock *sk, struct sk_buff *skb);
162extern int llc_conn_ac_stop_all_timers(struct sock* sk, struct sk_buff *skb); 138int llc_conn_ac_stop_p_timer(struct sock *sk, struct sk_buff *skb);
163extern int llc_conn_ac_stop_other_timers(struct sock* sk, struct sk_buff *skb); 139int llc_conn_ac_stop_rej_timer(struct sock *sk, struct sk_buff *skb);
164extern int llc_conn_ac_upd_nr_received(struct sock* sk, struct sk_buff *skb); 140int llc_conn_ac_stop_all_timers(struct sock *sk, struct sk_buff *skb);
165extern int llc_conn_ac_inc_tx_win_size(struct sock* sk, struct sk_buff *skb); 141int llc_conn_ac_stop_other_timers(struct sock *sk, struct sk_buff *skb);
166extern int llc_conn_ac_dec_tx_win_size(struct sock* sk, struct sk_buff *skb); 142int llc_conn_ac_upd_nr_received(struct sock *sk, struct sk_buff *skb);
167extern int llc_conn_ac_upd_p_flag(struct sock* sk, struct sk_buff *skb); 143int llc_conn_ac_inc_tx_win_size(struct sock *sk, struct sk_buff *skb);
168extern int llc_conn_ac_set_data_flag_2(struct sock* sk, struct sk_buff *skb); 144int llc_conn_ac_dec_tx_win_size(struct sock *sk, struct sk_buff *skb);
169extern int llc_conn_ac_set_data_flag_0(struct sock* sk, struct sk_buff *skb); 145int llc_conn_ac_upd_p_flag(struct sock *sk, struct sk_buff *skb);
170extern int llc_conn_ac_set_data_flag_1(struct sock* sk, struct sk_buff *skb); 146int llc_conn_ac_set_data_flag_2(struct sock *sk, struct sk_buff *skb);
171extern int llc_conn_ac_set_data_flag_1_if_data_flag_eq_0(struct sock* sk, 147int llc_conn_ac_set_data_flag_0(struct sock *sk, struct sk_buff *skb);
172 struct sk_buff *skb); 148int llc_conn_ac_set_data_flag_1(struct sock *sk, struct sk_buff *skb);
173extern int llc_conn_ac_set_p_flag_0(struct sock* sk, struct sk_buff *skb); 149int llc_conn_ac_set_data_flag_1_if_data_flag_eq_0(struct sock *sk,
174extern int llc_conn_ac_set_remote_busy_0(struct sock* sk, struct sk_buff *skb); 150 struct sk_buff *skb);
175extern int llc_conn_ac_set_retry_cnt_0(struct sock* sk, struct sk_buff *skb); 151int llc_conn_ac_set_p_flag_0(struct sock *sk, struct sk_buff *skb);
176extern int llc_conn_ac_set_cause_flag_0(struct sock* sk, struct sk_buff *skb); 152int llc_conn_ac_set_remote_busy_0(struct sock *sk, struct sk_buff *skb);
177extern int llc_conn_ac_set_cause_flag_1(struct sock* sk, struct sk_buff *skb); 153int llc_conn_ac_set_retry_cnt_0(struct sock *sk, struct sk_buff *skb);
178extern int llc_conn_ac_inc_retry_cnt_by_1(struct sock* sk, struct sk_buff *skb); 154int llc_conn_ac_set_cause_flag_0(struct sock *sk, struct sk_buff *skb);
179extern int llc_conn_ac_set_vr_0(struct sock* sk, struct sk_buff *skb); 155int llc_conn_ac_set_cause_flag_1(struct sock *sk, struct sk_buff *skb);
180extern int llc_conn_ac_inc_vr_by_1(struct sock* sk, struct sk_buff *skb); 156int llc_conn_ac_inc_retry_cnt_by_1(struct sock *sk, struct sk_buff *skb);
181extern int llc_conn_ac_set_vs_0(struct sock* sk, struct sk_buff *skb); 157int llc_conn_ac_set_vr_0(struct sock *sk, struct sk_buff *skb);
182extern int llc_conn_ac_set_vs_nr(struct sock* sk, struct sk_buff *skb); 158int llc_conn_ac_inc_vr_by_1(struct sock *sk, struct sk_buff *skb);
183extern int llc_conn_ac_rst_vs(struct sock* sk, struct sk_buff *skb); 159int llc_conn_ac_set_vs_0(struct sock *sk, struct sk_buff *skb);
184extern int llc_conn_ac_upd_vs(struct sock* sk, struct sk_buff *skb); 160int llc_conn_ac_set_vs_nr(struct sock *sk, struct sk_buff *skb);
185extern int llc_conn_disc(struct sock* sk, struct sk_buff *skb); 161int llc_conn_ac_rst_vs(struct sock *sk, struct sk_buff *skb);
186extern int llc_conn_reset(struct sock* sk, struct sk_buff *skb); 162int llc_conn_ac_upd_vs(struct sock *sk, struct sk_buff *skb);
187extern int llc_conn_ac_disc_confirm(struct sock* sk, struct sk_buff *skb); 163int llc_conn_disc(struct sock *sk, struct sk_buff *skb);
188extern u8 llc_circular_between(u8 a, u8 b, u8 c); 164int llc_conn_reset(struct sock *sk, struct sk_buff *skb);
189extern int llc_conn_ac_send_ack_if_needed(struct sock* sk, struct sk_buff *skb); 165int llc_conn_ac_disc_confirm(struct sock *sk, struct sk_buff *skb);
190extern int llc_conn_ac_adjust_npta_by_rr(struct sock* sk, struct sk_buff *skb); 166u8 llc_circular_between(u8 a, u8 b, u8 c);
191extern int llc_conn_ac_adjust_npta_by_rnr(struct sock* sk, struct sk_buff *skb); 167int llc_conn_ac_send_ack_if_needed(struct sock *sk, struct sk_buff *skb);
192extern int llc_conn_ac_rst_sendack_flag(struct sock* sk, struct sk_buff *skb); 168int llc_conn_ac_adjust_npta_by_rr(struct sock *sk, struct sk_buff *skb);
193extern int llc_conn_ac_send_i_rsp_as_ack(struct sock* sk, struct sk_buff *skb); 169int llc_conn_ac_adjust_npta_by_rnr(struct sock *sk, struct sk_buff *skb);
194extern int llc_conn_ac_send_i_as_ack(struct sock* sk, struct sk_buff *skb); 170int llc_conn_ac_rst_sendack_flag(struct sock *sk, struct sk_buff *skb);
171int llc_conn_ac_send_i_rsp_as_ack(struct sock *sk, struct sk_buff *skb);
172int llc_conn_ac_send_i_as_ack(struct sock *sk, struct sk_buff *skb);
195 173
196extern void llc_conn_busy_tmr_cb(unsigned long timeout_data); 174void llc_conn_busy_tmr_cb(unsigned long timeout_data);
197extern void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data); 175void llc_conn_pf_cycle_tmr_cb(unsigned long timeout_data);
198extern void llc_conn_ack_tmr_cb(unsigned long timeout_data); 176void llc_conn_ack_tmr_cb(unsigned long timeout_data);
199extern void llc_conn_rej_tmr_cb(unsigned long timeout_data); 177void llc_conn_rej_tmr_cb(unsigned long timeout_data);
200 178
201extern void llc_conn_set_p_flag(struct sock *sk, u8 value); 179void llc_conn_set_p_flag(struct sock *sk, u8 value);
202#endif /* LLC_C_AC_H */ 180#endif /* LLC_C_AC_H */
diff --git a/include/net/llc_c_ev.h b/include/net/llc_c_ev.h
index 6ca3113df39e..3948cf111dd0 100644
--- a/include/net/llc_c_ev.h
+++ b/include/net/llc_c_ev.h
@@ -128,138 +128,93 @@ static __inline__ struct llc_conn_state_ev *llc_conn_ev(struct sk_buff *skb)
128typedef int (*llc_conn_ev_t)(struct sock *sk, struct sk_buff *skb); 128typedef int (*llc_conn_ev_t)(struct sock *sk, struct sk_buff *skb);
129typedef int (*llc_conn_ev_qfyr_t)(struct sock *sk, struct sk_buff *skb); 129typedef int (*llc_conn_ev_qfyr_t)(struct sock *sk, struct sk_buff *skb);
130 130
131extern int llc_conn_ev_conn_req(struct sock *sk, struct sk_buff *skb); 131int llc_conn_ev_conn_req(struct sock *sk, struct sk_buff *skb);
132extern int llc_conn_ev_data_req(struct sock *sk, struct sk_buff *skb); 132int llc_conn_ev_data_req(struct sock *sk, struct sk_buff *skb);
133extern int llc_conn_ev_disc_req(struct sock *sk, struct sk_buff *skb); 133int llc_conn_ev_disc_req(struct sock *sk, struct sk_buff *skb);
134extern int llc_conn_ev_rst_req(struct sock *sk, struct sk_buff *skb); 134int llc_conn_ev_rst_req(struct sock *sk, struct sk_buff *skb);
135extern int llc_conn_ev_local_busy_detected(struct sock *sk, 135int llc_conn_ev_local_busy_detected(struct sock *sk, struct sk_buff *skb);
136 struct sk_buff *skb); 136int llc_conn_ev_local_busy_cleared(struct sock *sk, struct sk_buff *skb);
137extern int llc_conn_ev_local_busy_cleared(struct sock *sk, struct sk_buff *skb); 137int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct sk_buff *skb);
138extern int llc_conn_ev_rx_bad_pdu(struct sock *sk, struct sk_buff *skb); 138int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb);
139extern int llc_conn_ev_rx_disc_cmd_pbit_set_x(struct sock *sk, 139int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
140int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
141int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk,
142 struct sk_buff *skb);
143int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
144int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
140 struct sk_buff *skb); 145 struct sk_buff *skb);
141extern int llc_conn_ev_rx_dm_rsp_fbit_set_x(struct sock *sk, 146int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
142 struct sk_buff *skb); 147 struct sk_buff *skb);
143extern int llc_conn_ev_rx_frmr_rsp_fbit_set_x(struct sock *sk, 148int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
144 struct sk_buff *skb); 149int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb);
145extern int llc_conn_ev_rx_i_cmd_pbit_set_x_inval_ns(struct sock *sk, 150int llc_conn_ev_rx_ua_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
146 struct sk_buff *skb); 151int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, struct sk_buff *skb);
147extern int llc_conn_ev_rx_i_rsp_fbit_set_x(struct sock *sk, 152int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, struct sk_buff *skb);
148 struct sk_buff *skb); 153int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr(struct sock *sk,
149extern int llc_conn_ev_rx_i_rsp_fbit_set_x_unexpd_ns(struct sock *sk,
150 struct sk_buff *skb);
151extern int llc_conn_ev_rx_i_rsp_fbit_set_x_inval_ns(struct sock *sk,
152 struct sk_buff *skb);
153extern int llc_conn_ev_rx_rej_rsp_fbit_set_x(struct sock *sk,
154 struct sk_buff *skb);
155extern int llc_conn_ev_rx_sabme_cmd_pbit_set_x(struct sock *sk,
156 struct sk_buff *skb); 154 struct sk_buff *skb);
157extern int llc_conn_ev_rx_ua_rsp_fbit_set_x(struct sock *sk, 155int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk,
158 struct sk_buff *skb); 156 struct sk_buff *skb);
159extern int llc_conn_ev_rx_xxx_cmd_pbit_set_x(struct sock *sk, 157int llc_conn_ev_p_tmr_exp(struct sock *sk, struct sk_buff *skb);
160 struct sk_buff *skb); 158int llc_conn_ev_ack_tmr_exp(struct sock *sk, struct sk_buff *skb);
161extern int llc_conn_ev_rx_xxx_rsp_fbit_set_x(struct sock *sk, 159int llc_conn_ev_rej_tmr_exp(struct sock *sk, struct sk_buff *skb);
162 struct sk_buff *skb); 160int llc_conn_ev_busy_tmr_exp(struct sock *sk, struct sk_buff *skb);
163extern int llc_conn_ev_rx_zzz_cmd_pbit_set_x_inval_nr(struct sock *sk, 161int llc_conn_ev_sendack_tmr_exp(struct sock *sk, struct sk_buff *skb);
164 struct sk_buff *skb);
165extern int llc_conn_ev_rx_zzz_rsp_fbit_set_x_inval_nr(struct sock *sk,
166 struct sk_buff *skb);
167extern int llc_conn_ev_p_tmr_exp(struct sock *sk, struct sk_buff *skb);
168extern int llc_conn_ev_ack_tmr_exp(struct sock *sk, struct sk_buff *skb);
169extern int llc_conn_ev_rej_tmr_exp(struct sock *sk, struct sk_buff *skb);
170extern int llc_conn_ev_busy_tmr_exp(struct sock *sk, struct sk_buff *skb);
171extern int llc_conn_ev_sendack_tmr_exp(struct sock *sk, struct sk_buff *skb);
172/* NOT_USED functions and their variations */ 162/* NOT_USED functions and their variations */
173extern int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, 163int llc_conn_ev_rx_xxx_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
174 struct sk_buff *skb); 164int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
175extern int llc_conn_ev_rx_xxx_rsp_fbit_set_1(struct sock *sk, 165int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk,
176 struct sk_buff *skb); 166 struct sk_buff *skb);
177extern int llc_conn_ev_rx_i_cmd_pbit_set_0_unexpd_ns(struct sock *sk, 167int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk,
178 struct sk_buff *skb); 168 struct sk_buff *skb);
179extern int llc_conn_ev_rx_i_cmd_pbit_set_1_unexpd_ns(struct sock *sk, 169int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
180 struct sk_buff *skb); 170int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
181extern int llc_conn_ev_rx_i_cmd_pbit_set_0(struct sock *sk, 171int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk,
182 struct sk_buff *skb); 172 struct sk_buff *skb);
183extern int llc_conn_ev_rx_i_cmd_pbit_set_1(struct sock *sk, 173int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk,
184 struct sk_buff *skb); 174 struct sk_buff *skb);
185extern int llc_conn_ev_rx_i_rsp_fbit_set_0_unexpd_ns(struct sock *sk, 175int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
186 struct sk_buff *skb); 176int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
187extern int llc_conn_ev_rx_i_rsp_fbit_set_1_unexpd_ns(struct sock *sk, 177int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
188 struct sk_buff *skb); 178int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
189extern int llc_conn_ev_rx_i_rsp_fbit_set_0(struct sock *sk, 179int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
190 struct sk_buff *skb); 180int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
191extern int llc_conn_ev_rx_i_rsp_fbit_set_1(struct sock *sk, 181int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
192 struct sk_buff *skb); 182int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
193extern int llc_conn_ev_rx_rr_cmd_pbit_set_0(struct sock *sk, 183int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
194 struct sk_buff *skb); 184int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
195extern int llc_conn_ev_rx_rr_cmd_pbit_set_1(struct sock *sk, 185int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk, struct sk_buff *skb);
196 struct sk_buff *skb); 186int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk, struct sk_buff *skb);
197extern int llc_conn_ev_rx_rr_rsp_fbit_set_0(struct sock *sk, 187int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk, struct sk_buff *skb);
198 struct sk_buff *skb); 188int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk, struct sk_buff *skb);
199extern int llc_conn_ev_rx_rr_rsp_fbit_set_1(struct sock *sk, 189int llc_conn_ev_rx_any_frame(struct sock *sk, struct sk_buff *skb);
200 struct sk_buff *skb); 190int llc_conn_ev_tx_buffer_full(struct sock *sk, struct sk_buff *skb);
201extern int llc_conn_ev_rx_rnr_cmd_pbit_set_0(struct sock *sk, 191int llc_conn_ev_init_p_f_cycle(struct sock *sk, struct sk_buff *skb);
202 struct sk_buff *skb);
203extern int llc_conn_ev_rx_rnr_cmd_pbit_set_1(struct sock *sk,
204 struct sk_buff *skb);
205extern int llc_conn_ev_rx_rnr_rsp_fbit_set_0(struct sock *sk,
206 struct sk_buff *skb);
207extern int llc_conn_ev_rx_rnr_rsp_fbit_set_1(struct sock *sk,
208 struct sk_buff *skb);
209extern int llc_conn_ev_rx_rej_cmd_pbit_set_0(struct sock *sk,
210 struct sk_buff *skb);
211extern int llc_conn_ev_rx_rej_cmd_pbit_set_1(struct sock *sk,
212 struct sk_buff *skb);
213extern int llc_conn_ev_rx_rej_rsp_fbit_set_0(struct sock *sk,
214 struct sk_buff *skb);
215extern int llc_conn_ev_rx_rej_rsp_fbit_set_1(struct sock *sk,
216 struct sk_buff *skb);
217extern int llc_conn_ev_rx_any_frame(struct sock *sk, struct sk_buff *skb);
218extern int llc_conn_ev_tx_buffer_full(struct sock *sk, struct sk_buff *skb);
219extern int llc_conn_ev_init_p_f_cycle(struct sock *sk, struct sk_buff *skb);
220 192
221/* Available connection action qualifiers */ 193/* Available connection action qualifiers */
222extern int llc_conn_ev_qlfy_data_flag_eq_1(struct sock *sk, 194int llc_conn_ev_qlfy_data_flag_eq_1(struct sock *sk, struct sk_buff *skb);
223 struct sk_buff *skb); 195int llc_conn_ev_qlfy_data_flag_eq_0(struct sock *sk, struct sk_buff *skb);
224extern int llc_conn_ev_qlfy_data_flag_eq_0(struct sock *sk, 196int llc_conn_ev_qlfy_data_flag_eq_2(struct sock *sk, struct sk_buff *skb);
225 struct sk_buff *skb); 197int llc_conn_ev_qlfy_p_flag_eq_1(struct sock *sk, struct sk_buff *skb);
226extern int llc_conn_ev_qlfy_data_flag_eq_2(struct sock *sk, 198int llc_conn_ev_qlfy_last_frame_eq_1(struct sock *sk, struct sk_buff *skb);
227 struct sk_buff *skb); 199int llc_conn_ev_qlfy_last_frame_eq_0(struct sock *sk, struct sk_buff *skb);
228extern int llc_conn_ev_qlfy_p_flag_eq_1(struct sock *sk, struct sk_buff *skb); 200int llc_conn_ev_qlfy_p_flag_eq_0(struct sock *sk, struct sk_buff *skb);
229extern int llc_conn_ev_qlfy_last_frame_eq_1(struct sock *sk, 201int llc_conn_ev_qlfy_p_flag_eq_f(struct sock *sk, struct sk_buff *skb);
230 struct sk_buff *skb); 202int llc_conn_ev_qlfy_remote_busy_eq_0(struct sock *sk, struct sk_buff *skb);
231extern int llc_conn_ev_qlfy_last_frame_eq_0(struct sock *sk, 203int llc_conn_ev_qlfy_remote_busy_eq_1(struct sock *sk, struct sk_buff *skb);
232 struct sk_buff *skb); 204int llc_conn_ev_qlfy_retry_cnt_lt_n2(struct sock *sk, struct sk_buff *skb);
233extern int llc_conn_ev_qlfy_p_flag_eq_0(struct sock *sk, struct sk_buff *skb); 205int llc_conn_ev_qlfy_retry_cnt_gte_n2(struct sock *sk, struct sk_buff *skb);
234extern int llc_conn_ev_qlfy_p_flag_eq_f(struct sock *sk, struct sk_buff *skb); 206int llc_conn_ev_qlfy_s_flag_eq_1(struct sock *sk, struct sk_buff *skb);
235extern int llc_conn_ev_qlfy_remote_busy_eq_0(struct sock *sk, 207int llc_conn_ev_qlfy_s_flag_eq_0(struct sock *sk, struct sk_buff *skb);
236 struct sk_buff *skb); 208int llc_conn_ev_qlfy_cause_flag_eq_1(struct sock *sk, struct sk_buff *skb);
237extern int llc_conn_ev_qlfy_remote_busy_eq_1(struct sock *sk, 209int llc_conn_ev_qlfy_cause_flag_eq_0(struct sock *sk, struct sk_buff *skb);
238 struct sk_buff *skb); 210int llc_conn_ev_qlfy_set_status_conn(struct sock *sk, struct sk_buff *skb);
239extern int llc_conn_ev_qlfy_retry_cnt_lt_n2(struct sock *sk, 211int llc_conn_ev_qlfy_set_status_disc(struct sock *sk, struct sk_buff *skb);
240 struct sk_buff *skb); 212int llc_conn_ev_qlfy_set_status_failed(struct sock *sk, struct sk_buff *skb);
241extern int llc_conn_ev_qlfy_retry_cnt_gte_n2(struct sock *sk, 213int llc_conn_ev_qlfy_set_status_remote_busy(struct sock *sk,
242 struct sk_buff *skb);
243extern int llc_conn_ev_qlfy_s_flag_eq_1(struct sock *sk, struct sk_buff *skb);
244extern int llc_conn_ev_qlfy_s_flag_eq_0(struct sock *sk, struct sk_buff *skb);
245extern int llc_conn_ev_qlfy_cause_flag_eq_1(struct sock *sk,
246 struct sk_buff *skb);
247extern int llc_conn_ev_qlfy_cause_flag_eq_0(struct sock *sk,
248 struct sk_buff *skb); 214 struct sk_buff *skb);
249extern int llc_conn_ev_qlfy_set_status_conn(struct sock *sk, 215int llc_conn_ev_qlfy_set_status_refuse(struct sock *sk, struct sk_buff *skb);
250 struct sk_buff *skb); 216int llc_conn_ev_qlfy_set_status_conflict(struct sock *sk, struct sk_buff *skb);
251extern int llc_conn_ev_qlfy_set_status_disc(struct sock *sk, 217int llc_conn_ev_qlfy_set_status_rst_done(struct sock *sk, struct sk_buff *skb);
252 struct sk_buff *skb);
253extern int llc_conn_ev_qlfy_set_status_failed(struct sock *sk,
254 struct sk_buff *skb);
255extern int llc_conn_ev_qlfy_set_status_remote_busy(struct sock *sk,
256 struct sk_buff *skb);
257extern int llc_conn_ev_qlfy_set_status_refuse(struct sock *sk,
258 struct sk_buff *skb);
259extern int llc_conn_ev_qlfy_set_status_conflict(struct sock *sk,
260 struct sk_buff *skb);
261extern int llc_conn_ev_qlfy_set_status_rst_done(struct sock *sk,
262 struct sk_buff *skb);
263 218
264static __inline__ int llc_conn_space(struct sock *sk, struct sk_buff *skb) 219static __inline__ int llc_conn_space(struct sock *sk, struct sk_buff *skb)
265{ 220{
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h
index 2f97d8ddce92..0134681acc4c 100644
--- a/include/net/llc_conn.h
+++ b/include/net/llc_conn.h
@@ -95,28 +95,24 @@ static __inline__ char llc_backlog_type(struct sk_buff *skb)
95 return skb->cb[sizeof(skb->cb) - 1]; 95 return skb->cb[sizeof(skb->cb) - 1];
96} 96}
97 97
98extern struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, 98struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority,
99 struct proto *prot); 99 struct proto *prot);
100extern void llc_sk_free(struct sock *sk); 100void llc_sk_free(struct sock *sk);
101 101
102extern void llc_sk_reset(struct sock *sk); 102void llc_sk_reset(struct sock *sk);
103 103
104/* Access to a connection */ 104/* Access to a connection */
105extern int llc_conn_state_process(struct sock *sk, struct sk_buff *skb); 105int llc_conn_state_process(struct sock *sk, struct sk_buff *skb);
106extern void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb); 106void llc_conn_send_pdu(struct sock *sk, struct sk_buff *skb);
107extern void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb); 107void llc_conn_rtn_pdu(struct sock *sk, struct sk_buff *skb);
108extern void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, 108void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit);
109 u8 first_p_bit); 109void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, u8 first_f_bit);
110extern void llc_conn_resend_i_pdu_as_rsp(struct sock *sk, u8 nr, 110int llc_conn_remove_acked_pdus(struct sock *conn, u8 nr, u16 *how_many_unacked);
111 u8 first_f_bit); 111struct sock *llc_lookup_established(struct llc_sap *sap, struct llc_addr *daddr,
112extern int llc_conn_remove_acked_pdus(struct sock *conn, u8 nr, 112 struct llc_addr *laddr);
113 u16 *how_many_unacked); 113void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk);
114extern struct sock *llc_lookup_established(struct llc_sap *sap, 114void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk);
115 struct llc_addr *daddr,
116 struct llc_addr *laddr);
117extern void llc_sap_add_socket(struct llc_sap *sap, struct sock *sk);
118extern void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk);
119 115
120extern u8 llc_data_accept_state(u8 state); 116u8 llc_data_accept_state(u8 state);
121extern void llc_build_offset_table(void); 117void llc_build_offset_table(void);
122#endif /* LLC_CONN_H */ 118#endif /* LLC_CONN_H */
diff --git a/include/net/llc_if.h b/include/net/llc_if.h
index f0cb909b60eb..8d5c543cd620 100644
--- a/include/net/llc_if.h
+++ b/include/net/llc_if.h
@@ -62,8 +62,7 @@
62#define LLC_STATUS_CONFLICT 7 /* disconnect conn */ 62#define LLC_STATUS_CONFLICT 7 /* disconnect conn */
63#define LLC_STATUS_RESET_DONE 8 /* */ 63#define LLC_STATUS_RESET_DONE 8 /* */
64 64
65extern int llc_establish_connection(struct sock *sk, u8 *lmac, 65int llc_establish_connection(struct sock *sk, u8 *lmac, u8 *dmac, u8 dsap);
66 u8 *dmac, u8 dsap); 66int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb);
67extern int llc_build_and_send_pkt(struct sock *sk, struct sk_buff *skb); 67int llc_send_disc(struct sock *sk);
68extern int llc_send_disc(struct sock *sk);
69#endif /* LLC_IF_H */ 68#endif /* LLC_IF_H */
diff --git a/include/net/llc_pdu.h b/include/net/llc_pdu.h
index 5a93d13ac95c..31e2de7d57c5 100644
--- a/include/net/llc_pdu.h
+++ b/include/net/llc_pdu.h
@@ -410,21 +410,20 @@ struct llc_frmr_info {
410 u8 ind_bits; /* indicator bits set with macro */ 410 u8 ind_bits; /* indicator bits set with macro */
411} __packed; 411} __packed;
412 412
413extern void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 type); 413void llc_pdu_set_cmd_rsp(struct sk_buff *skb, u8 type);
414extern void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value); 414void llc_pdu_set_pf_bit(struct sk_buff *skb, u8 bit_value);
415extern void llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit); 415void llc_pdu_decode_pf_bit(struct sk_buff *skb, u8 *pf_bit);
416extern void llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit); 416void llc_pdu_init_as_disc_cmd(struct sk_buff *skb, u8 p_bit);
417extern void llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr); 417void llc_pdu_init_as_i_cmd(struct sk_buff *skb, u8 p_bit, u8 ns, u8 nr);
418extern void llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr); 418void llc_pdu_init_as_rej_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
419extern void llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr); 419void llc_pdu_init_as_rnr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
420extern void llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr); 420void llc_pdu_init_as_rr_cmd(struct sk_buff *skb, u8 p_bit, u8 nr);
421extern void llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit); 421void llc_pdu_init_as_sabme_cmd(struct sk_buff *skb, u8 p_bit);
422extern void llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit); 422void llc_pdu_init_as_dm_rsp(struct sk_buff *skb, u8 f_bit);
423extern void llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, 423void llc_pdu_init_as_frmr_rsp(struct sk_buff *skb, struct llc_pdu_sn *prev_pdu,
424 struct llc_pdu_sn *prev_pdu, 424 u8 f_bit, u8 vs, u8 vr, u8 vzyxw);
425 u8 f_bit, u8 vs, u8 vr, u8 vzyxw); 425void llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
426extern void llc_pdu_init_as_rr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr); 426void llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
427extern void llc_pdu_init_as_rej_rsp(struct sk_buff *skb, u8 f_bit, u8 nr); 427void llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr);
428extern void llc_pdu_init_as_rnr_rsp(struct sk_buff *skb, u8 f_bit, u8 nr); 428void llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit);
429extern void llc_pdu_init_as_ua_rsp(struct sk_buff *skb, u8 f_bit);
430#endif /* LLC_PDU_H */ 429#endif /* LLC_PDU_H */
diff --git a/include/net/llc_s_ac.h b/include/net/llc_s_ac.h
index 37a3bbd02394..a61b98c108ee 100644
--- a/include/net/llc_s_ac.h
+++ b/include/net/llc_s_ac.h
@@ -25,15 +25,13 @@
25/* All action functions must look like this */ 25/* All action functions must look like this */
26typedef int (*llc_sap_action_t)(struct llc_sap *sap, struct sk_buff *skb); 26typedef int (*llc_sap_action_t)(struct llc_sap *sap, struct sk_buff *skb);
27 27
28extern int llc_sap_action_unitdata_ind(struct llc_sap *sap, 28int llc_sap_action_unitdata_ind(struct llc_sap *sap, struct sk_buff *skb);
29 struct sk_buff *skb); 29int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb);
30extern int llc_sap_action_send_ui(struct llc_sap *sap, struct sk_buff *skb); 30int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb);
31extern int llc_sap_action_send_xid_c(struct llc_sap *sap, struct sk_buff *skb); 31int llc_sap_action_send_xid_r(struct llc_sap *sap, struct sk_buff *skb);
32extern int llc_sap_action_send_xid_r(struct llc_sap *sap, struct sk_buff *skb); 32int llc_sap_action_send_test_c(struct llc_sap *sap, struct sk_buff *skb);
33extern int llc_sap_action_send_test_c(struct llc_sap *sap, struct sk_buff *skb); 33int llc_sap_action_send_test_r(struct llc_sap *sap, struct sk_buff *skb);
34extern int llc_sap_action_send_test_r(struct llc_sap *sap, struct sk_buff *skb); 34int llc_sap_action_report_status(struct llc_sap *sap, struct sk_buff *skb);
35extern int llc_sap_action_report_status(struct llc_sap *sap, 35int llc_sap_action_xid_ind(struct llc_sap *sap, struct sk_buff *skb);
36 struct sk_buff *skb); 36int llc_sap_action_test_ind(struct llc_sap *sap, struct sk_buff *skb);
37extern int llc_sap_action_xid_ind(struct llc_sap *sap, struct sk_buff *skb);
38extern int llc_sap_action_test_ind(struct llc_sap *sap, struct sk_buff *skb);
39#endif /* LLC_S_AC_H */ 37#endif /* LLC_S_AC_H */
diff --git a/include/net/llc_s_ev.h b/include/net/llc_s_ev.h
index e3acb9329e4a..84db3a59ed28 100644
--- a/include/net/llc_s_ev.h
+++ b/include/net/llc_s_ev.h
@@ -53,15 +53,14 @@ struct llc_sap;
53 53
54typedef int (*llc_sap_ev_t)(struct llc_sap *sap, struct sk_buff *skb); 54typedef int (*llc_sap_ev_t)(struct llc_sap *sap, struct sk_buff *skb);
55 55
56extern int llc_sap_ev_activation_req(struct llc_sap *sap, struct sk_buff *skb); 56int llc_sap_ev_activation_req(struct llc_sap *sap, struct sk_buff *skb);
57extern int llc_sap_ev_rx_ui(struct llc_sap *sap, struct sk_buff *skb); 57int llc_sap_ev_rx_ui(struct llc_sap *sap, struct sk_buff *skb);
58extern int llc_sap_ev_unitdata_req(struct llc_sap *sap, struct sk_buff *skb); 58int llc_sap_ev_unitdata_req(struct llc_sap *sap, struct sk_buff *skb);
59extern int llc_sap_ev_xid_req(struct llc_sap *sap, struct sk_buff *skb); 59int llc_sap_ev_xid_req(struct llc_sap *sap, struct sk_buff *skb);
60extern int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct sk_buff *skb); 60int llc_sap_ev_rx_xid_c(struct llc_sap *sap, struct sk_buff *skb);
61extern int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct sk_buff *skb); 61int llc_sap_ev_rx_xid_r(struct llc_sap *sap, struct sk_buff *skb);
62extern int llc_sap_ev_test_req(struct llc_sap *sap, struct sk_buff *skb); 62int llc_sap_ev_test_req(struct llc_sap *sap, struct sk_buff *skb);
63extern int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct sk_buff *skb); 63int llc_sap_ev_rx_test_c(struct llc_sap *sap, struct sk_buff *skb);
64extern int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct sk_buff *skb); 64int llc_sap_ev_rx_test_r(struct llc_sap *sap, struct sk_buff *skb);
65extern int llc_sap_ev_deactivation_req(struct llc_sap *sap, 65int llc_sap_ev_deactivation_req(struct llc_sap *sap, struct sk_buff *skb);
66 struct sk_buff *skb);
67#endif /* LLC_S_EV_H */ 66#endif /* LLC_S_EV_H */
diff --git a/include/net/llc_sap.h b/include/net/llc_sap.h
index ed25bec2f648..1e4df9fd9fb2 100644
--- a/include/net/llc_sap.h
+++ b/include/net/llc_sap.h
@@ -19,18 +19,14 @@ struct net_device;
19struct sk_buff; 19struct sk_buff;
20struct sock; 20struct sock;
21 21
22extern void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb); 22void llc_sap_rtn_pdu(struct llc_sap *sap, struct sk_buff *skb);
23extern void llc_save_primitive(struct sock *sk, struct sk_buff* skb, 23void llc_save_primitive(struct sock *sk, struct sk_buff *skb,
24 unsigned char prim); 24 unsigned char prim);
25extern struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev, 25struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev,
26 u8 type, u32 data_size); 26 u8 type, u32 data_size);
27 27
28extern void llc_build_and_send_test_pkt(struct llc_sap *sap, 28void llc_build_and_send_test_pkt(struct llc_sap *sap, struct sk_buff *skb,
29 struct sk_buff *skb, 29 unsigned char *dmac, unsigned char dsap);
30 unsigned char *dmac, 30void llc_build_and_send_xid_pkt(struct llc_sap *sap, struct sk_buff *skb,
31 unsigned char dsap); 31 unsigned char *dmac, unsigned char dsap);
32extern void llc_build_and_send_xid_pkt(struct llc_sap *sap,
33 struct sk_buff *skb,
34 unsigned char *dmac,
35 unsigned char dsap);
36#endif /* LLC_SAP_H */ 32#endif /* LLC_SAP_H */
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index cc6035f1a2f1..7ceed99a05bc 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -829,6 +829,15 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
829 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3 829 * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
830 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used 830 * @RX_FLAG_10MHZ: 10 MHz (half channel) was used
831 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used 831 * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used
832 * @RX_FLAG_AMSDU_MORE: Some drivers may prefer to report separate A-MSDU
833 * subframes instead of a one huge frame for performance reasons.
834 * All, but the last MSDU from an A-MSDU should have this flag set. E.g.
835 * if an A-MSDU has 3 frames, the first 2 must have the flag set, while
836 * the 3rd (last) one must not have this flag set. The flag is used to
837 * deal with retransmission/duplication recovery properly since A-MSDU
838 * subframes share the same sequence number. Reported subframes can be
839 * either regular MSDU or singly A-MSDUs. Subframes must not be
840 * interleaved with other frames.
832 */ 841 */
833enum mac80211_rx_flags { 842enum mac80211_rx_flags {
834 RX_FLAG_MMIC_ERROR = BIT(0), 843 RX_FLAG_MMIC_ERROR = BIT(0),
@@ -859,6 +868,7 @@ enum mac80211_rx_flags {
859 RX_FLAG_STBC_MASK = BIT(26) | BIT(27), 868 RX_FLAG_STBC_MASK = BIT(26) | BIT(27),
860 RX_FLAG_10MHZ = BIT(28), 869 RX_FLAG_10MHZ = BIT(28),
861 RX_FLAG_5MHZ = BIT(29), 870 RX_FLAG_5MHZ = BIT(29),
871 RX_FLAG_AMSDU_MORE = BIT(30),
862}; 872};
863 873
864#define RX_FLAG_STBC_SHIFT 26 874#define RX_FLAG_STBC_SHIFT 26
@@ -1492,6 +1502,15 @@ struct ieee80211_tx_control {
1492 * 1502 *
1493 * @IEEE80211_HW_TIMING_BEACON_ONLY: Use sync timing from beacon frames 1503 * @IEEE80211_HW_TIMING_BEACON_ONLY: Use sync timing from beacon frames
1494 * only, to allow getting TBTT of a DTIM beacon. 1504 * only, to allow getting TBTT of a DTIM beacon.
1505 *
1506 * @IEEE80211_HW_SUPPORTS_HT_CCK_RATES: Hardware supports mixing HT/CCK rates
1507 * and can cope with CCK rates in an aggregation session (e.g. by not
1508 * using aggregation for such frames.)
1509 *
1510 * @IEEE80211_HW_CHANCTX_STA_CSA: Support 802.11h based channel-switch (CSA)
1511 * for a single active channel while using channel contexts. When support
1512 * is not enabled the default action is to disconnect when getting the
1513 * CSA frame.
1495 */ 1514 */
1496enum ieee80211_hw_flags { 1515enum ieee80211_hw_flags {
1497 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0, 1516 IEEE80211_HW_HAS_RATE_CONTROL = 1<<0,
@@ -1522,6 +1541,7 @@ enum ieee80211_hw_flags {
1522 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25, 1541 IEEE80211_HW_P2P_DEV_ADDR_FOR_INTF = 1<<25,
1523 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26, 1542 IEEE80211_HW_TIMING_BEACON_ONLY = 1<<26,
1524 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27, 1543 IEEE80211_HW_SUPPORTS_HT_CCK_RATES = 1<<27,
1544 IEEE80211_HW_CHANCTX_STA_CSA = 1<<28,
1525}; 1545};
1526 1546
1527/** 1547/**
@@ -2666,6 +2686,10 @@ enum ieee80211_roc_type {
2666 * zero using ieee80211_csa_is_complete() after the beacon has been 2686 * zero using ieee80211_csa_is_complete() after the beacon has been
2667 * transmitted and then call ieee80211_csa_finish(). 2687 * transmitted and then call ieee80211_csa_finish().
2668 * 2688 *
2689 * @join_ibss: Join an IBSS (on an IBSS interface); this is called after all
2690 * information in bss_conf is set up and the beacon can be retrieved. A
2691 * channel context is bound before this is called.
2692 * @leave_ibss: Leave the IBSS again.
2669 */ 2693 */
2670struct ieee80211_ops { 2694struct ieee80211_ops {
2671 void (*tx)(struct ieee80211_hw *hw, 2695 void (*tx)(struct ieee80211_hw *hw,
@@ -2857,6 +2881,9 @@ struct ieee80211_ops {
2857 void (*channel_switch_beacon)(struct ieee80211_hw *hw, 2881 void (*channel_switch_beacon)(struct ieee80211_hw *hw,
2858 struct ieee80211_vif *vif, 2882 struct ieee80211_vif *vif,
2859 struct cfg80211_chan_def *chandef); 2883 struct cfg80211_chan_def *chandef);
2884
2885 int (*join_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2886 void (*leave_ibss)(struct ieee80211_hw *hw, struct ieee80211_vif *vif);
2860}; 2887};
2861 2888
2862/** 2889/**
@@ -3920,6 +3947,25 @@ void ieee80211_iterate_active_interfaces_atomic(struct ieee80211_hw *hw,
3920 void *data); 3947 void *data);
3921 3948
3922/** 3949/**
3950 * ieee80211_iterate_active_interfaces_rtnl - iterate active interfaces
3951 *
3952 * This function iterates over the interfaces associated with a given
3953 * hardware that are currently active and calls the callback for them.
3954 * This version can only be used while holding the RTNL.
3955 *
3956 * @hw: the hardware struct of which the interfaces should be iterated over
3957 * @iter_flags: iteration flags, see &enum ieee80211_interface_iteration_flags
3958 * @iterator: the iterator function to call, cannot sleep
3959 * @data: first argument of the iterator function
3960 */
3961void ieee80211_iterate_active_interfaces_rtnl(struct ieee80211_hw *hw,
3962 u32 iter_flags,
3963 void (*iterator)(void *data,
3964 u8 *mac,
3965 struct ieee80211_vif *vif),
3966 void *data);
3967
3968/**
3923 * ieee80211_queue_work - add work onto the mac80211 workqueue 3969 * ieee80211_queue_work - add work onto the mac80211 workqueue
3924 * 3970 *
3925 * Drivers and mac80211 use this to add work onto the mac80211 workqueue. 3971 * Drivers and mac80211 use this to add work onto the mac80211 workqueue.
@@ -4525,4 +4571,18 @@ void ieee80211_report_wowlan_wakeup(struct ieee80211_vif *vif,
4525 struct cfg80211_wowlan_wakeup *wakeup, 4571 struct cfg80211_wowlan_wakeup *wakeup,
4526 gfp_t gfp); 4572 gfp_t gfp);
4527 4573
4574/**
4575 * ieee80211_tx_prepare_skb - prepare an 802.11 skb for transmission
4576 * @hw: pointer as obtained from ieee80211_alloc_hw()
4577 * @vif: virtual interface
4578 * @skb: frame to be sent from within the driver
4579 * @band: the band to transmit on
4580 * @sta: optional pointer to get the station to send the frame to
4581 *
4582 * Note: must be called under RCU lock
4583 */
4584bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
4585 struct ieee80211_vif *vif, struct sk_buff *skb,
4586 int band, struct ieee80211_sta **sta);
4587
4528#endif /* MAC80211_H */ 4588#endif /* MAC80211_H */
diff --git a/include/net/mrp.h b/include/net/mrp.h
index 0f7558b638ae..31912c3be772 100644
--- a/include/net/mrp.h
+++ b/include/net/mrp.h
@@ -126,19 +126,17 @@ struct mrp_port {
126 struct rcu_head rcu; 126 struct rcu_head rcu;
127}; 127};
128 128
129extern int mrp_register_application(struct mrp_application *app); 129int mrp_register_application(struct mrp_application *app);
130extern void mrp_unregister_application(struct mrp_application *app); 130void mrp_unregister_application(struct mrp_application *app);
131 131
132extern int mrp_init_applicant(struct net_device *dev, 132int mrp_init_applicant(struct net_device *dev, struct mrp_application *app);
133 struct mrp_application *app); 133void mrp_uninit_applicant(struct net_device *dev, struct mrp_application *app);
134extern void mrp_uninit_applicant(struct net_device *dev, 134
135 struct mrp_application *app); 135int mrp_request_join(const struct net_device *dev,
136 136 const struct mrp_application *app,
137extern int mrp_request_join(const struct net_device *dev, 137 const void *value, u8 len, u8 type);
138 const struct mrp_application *app, 138void mrp_request_leave(const struct net_device *dev,
139 const void *value, u8 len, u8 type); 139 const struct mrp_application *app,
140extern void mrp_request_leave(const struct net_device *dev, 140 const void *value, u8 len, u8 type);
141 const struct mrp_application *app,
142 const void *value, u8 len, u8 type);
143 141
144#endif /* _NET_MRP_H */ 142#endif /* _NET_MRP_H */
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index ea0cc26ab70e..6bbda34d5e59 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -110,8 +110,8 @@ struct ndisc_options {
110 110
111#define NDISC_OPT_SPACE(len) (((len)+2+7)&~7) 111#define NDISC_OPT_SPACE(len) (((len)+2+7)&~7)
112 112
113extern struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len, 113struct ndisc_options *ndisc_parse_options(u8 *opt, int opt_len,
114 struct ndisc_options *ndopts); 114 struct ndisc_options *ndopts);
115 115
116/* 116/*
117 * Return the padding between the option length and the start of the 117 * Return the padding between the option length and the start of the
@@ -189,60 +189,51 @@ static inline struct neighbour *__ipv6_neigh_lookup(struct net_device *dev, cons
189 return n; 189 return n;
190} 190}
191 191
192extern int ndisc_init(void); 192int ndisc_init(void);
193extern int ndisc_late_init(void); 193int ndisc_late_init(void);
194 194
195extern void ndisc_late_cleanup(void); 195void ndisc_late_cleanup(void);
196extern void ndisc_cleanup(void); 196void ndisc_cleanup(void);
197 197
198extern int ndisc_rcv(struct sk_buff *skb); 198int ndisc_rcv(struct sk_buff *skb);
199 199
200extern void ndisc_send_ns(struct net_device *dev, 200void ndisc_send_ns(struct net_device *dev, struct neighbour *neigh,
201 struct neighbour *neigh, 201 const struct in6_addr *solicit,
202 const struct in6_addr *solicit, 202 const struct in6_addr *daddr, const struct in6_addr *saddr);
203 const struct in6_addr *daddr,
204 const struct in6_addr *saddr);
205 203
206extern void ndisc_send_rs(struct net_device *dev, 204void ndisc_send_rs(struct net_device *dev,
207 const struct in6_addr *saddr, 205 const struct in6_addr *saddr, const struct in6_addr *daddr);
208 const struct in6_addr *daddr); 206void ndisc_send_na(struct net_device *dev, struct neighbour *neigh,
209extern void ndisc_send_na(struct net_device *dev, struct neighbour *neigh, 207 const struct in6_addr *daddr,
210 const struct in6_addr *daddr, 208 const struct in6_addr *solicited_addr,
211 const struct in6_addr *solicited_addr, 209 bool router, bool solicited, bool override, bool inc_opt);
212 bool router, bool solicited, bool override,
213 bool inc_opt);
214 210
215extern void ndisc_send_redirect(struct sk_buff *skb, 211void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target);
216 const struct in6_addr *target);
217 212
218extern int ndisc_mc_map(const struct in6_addr *addr, char *buf, 213int ndisc_mc_map(const struct in6_addr *addr, char *buf, struct net_device *dev,
219 struct net_device *dev, int dir); 214 int dir);
220 215
221 216
222/* 217/*
223 * IGMP 218 * IGMP
224 */ 219 */
225extern int igmp6_init(void); 220int igmp6_init(void);
226 221
227extern void igmp6_cleanup(void); 222void igmp6_cleanup(void);
228 223
229extern int igmp6_event_query(struct sk_buff *skb); 224int igmp6_event_query(struct sk_buff *skb);
230 225
231extern int igmp6_event_report(struct sk_buff *skb); 226int igmp6_event_report(struct sk_buff *skb);
232 227
233 228
234#ifdef CONFIG_SYSCTL 229#ifdef CONFIG_SYSCTL
235extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, 230int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, int write,
236 int write, 231 void __user *buffer, size_t *lenp, loff_t *ppos);
237 void __user *buffer,
238 size_t *lenp,
239 loff_t *ppos);
240int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl, 232int ndisc_ifinfo_sysctl_strategy(struct ctl_table *ctl,
241 void __user *oldval, size_t __user *oldlenp, 233 void __user *oldval, size_t __user *oldlenp,
242 void __user *newval, size_t newlen); 234 void __user *newval, size_t newlen);
243#endif 235#endif
244 236
245extern void inet6_ifinfo_notify(int event, 237void inet6_ifinfo_notify(int event, struct inet6_dev *idev);
246 struct inet6_dev *idev);
247 238
248#endif 239#endif
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h
index 9d22f08896c6..da68c9a90ac5 100644
--- a/include/net/net_namespace.h
+++ b/include/net/net_namespace.h
@@ -22,6 +22,7 @@
22#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 22#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
23#include <net/netns/conntrack.h> 23#include <net/netns/conntrack.h>
24#endif 24#endif
25#include <net/netns/nftables.h>
25#include <net/netns/xfrm.h> 26#include <net/netns/xfrm.h>
26 27
27struct user_namespace; 28struct user_namespace;
@@ -101,6 +102,9 @@ struct net {
101#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) 102#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
102 struct netns_ct ct; 103 struct netns_ct ct;
103#endif 104#endif
105#if defined(CONFIG_NF_TABLES) || defined(CONFIG_NF_TABLES_MODULE)
106 struct netns_nftables nft;
107#endif
104#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) 108#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)
105 struct netns_nf_frag nf_frag; 109 struct netns_nf_frag nf_frag;
106#endif 110#endif
@@ -137,8 +141,8 @@ struct net {
137extern struct net init_net; 141extern struct net init_net;
138 142
139#ifdef CONFIG_NET_NS 143#ifdef CONFIG_NET_NS
140extern struct net *copy_net_ns(unsigned long flags, 144struct net *copy_net_ns(unsigned long flags, struct user_namespace *user_ns,
141 struct user_namespace *user_ns, struct net *old_net); 145 struct net *old_net);
142 146
143#else /* CONFIG_NET_NS */ 147#else /* CONFIG_NET_NS */
144#include <linux/sched.h> 148#include <linux/sched.h>
@@ -155,11 +159,11 @@ static inline struct net *copy_net_ns(unsigned long flags,
155 159
156extern struct list_head net_namespace_list; 160extern struct list_head net_namespace_list;
157 161
158extern struct net *get_net_ns_by_pid(pid_t pid); 162struct net *get_net_ns_by_pid(pid_t pid);
159extern struct net *get_net_ns_by_fd(int pid); 163struct net *get_net_ns_by_fd(int pid);
160 164
161#ifdef CONFIG_NET_NS 165#ifdef CONFIG_NET_NS
162extern void __put_net(struct net *net); 166void __put_net(struct net *net);
163 167
164static inline struct net *get_net(struct net *net) 168static inline struct net *get_net(struct net *net)
165{ 169{
@@ -191,7 +195,7 @@ int net_eq(const struct net *net1, const struct net *net2)
191 return net1 == net2; 195 return net1 == net2;
192} 196}
193 197
194extern void net_drop_ns(void *); 198void net_drop_ns(void *);
195 199
196#else 200#else
197 201
@@ -308,19 +312,19 @@ struct pernet_operations {
308 * device which caused kernel oops, and panics during network 312 * device which caused kernel oops, and panics during network
309 * namespace cleanup. So please don't get this wrong. 313 * namespace cleanup. So please don't get this wrong.
310 */ 314 */
311extern int register_pernet_subsys(struct pernet_operations *); 315int register_pernet_subsys(struct pernet_operations *);
312extern void unregister_pernet_subsys(struct pernet_operations *); 316void unregister_pernet_subsys(struct pernet_operations *);
313extern int register_pernet_device(struct pernet_operations *); 317int register_pernet_device(struct pernet_operations *);
314extern void unregister_pernet_device(struct pernet_operations *); 318void unregister_pernet_device(struct pernet_operations *);
315 319
316struct ctl_table; 320struct ctl_table;
317struct ctl_table_header; 321struct ctl_table_header;
318 322
319#ifdef CONFIG_SYSCTL 323#ifdef CONFIG_SYSCTL
320extern int net_sysctl_init(void); 324int net_sysctl_init(void);
321extern struct ctl_table_header *register_net_sysctl(struct net *net, 325struct ctl_table_header *register_net_sysctl(struct net *net, const char *path,
322 const char *path, struct ctl_table *table); 326 struct ctl_table *table);
323extern void unregister_net_sysctl_table(struct ctl_table_header *header); 327void unregister_net_sysctl_table(struct ctl_table_header *header);
324#else 328#else
325static inline int net_sysctl_init(void) { return 0; } 329static inline int net_sysctl_init(void) { return 0; }
326static inline struct ctl_table_header *register_net_sysctl(struct net *net, 330static inline struct ctl_table_header *register_net_sysctl(struct net *net,
diff --git a/include/net/netevent.h b/include/net/netevent.h
index fe630dde35c3..d8bbb38584b6 100644
--- a/include/net/netevent.h
+++ b/include/net/netevent.h
@@ -26,8 +26,8 @@ enum netevent_notif_type {
26 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */ 26 NETEVENT_REDIRECT, /* arg is struct netevent_redirect ptr */
27}; 27};
28 28
29extern int register_netevent_notifier(struct notifier_block *nb); 29int register_netevent_notifier(struct notifier_block *nb);
30extern int unregister_netevent_notifier(struct notifier_block *nb); 30int unregister_netevent_notifier(struct notifier_block *nb);
31extern int call_netevent_notifiers(unsigned long val, void *v); 31int call_netevent_notifiers(unsigned long val, void *v);
32 32
33#endif 33#endif
diff --git a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
index 7573d52a4346..6c3d12e2949f 100644
--- a/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_conntrack_ipv4.h
@@ -16,9 +16,9 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp4;
16extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4; 16extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp4;
17extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp; 17extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
18 18
19extern int nf_conntrack_ipv4_compat_init(void); 19int nf_conntrack_ipv4_compat_init(void);
20extern void nf_conntrack_ipv4_compat_fini(void); 20void nf_conntrack_ipv4_compat_fini(void);
21 21
22extern void need_ipv4_conntrack(void); 22void need_ipv4_conntrack(void);
23 23
24#endif /*_NF_CONNTRACK_IPV4_H*/ 24#endif /*_NF_CONNTRACK_IPV4_H*/
diff --git a/include/net/netfilter/ipv4/nf_defrag_ipv4.h b/include/net/netfilter/ipv4/nf_defrag_ipv4.h
index 6b00ea38546b..f01ef208dff6 100644
--- a/include/net/netfilter/ipv4/nf_defrag_ipv4.h
+++ b/include/net/netfilter/ipv4/nf_defrag_ipv4.h
@@ -1,6 +1,6 @@
1#ifndef _NF_DEFRAG_IPV4_H 1#ifndef _NF_DEFRAG_IPV4_H
2#define _NF_DEFRAG_IPV4_H 2#define _NF_DEFRAG_IPV4_H
3 3
4extern void nf_defrag_ipv4_enable(void); 4void nf_defrag_ipv4_enable(void);
5 5
6#endif /* _NF_DEFRAG_IPV4_H */ 6#endif /* _NF_DEFRAG_IPV4_H */
diff --git a/include/net/netfilter/ipv6/nf_defrag_ipv6.h b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
index fd79c9a1779d..27666d8a0bd0 100644
--- a/include/net/netfilter/ipv6/nf_defrag_ipv6.h
+++ b/include/net/netfilter/ipv6/nf_defrag_ipv6.h
@@ -1,15 +1,12 @@
1#ifndef _NF_DEFRAG_IPV6_H 1#ifndef _NF_DEFRAG_IPV6_H
2#define _NF_DEFRAG_IPV6_H 2#define _NF_DEFRAG_IPV6_H
3 3
4extern void nf_defrag_ipv6_enable(void); 4void nf_defrag_ipv6_enable(void);
5 5
6extern int nf_ct_frag6_init(void); 6int nf_ct_frag6_init(void);
7extern void nf_ct_frag6_cleanup(void); 7void nf_ct_frag6_cleanup(void);
8extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user); 8struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user);
9extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb, 9void nf_ct_frag6_consume_orig(struct sk_buff *skb);
10 struct net_device *in,
11 struct net_device *out,
12 int (*okfn)(struct sk_buff *));
13 10
14struct inet_frags_ctl; 11struct inet_frags_ctl;
15 12
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 0c1288a50e8b..01ea6eed1bb1 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -139,15 +139,13 @@ static inline struct net *nf_ct_net(const struct nf_conn *ct)
139} 139}
140 140
141/* Alter reply tuple (maybe alter helper). */ 141/* Alter reply tuple (maybe alter helper). */
142extern void 142void nf_conntrack_alter_reply(struct nf_conn *ct,
143nf_conntrack_alter_reply(struct nf_conn *ct, 143 const struct nf_conntrack_tuple *newreply);
144 const struct nf_conntrack_tuple *newreply);
145 144
146/* Is this tuple taken? (ignoring any belonging to the given 145/* Is this tuple taken? (ignoring any belonging to the given
147 conntrack). */ 146 conntrack). */
148extern int 147int nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
149nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple, 148 const struct nf_conn *ignored_conntrack);
150 const struct nf_conn *ignored_conntrack);
151 149
152/* Return conntrack_info and tuple hash for given skb. */ 150/* Return conntrack_info and tuple hash for given skb. */
153static inline struct nf_conn * 151static inline struct nf_conn *
@@ -165,37 +163,34 @@ static inline void nf_ct_put(struct nf_conn *ct)
165} 163}
166 164
167/* Protocol module loading */ 165/* Protocol module loading */
168extern int nf_ct_l3proto_try_module_get(unsigned short l3proto); 166int nf_ct_l3proto_try_module_get(unsigned short l3proto);
169extern void nf_ct_l3proto_module_put(unsigned short l3proto); 167void nf_ct_l3proto_module_put(unsigned short l3proto);
170 168
171/* 169/*
172 * Allocate a hashtable of hlist_head (if nulls == 0), 170 * Allocate a hashtable of hlist_head (if nulls == 0),
173 * or hlist_nulls_head (if nulls == 1) 171 * or hlist_nulls_head (if nulls == 1)
174 */ 172 */
175extern void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls); 173void *nf_ct_alloc_hashtable(unsigned int *sizep, int nulls);
176 174
177extern void nf_ct_free_hashtable(void *hash, unsigned int size); 175void nf_ct_free_hashtable(void *hash, unsigned int size);
178 176
179extern struct nf_conntrack_tuple_hash * 177struct nf_conntrack_tuple_hash *
180__nf_conntrack_find(struct net *net, u16 zone, 178__nf_conntrack_find(struct net *net, u16 zone,
181 const struct nf_conntrack_tuple *tuple); 179 const struct nf_conntrack_tuple *tuple);
182 180
183extern int nf_conntrack_hash_check_insert(struct nf_conn *ct); 181int nf_conntrack_hash_check_insert(struct nf_conn *ct);
184bool nf_ct_delete(struct nf_conn *ct, u32 pid, int report); 182bool nf_ct_delete(struct nf_conn *ct, u32 pid, int report);
185 183
186extern void nf_conntrack_flush_report(struct net *net, u32 portid, int report); 184void nf_conntrack_flush_report(struct net *net, u32 portid, int report);
187 185
188extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, 186bool nf_ct_get_tuplepr(const struct sk_buff *skb, unsigned int nhoff,
189 unsigned int nhoff, u_int16_t l3num, 187 u_int16_t l3num, struct nf_conntrack_tuple *tuple);
190 struct nf_conntrack_tuple *tuple); 188bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse,
191extern bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, 189 const struct nf_conntrack_tuple *orig);
192 const struct nf_conntrack_tuple *orig);
193 190
194extern void __nf_ct_refresh_acct(struct nf_conn *ct, 191void __nf_ct_refresh_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
195 enum ip_conntrack_info ctinfo, 192 const struct sk_buff *skb,
196 const struct sk_buff *skb, 193 unsigned long extra_jiffies, int do_acct);
197 unsigned long extra_jiffies,
198 int do_acct);
199 194
200/* Refresh conntrack for this many jiffies and do accounting */ 195/* Refresh conntrack for this many jiffies and do accounting */
201static inline void nf_ct_refresh_acct(struct nf_conn *ct, 196static inline void nf_ct_refresh_acct(struct nf_conn *ct,
@@ -214,10 +209,8 @@ static inline void nf_ct_refresh(struct nf_conn *ct,
214 __nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0); 209 __nf_ct_refresh_acct(ct, 0, skb, extra_jiffies, 0);
215} 210}
216 211
217extern bool __nf_ct_kill_acct(struct nf_conn *ct, 212bool __nf_ct_kill_acct(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
218 enum ip_conntrack_info ctinfo, 213 const struct sk_buff *skb, int do_acct);
219 const struct sk_buff *skb,
220 int do_acct);
221 214
222/* kill conntrack and do accounting */ 215/* kill conntrack and do accounting */
223static inline bool nf_ct_kill_acct(struct nf_conn *ct, 216static inline bool nf_ct_kill_acct(struct nf_conn *ct,
@@ -244,19 +237,17 @@ static inline struct nf_conn *nf_ct_untracked_get(void)
244{ 237{
245 return &__raw_get_cpu_var(nf_conntrack_untracked); 238 return &__raw_get_cpu_var(nf_conntrack_untracked);
246} 239}
247extern void nf_ct_untracked_status_or(unsigned long bits); 240void nf_ct_untracked_status_or(unsigned long bits);
248 241
249/* Iterate over all conntracks: if iter returns true, it's deleted. */ 242/* Iterate over all conntracks: if iter returns true, it's deleted. */
250extern void 243void nf_ct_iterate_cleanup(struct net *net,
251nf_ct_iterate_cleanup(struct net *net, 244 int (*iter)(struct nf_conn *i, void *data),
252 int (*iter)(struct nf_conn *i, void *data), 245 void *data, u32 portid, int report);
253 void *data, u32 portid, int report); 246void nf_conntrack_free(struct nf_conn *ct);
254extern void nf_conntrack_free(struct nf_conn *ct); 247struct nf_conn *nf_conntrack_alloc(struct net *net, u16 zone,
255extern struct nf_conn * 248 const struct nf_conntrack_tuple *orig,
256nf_conntrack_alloc(struct net *net, u16 zone, 249 const struct nf_conntrack_tuple *repl,
257 const struct nf_conntrack_tuple *orig, 250 gfp_t gfp);
258 const struct nf_conntrack_tuple *repl,
259 gfp_t gfp);
260 251
261static inline int nf_ct_is_template(const struct nf_conn *ct) 252static inline int nf_ct_is_template(const struct nf_conn *ct)
262{ 253{
@@ -287,7 +278,7 @@ static inline bool nf_is_loopback_packet(const struct sk_buff *skb)
287 278
288struct kernel_param; 279struct kernel_param;
289 280
290extern int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp); 281int nf_conntrack_set_hashsize(const char *val, struct kernel_param *kp);
291extern unsigned int nf_conntrack_htable_size; 282extern unsigned int nf_conntrack_htable_size;
292extern unsigned int nf_conntrack_max; 283extern unsigned int nf_conntrack_max;
293extern unsigned int nf_conntrack_hash_rnd; 284extern unsigned int nf_conntrack_hash_rnd;
diff --git a/include/net/netfilter/nf_conntrack_acct.h b/include/net/netfilter/nf_conntrack_acct.h
index 2bdb7a15fe06..79d8d16732b4 100644
--- a/include/net/netfilter/nf_conntrack_acct.h
+++ b/include/net/netfilter/nf_conntrack_acct.h
@@ -19,17 +19,21 @@ struct nf_conn_counter {
19 atomic64_t bytes; 19 atomic64_t bytes;
20}; 20};
21 21
22struct nf_conn_acct {
23 struct nf_conn_counter counter[IP_CT_DIR_MAX];
24};
25
22static inline 26static inline
23struct nf_conn_counter *nf_conn_acct_find(const struct nf_conn *ct) 27struct nf_conn_acct *nf_conn_acct_find(const struct nf_conn *ct)
24{ 28{
25 return nf_ct_ext_find(ct, NF_CT_EXT_ACCT); 29 return nf_ct_ext_find(ct, NF_CT_EXT_ACCT);
26} 30}
27 31
28static inline 32static inline
29struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp) 33struct nf_conn_acct *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
30{ 34{
31 struct net *net = nf_ct_net(ct); 35 struct net *net = nf_ct_net(ct);
32 struct nf_conn_counter *acct; 36 struct nf_conn_acct *acct;
33 37
34 if (!net->ct.sysctl_acct) 38 if (!net->ct.sysctl_acct)
35 return NULL; 39 return NULL;
@@ -42,8 +46,8 @@ struct nf_conn_counter *nf_ct_acct_ext_add(struct nf_conn *ct, gfp_t gfp)
42 return acct; 46 return acct;
43}; 47};
44 48
45extern unsigned int 49unsigned int seq_print_acct(struct seq_file *s, const struct nf_conn *ct,
46seq_print_acct(struct seq_file *s, const struct nf_conn *ct, int dir); 50 int dir);
47 51
48/* Check if connection tracking accounting is enabled */ 52/* Check if connection tracking accounting is enabled */
49static inline bool nf_ct_acct_enabled(struct net *net) 53static inline bool nf_ct_acct_enabled(struct net *net)
@@ -57,9 +61,9 @@ static inline void nf_ct_set_acct(struct net *net, bool enable)
57 net->ct.sysctl_acct = enable; 61 net->ct.sysctl_acct = enable;
58} 62}
59 63
60extern int nf_conntrack_acct_pernet_init(struct net *net); 64int nf_conntrack_acct_pernet_init(struct net *net);
61extern void nf_conntrack_acct_pernet_fini(struct net *net); 65void nf_conntrack_acct_pernet_fini(struct net *net);
62 66
63extern int nf_conntrack_acct_init(void); 67int nf_conntrack_acct_init(void);
64extern void nf_conntrack_acct_fini(void); 68void nf_conntrack_acct_fini(void);
65#endif /* _NF_CONNTRACK_ACCT_H */ 69#endif /* _NF_CONNTRACK_ACCT_H */
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index fb2b6234e937..15308b8eb5b5 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -20,49 +20,42 @@
20/* This header is used to share core functionality between the 20/* This header is used to share core functionality between the
21 standalone connection tracking module, and the compatibility layer's use 21 standalone connection tracking module, and the compatibility layer's use
22 of connection tracking. */ 22 of connection tracking. */
23extern unsigned int nf_conntrack_in(struct net *net, 23unsigned int nf_conntrack_in(struct net *net, u_int8_t pf, unsigned int hooknum,
24 u_int8_t pf, 24 struct sk_buff *skb);
25 unsigned int hooknum, 25
26 struct sk_buff *skb); 26int nf_conntrack_init_net(struct net *net);
27 27void nf_conntrack_cleanup_net(struct net *net);
28extern int nf_conntrack_init_net(struct net *net); 28void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list);
29extern void nf_conntrack_cleanup_net(struct net *net); 29
30extern void nf_conntrack_cleanup_net_list(struct list_head *net_exit_list); 30int nf_conntrack_proto_pernet_init(struct net *net);
31 31void nf_conntrack_proto_pernet_fini(struct net *net);
32extern int nf_conntrack_proto_pernet_init(struct net *net); 32
33extern void nf_conntrack_proto_pernet_fini(struct net *net); 33int nf_conntrack_proto_init(void);
34 34void nf_conntrack_proto_fini(void);
35extern int nf_conntrack_proto_init(void); 35
36extern void nf_conntrack_proto_fini(void); 36int nf_conntrack_init_start(void);
37 37void nf_conntrack_cleanup_start(void);
38extern int nf_conntrack_init_start(void); 38
39extern void nf_conntrack_cleanup_start(void); 39void nf_conntrack_init_end(void);
40 40void nf_conntrack_cleanup_end(void);
41extern void nf_conntrack_init_end(void); 41
42extern void nf_conntrack_cleanup_end(void); 42bool nf_ct_get_tuple(const struct sk_buff *skb, unsigned int nhoff,
43 43 unsigned int dataoff, u_int16_t l3num, u_int8_t protonum,
44extern bool 44 struct nf_conntrack_tuple *tuple,
45nf_ct_get_tuple(const struct sk_buff *skb, 45 const struct nf_conntrack_l3proto *l3proto,
46 unsigned int nhoff, 46 const struct nf_conntrack_l4proto *l4proto);
47 unsigned int dataoff, 47
48 u_int16_t l3num, 48bool nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
49 u_int8_t protonum, 49 const struct nf_conntrack_tuple *orig,
50 struct nf_conntrack_tuple *tuple, 50 const struct nf_conntrack_l3proto *l3proto,
51 const struct nf_conntrack_l3proto *l3proto, 51 const struct nf_conntrack_l4proto *l4proto);
52 const struct nf_conntrack_l4proto *l4proto);
53
54extern bool
55nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
56 const struct nf_conntrack_tuple *orig,
57 const struct nf_conntrack_l3proto *l3proto,
58 const struct nf_conntrack_l4proto *l4proto);
59 52
60/* Find a connection corresponding to a tuple. */ 53/* Find a connection corresponding to a tuple. */
61extern struct nf_conntrack_tuple_hash * 54struct nf_conntrack_tuple_hash *
62nf_conntrack_find_get(struct net *net, u16 zone, 55nf_conntrack_find_get(struct net *net, u16 zone,
63 const struct nf_conntrack_tuple *tuple); 56 const struct nf_conntrack_tuple *tuple);
64 57
65extern int __nf_conntrack_confirm(struct sk_buff *skb); 58int __nf_conntrack_confirm(struct sk_buff *skb);
66 59
67/* Confirm a connection: returns NF_DROP if packet must be dropped. */ 60/* Confirm a connection: returns NF_DROP if packet must be dropped. */
68static inline int nf_conntrack_confirm(struct sk_buff *skb) 61static inline int nf_conntrack_confirm(struct sk_buff *skb)
diff --git a/include/net/netfilter/nf_conntrack_ecache.h b/include/net/netfilter/nf_conntrack_ecache.h
index 092dc651689f..0e3d08e4b1d3 100644
--- a/include/net/netfilter/nf_conntrack_ecache.h
+++ b/include/net/netfilter/nf_conntrack_ecache.h
@@ -68,10 +68,12 @@ struct nf_ct_event_notifier {
68 int (*fcn)(unsigned int events, struct nf_ct_event *item); 68 int (*fcn)(unsigned int events, struct nf_ct_event *item);
69}; 69};
70 70
71extern int nf_conntrack_register_notifier(struct net *net, struct nf_ct_event_notifier *nb); 71int nf_conntrack_register_notifier(struct net *net,
72extern void nf_conntrack_unregister_notifier(struct net *net, struct nf_ct_event_notifier *nb); 72 struct nf_ct_event_notifier *nb);
73void nf_conntrack_unregister_notifier(struct net *net,
74 struct nf_ct_event_notifier *nb);
73 75
74extern void nf_ct_deliver_cached_events(struct nf_conn *ct); 76void nf_ct_deliver_cached_events(struct nf_conn *ct);
75 77
76static inline void 78static inline void
77nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct) 79nf_conntrack_event_cache(enum ip_conntrack_events event, struct nf_conn *ct)
@@ -166,8 +168,10 @@ struct nf_exp_event_notifier {
166 int (*fcn)(unsigned int events, struct nf_exp_event *item); 168 int (*fcn)(unsigned int events, struct nf_exp_event *item);
167}; 169};
168 170
169extern int nf_ct_expect_register_notifier(struct net *net, struct nf_exp_event_notifier *nb); 171int nf_ct_expect_register_notifier(struct net *net,
170extern void nf_ct_expect_unregister_notifier(struct net *net, struct nf_exp_event_notifier *nb); 172 struct nf_exp_event_notifier *nb);
173void nf_ct_expect_unregister_notifier(struct net *net,
174 struct nf_exp_event_notifier *nb);
171 175
172static inline void 176static inline void
173nf_ct_expect_event_report(enum ip_conntrack_expect_events event, 177nf_ct_expect_event_report(enum ip_conntrack_expect_events event,
@@ -207,11 +211,11 @@ nf_ct_expect_event(enum ip_conntrack_expect_events event,
207 nf_ct_expect_event_report(event, exp, 0, 0); 211 nf_ct_expect_event_report(event, exp, 0, 0);
208} 212}
209 213
210extern int nf_conntrack_ecache_pernet_init(struct net *net); 214int nf_conntrack_ecache_pernet_init(struct net *net);
211extern void nf_conntrack_ecache_pernet_fini(struct net *net); 215void nf_conntrack_ecache_pernet_fini(struct net *net);
212 216
213extern int nf_conntrack_ecache_init(void); 217int nf_conntrack_ecache_init(void);
214extern void nf_conntrack_ecache_fini(void); 218void nf_conntrack_ecache_fini(void);
215#else /* CONFIG_NF_CONNTRACK_EVENTS */ 219#else /* CONFIG_NF_CONNTRACK_EVENTS */
216 220
217static inline void nf_conntrack_event_cache(enum ip_conntrack_events event, 221static inline void nf_conntrack_event_cache(enum ip_conntrack_events event,
diff --git a/include/net/netfilter/nf_conntrack_extend.h b/include/net/netfilter/nf_conntrack_extend.h
index 88a1d4060d52..956b175523ff 100644
--- a/include/net/netfilter/nf_conntrack_extend.h
+++ b/include/net/netfilter/nf_conntrack_extend.h
@@ -36,7 +36,7 @@ enum nf_ct_ext_id {
36#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help 36#define NF_CT_EXT_HELPER_TYPE struct nf_conn_help
37#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat 37#define NF_CT_EXT_NAT_TYPE struct nf_conn_nat
38#define NF_CT_EXT_SEQADJ_TYPE struct nf_conn_seqadj 38#define NF_CT_EXT_SEQADJ_TYPE struct nf_conn_seqadj
39#define NF_CT_EXT_ACCT_TYPE struct nf_conn_counter 39#define NF_CT_EXT_ACCT_TYPE struct nf_conn_acct
40#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache 40#define NF_CT_EXT_ECACHE_TYPE struct nf_conntrack_ecache
41#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone 41#define NF_CT_EXT_ZONE_TYPE struct nf_conntrack_zone
42#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp 42#define NF_CT_EXT_TSTAMP_TYPE struct nf_conn_tstamp
@@ -73,7 +73,7 @@ static inline void *__nf_ct_ext_find(const struct nf_conn *ct, u8 id)
73 ((id##_TYPE *)__nf_ct_ext_find((ext), (id))) 73 ((id##_TYPE *)__nf_ct_ext_find((ext), (id)))
74 74
75/* Destroy all relationships */ 75/* Destroy all relationships */
76extern void __nf_ct_ext_destroy(struct nf_conn *ct); 76void __nf_ct_ext_destroy(struct nf_conn *ct);
77static inline void nf_ct_ext_destroy(struct nf_conn *ct) 77static inline void nf_ct_ext_destroy(struct nf_conn *ct)
78{ 78{
79 if (ct->ext) 79 if (ct->ext)
diff --git a/include/net/netfilter/nf_conntrack_helper.h b/include/net/netfilter/nf_conntrack_helper.h
index 26c4ae5bfbb8..6cf614bc0029 100644
--- a/include/net/netfilter/nf_conntrack_helper.h
+++ b/include/net/netfilter/nf_conntrack_helper.h
@@ -52,21 +52,24 @@ struct nf_conntrack_helper {
52 unsigned int queue_num; /* For user-space helpers. */ 52 unsigned int queue_num; /* For user-space helpers. */
53}; 53};
54 54
55extern struct nf_conntrack_helper * 55struct nf_conntrack_helper *__nf_conntrack_helper_find(const char *name,
56__nf_conntrack_helper_find(const char *name, u16 l3num, u8 protonum); 56 u16 l3num, u8 protonum);
57 57
58extern struct nf_conntrack_helper * 58struct nf_conntrack_helper *nf_conntrack_helper_try_module_get(const char *name,
59nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum); 59 u16 l3num,
60 u8 protonum);
60 61
61extern int nf_conntrack_helper_register(struct nf_conntrack_helper *); 62int nf_conntrack_helper_register(struct nf_conntrack_helper *);
62extern void nf_conntrack_helper_unregister(struct nf_conntrack_helper *); 63void nf_conntrack_helper_unregister(struct nf_conntrack_helper *);
63 64
64extern struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct, struct nf_conntrack_helper *helper, gfp_t gfp); 65struct nf_conn_help *nf_ct_helper_ext_add(struct nf_conn *ct,
66 struct nf_conntrack_helper *helper,
67 gfp_t gfp);
65 68
66extern int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl, 69int __nf_ct_try_assign_helper(struct nf_conn *ct, struct nf_conn *tmpl,
67 gfp_t flags); 70 gfp_t flags);
68 71
69extern void nf_ct_helper_destroy(struct nf_conn *ct); 72void nf_ct_helper_destroy(struct nf_conn *ct);
70 73
71static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct) 74static inline struct nf_conn_help *nfct_help(const struct nf_conn *ct)
72{ 75{
@@ -82,17 +85,16 @@ static inline void *nfct_help_data(const struct nf_conn *ct)
82 return (void *)help->data; 85 return (void *)help->data;
83} 86}
84 87
85extern int nf_conntrack_helper_pernet_init(struct net *net); 88int nf_conntrack_helper_pernet_init(struct net *net);
86extern void nf_conntrack_helper_pernet_fini(struct net *net); 89void nf_conntrack_helper_pernet_fini(struct net *net);
87 90
88extern int nf_conntrack_helper_init(void); 91int nf_conntrack_helper_init(void);
89extern void nf_conntrack_helper_fini(void); 92void nf_conntrack_helper_fini(void);
90 93
91extern int nf_conntrack_broadcast_help(struct sk_buff *skb, 94int nf_conntrack_broadcast_help(struct sk_buff *skb, unsigned int protoff,
92 unsigned int protoff, 95 struct nf_conn *ct,
93 struct nf_conn *ct, 96 enum ip_conntrack_info ctinfo,
94 enum ip_conntrack_info ctinfo, 97 unsigned int timeout);
95 unsigned int timeout);
96 98
97struct nf_ct_helper_expectfn { 99struct nf_ct_helper_expectfn {
98 struct list_head head; 100 struct list_head head;
diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h
index 3bb89eac3fa1..3efab704b7eb 100644
--- a/include/net/netfilter/nf_conntrack_l3proto.h
+++ b/include/net/netfilter/nf_conntrack_l3proto.h
@@ -77,17 +77,17 @@ struct nf_conntrack_l3proto {
77extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX]; 77extern struct nf_conntrack_l3proto __rcu *nf_ct_l3protos[AF_MAX];
78 78
79/* Protocol pernet registration. */ 79/* Protocol pernet registration. */
80extern int nf_ct_l3proto_pernet_register(struct net *net, 80int nf_ct_l3proto_pernet_register(struct net *net,
81 struct nf_conntrack_l3proto *proto); 81 struct nf_conntrack_l3proto *proto);
82extern void nf_ct_l3proto_pernet_unregister(struct net *net, 82void nf_ct_l3proto_pernet_unregister(struct net *net,
83 struct nf_conntrack_l3proto *proto); 83 struct nf_conntrack_l3proto *proto);
84 84
85/* Protocol global registration. */ 85/* Protocol global registration. */
86extern int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto); 86int nf_ct_l3proto_register(struct nf_conntrack_l3proto *proto);
87extern void nf_ct_l3proto_unregister(struct nf_conntrack_l3proto *proto); 87void nf_ct_l3proto_unregister(struct nf_conntrack_l3proto *proto);
88 88
89extern struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto); 89struct nf_conntrack_l3proto *nf_ct_l3proto_find_get(u_int16_t l3proto);
90extern void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p); 90void nf_ct_l3proto_put(struct nf_conntrack_l3proto *p);
91 91
92/* Existing built-in protocols */ 92/* Existing built-in protocols */
93extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic; 93extern struct nf_conntrack_l3proto nf_conntrack_l3proto_generic;
diff --git a/include/net/netfilter/nf_conntrack_l4proto.h b/include/net/netfilter/nf_conntrack_l4proto.h
index b411d7b17dec..4c8d573830b7 100644
--- a/include/net/netfilter/nf_conntrack_l4proto.h
+++ b/include/net/netfilter/nf_conntrack_l4proto.h
@@ -114,22 +114,22 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_generic;
114 114
115#define MAX_NF_CT_PROTO 256 115#define MAX_NF_CT_PROTO 256
116 116
117extern struct nf_conntrack_l4proto * 117struct nf_conntrack_l4proto *__nf_ct_l4proto_find(u_int16_t l3proto,
118__nf_ct_l4proto_find(u_int16_t l3proto, u_int8_t l4proto); 118 u_int8_t l4proto);
119 119
120extern struct nf_conntrack_l4proto * 120struct nf_conntrack_l4proto *nf_ct_l4proto_find_get(u_int16_t l3proto,
121nf_ct_l4proto_find_get(u_int16_t l3proto, u_int8_t l4proto); 121 u_int8_t l4proto);
122extern void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p); 122void nf_ct_l4proto_put(struct nf_conntrack_l4proto *p);
123 123
124/* Protocol pernet registration. */ 124/* Protocol pernet registration. */
125extern int nf_ct_l4proto_pernet_register(struct net *net, 125int nf_ct_l4proto_pernet_register(struct net *net,
126 struct nf_conntrack_l4proto *proto); 126 struct nf_conntrack_l4proto *proto);
127extern void nf_ct_l4proto_pernet_unregister(struct net *net, 127void nf_ct_l4proto_pernet_unregister(struct net *net,
128 struct nf_conntrack_l4proto *proto); 128 struct nf_conntrack_l4proto *proto);
129 129
130/* Protocol global registration. */ 130/* Protocol global registration. */
131extern int nf_ct_l4proto_register(struct nf_conntrack_l4proto *proto); 131int nf_ct_l4proto_register(struct nf_conntrack_l4proto *proto);
132extern void nf_ct_l4proto_unregister(struct nf_conntrack_l4proto *proto); 132void nf_ct_l4proto_unregister(struct nf_conntrack_l4proto *proto);
133 133
134static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn) 134static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn)
135{ 135{
@@ -140,11 +140,11 @@ static inline void nf_ct_kfree_compat_sysctl_table(struct nf_proto_net *pn)
140} 140}
141 141
142/* Generic netlink helpers */ 142/* Generic netlink helpers */
143extern int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb, 143int nf_ct_port_tuple_to_nlattr(struct sk_buff *skb,
144 const struct nf_conntrack_tuple *tuple); 144 const struct nf_conntrack_tuple *tuple);
145extern int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[], 145int nf_ct_port_nlattr_to_tuple(struct nlattr *tb[],
146 struct nf_conntrack_tuple *t); 146 struct nf_conntrack_tuple *t);
147extern int nf_ct_port_nlattr_tuple_size(void); 147int nf_ct_port_nlattr_tuple_size(void);
148extern const struct nla_policy nf_ct_port_nla_policy[]; 148extern const struct nla_policy nf_ct_port_nla_policy[];
149 149
150#ifdef CONFIG_SYSCTL 150#ifdef CONFIG_SYSCTL
diff --git a/include/net/netfilter/nf_conntrack_seqadj.h b/include/net/netfilter/nf_conntrack_seqadj.h
index f6177a5fe0ca..4b3362991a25 100644
--- a/include/net/netfilter/nf_conntrack_seqadj.h
+++ b/include/net/netfilter/nf_conntrack_seqadj.h
@@ -30,22 +30,18 @@ static inline struct nf_conn_seqadj *nfct_seqadj_ext_add(struct nf_conn *ct)
30 return nf_ct_ext_add(ct, NF_CT_EXT_SEQADJ, GFP_ATOMIC); 30 return nf_ct_ext_add(ct, NF_CT_EXT_SEQADJ, GFP_ATOMIC);
31} 31}
32 32
33extern int nf_ct_seqadj_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo, 33int nf_ct_seqadj_init(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
34 s32 off); 34 s32 off);
35extern int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo, 35int nf_ct_seqadj_set(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
36 __be32 seq, s32 off); 36 __be32 seq, s32 off);
37extern void nf_ct_tcp_seqadj_set(struct sk_buff *skb, 37void nf_ct_tcp_seqadj_set(struct sk_buff *skb, struct nf_conn *ct,
38 struct nf_conn *ct, 38 enum ip_conntrack_info ctinfo, s32 off);
39 enum ip_conntrack_info ctinfo, 39
40 s32 off); 40int nf_ct_seq_adjust(struct sk_buff *skb, struct nf_conn *ct,
41 41 enum ip_conntrack_info ctinfo, unsigned int protoff);
42extern int nf_ct_seq_adjust(struct sk_buff *skb, 42s32 nf_ct_seq_offset(const struct nf_conn *ct, enum ip_conntrack_dir, u32 seq);
43 struct nf_conn *ct, enum ip_conntrack_info ctinfo, 43
44 unsigned int protoff); 44int nf_conntrack_seqadj_init(void);
45extern s32 nf_ct_seq_offset(const struct nf_conn *ct, enum ip_conntrack_dir, 45void nf_conntrack_seqadj_fini(void);
46 u32 seq);
47
48extern int nf_conntrack_seqadj_init(void);
49extern void nf_conntrack_seqadj_fini(void);
50 46
51#endif /* _NF_CONNTRACK_SEQADJ_H */ 47#endif /* _NF_CONNTRACK_SEQADJ_H */
diff --git a/include/net/netfilter/nf_conntrack_synproxy.h b/include/net/netfilter/nf_conntrack_synproxy.h
index f572f313d6f1..6793614e6502 100644
--- a/include/net/netfilter/nf_conntrack_synproxy.h
+++ b/include/net/netfilter/nf_conntrack_synproxy.h
@@ -56,22 +56,20 @@ struct synproxy_options {
56 56
57struct tcphdr; 57struct tcphdr;
58struct xt_synproxy_info; 58struct xt_synproxy_info;
59extern bool synproxy_parse_options(const struct sk_buff *skb, unsigned int doff, 59bool synproxy_parse_options(const struct sk_buff *skb, unsigned int doff,
60 const struct tcphdr *th, 60 const struct tcphdr *th,
61 struct synproxy_options *opts); 61 struct synproxy_options *opts);
62extern unsigned int synproxy_options_size(const struct synproxy_options *opts); 62unsigned int synproxy_options_size(const struct synproxy_options *opts);
63extern void synproxy_build_options(struct tcphdr *th, 63void synproxy_build_options(struct tcphdr *th,
64 const struct synproxy_options *opts); 64 const struct synproxy_options *opts);
65 65
66extern void synproxy_init_timestamp_cookie(const struct xt_synproxy_info *info, 66void synproxy_init_timestamp_cookie(const struct xt_synproxy_info *info,
67 struct synproxy_options *opts); 67 struct synproxy_options *opts);
68extern void synproxy_check_timestamp_cookie(struct synproxy_options *opts); 68void synproxy_check_timestamp_cookie(struct synproxy_options *opts);
69 69
70extern unsigned int synproxy_tstamp_adjust(struct sk_buff *skb, 70unsigned int synproxy_tstamp_adjust(struct sk_buff *skb, unsigned int protoff,
71 unsigned int protoff, 71 struct tcphdr *th, struct nf_conn *ct,
72 struct tcphdr *th, 72 enum ip_conntrack_info ctinfo,
73 struct nf_conn *ct, 73 const struct nf_conn_synproxy *synproxy);
74 enum ip_conntrack_info ctinfo,
75 const struct nf_conn_synproxy *synproxy);
76 74
77#endif /* _NF_CONNTRACK_SYNPROXY_H */ 75#endif /* _NF_CONNTRACK_SYNPROXY_H */
diff --git a/include/net/netfilter/nf_conntrack_timeout.h b/include/net/netfilter/nf_conntrack_timeout.h
index d23aceb16d94..62308713dd7f 100644
--- a/include/net/netfilter/nf_conntrack_timeout.h
+++ b/include/net/netfilter/nf_conntrack_timeout.h
@@ -76,8 +76,8 @@ nf_ct_timeout_lookup(struct net *net, struct nf_conn *ct,
76} 76}
77 77
78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT 78#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
79extern int nf_conntrack_timeout_init(void); 79int nf_conntrack_timeout_init(void);
80extern void nf_conntrack_timeout_fini(void); 80void nf_conntrack_timeout_fini(void);
81#else 81#else
82static inline int nf_conntrack_timeout_init(void) 82static inline int nf_conntrack_timeout_init(void)
83{ 83{
diff --git a/include/net/netfilter/nf_conntrack_timestamp.h b/include/net/netfilter/nf_conntrack_timestamp.h
index b00461413efd..300ae2209f25 100644
--- a/include/net/netfilter/nf_conntrack_timestamp.h
+++ b/include/net/netfilter/nf_conntrack_timestamp.h
@@ -48,11 +48,11 @@ static inline void nf_ct_set_tstamp(struct net *net, bool enable)
48} 48}
49 49
50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP 50#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP
51extern int nf_conntrack_tstamp_pernet_init(struct net *net); 51int nf_conntrack_tstamp_pernet_init(struct net *net);
52extern void nf_conntrack_tstamp_pernet_fini(struct net *net); 52void nf_conntrack_tstamp_pernet_fini(struct net *net);
53 53
54extern int nf_conntrack_tstamp_init(void); 54int nf_conntrack_tstamp_init(void);
55extern void nf_conntrack_tstamp_fini(void); 55void nf_conntrack_tstamp_fini(void);
56#else 56#else
57static inline int nf_conntrack_tstamp_pernet_init(struct net *net) 57static inline int nf_conntrack_tstamp_pernet_init(struct net *net)
58{ 58{
diff --git a/include/net/netfilter/nf_nat.h b/include/net/netfilter/nf_nat.h
index 59a192420053..07eaaf604092 100644
--- a/include/net/netfilter/nf_nat.h
+++ b/include/net/netfilter/nf_nat.h
@@ -41,13 +41,16 @@ struct nf_conn_nat {
41}; 41};
42 42
43/* Set up the info structure to map into this range. */ 43/* Set up the info structure to map into this range. */
44extern unsigned int nf_nat_setup_info(struct nf_conn *ct, 44unsigned int nf_nat_setup_info(struct nf_conn *ct,
45 const struct nf_nat_range *range, 45 const struct nf_nat_range *range,
46 enum nf_nat_manip_type maniptype); 46 enum nf_nat_manip_type maniptype);
47
48extern unsigned int nf_nat_alloc_null_binding(struct nf_conn *ct,
49 unsigned int hooknum);
47 50
48/* Is this tuple already taken? (not by us)*/ 51/* Is this tuple already taken? (not by us)*/
49extern int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple, 52int nf_nat_used_tuple(const struct nf_conntrack_tuple *tuple,
50 const struct nf_conn *ignored_conntrack); 53 const struct nf_conn *ignored_conntrack);
51 54
52static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct) 55static inline struct nf_conn_nat *nfct_nat(const struct nf_conn *ct)
53{ 56{
diff --git a/include/net/netfilter/nf_nat_core.h b/include/net/netfilter/nf_nat_core.h
index 972e1e47ec79..fbfd1ba4254e 100644
--- a/include/net/netfilter/nf_nat_core.h
+++ b/include/net/netfilter/nf_nat_core.h
@@ -7,12 +7,10 @@
7/* This header used to share core functionality between the standalone 7/* This header used to share core functionality between the standalone
8 NAT module, and the compatibility layer's use of NAT for masquerading. */ 8 NAT module, and the compatibility layer's use of NAT for masquerading. */
9 9
10extern unsigned int nf_nat_packet(struct nf_conn *ct, 10unsigned int nf_nat_packet(struct nf_conn *ct, enum ip_conntrack_info ctinfo,
11 enum ip_conntrack_info ctinfo, 11 unsigned int hooknum, struct sk_buff *skb);
12 unsigned int hooknum,
13 struct sk_buff *skb);
14 12
15extern int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family); 13int nf_xfrm_me_harder(struct sk_buff *skb, unsigned int family);
16 14
17static inline int nf_nat_initialized(struct nf_conn *ct, 15static inline int nf_nat_initialized(struct nf_conn *ct,
18 enum nf_nat_manip_type manip) 16 enum nf_nat_manip_type manip)
diff --git a/include/net/netfilter/nf_nat_helper.h b/include/net/netfilter/nf_nat_helper.h
index 404324d1d0c4..01bcc6bfbcc9 100644
--- a/include/net/netfilter/nf_nat_helper.h
+++ b/include/net/netfilter/nf_nat_helper.h
@@ -7,14 +7,11 @@
7struct sk_buff; 7struct sk_buff;
8 8
9/* These return true or false. */ 9/* These return true or false. */
10extern int __nf_nat_mangle_tcp_packet(struct sk_buff *skb, 10int __nf_nat_mangle_tcp_packet(struct sk_buff *skb, struct nf_conn *ct,
11 struct nf_conn *ct, 11 enum ip_conntrack_info ctinfo,
12 enum ip_conntrack_info ctinfo, 12 unsigned int protoff, unsigned int match_offset,
13 unsigned int protoff, 13 unsigned int match_len, const char *rep_buffer,
14 unsigned int match_offset, 14 unsigned int rep_len, bool adjust);
15 unsigned int match_len,
16 const char *rep_buffer,
17 unsigned int rep_len, bool adjust);
18 15
19static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb, 16static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
20 struct nf_conn *ct, 17 struct nf_conn *ct,
@@ -30,18 +27,14 @@ static inline int nf_nat_mangle_tcp_packet(struct sk_buff *skb,
30 rep_buffer, rep_len, true); 27 rep_buffer, rep_len, true);
31} 28}
32 29
33extern int nf_nat_mangle_udp_packet(struct sk_buff *skb, 30int nf_nat_mangle_udp_packet(struct sk_buff *skb, struct nf_conn *ct,
34 struct nf_conn *ct, 31 enum ip_conntrack_info ctinfo,
35 enum ip_conntrack_info ctinfo, 32 unsigned int protoff, unsigned int match_offset,
36 unsigned int protoff, 33 unsigned int match_len, const char *rep_buffer,
37 unsigned int match_offset, 34 unsigned int rep_len);
38 unsigned int match_len,
39 const char *rep_buffer,
40 unsigned int rep_len);
41 35
42/* Setup NAT on this expected conntrack so it follows master, but goes 36/* Setup NAT on this expected conntrack so it follows master, but goes
43 * to port ct->master->saved_proto. */ 37 * to port ct->master->saved_proto. */
44extern void nf_nat_follow_master(struct nf_conn *ct, 38void nf_nat_follow_master(struct nf_conn *ct, struct nf_conntrack_expect *this);
45 struct nf_conntrack_expect *this);
46 39
47#endif 40#endif
diff --git a/include/net/netfilter/nf_nat_l3proto.h b/include/net/netfilter/nf_nat_l3proto.h
index bd3b97e02c82..5a2919b2e09a 100644
--- a/include/net/netfilter/nf_nat_l3proto.h
+++ b/include/net/netfilter/nf_nat_l3proto.h
@@ -35,18 +35,15 @@ struct nf_nat_l3proto {
35 struct nf_nat_range *range); 35 struct nf_nat_range *range);
36}; 36};
37 37
38extern int nf_nat_l3proto_register(const struct nf_nat_l3proto *); 38int nf_nat_l3proto_register(const struct nf_nat_l3proto *);
39extern void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *); 39void nf_nat_l3proto_unregister(const struct nf_nat_l3proto *);
40extern const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto); 40const struct nf_nat_l3proto *__nf_nat_l3proto_find(u8 l3proto);
41 41
42extern int nf_nat_icmp_reply_translation(struct sk_buff *skb, 42int nf_nat_icmp_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
43 struct nf_conn *ct, 43 enum ip_conntrack_info ctinfo,
44 enum ip_conntrack_info ctinfo, 44 unsigned int hooknum);
45 unsigned int hooknum); 45int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, struct nf_conn *ct,
46extern int nf_nat_icmpv6_reply_translation(struct sk_buff *skb, 46 enum ip_conntrack_info ctinfo,
47 struct nf_conn *ct, 47 unsigned int hooknum, unsigned int hdrlen);
48 enum ip_conntrack_info ctinfo,
49 unsigned int hooknum,
50 unsigned int hdrlen);
51 48
52#endif /* _NF_NAT_L3PROTO_H */ 49#endif /* _NF_NAT_L3PROTO_H */
diff --git a/include/net/netfilter/nf_nat_l4proto.h b/include/net/netfilter/nf_nat_l4proto.h
index 24feb68d1bcc..12f4cc841b6e 100644
--- a/include/net/netfilter/nf_nat_l4proto.h
+++ b/include/net/netfilter/nf_nat_l4proto.h
@@ -42,10 +42,11 @@ struct nf_nat_l4proto {
42}; 42};
43 43
44/* Protocol registration. */ 44/* Protocol registration. */
45extern int nf_nat_l4proto_register(u8 l3proto, const struct nf_nat_l4proto *l4proto); 45int nf_nat_l4proto_register(u8 l3proto, const struct nf_nat_l4proto *l4proto);
46extern void nf_nat_l4proto_unregister(u8 l3proto, const struct nf_nat_l4proto *l4proto); 46void nf_nat_l4proto_unregister(u8 l3proto,
47 const struct nf_nat_l4proto *l4proto);
47 48
48extern const struct nf_nat_l4proto *__nf_nat_l4proto_find(u8 l3proto, u8 l4proto); 49const struct nf_nat_l4proto *__nf_nat_l4proto_find(u8 l3proto, u8 l4proto);
49 50
50/* Built-in protocols. */ 51/* Built-in protocols. */
51extern const struct nf_nat_l4proto nf_nat_l4proto_tcp; 52extern const struct nf_nat_l4proto nf_nat_l4proto_tcp;
@@ -54,19 +55,18 @@ extern const struct nf_nat_l4proto nf_nat_l4proto_icmp;
54extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6; 55extern const struct nf_nat_l4proto nf_nat_l4proto_icmpv6;
55extern const struct nf_nat_l4proto nf_nat_l4proto_unknown; 56extern const struct nf_nat_l4proto nf_nat_l4proto_unknown;
56 57
57extern bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple, 58bool nf_nat_l4proto_in_range(const struct nf_conntrack_tuple *tuple,
58 enum nf_nat_manip_type maniptype, 59 enum nf_nat_manip_type maniptype,
59 const union nf_conntrack_man_proto *min, 60 const union nf_conntrack_man_proto *min,
60 const union nf_conntrack_man_proto *max); 61 const union nf_conntrack_man_proto *max);
61 62
62extern void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto, 63void nf_nat_l4proto_unique_tuple(const struct nf_nat_l3proto *l3proto,
63 struct nf_conntrack_tuple *tuple, 64 struct nf_conntrack_tuple *tuple,
64 const struct nf_nat_range *range, 65 const struct nf_nat_range *range,
65 enum nf_nat_manip_type maniptype, 66 enum nf_nat_manip_type maniptype,
66 const struct nf_conn *ct, 67 const struct nf_conn *ct, u16 *rover);
67 u16 *rover);
68 68
69extern int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[], 69int nf_nat_l4proto_nlattr_to_range(struct nlattr *tb[],
70 struct nf_nat_range *range); 70 struct nf_nat_range *range);
71 71
72#endif /*_NF_NAT_L4PROTO_H*/ 72#endif /*_NF_NAT_L4PROTO_H*/
diff --git a/include/net/netfilter/nf_queue.h b/include/net/netfilter/nf_queue.h
index aaba4bbcdda0..c1d5b3e34a21 100644
--- a/include/net/netfilter/nf_queue.h
+++ b/include/net/netfilter/nf_queue.h
@@ -28,7 +28,7 @@ struct nf_queue_handler {
28 28
29void nf_register_queue_handler(const struct nf_queue_handler *qh); 29void nf_register_queue_handler(const struct nf_queue_handler *qh);
30void nf_unregister_queue_handler(void); 30void nf_unregister_queue_handler(void);
31extern void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); 31void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict);
32 32
33bool nf_queue_entry_get_refs(struct nf_queue_entry *entry); 33bool nf_queue_entry_get_refs(struct nf_queue_entry *entry);
34void nf_queue_entry_release_refs(struct nf_queue_entry *entry); 34void nf_queue_entry_release_refs(struct nf_queue_entry *entry);
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h
new file mode 100644
index 000000000000..5a91abfc0c30
--- /dev/null
+++ b/include/net/netfilter/nf_tables.h
@@ -0,0 +1,519 @@
1#ifndef _NET_NF_TABLES_H
2#define _NET_NF_TABLES_H
3
4#include <linux/list.h>
5#include <linux/netfilter.h>
6#include <linux/netfilter/x_tables.h>
7#include <linux/netfilter/nf_tables.h>
8#include <net/netlink.h>
9
10#define NFT_JUMP_STACK_SIZE 16
11
12struct nft_pktinfo {
13 struct sk_buff *skb;
14 const struct net_device *in;
15 const struct net_device *out;
16 u8 hooknum;
17 u8 nhoff;
18 u8 thoff;
19 /* for x_tables compatibility */
20 struct xt_action_param xt;
21};
22
23static inline void nft_set_pktinfo(struct nft_pktinfo *pkt,
24 const struct nf_hook_ops *ops,
25 struct sk_buff *skb,
26 const struct net_device *in,
27 const struct net_device *out)
28{
29 pkt->skb = skb;
30 pkt->in = pkt->xt.in = in;
31 pkt->out = pkt->xt.out = out;
32 pkt->hooknum = pkt->xt.hooknum = ops->hooknum;
33 pkt->xt.family = ops->pf;
34}
35
36struct nft_data {
37 union {
38 u32 data[4];
39 struct {
40 u32 verdict;
41 struct nft_chain *chain;
42 };
43 };
44} __attribute__((aligned(__alignof__(u64))));
45
46static inline int nft_data_cmp(const struct nft_data *d1,
47 const struct nft_data *d2,
48 unsigned int len)
49{
50 return memcmp(d1->data, d2->data, len);
51}
52
53static inline void nft_data_copy(struct nft_data *dst,
54 const struct nft_data *src)
55{
56 BUILD_BUG_ON(__alignof__(*dst) != __alignof__(u64));
57 *(u64 *)&dst->data[0] = *(u64 *)&src->data[0];
58 *(u64 *)&dst->data[2] = *(u64 *)&src->data[2];
59}
60
61static inline void nft_data_debug(const struct nft_data *data)
62{
63 pr_debug("data[0]=%x data[1]=%x data[2]=%x data[3]=%x\n",
64 data->data[0], data->data[1],
65 data->data[2], data->data[3]);
66}
67
68/**
69 * struct nft_ctx - nf_tables rule/set context
70 *
71 * @net: net namespace
72 * @skb: netlink skb
73 * @nlh: netlink message header
74 * @afi: address family info
75 * @table: the table the chain is contained in
76 * @chain: the chain the rule is contained in
77 * @nla: netlink attributes
78 */
79struct nft_ctx {
80 struct net *net;
81 const struct sk_buff *skb;
82 const struct nlmsghdr *nlh;
83 const struct nft_af_info *afi;
84 const struct nft_table *table;
85 const struct nft_chain *chain;
86 const struct nlattr * const *nla;
87};
88
89struct nft_data_desc {
90 enum nft_data_types type;
91 unsigned int len;
92};
93
94int nft_data_init(const struct nft_ctx *ctx, struct nft_data *data,
95 struct nft_data_desc *desc, const struct nlattr *nla);
96void nft_data_uninit(const struct nft_data *data, enum nft_data_types type);
97int nft_data_dump(struct sk_buff *skb, int attr, const struct nft_data *data,
98 enum nft_data_types type, unsigned int len);
99
100static inline enum nft_data_types nft_dreg_to_type(enum nft_registers reg)
101{
102 return reg == NFT_REG_VERDICT ? NFT_DATA_VERDICT : NFT_DATA_VALUE;
103}
104
105static inline enum nft_registers nft_type_to_reg(enum nft_data_types type)
106{
107 return type == NFT_DATA_VERDICT ? NFT_REG_VERDICT : NFT_REG_1;
108}
109
110int nft_validate_input_register(enum nft_registers reg);
111int nft_validate_output_register(enum nft_registers reg);
112int nft_validate_data_load(const struct nft_ctx *ctx, enum nft_registers reg,
113 const struct nft_data *data,
114 enum nft_data_types type);
115
116/**
117 * struct nft_set_elem - generic representation of set elements
118 *
119 * @cookie: implementation specific element cookie
120 * @key: element key
121 * @data: element data (maps only)
122 * @flags: element flags (end of interval)
123 *
124 * The cookie can be used to store a handle to the element for subsequent
125 * removal.
126 */
127struct nft_set_elem {
128 void *cookie;
129 struct nft_data key;
130 struct nft_data data;
131 u32 flags;
132};
133
134struct nft_set;
135struct nft_set_iter {
136 unsigned int count;
137 unsigned int skip;
138 int err;
139 int (*fn)(const struct nft_ctx *ctx,
140 const struct nft_set *set,
141 const struct nft_set_iter *iter,
142 const struct nft_set_elem *elem);
143};
144
145/**
146 * struct nft_set_ops - nf_tables set operations
147 *
148 * @lookup: look up an element within the set
149 * @insert: insert new element into set
150 * @remove: remove element from set
151 * @walk: iterate over all set elemeennts
152 * @privsize: function to return size of set private data
153 * @init: initialize private data of new set instance
154 * @destroy: destroy private data of set instance
155 * @list: nf_tables_set_ops list node
156 * @owner: module reference
157 * @features: features supported by the implementation
158 */
159struct nft_set_ops {
160 bool (*lookup)(const struct nft_set *set,
161 const struct nft_data *key,
162 struct nft_data *data);
163 int (*get)(const struct nft_set *set,
164 struct nft_set_elem *elem);
165 int (*insert)(const struct nft_set *set,
166 const struct nft_set_elem *elem);
167 void (*remove)(const struct nft_set *set,
168 const struct nft_set_elem *elem);
169 void (*walk)(const struct nft_ctx *ctx,
170 const struct nft_set *set,
171 struct nft_set_iter *iter);
172
173 unsigned int (*privsize)(const struct nlattr * const nla[]);
174 int (*init)(const struct nft_set *set,
175 const struct nlattr * const nla[]);
176 void (*destroy)(const struct nft_set *set);
177
178 struct list_head list;
179 struct module *owner;
180 u32 features;
181};
182
183int nft_register_set(struct nft_set_ops *ops);
184void nft_unregister_set(struct nft_set_ops *ops);
185
186/**
187 * struct nft_set - nf_tables set instance
188 *
189 * @list: table set list node
190 * @bindings: list of set bindings
191 * @name: name of the set
192 * @ktype: key type (numeric type defined by userspace, not used in the kernel)
193 * @dtype: data type (verdict or numeric type defined by userspace)
194 * @ops: set ops
195 * @flags: set flags
196 * @klen: key length
197 * @dlen: data length
198 * @data: private set data
199 */
200struct nft_set {
201 struct list_head list;
202 struct list_head bindings;
203 char name[IFNAMSIZ];
204 u32 ktype;
205 u32 dtype;
206 /* runtime data below here */
207 const struct nft_set_ops *ops ____cacheline_aligned;
208 u16 flags;
209 u8 klen;
210 u8 dlen;
211 unsigned char data[]
212 __attribute__((aligned(__alignof__(u64))));
213};
214
215static inline void *nft_set_priv(const struct nft_set *set)
216{
217 return (void *)set->data;
218}
219
220struct nft_set *nf_tables_set_lookup(const struct nft_table *table,
221 const struct nlattr *nla);
222
223/**
224 * struct nft_set_binding - nf_tables set binding
225 *
226 * @list: set bindings list node
227 * @chain: chain containing the rule bound to the set
228 *
229 * A set binding contains all information necessary for validation
230 * of new elements added to a bound set.
231 */
232struct nft_set_binding {
233 struct list_head list;
234 const struct nft_chain *chain;
235};
236
237int nf_tables_bind_set(const struct nft_ctx *ctx, struct nft_set *set,
238 struct nft_set_binding *binding);
239void nf_tables_unbind_set(const struct nft_ctx *ctx, struct nft_set *set,
240 struct nft_set_binding *binding);
241
242
243/**
244 * struct nft_expr_type - nf_tables expression type
245 *
246 * @select_ops: function to select nft_expr_ops
247 * @ops: default ops, used when no select_ops functions is present
248 * @list: used internally
249 * @name: Identifier
250 * @owner: module reference
251 * @policy: netlink attribute policy
252 * @maxattr: highest netlink attribute number
253 */
254struct nft_expr_type {
255 const struct nft_expr_ops *(*select_ops)(const struct nft_ctx *,
256 const struct nlattr * const tb[]);
257 const struct nft_expr_ops *ops;
258 struct list_head list;
259 const char *name;
260 struct module *owner;
261 const struct nla_policy *policy;
262 unsigned int maxattr;
263};
264
265/**
266 * struct nft_expr_ops - nf_tables expression operations
267 *
268 * @eval: Expression evaluation function
269 * @size: full expression size, including private data size
270 * @init: initialization function
271 * @destroy: destruction function
272 * @dump: function to dump parameters
273 * @type: expression type
274 * @validate: validate expression, called during loop detection
275 * @data: extra data to attach to this expression operation
276 */
277struct nft_expr;
278struct nft_expr_ops {
279 void (*eval)(const struct nft_expr *expr,
280 struct nft_data data[NFT_REG_MAX + 1],
281 const struct nft_pktinfo *pkt);
282 unsigned int size;
283
284 int (*init)(const struct nft_ctx *ctx,
285 const struct nft_expr *expr,
286 const struct nlattr * const tb[]);
287 void (*destroy)(const struct nft_expr *expr);
288 int (*dump)(struct sk_buff *skb,
289 const struct nft_expr *expr);
290 int (*validate)(const struct nft_ctx *ctx,
291 const struct nft_expr *expr,
292 const struct nft_data **data);
293 const struct nft_expr_type *type;
294 void *data;
295};
296
297#define NFT_EXPR_MAXATTR 16
298#define NFT_EXPR_SIZE(size) (sizeof(struct nft_expr) + \
299 ALIGN(size, __alignof__(struct nft_expr)))
300
301/**
302 * struct nft_expr - nf_tables expression
303 *
304 * @ops: expression ops
305 * @data: expression private data
306 */
307struct nft_expr {
308 const struct nft_expr_ops *ops;
309 unsigned char data[];
310};
311
312static inline void *nft_expr_priv(const struct nft_expr *expr)
313{
314 return (void *)expr->data;
315}
316
317/**
318 * struct nft_rule - nf_tables rule
319 *
320 * @list: used internally
321 * @rcu_head: used internally for rcu
322 * @handle: rule handle
323 * @genmask: generation mask
324 * @dlen: length of expression data
325 * @data: expression data
326 */
327struct nft_rule {
328 struct list_head list;
329 struct rcu_head rcu_head;
330 u64 handle:46,
331 genmask:2,
332 dlen:16;
333 unsigned char data[]
334 __attribute__((aligned(__alignof__(struct nft_expr))));
335};
336
337/**
338 * struct nft_rule_trans - nf_tables rule update in transaction
339 *
340 * @list: used internally
341 * @rule: rule that needs to be updated
342 * @chain: chain that this rule belongs to
343 * @table: table for which this chain applies
344 * @nlh: netlink header of the message that contain this update
345 * @family: family expressesed as AF_*
346 */
347struct nft_rule_trans {
348 struct list_head list;
349 struct nft_rule *rule;
350 const struct nft_chain *chain;
351 const struct nft_table *table;
352 const struct nlmsghdr *nlh;
353 u8 family;
354};
355
356static inline struct nft_expr *nft_expr_first(const struct nft_rule *rule)
357{
358 return (struct nft_expr *)&rule->data[0];
359}
360
361static inline struct nft_expr *nft_expr_next(const struct nft_expr *expr)
362{
363 return ((void *)expr) + expr->ops->size;
364}
365
366static inline struct nft_expr *nft_expr_last(const struct nft_rule *rule)
367{
368 return (struct nft_expr *)&rule->data[rule->dlen];
369}
370
371/*
372 * The last pointer isn't really necessary, but the compiler isn't able to
373 * determine that the result of nft_expr_last() is always the same since it
374 * can't assume that the dlen value wasn't changed within calls in the loop.
375 */
376#define nft_rule_for_each_expr(expr, last, rule) \
377 for ((expr) = nft_expr_first(rule), (last) = nft_expr_last(rule); \
378 (expr) != (last); \
379 (expr) = nft_expr_next(expr))
380
381enum nft_chain_flags {
382 NFT_BASE_CHAIN = 0x1,
383};
384
385/**
386 * struct nft_chain - nf_tables chain
387 *
388 * @rules: list of rules in the chain
389 * @list: used internally
390 * @rcu_head: used internally
391 * @net: net namespace that this chain belongs to
392 * @table: table that this chain belongs to
393 * @handle: chain handle
394 * @flags: bitmask of enum nft_chain_flags
395 * @use: number of jump references to this chain
396 * @level: length of longest path to this chain
397 * @name: name of the chain
398 */
399struct nft_chain {
400 struct list_head rules;
401 struct list_head list;
402 struct rcu_head rcu_head;
403 struct net *net;
404 struct nft_table *table;
405 u64 handle;
406 u8 flags;
407 u16 use;
408 u16 level;
409 char name[NFT_CHAIN_MAXNAMELEN];
410};
411
412enum nft_chain_type {
413 NFT_CHAIN_T_DEFAULT = 0,
414 NFT_CHAIN_T_ROUTE,
415 NFT_CHAIN_T_NAT,
416 NFT_CHAIN_T_MAX
417};
418
419struct nft_stats {
420 u64 bytes;
421 u64 pkts;
422};
423
424/**
425 * struct nft_base_chain - nf_tables base chain
426 *
427 * @ops: netfilter hook ops
428 * @type: chain type
429 * @policy: default policy
430 * @stats: per-cpu chain stats
431 * @chain: the chain
432 */
433struct nft_base_chain {
434 struct nf_hook_ops ops;
435 enum nft_chain_type type;
436 u8 policy;
437 struct nft_stats __percpu *stats;
438 struct nft_chain chain;
439};
440
441static inline struct nft_base_chain *nft_base_chain(const struct nft_chain *chain)
442{
443 return container_of(chain, struct nft_base_chain, chain);
444}
445
446unsigned int nft_do_chain_pktinfo(struct nft_pktinfo *pkt,
447 const struct nf_hook_ops *ops);
448
449/**
450 * struct nft_table - nf_tables table
451 *
452 * @list: used internally
453 * @chains: chains in the table
454 * @sets: sets in the table
455 * @hgenerator: handle generator state
456 * @use: number of chain references to this table
457 * @flags: table flag (see enum nft_table_flags)
458 * @name: name of the table
459 */
460struct nft_table {
461 struct list_head list;
462 struct list_head chains;
463 struct list_head sets;
464 u64 hgenerator;
465 u32 use;
466 u16 flags;
467 char name[];
468};
469
470/**
471 * struct nft_af_info - nf_tables address family info
472 *
473 * @list: used internally
474 * @family: address family
475 * @nhooks: number of hooks in this family
476 * @owner: module owner
477 * @tables: used internally
478 * @hooks: hookfn overrides for packet validation
479 */
480struct nft_af_info {
481 struct list_head list;
482 int family;
483 unsigned int nhooks;
484 struct module *owner;
485 struct list_head tables;
486 nf_hookfn *hooks[NF_MAX_HOOKS];
487};
488
489int nft_register_afinfo(struct net *, struct nft_af_info *);
490void nft_unregister_afinfo(struct nft_af_info *);
491
492struct nf_chain_type {
493 unsigned int hook_mask;
494 const char *name;
495 enum nft_chain_type type;
496 nf_hookfn *fn[NF_MAX_HOOKS];
497 struct module *me;
498 int family;
499};
500
501int nft_register_chain_type(struct nf_chain_type *);
502void nft_unregister_chain_type(struct nf_chain_type *);
503
504int nft_register_expr(struct nft_expr_type *);
505void nft_unregister_expr(struct nft_expr_type *);
506
507#define MODULE_ALIAS_NFT_FAMILY(family) \
508 MODULE_ALIAS("nft-afinfo-" __stringify(family))
509
510#define MODULE_ALIAS_NFT_CHAIN(family, name) \
511 MODULE_ALIAS("nft-chain-" __stringify(family) "-" name)
512
513#define MODULE_ALIAS_NFT_EXPR(name) \
514 MODULE_ALIAS("nft-expr-" name)
515
516#define MODULE_ALIAS_NFT_SET() \
517 MODULE_ALIAS("nft-set")
518
519#endif /* _NET_NF_TABLES_H */
diff --git a/include/net/netfilter/nf_tables_core.h b/include/net/netfilter/nf_tables_core.h
new file mode 100644
index 000000000000..cf2b7ae2b9d8
--- /dev/null
+++ b/include/net/netfilter/nf_tables_core.h
@@ -0,0 +1,42 @@
1#ifndef _NET_NF_TABLES_CORE_H
2#define _NET_NF_TABLES_CORE_H
3
4int nf_tables_core_module_init(void);
5void nf_tables_core_module_exit(void);
6
7int nft_immediate_module_init(void);
8void nft_immediate_module_exit(void);
9
10struct nft_cmp_fast_expr {
11 u32 data;
12 enum nft_registers sreg:8;
13 u8 len;
14};
15
16extern const struct nft_expr_ops nft_cmp_fast_ops;
17
18int nft_cmp_module_init(void);
19void nft_cmp_module_exit(void);
20
21int nft_lookup_module_init(void);
22void nft_lookup_module_exit(void);
23
24int nft_bitwise_module_init(void);
25void nft_bitwise_module_exit(void);
26
27int nft_byteorder_module_init(void);
28void nft_byteorder_module_exit(void);
29
30struct nft_payload {
31 enum nft_payload_bases base:8;
32 u8 offset;
33 u8 len;
34 enum nft_registers dreg:8;
35};
36
37extern const struct nft_expr_ops nft_payload_fast_ops;
38
39int nft_payload_module_init(void);
40void nft_payload_module_exit(void);
41
42#endif /* _NET_NF_TABLES_CORE_H */
diff --git a/include/net/netfilter/nf_tables_ipv4.h b/include/net/netfilter/nf_tables_ipv4.h
new file mode 100644
index 000000000000..1be1c2c197ee
--- /dev/null
+++ b/include/net/netfilter/nf_tables_ipv4.h
@@ -0,0 +1,23 @@
1#ifndef _NF_TABLES_IPV4_H_
2#define _NF_TABLES_IPV4_H_
3
4#include <net/netfilter/nf_tables.h>
5#include <net/ip.h>
6
7static inline void
8nft_set_pktinfo_ipv4(struct nft_pktinfo *pkt,
9 const struct nf_hook_ops *ops,
10 struct sk_buff *skb,
11 const struct net_device *in,
12 const struct net_device *out)
13{
14 struct iphdr *ip;
15
16 nft_set_pktinfo(pkt, ops, skb, in, out);
17
18 pkt->xt.thoff = ip_hdrlen(pkt->skb);
19 ip = ip_hdr(pkt->skb);
20 pkt->xt.fragoff = ntohs(ip->frag_off) & IP_OFFSET;
21}
22
23#endif
diff --git a/include/net/netfilter/nf_tables_ipv6.h b/include/net/netfilter/nf_tables_ipv6.h
new file mode 100644
index 000000000000..4a9b88a65963
--- /dev/null
+++ b/include/net/netfilter/nf_tables_ipv6.h
@@ -0,0 +1,30 @@
1#ifndef _NF_TABLES_IPV6_H_
2#define _NF_TABLES_IPV6_H_
3
4#include <linux/netfilter_ipv6/ip6_tables.h>
5#include <net/ipv6.h>
6
7static inline int
8nft_set_pktinfo_ipv6(struct nft_pktinfo *pkt,
9 const struct nf_hook_ops *ops,
10 struct sk_buff *skb,
11 const struct net_device *in,
12 const struct net_device *out)
13{
14 int protohdr, thoff = 0;
15 unsigned short frag_off;
16
17 nft_set_pktinfo(pkt, ops, skb, in, out);
18
19 protohdr = ipv6_find_hdr(pkt->skb, &thoff, -1, &frag_off, NULL);
20 /* If malformed, drop it */
21 if (protohdr < 0)
22 return -1;
23
24 pkt->xt.thoff = thoff;
25 pkt->xt.fragoff = frag_off;
26
27 return 0;
28}
29
30#endif
diff --git a/include/net/netfilter/xt_rateest.h b/include/net/netfilter/xt_rateest.h
index 495c71f66e7e..79f45e19f31e 100644
--- a/include/net/netfilter/xt_rateest.h
+++ b/include/net/netfilter/xt_rateest.h
@@ -16,7 +16,7 @@ struct xt_rateest {
16 struct rcu_head rcu; 16 struct rcu_head rcu;
17}; 17};
18 18
19extern struct xt_rateest *xt_rateest_lookup(const char *name); 19struct xt_rateest *xt_rateest_lookup(const char *name);
20extern void xt_rateest_put(struct xt_rateest *est); 20void xt_rateest_put(struct xt_rateest *est);
21 21
22#endif /* _XT_RATEEST_H */ 22#endif /* _XT_RATEEST_H */
diff --git a/include/net/netlink.h b/include/net/netlink.h
index 9690b0f6698a..2b47eaadba8f 100644
--- a/include/net/netlink.h
+++ b/include/net/netlink.h
@@ -225,44 +225,31 @@ struct nl_info {
225 u32 portid; 225 u32 portid;
226}; 226};
227 227
228extern int netlink_rcv_skb(struct sk_buff *skb, 228int netlink_rcv_skb(struct sk_buff *skb,
229 int (*cb)(struct sk_buff *, 229 int (*cb)(struct sk_buff *, struct nlmsghdr *));
230 struct nlmsghdr *)); 230int nlmsg_notify(struct sock *sk, struct sk_buff *skb, u32 portid,
231extern int nlmsg_notify(struct sock *sk, struct sk_buff *skb, 231 unsigned int group, int report, gfp_t flags);
232 u32 portid, unsigned int group, int report, 232
233 gfp_t flags); 233int nla_validate(const struct nlattr *head, int len, int maxtype,
234 234 const struct nla_policy *policy);
235extern int nla_validate(const struct nlattr *head, 235int nla_parse(struct nlattr **tb, int maxtype, const struct nlattr *head,
236 int len, int maxtype, 236 int len, const struct nla_policy *policy);
237 const struct nla_policy *policy); 237int nla_policy_len(const struct nla_policy *, int);
238extern int nla_parse(struct nlattr **tb, int maxtype, 238struct nlattr *nla_find(const struct nlattr *head, int len, int attrtype);
239 const struct nlattr *head, int len, 239size_t nla_strlcpy(char *dst, const struct nlattr *nla, size_t dstsize);
240 const struct nla_policy *policy); 240int nla_memcpy(void *dest, const struct nlattr *src, int count);
241extern int nla_policy_len(const struct nla_policy *, int); 241int nla_memcmp(const struct nlattr *nla, const void *data, size_t size);
242extern struct nlattr * nla_find(const struct nlattr *head, 242int nla_strcmp(const struct nlattr *nla, const char *str);
243 int len, int attrtype); 243struct nlattr *__nla_reserve(struct sk_buff *skb, int attrtype, int attrlen);
244extern size_t nla_strlcpy(char *dst, const struct nlattr *nla, 244void *__nla_reserve_nohdr(struct sk_buff *skb, int attrlen);
245 size_t dstsize); 245struct nlattr *nla_reserve(struct sk_buff *skb, int attrtype, int attrlen);
246extern int nla_memcpy(void *dest, const struct nlattr *src, int count); 246void *nla_reserve_nohdr(struct sk_buff *skb, int attrlen);
247extern int nla_memcmp(const struct nlattr *nla, const void *data, 247void __nla_put(struct sk_buff *skb, int attrtype, int attrlen,
248 size_t size); 248 const void *data);
249extern int nla_strcmp(const struct nlattr *nla, const char *str); 249void __nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data);
250extern struct nlattr * __nla_reserve(struct sk_buff *skb, int attrtype, 250int nla_put(struct sk_buff *skb, int attrtype, int attrlen, const void *data);
251 int attrlen); 251int nla_put_nohdr(struct sk_buff *skb, int attrlen, const void *data);
252extern void * __nla_reserve_nohdr(struct sk_buff *skb, int attrlen); 252int nla_append(struct sk_buff *skb, int attrlen, const void *data);
253extern struct nlattr * nla_reserve(struct sk_buff *skb, int attrtype,
254 int attrlen);
255extern void * nla_reserve_nohdr(struct sk_buff *skb, int attrlen);
256extern void __nla_put(struct sk_buff *skb, int attrtype,
257 int attrlen, const void *data);
258extern void __nla_put_nohdr(struct sk_buff *skb, int attrlen,
259 const void *data);
260extern int nla_put(struct sk_buff *skb, int attrtype,
261 int attrlen, const void *data);
262extern int nla_put_nohdr(struct sk_buff *skb, int attrlen,
263 const void *data);
264extern int nla_append(struct sk_buff *skb, int attrlen,
265 const void *data);
266 253
267/************************************************************************** 254/**************************************************************************
268 * Netlink Messages 255 * Netlink Messages
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index bf2ec2202c56..ee520cba2ec2 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -15,6 +15,10 @@ struct fib_rules_ops;
15struct hlist_head; 15struct hlist_head;
16struct fib_table; 16struct fib_table;
17struct sock; 17struct sock;
18struct local_ports {
19 seqlock_t lock;
20 int range[2];
21};
18 22
19struct netns_ipv4 { 23struct netns_ipv4 {
20#ifdef CONFIG_SYSCTL 24#ifdef CONFIG_SYSCTL
@@ -62,10 +66,11 @@ struct netns_ipv4 {
62 int sysctl_icmp_ratemask; 66 int sysctl_icmp_ratemask;
63 int sysctl_icmp_errors_use_inbound_ifaddr; 67 int sysctl_icmp_errors_use_inbound_ifaddr;
64 68
69 struct local_ports sysctl_local_ports;
70
65 int sysctl_tcp_ecn; 71 int sysctl_tcp_ecn;
66 72
67 kgid_t sysctl_ping_group_range[2]; 73 kgid_t sysctl_ping_group_range[2];
68 long sysctl_tcp_mem[3];
69 74
70 atomic_t dev_addr_genid; 75 atomic_t dev_addr_genid;
71 76
diff --git a/include/net/netns/nftables.h b/include/net/netns/nftables.h
new file mode 100644
index 000000000000..15d056d534e3
--- /dev/null
+++ b/include/net/netns/nftables.h
@@ -0,0 +1,19 @@
1#ifndef _NETNS_NFTABLES_H_
2#define _NETNS_NFTABLES_H_
3
4#include <linux/list.h>
5
6struct nft_af_info;
7
8struct netns_nftables {
9 struct list_head af_info;
10 struct list_head commit_list;
11 struct nft_af_info *ipv4;
12 struct nft_af_info *ipv6;
13 struct nft_af_info *arp;
14 struct nft_af_info *bridge;
15 u8 gencursor;
16 u8 genctr;
17};
18
19#endif
diff --git a/include/net/netrom.h b/include/net/netrom.h
index 121dcf854db5..110350aca3df 100644
--- a/include/net/netrom.h
+++ b/include/net/netrom.h
@@ -183,51 +183,50 @@ extern int sysctl_netrom_routing_control;
183extern int sysctl_netrom_link_fails_count; 183extern int sysctl_netrom_link_fails_count;
184extern int sysctl_netrom_reset_circuit; 184extern int sysctl_netrom_reset_circuit;
185 185
186extern int nr_rx_frame(struct sk_buff *, struct net_device *); 186int nr_rx_frame(struct sk_buff *, struct net_device *);
187extern void nr_destroy_socket(struct sock *); 187void nr_destroy_socket(struct sock *);
188 188
189/* nr_dev.c */ 189/* nr_dev.c */
190extern int nr_rx_ip(struct sk_buff *, struct net_device *); 190int nr_rx_ip(struct sk_buff *, struct net_device *);
191extern void nr_setup(struct net_device *); 191void nr_setup(struct net_device *);
192 192
193/* nr_in.c */ 193/* nr_in.c */
194extern int nr_process_rx_frame(struct sock *, struct sk_buff *); 194int nr_process_rx_frame(struct sock *, struct sk_buff *);
195 195
196/* nr_loopback.c */ 196/* nr_loopback.c */
197extern void nr_loopback_init(void); 197void nr_loopback_init(void);
198extern void nr_loopback_clear(void); 198void nr_loopback_clear(void);
199extern int nr_loopback_queue(struct sk_buff *); 199int nr_loopback_queue(struct sk_buff *);
200 200
201/* nr_out.c */ 201/* nr_out.c */
202extern void nr_output(struct sock *, struct sk_buff *); 202void nr_output(struct sock *, struct sk_buff *);
203extern void nr_send_nak_frame(struct sock *); 203void nr_send_nak_frame(struct sock *);
204extern void nr_kick(struct sock *); 204void nr_kick(struct sock *);
205extern void nr_transmit_buffer(struct sock *, struct sk_buff *); 205void nr_transmit_buffer(struct sock *, struct sk_buff *);
206extern void nr_establish_data_link(struct sock *); 206void nr_establish_data_link(struct sock *);
207extern void nr_enquiry_response(struct sock *); 207void nr_enquiry_response(struct sock *);
208extern void nr_check_iframes_acked(struct sock *, unsigned short); 208void nr_check_iframes_acked(struct sock *, unsigned short);
209 209
210/* nr_route.c */ 210/* nr_route.c */
211extern void nr_rt_device_down(struct net_device *); 211void nr_rt_device_down(struct net_device *);
212extern struct net_device *nr_dev_first(void); 212struct net_device *nr_dev_first(void);
213extern struct net_device *nr_dev_get(ax25_address *); 213struct net_device *nr_dev_get(ax25_address *);
214extern int nr_rt_ioctl(unsigned int, void __user *); 214int nr_rt_ioctl(unsigned int, void __user *);
215extern void nr_link_failed(ax25_cb *, int); 215void nr_link_failed(ax25_cb *, int);
216extern int nr_route_frame(struct sk_buff *, ax25_cb *); 216int nr_route_frame(struct sk_buff *, ax25_cb *);
217extern const struct file_operations nr_nodes_fops; 217extern const struct file_operations nr_nodes_fops;
218extern const struct file_operations nr_neigh_fops; 218extern const struct file_operations nr_neigh_fops;
219extern void nr_rt_free(void); 219void nr_rt_free(void);
220 220
221/* nr_subr.c */ 221/* nr_subr.c */
222extern void nr_clear_queues(struct sock *); 222void nr_clear_queues(struct sock *);
223extern void nr_frames_acked(struct sock *, unsigned short); 223void nr_frames_acked(struct sock *, unsigned short);
224extern void nr_requeue_frames(struct sock *); 224void nr_requeue_frames(struct sock *);
225extern int nr_validate_nr(struct sock *, unsigned short); 225int nr_validate_nr(struct sock *, unsigned short);
226extern int nr_in_rx_window(struct sock *, unsigned short); 226int nr_in_rx_window(struct sock *, unsigned short);
227extern void nr_write_internal(struct sock *, int); 227void nr_write_internal(struct sock *, int);
228 228
229extern void __nr_transmit_reply(struct sk_buff *skb, int mine, 229void __nr_transmit_reply(struct sk_buff *skb, int mine, unsigned char cmdflags);
230 unsigned char cmdflags);
231 230
232/* 231/*
233 * This routine is called when a Connect Acknowledge with the Choke Flag 232 * This routine is called when a Connect Acknowledge with the Choke Flag
@@ -247,24 +246,24 @@ do { \
247 __nr_transmit_reply((skb), (mine), NR_RESET); \ 246 __nr_transmit_reply((skb), (mine), NR_RESET); \
248} while (0) 247} while (0)
249 248
250extern void nr_disconnect(struct sock *, int); 249void nr_disconnect(struct sock *, int);
251 250
252/* nr_timer.c */ 251/* nr_timer.c */
253extern void nr_init_timers(struct sock *sk); 252void nr_init_timers(struct sock *sk);
254extern void nr_start_heartbeat(struct sock *); 253void nr_start_heartbeat(struct sock *);
255extern void nr_start_t1timer(struct sock *); 254void nr_start_t1timer(struct sock *);
256extern void nr_start_t2timer(struct sock *); 255void nr_start_t2timer(struct sock *);
257extern void nr_start_t4timer(struct sock *); 256void nr_start_t4timer(struct sock *);
258extern void nr_start_idletimer(struct sock *); 257void nr_start_idletimer(struct sock *);
259extern void nr_stop_heartbeat(struct sock *); 258void nr_stop_heartbeat(struct sock *);
260extern void nr_stop_t1timer(struct sock *); 259void nr_stop_t1timer(struct sock *);
261extern void nr_stop_t2timer(struct sock *); 260void nr_stop_t2timer(struct sock *);
262extern void nr_stop_t4timer(struct sock *); 261void nr_stop_t4timer(struct sock *);
263extern void nr_stop_idletimer(struct sock *); 262void nr_stop_idletimer(struct sock *);
264extern int nr_t1timer_running(struct sock *); 263int nr_t1timer_running(struct sock *);
265 264
266/* sysctl_net_netrom.c */ 265/* sysctl_net_netrom.c */
267extern void nr_register_sysctl(void); 266void nr_register_sysctl(void);
268extern void nr_unregister_sysctl(void); 267void nr_unregister_sysctl(void);
269 268
270#endif 269#endif
diff --git a/include/net/nfc/digital.h b/include/net/nfc/digital.h
new file mode 100644
index 000000000000..36acecd5f06c
--- /dev/null
+++ b/include/net/nfc/digital.h
@@ -0,0 +1,227 @@
1/*
2 * NFC Digital Protocol stack
3 * Copyright (c) 2013, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 */
15
16#ifndef __NFC_DIGITAL_H
17#define __NFC_DIGITAL_H
18
19#include <linux/skbuff.h>
20#include <net/nfc/nfc.h>
21
22/**
23 * Configuration types for in_configure_hw and tg_configure_hw.
24 */
25enum {
26 NFC_DIGITAL_CONFIG_RF_TECH = 0,
27 NFC_DIGITAL_CONFIG_FRAMING,
28};
29
30/**
31 * RF technology values passed as param argument to in_configure_hw and
32 * tg_configure_hw for NFC_DIGITAL_CONFIG_RF_TECH configuration type.
33 */
34enum {
35 NFC_DIGITAL_RF_TECH_106A = 0,
36 NFC_DIGITAL_RF_TECH_212F,
37 NFC_DIGITAL_RF_TECH_424F,
38
39 NFC_DIGITAL_RF_TECH_LAST,
40};
41
42/**
43 * Framing configuration passed as param argument to in_configure_hw and
44 * tg_configure_hw for NFC_DIGITAL_CONFIG_FRAMING configuration type.
45 */
46enum {
47 NFC_DIGITAL_FRAMING_NFCA_SHORT = 0,
48 NFC_DIGITAL_FRAMING_NFCA_STANDARD,
49 NFC_DIGITAL_FRAMING_NFCA_STANDARD_WITH_CRC_A,
50
51 NFC_DIGITAL_FRAMING_NFCA_T1T,
52 NFC_DIGITAL_FRAMING_NFCA_T2T,
53 NFC_DIGITAL_FRAMING_NFCA_NFC_DEP,
54
55 NFC_DIGITAL_FRAMING_NFCF,
56 NFC_DIGITAL_FRAMING_NFCF_T3T,
57 NFC_DIGITAL_FRAMING_NFCF_NFC_DEP,
58 NFC_DIGITAL_FRAMING_NFC_DEP_ACTIVATED,
59
60 NFC_DIGITAL_FRAMING_LAST,
61};
62
63#define DIGITAL_MDAA_NFCID1_SIZE 3
64
65struct digital_tg_mdaa_params {
66 u16 sens_res;
67 u8 nfcid1[DIGITAL_MDAA_NFCID1_SIZE];
68 u8 sel_res;
69
70 u8 nfcid2[NFC_NFCID2_MAXSIZE];
71 u16 sc;
72};
73
74struct nfc_digital_dev;
75
76/**
77 * nfc_digital_cmd_complete_t - Definition of command result callback
78 *
79 * @ddev: nfc_digital_device ref
80 * @arg: user data
81 * @resp: response data
82 *
83 * resp pointer can be an error code and will be checked with IS_ERR() macro.
84 * The callback is responsible for freeing resp sk_buff.
85 */
86typedef void (*nfc_digital_cmd_complete_t)(struct nfc_digital_dev *ddev,
87 void *arg, struct sk_buff *resp);
88
89/**
90 * Device side NFC Digital operations
91 *
92 * Initiator mode:
93 * @in_configure_hw: Hardware configuration for RF technology and communication
94 * framing in initiator mode. This is a synchronous function.
95 * @in_send_cmd: Initiator mode data exchange using RF technology and framing
96 * previously set with in_configure_hw. The peer response is returned
97 * through callback cb. If an io error occurs or the peer didn't reply
98 * within the specified timeout (ms), the error code is passed back through
99 * the resp pointer. This is an asynchronous function.
100 *
101 * Target mode: Only NFC-DEP protocol is supported in target mode.
102 * @tg_configure_hw: Hardware configuration for RF technology and communication
103 * framing in target mode. This is a synchronous function.
104 * @tg_send_cmd: Target mode data exchange using RF technology and framing
105 * previously set with tg_configure_hw. The peer next command is returned
106 * through callback cb. If an io error occurs or the peer didn't reply
107 * within the specified timeout (ms), the error code is passed back through
108 * the resp pointer. This is an asynchronous function.
109 * @tg_listen: Put the device in listen mode waiting for data from the peer
110 * device. This is an asynchronous function.
111 * @tg_listen_mdaa: If supported, put the device in automatic listen mode with
112 * mode detection and automatic anti-collision. In this mode, the device
113 * automatically detects the RF technology and executes the anti-collision
114 * detection using the command responses specified in mdaa_params. The
115 * mdaa_params structure contains SENS_RES, NFCID1, and SEL_RES for 106A RF
116 * tech. NFCID2 and system code (sc) for 212F and 424F. The driver returns
117 * the NFC-DEP ATR_REQ command through cb. The digital stack deducts the RF
118 * tech by analyzing the SoD of the frame containing the ATR_REQ command.
119 * This is an asynchronous function.
120 *
121 * @switch_rf: Turns device radio on or off. The stack does not call explicitly
122 * switch_rf to turn the radio on. A call to in|tg_configure_hw must turn
123 * the device radio on.
124 * @abort_cmd: Discard the last sent command.
125 */
126struct nfc_digital_ops {
127 int (*in_configure_hw)(struct nfc_digital_dev *ddev, int type,
128 int param);
129 int (*in_send_cmd)(struct nfc_digital_dev *ddev, struct sk_buff *skb,
130 u16 timeout, nfc_digital_cmd_complete_t cb,
131 void *arg);
132
133 int (*tg_configure_hw)(struct nfc_digital_dev *ddev, int type,
134 int param);
135 int (*tg_send_cmd)(struct nfc_digital_dev *ddev, struct sk_buff *skb,
136 u16 timeout, nfc_digital_cmd_complete_t cb,
137 void *arg);
138 int (*tg_listen)(struct nfc_digital_dev *ddev, u16 timeout,
139 nfc_digital_cmd_complete_t cb, void *arg);
140 int (*tg_listen_mdaa)(struct nfc_digital_dev *ddev,
141 struct digital_tg_mdaa_params *mdaa_params,
142 u16 timeout, nfc_digital_cmd_complete_t cb,
143 void *arg);
144
145 int (*switch_rf)(struct nfc_digital_dev *ddev, bool on);
146 void (*abort_cmd)(struct nfc_digital_dev *ddev);
147};
148
149#define NFC_DIGITAL_POLL_MODE_COUNT_MAX 6 /* 106A, 212F, and 424F in & tg */
150
151typedef int (*digital_poll_t)(struct nfc_digital_dev *ddev, u8 rf_tech);
152
153struct digital_poll_tech {
154 u8 rf_tech;
155 digital_poll_t poll_func;
156};
157
158/**
159 * Driver capabilities - bit mask made of the following values
160 *
161 * @NFC_DIGITAL_DRV_CAPS_IN_CRC: The driver handles CRC calculation in initiator
162 * mode.
163 * @NFC_DIGITAL_DRV_CAPS_TG_CRC: The driver handles CRC calculation in target
164 * mode.
165 */
166#define NFC_DIGITAL_DRV_CAPS_IN_CRC 0x0001
167#define NFC_DIGITAL_DRV_CAPS_TG_CRC 0x0002
168
169struct nfc_digital_dev {
170 struct nfc_dev *nfc_dev;
171 struct nfc_digital_ops *ops;
172
173 u32 protocols;
174
175 int tx_headroom;
176 int tx_tailroom;
177
178 u32 driver_capabilities;
179 void *driver_data;
180
181 struct digital_poll_tech poll_techs[NFC_DIGITAL_POLL_MODE_COUNT_MAX];
182 u8 poll_tech_count;
183 u8 poll_tech_index;
184 struct mutex poll_lock;
185
186 struct work_struct cmd_work;
187 struct work_struct cmd_complete_work;
188 struct list_head cmd_queue;
189 struct mutex cmd_lock;
190
191 struct work_struct poll_work;
192
193 u8 curr_protocol;
194 u8 curr_rf_tech;
195 u8 curr_nfc_dep_pni;
196
197 int (*skb_check_crc)(struct sk_buff *skb);
198 void (*skb_add_crc)(struct sk_buff *skb);
199};
200
201struct nfc_digital_dev *nfc_digital_allocate_device(struct nfc_digital_ops *ops,
202 __u32 supported_protocols,
203 __u32 driver_capabilities,
204 int tx_headroom,
205 int tx_tailroom);
206void nfc_digital_free_device(struct nfc_digital_dev *ndev);
207int nfc_digital_register_device(struct nfc_digital_dev *ndev);
208void nfc_digital_unregister_device(struct nfc_digital_dev *ndev);
209
210static inline void nfc_digital_set_parent_dev(struct nfc_digital_dev *ndev,
211 struct device *dev)
212{
213 nfc_set_parent_dev(ndev->nfc_dev, dev);
214}
215
216static inline void nfc_digital_set_drvdata(struct nfc_digital_dev *dev,
217 void *data)
218{
219 dev->driver_data = data;
220}
221
222static inline void *nfc_digital_get_drvdata(struct nfc_digital_dev *dev)
223{
224 return dev->driver_data;
225}
226
227#endif /* __NFC_DIGITAL_H */
diff --git a/include/net/nfc/hci.h b/include/net/nfc/hci.h
index b64b7bce4b94..2eca2960ca9c 100644
--- a/include/net/nfc/hci.h
+++ b/include/net/nfc/hci.h
@@ -24,12 +24,6 @@
24 24
25#include <net/nfc/nfc.h> 25#include <net/nfc/nfc.h>
26 26
27struct nfc_phy_ops {
28 int (*write)(void *dev_id, struct sk_buff *skb);
29 int (*enable)(void *dev_id);
30 void (*disable)(void *dev_id);
31};
32
33struct nfc_hci_dev; 27struct nfc_hci_dev;
34 28
35struct nfc_hci_ops { 29struct nfc_hci_ops {
diff --git a/include/net/nfc/nci.h b/include/net/nfc/nci.h
index 88785e5c6b2c..e5aa5acafea0 100644
--- a/include/net/nfc/nci.h
+++ b/include/net/nfc/nci.h
@@ -166,6 +166,10 @@
166#define NCI_GID_NFCEE_MGMT 0x2 166#define NCI_GID_NFCEE_MGMT 0x2
167#define NCI_GID_PROPRIETARY 0xf 167#define NCI_GID_PROPRIETARY 0xf
168 168
169/* ----- NCI over SPI head/crc(tail) room needed for outgoing frames ----- */
170#define NCI_SPI_HDR_LEN 4
171#define NCI_SPI_CRC_LEN 2
172
169/* ---- NCI Packet structures ---- */ 173/* ---- NCI Packet structures ---- */
170#define NCI_CTRL_HDR_SIZE 3 174#define NCI_CTRL_HDR_SIZE 3
171#define NCI_DATA_HDR_SIZE 3 175#define NCI_DATA_HDR_SIZE 3
diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h
index 99fc1f3a392a..6126f1f992b4 100644
--- a/include/net/nfc/nci_core.h
+++ b/include/net/nfc/nci_core.h
@@ -207,19 +207,9 @@ int nci_to_errno(__u8 code);
207#define NCI_SPI_CRC_ENABLED 0x01 207#define NCI_SPI_CRC_ENABLED 0x01
208 208
209/* ----- NCI SPI structures ----- */ 209/* ----- NCI SPI structures ----- */
210struct nci_spi_dev; 210struct nci_spi {
211 211 struct nci_dev *ndev;
212struct nci_spi_ops {
213 int (*open)(struct nci_spi_dev *ndev);
214 int (*close)(struct nci_spi_dev *ndev);
215 void (*assert_int)(struct nci_spi_dev *ndev);
216 void (*deassert_int)(struct nci_spi_dev *ndev);
217};
218
219struct nci_spi_dev {
220 struct nci_dev *nci_dev;
221 struct spi_device *spi; 212 struct spi_device *spi;
222 struct nci_spi_ops *ops;
223 213
224 unsigned int xfer_udelay; /* microseconds delay between 214 unsigned int xfer_udelay; /* microseconds delay between
225 transactions */ 215 transactions */
@@ -227,31 +217,15 @@ struct nci_spi_dev {
227 217
228 struct completion req_completion; 218 struct completion req_completion;
229 u8 req_result; 219 u8 req_result;
230
231 void *driver_data;
232}; 220};
233 221
234/* ----- NCI SPI Devices ----- */ 222/* ----- NCI SPI ----- */
235struct nci_spi_dev *nci_spi_allocate_device(struct spi_device *spi, 223struct nci_spi *nci_spi_allocate_spi(struct spi_device *spi,
236 struct nci_spi_ops *ops, 224 u8 acknowledge_mode, unsigned int delay,
237 u32 supported_protocols, 225 struct nci_dev *ndev);
238 u32 supported_se, 226int nci_spi_send(struct nci_spi *nspi,
239 u8 acknowledge_mode, 227 struct completion *write_handshake_completion,
240 unsigned int delay); 228 struct sk_buff *skb);
241void nci_spi_free_device(struct nci_spi_dev *ndev); 229struct sk_buff *nci_spi_read(struct nci_spi *nspi);
242int nci_spi_register_device(struct nci_spi_dev *ndev);
243void nci_spi_unregister_device(struct nci_spi_dev *ndev);
244int nci_spi_recv_frame(struct nci_spi_dev *ndev);
245
246static inline void nci_spi_set_drvdata(struct nci_spi_dev *ndev,
247 void *data)
248{
249 ndev->driver_data = data;
250}
251
252static inline void *nci_spi_get_drvdata(struct nci_spi_dev *ndev)
253{
254 return ndev->driver_data;
255}
256 230
257#endif /* __NCI_CORE_H */ 231#endif /* __NCI_CORE_H */
diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h
index f68ee68e4e3e..82fc4e43fc6e 100644
--- a/include/net/nfc/nfc.h
+++ b/include/net/nfc/nfc.h
@@ -28,9 +28,14 @@
28#include <linux/device.h> 28#include <linux/device.h>
29#include <linux/skbuff.h> 29#include <linux/skbuff.h>
30 30
31#define nfc_dev_info(dev, fmt, arg...) dev_info((dev), "NFC: " fmt "\n", ## arg) 31#define nfc_info(dev, fmt, ...) dev_info((dev), "NFC: " fmt, ##__VA_ARGS__)
32#define nfc_dev_err(dev, fmt, arg...) dev_err((dev), "NFC: " fmt "\n", ## arg) 32#define nfc_err(dev, fmt, ...) dev_err((dev), "NFC: " fmt, ##__VA_ARGS__)
33#define nfc_dev_dbg(dev, fmt, arg...) dev_dbg((dev), fmt "\n", ## arg) 33
34struct nfc_phy_ops {
35 int (*write)(void *dev_id, struct sk_buff *skb);
36 int (*enable)(void *dev_id);
37 void (*disable)(void *dev_id);
38};
34 39
35struct nfc_dev; 40struct nfc_dev;
36 41
@@ -48,6 +53,8 @@ struct nfc_dev;
48typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb, 53typedef void (*data_exchange_cb_t)(void *context, struct sk_buff *skb,
49 int err); 54 int err);
50 55
56typedef void (*se_io_cb_t)(void *context, u8 *apdu, size_t apdu_len, int err);
57
51struct nfc_target; 58struct nfc_target;
52 59
53struct nfc_ops { 60struct nfc_ops {
@@ -74,12 +81,23 @@ struct nfc_ops {
74 int (*discover_se)(struct nfc_dev *dev); 81 int (*discover_se)(struct nfc_dev *dev);
75 int (*enable_se)(struct nfc_dev *dev, u32 se_idx); 82 int (*enable_se)(struct nfc_dev *dev, u32 se_idx);
76 int (*disable_se)(struct nfc_dev *dev, u32 se_idx); 83 int (*disable_se)(struct nfc_dev *dev, u32 se_idx);
84 int (*se_io) (struct nfc_dev *dev, u32 se_idx,
85 u8 *apdu, size_t apdu_length,
86 se_io_cb_t cb, void *cb_context);
77}; 87};
78 88
79#define NFC_TARGET_IDX_ANY -1 89#define NFC_TARGET_IDX_ANY -1
80#define NFC_MAX_GT_LEN 48 90#define NFC_MAX_GT_LEN 48
81#define NFC_ATR_RES_GT_OFFSET 15 91#define NFC_ATR_RES_GT_OFFSET 15
82 92
93/**
94 * struct nfc_target - NFC target descriptiom
95 *
96 * @sens_res: 2 bytes describing the target SENS_RES response, if the target
97 * is a type A one. The %sens_res most significant byte must be byte 2
98 * as described by the NFC Forum digital specification (i.e. the platform
99 * configuration one) while %sens_res least significant byte is byte 1.
100 */
83struct nfc_target { 101struct nfc_target {
84 u32 idx; 102 u32 idx;
85 u32 supported_protocols; 103 u32 supported_protocols;
@@ -243,5 +261,6 @@ void nfc_driver_failure(struct nfc_dev *dev, int err);
243 261
244int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type); 262int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type);
245int nfc_remove_se(struct nfc_dev *dev, u32 se_idx); 263int nfc_remove_se(struct nfc_dev *dev, u32 se_idx);
264struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx);
246 265
247#endif /* __NET_NFC_H */ 266#endif /* __NET_NFC_H */
diff --git a/include/net/p8022.h b/include/net/p8022.h
index 42e9fac51b31..05e41383856b 100644
--- a/include/net/p8022.h
+++ b/include/net/p8022.h
@@ -1,13 +1,13 @@
1#ifndef _NET_P8022_H 1#ifndef _NET_P8022_H
2#define _NET_P8022_H 2#define _NET_P8022_H
3extern struct datalink_proto * 3struct datalink_proto *
4 register_8022_client(unsigned char type, 4register_8022_client(unsigned char type,
5 int (*func)(struct sk_buff *skb, 5 int (*func)(struct sk_buff *skb,
6 struct net_device *dev, 6 struct net_device *dev,
7 struct packet_type *pt, 7 struct packet_type *pt,
8 struct net_device *orig_dev)); 8 struct net_device *orig_dev));
9extern void unregister_8022_client(struct datalink_proto *proto); 9void unregister_8022_client(struct datalink_proto *proto);
10 10
11extern struct datalink_proto *make_8023_client(void); 11struct datalink_proto *make_8023_client(void);
12extern void destroy_8023_client(struct datalink_proto *dl); 12void destroy_8023_client(struct datalink_proto *dl);
13#endif 13#endif
diff --git a/include/net/ping.h b/include/net/ping.h
index 5db0224b73ac..3f67704f3747 100644
--- a/include/net/ping.h
+++ b/include/net/ping.h
@@ -103,8 +103,8 @@ void ping_seq_stop(struct seq_file *seq, void *v);
103int ping_proc_register(struct net *net, struct ping_seq_afinfo *afinfo); 103int ping_proc_register(struct net *net, struct ping_seq_afinfo *afinfo);
104void ping_proc_unregister(struct net *net, struct ping_seq_afinfo *afinfo); 104void ping_proc_unregister(struct net *net, struct ping_seq_afinfo *afinfo);
105 105
106extern int __init ping_proc_init(void); 106int __init ping_proc_init(void);
107extern void ping_proc_exit(void); 107void ping_proc_exit(void);
108#endif 108#endif
109 109
110void __init ping_init(void); 110void __init ping_init(void);
diff --git a/include/net/protocol.h b/include/net/protocol.h
index 047c0476c0a0..fbf7676c9a02 100644
--- a/include/net/protocol.h
+++ b/include/net/protocol.h
@@ -96,20 +96,20 @@ extern const struct net_offload __rcu *inet6_offloads[MAX_INET_PROTOS];
96extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS]; 96extern const struct inet6_protocol __rcu *inet6_protos[MAX_INET_PROTOS];
97#endif 97#endif
98 98
99extern int inet_add_protocol(const struct net_protocol *prot, unsigned char num); 99int inet_add_protocol(const struct net_protocol *prot, unsigned char num);
100extern int inet_del_protocol(const struct net_protocol *prot, unsigned char num); 100int inet_del_protocol(const struct net_protocol *prot, unsigned char num);
101extern int inet_add_offload(const struct net_offload *prot, unsigned char num); 101int inet_add_offload(const struct net_offload *prot, unsigned char num);
102extern int inet_del_offload(const struct net_offload *prot, unsigned char num); 102int inet_del_offload(const struct net_offload *prot, unsigned char num);
103extern void inet_register_protosw(struct inet_protosw *p); 103void inet_register_protosw(struct inet_protosw *p);
104extern void inet_unregister_protosw(struct inet_protosw *p); 104void inet_unregister_protosw(struct inet_protosw *p);
105 105
106#if IS_ENABLED(CONFIG_IPV6) 106#if IS_ENABLED(CONFIG_IPV6)
107extern int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num); 107int inet6_add_protocol(const struct inet6_protocol *prot, unsigned char num);
108extern int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num); 108int inet6_del_protocol(const struct inet6_protocol *prot, unsigned char num);
109extern int inet6_register_protosw(struct inet_protosw *p); 109int inet6_register_protosw(struct inet_protosw *p);
110extern void inet6_unregister_protosw(struct inet_protosw *p); 110void inet6_unregister_protosw(struct inet_protosw *p);
111#endif 111#endif
112extern int inet6_add_offload(const struct net_offload *prot, unsigned char num); 112int inet6_add_offload(const struct net_offload *prot, unsigned char num);
113extern int inet6_del_offload(const struct net_offload *prot, unsigned char num); 113int inet6_del_offload(const struct net_offload *prot, unsigned char num);
114 114
115#endif /* _PROTOCOL_H */ 115#endif /* _PROTOCOL_H */
diff --git a/include/net/psnap.h b/include/net/psnap.h
index fe456c295b04..78db4cc1306a 100644
--- a/include/net/psnap.h
+++ b/include/net/psnap.h
@@ -1,11 +1,11 @@
1#ifndef _NET_PSNAP_H 1#ifndef _NET_PSNAP_H
2#define _NET_PSNAP_H 2#define _NET_PSNAP_H
3 3
4extern struct datalink_proto * 4struct datalink_proto *
5register_snap_client(const unsigned char *desc, 5register_snap_client(const unsigned char *desc,
6 int (*rcvfunc)(struct sk_buff *, struct net_device *, 6 int (*rcvfunc)(struct sk_buff *, struct net_device *,
7 struct packet_type *, 7 struct packet_type *,
8 struct net_device *orig_dev)); 8 struct net_device *orig_dev));
9extern void unregister_snap_client(struct datalink_proto *proto); 9void unregister_snap_client(struct datalink_proto *proto);
10 10
11#endif 11#endif
diff --git a/include/net/raw.h b/include/net/raw.h
index 42ce6fe7a2d5..6a40c6562dd2 100644
--- a/include/net/raw.h
+++ b/include/net/raw.h
@@ -26,7 +26,7 @@ extern struct proto raw_prot;
26void raw_icmp_error(struct sk_buff *, int, u32); 26void raw_icmp_error(struct sk_buff *, int, u32);
27int raw_local_deliver(struct sk_buff *, int); 27int raw_local_deliver(struct sk_buff *, int);
28 28
29extern int raw_rcv(struct sock *, struct sk_buff *); 29int raw_rcv(struct sock *, struct sk_buff *);
30 30
31#define RAW_HTABLE_SIZE MAX_INET_PROTOS 31#define RAW_HTABLE_SIZE MAX_INET_PROTOS
32 32
@@ -36,8 +36,8 @@ struct raw_hashinfo {
36}; 36};
37 37
38#ifdef CONFIG_PROC_FS 38#ifdef CONFIG_PROC_FS
39extern int raw_proc_init(void); 39int raw_proc_init(void);
40extern void raw_proc_exit(void); 40void raw_proc_exit(void);
41 41
42struct raw_iter_state { 42struct raw_iter_state {
43 struct seq_net_private p; 43 struct seq_net_private p;
diff --git a/include/net/rawv6.h b/include/net/rawv6.h
index e7ea660e4db6..87783dea0791 100644
--- a/include/net/rawv6.h
+++ b/include/net/rawv6.h
@@ -7,8 +7,7 @@ void raw6_icmp_error(struct sk_buff *, int nexthdr,
7 u8 type, u8 code, int inner_offset, __be32); 7 u8 type, u8 code, int inner_offset, __be32);
8bool raw6_local_deliver(struct sk_buff *, int); 8bool raw6_local_deliver(struct sk_buff *, int);
9 9
10extern int rawv6_rcv(struct sock *sk, 10int rawv6_rcv(struct sock *sk, struct sk_buff *skb);
11 struct sk_buff *skb);
12 11
13#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 12#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
14int rawv6_mh_filter_register(int (*filter)(struct sock *sock, 13int rawv6_mh_filter_register(int (*filter)(struct sock *sock,
diff --git a/include/net/request_sock.h b/include/net/request_sock.h
index 59795e42c8b6..7f830ff67f08 100644
--- a/include/net/request_sock.h
+++ b/include/net/request_sock.h
@@ -43,11 +43,12 @@ struct request_sock_ops {
43 struct request_sock *req); 43 struct request_sock *req);
44}; 44};
45 45
46extern int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req); 46int inet_rtx_syn_ack(struct sock *parent, struct request_sock *req);
47 47
48/* struct request_sock - mini sock to represent a connection request 48/* struct request_sock - mini sock to represent a connection request
49 */ 49 */
50struct request_sock { 50struct request_sock {
51 struct sock_common __req_common;
51 struct request_sock *dl_next; 52 struct request_sock *dl_next;
52 u16 mss; 53 u16 mss;
53 u8 num_retrans; /* number of retransmits */ 54 u8 num_retrans; /* number of retransmits */
@@ -162,13 +163,13 @@ struct request_sock_queue {
162 */ 163 */
163}; 164};
164 165
165extern int reqsk_queue_alloc(struct request_sock_queue *queue, 166int reqsk_queue_alloc(struct request_sock_queue *queue,
166 unsigned int nr_table_entries); 167 unsigned int nr_table_entries);
167 168
168extern void __reqsk_queue_destroy(struct request_sock_queue *queue); 169void __reqsk_queue_destroy(struct request_sock_queue *queue);
169extern void reqsk_queue_destroy(struct request_sock_queue *queue); 170void reqsk_queue_destroy(struct request_sock_queue *queue);
170extern void reqsk_fastopen_remove(struct sock *sk, 171void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req,
171 struct request_sock *req, bool reset); 172 bool reset);
172 173
173static inline struct request_sock * 174static inline struct request_sock *
174 reqsk_queue_yank_acceptq(struct request_sock_queue *queue) 175 reqsk_queue_yank_acceptq(struct request_sock_queue *queue)
diff --git a/include/net/rose.h b/include/net/rose.h
index 555dd198aab7..50811fe2c585 100644
--- a/include/net/rose.h
+++ b/include/net/rose.h
@@ -160,38 +160,42 @@ extern int sysctl_rose_routing_control;
160extern int sysctl_rose_link_fail_timeout; 160extern int sysctl_rose_link_fail_timeout;
161extern int sysctl_rose_maximum_vcs; 161extern int sysctl_rose_maximum_vcs;
162extern int sysctl_rose_window_size; 162extern int sysctl_rose_window_size;
163extern int rosecmp(rose_address *, rose_address *); 163
164extern int rosecmpm(rose_address *, rose_address *, unsigned short); 164int rosecmp(rose_address *, rose_address *);
165extern char *rose2asc(char *buf, const rose_address *); 165int rosecmpm(rose_address *, rose_address *, unsigned short);
166extern struct sock *rose_find_socket(unsigned int, struct rose_neigh *); 166char *rose2asc(char *buf, const rose_address *);
167extern void rose_kill_by_neigh(struct rose_neigh *); 167struct sock *rose_find_socket(unsigned int, struct rose_neigh *);
168extern unsigned int rose_new_lci(struct rose_neigh *); 168void rose_kill_by_neigh(struct rose_neigh *);
169extern int rose_rx_call_request(struct sk_buff *, struct net_device *, struct rose_neigh *, unsigned int); 169unsigned int rose_new_lci(struct rose_neigh *);
170extern void rose_destroy_socket(struct sock *); 170int rose_rx_call_request(struct sk_buff *, struct net_device *,
171 struct rose_neigh *, unsigned int);
172void rose_destroy_socket(struct sock *);
171 173
172/* rose_dev.c */ 174/* rose_dev.c */
173extern void rose_setup(struct net_device *); 175void rose_setup(struct net_device *);
174 176
175/* rose_in.c */ 177/* rose_in.c */
176extern int rose_process_rx_frame(struct sock *, struct sk_buff *); 178int rose_process_rx_frame(struct sock *, struct sk_buff *);
177 179
178/* rose_link.c */ 180/* rose_link.c */
179extern void rose_start_ftimer(struct rose_neigh *); 181void rose_start_ftimer(struct rose_neigh *);
180extern void rose_stop_ftimer(struct rose_neigh *); 182void rose_stop_ftimer(struct rose_neigh *);
181extern void rose_stop_t0timer(struct rose_neigh *); 183void rose_stop_t0timer(struct rose_neigh *);
182extern int rose_ftimer_running(struct rose_neigh *); 184int rose_ftimer_running(struct rose_neigh *);
183extern void rose_link_rx_restart(struct sk_buff *, struct rose_neigh *, unsigned short); 185void rose_link_rx_restart(struct sk_buff *, struct rose_neigh *,
184extern void rose_transmit_clear_request(struct rose_neigh *, unsigned int, unsigned char, unsigned char); 186 unsigned short);
185extern void rose_transmit_link(struct sk_buff *, struct rose_neigh *); 187void rose_transmit_clear_request(struct rose_neigh *, unsigned int,
188 unsigned char, unsigned char);
189void rose_transmit_link(struct sk_buff *, struct rose_neigh *);
186 190
187/* rose_loopback.c */ 191/* rose_loopback.c */
188extern void rose_loopback_init(void); 192void rose_loopback_init(void);
189extern void rose_loopback_clear(void); 193void rose_loopback_clear(void);
190extern int rose_loopback_queue(struct sk_buff *, struct rose_neigh *); 194int rose_loopback_queue(struct sk_buff *, struct rose_neigh *);
191 195
192/* rose_out.c */ 196/* rose_out.c */
193extern void rose_kick(struct sock *); 197void rose_kick(struct sock *);
194extern void rose_enquiry_response(struct sock *); 198void rose_enquiry_response(struct sock *);
195 199
196/* rose_route.c */ 200/* rose_route.c */
197extern struct rose_neigh *rose_loopback_neigh; 201extern struct rose_neigh *rose_loopback_neigh;
@@ -199,43 +203,45 @@ extern const struct file_operations rose_neigh_fops;
199extern const struct file_operations rose_nodes_fops; 203extern const struct file_operations rose_nodes_fops;
200extern const struct file_operations rose_routes_fops; 204extern const struct file_operations rose_routes_fops;
201 205
202extern void rose_add_loopback_neigh(void); 206void rose_add_loopback_neigh(void);
203extern int __must_check rose_add_loopback_node(rose_address *); 207int __must_check rose_add_loopback_node(rose_address *);
204extern void rose_del_loopback_node(rose_address *); 208void rose_del_loopback_node(rose_address *);
205extern void rose_rt_device_down(struct net_device *); 209void rose_rt_device_down(struct net_device *);
206extern void rose_link_device_down(struct net_device *); 210void rose_link_device_down(struct net_device *);
207extern struct net_device *rose_dev_first(void); 211struct net_device *rose_dev_first(void);
208extern struct net_device *rose_dev_get(rose_address *); 212struct net_device *rose_dev_get(rose_address *);
209extern struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *); 213struct rose_route *rose_route_free_lci(unsigned int, struct rose_neigh *);
210extern struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *, unsigned char *, int); 214struct rose_neigh *rose_get_neigh(rose_address *, unsigned char *,
211extern int rose_rt_ioctl(unsigned int, void __user *); 215 unsigned char *, int);
212extern void rose_link_failed(ax25_cb *, int); 216int rose_rt_ioctl(unsigned int, void __user *);
213extern int rose_route_frame(struct sk_buff *, ax25_cb *); 217void rose_link_failed(ax25_cb *, int);
214extern void rose_rt_free(void); 218int rose_route_frame(struct sk_buff *, ax25_cb *);
219void rose_rt_free(void);
215 220
216/* rose_subr.c */ 221/* rose_subr.c */
217extern void rose_clear_queues(struct sock *); 222void rose_clear_queues(struct sock *);
218extern void rose_frames_acked(struct sock *, unsigned short); 223void rose_frames_acked(struct sock *, unsigned short);
219extern void rose_requeue_frames(struct sock *); 224void rose_requeue_frames(struct sock *);
220extern int rose_validate_nr(struct sock *, unsigned short); 225int rose_validate_nr(struct sock *, unsigned short);
221extern void rose_write_internal(struct sock *, int); 226void rose_write_internal(struct sock *, int);
222extern int rose_decode(struct sk_buff *, int *, int *, int *, int *, int *); 227int rose_decode(struct sk_buff *, int *, int *, int *, int *, int *);
223extern int rose_parse_facilities(unsigned char *, unsigned int, struct rose_facilities_struct *); 228int rose_parse_facilities(unsigned char *, unsigned int,
224extern void rose_disconnect(struct sock *, int, int, int); 229 struct rose_facilities_struct *);
230void rose_disconnect(struct sock *, int, int, int);
225 231
226/* rose_timer.c */ 232/* rose_timer.c */
227extern void rose_start_heartbeat(struct sock *); 233void rose_start_heartbeat(struct sock *);
228extern void rose_start_t1timer(struct sock *); 234void rose_start_t1timer(struct sock *);
229extern void rose_start_t2timer(struct sock *); 235void rose_start_t2timer(struct sock *);
230extern void rose_start_t3timer(struct sock *); 236void rose_start_t3timer(struct sock *);
231extern void rose_start_hbtimer(struct sock *); 237void rose_start_hbtimer(struct sock *);
232extern void rose_start_idletimer(struct sock *); 238void rose_start_idletimer(struct sock *);
233extern void rose_stop_heartbeat(struct sock *); 239void rose_stop_heartbeat(struct sock *);
234extern void rose_stop_timer(struct sock *); 240void rose_stop_timer(struct sock *);
235extern void rose_stop_idletimer(struct sock *); 241void rose_stop_idletimer(struct sock *);
236 242
237/* sysctl_net_rose.c */ 243/* sysctl_net_rose.c */
238extern void rose_register_sysctl(void); 244void rose_register_sysctl(void);
239extern void rose_unregister_sysctl(void); 245void rose_unregister_sysctl(void);
240 246
241#endif 247#endif
diff --git a/include/net/route.h b/include/net/route.h
index afdeeb5bec25..f68c167280a7 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -39,6 +39,7 @@
39#define RTO_ONLINK 0x01 39#define RTO_ONLINK 0x01
40 40
41#define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE)) 41#define RT_CONN_FLAGS(sk) (RT_TOS(inet_sk(sk)->tos) | sock_flag(sk, SOCK_LOCALROUTE))
42#define RT_CONN_FLAGS_TOS(sk,tos) (RT_TOS(tos) | sock_flag(sk, SOCK_LOCALROUTE))
42 43
43struct fib_nh; 44struct fib_nh;
44struct fib_info; 45struct fib_info;
@@ -87,34 +88,28 @@ struct ip_rt_acct {
87}; 88};
88 89
89struct rt_cache_stat { 90struct rt_cache_stat {
90 unsigned int in_hit;
91 unsigned int in_slow_tot; 91 unsigned int in_slow_tot;
92 unsigned int in_slow_mc; 92 unsigned int in_slow_mc;
93 unsigned int in_no_route; 93 unsigned int in_no_route;
94 unsigned int in_brd; 94 unsigned int in_brd;
95 unsigned int in_martian_dst; 95 unsigned int in_martian_dst;
96 unsigned int in_martian_src; 96 unsigned int in_martian_src;
97 unsigned int out_hit;
98 unsigned int out_slow_tot; 97 unsigned int out_slow_tot;
99 unsigned int out_slow_mc; 98 unsigned int out_slow_mc;
100 unsigned int gc_total;
101 unsigned int gc_ignored;
102 unsigned int gc_goal_miss;
103 unsigned int gc_dst_overflow;
104 unsigned int in_hlist_search;
105 unsigned int out_hlist_search;
106}; 99};
107 100
108extern struct ip_rt_acct __percpu *ip_rt_acct; 101extern struct ip_rt_acct __percpu *ip_rt_acct;
109 102
110struct in_device; 103struct in_device;
111extern int ip_rt_init(void); 104
112extern void rt_cache_flush(struct net *net); 105int ip_rt_init(void);
113extern void rt_flush_dev(struct net_device *dev); 106void rt_cache_flush(struct net *net);
114extern struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp); 107void rt_flush_dev(struct net_device *dev);
115extern struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp, 108struct rtable *__ip_route_output_key(struct net *, struct flowi4 *flp);
116 struct sock *sk); 109struct rtable *ip_route_output_flow(struct net *, struct flowi4 *flp,
117extern struct dst_entry *ipv4_blackhole_route(struct net *net, struct dst_entry *dst_orig); 110 struct sock *sk);
111struct dst_entry *ipv4_blackhole_route(struct net *net,
112 struct dst_entry *dst_orig);
118 113
119static inline struct rtable *ip_route_output_key(struct net *net, struct flowi4 *flp) 114static inline struct rtable *ip_route_output_key(struct net *net, struct flowi4 *flp)
120{ 115{
@@ -162,8 +157,8 @@ static inline struct rtable *ip_route_output_gre(struct net *net, struct flowi4
162 return ip_route_output_key(net, fl4); 157 return ip_route_output_key(net, fl4);
163} 158}
164 159
165extern int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src, 160int ip_route_input_noref(struct sk_buff *skb, __be32 dst, __be32 src,
166 u8 tos, struct net_device *devin); 161 u8 tos, struct net_device *devin);
167 162
168static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src, 163static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
169 u8 tos, struct net_device *devin) 164 u8 tos, struct net_device *devin)
@@ -179,24 +174,25 @@ static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
179 return err; 174 return err;
180} 175}
181 176
182extern void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, 177void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, int oif,
183 int oif, u32 mark, u8 protocol, int flow_flags); 178 u32 mark, u8 protocol, int flow_flags);
184extern void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu); 179void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu);
185extern void ipv4_redirect(struct sk_buff *skb, struct net *net, 180void ipv4_redirect(struct sk_buff *skb, struct net *net, int oif, u32 mark,
186 int oif, u32 mark, u8 protocol, int flow_flags); 181 u8 protocol, int flow_flags);
187extern void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk); 182void ipv4_sk_redirect(struct sk_buff *skb, struct sock *sk);
188extern void ip_rt_send_redirect(struct sk_buff *skb); 183void ip_rt_send_redirect(struct sk_buff *skb);
189 184
190extern unsigned int inet_addr_type(struct net *net, __be32 addr); 185unsigned int inet_addr_type(struct net *net, __be32 addr);
191extern unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev, __be32 addr); 186unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev,
192extern void ip_rt_multicast_event(struct in_device *); 187 __be32 addr);
193extern int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg); 188void ip_rt_multicast_event(struct in_device *);
194extern void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt); 189int ip_rt_ioctl(struct net *, unsigned int cmd, void __user *arg);
195extern int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb); 190void ip_rt_get_source(u8 *src, struct sk_buff *skb, struct rtable *rt);
191int ip_rt_dump(struct sk_buff *skb, struct netlink_callback *cb);
196 192
197struct in_ifaddr; 193struct in_ifaddr;
198extern void fib_add_ifaddr(struct in_ifaddr *); 194void fib_add_ifaddr(struct in_ifaddr *);
199extern void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *); 195void fib_del_ifaddr(struct in_ifaddr *, struct in_ifaddr *);
200 196
201static inline void ip_rt_put(struct rtable *rt) 197static inline void ip_rt_put(struct rtable *rt)
202{ 198{
@@ -317,12 +313,20 @@ static inline int ip4_dst_hoplimit(const struct dst_entry *dst)
317 return hoplimit; 313 return hoplimit;
318} 314}
319 315
320static inline int ip_skb_dst_mtu(struct sk_buff *skb) 316static inline bool ip_sk_accept_pmtu(const struct sock *sk)
317{
318 return inet_sk(sk)->pmtudisc != IP_PMTUDISC_INTERFACE;
319}
320
321static inline bool ip_sk_use_pmtu(const struct sock *sk)
321{ 322{
322 struct inet_sock *inet = skb->sk ? inet_sk(skb->sk) : NULL; 323 return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE;
324}
323 325
324 return (inet && inet->pmtudisc == IP_PMTUDISC_PROBE) ? 326static inline int ip_skb_dst_mtu(const struct sk_buff *skb)
325 skb_dst(skb)->dev->mtu : dst_mtu(skb_dst(skb)); 327{
328 return (!skb->sk || ip_sk_use_pmtu(skb->sk)) ?
329 dst_mtu(skb_dst(skb)) : skb_dst(skb)->dev->mtu;
326} 330}
327 331
328#endif /* _ROUTE_H */ 332#endif /* _ROUTE_H */
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 702664833a53..bb13a182fba6 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -8,14 +8,12 @@ typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *);
8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *); 8typedef int (*rtnl_dumpit_func)(struct sk_buff *, struct netlink_callback *);
9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *); 9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *);
10 10
11extern int __rtnl_register(int protocol, int msgtype, 11int __rtnl_register(int protocol, int msgtype,
12 rtnl_doit_func, rtnl_dumpit_func, 12 rtnl_doit_func, rtnl_dumpit_func, rtnl_calcit_func);
13 rtnl_calcit_func); 13void rtnl_register(int protocol, int msgtype,
14extern void rtnl_register(int protocol, int msgtype, 14 rtnl_doit_func, rtnl_dumpit_func, rtnl_calcit_func);
15 rtnl_doit_func, rtnl_dumpit_func, 15int rtnl_unregister(int protocol, int msgtype);
16 rtnl_calcit_func); 16void rtnl_unregister_all(int protocol);
17extern int rtnl_unregister(int protocol, int msgtype);
18extern void rtnl_unregister_all(int protocol);
19 17
20static inline int rtnl_msg_family(const struct nlmsghdr *nlh) 18static inline int rtnl_msg_family(const struct nlmsghdr *nlh)
21{ 19{
@@ -83,11 +81,11 @@ struct rtnl_link_ops {
83 unsigned int (*get_num_rx_queues)(void); 81 unsigned int (*get_num_rx_queues)(void);
84}; 82};
85 83
86extern int __rtnl_link_register(struct rtnl_link_ops *ops); 84int __rtnl_link_register(struct rtnl_link_ops *ops);
87extern void __rtnl_link_unregister(struct rtnl_link_ops *ops); 85void __rtnl_link_unregister(struct rtnl_link_ops *ops);
88 86
89extern int rtnl_link_register(struct rtnl_link_ops *ops); 87int rtnl_link_register(struct rtnl_link_ops *ops);
90extern void rtnl_link_unregister(struct rtnl_link_ops *ops); 88void rtnl_link_unregister(struct rtnl_link_ops *ops);
91 89
92/** 90/**
93 * struct rtnl_af_ops - rtnetlink address family operations 91 * struct rtnl_af_ops - rtnetlink address family operations
@@ -117,18 +115,18 @@ struct rtnl_af_ops {
117 const struct nlattr *attr); 115 const struct nlattr *attr);
118}; 116};
119 117
120extern int __rtnl_af_register(struct rtnl_af_ops *ops); 118int __rtnl_af_register(struct rtnl_af_ops *ops);
121extern void __rtnl_af_unregister(struct rtnl_af_ops *ops); 119void __rtnl_af_unregister(struct rtnl_af_ops *ops);
122 120
123extern int rtnl_af_register(struct rtnl_af_ops *ops); 121int rtnl_af_register(struct rtnl_af_ops *ops);
124extern void rtnl_af_unregister(struct rtnl_af_ops *ops); 122void rtnl_af_unregister(struct rtnl_af_ops *ops);
125 123
124struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
125struct net_device *rtnl_create_link(struct net *net, char *ifname,
126 const struct rtnl_link_ops *ops,
127 struct nlattr *tb[]);
128int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm);
126 129
127extern struct net *rtnl_link_get_net(struct net *src_net, struct nlattr *tb[]);
128extern struct net_device *rtnl_create_link(struct net *net,
129 char *ifname, const struct rtnl_link_ops *ops, struct nlattr *tb[]);
130extern int rtnl_configure_link(struct net_device *dev,
131 const struct ifinfomsg *ifm);
132extern const struct nla_policy ifla_policy[IFLA_MAX+1]; 130extern const struct nla_policy ifla_policy[IFLA_MAX+1];
133 131
134#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind) 132#define MODULE_ALIAS_RTNL_LINK(kind) MODULE_ALIAS("rtnl-link-" kind)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index f4eb365f7dcd..d0a6321c302e 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -702,13 +702,20 @@ static inline u64 psched_l2t_ns(const struct psched_ratecfg *r,
702} 702}
703 703
704void psched_ratecfg_precompute(struct psched_ratecfg *r, 704void psched_ratecfg_precompute(struct psched_ratecfg *r,
705 const struct tc_ratespec *conf); 705 const struct tc_ratespec *conf,
706 u64 rate64);
706 707
707static inline void psched_ratecfg_getrate(struct tc_ratespec *res, 708static inline void psched_ratecfg_getrate(struct tc_ratespec *res,
708 const struct psched_ratecfg *r) 709 const struct psched_ratecfg *r)
709{ 710{
710 memset(res, 0, sizeof(*res)); 711 memset(res, 0, sizeof(*res));
711 res->rate = r->rate_bytes_ps; 712
713 /* legacy struct tc_ratespec has a 32bit @rate field
714 * Qdisc using 64bit rate should add new attributes
715 * in order to maintain compatibility.
716 */
717 res->rate = min_t(u64, r->rate_bytes_ps, ~0U);
718
712 res->overhead = r->overhead; 719 res->overhead = r->overhead;
713 res->linklayer = (r->linklayer & TC_LINKLAYER_MASK); 720 res->linklayer = (r->linklayer & TC_LINKLAYER_MASK);
714} 721}
diff --git a/include/net/scm.h b/include/net/scm.h
index 8de2d37d2077..262532d111f5 100644
--- a/include/net/scm.h
+++ b/include/net/scm.h
@@ -33,11 +33,11 @@ struct scm_cookie {
33#endif 33#endif
34}; 34};
35 35
36extern void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm); 36void scm_detach_fds(struct msghdr *msg, struct scm_cookie *scm);
37extern void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm); 37void scm_detach_fds_compat(struct msghdr *msg, struct scm_cookie *scm);
38extern int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm); 38int __scm_send(struct socket *sock, struct msghdr *msg, struct scm_cookie *scm);
39extern void __scm_destroy(struct scm_cookie *scm); 39void __scm_destroy(struct scm_cookie *scm);
40extern struct scm_fp_list * scm_fp_dup(struct scm_fp_list *fpl); 40struct scm_fp_list *scm_fp_dup(struct scm_fp_list *fpl);
41 41
42#ifdef CONFIG_SECURITY_NETWORK 42#ifdef CONFIG_SECURITY_NETWORK
43static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm) 43static __inline__ void unix_get_peersec_dgram(struct socket *sock, struct scm_cookie *scm)
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index 259924d63ba6..6bd44fe94c26 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -42,56 +42,38 @@
42#include <linux/types.h> 42#include <linux/types.h>
43#include <net/sctp/sctp.h> 43#include <net/sctp/sctp.h>
44#include <linux/crc32c.h> 44#include <linux/crc32c.h>
45#include <linux/crc32.h>
45 46
46static inline __u32 sctp_crc32c(__u32 crc, u8 *buffer, u16 length) 47static inline __wsum sctp_csum_update(const void *buff, int len, __wsum sum)
47{ 48{
48 return crc32c(crc, buffer, length); 49 /* This uses the crypto implementation of crc32c, which is either
49} 50 * implemented w/ hardware support or resolves to __crc32c_le().
50
51static inline __u32 sctp_start_cksum(__u8 *buffer, __u16 length)
52{
53 __u32 crc = ~(__u32)0;
54 __u8 zero[sizeof(__u32)] = {0};
55
56 /* Optimize this routine to be SCTP specific, knowing how
57 * to skip the checksum field of the SCTP header.
58 */ 51 */
59 52 return crc32c(sum, buff, len);
60 /* Calculate CRC up to the checksum. */
61 crc = sctp_crc32c(crc, buffer, sizeof(struct sctphdr) - sizeof(__u32));
62
63 /* Skip checksum field of the header. */
64 crc = sctp_crc32c(crc, zero, sizeof(__u32));
65
66 /* Calculate the rest of the CRC. */
67 crc = sctp_crc32c(crc, &buffer[sizeof(struct sctphdr)],
68 length - sizeof(struct sctphdr));
69 return crc;
70}
71
72static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
73{
74 return sctp_crc32c(crc32, buffer, length);
75} 53}
76 54
77static inline __le32 sctp_end_cksum(__u32 crc32) 55static inline __wsum sctp_csum_combine(__wsum csum, __wsum csum2,
56 int offset, int len)
78{ 57{
79 return cpu_to_le32(~crc32); 58 return __crc32c_le_combine(csum, csum2, len);
80} 59}
81 60
82/* Calculate the CRC32C checksum of an SCTP packet. */
83static inline __le32 sctp_compute_cksum(const struct sk_buff *skb, 61static inline __le32 sctp_compute_cksum(const struct sk_buff *skb,
84 unsigned int offset) 62 unsigned int offset)
85{ 63{
86 const struct sk_buff *iter; 64 struct sctphdr *sh = sctp_hdr(skb);
65 __le32 ret, old = sh->checksum;
66 const struct skb_checksum_ops ops = {
67 .update = sctp_csum_update,
68 .combine = sctp_csum_combine,
69 };
87 70
88 __u32 crc32 = sctp_start_cksum(skb->data + offset, 71 sh->checksum = 0;
89 skb_headlen(skb) - offset); 72 ret = cpu_to_le32(~__skb_checksum(skb, offset, skb->len - offset,
90 skb_walk_frags(skb, iter) 73 ~(__u32)0, &ops));
91 crc32 = sctp_update_cksum((__u8 *) iter->data, 74 sh->checksum = old;
92 skb_headlen(iter), crc32);
93 75
94 return sctp_end_cksum(crc32); 76 return ret;
95} 77}
96 78
97#endif /* __sctp_checksum_h__ */ 79#endif /* __sctp_checksum_h__ */
diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h
index 3794c5ad20fe..c5fe80697f8d 100644
--- a/include/net/sctp/sctp.h
+++ b/include/net/sctp/sctp.h
@@ -90,12 +90,11 @@
90/* 90/*
91 * sctp/protocol.c 91 * sctp/protocol.c
92 */ 92 */
93extern int sctp_copy_local_addr_list(struct net *, struct sctp_bind_addr *, 93int sctp_copy_local_addr_list(struct net *, struct sctp_bind_addr *,
94 sctp_scope_t, gfp_t gfp, 94 sctp_scope_t, gfp_t gfp, int flags);
95 int flags); 95struct sctp_pf *sctp_get_pf_specific(sa_family_t family);
96extern struct sctp_pf *sctp_get_pf_specific(sa_family_t family); 96int sctp_register_pf(struct sctp_pf *, sa_family_t);
97extern int sctp_register_pf(struct sctp_pf *, sa_family_t); 97void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
98extern void sctp_addr_wq_mgmt(struct net *, struct sctp_sockaddr_entry *, int);
99 98
100/* 99/*
101 * sctp/socket.c 100 * sctp/socket.c
@@ -110,7 +109,7 @@ void sctp_sock_rfree(struct sk_buff *skb);
110void sctp_copy_sock(struct sock *newsk, struct sock *sk, 109void sctp_copy_sock(struct sock *newsk, struct sock *sk,
111 struct sctp_association *asoc); 110 struct sctp_association *asoc);
112extern struct percpu_counter sctp_sockets_allocated; 111extern struct percpu_counter sctp_sockets_allocated;
113extern int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *); 112int sctp_asconf_mgmt(struct sctp_sock *, struct sctp_sockaddr_entry *);
114 113
115/* 114/*
116 * sctp/primitive.c 115 * sctp/primitive.c
diff --git a/include/net/secure_seq.h b/include/net/secure_seq.h
index c2e542b27a5a..f257486f17be 100644
--- a/include/net/secure_seq.h
+++ b/include/net/secure_seq.h
@@ -3,18 +3,18 @@
3 3
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6extern __u32 secure_ip_id(__be32 daddr); 6__u32 secure_ip_id(__be32 daddr);
7extern __u32 secure_ipv6_id(const __be32 daddr[4]); 7__u32 secure_ipv6_id(const __be32 daddr[4]);
8extern u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport); 8u32 secure_ipv4_port_ephemeral(__be32 saddr, __be32 daddr, __be16 dport);
9extern u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr, 9u32 secure_ipv6_port_ephemeral(const __be32 *saddr, const __be32 *daddr,
10 __be16 dport); 10 __be16 dport);
11extern __u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr, 11__u32 secure_tcp_sequence_number(__be32 saddr, __be32 daddr,
12 __be16 sport, __be16 dport); 12 __be16 sport, __be16 dport);
13extern __u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr, 13__u32 secure_tcpv6_sequence_number(const __be32 *saddr, const __be32 *daddr,
14 __be16 sport, __be16 dport); 14 __be16 sport, __be16 dport);
15extern u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr, 15u64 secure_dccp_sequence_number(__be32 saddr, __be32 daddr,
16 __be16 sport, __be16 dport); 16 __be16 sport, __be16 dport);
17extern u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr, 17u64 secure_dccpv6_sequence_number(__be32 *saddr, __be32 *daddr,
18 __be16 sport, __be16 dport); 18 __be16 sport, __be16 dport);
19 19
20#endif /* _NET_SECURE_SEQ */ 20#endif /* _NET_SECURE_SEQ */
diff --git a/include/net/sock.h b/include/net/sock.h
index 808cbc2ec6c1..e3a18ff0c38b 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -156,7 +156,7 @@ typedef __u64 __bitwise __addrpair;
156 */ 156 */
157struct sock_common { 157struct sock_common {
158 /* skc_daddr and skc_rcv_saddr must be grouped on a 8 bytes aligned 158 /* skc_daddr and skc_rcv_saddr must be grouped on a 8 bytes aligned
159 * address on 64bit arches : cf INET_MATCH() and INET_TW_MATCH() 159 * address on 64bit arches : cf INET_MATCH()
160 */ 160 */
161 union { 161 union {
162 __addrpair skc_addrpair; 162 __addrpair skc_addrpair;
@@ -191,6 +191,12 @@ struct sock_common {
191#ifdef CONFIG_NET_NS 191#ifdef CONFIG_NET_NS
192 struct net *skc_net; 192 struct net *skc_net;
193#endif 193#endif
194
195#if IS_ENABLED(CONFIG_IPV6)
196 struct in6_addr skc_v6_daddr;
197 struct in6_addr skc_v6_rcv_saddr;
198#endif
199
194 /* 200 /*
195 * fields between dontcopy_begin/dontcopy_end 201 * fields between dontcopy_begin/dontcopy_end
196 * are not copied in sock_copy() 202 * are not copied in sock_copy()
@@ -218,7 +224,7 @@ struct cg_proto;
218 * @sk_lock: synchronizer 224 * @sk_lock: synchronizer
219 * @sk_rcvbuf: size of receive buffer in bytes 225 * @sk_rcvbuf: size of receive buffer in bytes
220 * @sk_wq: sock wait queue and async head 226 * @sk_wq: sock wait queue and async head
221 * @sk_rx_dst: receive input route used by early tcp demux 227 * @sk_rx_dst: receive input route used by early demux
222 * @sk_dst_cache: destination cache 228 * @sk_dst_cache: destination cache
223 * @sk_dst_lock: destination cache lock 229 * @sk_dst_lock: destination cache lock
224 * @sk_policy: flow policy 230 * @sk_policy: flow policy
@@ -233,6 +239,7 @@ struct cg_proto;
233 * @sk_ll_usec: usecs to busypoll when there is no data 239 * @sk_ll_usec: usecs to busypoll when there is no data
234 * @sk_allocation: allocation mode 240 * @sk_allocation: allocation mode
235 * @sk_pacing_rate: Pacing rate (if supported by transport/packet scheduler) 241 * @sk_pacing_rate: Pacing rate (if supported by transport/packet scheduler)
242 * @sk_max_pacing_rate: Maximum pacing rate (%SO_MAX_PACING_RATE)
236 * @sk_sndbuf: size of send buffer in bytes 243 * @sk_sndbuf: size of send buffer in bytes
237 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE, 244 * @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
238 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings 245 * %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
@@ -299,6 +306,12 @@ struct sock {
299#define sk_dontcopy_begin __sk_common.skc_dontcopy_begin 306#define sk_dontcopy_begin __sk_common.skc_dontcopy_begin
300#define sk_dontcopy_end __sk_common.skc_dontcopy_end 307#define sk_dontcopy_end __sk_common.skc_dontcopy_end
301#define sk_hash __sk_common.skc_hash 308#define sk_hash __sk_common.skc_hash
309#define sk_portpair __sk_common.skc_portpair
310#define sk_num __sk_common.skc_num
311#define sk_dport __sk_common.skc_dport
312#define sk_addrpair __sk_common.skc_addrpair
313#define sk_daddr __sk_common.skc_daddr
314#define sk_rcv_saddr __sk_common.skc_rcv_saddr
302#define sk_family __sk_common.skc_family 315#define sk_family __sk_common.skc_family
303#define sk_state __sk_common.skc_state 316#define sk_state __sk_common.skc_state
304#define sk_reuse __sk_common.skc_reuse 317#define sk_reuse __sk_common.skc_reuse
@@ -307,6 +320,9 @@ struct sock {
307#define sk_bind_node __sk_common.skc_bind_node 320#define sk_bind_node __sk_common.skc_bind_node
308#define sk_prot __sk_common.skc_prot 321#define sk_prot __sk_common.skc_prot
309#define sk_net __sk_common.skc_net 322#define sk_net __sk_common.skc_net
323#define sk_v6_daddr __sk_common.skc_v6_daddr
324#define sk_v6_rcv_saddr __sk_common.skc_v6_rcv_saddr
325
310 socket_lock_t sk_lock; 326 socket_lock_t sk_lock;
311 struct sk_buff_head sk_receive_queue; 327 struct sk_buff_head sk_receive_queue;
312 /* 328 /*
@@ -363,6 +379,7 @@ struct sock {
363 int sk_wmem_queued; 379 int sk_wmem_queued;
364 gfp_t sk_allocation; 380 gfp_t sk_allocation;
365 u32 sk_pacing_rate; /* bytes per second */ 381 u32 sk_pacing_rate; /* bytes per second */
382 u32 sk_max_pacing_rate;
366 netdev_features_t sk_route_caps; 383 netdev_features_t sk_route_caps;
367 netdev_features_t sk_route_nocaps; 384 netdev_features_t sk_route_nocaps;
368 int sk_gso_type; 385 int sk_gso_type;
@@ -751,7 +768,7 @@ static inline int sk_stream_wspace(const struct sock *sk)
751 return sk->sk_sndbuf - sk->sk_wmem_queued; 768 return sk->sk_sndbuf - sk->sk_wmem_queued;
752} 769}
753 770
754extern void sk_stream_write_space(struct sock *sk); 771void sk_stream_write_space(struct sock *sk);
755 772
756/* OOB backlog add */ 773/* OOB backlog add */
757static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb) 774static inline void __sk_add_backlog(struct sock *sk, struct sk_buff *skb)
@@ -793,7 +810,7 @@ static inline __must_check int sk_add_backlog(struct sock *sk, struct sk_buff *s
793 return 0; 810 return 0;
794} 811}
795 812
796extern int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb); 813int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb);
797 814
798static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) 815static inline int sk_backlog_rcv(struct sock *sk, struct sk_buff *skb)
799{ 816{
@@ -858,15 +875,15 @@ static inline void sock_rps_reset_rxhash(struct sock *sk)
858 __rc; \ 875 __rc; \
859 }) 876 })
860 877
861extern int sk_stream_wait_connect(struct sock *sk, long *timeo_p); 878int sk_stream_wait_connect(struct sock *sk, long *timeo_p);
862extern int sk_stream_wait_memory(struct sock *sk, long *timeo_p); 879int sk_stream_wait_memory(struct sock *sk, long *timeo_p);
863extern void sk_stream_wait_close(struct sock *sk, long timeo_p); 880void sk_stream_wait_close(struct sock *sk, long timeo_p);
864extern int sk_stream_error(struct sock *sk, int flags, int err); 881int sk_stream_error(struct sock *sk, int flags, int err);
865extern void sk_stream_kill_queues(struct sock *sk); 882void sk_stream_kill_queues(struct sock *sk);
866extern void sk_set_memalloc(struct sock *sk); 883void sk_set_memalloc(struct sock *sk);
867extern void sk_clear_memalloc(struct sock *sk); 884void sk_clear_memalloc(struct sock *sk);
868 885
869extern int sk_wait_data(struct sock *sk, long *timeo); 886int sk_wait_data(struct sock *sk, long *timeo);
870 887
871struct request_sock_ops; 888struct request_sock_ops;
872struct timewait_sock_ops; 889struct timewait_sock_ops;
@@ -1019,10 +1036,10 @@ enum cg_proto_flags {
1019 1036
1020struct cg_proto { 1037struct cg_proto {
1021 void (*enter_memory_pressure)(struct sock *sk); 1038 void (*enter_memory_pressure)(struct sock *sk);
1022 struct res_counter *memory_allocated; /* Current allocated memory. */ 1039 struct res_counter memory_allocated; /* Current allocated memory. */
1023 struct percpu_counter *sockets_allocated; /* Current number of sockets. */ 1040 struct percpu_counter sockets_allocated; /* Current number of sockets. */
1024 int *memory_pressure; 1041 int memory_pressure;
1025 long *sysctl_mem; 1042 long sysctl_mem[3];
1026 unsigned long flags; 1043 unsigned long flags;
1027 /* 1044 /*
1028 * memcg field is used to find which memcg we belong directly 1045 * memcg field is used to find which memcg we belong directly
@@ -1036,8 +1053,8 @@ struct cg_proto {
1036 struct mem_cgroup *memcg; 1053 struct mem_cgroup *memcg;
1037}; 1054};
1038 1055
1039extern int proto_register(struct proto *prot, int alloc_slab); 1056int proto_register(struct proto *prot, int alloc_slab);
1040extern void proto_unregister(struct proto *prot); 1057void proto_unregister(struct proto *prot);
1041 1058
1042static inline bool memcg_proto_active(struct cg_proto *cg_proto) 1059static inline bool memcg_proto_active(struct cg_proto *cg_proto)
1043{ 1060{
@@ -1118,7 +1135,7 @@ static inline bool sk_under_memory_pressure(const struct sock *sk)
1118 return false; 1135 return false;
1119 1136
1120 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) 1137 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1121 return !!*sk->sk_cgrp->memory_pressure; 1138 return !!sk->sk_cgrp->memory_pressure;
1122 1139
1123 return !!*sk->sk_prot->memory_pressure; 1140 return !!*sk->sk_prot->memory_pressure;
1124} 1141}
@@ -1138,8 +1155,8 @@ static inline void sk_leave_memory_pressure(struct sock *sk)
1138 struct proto *prot = sk->sk_prot; 1155 struct proto *prot = sk->sk_prot;
1139 1156
1140 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1157 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1141 if (*cg_proto->memory_pressure) 1158 if (cg_proto->memory_pressure)
1142 *cg_proto->memory_pressure = 0; 1159 cg_proto->memory_pressure = 0;
1143 } 1160 }
1144 1161
1145} 1162}
@@ -1175,7 +1192,7 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1175 struct res_counter *fail; 1192 struct res_counter *fail;
1176 int ret; 1193 int ret;
1177 1194
1178 ret = res_counter_charge_nofail(prot->memory_allocated, 1195 ret = res_counter_charge_nofail(&prot->memory_allocated,
1179 amt << PAGE_SHIFT, &fail); 1196 amt << PAGE_SHIFT, &fail);
1180 if (ret < 0) 1197 if (ret < 0)
1181 *parent_status = OVER_LIMIT; 1198 *parent_status = OVER_LIMIT;
@@ -1184,13 +1201,13 @@ static inline void memcg_memory_allocated_add(struct cg_proto *prot,
1184static inline void memcg_memory_allocated_sub(struct cg_proto *prot, 1201static inline void memcg_memory_allocated_sub(struct cg_proto *prot,
1185 unsigned long amt) 1202 unsigned long amt)
1186{ 1203{
1187 res_counter_uncharge(prot->memory_allocated, amt << PAGE_SHIFT); 1204 res_counter_uncharge(&prot->memory_allocated, amt << PAGE_SHIFT);
1188} 1205}
1189 1206
1190static inline u64 memcg_memory_allocated_read(struct cg_proto *prot) 1207static inline u64 memcg_memory_allocated_read(struct cg_proto *prot)
1191{ 1208{
1192 u64 ret; 1209 u64 ret;
1193 ret = res_counter_read_u64(prot->memory_allocated, RES_USAGE); 1210 ret = res_counter_read_u64(&prot->memory_allocated, RES_USAGE);
1194 return ret >> PAGE_SHIFT; 1211 return ret >> PAGE_SHIFT;
1195} 1212}
1196 1213
@@ -1238,7 +1255,7 @@ static inline void sk_sockets_allocated_dec(struct sock *sk)
1238 struct cg_proto *cg_proto = sk->sk_cgrp; 1255 struct cg_proto *cg_proto = sk->sk_cgrp;
1239 1256
1240 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1257 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1241 percpu_counter_dec(cg_proto->sockets_allocated); 1258 percpu_counter_dec(&cg_proto->sockets_allocated);
1242 } 1259 }
1243 1260
1244 percpu_counter_dec(prot->sockets_allocated); 1261 percpu_counter_dec(prot->sockets_allocated);
@@ -1252,7 +1269,7 @@ static inline void sk_sockets_allocated_inc(struct sock *sk)
1252 struct cg_proto *cg_proto = sk->sk_cgrp; 1269 struct cg_proto *cg_proto = sk->sk_cgrp;
1253 1270
1254 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto)) 1271 for (; cg_proto; cg_proto = parent_cg_proto(prot, cg_proto))
1255 percpu_counter_inc(cg_proto->sockets_allocated); 1272 percpu_counter_inc(&cg_proto->sockets_allocated);
1256 } 1273 }
1257 1274
1258 percpu_counter_inc(prot->sockets_allocated); 1275 percpu_counter_inc(prot->sockets_allocated);
@@ -1264,7 +1281,7 @@ sk_sockets_allocated_read_positive(struct sock *sk)
1264 struct proto *prot = sk->sk_prot; 1281 struct proto *prot = sk->sk_prot;
1265 1282
1266 if (mem_cgroup_sockets_enabled && sk->sk_cgrp) 1283 if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
1267 return percpu_counter_read_positive(sk->sk_cgrp->sockets_allocated); 1284 return percpu_counter_read_positive(&sk->sk_cgrp->sockets_allocated);
1268 1285
1269 return percpu_counter_read_positive(prot->sockets_allocated); 1286 return percpu_counter_read_positive(prot->sockets_allocated);
1270} 1287}
@@ -1292,8 +1309,8 @@ proto_memory_pressure(struct proto *prot)
1292 1309
1293#ifdef CONFIG_PROC_FS 1310#ifdef CONFIG_PROC_FS
1294/* Called with local bh disabled */ 1311/* Called with local bh disabled */
1295extern void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc); 1312void sock_prot_inuse_add(struct net *net, struct proto *prot, int inc);
1296extern int sock_prot_inuse_get(struct net *net, struct proto *proto); 1313int sock_prot_inuse_get(struct net *net, struct proto *proto);
1297#else 1314#else
1298static inline void sock_prot_inuse_add(struct net *net, struct proto *prot, 1315static inline void sock_prot_inuse_add(struct net *net, struct proto *prot,
1299 int inc) 1316 int inc)
@@ -1369,8 +1386,8 @@ static inline struct inode *SOCK_INODE(struct socket *socket)
1369/* 1386/*
1370 * Functions for memory accounting 1387 * Functions for memory accounting
1371 */ 1388 */
1372extern int __sk_mem_schedule(struct sock *sk, int size, int kind); 1389int __sk_mem_schedule(struct sock *sk, int size, int kind);
1373extern void __sk_mem_reclaim(struct sock *sk); 1390void __sk_mem_reclaim(struct sock *sk);
1374 1391
1375#define SK_MEM_QUANTUM ((int)PAGE_SIZE) 1392#define SK_MEM_QUANTUM ((int)PAGE_SIZE)
1376#define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM) 1393#define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM)
@@ -1478,14 +1495,14 @@ do { \
1478 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \ 1495 lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \
1479} while (0) 1496} while (0)
1480 1497
1481extern void lock_sock_nested(struct sock *sk, int subclass); 1498void lock_sock_nested(struct sock *sk, int subclass);
1482 1499
1483static inline void lock_sock(struct sock *sk) 1500static inline void lock_sock(struct sock *sk)
1484{ 1501{
1485 lock_sock_nested(sk, 0); 1502 lock_sock_nested(sk, 0);
1486} 1503}
1487 1504
1488extern void release_sock(struct sock *sk); 1505void release_sock(struct sock *sk);
1489 1506
1490/* BH context may only use the following locking interface. */ 1507/* BH context may only use the following locking interface. */
1491#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock)) 1508#define bh_lock_sock(__sk) spin_lock(&((__sk)->sk_lock.slock))
@@ -1494,7 +1511,7 @@ extern void release_sock(struct sock *sk);
1494 SINGLE_DEPTH_NESTING) 1511 SINGLE_DEPTH_NESTING)
1495#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock)) 1512#define bh_unlock_sock(__sk) spin_unlock(&((__sk)->sk_lock.slock))
1496 1513
1497extern bool lock_sock_fast(struct sock *sk); 1514bool lock_sock_fast(struct sock *sk);
1498/** 1515/**
1499 * unlock_sock_fast - complement of lock_sock_fast 1516 * unlock_sock_fast - complement of lock_sock_fast
1500 * @sk: socket 1517 * @sk: socket
@@ -1512,108 +1529,84 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow)
1512} 1529}
1513 1530
1514 1531
1515extern struct sock *sk_alloc(struct net *net, int family, 1532struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
1516 gfp_t priority, 1533 struct proto *prot);
1517 struct proto *prot); 1534void sk_free(struct sock *sk);
1518extern void sk_free(struct sock *sk); 1535void sk_release_kernel(struct sock *sk);
1519extern void sk_release_kernel(struct sock *sk); 1536struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority);
1520extern struct sock *sk_clone_lock(const struct sock *sk, 1537
1521 const gfp_t priority); 1538struct sk_buff *sock_wmalloc(struct sock *sk, unsigned long size, int force,
1522 1539 gfp_t priority);
1523extern struct sk_buff *sock_wmalloc(struct sock *sk, 1540struct sk_buff *sock_rmalloc(struct sock *sk, unsigned long size, int force,
1524 unsigned long size, int force, 1541 gfp_t priority);
1525 gfp_t priority); 1542void sock_wfree(struct sk_buff *skb);
1526extern struct sk_buff *sock_rmalloc(struct sock *sk, 1543void skb_orphan_partial(struct sk_buff *skb);
1527 unsigned long size, int force, 1544void sock_rfree(struct sk_buff *skb);
1528 gfp_t priority); 1545void sock_edemux(struct sk_buff *skb);
1529extern void sock_wfree(struct sk_buff *skb); 1546
1530extern void skb_orphan_partial(struct sk_buff *skb); 1547int sock_setsockopt(struct socket *sock, int level, int op,
1531extern void sock_rfree(struct sk_buff *skb); 1548 char __user *optval, unsigned int optlen);
1532extern void sock_edemux(struct sk_buff *skb); 1549
1533 1550int sock_getsockopt(struct socket *sock, int level, int op,
1534extern int sock_setsockopt(struct socket *sock, int level, 1551 char __user *optval, int __user *optlen);
1535 int op, char __user *optval, 1552struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
1536 unsigned int optlen); 1553 int noblock, int *errcode);
1537 1554struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
1538extern int sock_getsockopt(struct socket *sock, int level, 1555 unsigned long data_len, int noblock,
1539 int op, char __user *optval, 1556 int *errcode, int max_page_order);
1540 int __user *optlen); 1557void *sock_kmalloc(struct sock *sk, int size, gfp_t priority);
1541extern struct sk_buff *sock_alloc_send_skb(struct sock *sk, 1558void sock_kfree_s(struct sock *sk, void *mem, int size);
1542 unsigned long size, 1559void sk_send_sigurg(struct sock *sk);
1543 int noblock,
1544 int *errcode);
1545extern struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
1546 unsigned long header_len,
1547 unsigned long data_len,
1548 int noblock,
1549 int *errcode,
1550 int max_page_order);
1551extern void *sock_kmalloc(struct sock *sk, int size,
1552 gfp_t priority);
1553extern void sock_kfree_s(struct sock *sk, void *mem, int size);
1554extern void sk_send_sigurg(struct sock *sk);
1555 1560
1556/* 1561/*
1557 * Functions to fill in entries in struct proto_ops when a protocol 1562 * Functions to fill in entries in struct proto_ops when a protocol
1558 * does not implement a particular function. 1563 * does not implement a particular function.
1559 */ 1564 */
1560extern int sock_no_bind(struct socket *, 1565int sock_no_bind(struct socket *, struct sockaddr *, int);
1561 struct sockaddr *, int); 1566int sock_no_connect(struct socket *, struct sockaddr *, int, int);
1562extern int sock_no_connect(struct socket *, 1567int sock_no_socketpair(struct socket *, struct socket *);
1563 struct sockaddr *, int, int); 1568int sock_no_accept(struct socket *, struct socket *, int);
1564extern int sock_no_socketpair(struct socket *, 1569int sock_no_getname(struct socket *, struct sockaddr *, int *, int);
1565 struct socket *); 1570unsigned int sock_no_poll(struct file *, struct socket *,
1566extern int sock_no_accept(struct socket *, 1571 struct poll_table_struct *);
1567 struct socket *, int); 1572int sock_no_ioctl(struct socket *, unsigned int, unsigned long);
1568extern int sock_no_getname(struct socket *, 1573int sock_no_listen(struct socket *, int);
1569 struct sockaddr *, int *, int); 1574int sock_no_shutdown(struct socket *, int);
1570extern unsigned int sock_no_poll(struct file *, struct socket *, 1575int sock_no_getsockopt(struct socket *, int , int, char __user *, int __user *);
1571 struct poll_table_struct *); 1576int sock_no_setsockopt(struct socket *, int, int, char __user *, unsigned int);
1572extern int sock_no_ioctl(struct socket *, unsigned int, 1577int sock_no_sendmsg(struct kiocb *, struct socket *, struct msghdr *, size_t);
1573 unsigned long); 1578int sock_no_recvmsg(struct kiocb *, struct socket *, struct msghdr *, size_t,
1574extern int sock_no_listen(struct socket *, int); 1579 int);
1575extern int sock_no_shutdown(struct socket *, int); 1580int sock_no_mmap(struct file *file, struct socket *sock,
1576extern int sock_no_getsockopt(struct socket *, int , int, 1581 struct vm_area_struct *vma);
1577 char __user *, int __user *); 1582ssize_t sock_no_sendpage(struct socket *sock, struct page *page, int offset,
1578extern int sock_no_setsockopt(struct socket *, int, int, 1583 size_t size, int flags);
1579 char __user *, unsigned int);
1580extern int sock_no_sendmsg(struct kiocb *, struct socket *,
1581 struct msghdr *, size_t);
1582extern int sock_no_recvmsg(struct kiocb *, struct socket *,
1583 struct msghdr *, size_t, int);
1584extern int sock_no_mmap(struct file *file,
1585 struct socket *sock,
1586 struct vm_area_struct *vma);
1587extern ssize_t sock_no_sendpage(struct socket *sock,
1588 struct page *page,
1589 int offset, size_t size,
1590 int flags);
1591 1584
1592/* 1585/*
1593 * Functions to fill in entries in struct proto_ops when a protocol 1586 * Functions to fill in entries in struct proto_ops when a protocol
1594 * uses the inet style. 1587 * uses the inet style.
1595 */ 1588 */
1596extern int sock_common_getsockopt(struct socket *sock, int level, int optname, 1589int sock_common_getsockopt(struct socket *sock, int level, int optname,
1597 char __user *optval, int __user *optlen); 1590 char __user *optval, int __user *optlen);
1598extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, 1591int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock,
1599 struct msghdr *msg, size_t size, int flags); 1592 struct msghdr *msg, size_t size, int flags);
1600extern int sock_common_setsockopt(struct socket *sock, int level, int optname, 1593int sock_common_setsockopt(struct socket *sock, int level, int optname,
1601 char __user *optval, unsigned int optlen); 1594 char __user *optval, unsigned int optlen);
1602extern int compat_sock_common_getsockopt(struct socket *sock, int level, 1595int compat_sock_common_getsockopt(struct socket *sock, int level,
1603 int optname, char __user *optval, int __user *optlen); 1596 int optname, char __user *optval, int __user *optlen);
1604extern int compat_sock_common_setsockopt(struct socket *sock, int level, 1597int compat_sock_common_setsockopt(struct socket *sock, int level,
1605 int optname, char __user *optval, unsigned int optlen); 1598 int optname, char __user *optval, unsigned int optlen);
1606 1599
1607extern void sk_common_release(struct sock *sk); 1600void sk_common_release(struct sock *sk);
1608 1601
1609/* 1602/*
1610 * Default socket callbacks and setup code 1603 * Default socket callbacks and setup code
1611 */ 1604 */
1612 1605
1613/* Initialise core socket variables */ 1606/* Initialise core socket variables */
1614extern void sock_init_data(struct socket *sock, struct sock *sk); 1607void sock_init_data(struct socket *sock, struct sock *sk);
1615 1608
1616extern void sk_filter_release_rcu(struct rcu_head *rcu); 1609void sk_filter_release_rcu(struct rcu_head *rcu);
1617 1610
1618/** 1611/**
1619 * sk_filter_release - release a socket filter 1612 * sk_filter_release - release a socket filter
@@ -1671,9 +1664,12 @@ static inline void sock_put(struct sock *sk)
1671 if (atomic_dec_and_test(&sk->sk_refcnt)) 1664 if (atomic_dec_and_test(&sk->sk_refcnt))
1672 sk_free(sk); 1665 sk_free(sk);
1673} 1666}
1667/* Generic version of sock_put(), dealing with all sockets
1668 * (TCP_TIMEWAIT, ESTABLISHED...)
1669 */
1670void sock_gen_put(struct sock *sk);
1674 1671
1675extern int sk_receive_skb(struct sock *sk, struct sk_buff *skb, 1672int sk_receive_skb(struct sock *sk, struct sk_buff *skb, const int nested);
1676 const int nested);
1677 1673
1678static inline void sk_tx_queue_set(struct sock *sk, int tx_queue) 1674static inline void sk_tx_queue_set(struct sock *sk, int tx_queue)
1679{ 1675{
@@ -1727,8 +1723,8 @@ static inline void sock_graft(struct sock *sk, struct socket *parent)
1727 write_unlock_bh(&sk->sk_callback_lock); 1723 write_unlock_bh(&sk->sk_callback_lock);
1728} 1724}
1729 1725
1730extern kuid_t sock_i_uid(struct sock *sk); 1726kuid_t sock_i_uid(struct sock *sk);
1731extern unsigned long sock_i_ino(struct sock *sk); 1727unsigned long sock_i_ino(struct sock *sk);
1732 1728
1733static inline struct dst_entry * 1729static inline struct dst_entry *
1734__sk_dst_get(struct sock *sk) 1730__sk_dst_get(struct sock *sk)
@@ -1750,8 +1746,6 @@ sk_dst_get(struct sock *sk)
1750 return dst; 1746 return dst;
1751} 1747}
1752 1748
1753extern void sk_reset_txq(struct sock *sk);
1754
1755static inline void dst_negative_advice(struct sock *sk) 1749static inline void dst_negative_advice(struct sock *sk)
1756{ 1750{
1757 struct dst_entry *ndst, *dst = __sk_dst_get(sk); 1751 struct dst_entry *ndst, *dst = __sk_dst_get(sk);
@@ -1761,7 +1755,7 @@ static inline void dst_negative_advice(struct sock *sk)
1761 1755
1762 if (ndst != dst) { 1756 if (ndst != dst) {
1763 rcu_assign_pointer(sk->sk_dst_cache, ndst); 1757 rcu_assign_pointer(sk->sk_dst_cache, ndst);
1764 sk_reset_txq(sk); 1758 sk_tx_queue_clear(sk);
1765 } 1759 }
1766 } 1760 }
1767} 1761}
@@ -1803,16 +1797,16 @@ sk_dst_reset(struct sock *sk)
1803 spin_unlock(&sk->sk_dst_lock); 1797 spin_unlock(&sk->sk_dst_lock);
1804} 1798}
1805 1799
1806extern struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie); 1800struct dst_entry *__sk_dst_check(struct sock *sk, u32 cookie);
1807 1801
1808extern struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie); 1802struct dst_entry *sk_dst_check(struct sock *sk, u32 cookie);
1809 1803
1810static inline bool sk_can_gso(const struct sock *sk) 1804static inline bool sk_can_gso(const struct sock *sk)
1811{ 1805{
1812 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type); 1806 return net_gso_ok(sk->sk_route_caps, sk->sk_gso_type);
1813} 1807}
1814 1808
1815extern void sk_setup_caps(struct sock *sk, struct dst_entry *dst); 1809void sk_setup_caps(struct sock *sk, struct dst_entry *dst);
1816 1810
1817static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags) 1811static inline void sk_nocaps_add(struct sock *sk, netdev_features_t flags)
1818{ 1812{
@@ -2025,14 +2019,14 @@ static inline void skb_set_owner_r(struct sk_buff *skb, struct sock *sk)
2025 sk_mem_charge(sk, skb->truesize); 2019 sk_mem_charge(sk, skb->truesize);
2026} 2020}
2027 2021
2028extern void sk_reset_timer(struct sock *sk, struct timer_list *timer, 2022void sk_reset_timer(struct sock *sk, struct timer_list *timer,
2029 unsigned long expires); 2023 unsigned long expires);
2030 2024
2031extern void sk_stop_timer(struct sock *sk, struct timer_list *timer); 2025void sk_stop_timer(struct sock *sk, struct timer_list *timer);
2032 2026
2033extern int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb); 2027int sock_queue_rcv_skb(struct sock *sk, struct sk_buff *skb);
2034 2028
2035extern int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb); 2029int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb);
2036 2030
2037/* 2031/*
2038 * Recover an error report and clear atomically 2032 * Recover an error report and clear atomically
@@ -2100,7 +2094,7 @@ static inline struct page_frag *sk_page_frag(struct sock *sk)
2100 return &sk->sk_frag; 2094 return &sk->sk_frag;
2101} 2095}
2102 2096
2103extern bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag); 2097bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag);
2104 2098
2105/* 2099/*
2106 * Default write policy as shown to user space via poll/select/SIGIO 2100 * Default write policy as shown to user space via poll/select/SIGIO
@@ -2138,10 +2132,10 @@ static inline int sock_intr_errno(long timeo)
2138 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR; 2132 return timeo == MAX_SCHEDULE_TIMEOUT ? -ERESTARTSYS : -EINTR;
2139} 2133}
2140 2134
2141extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk, 2135void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
2142 struct sk_buff *skb); 2136 struct sk_buff *skb);
2143extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk, 2137void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
2144 struct sk_buff *skb); 2138 struct sk_buff *skb);
2145 2139
2146static inline void 2140static inline void
2147sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb) 2141sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
@@ -2174,8 +2168,8 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
2174 __sock_recv_wifi_status(msg, sk, skb); 2168 __sock_recv_wifi_status(msg, sk, skb);
2175} 2169}
2176 2170
2177extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, 2171void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2178 struct sk_buff *skb); 2172 struct sk_buff *skb);
2179 2173
2180static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk, 2174static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2181 struct sk_buff *skb) 2175 struct sk_buff *skb)
@@ -2200,7 +2194,7 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
2200 * 2194 *
2201 * Currently only depends on SOCK_TIMESTAMPING* flags. 2195 * Currently only depends on SOCK_TIMESTAMPING* flags.
2202 */ 2196 */
2203extern void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags); 2197void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);
2204 2198
2205/** 2199/**
2206 * sk_eat_skb - Release a skb if it is no longer needed 2200 * sk_eat_skb - Release a skb if it is no longer needed
@@ -2264,11 +2258,11 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb)
2264 return NULL; 2258 return NULL;
2265} 2259}
2266 2260
2267extern void sock_enable_timestamp(struct sock *sk, int flag); 2261void sock_enable_timestamp(struct sock *sk, int flag);
2268extern int sock_get_timestamp(struct sock *, struct timeval __user *); 2262int sock_get_timestamp(struct sock *, struct timeval __user *);
2269extern int sock_get_timestampns(struct sock *, struct timespec __user *); 2263int sock_get_timestampns(struct sock *, struct timespec __user *);
2270extern int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, 2264int sock_recv_errqueue(struct sock *sk, struct msghdr *msg, int len, int level,
2271 int level, int type); 2265 int type);
2272 2266
2273/* 2267/*
2274 * Enable debug/info messages 2268 * Enable debug/info messages
diff --git a/include/net/stp.h b/include/net/stp.h
index ad447f105417..3af174d70d9e 100644
--- a/include/net/stp.h
+++ b/include/net/stp.h
@@ -8,7 +8,7 @@ struct stp_proto {
8 void *data; 8 void *data;
9}; 9};
10 10
11extern int stp_proto_register(const struct stp_proto *proto); 11int stp_proto_register(const struct stp_proto *proto);
12extern void stp_proto_unregister(const struct stp_proto *proto); 12void stp_proto_unregister(const struct stp_proto *proto);
13 13
14#endif /* _NET_STP_H */ 14#endif /* _NET_STP_H */
diff --git a/include/net/tcp.h b/include/net/tcp.h
index b1aa324c5e65..70e55d200610 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -50,7 +50,7 @@
50extern struct inet_hashinfo tcp_hashinfo; 50extern struct inet_hashinfo tcp_hashinfo;
51 51
52extern struct percpu_counter tcp_orphan_count; 52extern struct percpu_counter tcp_orphan_count;
53extern void tcp_time_wait(struct sock *sk, int state, int timeo); 53void tcp_time_wait(struct sock *sk, int state, int timeo);
54 54
55#define MAX_TCP_HEADER (128 + MAX_HEADER) 55#define MAX_TCP_HEADER (128 + MAX_HEADER)
56#define MAX_TCP_OPTION_SPACE 40 56#define MAX_TCP_OPTION_SPACE 40
@@ -259,6 +259,7 @@ extern int sysctl_tcp_max_orphans;
259extern int sysctl_tcp_fack; 259extern int sysctl_tcp_fack;
260extern int sysctl_tcp_reordering; 260extern int sysctl_tcp_reordering;
261extern int sysctl_tcp_dsack; 261extern int sysctl_tcp_dsack;
262extern long sysctl_tcp_mem[3];
262extern int sysctl_tcp_wmem[3]; 263extern int sysctl_tcp_wmem[3];
263extern int sysctl_tcp_rmem[3]; 264extern int sysctl_tcp_rmem[3];
264extern int sysctl_tcp_app_win; 265extern int sysctl_tcp_app_win;
@@ -274,7 +275,6 @@ extern int sysctl_tcp_mtu_probing;
274extern int sysctl_tcp_base_mss; 275extern int sysctl_tcp_base_mss;
275extern int sysctl_tcp_workaround_signed_windows; 276extern int sysctl_tcp_workaround_signed_windows;
276extern int sysctl_tcp_slow_start_after_idle; 277extern int sysctl_tcp_slow_start_after_idle;
277extern int sysctl_tcp_max_ssthresh;
278extern int sysctl_tcp_thin_linear_timeouts; 278extern int sysctl_tcp_thin_linear_timeouts;
279extern int sysctl_tcp_thin_dupack; 279extern int sysctl_tcp_thin_dupack;
280extern int sysctl_tcp_early_retrans; 280extern int sysctl_tcp_early_retrans;
@@ -325,7 +325,7 @@ static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
325 return false; 325 return false;
326} 326}
327 327
328extern bool tcp_check_oom(struct sock *sk, int shift); 328bool tcp_check_oom(struct sock *sk, int shift);
329 329
330/* syncookies: remember time of last synqueue overflow */ 330/* syncookies: remember time of last synqueue overflow */
331static inline void tcp_synq_overflow(struct sock *sk) 331static inline void tcp_synq_overflow(struct sock *sk)
@@ -348,38 +348,36 @@ extern struct proto tcp_prot;
348#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 348#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
349#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) 349#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
350 350
351extern void tcp_init_mem(struct net *net); 351void tcp_tasklet_init(void);
352 352
353extern void tcp_tasklet_init(void); 353void tcp_v4_err(struct sk_buff *skb, u32);
354 354
355extern void tcp_v4_err(struct sk_buff *skb, u32); 355void tcp_shutdown(struct sock *sk, int how);
356 356
357extern void tcp_shutdown (struct sock *sk, int how); 357void tcp_v4_early_demux(struct sk_buff *skb);
358 358int tcp_v4_rcv(struct sk_buff *skb);
359extern void tcp_v4_early_demux(struct sk_buff *skb); 359
360extern int tcp_v4_rcv(struct sk_buff *skb); 360int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
361 361int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
362extern int tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw); 362 size_t size);
363extern int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 363int tcp_sendpage(struct sock *sk, struct page *page, int offset, size_t size,
364 size_t size); 364 int flags);
365extern int tcp_sendpage(struct sock *sk, struct page *page, int offset, 365void tcp_release_cb(struct sock *sk);
366 size_t size, int flags); 366void tcp_wfree(struct sk_buff *skb);
367extern void tcp_release_cb(struct sock *sk); 367void tcp_write_timer_handler(struct sock *sk);
368extern void tcp_wfree(struct sk_buff *skb); 368void tcp_delack_timer_handler(struct sock *sk);
369extern void tcp_write_timer_handler(struct sock *sk); 369int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg);
370extern void tcp_delack_timer_handler(struct sock *sk); 370int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
371extern int tcp_ioctl(struct sock *sk, int cmd, unsigned long arg); 371 const struct tcphdr *th, unsigned int len);
372extern int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, 372void tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
373 const struct tcphdr *th, unsigned int len); 373 const struct tcphdr *th, unsigned int len);
374extern void tcp_rcv_established(struct sock *sk, struct sk_buff *skb, 374void tcp_rcv_space_adjust(struct sock *sk);
375 const struct tcphdr *th, unsigned int len); 375void tcp_cleanup_rbuf(struct sock *sk, int copied);
376extern void tcp_rcv_space_adjust(struct sock *sk); 376int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp);
377extern void tcp_cleanup_rbuf(struct sock *sk, int copied); 377void tcp_twsk_destructor(struct sock *sk);
378extern int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp); 378ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos,
379extern void tcp_twsk_destructor(struct sock *sk); 379 struct pipe_inode_info *pipe, size_t len,
380extern ssize_t tcp_splice_read(struct socket *sk, loff_t *ppos, 380 unsigned int flags);
381 struct pipe_inode_info *pipe, size_t len,
382 unsigned int flags);
383 381
384static inline void tcp_dec_quickack_mode(struct sock *sk, 382static inline void tcp_dec_quickack_mode(struct sock *sk,
385 const unsigned int pkts) 383 const unsigned int pkts)
@@ -409,66 +407,65 @@ enum tcp_tw_status {
409}; 407};
410 408
411 409
412extern enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw, 410enum tcp_tw_status tcp_timewait_state_process(struct inet_timewait_sock *tw,
413 struct sk_buff *skb, 411 struct sk_buff *skb,
414 const struct tcphdr *th); 412 const struct tcphdr *th);
415extern struct sock * tcp_check_req(struct sock *sk,struct sk_buff *skb, 413struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
416 struct request_sock *req, 414 struct request_sock *req, struct request_sock **prev,
417 struct request_sock **prev, 415 bool fastopen);
418 bool fastopen); 416int tcp_child_process(struct sock *parent, struct sock *child,
419extern int tcp_child_process(struct sock *parent, struct sock *child, 417 struct sk_buff *skb);
420 struct sk_buff *skb); 418void tcp_enter_loss(struct sock *sk, int how);
421extern void tcp_enter_loss(struct sock *sk, int how); 419void tcp_clear_retrans(struct tcp_sock *tp);
422extern void tcp_clear_retrans(struct tcp_sock *tp); 420void tcp_update_metrics(struct sock *sk);
423extern void tcp_update_metrics(struct sock *sk); 421void tcp_init_metrics(struct sock *sk);
424extern void tcp_init_metrics(struct sock *sk); 422void tcp_metrics_init(void);
425extern void tcp_metrics_init(void); 423bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst,
426extern bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst, bool paws_check); 424 bool paws_check);
427extern bool tcp_remember_stamp(struct sock *sk); 425bool tcp_remember_stamp(struct sock *sk);
428extern bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw); 426bool tcp_tw_remember_stamp(struct inet_timewait_sock *tw);
429extern void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst); 427void tcp_fetch_timewait_stamp(struct sock *sk, struct dst_entry *dst);
430extern void tcp_disable_fack(struct tcp_sock *tp); 428void tcp_disable_fack(struct tcp_sock *tp);
431extern void tcp_close(struct sock *sk, long timeout); 429void tcp_close(struct sock *sk, long timeout);
432extern void tcp_init_sock(struct sock *sk); 430void tcp_init_sock(struct sock *sk);
433extern unsigned int tcp_poll(struct file * file, struct socket *sock, 431unsigned int tcp_poll(struct file *file, struct socket *sock,
434 struct poll_table_struct *wait); 432 struct poll_table_struct *wait);
435extern int tcp_getsockopt(struct sock *sk, int level, int optname, 433int tcp_getsockopt(struct sock *sk, int level, int optname,
434 char __user *optval, int __user *optlen);
435int tcp_setsockopt(struct sock *sk, int level, int optname,
436 char __user *optval, unsigned int optlen);
437int compat_tcp_getsockopt(struct sock *sk, int level, int optname,
436 char __user *optval, int __user *optlen); 438 char __user *optval, int __user *optlen);
437extern int tcp_setsockopt(struct sock *sk, int level, int optname, 439int compat_tcp_setsockopt(struct sock *sk, int level, int optname,
438 char __user *optval, unsigned int optlen); 440 char __user *optval, unsigned int optlen);
439extern int compat_tcp_getsockopt(struct sock *sk, int level, int optname, 441void tcp_set_keepalive(struct sock *sk, int val);
440 char __user *optval, int __user *optlen); 442void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req);
441extern int compat_tcp_setsockopt(struct sock *sk, int level, int optname, 443int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
442 char __user *optval, unsigned int optlen); 444 size_t len, int nonblock, int flags, int *addr_len);
443extern void tcp_set_keepalive(struct sock *sk, int val); 445void tcp_parse_options(const struct sk_buff *skb,
444extern void tcp_syn_ack_timeout(struct sock *sk, struct request_sock *req); 446 struct tcp_options_received *opt_rx,
445extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 447 int estab, struct tcp_fastopen_cookie *foc);
446 size_t len, int nonblock, int flags, int *addr_len); 448const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
447extern void tcp_parse_options(const struct sk_buff *skb,
448 struct tcp_options_received *opt_rx,
449 int estab, struct tcp_fastopen_cookie *foc);
450extern const u8 *tcp_parse_md5sig_option(const struct tcphdr *th);
451 449
452/* 450/*
453 * TCP v4 functions exported for the inet6 API 451 * TCP v4 functions exported for the inet6 API
454 */ 452 */
455 453
456extern void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb); 454void tcp_v4_send_check(struct sock *sk, struct sk_buff *skb);
457extern int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb); 455int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
458extern struct sock * tcp_create_openreq_child(struct sock *sk, 456struct sock *tcp_create_openreq_child(struct sock *sk,
459 struct request_sock *req, 457 struct request_sock *req,
460 struct sk_buff *skb); 458 struct sk_buff *skb);
461extern struct sock * tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb, 459struct sock *tcp_v4_syn_recv_sock(struct sock *sk, struct sk_buff *skb,
462 struct request_sock *req, 460 struct request_sock *req,
463 struct dst_entry *dst); 461 struct dst_entry *dst);
464extern int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb); 462int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb);
465extern int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, 463int tcp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
466 int addr_len); 464int tcp_connect(struct sock *sk);
467extern int tcp_connect(struct sock *sk); 465struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
468extern struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst, 466 struct request_sock *req,
469 struct request_sock *req, 467 struct tcp_fastopen_cookie *foc);
470 struct tcp_fastopen_cookie *foc); 468int tcp_disconnect(struct sock *sk, int flags);
471extern int tcp_disconnect(struct sock *sk, int flags);
472 469
473void tcp_connect_init(struct sock *sk); 470void tcp_connect_init(struct sock *sk);
474void tcp_finish_connect(struct sock *sk, struct sk_buff *skb); 471void tcp_finish_connect(struct sock *sk, struct sk_buff *skb);
@@ -476,16 +473,32 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size);
476void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb); 473void inet_sk_rx_dst_set(struct sock *sk, const struct sk_buff *skb);
477 474
478/* From syncookies.c */ 475/* From syncookies.c */
479extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS]; 476int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th,
480extern int __cookie_v4_check(const struct iphdr *iph, const struct tcphdr *th, 477 u32 cookie);
481 u32 cookie); 478struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
482extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb, 479 struct ip_options *opt);
483 struct ip_options *opt);
484#ifdef CONFIG_SYN_COOKIES 480#ifdef CONFIG_SYN_COOKIES
485extern u32 __cookie_v4_init_sequence(const struct iphdr *iph, 481#include <linux/ktime.h>
486 const struct tcphdr *th, u16 *mssp); 482
487extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, 483/* Syncookies use a monotonic timer which increments every 64 seconds.
488 __u16 *mss); 484 * This counter is used both as a hash input and partially encoded into
485 * the cookie value. A cookie is only validated further if the delta
486 * between the current counter value and the encoded one is less than this,
487 * i.e. a sent cookie is valid only at most for 128 seconds (or less if
488 * the counter advances immediately after a cookie is generated).
489 */
490#define MAX_SYNCOOKIE_AGE 2
491
492static inline u32 tcp_cookie_time(void)
493{
494 struct timespec now;
495 getnstimeofday(&now);
496 return now.tv_sec >> 6; /* 64 seconds granularity */
497}
498
499u32 __cookie_v4_init_sequence(const struct iphdr *iph, const struct tcphdr *th,
500 u16 *mssp);
501__u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb, __u16 *mss);
489#else 502#else
490static inline __u32 cookie_v4_init_sequence(struct sock *sk, 503static inline __u32 cookie_v4_init_sequence(struct sock *sk,
491 struct sk_buff *skb, 504 struct sk_buff *skb,
@@ -495,19 +508,19 @@ static inline __u32 cookie_v4_init_sequence(struct sock *sk,
495} 508}
496#endif 509#endif
497 510
498extern __u32 cookie_init_timestamp(struct request_sock *req); 511__u32 cookie_init_timestamp(struct request_sock *req);
499extern bool cookie_check_timestamp(struct tcp_options_received *opt, 512bool cookie_check_timestamp(struct tcp_options_received *opt, struct net *net,
500 struct net *net, bool *ecn_ok); 513 bool *ecn_ok);
501 514
502/* From net/ipv6/syncookies.c */ 515/* From net/ipv6/syncookies.c */
503extern int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th, 516int __cookie_v6_check(const struct ipv6hdr *iph, const struct tcphdr *th,
504 u32 cookie); 517 u32 cookie);
505extern struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb); 518struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb);
506#ifdef CONFIG_SYN_COOKIES 519#ifdef CONFIG_SYN_COOKIES
507extern u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, 520u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph,
508 const struct tcphdr *th, u16 *mssp); 521 const struct tcphdr *th, u16 *mssp);
509extern __u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb, 522__u32 cookie_v6_init_sequence(struct sock *sk, const struct sk_buff *skb,
510 __u16 *mss); 523 __u16 *mss);
511#else 524#else
512static inline __u32 cookie_v6_init_sequence(struct sock *sk, 525static inline __u32 cookie_v6_init_sequence(struct sock *sk,
513 struct sk_buff *skb, 526 struct sk_buff *skb,
@@ -518,47 +531,46 @@ static inline __u32 cookie_v6_init_sequence(struct sock *sk,
518#endif 531#endif
519/* tcp_output.c */ 532/* tcp_output.c */
520 533
521extern void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss, 534void __tcp_push_pending_frames(struct sock *sk, unsigned int cur_mss,
522 int nonagle); 535 int nonagle);
523extern bool tcp_may_send_now(struct sock *sk); 536bool tcp_may_send_now(struct sock *sk);
524extern int __tcp_retransmit_skb(struct sock *, struct sk_buff *); 537int __tcp_retransmit_skb(struct sock *, struct sk_buff *);
525extern int tcp_retransmit_skb(struct sock *, struct sk_buff *); 538int tcp_retransmit_skb(struct sock *, struct sk_buff *);
526extern void tcp_retransmit_timer(struct sock *sk); 539void tcp_retransmit_timer(struct sock *sk);
527extern void tcp_xmit_retransmit_queue(struct sock *); 540void tcp_xmit_retransmit_queue(struct sock *);
528extern void tcp_simple_retransmit(struct sock *); 541void tcp_simple_retransmit(struct sock *);
529extern int tcp_trim_head(struct sock *, struct sk_buff *, u32); 542int tcp_trim_head(struct sock *, struct sk_buff *, u32);
530extern int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int); 543int tcp_fragment(struct sock *, struct sk_buff *, u32, unsigned int);
531 544
532extern void tcp_send_probe0(struct sock *); 545void tcp_send_probe0(struct sock *);
533extern void tcp_send_partial(struct sock *); 546void tcp_send_partial(struct sock *);
534extern int tcp_write_wakeup(struct sock *); 547int tcp_write_wakeup(struct sock *);
535extern void tcp_send_fin(struct sock *sk); 548void tcp_send_fin(struct sock *sk);
536extern void tcp_send_active_reset(struct sock *sk, gfp_t priority); 549void tcp_send_active_reset(struct sock *sk, gfp_t priority);
537extern int tcp_send_synack(struct sock *); 550int tcp_send_synack(struct sock *);
538extern bool tcp_syn_flood_action(struct sock *sk, 551bool tcp_syn_flood_action(struct sock *sk, const struct sk_buff *skb,
539 const struct sk_buff *skb, 552 const char *proto);
540 const char *proto); 553void tcp_push_one(struct sock *, unsigned int mss_now);
541extern void tcp_push_one(struct sock *, unsigned int mss_now); 554void tcp_send_ack(struct sock *sk);
542extern void tcp_send_ack(struct sock *sk); 555void tcp_send_delayed_ack(struct sock *sk);
543extern void tcp_send_delayed_ack(struct sock *sk); 556void tcp_send_loss_probe(struct sock *sk);
544extern void tcp_send_loss_probe(struct sock *sk); 557bool tcp_schedule_loss_probe(struct sock *sk);
545extern bool tcp_schedule_loss_probe(struct sock *sk);
546 558
547/* tcp_input.c */ 559/* tcp_input.c */
548extern void tcp_cwnd_application_limited(struct sock *sk); 560void tcp_cwnd_application_limited(struct sock *sk);
549extern void tcp_resume_early_retransmit(struct sock *sk); 561void tcp_resume_early_retransmit(struct sock *sk);
550extern void tcp_rearm_rto(struct sock *sk); 562void tcp_rearm_rto(struct sock *sk);
551extern void tcp_reset(struct sock *sk); 563void tcp_reset(struct sock *sk);
552 564
553/* tcp_timer.c */ 565/* tcp_timer.c */
554extern void tcp_init_xmit_timers(struct sock *); 566void tcp_init_xmit_timers(struct sock *);
555static inline void tcp_clear_xmit_timers(struct sock *sk) 567static inline void tcp_clear_xmit_timers(struct sock *sk)
556{ 568{
557 inet_csk_clear_xmit_timers(sk); 569 inet_csk_clear_xmit_timers(sk);
558} 570}
559 571
560extern unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu); 572unsigned int tcp_sync_mss(struct sock *sk, u32 pmtu);
561extern unsigned int tcp_current_mss(struct sock *sk); 573unsigned int tcp_current_mss(struct sock *sk);
562 574
563/* Bound MSS / TSO packet size with the half of the window */ 575/* Bound MSS / TSO packet size with the half of the window */
564static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) 576static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
@@ -584,20 +596,20 @@ static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize)
584} 596}
585 597
586/* tcp.c */ 598/* tcp.c */
587extern void tcp_get_info(const struct sock *, struct tcp_info *); 599void tcp_get_info(const struct sock *, struct tcp_info *);
588 600
589/* Read 'sendfile()'-style from a TCP socket */ 601/* Read 'sendfile()'-style from a TCP socket */
590typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, 602typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *,
591 unsigned int, size_t); 603 unsigned int, size_t);
592extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, 604int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
593 sk_read_actor_t recv_actor); 605 sk_read_actor_t recv_actor);
594 606
595extern void tcp_initialize_rcv_mss(struct sock *sk); 607void tcp_initialize_rcv_mss(struct sock *sk);
596 608
597extern int tcp_mtu_to_mss(struct sock *sk, int pmtu); 609int tcp_mtu_to_mss(struct sock *sk, int pmtu);
598extern int tcp_mss_to_mtu(struct sock *sk, int mss); 610int tcp_mss_to_mtu(struct sock *sk, int mss);
599extern void tcp_mtup_init(struct sock *sk); 611void tcp_mtup_init(struct sock *sk);
600extern void tcp_init_buffer_space(struct sock *sk); 612void tcp_init_buffer_space(struct sock *sk);
601 613
602static inline void tcp_bound_rto(const struct sock *sk) 614static inline void tcp_bound_rto(const struct sock *sk)
603{ 615{
@@ -610,7 +622,7 @@ static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
610 return (tp->srtt >> 3) + tp->rttvar; 622 return (tp->srtt >> 3) + tp->rttvar;
611} 623}
612 624
613extern void tcp_set_rto(struct sock *sk); 625void tcp_set_rto(struct sock *sk);
614 626
615static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) 627static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
616{ 628{
@@ -663,7 +675,7 @@ static inline u32 tcp_receive_window(const struct tcp_sock *tp)
663 * scaling applied to the result. The caller does these things 675 * scaling applied to the result. The caller does these things
664 * if necessary. This is a "raw" window selection. 676 * if necessary. This is a "raw" window selection.
665 */ 677 */
666extern u32 __tcp_select_window(struct sock *sk); 678u32 __tcp_select_window(struct sock *sk);
667 679
668void tcp_send_window_probe(struct sock *sk); 680void tcp_send_window_probe(struct sock *sk);
669 681
@@ -784,7 +796,7 @@ struct tcp_congestion_ops {
784 /* lower bound for congestion window (optional) */ 796 /* lower bound for congestion window (optional) */
785 u32 (*min_cwnd)(const struct sock *sk); 797 u32 (*min_cwnd)(const struct sock *sk);
786 /* do new cwnd calculation (required) */ 798 /* do new cwnd calculation (required) */
787 void (*cong_avoid)(struct sock *sk, u32 ack, u32 in_flight); 799 void (*cong_avoid)(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
788 /* call before changing ca_state (optional) */ 800 /* call before changing ca_state (optional) */
789 void (*set_state)(struct sock *sk, u8 new_state); 801 void (*set_state)(struct sock *sk, u8 new_state);
790 /* call when cwnd event occurs (optional) */ 802 /* call when cwnd event occurs (optional) */
@@ -800,24 +812,24 @@ struct tcp_congestion_ops {
800 struct module *owner; 812 struct module *owner;
801}; 813};
802 814
803extern int tcp_register_congestion_control(struct tcp_congestion_ops *type); 815int tcp_register_congestion_control(struct tcp_congestion_ops *type);
804extern void tcp_unregister_congestion_control(struct tcp_congestion_ops *type); 816void tcp_unregister_congestion_control(struct tcp_congestion_ops *type);
805 817
806extern void tcp_init_congestion_control(struct sock *sk); 818void tcp_init_congestion_control(struct sock *sk);
807extern void tcp_cleanup_congestion_control(struct sock *sk); 819void tcp_cleanup_congestion_control(struct sock *sk);
808extern int tcp_set_default_congestion_control(const char *name); 820int tcp_set_default_congestion_control(const char *name);
809extern void tcp_get_default_congestion_control(char *name); 821void tcp_get_default_congestion_control(char *name);
810extern void tcp_get_available_congestion_control(char *buf, size_t len); 822void tcp_get_available_congestion_control(char *buf, size_t len);
811extern void tcp_get_allowed_congestion_control(char *buf, size_t len); 823void tcp_get_allowed_congestion_control(char *buf, size_t len);
812extern int tcp_set_allowed_congestion_control(char *allowed); 824int tcp_set_allowed_congestion_control(char *allowed);
813extern int tcp_set_congestion_control(struct sock *sk, const char *name); 825int tcp_set_congestion_control(struct sock *sk, const char *name);
814extern void tcp_slow_start(struct tcp_sock *tp); 826int tcp_slow_start(struct tcp_sock *tp, u32 acked);
815extern void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w); 827void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w);
816 828
817extern struct tcp_congestion_ops tcp_init_congestion_ops; 829extern struct tcp_congestion_ops tcp_init_congestion_ops;
818extern u32 tcp_reno_ssthresh(struct sock *sk); 830u32 tcp_reno_ssthresh(struct sock *sk);
819extern void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight); 831void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked, u32 in_flight);
820extern u32 tcp_reno_min_cwnd(const struct sock *sk); 832u32 tcp_reno_min_cwnd(const struct sock *sk);
821extern struct tcp_congestion_ops tcp_reno; 833extern struct tcp_congestion_ops tcp_reno;
822 834
823static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state) 835static inline void tcp_set_ca_state(struct sock *sk, const u8 ca_state)
@@ -936,8 +948,8 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk)
936/* Use define here intentionally to get WARN_ON location shown at the caller */ 948/* Use define here intentionally to get WARN_ON location shown at the caller */
937#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out) 949#define tcp_verify_left_out(tp) WARN_ON(tcp_left_out(tp) > tp->packets_out)
938 950
939extern void tcp_enter_cwr(struct sock *sk, const int set_ssthresh); 951void tcp_enter_cwr(struct sock *sk, const int set_ssthresh);
940extern __u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst); 952__u32 tcp_init_cwnd(const struct tcp_sock *tp, const struct dst_entry *dst);
941 953
942/* The maximum number of MSS of available cwnd for which TSO defers 954/* The maximum number of MSS of available cwnd for which TSO defers
943 * sending if not using sysctl_tcp_tso_win_divisor. 955 * sending if not using sysctl_tcp_tso_win_divisor.
@@ -963,7 +975,7 @@ static inline u32 tcp_wnd_end(const struct tcp_sock *tp)
963{ 975{
964 return tp->snd_una + tp->snd_wnd; 976 return tp->snd_una + tp->snd_wnd;
965} 977}
966extern bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight); 978bool tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight);
967 979
968static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss, 980static inline void tcp_minshall_update(struct tcp_sock *tp, unsigned int mss,
969 const struct sk_buff *skb) 981 const struct sk_buff *skb)
@@ -1028,7 +1040,7 @@ static inline void tcp_prequeue_init(struct tcp_sock *tp)
1028#endif 1040#endif
1029} 1041}
1030 1042
1031extern bool tcp_prequeue(struct sock *sk, struct sk_buff *skb); 1043bool tcp_prequeue(struct sock *sk, struct sk_buff *skb);
1032 1044
1033#undef STATE_TRACE 1045#undef STATE_TRACE
1034 1046
@@ -1039,9 +1051,9 @@ static const char *statename[]={
1039 "Close Wait","Last ACK","Listen","Closing" 1051 "Close Wait","Last ACK","Listen","Closing"
1040}; 1052};
1041#endif 1053#endif
1042extern void tcp_set_state(struct sock *sk, int state); 1054void tcp_set_state(struct sock *sk, int state);
1043 1055
1044extern void tcp_done(struct sock *sk); 1056void tcp_done(struct sock *sk);
1045 1057
1046static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) 1058static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1047{ 1059{
@@ -1049,13 +1061,12 @@ static inline void tcp_sack_reset(struct tcp_options_received *rx_opt)
1049 rx_opt->num_sacks = 0; 1061 rx_opt->num_sacks = 0;
1050} 1062}
1051 1063
1052extern u32 tcp_default_init_rwnd(u32 mss); 1064u32 tcp_default_init_rwnd(u32 mss);
1053 1065
1054/* Determine a window scaling and initial window to offer. */ 1066/* Determine a window scaling and initial window to offer. */
1055extern void tcp_select_initial_window(int __space, __u32 mss, 1067void tcp_select_initial_window(int __space, __u32 mss, __u32 *rcv_wnd,
1056 __u32 *rcv_wnd, __u32 *window_clamp, 1068 __u32 *window_clamp, int wscale_ok,
1057 int wscale_ok, __u8 *rcv_wscale, 1069 __u8 *rcv_wscale, __u32 init_rcv_wnd);
1058 __u32 init_rcv_wnd);
1059 1070
1060static inline int tcp_win_from_space(int space) 1071static inline int tcp_win_from_space(int space)
1061{ 1072{
@@ -1095,11 +1106,11 @@ static inline void tcp_openreq_init(struct request_sock *req,
1095 ireq->wscale_ok = rx_opt->wscale_ok; 1106 ireq->wscale_ok = rx_opt->wscale_ok;
1096 ireq->acked = 0; 1107 ireq->acked = 0;
1097 ireq->ecn_ok = 0; 1108 ireq->ecn_ok = 0;
1098 ireq->rmt_port = tcp_hdr(skb)->source; 1109 ireq->ir_rmt_port = tcp_hdr(skb)->source;
1099 ireq->loc_port = tcp_hdr(skb)->dest; 1110 ireq->ir_num = ntohs(tcp_hdr(skb)->dest);
1100} 1111}
1101 1112
1102extern void tcp_enter_memory_pressure(struct sock *sk); 1113void tcp_enter_memory_pressure(struct sock *sk);
1103 1114
1104static inline int keepalive_intvl_when(const struct tcp_sock *tp) 1115static inline int keepalive_intvl_when(const struct tcp_sock *tp)
1105{ 1116{
@@ -1252,21 +1263,20 @@ struct tcp_md5sig_pool {
1252}; 1263};
1253 1264
1254/* - functions */ 1265/* - functions */
1255extern int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key, 1266int tcp_v4_md5_hash_skb(char *md5_hash, struct tcp_md5sig_key *key,
1256 const struct sock *sk, 1267 const struct sock *sk, const struct request_sock *req,
1257 const struct request_sock *req, 1268 const struct sk_buff *skb);
1258 const struct sk_buff *skb); 1269int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr,
1259extern int tcp_md5_do_add(struct sock *sk, const union tcp_md5_addr *addr, 1270 int family, const u8 *newkey, u8 newkeylen, gfp_t gfp);
1260 int family, const u8 *newkey, 1271int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr,
1261 u8 newkeylen, gfp_t gfp); 1272 int family);
1262extern int tcp_md5_do_del(struct sock *sk, const union tcp_md5_addr *addr, 1273struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1263 int family);
1264extern struct tcp_md5sig_key *tcp_v4_md5_lookup(struct sock *sk,
1265 struct sock *addr_sk); 1274 struct sock *addr_sk);
1266 1275
1267#ifdef CONFIG_TCP_MD5SIG 1276#ifdef CONFIG_TCP_MD5SIG
1268extern struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, 1277struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1269 const union tcp_md5_addr *addr, int family); 1278 const union tcp_md5_addr *addr,
1279 int family);
1270#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key) 1280#define tcp_twsk_md5_key(twsk) ((twsk)->tw_md5_key)
1271#else 1281#else
1272static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk, 1282static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
@@ -1278,27 +1288,26 @@ static inline struct tcp_md5sig_key *tcp_md5_do_lookup(struct sock *sk,
1278#define tcp_twsk_md5_key(twsk) NULL 1288#define tcp_twsk_md5_key(twsk) NULL
1279#endif 1289#endif
1280 1290
1281extern bool tcp_alloc_md5sig_pool(void); 1291bool tcp_alloc_md5sig_pool(void);
1282 1292
1283extern struct tcp_md5sig_pool *tcp_get_md5sig_pool(void); 1293struct tcp_md5sig_pool *tcp_get_md5sig_pool(void);
1284static inline void tcp_put_md5sig_pool(void) 1294static inline void tcp_put_md5sig_pool(void)
1285{ 1295{
1286 local_bh_enable(); 1296 local_bh_enable();
1287} 1297}
1288 1298
1289extern int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *); 1299int tcp_md5_hash_header(struct tcp_md5sig_pool *, const struct tcphdr *);
1290extern int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *, 1300int tcp_md5_hash_skb_data(struct tcp_md5sig_pool *, const struct sk_buff *,
1291 unsigned int header_len); 1301 unsigned int header_len);
1292extern int tcp_md5_hash_key(struct tcp_md5sig_pool *hp, 1302int tcp_md5_hash_key(struct tcp_md5sig_pool *hp,
1293 const struct tcp_md5sig_key *key); 1303 const struct tcp_md5sig_key *key);
1294 1304
1295/* From tcp_fastopen.c */ 1305/* From tcp_fastopen.c */
1296extern void tcp_fastopen_cache_get(struct sock *sk, u16 *mss, 1306void tcp_fastopen_cache_get(struct sock *sk, u16 *mss,
1297 struct tcp_fastopen_cookie *cookie, 1307 struct tcp_fastopen_cookie *cookie, int *syn_loss,
1298 int *syn_loss, unsigned long *last_syn_loss); 1308 unsigned long *last_syn_loss);
1299extern void tcp_fastopen_cache_set(struct sock *sk, u16 mss, 1309void tcp_fastopen_cache_set(struct sock *sk, u16 mss,
1300 struct tcp_fastopen_cookie *cookie, 1310 struct tcp_fastopen_cookie *cookie, bool syn_lost);
1301 bool syn_lost);
1302struct tcp_fastopen_request { 1311struct tcp_fastopen_request {
1303 /* Fast Open cookie. Size 0 means a cookie request */ 1312 /* Fast Open cookie. Size 0 means a cookie request */
1304 struct tcp_fastopen_cookie cookie; 1313 struct tcp_fastopen_cookie cookie;
@@ -1309,9 +1318,9 @@ void tcp_free_fastopen_req(struct tcp_sock *tp);
1309 1318
1310extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx; 1319extern struct tcp_fastopen_context __rcu *tcp_fastopen_ctx;
1311int tcp_fastopen_reset_cipher(void *key, unsigned int len); 1320int tcp_fastopen_reset_cipher(void *key, unsigned int len);
1312extern void tcp_fastopen_cookie_gen(__be32 src, __be32 dst, 1321void tcp_fastopen_cookie_gen(__be32 src, __be32 dst,
1313 struct tcp_fastopen_cookie *foc); 1322 struct tcp_fastopen_cookie *foc);
1314 1323void tcp_fastopen_init_key_once(bool publish);
1315#define TCP_FASTOPEN_KEY_LENGTH 16 1324#define TCP_FASTOPEN_KEY_LENGTH 16
1316 1325
1317/* Fastopen key context */ 1326/* Fastopen key context */
@@ -1507,7 +1516,6 @@ enum tcp_seq_states {
1507 TCP_SEQ_STATE_LISTENING, 1516 TCP_SEQ_STATE_LISTENING,
1508 TCP_SEQ_STATE_OPENREQ, 1517 TCP_SEQ_STATE_OPENREQ,
1509 TCP_SEQ_STATE_ESTABLISHED, 1518 TCP_SEQ_STATE_ESTABLISHED,
1510 TCP_SEQ_STATE_TIME_WAIT,
1511}; 1519};
1512 1520
1513int tcp_seq_open(struct inode *inode, struct file *file); 1521int tcp_seq_open(struct inode *inode, struct file *file);
@@ -1529,22 +1537,20 @@ struct tcp_iter_state {
1529 loff_t last_pos; 1537 loff_t last_pos;
1530}; 1538};
1531 1539
1532extern int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo); 1540int tcp_proc_register(struct net *net, struct tcp_seq_afinfo *afinfo);
1533extern void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo); 1541void tcp_proc_unregister(struct net *net, struct tcp_seq_afinfo *afinfo);
1534 1542
1535extern struct request_sock_ops tcp_request_sock_ops; 1543extern struct request_sock_ops tcp_request_sock_ops;
1536extern struct request_sock_ops tcp6_request_sock_ops; 1544extern struct request_sock_ops tcp6_request_sock_ops;
1537 1545
1538extern void tcp_v4_destroy_sock(struct sock *sk); 1546void tcp_v4_destroy_sock(struct sock *sk);
1539 1547
1540extern struct sk_buff *tcp_tso_segment(struct sk_buff *skb, 1548struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
1541 netdev_features_t features); 1549 netdev_features_t features);
1542extern struct sk_buff **tcp_gro_receive(struct sk_buff **head, 1550struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb);
1543 struct sk_buff *skb); 1551int tcp_gro_complete(struct sk_buff *skb);
1544extern int tcp_gro_complete(struct sk_buff *skb);
1545 1552
1546extern void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, 1553void __tcp_v4_send_check(struct sk_buff *skb, __be32 saddr, __be32 daddr);
1547 __be32 daddr);
1548 1554
1549static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp) 1555static inline u32 tcp_notsent_lowat(const struct tcp_sock *tp)
1550{ 1556{
@@ -1560,8 +1566,8 @@ static inline bool tcp_stream_memory_free(const struct sock *sk)
1560} 1566}
1561 1567
1562#ifdef CONFIG_PROC_FS 1568#ifdef CONFIG_PROC_FS
1563extern int tcp4_proc_init(void); 1569int tcp4_proc_init(void);
1564extern void tcp4_proc_exit(void); 1570void tcp4_proc_exit(void);
1565#endif 1571#endif
1566 1572
1567/* TCP af-specific functions */ 1573/* TCP af-specific functions */
@@ -1592,9 +1598,9 @@ struct tcp_request_sock_ops {
1592#endif 1598#endif
1593}; 1599};
1594 1600
1595extern int tcpv4_offload_init(void); 1601int tcpv4_offload_init(void);
1596 1602
1597extern void tcp_v4_init(void); 1603void tcp_v4_init(void);
1598extern void tcp_init(void); 1604void tcp_init(void);
1599 1605
1600#endif /* _TCP_H */ 1606#endif /* _TCP_H */
diff --git a/include/net/tcp_memcontrol.h b/include/net/tcp_memcontrol.h
index 7df18bc43a97..05b94d9453de 100644
--- a/include/net/tcp_memcontrol.h
+++ b/include/net/tcp_memcontrol.h
@@ -1,19 +1,7 @@
1#ifndef _TCP_MEMCG_H 1#ifndef _TCP_MEMCG_H
2#define _TCP_MEMCG_H 2#define _TCP_MEMCG_H
3 3
4struct tcp_memcontrol {
5 struct cg_proto cg_proto;
6 /* per-cgroup tcp memory pressure knobs */
7 struct res_counter tcp_memory_allocated;
8 struct percpu_counter tcp_sockets_allocated;
9 /* those two are read-mostly, leave them at the end */
10 long tcp_prot_mem[3];
11 int tcp_memory_pressure;
12};
13
14struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg); 4struct cg_proto *tcp_proto_cgroup(struct mem_cgroup *memcg);
15int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss); 5int tcp_init_cgroup(struct mem_cgroup *memcg, struct cgroup_subsys *ss);
16void tcp_destroy_cgroup(struct mem_cgroup *memcg); 6void tcp_destroy_cgroup(struct mem_cgroup *memcg);
17unsigned long long tcp_max_memory(const struct mem_cgroup *memcg);
18void tcp_prot_mem(struct mem_cgroup *memcg, long val, int idx);
19#endif /* _TCP_MEMCG_H */ 7#endif /* _TCP_MEMCG_H */
diff --git a/include/net/udp.h b/include/net/udp.h
index ef2e0b7843a0..a24f0f3e107f 100644
--- a/include/net/udp.h
+++ b/include/net/udp.h
@@ -79,7 +79,7 @@ struct udp_table {
79 unsigned int log; 79 unsigned int log;
80}; 80};
81extern struct udp_table udp_table; 81extern struct udp_table udp_table;
82extern void udp_table_init(struct udp_table *, const char *); 82void udp_table_init(struct udp_table *, const char *);
83static inline struct udp_hslot *udp_hashslot(struct udp_table *table, 83static inline struct udp_hslot *udp_hashslot(struct udp_table *table,
84 struct net *net, unsigned int num) 84 struct net *net, unsigned int num)
85{ 85{
@@ -162,52 +162,53 @@ static inline void udp_lib_hash(struct sock *sk)
162 BUG(); 162 BUG();
163} 163}
164 164
165extern void udp_lib_unhash(struct sock *sk); 165void udp_lib_unhash(struct sock *sk);
166extern void udp_lib_rehash(struct sock *sk, u16 new_hash); 166void udp_lib_rehash(struct sock *sk, u16 new_hash);
167 167
168static inline void udp_lib_close(struct sock *sk, long timeout) 168static inline void udp_lib_close(struct sock *sk, long timeout)
169{ 169{
170 sk_common_release(sk); 170 sk_common_release(sk);
171} 171}
172 172
173extern int udp_lib_get_port(struct sock *sk, unsigned short snum, 173int udp_lib_get_port(struct sock *sk, unsigned short snum,
174 int (*)(const struct sock *,const struct sock *), 174 int (*)(const struct sock *, const struct sock *),
175 unsigned int hash2_nulladdr); 175 unsigned int hash2_nulladdr);
176 176
177/* net/ipv4/udp.c */ 177/* net/ipv4/udp.c */
178extern int udp_get_port(struct sock *sk, unsigned short snum, 178void udp_v4_early_demux(struct sk_buff *skb);
179 int (*saddr_cmp)(const struct sock *, 179int udp_get_port(struct sock *sk, unsigned short snum,
180 const struct sock *)); 180 int (*saddr_cmp)(const struct sock *,
181extern void udp_err(struct sk_buff *, u32); 181 const struct sock *));
182extern int udp_sendmsg(struct kiocb *iocb, struct sock *sk, 182void udp_err(struct sk_buff *, u32);
183 struct msghdr *msg, size_t len); 183int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
184extern int udp_push_pending_frames(struct sock *sk); 184 size_t len);
185extern void udp_flush_pending_frames(struct sock *sk); 185int udp_push_pending_frames(struct sock *sk);
186extern void udp4_hwcsum(struct sk_buff *skb, __be32 src, __be32 dst); 186void udp_flush_pending_frames(struct sock *sk);
187extern int udp_rcv(struct sk_buff *skb); 187void udp4_hwcsum(struct sk_buff *skb, __be32 src, __be32 dst);
188extern int udp_ioctl(struct sock *sk, int cmd, unsigned long arg); 188int udp_rcv(struct sk_buff *skb);
189extern int udp_disconnect(struct sock *sk, int flags); 189int udp_ioctl(struct sock *sk, int cmd, unsigned long arg);
190extern unsigned int udp_poll(struct file *file, struct socket *sock, 190int udp_disconnect(struct sock *sk, int flags);
191 poll_table *wait); 191unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait);
192extern struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb, 192struct sk_buff *skb_udp_tunnel_segment(struct sk_buff *skb,
193 netdev_features_t features); 193 netdev_features_t features);
194extern int udp_lib_getsockopt(struct sock *sk, int level, int optname, 194int udp_lib_getsockopt(struct sock *sk, int level, int optname,
195 char __user *optval, int __user *optlen); 195 char __user *optval, int __user *optlen);
196extern int udp_lib_setsockopt(struct sock *sk, int level, int optname, 196int udp_lib_setsockopt(struct sock *sk, int level, int optname,
197 char __user *optval, unsigned int optlen, 197 char __user *optval, unsigned int optlen,
198 int (*push_pending_frames)(struct sock *)); 198 int (*push_pending_frames)(struct sock *));
199extern struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 199struct sock *udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
200 __be32 daddr, __be16 dport, 200 __be32 daddr, __be16 dport, int dif);
201 int dif); 201struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport,
202extern struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, __be16 sport, 202 __be32 daddr, __be16 dport, int dif,
203 __be32 daddr, __be16 dport, 203 struct udp_table *tbl);
204 int dif, struct udp_table *tbl); 204struct sock *udp6_lib_lookup(struct net *net,
205extern struct sock *udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be16 sport, 205 const struct in6_addr *saddr, __be16 sport,
206 const struct in6_addr *daddr, __be16 dport, 206 const struct in6_addr *daddr, __be16 dport,
207 int dif); 207 int dif);
208extern struct sock *__udp6_lib_lookup(struct net *net, const struct in6_addr *saddr, __be16 sport, 208struct sock *__udp6_lib_lookup(struct net *net,
209 const struct in6_addr *daddr, __be16 dport, 209 const struct in6_addr *saddr, __be16 sport,
210 int dif, struct udp_table *tbl); 210 const struct in6_addr *daddr, __be16 dport,
211 int dif, struct udp_table *tbl);
211 212
212/* 213/*
213 * SNMP statistics for UDP and UDP-Lite 214 * SNMP statistics for UDP and UDP-Lite
@@ -229,13 +230,13 @@ extern struct sock *__udp6_lib_lookup(struct net *net, const struct in6_addr *sa
229} while(0) 230} while(0)
230 231
231#if IS_ENABLED(CONFIG_IPV6) 232#if IS_ENABLED(CONFIG_IPV6)
232#define UDPX_INC_STATS_BH(sk, field) \ 233#define UDPX_INC_STATS_BH(sk, field) \
233 do { \ 234do { \
234 if ((sk)->sk_family == AF_INET) \ 235 if ((sk)->sk_family == AF_INET) \
235 UDP_INC_STATS_BH(sock_net(sk), field, 0); \ 236 UDP_INC_STATS_BH(sock_net(sk), field, 0); \
236 else \ 237 else \
237 UDP6_INC_STATS_BH(sock_net(sk), field, 0); \ 238 UDP6_INC_STATS_BH(sock_net(sk), field, 0); \
238 } while (0); 239} while (0)
239#else 240#else
240#define UDPX_INC_STATS_BH(sk, field) UDP_INC_STATS_BH(sock_net(sk), field, 0) 241#define UDPX_INC_STATS_BH(sk, field) UDP_INC_STATS_BH(sock_net(sk), field, 0)
241#endif 242#endif
@@ -259,19 +260,19 @@ struct udp_iter_state {
259}; 260};
260 261
261#ifdef CONFIG_PROC_FS 262#ifdef CONFIG_PROC_FS
262extern int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo); 263int udp_proc_register(struct net *net, struct udp_seq_afinfo *afinfo);
263extern void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo); 264void udp_proc_unregister(struct net *net, struct udp_seq_afinfo *afinfo);
264 265
265extern int udp4_proc_init(void); 266int udp4_proc_init(void);
266extern void udp4_proc_exit(void); 267void udp4_proc_exit(void);
267#endif 268#endif
268 269
269extern int udpv4_offload_init(void); 270int udpv4_offload_init(void);
270 271
271extern void udp_init(void); 272void udp_init(void);
272 273
273extern void udp_encap_enable(void); 274void udp_encap_enable(void);
274#if IS_ENABLED(CONFIG_IPV6) 275#if IS_ENABLED(CONFIG_IPV6)
275extern void udpv6_encap_enable(void); 276void udpv6_encap_enable(void);
276#endif 277#endif
277#endif /* _UDP_H */ 278#endif /* _UDP_H */
diff --git a/include/net/udplite.h b/include/net/udplite.h
index 71375459a884..2caadabcd07b 100644
--- a/include/net/udplite.h
+++ b/include/net/udplite.h
@@ -126,7 +126,7 @@ static inline __wsum udplite_csum(struct sk_buff *skb)
126 return skb_checksum(skb, off, len, 0); 126 return skb_checksum(skb, off, len, 0);
127} 127}
128 128
129extern void udplite4_register(void); 129void udplite4_register(void);
130extern int udplite_get_port(struct sock *sk, unsigned short snum, 130int udplite_get_port(struct sock *sk, unsigned short snum,
131 int (*scmp)(const struct sock *, const struct sock *)); 131 int (*scmp)(const struct sock *, const struct sock *));
132#endif /* _UDPLITE_H */ 132#endif /* _UDPLITE_H */
diff --git a/include/net/vxlan.h b/include/net/vxlan.h
index 2d64d3cd4999..6b6d180fb91a 100644
--- a/include/net/vxlan.h
+++ b/include/net/vxlan.h
@@ -36,5 +36,16 @@ int vxlan_xmit_skb(struct vxlan_sock *vs,
36 36
37__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb); 37__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb);
38 38
39/* IP header + UDP + VXLAN + Ethernet header */
40#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
41/* IPv6 header + UDP + VXLAN + Ethernet header */
42#define VXLAN6_HEADROOM (40 + 8 + 8 + 14)
43
44#if IS_ENABLED(CONFIG_VXLAN)
39void vxlan_get_rx_port(struct net_device *netdev); 45void vxlan_get_rx_port(struct net_device *netdev);
46#else
47static inline void vxlan_get_rx_port(struct net_device *netdev)
48{
49}
50#endif
40#endif 51#endif
diff --git a/include/net/wext.h b/include/net/wext.h
index 4f6e7423174c..345911965dbb 100644
--- a/include/net/wext.h
+++ b/include/net/wext.h
@@ -6,13 +6,13 @@
6struct net; 6struct net;
7 7
8#ifdef CONFIG_WEXT_CORE 8#ifdef CONFIG_WEXT_CORE
9extern int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, 9int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
10 void __user *arg); 10 void __user *arg);
11extern int compat_wext_handle_ioctl(struct net *net, unsigned int cmd, 11int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
12 unsigned long arg); 12 unsigned long arg);
13 13
14extern struct iw_statistics *get_wireless_stats(struct net_device *dev); 14struct iw_statistics *get_wireless_stats(struct net_device *dev);
15extern int call_commit_handler(struct net_device *dev); 15int call_commit_handler(struct net_device *dev);
16#else 16#else
17static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd, 17static inline int wext_handle_ioctl(struct net *net, struct ifreq *ifr, unsigned int cmd,
18 void __user *arg) 18 void __user *arg)
@@ -27,8 +27,8 @@ static inline int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
27#endif 27#endif
28 28
29#ifdef CONFIG_WEXT_PROC 29#ifdef CONFIG_WEXT_PROC
30extern int wext_proc_init(struct net *net); 30int wext_proc_init(struct net *net);
31extern void wext_proc_exit(struct net *net); 31void wext_proc_exit(struct net *net);
32#else 32#else
33static inline int wext_proc_init(struct net *net) 33static inline int wext_proc_init(struct net *net)
34{ 34{
diff --git a/include/net/wimax.h b/include/net/wimax.h
index bbb74f990cab..98498e1daa06 100644
--- a/include/net/wimax.h
+++ b/include/net/wimax.h
@@ -438,9 +438,9 @@ struct wimax_dev {
438 * 438 *
439 * These functions are not exported to user space. 439 * These functions are not exported to user space.
440 */ 440 */
441extern void wimax_dev_init(struct wimax_dev *); 441void wimax_dev_init(struct wimax_dev *);
442extern int wimax_dev_add(struct wimax_dev *, struct net_device *); 442int wimax_dev_add(struct wimax_dev *, struct net_device *);
443extern void wimax_dev_rm(struct wimax_dev *); 443void wimax_dev_rm(struct wimax_dev *);
444 444
445static inline 445static inline
446struct wimax_dev *net_dev_to_wimax(struct net_device *net_dev) 446struct wimax_dev *net_dev_to_wimax(struct net_device *net_dev)
@@ -454,8 +454,8 @@ struct device *wimax_dev_to_dev(struct wimax_dev *wimax_dev)
454 return wimax_dev->net_dev->dev.parent; 454 return wimax_dev->net_dev->dev.parent;
455} 455}
456 456
457extern void wimax_state_change(struct wimax_dev *, enum wimax_st); 457void wimax_state_change(struct wimax_dev *, enum wimax_st);
458extern enum wimax_st wimax_state_get(struct wimax_dev *); 458enum wimax_st wimax_state_get(struct wimax_dev *);
459 459
460/* 460/*
461 * Radio Switch state reporting. 461 * Radio Switch state reporting.
@@ -463,8 +463,8 @@ extern enum wimax_st wimax_state_get(struct wimax_dev *);
463 * enum wimax_rf_state is declared in linux/wimax.h so the exports 463 * enum wimax_rf_state is declared in linux/wimax.h so the exports
464 * to user space can use it. 464 * to user space can use it.
465 */ 465 */
466extern void wimax_report_rfkill_hw(struct wimax_dev *, enum wimax_rf_state); 466void wimax_report_rfkill_hw(struct wimax_dev *, enum wimax_rf_state);
467extern void wimax_report_rfkill_sw(struct wimax_dev *, enum wimax_rf_state); 467void wimax_report_rfkill_sw(struct wimax_dev *, enum wimax_rf_state);
468 468
469 469
470/* 470/*
@@ -490,15 +490,14 @@ extern void wimax_report_rfkill_sw(struct wimax_dev *, enum wimax_rf_state);
490 * send diagnostics information that a device-specific diagnostics 490 * send diagnostics information that a device-specific diagnostics
491 * tool would be interested in. 491 * tool would be interested in.
492 */ 492 */
493extern struct sk_buff *wimax_msg_alloc(struct wimax_dev *, const char *, 493struct sk_buff *wimax_msg_alloc(struct wimax_dev *, const char *, const void *,
494 const void *, size_t, gfp_t); 494 size_t, gfp_t);
495extern int wimax_msg_send(struct wimax_dev *, struct sk_buff *); 495int wimax_msg_send(struct wimax_dev *, struct sk_buff *);
496extern int wimax_msg(struct wimax_dev *, const char *, 496int wimax_msg(struct wimax_dev *, const char *, const void *, size_t, gfp_t);
497 const void *, size_t, gfp_t);
498 497
499extern const void *wimax_msg_data_len(struct sk_buff *, size_t *); 498const void *wimax_msg_data_len(struct sk_buff *, size_t *);
500extern const void *wimax_msg_data(struct sk_buff *); 499const void *wimax_msg_data(struct sk_buff *);
501extern ssize_t wimax_msg_len(struct sk_buff *); 500ssize_t wimax_msg_len(struct sk_buff *);
502 501
503 502
504/* 503/*
@@ -513,7 +512,7 @@ extern ssize_t wimax_msg_len(struct sk_buff *);
513 * device's control structure and (as such) the 'struct wimax_dev' is 512 * device's control structure and (as such) the 'struct wimax_dev' is
514 * referenced by the caller. 513 * referenced by the caller.
515 */ 514 */
516extern int wimax_rfkill(struct wimax_dev *, enum wimax_rf_state); 515int wimax_rfkill(struct wimax_dev *, enum wimax_rf_state);
517extern int wimax_reset(struct wimax_dev *); 516int wimax_reset(struct wimax_dev *);
518 517
519#endif /* #ifndef __NET__WIMAX_H__ */ 518#endif /* #ifndef __NET__WIMAX_H__ */
diff --git a/include/net/x25.h b/include/net/x25.h
index b4a8a8923128..c383aa4edbf0 100644
--- a/include/net/x25.h
+++ b/include/net/x25.h
@@ -187,57 +187,57 @@ extern int sysctl_x25_clear_request_timeout;
187extern int sysctl_x25_ack_holdback_timeout; 187extern int sysctl_x25_ack_holdback_timeout;
188extern int sysctl_x25_forward; 188extern int sysctl_x25_forward;
189 189
190extern int x25_parse_address_block(struct sk_buff *skb, 190int x25_parse_address_block(struct sk_buff *skb,
191 struct x25_address *called_addr, 191 struct x25_address *called_addr,
192 struct x25_address *calling_addr); 192 struct x25_address *calling_addr);
193 193
194extern int x25_addr_ntoa(unsigned char *, struct x25_address *, 194int x25_addr_ntoa(unsigned char *, struct x25_address *, struct x25_address *);
195 struct x25_address *); 195int x25_addr_aton(unsigned char *, struct x25_address *, struct x25_address *);
196extern int x25_addr_aton(unsigned char *, struct x25_address *, 196struct sock *x25_find_socket(unsigned int, struct x25_neigh *);
197 struct x25_address *); 197void x25_destroy_socket_from_timer(struct sock *);
198extern struct sock *x25_find_socket(unsigned int, struct x25_neigh *); 198int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int);
199extern void x25_destroy_socket_from_timer(struct sock *); 199void x25_kill_by_neigh(struct x25_neigh *);
200extern int x25_rx_call_request(struct sk_buff *, struct x25_neigh *, unsigned int);
201extern void x25_kill_by_neigh(struct x25_neigh *);
202 200
203/* x25_dev.c */ 201/* x25_dev.c */
204extern void x25_send_frame(struct sk_buff *, struct x25_neigh *); 202void x25_send_frame(struct sk_buff *, struct x25_neigh *);
205extern int x25_lapb_receive_frame(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *); 203int x25_lapb_receive_frame(struct sk_buff *, struct net_device *,
206extern void x25_establish_link(struct x25_neigh *); 204 struct packet_type *, struct net_device *);
207extern void x25_terminate_link(struct x25_neigh *); 205void x25_establish_link(struct x25_neigh *);
206void x25_terminate_link(struct x25_neigh *);
208 207
209/* x25_facilities.c */ 208/* x25_facilities.c */
210extern int x25_parse_facilities(struct sk_buff *, struct x25_facilities *, 209int x25_parse_facilities(struct sk_buff *, struct x25_facilities *,
211 struct x25_dte_facilities *, unsigned long *); 210 struct x25_dte_facilities *, unsigned long *);
212extern int x25_create_facilities(unsigned char *, struct x25_facilities *, 211int x25_create_facilities(unsigned char *, struct x25_facilities *,
213 struct x25_dte_facilities *, unsigned long); 212 struct x25_dte_facilities *, unsigned long);
214extern int x25_negotiate_facilities(struct sk_buff *, struct sock *, 213int x25_negotiate_facilities(struct sk_buff *, struct sock *,
215 struct x25_facilities *, 214 struct x25_facilities *,
216 struct x25_dte_facilities *); 215 struct x25_dte_facilities *);
217extern void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *); 216void x25_limit_facilities(struct x25_facilities *, struct x25_neigh *);
218 217
219/* x25_forward.c */ 218/* x25_forward.c */
220extern void x25_clear_forward_by_lci(unsigned int lci); 219void x25_clear_forward_by_lci(unsigned int lci);
221extern void x25_clear_forward_by_dev(struct net_device *); 220void x25_clear_forward_by_dev(struct net_device *);
222extern int x25_forward_data(int, struct x25_neigh *, struct sk_buff *); 221int x25_forward_data(int, struct x25_neigh *, struct sk_buff *);
223extern int x25_forward_call(struct x25_address *, struct x25_neigh *, 222int x25_forward_call(struct x25_address *, struct x25_neigh *, struct sk_buff *,
224 struct sk_buff *, int); 223 int);
225 224
226/* x25_in.c */ 225/* x25_in.c */
227extern int x25_process_rx_frame(struct sock *, struct sk_buff *); 226int x25_process_rx_frame(struct sock *, struct sk_buff *);
228extern int x25_backlog_rcv(struct sock *, struct sk_buff *); 227int x25_backlog_rcv(struct sock *, struct sk_buff *);
229 228
230/* x25_link.c */ 229/* x25_link.c */
231extern void x25_link_control(struct sk_buff *, struct x25_neigh *, unsigned short); 230void x25_link_control(struct sk_buff *, struct x25_neigh *, unsigned short);
232extern void x25_link_device_up(struct net_device *); 231void x25_link_device_up(struct net_device *);
233extern void x25_link_device_down(struct net_device *); 232void x25_link_device_down(struct net_device *);
234extern void x25_link_established(struct x25_neigh *); 233void x25_link_established(struct x25_neigh *);
235extern void x25_link_terminated(struct x25_neigh *); 234void x25_link_terminated(struct x25_neigh *);
236extern void x25_transmit_clear_request(struct x25_neigh *, unsigned int, unsigned char); 235void x25_transmit_clear_request(struct x25_neigh *, unsigned int,
237extern void x25_transmit_link(struct sk_buff *, struct x25_neigh *); 236 unsigned char);
238extern int x25_subscr_ioctl(unsigned int, void __user *); 237void x25_transmit_link(struct sk_buff *, struct x25_neigh *);
239extern struct x25_neigh *x25_get_neigh(struct net_device *); 238int x25_subscr_ioctl(unsigned int, void __user *);
240extern void x25_link_free(void); 239struct x25_neigh *x25_get_neigh(struct net_device *);
240void x25_link_free(void);
241 241
242/* x25_neigh.c */ 242/* x25_neigh.c */
243static __inline__ void x25_neigh_hold(struct x25_neigh *nb) 243static __inline__ void x25_neigh_hold(struct x25_neigh *nb)
@@ -252,16 +252,16 @@ static __inline__ void x25_neigh_put(struct x25_neigh *nb)
252} 252}
253 253
254/* x25_out.c */ 254/* x25_out.c */
255extern int x25_output(struct sock *, struct sk_buff *); 255int x25_output(struct sock *, struct sk_buff *);
256extern void x25_kick(struct sock *); 256void x25_kick(struct sock *);
257extern void x25_enquiry_response(struct sock *); 257void x25_enquiry_response(struct sock *);
258 258
259/* x25_route.c */ 259/* x25_route.c */
260extern struct x25_route *x25_get_route(struct x25_address *addr); 260struct x25_route *x25_get_route(struct x25_address *addr);
261extern struct net_device *x25_dev_get(char *); 261struct net_device *x25_dev_get(char *);
262extern void x25_route_device_down(struct net_device *dev); 262void x25_route_device_down(struct net_device *dev);
263extern int x25_route_ioctl(unsigned int, void __user *); 263int x25_route_ioctl(unsigned int, void __user *);
264extern void x25_route_free(void); 264void x25_route_free(void);
265 265
266static __inline__ void x25_route_hold(struct x25_route *rt) 266static __inline__ void x25_route_hold(struct x25_route *rt)
267{ 267{
@@ -275,30 +275,31 @@ static __inline__ void x25_route_put(struct x25_route *rt)
275} 275}
276 276
277/* x25_subr.c */ 277/* x25_subr.c */
278extern void x25_clear_queues(struct sock *); 278void x25_clear_queues(struct sock *);
279extern void x25_frames_acked(struct sock *, unsigned short); 279void x25_frames_acked(struct sock *, unsigned short);
280extern void x25_requeue_frames(struct sock *); 280void x25_requeue_frames(struct sock *);
281extern int x25_validate_nr(struct sock *, unsigned short); 281int x25_validate_nr(struct sock *, unsigned short);
282extern void x25_write_internal(struct sock *, int); 282void x25_write_internal(struct sock *, int);
283extern int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *, int *); 283int x25_decode(struct sock *, struct sk_buff *, int *, int *, int *, int *,
284extern void x25_disconnect(struct sock *, int, unsigned char, unsigned char); 284 int *);
285void x25_disconnect(struct sock *, int, unsigned char, unsigned char);
285 286
286/* x25_timer.c */ 287/* x25_timer.c */
287extern void x25_init_timers(struct sock *sk); 288void x25_init_timers(struct sock *sk);
288extern void x25_start_heartbeat(struct sock *); 289void x25_start_heartbeat(struct sock *);
289extern void x25_start_t2timer(struct sock *); 290void x25_start_t2timer(struct sock *);
290extern void x25_start_t21timer(struct sock *); 291void x25_start_t21timer(struct sock *);
291extern void x25_start_t22timer(struct sock *); 292void x25_start_t22timer(struct sock *);
292extern void x25_start_t23timer(struct sock *); 293void x25_start_t23timer(struct sock *);
293extern void x25_stop_heartbeat(struct sock *); 294void x25_stop_heartbeat(struct sock *);
294extern void x25_stop_timer(struct sock *); 295void x25_stop_timer(struct sock *);
295extern unsigned long x25_display_timer(struct sock *); 296unsigned long x25_display_timer(struct sock *);
296extern void x25_check_rbuf(struct sock *); 297void x25_check_rbuf(struct sock *);
297 298
298/* sysctl_net_x25.c */ 299/* sysctl_net_x25.c */
299#ifdef CONFIG_SYSCTL 300#ifdef CONFIG_SYSCTL
300extern void x25_register_sysctl(void); 301void x25_register_sysctl(void);
301extern void x25_unregister_sysctl(void); 302void x25_unregister_sysctl(void);
302#else 303#else
303static inline void x25_register_sysctl(void) {}; 304static inline void x25_register_sysctl(void) {};
304static inline void x25_unregister_sysctl(void) {}; 305static inline void x25_unregister_sysctl(void) {};
@@ -318,6 +319,6 @@ extern rwlock_t x25_forward_list_lock;
318extern struct list_head x25_neigh_list; 319extern struct list_head x25_neigh_list;
319extern rwlock_t x25_neigh_list_lock; 320extern rwlock_t x25_neigh_list_lock;
320 321
321extern int x25_proc_init(void); 322int x25_proc_init(void);
322extern void x25_proc_exit(void); 323void x25_proc_exit(void);
323#endif 324#endif
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index e253bf0cc7ef..6b82fdf4ba71 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -307,15 +307,17 @@ struct xfrm_policy_afinfo {
307 struct dst_entry *(*blackhole_route)(struct net *net, struct dst_entry *orig); 307 struct dst_entry *(*blackhole_route)(struct net *net, struct dst_entry *orig);
308}; 308};
309 309
310extern int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo); 310int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo);
311extern int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo); 311int xfrm_policy_unregister_afinfo(struct xfrm_policy_afinfo *afinfo);
312extern void km_policy_notify(struct xfrm_policy *xp, int dir, const struct km_event *c); 312void km_policy_notify(struct xfrm_policy *xp, int dir,
313extern void km_state_notify(struct xfrm_state *x, const struct km_event *c); 313 const struct km_event *c);
314void km_state_notify(struct xfrm_state *x, const struct km_event *c);
314 315
315struct xfrm_tmpl; 316struct xfrm_tmpl;
316extern int km_query(struct xfrm_state *x, struct xfrm_tmpl *t, struct xfrm_policy *pol); 317int km_query(struct xfrm_state *x, struct xfrm_tmpl *t,
317extern void km_state_expired(struct xfrm_state *x, int hard, u32 portid); 318 struct xfrm_policy *pol);
318extern int __xfrm_state_delete(struct xfrm_state *x); 319void km_state_expired(struct xfrm_state *x, int hard, u32 portid);
320int __xfrm_state_delete(struct xfrm_state *x);
319 321
320struct xfrm_state_afinfo { 322struct xfrm_state_afinfo {
321 unsigned int family; 323 unsigned int family;
@@ -344,12 +346,12 @@ struct xfrm_state_afinfo {
344 void (*local_error)(struct sk_buff *skb, u32 mtu); 346 void (*local_error)(struct sk_buff *skb, u32 mtu);
345}; 347};
346 348
347extern int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo); 349int xfrm_state_register_afinfo(struct xfrm_state_afinfo *afinfo);
348extern int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo); 350int xfrm_state_unregister_afinfo(struct xfrm_state_afinfo *afinfo);
349extern struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family); 351struct xfrm_state_afinfo *xfrm_state_get_afinfo(unsigned int family);
350extern void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo); 352void xfrm_state_put_afinfo(struct xfrm_state_afinfo *afinfo);
351 353
352extern void xfrm_state_delete_tunnel(struct xfrm_state *x); 354void xfrm_state_delete_tunnel(struct xfrm_state *x);
353 355
354struct xfrm_type { 356struct xfrm_type {
355 char *description; 357 char *description;
@@ -372,8 +374,8 @@ struct xfrm_type {
372 u32 (*get_mtu)(struct xfrm_state *, int size); 374 u32 (*get_mtu)(struct xfrm_state *, int size);
373}; 375};
374 376
375extern int xfrm_register_type(const struct xfrm_type *type, unsigned short family); 377int xfrm_register_type(const struct xfrm_type *type, unsigned short family);
376extern int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family); 378int xfrm_unregister_type(const struct xfrm_type *type, unsigned short family);
377 379
378struct xfrm_mode { 380struct xfrm_mode {
379 /* 381 /*
@@ -434,8 +436,8 @@ enum {
434 XFRM_MODE_FLAG_TUNNEL = 1, 436 XFRM_MODE_FLAG_TUNNEL = 1,
435}; 437};
436 438
437extern int xfrm_register_mode(struct xfrm_mode *mode, int family); 439int xfrm_register_mode(struct xfrm_mode *mode, int family);
438extern int xfrm_unregister_mode(struct xfrm_mode *mode, int family); 440int xfrm_unregister_mode(struct xfrm_mode *mode, int family);
439 441
440static inline int xfrm_af2proto(unsigned int family) 442static inline int xfrm_af2proto(unsigned int family)
441{ 443{
@@ -595,8 +597,8 @@ struct xfrm_mgr {
595 const struct xfrm_kmaddress *k); 597 const struct xfrm_kmaddress *k);
596}; 598};
597 599
598extern int xfrm_register_km(struct xfrm_mgr *km); 600int xfrm_register_km(struct xfrm_mgr *km);
599extern int xfrm_unregister_km(struct xfrm_mgr *km); 601int xfrm_unregister_km(struct xfrm_mgr *km);
600 602
601/* 603/*
602 * This structure is used for the duration where packets are being 604 * This structure is used for the duration where packets are being
@@ -713,23 +715,23 @@ static inline void xfrm_audit_helper_usrinfo(kuid_t auid, u32 ses, u32 secid,
713 audit_log_task_context(audit_buf); 715 audit_log_task_context(audit_buf);
714} 716}
715 717
716extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 718void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, kuid_t auid,
717 kuid_t auid, u32 ses, u32 secid); 719 u32 ses, u32 secid);
718extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, 720void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, kuid_t auid,
719 kuid_t auid, u32 ses, u32 secid); 721 u32 ses, u32 secid);
720extern void xfrm_audit_state_add(struct xfrm_state *x, int result, 722void xfrm_audit_state_add(struct xfrm_state *x, int result, kuid_t auid,
721 kuid_t auid, u32 ses, u32 secid); 723 u32 ses, u32 secid);
722extern void xfrm_audit_state_delete(struct xfrm_state *x, int result, 724void xfrm_audit_state_delete(struct xfrm_state *x, int result, kuid_t auid,
723 kuid_t auid, u32 ses, u32 secid); 725 u32 ses, u32 secid);
724extern void xfrm_audit_state_replay_overflow(struct xfrm_state *x, 726void xfrm_audit_state_replay_overflow(struct xfrm_state *x,
725 struct sk_buff *skb); 727 struct sk_buff *skb);
726extern void xfrm_audit_state_replay(struct xfrm_state *x, 728void xfrm_audit_state_replay(struct xfrm_state *x, struct sk_buff *skb,
727 struct sk_buff *skb, __be32 net_seq); 729 __be32 net_seq);
728extern void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family); 730void xfrm_audit_state_notfound_simple(struct sk_buff *skb, u16 family);
729extern void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, 731void xfrm_audit_state_notfound(struct sk_buff *skb, u16 family, __be32 net_spi,
730 __be32 net_spi, __be32 net_seq); 732 __be32 net_seq);
731extern void xfrm_audit_state_icvfail(struct xfrm_state *x, 733void xfrm_audit_state_icvfail(struct xfrm_state *x, struct sk_buff *skb,
732 struct sk_buff *skb, u8 proto); 734 u8 proto);
733#else 735#else
734 736
735static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, 737static inline void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
@@ -784,7 +786,7 @@ static inline void xfrm_pol_hold(struct xfrm_policy *policy)
784 atomic_inc(&policy->refcnt); 786 atomic_inc(&policy->refcnt);
785} 787}
786 788
787extern void xfrm_policy_destroy(struct xfrm_policy *policy); 789void xfrm_policy_destroy(struct xfrm_policy *policy);
788 790
789static inline void xfrm_pol_put(struct xfrm_policy *policy) 791static inline void xfrm_pol_put(struct xfrm_policy *policy)
790{ 792{
@@ -799,7 +801,7 @@ static inline void xfrm_pols_put(struct xfrm_policy **pols, int npols)
799 xfrm_pol_put(pols[i]); 801 xfrm_pol_put(pols[i]);
800} 802}
801 803
802extern void __xfrm_state_destroy(struct xfrm_state *); 804void __xfrm_state_destroy(struct xfrm_state *);
803 805
804static inline void __xfrm_state_put(struct xfrm_state *x) 806static inline void __xfrm_state_put(struct xfrm_state *x)
805{ 807{
@@ -903,9 +905,8 @@ __be16 xfrm_flowi_dport(const struct flowi *fl, const union flowi_uli *uli)
903 return port; 905 return port;
904} 906}
905 907
906extern bool xfrm_selector_match(const struct xfrm_selector *sel, 908bool xfrm_selector_match(const struct xfrm_selector *sel,
907 const struct flowi *fl, 909 const struct flowi *fl, unsigned short family);
908 unsigned short family);
909 910
910#ifdef CONFIG_SECURITY_NETWORK_XFRM 911#ifdef CONFIG_SECURITY_NETWORK_XFRM
911/* If neither has a context --> match 912/* If neither has a context --> match
@@ -975,7 +976,7 @@ static inline void xfrm_dst_destroy(struct xfrm_dst *xdst)
975} 976}
976#endif 977#endif
977 978
978extern void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev); 979void xfrm_dst_ifdown(struct dst_entry *dst, struct net_device *dev);
979 980
980struct sec_path { 981struct sec_path {
981 atomic_t refcnt; 982 atomic_t refcnt;
@@ -1000,7 +1001,7 @@ secpath_get(struct sec_path *sp)
1000 return sp; 1001 return sp;
1001} 1002}
1002 1003
1003extern void __secpath_destroy(struct sec_path *sp); 1004void __secpath_destroy(struct sec_path *sp);
1004 1005
1005static inline void 1006static inline void
1006secpath_put(struct sec_path *sp) 1007secpath_put(struct sec_path *sp)
@@ -1009,7 +1010,7 @@ secpath_put(struct sec_path *sp)
1009 __secpath_destroy(sp); 1010 __secpath_destroy(sp);
1010} 1011}
1011 1012
1012extern struct sec_path *secpath_dup(struct sec_path *src); 1013struct sec_path *secpath_dup(struct sec_path *src);
1013 1014
1014static inline void 1015static inline void
1015secpath_reset(struct sk_buff *skb) 1016secpath_reset(struct sk_buff *skb)
@@ -1059,7 +1060,8 @@ xfrm_state_addr_cmp(const struct xfrm_tmpl *tmpl, const struct xfrm_state *x, un
1059} 1060}
1060 1061
1061#ifdef CONFIG_XFRM 1062#ifdef CONFIG_XFRM
1062extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family); 1063int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb,
1064 unsigned short family);
1063 1065
1064static inline int __xfrm_policy_check2(struct sock *sk, int dir, 1066static inline int __xfrm_policy_check2(struct sock *sk, int dir,
1065 struct sk_buff *skb, 1067 struct sk_buff *skb,
@@ -1103,8 +1105,8 @@ static inline int xfrm6_policy_check_reverse(struct sock *sk, int dir,
1103 return __xfrm_policy_check2(sk, dir, skb, AF_INET6, 1); 1105 return __xfrm_policy_check2(sk, dir, skb, AF_INET6, 1);
1104} 1106}
1105 1107
1106extern int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, 1108int __xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
1107 unsigned int family, int reverse); 1109 unsigned int family, int reverse);
1108 1110
1109static inline int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl, 1111static inline int xfrm_decode_session(struct sk_buff *skb, struct flowi *fl,
1110 unsigned int family) 1112 unsigned int family)
@@ -1119,7 +1121,7 @@ static inline int xfrm_decode_session_reverse(struct sk_buff *skb,
1119 return __xfrm_decode_session(skb, fl, family, 1); 1121 return __xfrm_decode_session(skb, fl, family, 1);
1120} 1122}
1121 1123
1122extern int __xfrm_route_forward(struct sk_buff *skb, unsigned short family); 1124int __xfrm_route_forward(struct sk_buff *skb, unsigned short family);
1123 1125
1124static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family) 1126static inline int xfrm_route_forward(struct sk_buff *skb, unsigned short family)
1125{ 1127{
@@ -1140,7 +1142,7 @@ static inline int xfrm6_route_forward(struct sk_buff *skb)
1140 return xfrm_route_forward(skb, AF_INET6); 1142 return xfrm_route_forward(skb, AF_INET6);
1141} 1143}
1142 1144
1143extern int __xfrm_sk_clone_policy(struct sock *sk); 1145int __xfrm_sk_clone_policy(struct sock *sk);
1144 1146
1145static inline int xfrm_sk_clone_policy(struct sock *sk) 1147static inline int xfrm_sk_clone_policy(struct sock *sk)
1146{ 1148{
@@ -1149,7 +1151,7 @@ static inline int xfrm_sk_clone_policy(struct sock *sk)
1149 return 0; 1151 return 0;
1150} 1152}
1151 1153
1152extern int xfrm_policy_delete(struct xfrm_policy *pol, int dir); 1154int xfrm_policy_delete(struct xfrm_policy *pol, int dir);
1153 1155
1154static inline void xfrm_sk_free_policy(struct sock *sk) 1156static inline void xfrm_sk_free_policy(struct sock *sk)
1155{ 1157{
@@ -1163,7 +1165,7 @@ static inline void xfrm_sk_free_policy(struct sock *sk)
1163 } 1165 }
1164} 1166}
1165 1167
1166extern void xfrm_garbage_collect(struct net *net); 1168void xfrm_garbage_collect(struct net *net);
1167 1169
1168#else 1170#else
1169 1171
@@ -1355,6 +1357,12 @@ struct xfrm_tunnel {
1355 int priority; 1357 int priority;
1356}; 1358};
1357 1359
1360struct xfrm_tunnel_notifier {
1361 int (*handler)(struct sk_buff *skb);
1362 struct xfrm_tunnel_notifier __rcu *next;
1363 int priority;
1364};
1365
1358struct xfrm6_tunnel { 1366struct xfrm6_tunnel {
1359 int (*handler)(struct sk_buff *skb); 1367 int (*handler)(struct sk_buff *skb);
1360 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt, 1368 int (*err_handler)(struct sk_buff *skb, struct inet6_skb_parm *opt,
@@ -1363,16 +1371,16 @@ struct xfrm6_tunnel {
1363 int priority; 1371 int priority;
1364}; 1372};
1365 1373
1366extern void xfrm_init(void); 1374void xfrm_init(void);
1367extern void xfrm4_init(void); 1375void xfrm4_init(void);
1368extern int xfrm_state_init(struct net *net); 1376int xfrm_state_init(struct net *net);
1369extern void xfrm_state_fini(struct net *net); 1377void xfrm_state_fini(struct net *net);
1370extern void xfrm4_state_init(void); 1378void xfrm4_state_init(void);
1371#ifdef CONFIG_XFRM 1379#ifdef CONFIG_XFRM
1372extern int xfrm6_init(void); 1380int xfrm6_init(void);
1373extern void xfrm6_fini(void); 1381void xfrm6_fini(void);
1374extern int xfrm6_state_init(void); 1382int xfrm6_state_init(void);
1375extern void xfrm6_state_fini(void); 1383void xfrm6_state_fini(void);
1376#else 1384#else
1377static inline int xfrm6_init(void) 1385static inline int xfrm6_init(void)
1378{ 1386{
@@ -1385,52 +1393,52 @@ static inline void xfrm6_fini(void)
1385#endif 1393#endif
1386 1394
1387#ifdef CONFIG_XFRM_STATISTICS 1395#ifdef CONFIG_XFRM_STATISTICS
1388extern int xfrm_proc_init(struct net *net); 1396int xfrm_proc_init(struct net *net);
1389extern void xfrm_proc_fini(struct net *net); 1397void xfrm_proc_fini(struct net *net);
1390#endif 1398#endif
1391 1399
1392extern int xfrm_sysctl_init(struct net *net); 1400int xfrm_sysctl_init(struct net *net);
1393#ifdef CONFIG_SYSCTL 1401#ifdef CONFIG_SYSCTL
1394extern void xfrm_sysctl_fini(struct net *net); 1402void xfrm_sysctl_fini(struct net *net);
1395#else 1403#else
1396static inline void xfrm_sysctl_fini(struct net *net) 1404static inline void xfrm_sysctl_fini(struct net *net)
1397{ 1405{
1398} 1406}
1399#endif 1407#endif
1400 1408
1401extern void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto); 1409void xfrm_state_walk_init(struct xfrm_state_walk *walk, u8 proto);
1402extern int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk, 1410int xfrm_state_walk(struct net *net, struct xfrm_state_walk *walk,
1403 int (*func)(struct xfrm_state *, int, void*), void *); 1411 int (*func)(struct xfrm_state *, int, void*), void *);
1404extern void xfrm_state_walk_done(struct xfrm_state_walk *walk); 1412void xfrm_state_walk_done(struct xfrm_state_walk *walk);
1405extern struct xfrm_state *xfrm_state_alloc(struct net *net); 1413struct xfrm_state *xfrm_state_alloc(struct net *net);
1406extern struct xfrm_state *xfrm_state_find(const xfrm_address_t *daddr, 1414struct xfrm_state *xfrm_state_find(const xfrm_address_t *daddr,
1407 const xfrm_address_t *saddr, 1415 const xfrm_address_t *saddr,
1408 const struct flowi *fl, 1416 const struct flowi *fl,
1409 struct xfrm_tmpl *tmpl, 1417 struct xfrm_tmpl *tmpl,
1410 struct xfrm_policy *pol, int *err, 1418 struct xfrm_policy *pol, int *err,
1411 unsigned short family); 1419 unsigned short family);
1412extern struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark, 1420struct xfrm_state *xfrm_stateonly_find(struct net *net, u32 mark,
1413 xfrm_address_t *daddr, 1421 xfrm_address_t *daddr,
1414 xfrm_address_t *saddr, 1422 xfrm_address_t *saddr,
1415 unsigned short family, 1423 unsigned short family,
1416 u8 mode, u8 proto, u32 reqid); 1424 u8 mode, u8 proto, u32 reqid);
1417extern int xfrm_state_check_expire(struct xfrm_state *x); 1425int xfrm_state_check_expire(struct xfrm_state *x);
1418extern void xfrm_state_insert(struct xfrm_state *x); 1426void xfrm_state_insert(struct xfrm_state *x);
1419extern int xfrm_state_add(struct xfrm_state *x); 1427int xfrm_state_add(struct xfrm_state *x);
1420extern int xfrm_state_update(struct xfrm_state *x); 1428int xfrm_state_update(struct xfrm_state *x);
1421extern struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark, 1429struct xfrm_state *xfrm_state_lookup(struct net *net, u32 mark,
1422 const xfrm_address_t *daddr, __be32 spi, 1430 const xfrm_address_t *daddr, __be32 spi,
1423 u8 proto, unsigned short family); 1431 u8 proto, unsigned short family);
1424extern struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark, 1432struct xfrm_state *xfrm_state_lookup_byaddr(struct net *net, u32 mark,
1425 const xfrm_address_t *daddr, 1433 const xfrm_address_t *daddr,
1426 const xfrm_address_t *saddr, 1434 const xfrm_address_t *saddr,
1427 u8 proto, 1435 u8 proto,
1428 unsigned short family); 1436 unsigned short family);
1429#ifdef CONFIG_XFRM_SUB_POLICY 1437#ifdef CONFIG_XFRM_SUB_POLICY
1430extern int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 1438int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, int n,
1431 int n, unsigned short family); 1439 unsigned short family);
1432extern int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, 1440int xfrm_state_sort(struct xfrm_state **dst, struct xfrm_state **src, int n,
1433 int n, unsigned short family); 1441 unsigned short family);
1434#else 1442#else
1435static inline int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src, 1443static inline int xfrm_tmpl_sort(struct xfrm_tmpl **dst, struct xfrm_tmpl **src,
1436 int n, unsigned short family) 1444 int n, unsigned short family)
@@ -1462,68 +1470,69 @@ struct xfrmk_spdinfo {
1462 u32 spdhmcnt; 1470 u32 spdhmcnt;
1463}; 1471};
1464 1472
1465extern struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, 1473struct xfrm_state *xfrm_find_acq_byseq(struct net *net, u32 mark, u32 seq);
1466 u32 seq); 1474int xfrm_state_delete(struct xfrm_state *x);
1467extern int xfrm_state_delete(struct xfrm_state *x); 1475int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info);
1468extern int xfrm_state_flush(struct net *net, u8 proto, struct xfrm_audit *audit_info); 1476void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si);
1469extern void xfrm_sad_getinfo(struct net *net, struct xfrmk_sadinfo *si); 1477void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si);
1470extern void xfrm_spd_getinfo(struct net *net, struct xfrmk_spdinfo *si); 1478u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq);
1471extern u32 xfrm_replay_seqhi(struct xfrm_state *x, __be32 net_seq); 1479int xfrm_init_replay(struct xfrm_state *x);
1472extern int xfrm_init_replay(struct xfrm_state *x); 1480int xfrm_state_mtu(struct xfrm_state *x, int mtu);
1473extern int xfrm_state_mtu(struct xfrm_state *x, int mtu); 1481int __xfrm_init_state(struct xfrm_state *x, bool init_replay);
1474extern int __xfrm_init_state(struct xfrm_state *x, bool init_replay); 1482int xfrm_init_state(struct xfrm_state *x);
1475extern int xfrm_init_state(struct xfrm_state *x); 1483int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb);
1476extern int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb); 1484int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, int encap_type);
1477extern int xfrm_input(struct sk_buff *skb, int nexthdr, __be32 spi, 1485int xfrm_input_resume(struct sk_buff *skb, int nexthdr);
1478 int encap_type); 1486int xfrm_output_resume(struct sk_buff *skb, int err);
1479extern int xfrm_input_resume(struct sk_buff *skb, int nexthdr); 1487int xfrm_output(struct sk_buff *skb);
1480extern int xfrm_output_resume(struct sk_buff *skb, int err); 1488int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1481extern int xfrm_output(struct sk_buff *skb); 1489void xfrm_local_error(struct sk_buff *skb, int mtu);
1482extern int xfrm_inner_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1490int xfrm4_extract_header(struct sk_buff *skb);
1483extern void xfrm_local_error(struct sk_buff *skb, int mtu); 1491int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb);
1484extern int xfrm4_extract_header(struct sk_buff *skb); 1492int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi,
1485extern int xfrm4_extract_input(struct xfrm_state *x, struct sk_buff *skb); 1493 int encap_type);
1486extern int xfrm4_rcv_encap(struct sk_buff *skb, int nexthdr, __be32 spi, 1494int xfrm4_transport_finish(struct sk_buff *skb, int async);
1487 int encap_type); 1495int xfrm4_rcv(struct sk_buff *skb);
1488extern int xfrm4_transport_finish(struct sk_buff *skb, int async);
1489extern int xfrm4_rcv(struct sk_buff *skb);
1490 1496
1491static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi) 1497static inline int xfrm4_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi)
1492{ 1498{
1493 return xfrm4_rcv_encap(skb, nexthdr, spi, 0); 1499 return xfrm4_rcv_encap(skb, nexthdr, spi, 0);
1494} 1500}
1495 1501
1496extern int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1502int xfrm4_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1497extern int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1503int xfrm4_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1498extern int xfrm4_output(struct sk_buff *skb); 1504int xfrm4_output(struct sk_buff *skb);
1499extern int xfrm4_output_finish(struct sk_buff *skb); 1505int xfrm4_output_finish(struct sk_buff *skb);
1500extern int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family); 1506int xfrm4_tunnel_register(struct xfrm_tunnel *handler, unsigned short family);
1501extern int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family); 1507int xfrm4_tunnel_deregister(struct xfrm_tunnel *handler, unsigned short family);
1502extern int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel *handler); 1508void xfrm4_local_error(struct sk_buff *skb, u32 mtu);
1503extern int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel *handler); 1509int xfrm4_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
1504extern void xfrm4_local_error(struct sk_buff *skb, u32 mtu); 1510int xfrm4_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
1505extern int xfrm6_extract_header(struct sk_buff *skb); 1511int xfrm6_mode_tunnel_input_register(struct xfrm_tunnel_notifier *handler);
1506extern int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb); 1512int xfrm6_mode_tunnel_input_deregister(struct xfrm_tunnel_notifier *handler);
1507extern int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi); 1513int xfrm6_extract_header(struct sk_buff *skb);
1508extern int xfrm6_transport_finish(struct sk_buff *skb, int async); 1514int xfrm6_extract_input(struct xfrm_state *x, struct sk_buff *skb);
1509extern int xfrm6_rcv(struct sk_buff *skb); 1515int xfrm6_rcv_spi(struct sk_buff *skb, int nexthdr, __be32 spi);
1510extern int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr, 1516int xfrm6_transport_finish(struct sk_buff *skb, int async);
1511 xfrm_address_t *saddr, u8 proto); 1517int xfrm6_rcv(struct sk_buff *skb);
1512extern int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family); 1518int xfrm6_input_addr(struct sk_buff *skb, xfrm_address_t *daddr,
1513extern int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family); 1519 xfrm_address_t *saddr, u8 proto);
1514extern __be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr); 1520void xfrm6_local_error(struct sk_buff *skb, u32 mtu);
1515extern __be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr); 1521int xfrm6_tunnel_register(struct xfrm6_tunnel *handler, unsigned short family);
1516extern int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb); 1522int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler, unsigned short family);
1517extern int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb); 1523__be32 xfrm6_tunnel_alloc_spi(struct net *net, xfrm_address_t *saddr);
1518extern int xfrm6_output(struct sk_buff *skb); 1524__be32 xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr);
1519extern int xfrm6_output_finish(struct sk_buff *skb); 1525int xfrm6_extract_output(struct xfrm_state *x, struct sk_buff *skb);
1520extern int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb, 1526int xfrm6_prepare_output(struct xfrm_state *x, struct sk_buff *skb);
1521 u8 **prevhdr); 1527int xfrm6_output(struct sk_buff *skb);
1522extern void xfrm6_local_error(struct sk_buff *skb, u32 mtu); 1528int xfrm6_output_finish(struct sk_buff *skb);
1529int xfrm6_find_1stfragopt(struct xfrm_state *x, struct sk_buff *skb,
1530 u8 **prevhdr);
1523 1531
1524#ifdef CONFIG_XFRM 1532#ifdef CONFIG_XFRM
1525extern int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb); 1533int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb);
1526extern int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen); 1534int xfrm_user_policy(struct sock *sk, int optname,
1535 u8 __user *optval, int optlen);
1527#else 1536#else
1528static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen) 1537static inline int xfrm_user_policy(struct sock *sk, int optname, u8 __user *optval, int optlen)
1529{ 1538{
@@ -1540,59 +1549,62 @@ static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb)
1540 1549
1541struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp); 1550struct xfrm_policy *xfrm_policy_alloc(struct net *net, gfp_t gfp);
1542 1551
1543extern void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type); 1552void xfrm_policy_walk_init(struct xfrm_policy_walk *walk, u8 type);
1544extern int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk, 1553int xfrm_policy_walk(struct net *net, struct xfrm_policy_walk *walk,
1545 int (*func)(struct xfrm_policy *, int, int, void*), void *); 1554 int (*func)(struct xfrm_policy *, int, int, void*),
1546extern void xfrm_policy_walk_done(struct xfrm_policy_walk *walk); 1555 void *);
1556void xfrm_policy_walk_done(struct xfrm_policy_walk *walk);
1547int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); 1557int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl);
1548struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark, 1558struct xfrm_policy *xfrm_policy_bysel_ctx(struct net *net, u32 mark,
1549 u8 type, int dir, 1559 u8 type, int dir,
1550 struct xfrm_selector *sel, 1560 struct xfrm_selector *sel,
1551 struct xfrm_sec_ctx *ctx, int delete, 1561 struct xfrm_sec_ctx *ctx, int delete,
1552 int *err); 1562 int *err);
1553struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir, u32 id, int delete, int *err); 1563struct xfrm_policy *xfrm_policy_byid(struct net *net, u32 mark, u8, int dir,
1564 u32 id, int delete, int *err);
1554int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info); 1565int xfrm_policy_flush(struct net *net, u8 type, struct xfrm_audit *audit_info);
1555u32 xfrm_get_acqseq(void); 1566u32 xfrm_get_acqseq(void);
1556extern int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi); 1567int xfrm_alloc_spi(struct xfrm_state *x, u32 minspi, u32 maxspi);
1557struct xfrm_state *xfrm_find_acq(struct net *net, const struct xfrm_mark *mark, 1568struct xfrm_state *xfrm_find_acq(struct net *net, const struct xfrm_mark *mark,
1558 u8 mode, u32 reqid, u8 proto, 1569 u8 mode, u32 reqid, u8 proto,
1559 const xfrm_address_t *daddr, 1570 const xfrm_address_t *daddr,
1560 const xfrm_address_t *saddr, int create, 1571 const xfrm_address_t *saddr, int create,
1561 unsigned short family); 1572 unsigned short family);
1562extern int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol); 1573int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol);
1563 1574
1564#ifdef CONFIG_XFRM_MIGRATE 1575#ifdef CONFIG_XFRM_MIGRATE
1565extern int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, 1576int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1566 const struct xfrm_migrate *m, int num_bundles, 1577 const struct xfrm_migrate *m, int num_bundles,
1567 const struct xfrm_kmaddress *k); 1578 const struct xfrm_kmaddress *k);
1568extern struct xfrm_state * xfrm_migrate_state_find(struct xfrm_migrate *m); 1579struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m);
1569extern struct xfrm_state * xfrm_state_migrate(struct xfrm_state *x, 1580struct xfrm_state *xfrm_state_migrate(struct xfrm_state *x,
1570 struct xfrm_migrate *m); 1581 struct xfrm_migrate *m);
1571extern int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type, 1582int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
1572 struct xfrm_migrate *m, int num_bundles, 1583 struct xfrm_migrate *m, int num_bundles,
1573 struct xfrm_kmaddress *k); 1584 struct xfrm_kmaddress *k);
1574#endif 1585#endif
1575 1586
1576extern int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport); 1587int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
1577extern void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 portid); 1588void km_policy_expired(struct xfrm_policy *pol, int dir, int hard, u32 portid);
1578extern int km_report(struct net *net, u8 proto, struct xfrm_selector *sel, xfrm_address_t *addr); 1589int km_report(struct net *net, u8 proto, struct xfrm_selector *sel,
1579 1590 xfrm_address_t *addr);
1580extern void xfrm_input_init(void); 1591
1581extern int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq); 1592void xfrm_input_init(void);
1582 1593int xfrm_parse_spi(struct sk_buff *skb, u8 nexthdr, __be32 *spi, __be32 *seq);
1583extern void xfrm_probe_algs(void); 1594
1584extern int xfrm_count_pfkey_auth_supported(void); 1595void xfrm_probe_algs(void);
1585extern int xfrm_count_pfkey_enc_supported(void); 1596int xfrm_count_pfkey_auth_supported(void);
1586extern struct xfrm_algo_desc *xfrm_aalg_get_byidx(unsigned int idx); 1597int xfrm_count_pfkey_enc_supported(void);
1587extern struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx); 1598struct xfrm_algo_desc *xfrm_aalg_get_byidx(unsigned int idx);
1588extern struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id); 1599struct xfrm_algo_desc *xfrm_ealg_get_byidx(unsigned int idx);
1589extern struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id); 1600struct xfrm_algo_desc *xfrm_aalg_get_byid(int alg_id);
1590extern struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id); 1601struct xfrm_algo_desc *xfrm_ealg_get_byid(int alg_id);
1591extern struct xfrm_algo_desc *xfrm_aalg_get_byname(const char *name, int probe); 1602struct xfrm_algo_desc *xfrm_calg_get_byid(int alg_id);
1592extern struct xfrm_algo_desc *xfrm_ealg_get_byname(const char *name, int probe); 1603struct xfrm_algo_desc *xfrm_aalg_get_byname(const char *name, int probe);
1593extern struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe); 1604struct xfrm_algo_desc *xfrm_ealg_get_byname(const char *name, int probe);
1594extern struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len, 1605struct xfrm_algo_desc *xfrm_calg_get_byname(const char *name, int probe);
1595 int probe); 1606struct xfrm_algo_desc *xfrm_aead_get_byname(const char *name, int icv_len,
1607 int probe);
1596 1608
1597static inline bool xfrm6_addr_equal(const xfrm_address_t *a, 1609static inline bool xfrm6_addr_equal(const xfrm_address_t *a,
1598 const xfrm_address_t *b) 1610 const xfrm_address_t *b)