Skip to content

Commit 6fdd34d

Browse files
Gerrit Renkerdavem330
authored andcommitted
dccp ccid-2: Phase out the use of boolean Ack Vector sysctl
This removes the use of the sysctl and the minisock variable for the Send Ack Vector feature, as it now is handled fully dynamically via feature negotiation (i.e. when CCID-2 is enabled, Ack Vectors are automatically enabled as per RFC 4341, 4.). Using a sysctl in parallel to this implementation would open the door to crashes, since much of the code relies on tests of the boolean minisock / sysctl variable. Thus, this patch replaces all tests of type if (dccp_msk(sk)->dccpms_send_ack_vector) /* ... */ with if (dp->dccps_hc_rx_ackvec != NULL) /* ... */ The dccps_hc_rx_ackvec is allocated by the dccp_hdlr_ackvec() when feature negotiation concluded that Ack Vectors are to be used on the half-connection. Otherwise, it is NULL (due to dccp_init_sock/dccp_create_openreq_child), so that the test is a valid one. The activation handler for Ack Vectors is called as soon as the feature negotiation has concluded at the * server when the Ack marking the transition RESPOND => OPEN arrives; * client after it has sent its ACK, marking the transition REQUEST => PARTOPEN. Adding the sequence number of the Response packet to the Ack Vector has been removed, since (a) connection establishment implies that the Response has been received; (b) the CCIDs only look at packets received in the (PART)OPEN state, i.e. this entry will always be ignored; (c) it can not be used for anything useful - to detect loss for instance, only packets received after the loss can serve as pseudo-dupacks. There was a FIXME to change the error code when dccp_ackvec_add() fails. I removed this after finding out that: * the check whether ackno < ISN is already made earlier, * this Response is likely the 1st packet with an Ackno that the client gets, * so when dccp_ackvec_add() fails, the reason is likely not a packet error. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4098dce commit 6fdd34d

9 files changed

Lines changed: 8 additions & 33 deletions

File tree

‎Documentation/networking/dccp.txt‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ retries2
133133
importance for retransmitted acknowledgments and feature negotiation,
134134
data packets are never retransmitted. Analogue of tcp_retries2.
135135

136-
send_ackvec = 1
137-
Whether or not to send Ack Vector options (sec. 11.5).
138-
139136
tx_ccid = 2
140137
Default CCID for the sender-receiver half-connection. Depending on the
141138
choice of CCID, the Send Ack Vector feature is enabled automatically.

‎include/linux/dccp.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
360360
#define DCCPF_INITIAL_SEQUENCE_WINDOW 100
361361
#define DCCPF_INITIAL_ACK_RATIO 2
362362
#define DCCPF_INITIAL_CCID DCCPC_CCID2
363-
#define DCCPF_INITIAL_SEND_ACK_VECTOR 1
364363
/* FIXME: for now we're default to 1 but it should really be 0 */
365364
#define DCCPF_INITIAL_SEND_NDP_COUNT 1
366365

@@ -370,13 +369,11 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
370369
* Will be used to pass the state from dccp_request_sock to dccp_sock.
371370
*
372371
* @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
373-
* @dccpms_send_ack_vector - Send Ack Vector Feature (section 11.5)
374372
* @dccpms_pending - List of features being negotiated
375373
* @dccpms_conf -
376374
*/
377375
struct dccp_minisock {
378376
__u64 dccpms_sequence_window;
379-
__u8 dccpms_send_ack_vector;
380377
struct list_head dccpms_pending;
381378
struct list_head dccpms_conf;
382379
};

‎net/dccp/dccp.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ extern int sysctl_dccp_retries2;
9898
extern int sysctl_dccp_feat_sequence_window;
9999
extern int sysctl_dccp_feat_rx_ccid;
100100
extern int sysctl_dccp_feat_tx_ccid;
101-
extern int sysctl_dccp_feat_send_ack_vector;
102101
extern int sysctl_dccp_tx_qlen;
103102
extern int sysctl_dccp_sync_ratelimit;
104103

