dccp: Query supported CCIDs
This provides a data structure to record which CCIDs are locally supported and three accessor functions: - a test function for internal use which is used to validate CCID requests made by the user; - a copy function so that the list can be used for feature-negotiation; - documented getsockopt() support so that the user can query capabilities. The data structure is a table which is filled in at compile-time with the list of available CCIDs (which in turn depends on the Kconfig choices). Using the copy function for cloning the list of supported CCIDs is useful for feature negotiation, since the negotiation is now with the full list of available CCIDs (e.g. {2, 3}) instead of the default value {2}. This means negotiation will not fail if the peer requests to use CCID3 instead of CCID2. 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>
This commit is contained in:
committed by
David S. Miller
parent
e8ef967a54
commit
d90ebcbfa7
@@ -342,6 +342,10 @@ static int __feat_register_sp(struct list_head *fn, u8 feat, u8 is_local,
|
||||
!dccp_feat_sp_list_ok(feat, sp_val, sp_len))
|
||||
return -EINVAL;
|
||||
|
||||
/* Avoid negotiating alien CCIDs by only advertising supported ones */
|
||||
if (feat == DCCPF_CCID && !ccid_support_check(sp_val, sp_len))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (dccp_feat_clone_sp_val(&fval, sp_val, sp_len))
|
||||
return -ENOMEM;
|
||||
|
||||
|
Reference in New Issue
Block a user