diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2009-01-16 18:36:32 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-21 17:34:05 -0500 |
commit | 883ca833e5fb814fb03426c9d35e5489ce43e8da (patch) | |
tree | dcf361291b79e57195f8d89ca493c15c835b14cf /net/dccp/feat.c | |
parent | 792b48780e8b6435d017cef4b5c304876a48653e (diff) |
dccp: Initialisation and type-checking of feature sysctls
This patch takes care of initialising and type-checking sysctls
related to feature negotiation. Type checking is important since some
of the sysctls now directly impact the feature-negotiation process.
The sysctls are initialised with the known default values for each
feature. For the type-checking the value constraints from RFC 4340
are used:
* Sequence Window uses the specified Wmin=32, the maximum is ulong (4 bytes),
tested and confirmed that it works up to 4294967295 - for Gbps speed;
* Ack Ratio is between 0 .. 0xffff (2-byte unsigned integer);
* CCIDs are between 0 .. 255;
* request_retries, retries1, retries2 also between 0..255 for good measure;
* tx_qlen is checked to be non-negative;
* sync_ratelimit remains as before.
Notes:
------
1. Die s@sysctl_dccp_feat@sysctl_dccp@g since the sysctls are now in feat.c.
2. As pointed out by Arnaldo, the pattern of type-checking repeats itself in
other places, sometimes with exactly the same kind of definitions (e.g.
"static int zero;"). It may be a good idea (kernel janitors?) to consolidate
type checking. For the sake of keeping the changeset small and in order not
to affect other subsystems, I have not strived to generalise here.
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>
Diffstat (limited to 'net/dccp/feat.c')
-rw-r--r-- | net/dccp/feat.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/net/dccp/feat.c b/net/dccp/feat.c index 7303f79705d2..12006e9b2472 100644 --- a/net/dccp/feat.c +++ b/net/dccp/feat.c | |||
@@ -25,6 +25,11 @@ | |||
25 | #include "ccid.h" | 25 | #include "ccid.h" |
26 | #include "feat.h" | 26 | #include "feat.h" |
27 | 27 | ||
28 | /* feature-specific sysctls - initialised to the defaults from RFC 4340, 6.4 */ | ||
29 | unsigned long sysctl_dccp_sequence_window __read_mostly = 100; | ||
30 | int sysctl_dccp_rx_ccid __read_mostly = 2, | ||
31 | sysctl_dccp_tx_ccid __read_mostly = 2; | ||
32 | |||
28 | /* | 33 | /* |
29 | * Feature activation handlers. | 34 | * Feature activation handlers. |
30 | * | 35 | * |
@@ -1146,7 +1151,7 @@ int dccp_feat_init(struct sock *sk) | |||
1146 | 1151 | ||
1147 | /* Non-negotiable (NN) features */ | 1152 | /* Non-negotiable (NN) features */ |
1148 | rc = __feat_register_nn(fn, DCCPF_SEQUENCE_WINDOW, 0, | 1153 | rc = __feat_register_nn(fn, DCCPF_SEQUENCE_WINDOW, 0, |
1149 | sysctl_dccp_feat_sequence_window); | 1154 | sysctl_dccp_sequence_window); |
1150 | if (rc) | 1155 | if (rc) |
1151 | return rc; | 1156 | return rc; |
1152 | 1157 | ||
@@ -1172,8 +1177,8 @@ int dccp_feat_init(struct sock *sk) | |||
1172 | ccid_get_builtin_ccids(&rx.val, &rx.len)) | 1177 | ccid_get_builtin_ccids(&rx.val, &rx.len)) |
1173 | return -ENOBUFS; | 1178 | return -ENOBUFS; |
1174 | 1179 | ||
1175 | if (!dccp_feat_prefer(sysctl_dccp_feat_tx_ccid, tx.val, tx.len) || | 1180 | if (!dccp_feat_prefer(sysctl_dccp_tx_ccid, tx.val, tx.len) || |
1176 | !dccp_feat_prefer(sysctl_dccp_feat_rx_ccid, rx.val, rx.len)) | 1181 | !dccp_feat_prefer(sysctl_dccp_rx_ccid, rx.val, rx.len)) |
1177 | goto free_ccid_lists; | 1182 | goto free_ccid_lists; |
1178 | 1183 | ||
1179 | rc = __feat_register_sp(fn, DCCPF_CCID, true, false, tx.val, tx.len); | 1184 | rc = __feat_register_sp(fn, DCCPF_CCID, true, false, tx.val, tx.len); |