Skip to contentSkip to conversation

: Process incoming Change requests

PATCH In review Gerrit Renker 2 participants 2 messages Oct 1, 2007 – Oct 2, 2007 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 10/11 : Process incoming Change requests

[DCCP]: Process incoming Change requests

This adds/replaces code for processing incoming Change feature-negotiation options.

The main difference is that mandatory FN options are now interpreted inside the function (there are too many individual cases to do this externally); the function returns an appropriate Reset code or 0, which is then used by dccp_parse_options.

Old code, which is no longer used or referenced, has been removed.

---
 net/dccp/feat.c    |  220 ++++++++++++++++++++++++++++++-----------------------
 net/dccp/feat.h    |    4 
 net/dccp/options.c |   15 ---
 3 files changed, 132 insertions(+), 107 deletions(-)
net/dccp/feat.h +2 -2
@@ -103,8 +103,8 @@ static inline void dccp_feat_debug(const
 
 extern int  dccp_feat_register_change(struct sock *sk, u8 feat,
 				      u8 is_local, u8 *val, u8 len);
-extern int  dccp_feat_change_recv(struct sock *sk, u8 type, u8 feature,
-				  u8 *val, u8 len);
+extern int  dccp_feat_parse_options(struct sock *, struct dccp_request_sock *,
+				    u8 mand, u8 opt, u8 feat, u8 *val, u8 len);
 extern int  dccp_feat_confirm_recv(struct sock *sk, u8 type, u8 feature,
 				   u8 *val, u8 len);
 extern void dccp_feat_clean(struct dccp_minisock *dmsk);
net/dccp/options.c +3 -12
@@ -126,21 +126,12 @@ int dccp_parse_options(struct sock *sk, 
 				      (unsigned long long)opt_recv->dccpor_ndp);
 			break;
 		case DCCPO_CHANGE_L:
-			/* fall through */
 		case DCCPO_CHANGE_R:
 			if (pkt_type = DCCP_PKT_DATA)
 				break;
-			if (len < 2)
-				goto out_invalid_option;
-			rc = dccp_feat_change_recv(sk, opt, *value, value + 1,
-						   len - 1);
-			/*
-			 * When there is a change error, change_recv is
-			 * responsible for dealing with it.  i.e. reply with an
-			 * empty confirm.
-			 * If the change was mandatory, then we need to die.
-			 */
-			if (rc && mandatory)
+			rc = dccp_feat_parse_options(sk, dreq, mandatory, opt,
+						    *value, value + 1, len - 1);
+			if (rc)
 				goto out_invalid_option;
 			break;
 		case DCCPO_CONFIRM_L:
net/dccp/feat.c +127 -93

250 lines not on this page · raw message

Acked-by on v1 10/11
#1 lore raw
Quoted 11 lines · Gerrit Renker

[DCCP]: Process incoming Change requests

This adds/replaces code for processing incoming Change feature-negotiation options.

The main difference is that mandatory FN options are now interpreted inside the function (there are too many individual cases to do this externally); the function returns an appropriate Reset code or 0, which is then used by dccp_parse_options.

Old code, which is no longer used or referenced, has been removed.