aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 03:40:34 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-13 03:40:34 -0500
commit42a2d923cc349583ebf6fdd52a7d35e1c2f7e6bd (patch)
tree2b2b0c03b5389c1301800119333967efafd994ca /net/dccp
parent5cbb3d216e2041700231bcfc383ee5f8b7fc8b74 (diff)
parent75ecab1df14d90e86cebef9ec5c76befde46e65f (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
Pull networking updates from David Miller: 1) The addition of nftables. No longer will we need protocol aware firewall filtering modules, it can all live in userspace. At the core of nftables is a, for lack of a better term, virtual machine that executes byte codes to inspect packet or metadata (arriving interface index, etc.) and make verdict decisions. Besides support for loading packet contents and comparing them, the interpreter supports lookups in various datastructures as fundamental operations. For example sets are supports, and therefore one could create a set of whitelist IP address entries which have ACCEPT verdicts attached to them, and use the appropriate byte codes to do such lookups. Since the interpreted code is composed in userspace, userspace can do things like optimize things before giving it to the kernel. Another major improvement is the capability of atomically updating portions of the ruleset. In the existing netfilter implementation, one has to update the entire rule set in order to make a change and this is very expensive. Userspace tools exist to create nftables rules using existing netfilter rule sets, but both kernel implementations will need to co-exist for quite some time as we transition from the old to the new stuff. Kudos to Patrick McHardy, Pablo Neira Ayuso, and others who have worked so hard on this. 2) Daniel Borkmann and Hannes Frederic Sowa made several improvements to our pseudo-random number generator, mostly used for things like UDP port randomization and netfitler, amongst other things. In particular the taus88 generater is updated to taus113, and test cases are added. 3) Support 64-bit rates in HTB and TBF schedulers, from Eric Dumazet and Yang Yingliang. 4) Add support for new 577xx tigon3 chips to tg3 driver, from Nithin Sujir. 5) Fix two fatal flaws in TCP dynamic right sizing, from Eric Dumazet, Neal Cardwell, and Yuchung Cheng. 6) Allow IP_TOS and IP_TTL to be specified in sendmsg() ancillary control message data, much like other socket option attributes. From Francesco Fusco. 7) Allow applications to specify a cap on the rate computed automatically by the kernel for pacing flows, via a new SO_MAX_PACING_RATE socket option. From Eric Dumazet. 8) Make the initial autotuned send buffer sizing in TCP more closely reflect actual needs, from Eric Dumazet. 9) Currently early socket demux only happens for TCP sockets, but we can do it for connected UDP sockets too. Implementation from Shawn Bohrer. 10) Refactor inet socket demux with the goal of improving hash demux performance for listening sockets. With the main goals being able to use RCU lookups on even request sockets, and eliminating the listening lock contention. From Eric Dumazet. 11) The bonding layer has many demuxes in it's fast path, and an RCU conversion was started back in 3.11, several changes here extend the RCU usage to even more locations. From Ding Tianhong and Wang Yufen, based upon suggestions by Nikolay Aleksandrov and Veaceslav Falico. 12) Allow stackability of segmentation offloads to, in particular, allow segmentation offloading over tunnels. From Eric Dumazet. 13) Significantly improve the handling of secret keys we input into the various hash functions in the inet hashtables, TCP fast open, as well as syncookies. From Hannes Frederic Sowa. The key fundamental operation is "net_get_random_once()" which uses static keys. Hannes even extended this to ipv4/ipv6 fragmentation handling and our generic flow dissector. 14) The generic driver layer takes care now to set the driver data to NULL on device removal, so it's no longer necessary for drivers to explicitly set it to NULL any more. Many drivers have been cleaned up in this way, from Jingoo Han. 15) Add a BPF based packet scheduler classifier, from Daniel Borkmann. 16) Improve CRC32 interfaces and generic SKB checksum iterators so that SCTP's checksumming can more cleanly be handled. Also from Daniel Borkmann. 17) Add a new PMTU discovery mode, IP_PMTUDISC_INTERFACE, which forces using the interface MTU value. This helps avoid PMTU attacks, particularly on DNS servers. From Hannes Frederic Sowa. 18) Use generic XPS for transmit queue steering rather than internal (re-)implementation in virtio-net. From Jason Wang. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1622 commits) random32: add test cases for taus113 implementation random32: upgrade taus88 generator to taus113 from errata paper random32: move rnd_state to linux/random.h random32: add prandom_reseed_late() and call when nonblocking pool becomes initialized random32: add periodic reseeding random32: fix off-by-one in seeding requirement PHY: Add RTL8201CP phy_driver to realtek xtsonic: add missing platform_set_drvdata() in xtsonic_probe() macmace: add missing platform_set_drvdata() in mace_probe() ethernet/arc/arc_emac: add missing platform_set_drvdata() in arc_emac_probe() ipv6: protect for_each_sk_fl_rcu in mem_check with rcu_read_lock_bh vlan: Implement vlan_dev_get_egress_qos_mask as an inline. ixgbe: add warning when max_vfs is out of range. igb: Update link modes display in ethtool netfilter: push reasm skb through instead of original frag skbs ip6_output: fragment outgoing reassembled skb properly MAINTAINERS: mv643xx_eth: take over maintainership from Lennart net_sched: tbf: support of 64bit rates ixgbe: deleting dfwd stations out of order can cause null ptr deref ixgbe: fix build err, num_rx_queues is only available with CONFIG_RPS ...
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ackvec.h21
-rw-r--r--net/dccp/ccid.h18
-rw-r--r--net/dccp/ccids/lib/loss_interval.h8
-rw-r--r--net/dccp/ccids/lib/packet_history.h25
-rw-r--r--net/dccp/ccids/lib/tfrc.h22
-rw-r--r--net/dccp/dccp.h186
-rw-r--r--net/dccp/feat.h26
-rw-r--r--net/dccp/ipv4.c19
-rw-r--r--net/dccp/ipv6.c83
-rw-r--r--net/dccp/ipv6.h2
-rw-r--r--net/dccp/minisocks.c15
-rw-r--r--net/dccp/output.c4
-rw-r--r--net/dccp/proto.c4
13 files changed, 208 insertions, 225 deletions
diff --git a/net/dccp/ackvec.h b/net/dccp/ackvec.h
index a269aa7f7923..3284bfa988c0 100644
--- a/net/dccp/ackvec.h
+++ b/net/dccp/ackvec.h
@@ -101,16 +101,16 @@ struct dccp_ackvec_record {
101 u8 avr_ack_nonce:1; 101 u8 avr_ack_nonce:1;
102}; 102};
103 103
104extern int dccp_ackvec_init(void); 104int dccp_ackvec_init(void);
105extern void dccp_ackvec_exit(void); 105void dccp_ackvec_exit(void);
106 106
107extern struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority); 107struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority);
108extern void dccp_ackvec_free(struct dccp_ackvec *av); 108void dccp_ackvec_free(struct dccp_ackvec *av);
109 109
110extern void dccp_ackvec_input(struct dccp_ackvec *av, struct sk_buff *skb); 110void dccp_ackvec_input(struct dccp_ackvec *av, struct sk_buff *skb);
111extern int dccp_ackvec_update_records(struct dccp_ackvec *av, u64 seq, u8 sum); 111int dccp_ackvec_update_records(struct dccp_ackvec *av, u64 seq, u8 sum);
112extern void dccp_ackvec_clear_state(struct dccp_ackvec *av, const u64 ackno); 112void dccp_ackvec_clear_state(struct dccp_ackvec *av, const u64 ackno);
113extern u16 dccp_ackvec_buflen(const struct dccp_ackvec *av); 113u16 dccp_ackvec_buflen(const struct dccp_ackvec *av);
114 114
115static inline bool dccp_ackvec_is_empty(const struct dccp_ackvec *av) 115static inline bool dccp_ackvec_is_empty(const struct dccp_ackvec *av)
116{ 116{
@@ -133,7 +133,6 @@ struct dccp_ackvec_parsed {
133 struct list_head node; 133 struct list_head node;
134}; 134};
135 135
136extern int dccp_ackvec_parsed_add(struct list_head *head, 136int dccp_ackvec_parsed_add(struct list_head *head, u8 *vec, u8 len, u8 nonce);
137 u8 *vec, u8 len, u8 nonce); 137void dccp_ackvec_parsed_cleanup(struct list_head *parsed_chunks);
138extern void dccp_ackvec_parsed_cleanup(struct list_head *parsed_chunks);
139#endif /* _ACKVEC_H */ 138#endif /* _ACKVEC_H */
diff --git a/net/dccp/ccid.h b/net/dccp/ccid.h
index fb85d371a8de..6eb837a47b5c 100644
--- a/net/dccp/ccid.h
+++ b/net/dccp/ccid.h
@@ -93,8 +93,8 @@ extern struct ccid_operations ccid2_ops;
93extern struct ccid_operations ccid3_ops; 93extern struct ccid_operations ccid3_ops;
94#endif 94#endif
95 95
96extern int ccid_initialize_builtins(void); 96int ccid_initialize_builtins(void);
97extern void ccid_cleanup_builtins(void); 97void ccid_cleanup_builtins(void);
98 98
99struct ccid { 99struct ccid {
100 struct ccid_operations *ccid_ops; 100 struct ccid_operations *ccid_ops;
@@ -106,12 +106,12 @@ static inline void *ccid_priv(const struct ccid *ccid)
106 return (void *)ccid->ccid_priv; 106 return (void *)ccid->ccid_priv;
107} 107}
108 108
109extern bool ccid_support_check(u8 const *ccid_array, u8 array_len); 109bool ccid_support_check(u8 const *ccid_array, u8 array_len);
110extern int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len); 110int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len);
111extern int ccid_getsockopt_builtin_ccids(struct sock *sk, int len, 111int ccid_getsockopt_builtin_ccids(struct sock *sk, int len,
112 char __user *, int __user *); 112 char __user *, int __user *);
113 113
114extern struct ccid *ccid_new(const u8 id, struct sock *sk, bool rx); 114struct ccid *ccid_new(const u8 id, struct sock *sk, bool rx);
115 115
116static inline int ccid_get_current_rx_ccid(struct dccp_sock *dp) 116static inline int ccid_get_current_rx_ccid(struct dccp_sock *dp)
117{ 117{
@@ -131,8 +131,8 @@ static inline int ccid_get_current_tx_ccid(struct dccp_sock *dp)
131 return ccid->ccid_ops->ccid_id; 131 return ccid->ccid_ops->ccid_id;
132} 132}
133 133
134extern void ccid_hc_rx_delete(struct ccid *ccid, struct sock *sk); 134void ccid_hc_rx_delete(struct ccid *ccid, struct sock *sk);
135extern void ccid_hc_tx_delete(struct ccid *ccid, struct sock *sk); 135void ccid_hc_tx_delete(struct ccid *ccid, struct sock *sk);
136 136
137/* 137/*
138 * Congestion control of queued data packets via CCID decision. 138 * Congestion control of queued data packets via CCID decision.
diff --git a/net/dccp/ccids/lib/loss_interval.h b/net/dccp/ccids/lib/loss_interval.h
index d1d2f5383b7d..57f631a86ccd 100644
--- a/net/dccp/ccids/lib/loss_interval.h
+++ b/net/dccp/ccids/lib/loss_interval.h
@@ -65,9 +65,9 @@ static inline u8 tfrc_lh_length(struct tfrc_loss_hist *lh)
65 65
66struct tfrc_rx_hist; 66struct tfrc_rx_hist;
67 67
68extern int tfrc_lh_interval_add(struct tfrc_loss_hist *, struct tfrc_rx_hist *, 68int tfrc_lh_interval_add(struct tfrc_loss_hist *, struct tfrc_rx_hist *,
69 u32 (*first_li)(struct sock *), struct sock *); 69 u32 (*first_li)(struct sock *), struct sock *);
70extern u8 tfrc_lh_update_i_mean(struct tfrc_loss_hist *lh, struct sk_buff *); 70u8 tfrc_lh_update_i_mean(struct tfrc_loss_hist *lh, struct sk_buff *);
71extern void tfrc_lh_cleanup(struct tfrc_loss_hist *lh); 71void tfrc_lh_cleanup(struct tfrc_loss_hist *lh);
72 72
73#endif /* _DCCP_LI_HIST_ */ 73#endif /* _DCCP_LI_HIST_ */
diff --git a/net/dccp/ccids/lib/packet_history.h b/net/dccp/ccids/lib/packet_history.h
index 7ee4a9d9d335..ee362b0b630d 100644
--- a/net/dccp/ccids/lib/packet_history.h
+++ b/net/dccp/ccids/lib/packet_history.h
@@ -60,8 +60,8 @@ static inline struct tfrc_tx_hist_entry *
60 return head; 60 return head;
61} 61}
62 62
63extern int tfrc_tx_hist_add(struct tfrc_tx_hist_entry **headp, u64 seqno); 63int tfrc_tx_hist_add(struct tfrc_tx_hist_entry **headp, u64 seqno);
64extern void tfrc_tx_hist_purge(struct tfrc_tx_hist_entry **headp); 64void tfrc_tx_hist_purge(struct tfrc_tx_hist_entry **headp);
65 65
66/* Subtraction a-b modulo-16, respects circular wrap-around */ 66/* Subtraction a-b modulo-16, respects circular wrap-around */
67#define SUB16(a, b) (((a) + 16 - (b)) & 0xF) 67#define SUB16(a, b) (((a) + 16 - (b)) & 0xF)
@@ -139,20 +139,17 @@ static inline bool tfrc_rx_hist_loss_pending(const struct tfrc_rx_hist *h)
139 return h->loss_count > 0; 139 return h->loss_count > 0;
140} 140}
141 141
142extern void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, 142void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h, const struct sk_buff *skb,
143 const struct sk_buff *skb, const u64 ndp); 143 const u64 ndp);
144 144
145extern int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb); 145int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb);
146 146
147struct tfrc_loss_hist; 147struct tfrc_loss_hist;
148extern int tfrc_rx_handle_loss(struct tfrc_rx_hist *h, 148int tfrc_rx_handle_loss(struct tfrc_rx_hist *h, struct tfrc_loss_hist *lh,
149 struct tfrc_loss_hist *lh, 149 struct sk_buff *skb, const u64 ndp,
150 struct sk_buff *skb, const u64 ndp, 150 u32 (*first_li)(struct sock *sk), struct sock *sk);
151 u32 (*first_li)(struct sock *sk), 151u32 tfrc_rx_hist_sample_rtt(struct tfrc_rx_hist *h, const struct sk_buff *skb);
152 struct sock *sk); 152int tfrc_rx_hist_alloc(struct tfrc_rx_hist *h);
153extern u32 tfrc_rx_hist_sample_rtt(struct tfrc_rx_hist *h, 153void tfrc_rx_hist_purge(struct tfrc_rx_hist *h);
154 const struct sk_buff *skb);
155extern int tfrc_rx_hist_alloc(struct tfrc_rx_hist *h);
156extern void tfrc_rx_hist_purge(struct tfrc_rx_hist *h);
157 154
158#endif /* _DCCP_PKT_HIST_ */ 155#endif /* _DCCP_PKT_HIST_ */
diff --git a/net/dccp/ccids/lib/tfrc.h b/net/dccp/ccids/lib/tfrc.h
index ed698c42a5fb..40ee7d62b652 100644
--- a/net/dccp/ccids/lib/tfrc.h
+++ b/net/dccp/ccids/lib/tfrc.h
@@ -55,21 +55,21 @@ static inline u32 tfrc_ewma(const u32 avg, const u32 newval, const u8 weight)
55 return avg ? (weight * avg + (10 - weight) * newval) / 10 : newval; 55 return avg ? (weight * avg + (10 - weight) * newval) / 10 : newval;
56} 56}
57 57
58extern u32 tfrc_calc_x(u16 s, u32 R, u32 p); 58u32 tfrc_calc_x(u16 s, u32 R, u32 p);
59extern u32 tfrc_calc_x_reverse_lookup(u32 fvalue); 59u32 tfrc_calc_x_reverse_lookup(u32 fvalue);
60extern u32 tfrc_invert_loss_event_rate(u32 loss_event_rate); 60u32 tfrc_invert_loss_event_rate(u32 loss_event_rate);
61 61
62extern int tfrc_tx_packet_history_init(void); 62int tfrc_tx_packet_history_init(void);
63extern void tfrc_tx_packet_history_exit(void); 63void tfrc_tx_packet_history_exit(void);
64extern int tfrc_rx_packet_history_init(void); 64int tfrc_rx_packet_history_init(void);
65extern void tfrc_rx_packet_history_exit(void); 65void tfrc_rx_packet_history_exit(void);
66 66
67extern int tfrc_li_init(void); 67int tfrc_li_init(void);
68extern void tfrc_li_exit(void); 68void tfrc_li_exit(void);
69 69
70#ifdef CONFIG_IP_DCCP_TFRC_LIB 70#ifdef CONFIG_IP_DCCP_TFRC_LIB
71extern int tfrc_lib_init(void); 71int tfrc_lib_init(void);
72extern void tfrc_lib_exit(void); 72void tfrc_lib_exit(void);
73#else 73#else
74#define tfrc_lib_init() (0) 74#define tfrc_lib_init() (0)
75#define tfrc_lib_exit() 75#define tfrc_lib_exit()
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 708e75bf623d..30948784dd58 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -53,7 +53,7 @@ extern struct inet_hashinfo dccp_hashinfo;
53 53
54extern struct percpu_counter dccp_orphan_count; 54extern struct percpu_counter dccp_orphan_count;
55 55
56extern void dccp_time_wait(struct sock *sk, int state, int timeo); 56void dccp_time_wait(struct sock *sk, int state, int timeo);
57 57
58/* 58/*
59 * Set safe upper bounds for header and option length. Since Data Offset is 8 59 * Set safe upper bounds for header and option length. Since Data Offset is 8
@@ -224,114 +224,108 @@ static inline void dccp_csum_outgoing(struct sk_buff *skb)
224 skb->csum = skb_checksum(skb, 0, (cov > skb->len)? skb->len : cov, 0); 224 skb->csum = skb_checksum(skb, 0, (cov > skb->len)? skb->len : cov, 0);
225} 225}
226 226
227extern void dccp_v4_send_check(struct sock *sk, struct sk_buff *skb); 227void dccp_v4_send_check(struct sock *sk, struct sk_buff *skb);
228 228
229extern int dccp_retransmit_skb(struct sock *sk); 229int dccp_retransmit_skb(struct sock *sk);
230 230
231extern void dccp_send_ack(struct sock *sk); 231void dccp_send_ack(struct sock *sk);
232extern void dccp_reqsk_send_ack(struct sock *sk, struct sk_buff *skb, 232void dccp_reqsk_send_ack(struct sock *sk, struct sk_buff *skb,
233 struct request_sock *rsk); 233 struct request_sock *rsk);
234 234
235extern void dccp_send_sync(struct sock *sk, const u64 seq, 235void dccp_send_sync(struct sock *sk, const u64 seq,
236 const enum dccp_pkt_type pkt_type); 236 const enum dccp_pkt_type pkt_type);
237 237
238/* 238/*
239 * TX Packet Dequeueing Interface 239 * TX Packet Dequeueing Interface
240 */ 240 */
241extern void dccp_qpolicy_push(struct sock *sk, struct sk_buff *skb); 241void dccp_qpolicy_push(struct sock *sk, struct sk_buff *skb);
242extern bool dccp_qpolicy_full(struct sock *sk); 242bool dccp_qpolicy_full(struct sock *sk);
243extern void dccp_qpolicy_drop(struct sock *sk, struct sk_buff *skb); 243void dccp_qpolicy_drop(struct sock *sk, struct sk_buff *skb);
244extern struct sk_buff *dccp_qpolicy_top(struct sock *sk); 244struct sk_buff *dccp_qpolicy_top(struct sock *sk);
245extern struct sk_buff *dccp_qpolicy_pop(struct sock *sk); 245struct sk_buff *dccp_qpolicy_pop(struct sock *sk);
246extern bool dccp_qpolicy_param_ok(struct sock *sk, __be32 param); 246bool dccp_qpolicy_param_ok(struct sock *sk, __be32 param);
247 247
248/* 248/*
249 * TX Packet Output and TX Timers 249 * TX Packet Output and TX Timers
250 */ 250 */
251extern void dccp_write_xmit(struct sock *sk); 251void dccp_write_xmit(struct sock *sk);
252extern void dccp_write_space(struct sock *sk); 252void dccp_write_space(struct sock *sk);
253extern void dccp_flush_write_queue(struct sock *sk, long *time_budget); 253void dccp_flush_write_queue(struct sock *sk, long *time_budget);
254 254
255extern void dccp_init_xmit_timers(struct sock *sk); 255void dccp_init_xmit_timers(struct sock *sk);
256static inline void dccp_clear_xmit_timers(struct sock *sk) 256static inline void dccp_clear_xmit_timers(struct sock *sk)
257{ 257{
258 inet_csk_clear_xmit_timers(sk); 258 inet_csk_clear_xmit_timers(sk);
259} 259}
260 260
261extern unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu); 261unsigned int dccp_sync_mss(struct sock *sk, u32 pmtu);
262 262
263extern const char *dccp_packet_name(const int type); 263const char *dccp_packet_name(const int type);
264 264
265extern void dccp_set_state(struct sock *sk, const int state); 265void dccp_set_state(struct sock *sk, const int state);
266extern void dccp_done(struct sock *sk); 266void dccp_done(struct sock *sk);
267 267
268extern int dccp_reqsk_init(struct request_sock *rq, struct dccp_sock const *dp, 268int dccp_reqsk_init(struct request_sock *rq, struct dccp_sock const *dp,
269 struct sk_buff const *skb); 269 struct sk_buff const *skb);
270 270
271extern int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb); 271int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb);
272 272
273extern struct sock *dccp_create_openreq_child(struct sock *sk, 273struct sock *dccp_create_openreq_child(struct sock *sk,
274 const struct request_sock *req, 274 const struct request_sock *req,
275 const struct sk_buff *skb); 275 const struct sk_buff *skb);
276 276
277extern int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb); 277int dccp_v4_do_rcv(struct sock *sk, struct sk_buff *skb);
278 278
279extern struct sock *dccp_v4_request_recv_sock(struct sock *sk, 279struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
280 struct sk_buff *skb, 280 struct request_sock *req,
281 struct request_sock *req, 281 struct dst_entry *dst);
282 struct dst_entry *dst); 282struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb,
283extern struct sock *dccp_check_req(struct sock *sk, struct sk_buff *skb, 283 struct request_sock *req,
284 struct request_sock *req, 284 struct request_sock **prev);
285 struct request_sock **prev);
286 285
287extern int dccp_child_process(struct sock *parent, struct sock *child, 286int dccp_child_process(struct sock *parent, struct sock *child,
288 struct sk_buff *skb); 287 struct sk_buff *skb);
289extern int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb, 288int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
290 struct dccp_hdr *dh, unsigned int len); 289 struct dccp_hdr *dh, unsigned int len);
291extern int dccp_rcv_established(struct sock *sk, struct sk_buff *skb, 290int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
292 const struct dccp_hdr *dh, const unsigned int len); 291 const struct dccp_hdr *dh, const unsigned int len);
293 292
294extern int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized); 293int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized);
295extern void dccp_destroy_sock(struct sock *sk); 294void dccp_destroy_sock(struct sock *sk);
296 295
297extern void dccp_close(struct sock *sk, long timeout); 296void dccp_close(struct sock *sk, long timeout);
298extern struct sk_buff *dccp_make_response(struct sock *sk, 297struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst,
299 struct dst_entry *dst, 298 struct request_sock *req);
300 struct request_sock *req);
301 299
302extern int dccp_connect(struct sock *sk); 300int dccp_connect(struct sock *sk);
303extern int dccp_disconnect(struct sock *sk, int flags); 301int dccp_disconnect(struct sock *sk, int flags);
304extern int dccp_getsockopt(struct sock *sk, int level, int optname, 302int dccp_getsockopt(struct sock *sk, int level, int optname,
305 char __user *optval, int __user *optlen); 303 char __user *optval, int __user *optlen);
306extern int dccp_setsockopt(struct sock *sk, int level, int optname, 304int dccp_setsockopt(struct sock *sk, int level, int optname,
307 char __user *optval, unsigned int optlen); 305 char __user *optval, unsigned int optlen);
308#ifdef CONFIG_COMPAT 306#ifdef CONFIG_COMPAT
309extern int compat_dccp_getsockopt(struct sock *sk, 307int compat_dccp_getsockopt(struct sock *sk, int level, int optname,
310 int level, int optname, 308 char __user *optval, int __user *optlen);
311 char __user *optval, int __user *optlen); 309int compat_dccp_setsockopt(struct sock *sk, int level, int optname,
312extern int compat_dccp_setsockopt(struct sock *sk, 310 char __user *optval, unsigned int optlen);
313 int level, int optname,
314 char __user *optval, unsigned int optlen);
315#endif 311#endif
316extern int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg); 312int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg);
317extern int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, 313int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
318 struct msghdr *msg, size_t size); 314 size_t size);
319extern int dccp_recvmsg(struct kiocb *iocb, struct sock *sk, 315int dccp_recvmsg(struct kiocb *iocb, struct sock *sk,
320 struct msghdr *msg, size_t len, int nonblock, 316 struct msghdr *msg, size_t len, int nonblock, int flags,
321 int flags, int *addr_len); 317 int *addr_len);
322extern void dccp_shutdown(struct sock *sk, int how); 318void dccp_shutdown(struct sock *sk, int how);
323extern int inet_dccp_listen(struct socket *sock, int backlog); 319int inet_dccp_listen(struct socket *sock, int backlog);
324extern unsigned int dccp_poll(struct file *file, struct socket *sock, 320unsigned int dccp_poll(struct file *file, struct socket *sock,
325 poll_table *wait); 321 poll_table *wait);
326extern int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, 322int dccp_v4_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
327 int addr_len); 323
328 324struct sk_buff *dccp_ctl_make_reset(struct sock *sk, struct sk_buff *skb);
329extern struct sk_buff *dccp_ctl_make_reset(struct sock *sk, 325int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code);
330 struct sk_buff *skb); 326void dccp_send_close(struct sock *sk, const int active);
331extern int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code); 327int dccp_invalid_packet(struct sk_buff *skb);
332extern void dccp_send_close(struct sock *sk, const int active); 328u32 dccp_sample_rtt(struct sock *sk, long delta);
333extern int dccp_invalid_packet(struct sk_buff *skb);
334extern u32 dccp_sample_rtt(struct sock *sk, long delta);
335 329
336static inline int dccp_bad_service_code(const struct sock *sk, 330static inline int dccp_bad_service_code(const struct sock *sk,
337 const __be32 service) 331 const __be32 service)
@@ -475,25 +469,25 @@ static inline int dccp_ack_pending(const struct sock *sk)
475 return dccp_ackvec_pending(sk) || inet_csk_ack_scheduled(sk); 469 return dccp_ackvec_pending(sk) || inet_csk_ack_scheduled(sk);
476} 470}
477 471
478extern int dccp_feat_signal_nn_change(struct sock *sk, u8 feat, u64 nn_val); 472int dccp_feat_signal_nn_change(struct sock *sk, u8 feat, u64 nn_val);
479extern int dccp_feat_finalise_settings(struct dccp_sock *dp); 473int dccp_feat_finalise_settings(struct dccp_sock *dp);
480extern int dccp_feat_server_ccid_dependencies(struct dccp_request_sock *dreq); 474int dccp_feat_server_ccid_dependencies(struct dccp_request_sock *dreq);
481extern int dccp_feat_insert_opts(struct dccp_sock*, struct dccp_request_sock*, 475int dccp_feat_insert_opts(struct dccp_sock*, struct dccp_request_sock*,
482 struct sk_buff *skb); 476 struct sk_buff *skb);
483extern int dccp_feat_activate_values(struct sock *sk, struct list_head *fn); 477int dccp_feat_activate_values(struct sock *sk, struct list_head *fn);
484extern void dccp_feat_list_purge(struct list_head *fn_list); 478void dccp_feat_list_purge(struct list_head *fn_list);
485 479
486extern int dccp_insert_options(struct sock *sk, struct sk_buff *skb); 480int dccp_insert_options(struct sock *sk, struct sk_buff *skb);
487extern int dccp_insert_options_rsk(struct dccp_request_sock*, struct sk_buff*); 481int dccp_insert_options_rsk(struct dccp_request_sock *, struct sk_buff *);
488extern int dccp_insert_option_elapsed_time(struct sk_buff *skb, u32 elapsed); 482int dccp_insert_option_elapsed_time(struct sk_buff *skb, u32 elapsed);
489extern u32 dccp_timestamp(void); 483u32 dccp_timestamp(void);
490extern void dccp_timestamping_init(void); 484void dccp_timestamping_init(void);
491extern int dccp_insert_option(struct sk_buff *skb, unsigned char option, 485int dccp_insert_option(struct sk_buff *skb, unsigned char option,
492 const void *value, unsigned char len); 486 const void *value, unsigned char len);
493 487
494#ifdef CONFIG_SYSCTL 488#ifdef CONFIG_SYSCTL
495extern int dccp_sysctl_init(void); 489int dccp_sysctl_init(void);
496extern void dccp_sysctl_exit(void); 490void dccp_sysctl_exit(void);
497#else 491#else
498static inline int dccp_sysctl_init(void) 492static inline int dccp_sysctl_init(void)
499{ 493{
diff --git a/net/dccp/feat.h b/net/dccp/feat.h
index 90b957d34d26..0e75cebb2187 100644
--- a/net/dccp/feat.h
+++ b/net/dccp/feat.h
@@ -107,13 +107,13 @@ extern unsigned long sysctl_dccp_sequence_window;
107extern int sysctl_dccp_rx_ccid; 107extern int sysctl_dccp_rx_ccid;
108extern int sysctl_dccp_tx_ccid; 108extern int sysctl_dccp_tx_ccid;
109 109
110extern int dccp_feat_init(struct sock *sk); 110int dccp_feat_init(struct sock *sk);
111extern void dccp_feat_initialise_sysctls(void); 111void dccp_feat_initialise_sysctls(void);
112extern int dccp_feat_register_sp(struct sock *sk, u8 feat, u8 is_local, 112int dccp_feat_register_sp(struct sock *sk, u8 feat, u8 is_local,
113 u8 const *list, u8 len); 113 u8 const *list, u8 len);
114extern int dccp_feat_parse_options(struct sock *, struct dccp_request_sock *, 114int dccp_feat_parse_options(struct sock *, struct dccp_request_sock *,
115 u8 mand, u8 opt, u8 feat, u8 *val, u8 len); 115 u8 mand, u8 opt, u8 feat, u8 *val, u8 len);
116extern int dccp_feat_clone_list(struct list_head const *, struct list_head *); 116int dccp_feat_clone_list(struct list_head const *, struct list_head *);
117 117
118/* 118/*
119 * Encoding variable-length options and their maximum length. 119 * Encoding variable-length options and their maximum length.
@@ -127,11 +127,11 @@ extern int dccp_feat_clone_list(struct list_head const *, struct list_head *);
127 */ 127 */
128#define DCCP_OPTVAL_MAXLEN 6 128#define DCCP_OPTVAL_MAXLEN 6
129 129
130extern void dccp_encode_value_var(const u64 value, u8 *to, const u8 len); 130void dccp_encode_value_var(const u64 value, u8 *to, const u8 len);
131extern u64 dccp_decode_value_var(const u8 *bf, const u8 len); 131u64 dccp_decode_value_var(const u8 *bf, const u8 len);
132extern u64 dccp_feat_nn_get(struct sock *sk, u8 feat); 132u64 dccp_feat_nn_get(struct sock *sk, u8 feat);
133 133
134extern int dccp_insert_option_mandatory(struct sk_buff *skb); 134int dccp_insert_option_mandatory(struct sk_buff *skb);
135extern int dccp_insert_fn_opt(struct sk_buff *skb, u8 type, u8 feat, 135int dccp_insert_fn_opt(struct sk_buff *skb, u8 type, u8 feat, u8 *val, u8 len,
136 u8 *val, u8 len, bool repeat_first); 136 bool repeat_first);
137#endif /* _DCCP_FEAT_H */ 137#endif /* _DCCP_FEAT_H */
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index ebc54fef85a5..d9f65fc66db5 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -174,6 +174,7 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk,
174 mtu = dst_mtu(dst); 174 mtu = dst_mtu(dst);
175 175
176 if (inet->pmtudisc != IP_PMTUDISC_DONT && 176 if (inet->pmtudisc != IP_PMTUDISC_DONT &&
177 ip_sk_accept_pmtu(sk) &&
177 inet_csk(sk)->icsk_pmtu_cookie > mtu) { 178 inet_csk(sk)->icsk_pmtu_cookie > mtu) {
178 dccp_sync_mss(sk, mtu); 179 dccp_sync_mss(sk, mtu);
179 180
@@ -409,9 +410,9 @@ struct sock *dccp_v4_request_recv_sock(struct sock *sk, struct sk_buff *skb,
409 410
410 newinet = inet_sk(newsk); 411 newinet = inet_sk(newsk);
411 ireq = inet_rsk(req); 412 ireq = inet_rsk(req);
412 newinet->inet_daddr = ireq->rmt_addr; 413 newinet->inet_daddr = ireq->ir_rmt_addr;
413 newinet->inet_rcv_saddr = ireq->loc_addr; 414 newinet->inet_rcv_saddr = ireq->ir_loc_addr;
414 newinet->inet_saddr = ireq->loc_addr; 415 newinet->inet_saddr = ireq->ir_loc_addr;
415 newinet->inet_opt = ireq->opt; 416 newinet->inet_opt = ireq->opt;
416 ireq->opt = NULL; 417 ireq->opt = NULL;
417 newinet->mc_index = inet_iif(skb); 418 newinet->mc_index = inet_iif(skb);
@@ -516,10 +517,10 @@ static int dccp_v4_send_response(struct sock *sk, struct request_sock *req)
516 const struct inet_request_sock *ireq = inet_rsk(req); 517 const struct inet_request_sock *ireq = inet_rsk(req);
517 struct dccp_hdr *dh = dccp_hdr(skb); 518 struct dccp_hdr *dh = dccp_hdr(skb);
518 519
519 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->loc_addr, 520 dh->dccph_checksum = dccp_v4_csum_finish(skb, ireq->ir_loc_addr,
520 ireq->rmt_addr); 521 ireq->ir_rmt_addr);
521 err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr, 522 err = ip_build_and_send_pkt(skb, sk, ireq->ir_loc_addr,
522 ireq->rmt_addr, 523 ireq->ir_rmt_addr,
523 ireq->opt); 524 ireq->opt);
524 err = net_xmit_eval(err); 525 err = net_xmit_eval(err);
525 } 526 }
@@ -641,8 +642,8 @@ int dccp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
641 goto drop_and_free; 642 goto drop_and_free;
642 643
643 ireq = inet_rsk(req); 644 ireq = inet_rsk(req);
644 ireq->loc_addr = ip_hdr(skb)->daddr; 645 ireq->ir_loc_addr = ip_hdr(skb)->daddr;
645 ireq->rmt_addr = ip_hdr(skb)->saddr; 646 ireq->ir_rmt_addr = ip_hdr(skb)->saddr;
646 647
647 /* 648 /*
648 * Step 3: Process LISTEN state 649 * Step 3: Process LISTEN state
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index 6cf9f7782ad4..4ac71ff7c2e4 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -67,7 +67,7 @@ static inline void dccp_v6_send_check(struct sock *sk, struct sk_buff *skb)
67 struct dccp_hdr *dh = dccp_hdr(skb); 67 struct dccp_hdr *dh = dccp_hdr(skb);
68 68
69 dccp_csum_outgoing(skb); 69 dccp_csum_outgoing(skb);
70 dh->dccph_checksum = dccp_v6_csum_finish(skb, &np->saddr, &np->daddr); 70 dh->dccph_checksum = dccp_v6_csum_finish(skb, &np->saddr, &sk->sk_v6_daddr);
71} 71}
72 72
73static inline __u64 dccp_v6_init_sequence(struct sk_buff *skb) 73static inline __u64 dccp_v6_init_sequence(struct sk_buff *skb)
@@ -216,7 +216,7 @@ out:
216 216
217static int dccp_v6_send_response(struct sock *sk, struct request_sock *req) 217static int dccp_v6_send_response(struct sock *sk, struct request_sock *req)
218{ 218{
219 struct inet6_request_sock *ireq6 = inet6_rsk(req); 219 struct inet_request_sock *ireq = inet_rsk(req);
220 struct ipv6_pinfo *np = inet6_sk(sk); 220 struct ipv6_pinfo *np = inet6_sk(sk);
221 struct sk_buff *skb; 221 struct sk_buff *skb;
222 struct in6_addr *final_p, final; 222 struct in6_addr *final_p, final;
@@ -226,12 +226,12 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req)
226 226
227 memset(&fl6, 0, sizeof(fl6)); 227 memset(&fl6, 0, sizeof(fl6));
228 fl6.flowi6_proto = IPPROTO_DCCP; 228 fl6.flowi6_proto = IPPROTO_DCCP;
229 fl6.daddr = ireq6->rmt_addr; 229 fl6.daddr = ireq->ir_v6_rmt_addr;
230 fl6.saddr = ireq6->loc_addr; 230 fl6.saddr = ireq->ir_v6_loc_addr;
231 fl6.flowlabel = 0; 231 fl6.flowlabel = 0;
232 fl6.flowi6_oif = ireq6->iif; 232 fl6.flowi6_oif = ireq->ir_iif;
233 fl6.fl6_dport = inet_rsk(req)->rmt_port; 233 fl6.fl6_dport = ireq->ir_rmt_port;
234 fl6.fl6_sport = inet_rsk(req)->loc_port; 234 fl6.fl6_sport = htons(ireq->ir_num);
235 security_req_classify_flow(req, flowi6_to_flowi(&fl6)); 235 security_req_classify_flow(req, flowi6_to_flowi(&fl6));
236 236
237 237
@@ -249,9 +249,9 @@ static int dccp_v6_send_response(struct sock *sk, struct request_sock *req)
249 struct dccp_hdr *dh = dccp_hdr(skb); 249 struct dccp_hdr *dh = dccp_hdr(skb);
250 250
251 dh->dccph_checksum = dccp_v6_csum_finish(skb, 251 dh->dccph_checksum = dccp_v6_csum_finish(skb,
252 &ireq6->loc_addr, 252 &ireq->ir_v6_loc_addr,
253 &ireq6->rmt_addr); 253 &ireq->ir_v6_rmt_addr);
254 fl6.daddr = ireq6->rmt_addr; 254 fl6.daddr = ireq->ir_v6_rmt_addr;
255 err = ip6_xmit(sk, skb, &fl6, np->opt, np->tclass); 255 err = ip6_xmit(sk, skb, &fl6, np->opt, np->tclass);
256 err = net_xmit_eval(err); 256 err = net_xmit_eval(err);
257 } 257 }
@@ -264,8 +264,7 @@ done:
264static void dccp_v6_reqsk_destructor(struct request_sock *req) 264static void dccp_v6_reqsk_destructor(struct request_sock *req)
265{ 265{
266 dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg); 266 dccp_feat_list_purge(&dccp_rsk(req)->dreq_featneg);
267 if (inet6_rsk(req)->pktopts != NULL) 267 kfree_skb(inet_rsk(req)->pktopts);
268 kfree_skb(inet6_rsk(req)->pktopts);
269} 268}
270 269
271static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) 270static void dccp_v6_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb)
@@ -359,7 +358,7 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
359{ 358{
360 struct request_sock *req; 359 struct request_sock *req;
361 struct dccp_request_sock *dreq; 360 struct dccp_request_sock *dreq;
362 struct inet6_request_sock *ireq6; 361 struct inet_request_sock *ireq;
363 struct ipv6_pinfo *np = inet6_sk(sk); 362 struct ipv6_pinfo *np = inet6_sk(sk);
364 const __be32 service = dccp_hdr_request(skb)->dccph_req_service; 363 const __be32 service = dccp_hdr_request(skb)->dccph_req_service;
365 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); 364 struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb);
@@ -398,22 +397,22 @@ static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
398 if (security_inet_conn_request(sk, skb, req)) 397 if (security_inet_conn_request(sk, skb, req))
399 goto drop_and_free; 398 goto drop_and_free;
400 399
401 ireq6 = inet6_rsk(req); 400 ireq = inet_rsk(req);
402 ireq6->rmt_addr = ipv6_hdr(skb)->saddr; 401 ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr;
403 ireq6->loc_addr = ipv6_hdr(skb)->daddr; 402 ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr;
404 403
405 if (ipv6_opt_accepted(sk, skb) || 404 if (ipv6_opt_accepted(sk, skb) ||
406 np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || 405 np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo ||
407 np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { 406 np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) {
408 atomic_inc(&skb->users); 407 atomic_inc(&skb->users);
409 ireq6->pktopts = skb; 408 ireq->pktopts = skb;
410 } 409 }
411 ireq6->iif = sk->sk_bound_dev_if; 410 ireq->ir_iif = sk->sk_bound_dev_if;
412 411
413 /* So that link locals have meaning */ 412 /* So that link locals have meaning */
414 if (!sk->sk_bound_dev_if && 413 if (!sk->sk_bound_dev_if &&
415 ipv6_addr_type(&ireq6->rmt_addr) & IPV6_ADDR_LINKLOCAL) 414 ipv6_addr_type(&ireq->ir_v6_rmt_addr) & IPV6_ADDR_LINKLOCAL)
416 ireq6->iif = inet6_iif(skb); 415 ireq->ir_iif = inet6_iif(skb);
417 416
418 /* 417 /*
419 * Step 3: Process LISTEN state 418 * Step 3: Process LISTEN state
@@ -446,7 +445,7 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
446 struct request_sock *req, 445 struct request_sock *req,
447 struct dst_entry *dst) 446 struct dst_entry *dst)
448{ 447{
449 struct inet6_request_sock *ireq6 = inet6_rsk(req); 448 struct inet_request_sock *ireq = inet_rsk(req);
450 struct ipv6_pinfo *newnp, *np = inet6_sk(sk); 449 struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
451 struct inet_sock *newinet; 450 struct inet_sock *newinet;
452 struct dccp6_sock *newdp6; 451 struct dccp6_sock *newdp6;
@@ -467,11 +466,11 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
467 466
468 memcpy(newnp, np, sizeof(struct ipv6_pinfo)); 467 memcpy(newnp, np, sizeof(struct ipv6_pinfo));
469 468
470 ipv6_addr_set_v4mapped(newinet->inet_daddr, &newnp->daddr); 469 ipv6_addr_set_v4mapped(newinet->inet_daddr, &newsk->sk_v6_daddr);
471 470
472 ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr); 471 ipv6_addr_set_v4mapped(newinet->inet_saddr, &newnp->saddr);
473 472
474 newnp->rcv_saddr = newnp->saddr; 473 newsk->sk_v6_rcv_saddr = newnp->saddr;
475 474
476 inet_csk(newsk)->icsk_af_ops = &dccp_ipv6_mapped; 475 inet_csk(newsk)->icsk_af_ops = &dccp_ipv6_mapped;
477 newsk->sk_backlog_rcv = dccp_v4_do_rcv; 476 newsk->sk_backlog_rcv = dccp_v4_do_rcv;
@@ -505,12 +504,12 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
505 504
506 memset(&fl6, 0, sizeof(fl6)); 505 memset(&fl6, 0, sizeof(fl6));
507 fl6.flowi6_proto = IPPROTO_DCCP; 506 fl6.flowi6_proto = IPPROTO_DCCP;
508 fl6.daddr = ireq6->rmt_addr; 507 fl6.daddr = ireq->ir_v6_rmt_addr;
509 final_p = fl6_update_dst(&fl6, np->opt, &final); 508 final_p = fl6_update_dst(&fl6, np->opt, &final);
510 fl6.saddr = ireq6->loc_addr; 509 fl6.saddr = ireq->ir_v6_loc_addr;
511 fl6.flowi6_oif = sk->sk_bound_dev_if; 510 fl6.flowi6_oif = sk->sk_bound_dev_if;
512 fl6.fl6_dport = inet_rsk(req)->rmt_port; 511 fl6.fl6_dport = ireq->ir_rmt_port;
513 fl6.fl6_sport = inet_rsk(req)->loc_port; 512 fl6.fl6_sport = htons(ireq->ir_num);
514 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); 513 security_sk_classify_flow(sk, flowi6_to_flowi(&fl6));
515 514
516 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); 515 dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false);
@@ -538,10 +537,10 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
538 537
539 memcpy(newnp, np, sizeof(struct ipv6_pinfo)); 538 memcpy(newnp, np, sizeof(struct ipv6_pinfo));
540 539
541 newnp->daddr = ireq6->rmt_addr; 540 newsk->sk_v6_daddr = ireq->ir_v6_rmt_addr;
542 newnp->saddr = ireq6->loc_addr; 541 newnp->saddr = ireq->ir_v6_loc_addr;
543 newnp->rcv_saddr = ireq6->loc_addr; 542 newsk->sk_v6_rcv_saddr = ireq->ir_v6_loc_addr;
544 newsk->sk_bound_dev_if = ireq6->iif; 543 newsk->sk_bound_dev_if = ireq->ir_iif;
545 544
546 /* Now IPv6 options... 545 /* Now IPv6 options...
547 546
@@ -554,10 +553,10 @@ static struct sock *dccp_v6_request_recv_sock(struct sock *sk,
554 553
555 /* Clone pktoptions received with SYN */ 554 /* Clone pktoptions received with SYN */
556 newnp->pktoptions = NULL; 555 newnp->pktoptions = NULL;
557 if (ireq6->pktopts != NULL) { 556 if (ireq->pktopts != NULL) {
558 newnp->pktoptions = skb_clone(ireq6->pktopts, GFP_ATOMIC); 557 newnp->pktoptions = skb_clone(ireq->pktopts, GFP_ATOMIC);
559 consume_skb(ireq6->pktopts); 558 consume_skb(ireq->pktopts);
560 ireq6->pktopts = NULL; 559 ireq->pktopts = NULL;
561 if (newnp->pktoptions) 560 if (newnp->pktoptions)
562 skb_set_owner_r(newnp->pktoptions, newsk); 561 skb_set_owner_r(newnp->pktoptions, newsk);
563 } 562 }
@@ -885,7 +884,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
885 return -EINVAL; 884 return -EINVAL;
886 } 885 }
887 886
888 np->daddr = usin->sin6_addr; 887 sk->sk_v6_daddr = usin->sin6_addr;
889 np->flow_label = fl6.flowlabel; 888 np->flow_label = fl6.flowlabel;
890 889
891 /* 890 /*
@@ -915,16 +914,16 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
915 goto failure; 914 goto failure;
916 } 915 }
917 ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr); 916 ipv6_addr_set_v4mapped(inet->inet_saddr, &np->saddr);
918 ipv6_addr_set_v4mapped(inet->inet_rcv_saddr, &np->rcv_saddr); 917 ipv6_addr_set_v4mapped(inet->inet_rcv_saddr, &sk->sk_v6_rcv_saddr);
919 918
920 return err; 919 return err;
921 } 920 }
922 921
923 if (!ipv6_addr_any(&np->rcv_saddr)) 922 if (!ipv6_addr_any(&sk->sk_v6_rcv_saddr))
924 saddr = &np->rcv_saddr; 923 saddr = &sk->sk_v6_rcv_saddr;
925 924
926 fl6.flowi6_proto = IPPROTO_DCCP; 925 fl6.flowi6_proto = IPPROTO_DCCP;
927 fl6.daddr = np->daddr; 926 fl6.daddr = sk->sk_v6_daddr;
928 fl6.saddr = saddr ? *saddr : np->saddr; 927 fl6.saddr = saddr ? *saddr : np->saddr;
929 fl6.flowi6_oif = sk->sk_bound_dev_if; 928 fl6.flowi6_oif = sk->sk_bound_dev_if;
930 fl6.fl6_dport = usin->sin6_port; 929 fl6.fl6_dport = usin->sin6_port;
@@ -941,7 +940,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
941 940
942 if (saddr == NULL) { 941 if (saddr == NULL) {
943 saddr = &fl6.saddr; 942 saddr = &fl6.saddr;
944 np->rcv_saddr = *saddr; 943 sk->sk_v6_rcv_saddr = *saddr;
945 } 944 }
946 945
947 /* set the source address */ 946 /* set the source address */
@@ -963,7 +962,7 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *uaddr,
963 goto late_failure; 962 goto late_failure;
964 963
965 dp->dccps_iss = secure_dccpv6_sequence_number(np->saddr.s6_addr32, 964 dp->dccps_iss = secure_dccpv6_sequence_number(np->saddr.s6_addr32,
966 np->daddr.s6_addr32, 965 sk->sk_v6_daddr.s6_addr32,
967 inet->inet_sport, 966 inet->inet_sport,
968 inet->inet_dport); 967 inet->inet_dport);
969 err = dccp_connect(sk); 968 err = dccp_connect(sk);
diff --git a/net/dccp/ipv6.h b/net/dccp/ipv6.h
index 6eef81fdbe56..af259e15e7f0 100644
--- a/net/dccp/ipv6.h
+++ b/net/dccp/ipv6.h
@@ -25,12 +25,10 @@ struct dccp6_sock {
25 25
26struct dccp6_request_sock { 26struct dccp6_request_sock {
27 struct dccp_request_sock dccp; 27 struct dccp_request_sock dccp;
28 struct inet6_request_sock inet6;
29}; 28};
30 29
31struct dccp6_timewait_sock { 30struct dccp6_timewait_sock {
32 struct inet_timewait_sock inet; 31 struct inet_timewait_sock inet;
33 struct inet6_timewait_sock tw6;
34}; 32};
35 33
36#endif /* _DCCP_IPV6_H */ 34#endif /* _DCCP_IPV6_H */
diff --git a/net/dccp/minisocks.c b/net/dccp/minisocks.c
index 662071b249cc..9e2f78bc1553 100644
--- a/net/dccp/minisocks.c
+++ b/net/dccp/minisocks.c
@@ -56,12 +56,9 @@ void dccp_time_wait(struct sock *sk, int state, int timeo)
56#if IS_ENABLED(CONFIG_IPV6) 56#if IS_ENABLED(CONFIG_IPV6)
57 if (tw->tw_family == PF_INET6) { 57 if (tw->tw_family == PF_INET6) {
58 const struct ipv6_pinfo *np = inet6_sk(sk); 58 const struct ipv6_pinfo *np = inet6_sk(sk);
59 struct inet6_timewait_sock *tw6;
60 59
61 tw->tw_ipv6_offset = inet6_tw_offset(sk->sk_prot); 60 tw->tw_v6_daddr = sk->sk_v6_daddr;
62 tw6 = inet6_twsk((struct sock *)tw); 61 tw->tw_v6_rcv_saddr = sk->sk_v6_rcv_saddr;
63 tw6->tw_v6_daddr = np->daddr;
64 tw6->tw_v6_rcv_saddr = np->rcv_saddr;
65 tw->tw_ipv6only = np->ipv6only; 62 tw->tw_ipv6only = np->ipv6only;
66 } 63 }
67#endif 64#endif
@@ -269,10 +266,10 @@ int dccp_reqsk_init(struct request_sock *req,
269{ 266{
270 struct dccp_request_sock *dreq = dccp_rsk(req); 267 struct dccp_request_sock *dreq = dccp_rsk(req);
271 268
272 inet_rsk(req)->rmt_port = dccp_hdr(skb)->dccph_sport; 269 inet_rsk(req)->ir_rmt_port = dccp_hdr(skb)->dccph_sport;
273 inet_rsk(req)->loc_port = dccp_hdr(skb)->dccph_dport; 270 inet_rsk(req)->ir_num = ntohs(dccp_hdr(skb)->dccph_dport);
274 inet_rsk(req)->acked = 0; 271 inet_rsk(req)->acked = 0;
275 dreq->dreq_timestamp_echo = 0; 272 dreq->dreq_timestamp_echo = 0;
276 273
277 /* inherit feature negotiation options from listening socket */ 274 /* inherit feature negotiation options from listening socket */
278 return dccp_feat_clone_list(&dp->dccps_featneg, &dreq->dreq_featneg); 275 return dccp_feat_clone_list(&dp->dccps_featneg, &dreq->dreq_featneg);
diff --git a/net/dccp/output.c b/net/dccp/output.c
index d17fc90a74b6..8876078859da 100644
--- a/net/dccp/output.c
+++ b/net/dccp/output.c
@@ -424,8 +424,8 @@ struct sk_buff *dccp_make_response(struct sock *sk, struct dst_entry *dst,
424 /* Build and checksum header */ 424 /* Build and checksum header */
425 dh = dccp_zeroed_hdr(skb, dccp_header_size); 425 dh = dccp_zeroed_hdr(skb, dccp_header_size);
426 426
427 dh->dccph_sport = inet_rsk(req)->loc_port; 427 dh->dccph_sport = htons(inet_rsk(req)->ir_num);
428 dh->dccph_dport = inet_rsk(req)->rmt_port; 428 dh->dccph_dport = inet_rsk(req)->ir_rmt_port;
429 dh->dccph_doff = (dccp_header_size + 429 dh->dccph_doff = (dccp_header_size +
430 DCCP_SKB_CB(skb)->dccpd_opt_len) / 4; 430 DCCP_SKB_CB(skb)->dccpd_opt_len) / 4;
431 dh->dccph_type = DCCP_PKT_RESPONSE; 431 dh->dccph_type = DCCP_PKT_RESPONSE;
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index ba64750f0387..eb892b4f4814 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -1158,10 +1158,8 @@ static int __init dccp_init(void)
1158 goto out_free_bind_bucket_cachep; 1158 goto out_free_bind_bucket_cachep;
1159 } 1159 }
1160 1160
1161 for (i = 0; i <= dccp_hashinfo.ehash_mask; i++) { 1161 for (i = 0; i <= dccp_hashinfo.ehash_mask; i++)
1162 INIT_HLIST_NULLS_HEAD(&dccp_hashinfo.ehash[i].chain, i); 1162 INIT_HLIST_NULLS_HEAD(&dccp_hashinfo.ehash[i].chain, i);
1163 INIT_HLIST_NULLS_HEAD(&dccp_hashinfo.ehash[i].twchain, i);
1164 }
1165 1163
1166 if (inet_ehash_locks_alloc(&dccp_hashinfo)) 1164 if (inet_ehash_locks_alloc(&dccp_hashinfo))
1167 goto out_free_dccp_ehash; 1165 goto out_free_dccp_ehash;