Subject: Re: [PATCH] SCTP: Reduce log spamming for sctp setsockopt

From: Daniel Borkmann <[email-masked]>
Date: Mon, 16 Dec 2013 16:45:05 +0100

On 12/16/2013 04:21 PM, Joe Perches wrote:
> On Mon, 2013-12-16 at 16:13 +0100, Daniel Borkmann wrote:
>> On 12/16/2013 04:03 PM, Joe Perches wrote:
>>> On Mon, 2013-12-16 at 09:44 -0500, Neil Horman wrote:
>>>> During a recent discussion regarding some sctp socket options, it was noted that
>>>> we have several points at which we issue log warnings that can be flooded at an
>>>> unbounded rate by any user.  Fix this by converting all the pr_warns in the
>>>> sctp_setsockopt path to be pr_warn_ratelimited.
>>>
>>> trivial note:
>> [...]
>>>> @@ -5311,8 +5311,8 @@ static int sctp_getsockopt_maxburst(struct sock *sk, int len,
>>> []
>>>> +		pr_warn_ratelimited("Use of int in max_burst socket option deprecated\n");
>>>> +		pr_warn_ratelimited("Use struct sctp_assoc_value instead\n");
>>>
>>> Perhaps a dedicated "deprecated" warning function
>>> to centralize these?
>>>
>>> void _sctp_warn_deprecated(const char *func, const char *from, const char *to);
>>> {
>>> 	etc.
>>> }
>>> #define sctp_warn_deprecated(from, to)		\
>>> 	_sctp_warn_deprecated(__func__, from, to)
>>
>> If so, then this should better get even more "centralized" ... as e.g.
>> pr_warn_deprecated() [which internally is ratelimited]. I don't see the
>> point why only SCTP should have this special-cased.
>
> Sure, if it's useful outside of sctp, but I didn't
> notice any other uses like it.

If we have a generic API for that, they might come, sure.