Good that you provided the description.
Ack,
Mathi.

----- vu.m.ngu...@dektech.com.au wrote:

> osaf/libs/agents/saf/lga/lga_mds.c |  42
> ++++++++++++++++++++++++++++++++-----
>  1 files changed, 36 insertions(+), 6 deletions(-)
> 
> 
> The log agent on defaul branch (5.0) was not backward compatible
> with the old OpenSAF versions.
> 
> This fix does an workaround to make it work.
> 
> diff --git a/osaf/libs/agents/saf/lga/lga_mds.c
> b/osaf/libs/agents/saf/lga/lga_mds.c
> --- a/osaf/libs/agents/saf/lga/lga_mds.c
> +++ b/osaf/libs/agents/saf/lga/lga_mds.c
> @@ -140,10 +140,29 @@ static uint32_t lga_enc_lstr_open_sync_m
>               TRACE("p8 NULL!!!");
>               goto done;
>       }
> -     if (param->logFileName != NULL)
> +     if (param->logFileName != NULL) {
>               len = strlen(param->logFileName) + 1;
> -     else
> -             len = 0;
> +     } else {
> +             /**
> +              * Workaround to keep backward compatible [#1686]
> +              * The problem was that standby node (OpenSAF 5.0) failed to 
> come
> up
> +              * when active node ran with older OpenSAF version (e.g OpenSAF
> 4.7).
> +              *
> +              * In OpenSAF 4.7 or older, logFileName is declared as an static
> array of chars
> +              * and always passed to MDS layer for encoding. The length 
> (len) is
> at least one.
> +              * Therefore, in log service side, there is an precondition 
> check
> +              * in MDS decoding callback if the length of logFileName data is
> invalid (0).
> +              *
> +              * In OpenSAF 5.0 or later, logFileName is declared as an 
> dynamic
> one and then
> +              * there is posibility to be NULL when opening one of dedicated 
> log
> streams.
> +              * Suppose we did not pass any data for encoding when 
> logFileName
> is NULL,
> +              * when OpenSAF 5.0 log client communicates with OpenSAF 4.7 
> active
> log service,
> +              * it would get failed at saLogStreamOpen() because of log 
> service
> unsuccesfully
> +              * deeode the message at MDS layer (len = 0).
> +              */
> +             len = 1;
> +     }
> +
>       ncs_encode_16bit(&p8, len);
>       ncs_enc_claim_space(uba, 2);
>       total_bytes += 2;
> @@ -151,6 +170,10 @@ static uint32_t lga_enc_lstr_open_sync_m
>       if (param->logFileName != NULL) {
>               ncs_encode_n_octets_in_uba(uba, (uint8_t *)param->logFileName,
> len);
>               total_bytes += len;
> +     } else {
> +             /* Keep backward compatible */
> +             ncs_encode_n_octets_in_uba(uba, (uint8_t *)"", len);
> +             total_bytes += len;
>       }
>  
>       /* Encode logFilePathName if initiated */
> @@ -159,10 +182,13 @@ static uint32_t lga_enc_lstr_open_sync_m
>               TRACE("p8 NULL!!!");
>               goto done;
>       }
> -     if (param->logFilePathName)
> +     if (param->logFilePathName) {
>               len = strlen(param->logFilePathName) + 1;
> -     else
> -             len = 0;
> +     } else {
> +             /* Workaround to keep backward compatible */
> +             len = 1;
> +     }
> +
>       ncs_encode_16bit(&p8, len);
>       ncs_enc_claim_space(uba, 2);
>       total_bytes += 2;
> @@ -170,6 +196,10 @@ static uint32_t lga_enc_lstr_open_sync_m
>       if (param->logFilePathName != NULL) {
>               ncs_encode_n_octets_in_uba(uba, (uint8_t 
> *)param->logFilePathName,
> len);
>               total_bytes += len;
> +     } else {
> +             /* Workaround to keep backward compatible */
> +             ncs_encode_n_octets_in_uba(uba, (uint8_t *)"", len);
> +             total_bytes += len;
>       }
>  
>       /* Encode format string if initiated */

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to