All of lore.kernel.org
 help / color / mirror / Atom feed
* Question regarding struct sctp_association
@ 2011-01-10 11:51 Holger Hans Peter Freyther
  2011-01-11  9:12 ` Wei Yongjun
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Holger Hans Peter Freyther @ 2011-01-10 11:51 UTC (permalink / raw)
  To: linux-sctp

Hi,

I have a small consistency question. In sctp_packet_transmit of
net/sctp/output.c some parts of the method check if the asoc is valid, other
assume that there is one.

I have some questions regarding that.

The sctp_packet has a pointer to sctp_transport. Does every sctp_transport
hold a valid pointer to sctp_association? Does it hold a valid pointer if
authentication (sctp_auth) is used? Does it hold a valid pointer if chunks
were seen?

regards
	holger

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question regarding struct sctp_association
  2011-01-10 11:51 Question regarding struct sctp_association Holger Hans Peter Freyther
@ 2011-01-11  9:12 ` Wei Yongjun
  2011-01-11 10:29 ` Holger Hans Peter Freyther
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Wei Yongjun @ 2011-01-11  9:12 UTC (permalink / raw)
  To: linux-sctp


> Hi,
>
> I have a small consistency question. In sctp_packet_transmit of
> net/sctp/output.c some parts of the method check if the asoc is valid, other
> assume that there is one.
>
> I have some questions regarding that.
>
> The sctp_packet has a pointer to sctp_transport. Does every sctp_transport
> hold a valid pointer to sctp_association? Does it hold a valid pointer if


assoc not always valid, when we response to an OOTB packet, the
assoc will be NULL.


> authentication (sctp_auth) is used? Does it hold a valid pointer if chunks
> were seen?
>
> regards
> 	holger
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question regarding struct sctp_association
  2011-01-10 11:51 Question regarding struct sctp_association Holger Hans Peter Freyther
  2011-01-11  9:12 ` Wei Yongjun
