ipvs: off by one in set_sctp_state()
Subsystems (4)
PATCH 1/1 ipvs: off by one in set_sctp_state()
The sctp_events[] come from sch->type in set_sctp_state(). They are between 0-255 so that means we need 256 elements in the array.
I believe that because of how the code is aligned there is normally a hole after sctp_events[] so this patch doesn't actually change anything.
---
This is static checker stuff. I'm not very familiar with this code.
net/netfilter/ipvs/ip_vs_proto_sctp.c +1 -1
@@ -208,7 +208,7 @@ enum ipvs_sctp_event_t {IP_VS_SCTP_EVE_LAST }; -static enum ipvs_sctp_event_t sctp_events[255 ] = { +static enum ipvs_sctp_event_t sctp_events[256 ] = {IP_VS_SCTP_EVE_DATA_CLI ,IP_VS_SCTP_EVE_INIT_CLI ,IP_VS_SCTP_EVE_INIT_ACK_CLI ,
Hello,
Quoted 15 lines · Dan Carpenter
The sctp_events[] come from
sch->typeinset_sctp_state(). They are between 0-255 so that means we need 256 elements in the array.I believe that because of how the code is aligned there is normally a hole after sctp_events[] so this patch doesn't actually change anything.
Signed-off-by Dan Carpenter <[email protected]>---
This is static checker stuff. I'm not very familiar with this code.net/netfilter/ipvs/ip_vs_proto_sctp.c +0
-0
net/netfilter/ipvs/ip_vs_proto_sctp.c enum ipvs_sctp_event_t { · line 214
Quoted 8 lines
net/netfilter/ipvs/ip_vs_proto_sctp.c +1
-1@@ -208,7 +208,7 @@ enum ipvs_sctp_event_t {IP_VS_SCTP_EVE_LAST }; -static enum ipvs_sctp_event_t sctp_events[255 ] = { +static enum ipvs_sctp_event_t sctp_events[256 ] = {IP_VS_SCTP_EVE_DATA_CLI ,IP_VS_SCTP_EVE_INIT_CLI ,IP_VS_SCTP_EVE_INIT_ACK_CLI ,
There are more confusing (still, non-fatal)
problems in this IPVS-SCTP support, eg.
if (direction == IP_VS_DIR_OUTPUT)
- event++;
+ event *= 2;
I guess we are running with wrong timeouts.
Also, I'm not sure we support properly the
one-way states as done for TCP (IP_VS_DIR_INPUT_ONLY). May be this code deserves more serious review, for example, net/netfilter/nf_conntrack_proto_sctp.c looks as good source for comparison.
Anyways, this change looks correct to me,
Simon Horman
maintainerQuoted 36 lines · Julian Anastasov
Hello,
Quoted 15 lines · Dan Carpenter
The sctp_events[] come from
sch->typeinset_sctp_state(). They are between 0-255 so that means we need 256 elements in the array.I believe that because of how the code is aligned there is normally a hole after sctp_events[] so this patch doesn't actually change anything.
Signed-off-by Dan Carpenter <[email protected]>---
This is static checker stuff. I'm not very familiar with this code.net/netfilter/ipvs/ip_vs_proto_sctp.c +0
-0net/netfilter/ipvs/ip_vs_proto_sctp.c enum ipvs_sctp_event_t { · line 214
Quoted 8 lines
net/netfilter/ipvs/ip_vs_proto_sctp.c +1
-1@@ -208,7 +208,7 @@ enum ipvs_sctp_event_t {IP_VS_SCTP_EVE_LAST }; -static enum ipvs_sctp_event_t sctp_events[255 ] = { +static enum ipvs_sctp_event_t sctp_events[256 ] = {IP_VS_SCTP_EVE_DATA_CLI ,IP_VS_SCTP_EVE_INIT_CLI ,IP_VS_SCTP_EVE_INIT_ACK_CLI ,There are more confusing (still, non-fatal)
problems in this IPVS-SCTP support, eg.if (direction == IP_VS_DIR_OUTPUT)(quoted diff) +1
-1- event++; + event *= 2;
Quoted 1 line
I guess we are running with wrong timeouts.
IMHO there seem to be many problems with SCTP, but it is good to fix the ones we find as we find them.
Would you like to make a patch for the above change or should I?
Quoted 5 lines
Also, I'm not sure we support properly the
one-way states as done for TCP (IP_VS_DIR_INPUT_ONLY). May be this code deserves more serious review, for example,net/netfilter/nf_conntrack_proto_sctp.clooks as good source for comparison.
I believe it does need a more serious review.
Quoted 3 lines
Anyways, this change looks correct to me,
Acked-by Julian Anastasov <[email protected]>
I have queued-up this change in ipvs-next.
Thanks Dan & Julian.
Julian Anastasov
maintainerHello,
Quoted 11 lines · Simon Horman
Quoted 8 lines
There are more confusing (still, non-fatal)
problems in this IPVS-SCTP support, eg.if (direction == IP_VS_DIR_OUTPUT)(quoted diff) +1
-1- event++; + event *= 2;I guess we are running with wrong timeouts.
IMHO there seem to be many problems with SCTP, but it is good to fix the ones we find as we find them.
At the time I found it (during IPVS optimizations
development), it didn't looked fatal, I preferred to allocate more time for SCTP for debugging.
Quoted 1 line
Would you like to make a patch for the above change or should I?
May be the code is correct, my mistake. I was
confused from the order in sctp_events[] but ipvs_sctp_event_t allocates values for _SER states.
Quoted 7 lines
Quoted 5 lines
Also, I'm not sure we support properly the
one-way states as done for TCP (IP_VS_DIR_INPUT_ONLY). May be this code deserves more serious review, for example,net/netfilter/nf_conntrack_proto_sctp.clooks as good source for comparison.I believe it does need a more serious review.
Regards
--
Julian Anastasov <[email protected]>
Hi,
I see there is no problem in the code regarding the state change. And the thing why I took 255 in the sctp_events array is that as per the sctp specification, the 255 message is reserved, so I thought 0 to 254 messages are enough.
Do you see any problem with the ipvs sctp code in the field?. Please let me know if you see any such, I will try to fix.
Thanks,
Mohan
Quoted 37 lines · Julian Anastasov
Hello,
Quoted 10 lines · Simon Horman
Quoted 8 lines
There are more confusing (still, non-fatal)
problems in this IPVS-SCTP support, eg.if (direction == IP_VS_DIR_OUTPUT)(quoted diff) +1
-1- event++; + event *= 2;I guess we are running with wrong timeouts.
IMHO there seem to be many problems with SCTP, but it is good to fix the ones we find as we find them.
At the time I found it (during IPVS optimizations
development), it didn't looked fatal, I preferred to allocate more time for SCTP for debugging.Quoted 1 line
Would you like to make a patch for the above change or should I?
May be the code is correct, my mistake. I was
confused from the order in sctp_events[] butipvs_sctp_event_tallocates values for_SERstates.Quoted 6 lines
Quoted 5 lines
Also, I'm not sure we support properly the
one-way states as done for TCP (IP_VS_DIR_INPUT_ONLY). May be this code deserves more serious review, for example,net/netfilter/nf_conntrack_proto_sctp.clooks as good source for comparison.I believe it does need a more serious review.
Regards
--
Julian Anastasov <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe lvs-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 6 lines · Moahn Reddy
Hi,
I see there is no problem in the code regarding the state change. And the thing why I took 255 in the
sctp_eventsarray is that as per the sctp specification, the 255 message is reserved, so I thought 0 to 254 messages are enough.
The issue is can chunk_type in set_sctp_state() be 255? How is this prevented in the code?
regards,
dan carpenter
Hi Dan,
I am not saying that that is not a problem. Yes, we need to fix that array issue. I just said that I thought 0 to 254 enough at that time.
Thanks,
Mohan
Quoted 13 lines · Dan Carpenter
Quoted 6 lines · Moahn Reddy
Hi,
I see there is no problem in the code regarding the state change. And the thing why I took 255 in the
sctp_eventsarray is that as per the sctp specification, the 255 message is reserved, so I thought 0 to 254 messages are enough.The issue is can
chunk_typeinset_sctp_state()be 255? How is this prevented in the code?regards,
dan carpenter
Simon Horman
maintainerQuoted 21 lines · Julian Anastasov
Hello,
Quoted 11 lines · Simon Horman
Quoted 8 lines
There are more confusing (still, non-fatal)
problems in this IPVS-SCTP support, eg.if (direction == IP_VS_DIR_OUTPUT)(quoted diff) +1
-1- event++; + event *= 2;I guess we are running with wrong timeouts.
IMHO there seem to be many problems with SCTP, but it is good to fix the ones we find as we find them.
At the time I found it (during IPVS optimizations
development), it didn't looked fatal, I preferred to allocate more time for SCTP for debugging.
Quoted 5 lines
Quoted 1 line
Would you like to make a patch for the above change or should I?
May be the code is correct, my mistake. I was
confused from the order in sctp_events[] butipvs_sctp_event_tallocates values for_SERstates.
Thanks, it sounds like we should study things more carefully before making any changes.
Quoted 13 lines
Quoted 7 lines
Quoted 5 lines
Also, I'm not sure we support properly the
one-way states as done for TCP (IP_VS_DIR_INPUT_ONLY). May be this code deserves more serious review, for example,net/netfilter/nf_conntrack_proto_sctp.clooks as good source for comparison.I believe it does need a more serious review.
Regards
--
Julian Anastasov <[email protected]>