* [PATCH net] sctp: asconf process should treat multiple address parameter as unrecognized parameter
@ 2015-08-24 10:07 Xin Long
2015-08-24 12:19 ` Sergei Shtylyov
2015-08-24 17:49 ` Vlad Yasevich
0 siblings, 2 replies; 7+ messages in thread
From: Xin Long @ 2015-08-24 10:07 UTC (permalink / raw)
To: network dev; +Cc: mleitner, davem
currently, we sctp_walk_params(), if we encounter the address parameter, we will
skip them, we do not care about how many addr params are there.
but the params of ASCONF chunk should consist of one *Address Parameter* and one
or more *ASCONF Parameters*.
so we will process multiple address parameters as unrecognized parameter and
send error cause to peer.
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
net/sctp/sm_make_chunk.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
index 06320c8..0ee5ca7 100644
--- a/net/sctp/sm_make_chunk.c
+++ b/net/sctp/sm_make_chunk.c
@@ -3217,10 +3217,18 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
/* Process the TLVs contained within the ASCONF chunk. */
sctp_walk_params(param, addip, addip_hdr.params) {
- /* Skip preceeding address parameters. */
+ /* Skip preceeding address parameters.
+ * process multi-addrparam as unrecognized parameters
+ */
if (param.p->type == SCTP_PARAM_IPV4_ADDRESS ||
- param.p->type == SCTP_PARAM_IPV6_ADDRESS)
+ param.p->type == SCTP_PARAM_IPV6_ADDRESS) {
+ if(param.addr != addr_param) {
+ all_param_pass = false;
+ sctp_add_asconf_response(asconf_ack, 0,
+ SCTP_ERROR_UNKNOWN_PARAM, param.v);
+ }
continue;
+ }
err_code = sctp_process_asconf_param(asoc, asconf,
param.addip);
--
2.1.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH net] sctp: asconf process should treat multiple address parameter as unrecognized parameter
2015-08-24 10:07 [PATCH net] sctp: asconf process should treat multiple address parameter as unrecognized parameter Xin Long
@ 2015-08-24 12:19 ` Sergei Shtylyov
2015-08-24 17:49 ` Vlad Yasevich
1 sibling, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2015-08-24 12:19 UTC (permalink / raw)
To: Xin Long, network dev; +Cc: mleitner, davem
Hello.
On 8/24/2015 1:07 PM, Xin Long wrote:
> currently, we sctp_walk_params(), if we encounter the address parameter, we will
> skip them, we do not care about how many addr params are there.
>
> but the params of ASCONF chunk should consist of one *Address Parameter* and one
> or more *ASCONF Parameters*.
>
> so we will process multiple address parameters as unrecognized parameter and
> send error cause to peer.
>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
> net/sctp/sm_make_chunk.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index 06320c8..0ee5ca7 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -3217,10 +3217,18 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
>
> /* Process the TLVs contained within the ASCONF chunk. */
> sctp_walk_params(param, addip, addip_hdr.params) {
> - /* Skip preceeding address parameters. */
> + /* Skip preceeding address parameters.
> + * process multi-addrparam as unrecognized parameters
> + */
> if (param.p->type == SCTP_PARAM_IPV4_ADDRESS ||
> - param.p->type == SCTP_PARAM_IPV6_ADDRESS)
> + param.p->type == SCTP_PARAM_IPV6_ADDRESS) {
> + if(param.addr != addr_param) {
Space needed after *if*.
> + all_param_pass = false;
> + sctp_add_asconf_response(asconf_ack, 0,
> + SCTP_ERROR_UNKNOWN_PARAM, param.v);
Please start the continuation line under 'asconf_ack'.
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] sctp: asconf process should treat multiple address parameter as unrecognized parameter
2015-08-24 10:07 [PATCH net] sctp: asconf process should treat multiple address parameter as unrecognized parameter Xin Long
2015-08-24 12:19 ` Sergei Shtylyov
@ 2015-08-24 17:49 ` Vlad Yasevich
2015-08-25 12:39 ` lucien xin
1 sibling, 1 reply; 7+ messages in thread
From: Vlad Yasevich @ 2015-08-24 17:49 UTC (permalink / raw)
To: Xin Long, network dev; +Cc: mleitner, davem
On 08/24/2015 06:07 AM, Xin Long wrote:
> currently, we sctp_walk_params(), if we encounter the address parameter, we will
> skip them, we do not care about how many addr params are there.
>
> but the params of ASCONF chunk should consist of one *Address Parameter* and one
> or more *ASCONF Parameters*.
>
> so we will process multiple address parameters as unrecognized parameter and
> send error cause to peer.
>
> Signed-off-by: Xin Long <lucien.xin@gmail.com>
> ---
> net/sctp/sm_make_chunk.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c
> index 06320c8..0ee5ca7 100644
> --- a/net/sctp/sm_make_chunk.c
> +++ b/net/sctp/sm_make_chunk.c
> @@ -3217,10 +3217,18 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,
>
> /* Process the TLVs contained within the ASCONF chunk. */
> sctp_walk_params(param, addip, addip_hdr.params) {
> - /* Skip preceeding address parameters. */
> + /* Skip preceeding address parameters.
> + * process multi-addrparam as unrecognized parameters
> + */
> if (param.p->type == SCTP_PARAM_IPV4_ADDRESS ||
> - param.p->type == SCTP_PARAM_IPV6_ADDRESS)
> + param.p->type == SCTP_PARAM_IPV6_ADDRESS) {
> + if(param.addr != addr_param) {
> + all_param_pass = false;
> + sctp_add_asconf_response(asconf_ack, 0,
> + SCTP_ERROR_UNKNOWN_PARAM, param.v);
> + }
> continue;
> + }
>
I think it would be much better to catch this in the validation stage.
If an implementation inserts multiple address parameters, we don't really know
which one we should be using.
-vlad
> err_code = sctp_process_asconf_param(asoc, asconf,
> param.addip);
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] sctp: asconf process should treat multiple address parameter as unrecognized parameter
2015-08-24 17:49 ` Vlad Yasevich
@ 2015-08-25 12:39 ` lucien xin
2015-08-25 12:43 ` lucien xin
0 siblings, 1 reply; 7+ messages in thread
From: lucien xin @ 2015-08-25 12:39 UTC (permalink / raw)
To: vyasevic; +Cc: network dev, Marcelo Ricardo Leitner, davem
>
> I think it would be much better to catch this in the validation stage.
> If an implementation inserts multiple address parameters, we don't really know
> which one we should be using.
>
the params of ASCONF chunk should consist of one *Address Parameter* and one
or more *ASCONF Parameters*. besides, the address parameter should be in the
beginning. so the first one must be our choice.
if we cat this in the validation stage, I think it will be hard to treat it as a
unrecognized parameter,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] sctp: asconf process should treat multiple address parameter as unrecognized parameter
2015-08-25 12:39 ` lucien xin
@ 2015-08-25 12:43 ` lucien xin
2015-08-25 14:18 ` Marcelo Ricardo Leitner
0 siblings, 1 reply; 7+ messages in thread
From: lucien xin @ 2015-08-25 12:43 UTC (permalink / raw)
To: vyasevic; +Cc: network dev, Marcelo Ricardo Leitner, davem
On Tue, Aug 25, 2015 at 8:39 PM, lucien xin <lucien.xin@gmail.com> wrote:
>>
>> I think it would be much better to catch this in the validation stage.
>> If an implementation inserts multiple address parameters, we don't really know
>> which one we should be using.
>>
>
> the params of ASCONF chunk should consist of one *Address Parameter* and one
> or more *ASCONF Parameters*. besides, the address parameter should be in the
> beginning. so the first one must be our choice.
>
> if we cat this in the validation stage, I think it will be hard to treat it as a
> unrecognized parameter,
because *unrecognized parameter* cause packet need to be built in
sctp_process_asconf(),
as current linux's implementation.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] sctp: asconf process should treat multiple address parameter as unrecognized parameter
2015-08-25 12:43 ` lucien xin
@ 2015-08-25 14:18 ` Marcelo Ricardo Leitner
2015-08-25 16:20 ` Vlad Yasevich
0 siblings, 1 reply; 7+ messages in thread
From: Marcelo Ricardo Leitner @ 2015-08-25 14:18 UTC (permalink / raw)
To: lucien xin; +Cc: vyasevic, network dev, davem
On Tue, Aug 25, 2015 at 08:43:10PM +0800, lucien xin wrote:
> On Tue, Aug 25, 2015 at 8:39 PM, lucien xin <lucien.xin@gmail.com> wrote:
> >>
> >> I think it would be much better to catch this in the validation stage.
> >> If an implementation inserts multiple address parameters, we don't really know
> >> which one we should be using.
> >>
> >
> > the params of ASCONF chunk should consist of one *Address Parameter* and one
> > or more *ASCONF Parameters*. besides, the address parameter should be in the
> > beginning. so the first one must be our choice.
That's not necessarily true. You're assuming the first is the best but
that's not ensured anywhere as RFC doesn't allow multiple parameteres in
there.
That also puts the entire asconf in question, because if it needed an
address parameter and now it has many and you don't know which one you
should use, you actually have none, and the needed parameter is thus
missing.
> > if we cat this in the validation stage, I think it will be hard to treat it as a
> > unrecognized parameter,
> because *unrecognized parameter* cause packet need to be built in
> sctp_process_asconf(),
> as current linux's implementation.
I agree with Vlad, but yeah, it may make error reporting harder.
Although I don't have any issue if we just fall through the current error
handling for bad asconf chunks, which aborts the association due to
param len violation. Vlad?
Marcelo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net] sctp: asconf process should treat multiple address parameter as unrecognized parameter
2015-08-25 14:18 ` Marcelo Ricardo Leitner
@ 2015-08-25 16:20 ` Vlad Yasevich
0 siblings, 0 replies; 7+ messages in thread
From: Vlad Yasevich @ 2015-08-25 16:20 UTC (permalink / raw)
To: Marcelo Ricardo Leitner, lucien xin; +Cc: network dev, davem
On 08/25/2015 10:18 AM, Marcelo Ricardo Leitner wrote:
> On Tue, Aug 25, 2015 at 08:43:10PM +0800, lucien xin wrote:
>> On Tue, Aug 25, 2015 at 8:39 PM, lucien xin <lucien.xin@gmail.com> wrote:
>>>>
>>>> I think it would be much better to catch this in the validation stage.
>>>> If an implementation inserts multiple address parameters, we don't really know
>>>> which one we should be using.
>>>>
>>>
>>> the params of ASCONF chunk should consist of one *Address Parameter* and one
>>> or more *ASCONF Parameters*. besides, the address parameter should be in the
>>> beginning. so the first one must be our choice.
>
> That's not necessarily true. You're assuming the first is the best but
> that's not ensured anywhere as RFC doesn't allow multiple parameteres in
> there.
>
> That also puts the entire asconf in question, because if it needed an
> address parameter and now it has many and you don't know which one you
> should use, you actually have none, and the needed parameter is thus
> missing.
>
>>> if we cat this in the validation stage, I think it will be hard to treat it as a
>>> unrecognized parameter,
>> because *unrecognized parameter* cause packet need to be built in
>> sctp_process_asconf(),
>> as current linux's implementation.
>
> I agree with Vlad, but yeah, it may make error reporting harder.
> Although I don't have any issue if we just fall through the current error
> handling for bad asconf chunks, which aborts the association due to
> param len violation. Vlad?
I've been looking at the spec and the spec does not make any requirements on the
the number of address parameters present. The only thing we have to draw any
additional requirements from is the format of the ASCONF message.
That format provides space for a single address parameter and doesn't to include
any options data between it and and ASCONF parameters. Based on that, I would
argue that inclusion of multiple Address Parameters in the ASCONF message is a
violation of ASCONF protocol and should be dealt with the same as all the other
violations we have.
I believe the above would make things a lot simpler.
-vlad
> Marcelo
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-08-25 16:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-24 10:07 [PATCH net] sctp: asconf process should treat multiple address parameter as unrecognized parameter Xin Long
2015-08-24 12:19 ` Sergei Shtylyov
2015-08-24 17:49 ` Vlad Yasevich
2015-08-25 12:39 ` lucien xin
2015-08-25 12:43 ` lucien xin
2015-08-25 14:18 ` Marcelo Ricardo Leitner
2015-08-25 16:20 ` Vlad Yasevich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).