[SCTP] Fix misc. issues in SCTP_PEER_ADDR_PARAMS set socket option.
Linux Kernel Mailing List <[email protected]>
| Newsgroups | gmane.linux.kernel.commits.2-4 |
|---|---|
| Message-ID | <[email protected]> |
ChangeSet 1.1530.1.18, 2004/12/29 15:50:07-08:00, [email protected] [SCTP] Fix misc. issues in SCTP_PEER_ADDR_PARAMS set socket option. Signed-off-by: Sridhar Samudrala <[email protected]> include/net/sctp/structs.h | 6 ------ net/sctp/associola.c | 3 +-- net/sctp/sm_sideeffect.c | 2 +- net/sctp/socket.c | 12 ++++++++---- net/sctp/transport.c | 1 - 5 files changed, 10 insertions(+), 14 deletions(-) diff -Nru a/include/net/sctp/structs.h b/include/net/sctp/structs.h --- a/include/net/sctp/structs.h 2005-01-15 07:05:46 -08:00 +++ b/include/net/sctp/structs.h 2005-01-15 07:05:46 -08:00 @@ -856,12 +856,6 @@ /* Error count : The current error count for this destination. */ unsigned short error_count; - /* Error : Current error threshold for this destination - * Threshold : i.e. what value marks the destination down if - * : errorCount reaches this value. - */ - unsigned short error_threshold; - /* This is the max_retrans value for the transport and will * be initialized to proto.max_retrans.path. This can be changed * using SCTP_SET_PEER_ADDR_PARAMS socket option. diff -Nru a/net/sctp/associola.c b/net/sctp/associola.c --- a/net/sctp/associola.c 2005-01-15 07:05:46 -08:00 +++ b/net/sctp/associola.c 2005-01-15 07:05:46 -08:00 @@ -497,7 +497,6 @@ peer->partial_bytes_acked = 0; peer->flight_size = 0; - peer->error_threshold = peer->max_retrans; /* By default, enable heartbeat for peer address. */ peer->hb_allowed = 1; @@ -508,7 +507,7 @@ peer->hb_interval = SCTP_MSECS_TO_JIFFIES(sp->paddrparam.spp_hbinterval); /* Set the path max_retrans. */ - peer->max_retrans = asoc->max_retrans; + peer->max_retrans = sp->paddrparam.spp_pathmaxrxt; /* Set the transport's RTO.initial value */ peer->rto = asoc->rto_initial; diff -Nru a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c --- a/net/sctp/sm_sideeffect.c 2005-01-15 07:05:46 -08:00 +++ b/net/sctp/sm_sideeffect.c 2005-01-15 07:05:46 -08:00 @@ -415,7 +415,7 @@ asoc->overall_error_count++; if (transport->active && - (transport->error_count++ >= transport->error_threshold)) { + (transport->error_count++ >= transport->max_retrans)) { SCTP_DEBUG_PRINTK("transport_strike: transport " "IP:%d.%d.%d.%d failed.\n", NIPQUAD(transport->ipaddr.v4.sin_addr)); diff -Nru a/net/sctp/socket.c b/net/sctp/socket.c --- a/net/sctp/socket.c 2005-01-15 07:05:46 -08:00 +++ b/net/sctp/socket.c 2005-01-15 07:05:46 -08:00 @@ -1702,10 +1702,13 @@ /* update default value for endpoint (all future associations) */ if (!params.spp_assoc_id && sctp_is_any(( union sctp_addr *)¶ms.spp_address)) { - if (params.spp_hbinterval) + /* Manual heartbeat on an endpoint is invalid. */ + if (0xffffffff == params.spp_hbinterval) + return -EINVAL; + else if (params.spp_hbinterval) sctp_sk(sk)->paddrparam.spp_hbinterval = params.spp_hbinterval; - if (sctp_max_retrans_path) + if (params.spp_pathmaxrxt) sctp_sk(sk)->paddrparam.spp_pathmaxrxt = params.spp_pathmaxrxt; return 0; @@ -1747,7 +1750,8 @@ /* spp_pathmaxrxt contains the maximum number of retransmissions * before this address shall be considered unreachable. */ - trans->error_threshold = params.spp_pathmaxrxt; + if (params.spp_pathmaxrxt) + trans->max_retrans = params.spp_pathmaxrxt; return 0; } @@ -2924,7 +2928,7 @@ /* spp_pathmaxrxt contains the maximum number of retransmissions * before this address shall be considered unreachable. */ - params.spp_pathmaxrxt = trans->error_threshold; + params.spp_pathmaxrxt = trans->max_retrans; done: if (copy_to_user(optval, ¶ms, len)) diff -Nru a/net/sctp/transport.c b/net/sctp/transport.c --- a/net/sctp/transport.c 2005-01-15 07:05:46 -08:00 +++ b/net/sctp/transport.c 2005-01-15 07:05:46 -08:00 @@ -88,7 +88,6 @@ /* Initialize the default path max_retrans. */ peer->max_retrans = sctp_max_retrans_path; - peer->error_threshold = 0; peer->error_count = 0; INIT_LIST_HEAD(&peer->transmitted);