@ 2011-01-11 10:29 ` Holger Hans Peter Freyther
  2011-01-12  1:00 ` Wei Yongjun
  2011-01-12 14:35 ` Holger Hans Peter Freyther
  3 siblings, 0 replies; 5+ messages in thread
From: Holger Hans Peter Freyther @ 2011-01-11 10:29 UTC (permalink / raw)
  To: linux-sctp

On 01/11/2011 10:12 AM, Wei Yongjun wrote:
> 

>> The sctp_packet has a pointer to sctp_transport. Does every sctp_transport
>> hold a valid pointer to sctp_association? Does it hold a valid pointer if
> 
> assoc not always valid, when we response to an OOTB packet, the
> assoc will be NULL.

Thanks, I am sorry if the next question is totally obvious. I am obviously not
too familiar with SCTP and the implementation here. For an OOTB packet we
first check if we want to ignore it according to the RFC and then it will be
placed in sctp_inq_push(&chunk->rcvr->inqueue, chunk) and here is where I am
lost and the below is just guessing.


--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -490,7 +490,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
         *    HMAC field set to zero (as shown in Figure 6) followed by all
         *    chunks that are placed after the AUTH chunk in the SCTP packet.
         */
-       if (auth)
+       if (auth && asoc)
                sctp_auth_calculate_hmac(asoc, nskb,
                                        (struct sctp_auth_chunk *)auth,
                                        GFP_ATOMIC);

Can an OOTB packet force us to calculate the hmac here?



@@ -563,7 +563,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
                unsigned long timeout;

                /* Restart the AUTOCLOSE timer when sending data. */
-               if (sctp_state(asoc, ESTABLISHED) && asoc->autoclose) {
+               if (asoc && sctp_state(asoc, ESTABLISHED) && asoc->autoclose) {
                        timer = &asoc->timers[SCTP_EVENT_TIMEOUT_AUTOCLOSE];
                        timeout = asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE];


Can an OOTB packet contain data chunks that would make us go through this path?




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question regarding struct sctp_association
  2011-01-10 11:51 Question regarding struct sctp_association Holger Hans Peter Freyther
  2011-01-11  9:12 ` Wei Yongjun
  2011-01-11 10:29 ` Holger Hans Peter Freyther
@ 2011-01-12  1:00 ` Wei Yongjun
  2011-01-12 14:35 ` Holger Hans Peter Freyther
  3 siblings, 0 replies; 5+ messages in thread
From: Wei Yongjun @ 2011-01-12  1:00 UTC (permalink / raw)
  To: linux-sctp


> On 01/11/2011 10:12 AM, Wei Yongjun wrote:
>>> The sctp_packet has a pointer to sctp_transport. Does every sctp_transport
>>> hold a valid pointer to sctp_association? Does it hold a valid pointer if
>> assoc not always valid, when we response to an OOTB packet, the
>> assoc will be NULL.
> Thanks, I am sorry if the next question is totally obvious. I am obviously not
> too familiar with SCTP and the implementation here. For an OOTB packet we
> first check if we want to ignore it according to the RFC and then it will be
> placed in sctp_inq_push(&chunk->rcvr->inqueue, chunk) and here is where I am
> lost and the below is just guessing.
>
>
> --- a/net/sctp/output.c
> +++ b/net/sctp/output.c
> @@ -490,7 +490,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
>          *    HMAC field set to zero (as shown in Figure 6) followed by all
>          *    chunks that are placed after the AUTH chunk in the SCTP packet.
>          */
> -       if (auth)
> +       if (auth && asoc)
>                 sctp_auth_calculate_hmac(asoc, nskb,
>                                         (struct sctp_auth_chunk *)auth,
>                                         GFP_ATOMIC);
>
> Can an OOTB packet force us to calculate the hmac here?

if we don't have an association, we can't do authentication, so if auth
then asoc is not NULL.

>
>
> @@ -563,7 +563,7 @@ int sctp_packet_transmit(struct sctp_packet *packet)
>                 unsigned long timeout;
>
>                 /* Restart the AUTOCLOSE timer when sending data. */
> -               if (sctp_state(asoc, ESTABLISHED) && asoc->autoclose) {
> +               if (asoc && sctp_state(asoc, ESTABLISHED) && asoc->autoclose) {
>                         timer = &asoc->timers[SCTP_EVENT_TIMEOUT_AUTOCLOSE];
>                         timeout = asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE];
>
>
> Can an OOTB packet contain data chunks that would make us go through this path?

AUTOCLOSE timer is only start when we have association, so this will
not happen.



>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Question regarding struct sctp_association
  2011-01-10 11:51 Question regarding struct sctp_association Holger Hans Peter Freyther
                   ` (2 preceding siblings ...)
  2011-01-12  1:00 ` Wei Yongjun
@ 2011-01-12 14:35 ` Holger Hans Peter Freyther
  3 siblings, 0 replies; 5+ messages in thread
From: Holger Hans Peter Freyther @ 2011-01-12 14:35 UTC (permalink / raw)
  To: linux-sctp

On 01/12/2011 02:00 AM, Wei Yongjun wrote:

>>                 /* Restart the AUTOCLOSE timer when sending data. */
>> -               if (sctp_state(asoc, ESTABLISHED) && asoc->autoclose) {
>> +               if (asoc && sctp_state(asoc, ESTABLISHED) && asoc->autoclose) {
>>                         timer = &asoc->timers[SCTP_EVENT_TIMEOUT_AUTOCLOSE];
>>                         timeout = asoc->timeouts[SCTP_EVENT_TIMEOUT_AUTOCLOSE];
>>
>>
>> Can an OOTB packet contain data chunks that would make us go through this path?
> 
> AUTOCLOSE timer is only start when we have association, so this will
> not happen.

I am not sure, that is why I am asking. It appears that if there is any DATA
Chunk in the packet to send the code attempts to access 'asoc'. Can this code
path be ever triggered with an OOTB packet?

sorry if that question is too stupid

z.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-01-12 14:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-10 11:51 Question regarding struct sctp_association Holger Hans Peter Freyther
2011-01-11  9:12 ` Wei Yongjun
2011-01-11 10:29 ` Holger Hans Peter Freyther
2011-01-12  1:00 ` Wei Yongjun
2011-01-12 14:35 ` Holger Hans Peter Freyther

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.