@@ -434,7 +433,7 @@ static inline int dccp_ack_pending(const struct sock *sk)
434433
const struct dccp_sock *dp = dccp_sk(sk);
435434
return dp->dccps_timestamp_echo != 0 ||
436435
#ifdef CONFIG_IP_DCCP_ACKVEC
437-
(dccp_msk(sk)->dccpms_send_ack_vector &&
436+
(dp->dccps_hc_rx_ackvec != NULL &&
438437
dccp_ackvec_pending(dp->dccps_hc_rx_ackvec)) ||
439438
#endif
440439
inet_csk_ack_scheduled(sk);

‎net/dccp/diag.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static void dccp_get_info(struct sock *sk, struct tcp_info *info)
2929
info->tcpi_backoff = icsk->icsk_backoff;
3030
info->tcpi_pmtu = icsk->icsk_pmtu_cookie;
3131

32-
if (dccp_msk(sk)->dccpms_send_ack_vector)
32+
if (dp->dccps_hc_rx_ackvec != NULL)
3333
info->tcpi_options |= TCPI_OPT_SACK;
3434

3535
ccid_hc_rx_get_info(dp->dccps_hc_rx_ccid, sk, info);

‎net/dccp/input.c‎

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static void dccp_event_ack_recv(struct sock *sk, struct sk_buff *skb)
163163
{
164164
struct dccp_sock *dp = dccp_sk(sk);
165165

166-
if (dccp_msk(sk)->dccpms_send_ack_vector)
166+
if (dp->dccps_hc_rx_ackvec != NULL)
167167
dccp_ackvec_check_rcv_ackno(dp->dccps_hc_rx_ackvec, sk,
168168
DCCP_SKB_CB(skb)->dccpd_ack_seq);
169169
}
@@ -375,7 +375,7 @@ int dccp_rcv_established(struct sock *sk, struct sk_buff *skb,
375375
if (DCCP_SKB_CB(skb)->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
376376
dccp_event_ack_recv(sk, skb);
377377

378-
if (dccp_msk(sk)->dccpms_send_ack_vector &&
378+
if (dp->dccps_hc_rx_ackvec != NULL &&
379379
dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
380380
DCCP_SKB_CB(skb)->dccpd_seq,
381381
DCCP_ACKVEC_STATE_RECEIVED))
@@ -434,12 +434,6 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
434434
dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * (tstamp -
435435
dp->dccps_options_received.dccpor_timestamp_echo));
436436

437-
if (dccp_msk(sk)->dccpms_send_ack_vector &&
438-
dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
439-
DCCP_SKB_CB(skb)->dccpd_seq,
440-
DCCP_ACKVEC_STATE_RECEIVED))
441-
goto out_invalid_packet; /* FIXME: change error code */
442-
443437
/* Stop the REQUEST timer */
444438
inet_csk_clear_xmit_timer(sk, ICSK_TIME_RETRANS);
445439
WARN_ON(sk->sk_send_head == NULL);
@@ -637,7 +631,7 @@ int dccp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
637631
if (dcb->dccpd_ack_seq != DCCP_PKT_WITHOUT_ACK_SEQ)
638632
dccp_event_ack_recv(sk, skb);
639633

640-
if (dccp_msk(sk)->dccpms_send_ack_vector &&
634+
if (dp->dccps_hc_rx_ackvec != NULL &&
641635
dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
642636
DCCP_SKB_CB(skb)->dccpd_seq,
643637
DCCP_ACKVEC_STATE_RECEIVED))

‎net/dccp/minisocks.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ EXPORT_SYMBOL_GPL(dccp_death_row);
4545
void dccp_minisock_init(struct dccp_minisock *dmsk)
4646
{
4747
dmsk->dccpms_sequence_window = sysctl_dccp_feat_sequence_window;
48-
dmsk->dccpms_send_ack_vector = sysctl_dccp_feat_send_ack_vector;
4948
}
5049

5150
void dccp_time_wait(struct sock *sk, int state, int timeo)

‎net/dccp/options.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
int sysctl_dccp_feat_sequence_window = DCCPF_INITIAL_SEQUENCE_WINDOW;
2727
int sysctl_dccp_feat_rx_ccid = DCCPF_INITIAL_CCID;
2828
int sysctl_dccp_feat_tx_ccid = DCCPF_INITIAL_CCID;
29-
int sysctl_dccp_feat_send_ack_vector = DCCPF_INITIAL_SEND_ACK_VECTOR;
3029

3130
u64 dccp_decode_value_var(const u8 *bf, const u8 len)
3231
{
@@ -145,8 +144,7 @@ int dccp_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
145144
case DCCPO_ACK_VECTOR_1:
146145
if (dccp_packet_without_ack(skb)) /* RFC 4340, 11.4 */
147146
break;
148-
149-
if (dccp_msk(sk)->dccpms_send_ack_vector &&
147+
if (dp->dccps_hc_rx_ackvec != NULL &&
150148
dccp_ackvec_parse(sk, skb, &ackno, opt, value, len))
151149
goto out_invalid_option;
152150
break;
@@ -526,7 +524,6 @@ static void dccp_insert_option_padding(struct sk_buff *skb)
526524
int dccp_insert_options(struct sock *sk, struct sk_buff *skb)
527525
{
528526
struct dccp_sock *dp = dccp_sk(sk);
529-
struct dccp_minisock *dmsk = dccp_msk(sk);
530527

531528
DCCP_SKB_CB(skb)->dccpd_opt_len = 0;
532529

@@ -547,7 +544,7 @@ int dccp_insert_options(struct sock *sk, struct sk_buff *skb)
547544
if (dccp_insert_option_timestamp(sk, skb))
548545
return -1;
549546

550-
} else if (dmsk->dccpms_send_ack_vector &&
547+
} else if (dp->dccps_hc_rx_ackvec != NULL &&
551548
dccp_ackvec_pending(dp->dccps_hc_rx_ackvec) &&
552549
dccp_insert_option_ackvec(sk, skb)) {
553550
return -1;

‎net/dccp/proto.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ EXPORT_SYMBOL_GPL(dccp_init_sock);
201201
void dccp_destroy_sock(struct sock *sk)
202202
{
203203
struct dccp_sock *dp = dccp_sk(sk);
204-
struct dccp_minisock *dmsk = dccp_msk(sk);
205204

206205
/*
207206
* DCCP doesn't use sk_write_queue, just sk_send_head
@@ -219,7 +218,7 @@ void dccp_destroy_sock(struct sock *sk)
219218
kfree(dp->dccps_service_list);
220219
dp->dccps_service_list = NULL;
221220

222-
if (dmsk->dccpms_send_ack_vector) {
221+
if (dp->dccps_hc_rx_ackvec != NULL) {
223222
dccp_ackvec_free(dp->dccps_hc_rx_ackvec);
224223
dp->dccps_hc_rx_ackvec = NULL;
225224
}

‎net/dccp/sysctl.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,6 @@ static struct ctl_table dccp_default_table[] = {
4040
.mode = 0644,
4141
.proc_handler = proc_dointvec,
4242
},
43-
{
44-
.procname = "send_ackvec",
45-
.data = &sysctl_dccp_feat_send_ack_vector,
46-
.maxlen = sizeof(sysctl_dccp_feat_send_ack_vector),
47-
.mode = 0644,
48-
.proc_handler = proc_dointvec,
49-
},
5043
{
5144
.procname = "request_retries",
5245
.data = &sysctl_dccp_request_retries,

0 commit comments

Comments
 (0)