aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bluetooth/bluetooth.h2
-rw-r--r--include/net/bluetooth/hci_core.h6
-rw-r--r--include/net/bluetooth/l2cap.h12
-rw-r--r--include/net/flow.h10
-rw-r--r--include/net/inetpeer.h4
-rw-r--r--include/net/netfilter/nf_conntrack.h2
-rw-r--r--include/net/netns/generic.h1
-rw-r--r--include/net/netprio_cgroup.h48
-rw-r--r--include/net/route.h4
-rw-r--r--include/net/rtnetlink.h2
-rw-r--r--include/net/sch_generic.h9
-rw-r--r--include/net/sock.h1
-rw-r--r--include/net/tcp.h21
13 files changed, 95 insertions, 27 deletions
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index abaad6ed9b83..4a82ca0bb0b2 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -256,4 +256,6 @@ void l2cap_exit(void);
256int sco_init(void); 256int sco_init(void);
257void sco_exit(void); 257void sco_exit(void);
258 258
259void bt_sock_reclassify_lock(struct sock *sk, int proto);
260
259#endif /* __BLUETOOTH_H */ 261#endif /* __BLUETOOTH_H */
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index ea9231f4935f..453893b3120e 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -540,7 +540,7 @@ void hci_conn_put_device(struct hci_conn *conn);
540static inline void hci_conn_hold(struct hci_conn *conn) 540static inline void hci_conn_hold(struct hci_conn *conn)
541{ 541{
542 atomic_inc(&conn->refcnt); 542 atomic_inc(&conn->refcnt);
543 cancel_delayed_work_sync(&conn->disc_work); 543 cancel_delayed_work(&conn->disc_work);
544} 544}
545 545
546static inline void hci_conn_put(struct hci_conn *conn) 546static inline void hci_conn_put(struct hci_conn *conn)
@@ -559,9 +559,9 @@ static inline void hci_conn_put(struct hci_conn *conn)
559 } else { 559 } else {
560 timeo = msecs_to_jiffies(10); 560 timeo = msecs_to_jiffies(10);
561 } 561 }
562 cancel_delayed_work_sync(&conn->disc_work); 562 cancel_delayed_work(&conn->disc_work);
563 queue_delayed_work(conn->hdev->workqueue, 563 queue_delayed_work(conn->hdev->workqueue,
564 &conn->disc_work, jiffies + timeo); 564 &conn->disc_work, timeo);
565 } 565 }
566} 566}
567 567
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 68f589150692..b1664ed884e6 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -611,7 +611,7 @@ static inline void l2cap_set_timer(struct l2cap_chan *chan,
611{ 611{
612 BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout); 612 BT_DBG("chan %p state %d timeout %ld", chan, chan->state, timeout);
613 613
614 if (!__cancel_delayed_work(work)) 614 if (!cancel_delayed_work(work))
615 l2cap_chan_hold(chan); 615 l2cap_chan_hold(chan);
616 schedule_delayed_work(work, timeout); 616 schedule_delayed_work(work, timeout);
617} 617}
@@ -619,20 +619,20 @@ static inline void l2cap_set_timer(struct l2cap_chan *chan,
619static inline void l2cap_clear_timer(struct l2cap_chan *chan, 619static inline void l2cap_clear_timer(struct l2cap_chan *chan,
620 struct delayed_work *work) 620 struct delayed_work *work)
621{ 621{
622 if (__cancel_delayed_work(work)) 622 if (cancel_delayed_work(work))
623 l2cap_chan_put(chan); 623 l2cap_chan_put(chan);
624} 624}
625 625
626#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t)) 626#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
627#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer) 627#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
628#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \ 628#define __set_retrans_timer(c) l2cap_set_timer(c, &c->retrans_timer, \
629 L2CAP_DEFAULT_RETRANS_TO); 629 msecs_to_jiffies(L2CAP_DEFAULT_RETRANS_TO));
630#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer) 630#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer)
631#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \ 631#define __set_monitor_timer(c) l2cap_set_timer(c, &c->monitor_timer, \
632 L2CAP_DEFAULT_MONITOR_TO); 632 msecs_to_jiffies(L2CAP_DEFAULT_MONITOR_TO));
633#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer) 633#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer)
634#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \ 634#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \
635 L2CAP_DEFAULT_ACK_TO); 635 msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
636#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer) 636#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer)
637 637
638static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2) 638static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
@@ -834,7 +834,7 @@ int l2cap_add_scid(struct l2cap_chan *chan, __u16 scid);
834struct l2cap_chan *l2cap_chan_create(struct sock *sk); 834struct l2cap_chan *l2cap_chan_create(struct sock *sk);
835void l2cap_chan_close(struct l2cap_chan *chan, int reason); 835void l2cap_chan_close(struct l2cap_chan *chan, int reason);
836void l2cap_chan_destroy(struct l2cap_chan *chan); 836void l2cap_chan_destroy(struct l2cap_chan *chan);
837inline int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid, 837int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
838 bdaddr_t *dst); 838 bdaddr_t *dst);
839int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len, 839int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
840 u32 priority); 840 u32 priority);
diff --git a/include/net/flow.h b/include/net/flow.h
index 9b582437fbea..6c469dbdb917 100644
--- a/include/net/flow.h
+++ b/include/net/flow.h
@@ -93,6 +93,16 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
93 fl4->fl4_dport = dport; 93 fl4->fl4_dport = dport;
94 fl4->fl4_sport = sport; 94 fl4->fl4_sport = sport;
95} 95}
96
97/* Reset some input parameters after previous lookup */
98static inline void flowi4_update_output(struct flowi4 *fl4, int oif, __u8 tos,
99 __be32 daddr, __be32 saddr)
100{
101 fl4->flowi4_oif = oif;
102 fl4->flowi4_tos = tos;
103 fl4->daddr = daddr;
104 fl4->saddr = saddr;
105}
96 106
97 107
98struct flowi6 { 108struct flowi6 {
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index 06b795dd5906..b94765e38e80 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -35,12 +35,12 @@ struct inet_peer {
35 35
36 u32 metrics[RTAX_MAX]; 36 u32 metrics[RTAX_MAX];
37 u32 rate_tokens; /* rate limiting for ICMP */ 37 u32 rate_tokens; /* rate limiting for ICMP */
38 int redirect_genid;
39 unsigned long rate_last; 38 unsigned long rate_last;
40 unsigned long pmtu_expires; 39 unsigned long pmtu_expires;
41 u32 pmtu_orig; 40 u32 pmtu_orig;
42 u32 pmtu_learned; 41 u32 pmtu_learned;
43 struct inetpeer_addr_base redirect_learned; 42 struct inetpeer_addr_base redirect_learned;
43 struct list_head gc_list;
44 /* 44 /*
45 * Once inet_peer is queued for deletion (refcnt == -1), following fields 45 * Once inet_peer is queued for deletion (refcnt == -1), following fields
46 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp 46 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp
@@ -96,6 +96,8 @@ static inline struct inet_peer *inet_getpeer_v6(const struct in6_addr *v6daddr,
96extern void inet_putpeer(struct inet_peer *p); 96extern void inet_putpeer(struct inet_peer *p);
97extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout); 97extern bool inet_peer_xrlim_allow(struct inet_peer *peer, int timeout);
98 98
99extern void inetpeer_invalidate_tree(int family);
100
99/* 101/*
100 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts, 102 * temporary check to make sure we dont access rid, ip_id_count, tcp_ts,
101 * tcp_ts_stamp if no refcount is taken on inet_peer 103 * tcp_ts_stamp if no refcount is taken on inet_peer
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 8a2b0ae7dbd2..ab86036bbf0c 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -209,7 +209,7 @@ extern struct nf_conntrack_tuple_hash *
209__nf_conntrack_find(struct net *net, u16 zone, 209__nf_conntrack_find(struct net *net, u16 zone,
210 const struct nf_conntrack_tuple *tuple); 210 const struct nf_conntrack_tuple *tuple);
211 211
212extern void nf_conntrack_hash_insert(struct nf_conn *ct); 212extern int nf_conntrack_hash_check_insert(struct nf_conn *ct);
213extern void nf_ct_delete_from_lists(struct nf_conn *ct); 213extern void nf_ct_delete_from_lists(struct nf_conn *ct);
214extern void nf_ct_insert_dying_list(struct nf_conn *ct); 214extern void nf_ct_insert_dying_list(struct nf_conn *ct);
215 215
diff --git a/include/net/netns/generic.h b/include/net/netns/generic.h
index 3419bf5cd154..d55f43443335 100644
--- a/include/net/netns/generic.h
+++ b/include/net/netns/generic.h
@@ -41,6 +41,7 @@ static inline void *net_generic(const struct net *net, int id)
41 ptr = ng->ptr[id - 1]; 41 ptr = ng->ptr[id - 1];
42 rcu_read_unlock(); 42 rcu_read_unlock();
43 43
44 BUG_ON(!ptr);
44 return ptr; 45 return ptr;
45} 46}
46#endif 47#endif
diff --git a/include/net/netprio_cgroup.h b/include/net/netprio_cgroup.h
index 7b2d43139c8e..d58fdec47597 100644
--- a/include/net/netprio_cgroup.h
+++ b/include/net/netprio_cgroup.h
@@ -37,19 +37,51 @@ extern int net_prio_subsys_id;
37 37
38extern void sock_update_netprioidx(struct sock *sk); 38extern void sock_update_netprioidx(struct sock *sk);
39 39
40static inline struct cgroup_netprio_state 40#if IS_BUILTIN(CONFIG_NETPRIO_CGROUP)
41 *task_netprio_state(struct task_struct *p) 41
42static inline u32 task_netprioidx(struct task_struct *p)
42{ 43{
43#if IS_ENABLED(CONFIG_NETPRIO_CGROUP) 44 struct cgroup_netprio_state *state;
44 return container_of(task_subsys_state(p, net_prio_subsys_id), 45 u32 idx;
45 struct cgroup_netprio_state, css); 46
46#else 47 rcu_read_lock();
47 return NULL; 48 state = container_of(task_subsys_state(p, net_prio_subsys_id),
48#endif 49 struct cgroup_netprio_state, css);
50 idx = state->prioidx;
51 rcu_read_unlock();
52 return idx;
53}
54
55#elif IS_MODULE(CONFIG_NETPRIO_CGROUP)
56
57static inline u32 task_netprioidx(struct task_struct *p)
58{
59 struct cgroup_netprio_state *state;
60 int subsys_id;
61 u32 idx = 0;
62
63 rcu_read_lock();
64 subsys_id = rcu_dereference_index_check(net_prio_subsys_id,
65 rcu_read_lock_held());
66 if (subsys_id >= 0) {
67 state = container_of(task_subsys_state(p, subsys_id),
68 struct cgroup_netprio_state, css);
69 idx = state->prioidx;
70 }
71 rcu_read_unlock();
72 return idx;
49} 73}
50 74
51#else 75#else
52 76
77static inline u32 task_netprioidx(struct task_struct *p)
78{
79 return 0;
80}
81
82#endif /* CONFIG_NETPRIO_CGROUP */
83
84#else
53#define sock_update_netprioidx(sk) 85#define sock_update_netprioidx(sk)
54#endif 86#endif
55 87
diff --git a/include/net/route.h b/include/net/route.h
index 91855d185b53..b1c0d5b564c2 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -270,6 +270,7 @@ static inline struct rtable *ip_route_connect(struct flowi4 *fl4,
270 if (IS_ERR(rt)) 270 if (IS_ERR(rt))
271 return rt; 271 return rt;
272 ip_rt_put(rt); 272 ip_rt_put(rt);
273 flowi4_update_output(fl4, oif, tos, fl4->daddr, fl4->saddr);
273 } 274 }
274 security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); 275 security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
275 return ip_route_output_flow(net, fl4, sk); 276 return ip_route_output_flow(net, fl4, sk);
@@ -284,6 +285,9 @@ static inline struct rtable *ip_route_newports(struct flowi4 *fl4, struct rtable
284 fl4->fl4_dport = dport; 285 fl4->fl4_dport = dport;
285 fl4->fl4_sport = sport; 286 fl4->fl4_sport = sport;
286 ip_rt_put(rt); 287 ip_rt_put(rt);
288 flowi4_update_output(fl4, sk->sk_bound_dev_if,
289 RT_CONN_FLAGS(sk), fl4->daddr,
290 fl4->saddr);
287 security_sk_classify_flow(sk, flowi4_to_flowi(fl4)); 291 security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
288 return ip_route_output_flow(sock_net(sk), fl4, sk); 292 return ip_route_output_flow(sock_net(sk), fl4, sk);
289 } 293 }
diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h
index 678f1ffaf843..370293901971 100644
--- a/include/net/rtnetlink.h
+++ b/include/net/rtnetlink.h
@@ -6,7 +6,7 @@
6 6
7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *); 7typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, void *);
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 *); 9typedef u16 (*rtnl_calcit_func)(struct sk_buff *, struct nlmsghdr *);
10 10
11extern int __rtnl_register(int protocol, int msgtype, 11extern int __rtnl_register(int protocol, int msgtype,
12 rtnl_doit_func, rtnl_dumpit_func, 12 rtnl_doit_func, rtnl_dumpit_func,
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index f6bb08b73ca4..55ce96b53b09 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -220,9 +220,16 @@ struct tcf_proto {
220 220
221struct qdisc_skb_cb { 221struct qdisc_skb_cb {
222 unsigned int pkt_len; 222 unsigned int pkt_len;
223 long data[]; 223 unsigned char data[24];
224}; 224};
225 225
226static inline void qdisc_cb_private_validate(const struct sk_buff *skb, int sz)
227{
228 struct qdisc_skb_cb *qcb;
229 BUILD_BUG_ON(sizeof(skb->cb) < sizeof(unsigned int) + sz);
230 BUILD_BUG_ON(sizeof(qcb->data) < sz);
231}
232
226static inline int qdisc_qlen(const struct Qdisc *q) 233static inline int qdisc_qlen(const struct Qdisc *q)
227{ 234{
228 return q->q.qlen; 235 return q->q.qlen;
diff --git a/include/net/sock.h b/include/net/sock.h
index 4c69ac165e6b..91c1c8baf020 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -55,6 +55,7 @@
55#include <linux/uaccess.h> 55#include <linux/uaccess.h>
56#include <linux/memcontrol.h> 56#include <linux/memcontrol.h>
57#include <linux/res_counter.h> 57#include <linux/res_counter.h>
58#include <linux/jump_label.h>
58 59
59#include <linux/filter.h> 60#include <linux/filter.h>
60#include <linux/rculist_nulls.h> 61#include <linux/rculist_nulls.h>
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 0118ea999f67..2d80c291fffb 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -273,6 +273,14 @@ static inline int between(__u32 seq1, __u32 seq2, __u32 seq3)
273 return seq3 - seq2 >= seq1 - seq2; 273 return seq3 - seq2 >= seq1 - seq2;
274} 274}
275 275
276static inline bool tcp_out_of_memory(struct sock *sk)
277{
278 if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
279 sk_memory_allocated(sk) > sk_prot_mem_limits(sk, 2))
280 return true;
281 return false;
282}
283
276static inline bool tcp_too_many_orphans(struct sock *sk, int shift) 284static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
277{ 285{
278 struct percpu_counter *ocp = sk->sk_prot->orphan_count; 286 struct percpu_counter *ocp = sk->sk_prot->orphan_count;
@@ -283,13 +291,11 @@ static inline bool tcp_too_many_orphans(struct sock *sk, int shift)
283 if (orphans << shift > sysctl_tcp_max_orphans) 291 if (orphans << shift > sysctl_tcp_max_orphans)
284 return true; 292 return true;
285 } 293 }
286
287 if (sk->sk_wmem_queued > SOCK_MIN_SNDBUF &&
288 sk_memory_allocated(sk) > sk_prot_mem_limits(sk, 2))
289 return true;
290 return false; 294 return false;
291} 295}
292 296
297extern bool tcp_check_oom(struct sock *sk, int shift);
298
293/* syncookies: remember time of last synqueue overflow */ 299/* syncookies: remember time of last synqueue overflow */
294static inline void tcp_synq_overflow(struct sock *sk) 300static inline void tcp_synq_overflow(struct sock *sk)
295{ 301{
@@ -311,6 +317,8 @@ extern struct proto tcp_prot;
311#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val) 317#define TCP_ADD_STATS_USER(net, field, val) SNMP_ADD_STATS_USER((net)->mib.tcp_statistics, field, val)
312#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val) 318#define TCP_ADD_STATS(net, field, val) SNMP_ADD_STATS((net)->mib.tcp_statistics, field, val)
313 319
320extern void tcp_init_mem(struct net *net);
321
314extern void tcp_v4_err(struct sk_buff *skb, u32); 322extern void tcp_v4_err(struct sk_buff *skb, u32);
315 323
316extern void tcp_shutdown (struct sock *sk, int how); 324extern void tcp_shutdown (struct sock *sk, int how);
@@ -1356,8 +1364,9 @@ static inline void tcp_push_pending_frames(struct sock *sk)
1356 } 1364 }
1357} 1365}
1358 1366
1359/* Start sequence of the highest skb with SACKed bit, valid only if 1367/* Start sequence of the skb just after the highest skb with SACKed
1360 * sacked > 0 or when the caller has ensured validity by itself. 1368 * bit, valid only if sacked_out > 0 or when the caller has ensured
1369 * validity by itself.
1361 */ 1370 */
1362static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp) 1371static inline u32 tcp_highest_sack_seq(struct tcp_sock *tp)
1363{ 1372{