options: Make dccp_insert_options & friends yell on error
PATCH 5/5 options: Make dccp_insert_options & friends yell on error
And not the silly LIMIT_NETDEBUG and silently return without inserting the option requested.
Also drop some old debugging messages associated to option insertion.
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
---
net/dccp/ackvec.c | 14 +++--- net/dccp/ccid.h | 18 ++++---- net/dccp/ccids/ccid3.c | 37 +++++++++------- net/dccp/dccp.h | 8 ++-- net/dccp/options.c | 109 ++++++++++++++++++++---------------------------- net/dccp/output.c | 18 +++++++- 6 files changed, 102 insertions(+), 102 deletions(-)
3dabf50385c2b28630c104ca8cdbb0be7b1b6d70
net/dccp/ackvec.c +7 -7
@@ -81,15 +81,16 @@ int dccp_insert_option_ackvec(struct socif (DCCP_SKB_CB (skb)->dccpd_opt_len + len >DCCP_MAX_OPT_LEN )return -1 ; - avr =dccp_ackvec_record_new (); -if (avr =NULL ) -return -1 ; -dccp_timestamp (sk, &now); elapsed_time =timeval_delta (&now, &av->dccpav_time) /10 ; -if (elapsed_time !=0 ) -dccp_insert_option_elapsed_time (sk, skb, elapsed_time); +if (elapsed_time !=0 && +dccp_insert_option_elapsed_time (sk, skb, elapsed_time)) +return -1 ; + + avr =dccp_ackvec_record_new (); +if (avr =NULL ) +return -1 ;DCCP_SKB_CB (skb)->dccpd_opt_len += len;
@@ -310,7 +311,6 @@ int dccp_ackvec_add(struct dccp_ackvec * av->dccpav_buf_ackno = ackno;dccp_timestamp (sk, &av->dccpav_time); out: -dccp_pr_debug ("" );return 0 ; out_duplicate:
net/dccp/ccid.h +10 -8
@@ -41,9 +41,9 @@ struct ccid_operations {unsigned char option, unsigned char len, u16 idx, unsigned char* value); -void (*ccid_hc_rx_insert_options)(struct sock *sk, +int (*ccid_hc_rx_insert_options)(struct sock *sk,struct sk_buff *skb); -void (*ccid_hc_tx_insert_options)(struct sock *sk, +int (*ccid_hc_tx_insert_options)(struct sock *sk,struct sk_buff *skb);void (*ccid_hc_tx_packet_recv)(struct sock *sk,struct sk_buff *skb);
@@ -146,18 +146,20 @@ static inline int ccid_hc_rx_parse_optioreturn rc; } -static inline void ccid_hc_tx_insert_options (struct ccid *ccid,struct sock *sk, -struct sk_buff *skb) +static inline int ccid_hc_tx_insert_options (struct ccid *ccid,struct sock *sk, +struct sk_buff *skb) {if (ccid->ccid_ops->ccid_hc_tx_insert_options !=NULL ) - ccid->ccid_ops->ccid_hc_tx_insert_options (sk, skb); +return ccid->ccid_ops->ccid_hc_tx_insert_options (sk, skb); +return 0 ; } -static inline void ccid_hc_rx_insert_options (struct ccid *ccid,struct sock *sk, -struct sk_buff *skb) +static inline int ccid_hc_rx_insert_options (struct ccid *ccid,struct sock *sk, +struct sk_buff *skb) {if (ccid->ccid_ops->ccid_hc_rx_insert_options !=NULL ) - ccid->ccid_ops->ccid_hc_rx_insert_options (sk, skb); +return ccid->ccid_ops->ccid_hc_rx_insert_options (sk, skb); +return 0 ; } static inline void ccid_hc_rx_get_info(struct ccid *ccid, struct sock *sk,
net/dccp/ccids/ccid3.c +20 -17
@@ -574,16 +574,15 @@ static void ccid3_hc_tx_packet_recv(stru } } -static void ccid3_hc_tx_insert_options (struct sock *sk,struct sk_buff *skb) +static int ccid3_hc_tx_insert_options (struct sock *sk,struct sk_buff *skb) {const struct ccid3_hc_tx_sock *hctx =ccid3_hc_tx_sk (sk);BUG_ON (hctx =NULL ); -if (!(sk->sk_state =DCCP_OPEN || sk->sk_state =DCCP_PARTOPEN )) -return ; - -DCCP_SKB_CB (skb)->dccpd_ccval = hctx->ccid3hctx_last_win_count; +if (sk->sk_state =DCCP_OPEN || sk->sk_state =DCCP_PARTOPEN ) +DCCP_SKB_CB (skb)->dccpd_ccval = hctx->ccid3hctx_last_win_count; +return 0 ; } static int ccid3_hc_tx_parse_options(struct sock *sk, unsigned char option,
@@ -774,7 +773,7 @@ static void ccid3_hc_rx_send_feedback(stdccp_send_ack (sk); } -static void ccid3_hc_rx_insert_options (struct sock *sk,struct sk_buff *skb) +static int ccid3_hc_rx_insert_options (struct sock *sk,struct sk_buff *skb) {const struct ccid3_hc_rx_sock *hcrx =ccid3_hc_rx_sk (sk);__be32 x_recv, pinv;
@@ -782,23 +781,27 @@ static void ccid3_hc_rx_insert_options(sBUG_ON (hcrx =NULL );if (!(sk->sk_state =DCCP_OPEN || sk->sk_state =DCCP_PARTOPEN )) -return ; +return 0 ;DCCP_SKB_CB (skb)->dccpd_ccval = hcrx->ccid3hcrx_last_counter;if (dccp_packet_without_ack (skb)) -return ; - -if (hcrx->ccid3hcrx_elapsed_time !=0 ) -dccp_insert_option_elapsed_time (sk, skb, - hcrx->ccid3hcrx_elapsed_time); -dccp_insert_option_timestamp (sk, skb); +return 0 ; + x_recv =htonl (hcrx->ccid3hcrx_x_recv); pinv =htonl (hcrx->ccid3hcrx_pinv); -dccp_insert_option (sk, skb,TFRC_OPT_LOSS_EVENT_RATE , - &pinv,sizeof (pinv)); -dccp_insert_option (sk, skb,TFRC_OPT_RECEIVE_RATE , - &x_recv,sizeof (x_recv)); + +if ((hcrx->ccid3hcrx_elapsed_time !=0 && +dccp_insert_option_elapsed_time (sk, skb, + hcrx->ccid3hcrx_elapsed_time)) || +dccp_insert_option_timestamp (sk, skb) || +dccp_insert_option (sk, skb,TFRC_OPT_LOSS_EVENT_RATE , + &pinv,sizeof (pinv)) || +dccp_insert_option (sk, skb,TFRC_OPT_RECEIVE_RATE , + &x_recv,sizeof (x_recv))) +return -1 ; + +return 0 ; }/* calculate first loss interval
net/dccp/dccp.h +4 -4
@@ -326,13 +326,13 @@ static inline int dccp_ack_pending(constinet_csk_ack_scheduled (sk); } -extern void dccp_insert_options (struct sock *sk,struct sk_buff *skb); -extern void dccp_insert_option_elapsed_time (struct sock *sk, +extern int dccp_insert_options (struct sock *sk,struct sk_buff *skb); +extern int dccp_insert_option_elapsed_time (struct sock *sk,struct sk_buff *skb,u32 elapsed_time); -extern void dccp_insert_option_timestamp (struct sock *sk, +extern int dccp_insert_option_timestamp (struct sock *sk,struct sk_buff *skb); -extern void dccp_insert_option (struct sock *sk,struct sk_buff *skb, +extern int dccp_insert_option (struct sock *sk,struct sk_buff *skb,unsigned char option,const void *value,unsigned char len);
net/dccp/options.c +46 -63
230 lines not on this page · raw message
net/dccp/output.c +15 -3
@@ -83,7 +83,11 @@ static int dccp_transmit_skb(struct sock } dcb->dccpd_seq = dp->dccps_gss; -dccp_insert_options (sk, skb); + +if (dccp_insert_options (sk, skb)) { +kfree_skb (skb); +return -EPROTO ; + } skb->h.raw =skb_push (skb, dccp_header_size); dh =dccp_hdr (skb);
@@ -296,7 +300,11 @@ struct sk_buff *dccp_make_response(struc dreq =dccp_rsk (req);DCCP_SKB_CB (skb)->dccpd_type =DCCP_PKT_RESPONSE ;DCCP_SKB_CB (skb)->dccpd_seq = dreq->dreq_iss; -dccp_insert_options (sk, skb); + +if (dccp_insert_options (sk, skb)) { +kfree_skb (skb); +return NULL ; + } skb->h.raw =skb_push (skb, dccp_header_size);
@@ -344,7 +352,11 @@ static struct sk_buff *dccp_make_reset(sDCCP_SKB_CB (skb)->dccpd_reset_code = code;DCCP_SKB_CB (skb)->dccpd_type =DCCP_PKT_RESET ;DCCP_SKB_CB (skb)->dccpd_seq = dp->dccps_gss; -dccp_insert_options (sk, skb); + +if (dccp_insert_options (sk, skb)) { +kfree_skb (skb); +return NULL ; + } skb->h.raw =skb_push (skb, dccp_header_size);
Signature · 1 line
1.2.2.gd27d