Hi Anders Widell/Vu,

On 2/16/2016 9:41 PM, Anders Widell wrote:
> I think it looks like HOST_NAME_MAX is not included in LSB. Please 
> check http://refspecs.linuxfoundation.org/
>
> Also, it looks like you are using an 8-bit variable for storing the 
> length of the host name, so you are assuming HOST_NAME_MAX is not 
> larger than 255? Maybe it is better to just use our own constant and 
> decide that we don't support host names longer than 255 byte?

As we know `/etc/opensaf/node_name`   file is generated with the short 
form of the hostname ('hostname -s')
when the controller or payload rpm is installed , And the there are hard 
limits for the line size in the /etc/hosts file,
Maximum line size is 256  is e hard limits for the /etc/hosts file.

The Opensaf 00-README.conf also says :

"The node_name file contains the RDN value of the CLM node name. A user can
change the default value but the changed value 'must match' with the value
specified in the nodes.cfg that was used to generate the imm.xml.i.e. the
node_name value should match the value present in the generated imm.xml.
  The node_name must be set to a unique value(as described above) for 
each node."


As the RDN value of the CLM node name it self is max 255 , so their is 
no possibility of
  `/etc/opensaf/node_name`   exceeding 255 with combining with RDN name  
for example :

`safAmfNode=SC-1,safAmfCluster=myAmfCluster`

That is why  I derived the name_name max as 255  where  MDS is being 
fetching the node_name
from `/etc/opensaf/node_name`.

-AVM

>
> regards,
> Anders Widell
>
> On 02/16/2016 10:05 AM, Vu Minh Nguyen wrote:
>> Hi Mahesh,
>>
>> I see you are using constant HOST_NAME_MAX for node_name string.
>>
>> Referring to following page, it states HOST_NAME_MAX value possibly "is
>> unspecified."
>> http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html
>> With _POSIX_HOST_NAME_MAX constant, the value is determined. Its 
>> value is
>> 255.
>>
>> I wonder it is safe to use HOST_NAME_MAX or not.
>>
>> Regards, Vu.
>>
>>
>>> -----Original Message-----
>>> From: [email protected] [mailto:[email protected]]
>>> Sent: Friday, February 05, 2016 1:26 PM
>>> To: [email protected]; [email protected];
>>> [email protected]; [email protected]
>>> Cc: [email protected]
>>> Subject: [devel] [PATCH 1 of 3] MDS:TIPC include node name as a part of
>>> callback_info events [#1522]
>>>
>>> osaf/libs/core/include/mds_papi.h     |    8 ++-
>>> osaf/libs/core/mds/include/mds_core.h |    4 +-
>>> osaf/libs/core/mds/include/mds_dt.h   |    5 +-
>>> osaf/libs/core/mds/include/mds_dt2c.h |    6 +-
>>> osaf/libs/core/mds/mds_c_api.c        |   14 ++-
>>> osaf/libs/core/mds/mds_c_sndrcv.c     |    5 +
>>> osaf/libs/core/mds/mds_dt_common.c    |   49 ++++++++++----
>>> osaf/libs/core/mds/mds_dt_tipc.c      |  116
>> ++++++++++++++++++++++++--------
>>> -
>>> osaf/libs/core/mds/mds_main.c         |   55 +++++++++++----
>>> 9 files changed, 188 insertions(+), 74 deletions(-)
>>>
>>>
>>>            This patch enhences the Opensaf Transport provides Node 
>>> Name of
>> the
>>> sender
>>>                         as part of ncsmds_callback_info
>> (NCSMDS_CALLBACK_INFO).
>>>                         This enhences implemented for  both TCP & TIPC
>> Transport.
>>>                         In addtional to TIPC list DEC_INFO, 
>>> RECEIVE_INFO &
>>> DIRECT_RECEIVE,
>>>                         TCP Transport provides Node Name of the 
>>> sender as
>> part of
>>> NODE_EVENT event also.
>>>
>>>                         Patch supports  in-serrvice upgrade both TCP &
>> TIPC Transport
>>> (NOT YET TESTED).
>>>
>>>
>>>
>>>                          TIPC MDS transport will provide  part of
>> ncsmds_callback_info
>>> for follwing events :
>>>
>>> - MDS_CALLBACK_DEC_INFO
>>> - MDS_CALLBACK_RECEIVE_INFO
>>> - MDS_CALLBACK_DIRECT_RECEIVE_INFO
>>>
>>>
>>> Example :
>>>
>>> Feb  5 11:41:06 SC-1 osaflogd[21413]: LGS: mds_dec() node_name : SC-1
>>> evt.type :0 from ncsmds_callback_info
>>> Feb  5 11:41:06 SC-1 osaflogd[21413]: LGS: mds_rcv() node_name : SC-1
>>> evt.type :4 from ncsmds_callback_info
>>> Feb  5 11:41:06 SC-1 osaflogd[21413]: LGS: mds_dec() node_name : SC-2
>>> evt.type :0 from ncsmds_callback_info
>>> Feb  5 11:41:06 SC-1 osaflogd[21413]: LGS: mds_rcv() node_name : SC-2
>>> evt.type :0 from ncsmds_callback_info
>>>
>>> diff --git a/osaf/libs/core/include/mds_papi.h
>>> b/osaf/libs/core/include/mds_papi.h
>>> --- a/osaf/libs/core/include/mds_papi.h
>>> +++ b/osaf/libs/core/include/mds_papi.h
>>> @@ -700,6 +700,7 @@ typedef uint8_t *MDS_DIRECT_BUFF;
>>>         NCSCONTEXT o_msg;    /* New message resulting from decode
>>> */
>>>         NODE_ID i_node_id;    /* Node id of the sender
>> */
>>>         MDS_CLIENT_MSG_FORMAT_VER i_msg_fmt_ver;
>>> +        char i_node_name[HOST_NAME_MAX]; /* Node Name of the
>>> sender              */
>>>
>>>     } MDS_CALLBACK_DEC_INFO;
>>>
>>> @@ -732,6 +733,7 @@ unpack individual structure members. */
>>>         MDS_SVC_ID i_to_svc_id;
>>>         MDS_SEND_PRIORITY_TYPE i_priority;    /* Priority with
>> which
>>> this message was sent */
>>>         NODE_ID i_node_id;    /* Node id of the sender
>> */
>>> +        char i_node_name[HOST_NAME_MAX]; /* Node Name of the
>>> sender              */
>>>
>>>         /* Local handle to the PWE of "svc_id". It is meaningful
>> only to
>>> "Global
>>>            MDS services". Global MDS services are global to a
>>> "MDS_DEST" scope.
>>> @@ -764,6 +766,7 @@ unpack individual structure members. */
>>>         MDS_SVC_ID i_to_svc_id;
>>>         MDS_SEND_PRIORITY_TYPE i_priority;    /* Priority with
>> which
>>> this message was sent */
>>>         NODE_ID i_node_id;    /* Node id of the sender
>> */
>>> +        char i_node_name[HOST_NAME_MAX]; /* Node Name of the
>>> sender              */
>>>
>>>         /* Local handle to the PWE of "svc_id". It is meaningful
>> only to
>>> "Global
>>>            MDS services". Global MDS services are global to a
>>> "MDS_DEST" scope.
>>> @@ -835,8 +838,11 @@ unpack individual structure members. */
>>>         NCSMDS_NODE_CHG  node_chg;
>>>         NODE_ID node_id;
>>>         uint16_t addr_family;
>>> -        uint16_t length;
>>> +        uint16_t length; /* will be deprecated after few version */
>>> +        uint16_t ip_addr_len;
>>>         uint8_t ip_addr[INET6_ADDRSTRLEN];
>>> +        uint16_t i_node_name_len;
>>> +        char i_node_name[HOST_NAME_MAX]; /* Node Name of the
>>> sender */
>>>     } MDS_CALLBACK_NODE_EVENT_INFO;
>>>
>>>     typedef struct mds_callback_msg_loss_event_info {
>>> diff --git a/osaf/libs/core/mds/include/mds_core.h
>>> b/osaf/libs/core/mds/include/mds_core.h
>>> --- a/osaf/libs/core/mds/include/mds_core.h
>>> +++ b/osaf/libs/core/mds/include/mds_core.h
>>> @@ -106,9 +106,9 @@ typedef struct mds_mcm_sync_send_queue {
>>>         MDS_DEST adest;
>>>     } dest_sndrack_adest;    /*  Filled, when the sndrack and 
>>> redrack is
>>> being sent to originator and checked when ack
>>>                    is recd for the sent sndrack or redrack
>> */
>>> -
>>>     struct mds_mcm_sync_send_queue *next_send;
>>>     MDS_CLIENT_MSG_FORMAT_VER msg_fmt_ver;
>>> +    char i_node_name[HOST_NAME_MAX]; /* Node Name of the sender*/
>>>
>>> } MDS_MCM_SYNC_SEND_QUEUE;
>>>
>>> @@ -287,6 +287,8 @@ MDS_SVC_INFO *mds_get_svc_info_by_hdl(MD
>>> typedef struct mds_mcm_cb {
>>>     MDS_DEST adest;
>>>     char adest_details[MDS_MAX_PROCESS_NAME_LEN]; /*
>>> <node[slotno]:processname[pid]> */
>>> +    char node_name[HOST_NAME_MAX]; /* Node Name of this Node*/
>>> +    uint8_t node_name_len; /* configured Node Name len of this Node*/
>>>
>>>     /* List of all subscription results 
>>> MDS_SUBSCRIPTION_RESULTS_INFO */
>>>     NCS_PATRICIA_TREE subtn_results;
>>> diff --git a/osaf/libs/core/mds/include/mds_dt.h
>>> b/osaf/libs/core/mds/include/mds_dt.h
>>> --- a/osaf/libs/core/mds/include/mds_dt.h
>>> +++ b/osaf/libs/core/mds/include/mds_dt.h
>>> @@ -73,8 +73,7 @@ typedef struct mdtm_reassembly_queue {
>>> } MDTM_REASSEMBLY_QUEUE;
>>>
>>> /* Defines regarding to the Send and receive buff sizes */
>>> -#define MDS_HDR_LEN         24    /* Mds_prot-4bit, Mds_version-2bit ,
>> Msg
>>> prior-2bit, Hdr_len-16bit, Seq_no-32bit, Enc_dec_type-2bit, 
>>> Msg_snd_type-
>>> 6bit,
>>> -                   Pwe_id-16bit, Sndr_vdest_id-16bit,
>>> Sndr_svc_id-16bit, Rcvr_vdest_id-16bit, Rcvr_svc_id-16bit, 
>>> Exch_id-32bit,
>>> App_Vers-16bit */
>>> +#define MDS_HDR_LEN         25    /* Mds_prot-4bit, Mds_version-2bit ,
>>> Msg prior-2bit, Hdr_len-16bit, Seq_no-32bit, Enc_dec_type-2bit,
>>> Msg_snd_type-6bit, Pwe_id-16bit, Sndr_vdest_id-16bit, 
>>> Sndr_svc_id-16bit,
>>> Rcvr_vdest_id-16bit, Rcvr_svc_id-16bit, Exch_id-32bit, App_Vers-16bit
>>> node_name_len-8bit,  dynamic value node_name-<HOST_NAME_MAX>bits*/
>>>
>>> /* Following defines the positions of each field in the mds hdr */
>>> #define MDS_HEADER_PROT_VER_PRIOR_POSITION    0
>>> @@ -88,6 +87,8 @@ typedef struct mdtm_reassembly_queue {
>>> #define MDS_HEADER_RCVR_SVC_ID_POSITION       16
>>> #define MDS_HEADER_EXCHG_ID_POSITION          18
>>> #define MDS_HEADER_APP_VERSION_ID_POSITION    22
>>> +#define MDS_HEADER_NODE_NAME_LEN_POSITION     24
>>> +#define MDS_HEADER_NODE_NAME_POSITION         25
>>>
>>> #define MDTM_FRAG_HDR_LEN    8    /* Msg Seq_no-32bit, More Frag-1bit,
>>> Frag_num-15bit, Frag_size-16bit */
>>>
>>> diff --git a/osaf/libs/core/mds/include/mds_dt2c.h
>>> b/osaf/libs/core/mds/include/mds_dt2c.h
>>> --- a/osaf/libs/core/mds/include/mds_dt2c.h
>>> +++ b/osaf/libs/core/mds/include/mds_dt2c.h
>>> @@ -43,7 +43,7 @@ typedef uint8_t MDS_SVC_ARCHWORD_TYPE;    /
>>>   *    Version 0 uses 1400 bytes fragmentation.
>>>   *    Version 1 uses TIPC max msg (66000 bytes) fragmentation.
>>>   */
>>> -#define MDS_SELF_ARCHWORD ((MDS_SVC_ARCHWORD_TYPE)
>>> ((MDS_WORD_SIZE_TYPE<<3) | 1))
>>> +#define MDS_SELF_ARCHWORD ((MDS_SVC_ARCHWORD_TYPE)
>>> ((MDS_WORD_SIZE_TYPE<<3) | 2))
>>>
>>> typedef enum {
>>>     MDS_VIEW_NORMAL,
>>> @@ -106,6 +106,8 @@ typedef struct mds_data_recv {
>>>     MDS_CLIENT_MSG_FORMAT_VER msg_fmt_ver;    /* message format
>>> version specification */
>>>     MDS_SVC_PVT_SUB_PART_VER src_svc_sub_part_ver;
>>>     MDS_SVC_ARCHWORD_TYPE msg_arch_word;
>>> +    uint8_t src_node_name_len;
>>> +    char src_node_name[HOST_NAME_MAX]; /* Node Name of the
>>> sender/source*/
>>>     uint32_t src_seq_num;
>>>     pid_t pid;
>>>     uid_t uid;
>>> @@ -400,7 +402,7 @@ extern uint32_t mds_mcm_svc_down(PW_ENV_
>>>                   MDS_SVC_PVT_SUB_PART_VER svc_sub_part_ver,
>>> MDS_SVC_ARCHWORD_TYPE archword_type);
>>>
>>> /* NODE UP */
>>> -extern uint32_t mds_mcm_node_up(MDS_SVC_HDL local_svc_hdl, NODE_ID
>>> node_id, char *node_ip, uint16_t addr_family);
>>> +extern uint32_t mds_mcm_node_up(MDS_SVC_HDL local_svc_hdl, NODE_ID
>>> node_id, char *node_ip, uint16_t addr_family, char *node_name);
>>>
>>> /* NODE DOWN */
>>> extern uint32_t mds_mcm_node_down(MDS_SVC_HDL local_svc_hdl, NODE_ID
>>> node_id, uint16_t addr_family);
>>> diff --git a/osaf/libs/core/mds/mds_c_api.c
>> b/osaf/libs/core/mds/mds_c_api.c
>>> --- a/osaf/libs/core/mds/mds_c_api.c
>>> +++ b/osaf/libs/core/mds/mds_c_api.c
>>> @@ -2884,8 +2884,7 @@ else (entry exists)
>>>              2 - NCSCC_RC_FAILURE
>>>
>>> *********************************************************/
>>> -uint32_t mds_mcm_node_up(MDS_SVC_HDL local_svc_hdl, NODE_ID node_id,
>>> char *node_ip, uint16_t addr_family)
>>> -
>>> +uint32_t mds_mcm_node_up(MDS_SVC_HDL local_svc_hdl, NODE_ID node_id,
>>> char *node_ip, uint16_t addr_family, char *node_name)
>>> {
>>>     MDS_MCM_MSG_ELEM *event_msg = NULL;
>>>     MDS_SVC_INFO *local_svc_info = NULL;
>>> @@ -2929,13 +2928,18 @@ uint32_t mds_mcm_node_up(MDS_SVC_HDL loc
>>>     cbinfo->info.node_evt.node_id = node_id;
>>>     cbinfo->info.node_evt.addr_family = addr_family;
>>>     if (node_ip) {
>>> -        memcpy(cbinfo->info.node_evt.ip_addr, node_ip,
>>> INET6_ADDRSTRLEN);
>>> -        cbinfo->info.node_evt.length = strlen(node_ip);
>>> +        cbinfo->info.node_evt.ip_addr_len = strlen(node_ip);
>>> +        cbinfo->info.node_evt.length = cbinfo-
>>>> info.node_evt.ip_addr_len;
>>> +        memcpy(cbinfo->info.node_evt.ip_addr, node_ip, cbinfo-
>>>> info.node_evt.ip_addr_len);
>>>     }
>>>
>>>     m_MDS_LOG_INFO("MDTM: node up node_ip:%s, length:%d
>>> node_id:%u addr_family:%d msg_type:%d",
>>> -            cbinfo->info.node_evt.ip_addr, cbinfo-
>>>> info.node_evt.length,
>>> +            cbinfo->info.node_evt.ip_addr, cbinfo-
>>>> info.node_evt.ip_addr_len,
>>>             cbinfo->info.node_evt.node_id, cbinfo-
>>>> info.node_evt.addr_family, cbinfo->info.node_evt.node_chg);
>>> +    if (node_name) {
>>> +        cbinfo->info.node_evt.i_node_name_len = strlen(node_name);
>>> +        strncpy(cbinfo->info.node_evt.i_node_name, node_name,
>>> cbinfo->info.node_evt.i_node_name_len);
>>> +    }
>>>
>>>     /* Post to mail box If Q Ownership is enabled Else Call user
>> callback */
>>>     if (local_svc_info->q_ownership == true) {
>>> diff --git a/osaf/libs/core/mds/mds_c_sndrcv.c
>>> b/osaf/libs/core/mds/mds_c_sndrcv.c
>>> --- a/osaf/libs/core/mds/mds_c_sndrcv.c
>>> +++ b/osaf/libs/core/mds/mds_c_sndrcv.c
>>> @@ -4289,6 +4289,7 @@ static uint32_t mds_mcm_process_recv_snd
>>>             cbinfo.info.receive.i_to_svc_id = svccb->svc_id;
>>>             cbinfo.info.receive.i_priority = recv->pri;
>>>             cbinfo.info.receive.i_msg_fmt_ver = recv-
>>>> msg_fmt_ver;
>>> +            strncpy(cbinfo.info.receive.i_node_name, recv-
>>>> src_node_name , recv->src_node_name_len);
>>>         } else if (recv->msg.encoding == MDS_ENC_TYPE_DIRECT_BUFF)
>>> {
>>>             cbinfo.i_op = MDS_CALLBACK_DIRECT_RECEIVE;
>>>             cbinfo.info.direct_receive.i_fr_anc =
>> recv->src_adest;
>>> @@ -4319,6 +4320,7 @@ static uint32_t mds_mcm_process_recv_snd
>>>             cbinfo.info.direct_receive.i_to_svc_id =
>> svccb->svc_id;
>>> cbinfo.info.direct_receive.i_priority = recv->pri;
>>>             cbinfo.info.direct_receive.i_msg_fmt_ver = recv-
>>>> msg_fmt_ver;
>>> +            strncpy(cbinfo.info.direct_receive.i_node_name,
>> recv-
>>>> src_node_name , recv->src_node_name_len);
>>>         } else if (recv->msg.encoding == MDS_ENC_TYPE_CPY) {
>>>             cbinfo.i_op = MDS_CALLBACK_RECEIVE;
>>>
>>> @@ -4346,6 +4348,7 @@ static uint32_t mds_mcm_process_recv_snd
>>>             cbinfo.info.receive.i_to_svc_id = svccb->svc_id;
>>>             cbinfo.info.receive.i_priority = recv->pri;
>>>             cbinfo.info.receive.i_msg_fmt_ver = recv-
>>>> msg_fmt_ver;
>>> +            strncpy(cbinfo.info.receive.i_node_name, recv-
>>>> src_node_name , recv->src_node_name_len);
>>>         } else {
>>>             mds_mcm_free_msg_memory(recv->msg);
>>>             return NCSCC_RC_FAILURE;
>>> @@ -4904,6 +4907,7 @@ static uint32_t mds_mcm_do_decode_full_o
>>>         cbinfo->info.dec.o_msg = orig_msg;
>>>
>>>         cbinfo->info.dec.i_msg_fmt_ver = recv_msg->msg_fmt_ver;
>>> +        strncpy(cbinfo->info.dec.i_node_name, recv_msg-
>>>> src_node_name , recv_msg->src_node_name_len);
>>>         m_MDS_LOG_DBG("MDS_SND_RCV : calling callback ptr\n");
>>>
>>> @@ -4923,6 +4927,7 @@ static uint32_t mds_mcm_do_decode_full_o
>>>         cbinfo->info.dec_flat.o_msg = orig_msg;
>>>
>>>         cbinfo->info.dec_flat.i_msg_fmt_ver = recv_msg->msg_fmt_ver;
>>> +        strncpy(cbinfo->info.dec_flat.i_node_name, recv_msg-
>>>> src_node_name , recv_msg->src_node_name_len);
>>>         m_MDS_LOG_DBG("MDS_SND_RCV : calling callback ptr\n");
>>>
>>>         if ((rc = svccb->cback_ptr(cbinfo)) != NCSCC_RC_SUCCESS) {
>>> diff --git a/osaf/libs/core/mds/mds_dt_common.c
>>> b/osaf/libs/core/mds/mds_dt_common.c
>>> --- a/osaf/libs/core/mds/mds_dt_common.c
>>> +++ b/osaf/libs/core/mds/mds_dt_common.c
>>> @@ -294,13 +294,7 @@ uint32_t mdtm_process_recv_message_commo
>>>
>>>             return NCSCC_RC_FAILURE;
>>>         }
>>> -        /* Check whether mds header length received is not less than
>>> mds header length of this instance */
>>> -        if (len_mds_hdr < MDS_HDR_LEN) {
>>> -            m_MDS_LOG_ERR
>>> -                ("MDTM:Mds hdr len of recd msg (Non frag) = %d
>> is
>>> less than local mds hdr len = %d",
>>> -                 len_mds_hdr, MDS_HDR_LEN);
>>> -            return NCSCC_RC_FAILURE;
>>> -        }
>>> +
>>>
>>>         data = &buffer[MDS_HEADER_PWE_ID_POSITION];
>>>
>>> @@ -412,9 +406,26 @@ uint32_t mdtm_process_recv_message_commo
>>>             break;
>>>         }
>>>
>>> +        data = NULL;
>>>         data = &buffer[MDS_HEADER_APP_VERSION_ID_POSITION];
>>>         reassem_queue->recv.msg_fmt_ver =
>>> ncs_decode_16bit(&data);    /* For the version field */
>>>
>>> +        data = NULL;
>>> +        data = &buffer[MDS_HEADER_NODE_NAME_LEN_POSITION];
>>> +        reassem_queue->recv.src_node_name_len =
>>> ncs_decode_8bit(&data);
>>> +
>>> +               /* Check whether mds header length received is not less
>> than mds
>>> header length of this instance */
>>> +                if (len_mds_hdr < (MDS_HDR_LEN + reassem_queue-
>>>> recv.src_node_name_len)) {
>>> +                        m_MDS_LOG_ERR
>>> +                            ("MDTM:Mds hdr len of recd msg (Non 
>>> frag) = %d
>> is less than
>>> local mds hdr len = %d",
>>> +                             len_mds_hdr, (MDS_HDR_LEN + 
>>> reassem_queue-
>>>> recv.src_node_name_len));
>>> +                        return NCSCC_RC_FAILURE;
>>> +                }
>>> +
>>> +        data = NULL;
>>> +        data = &buffer[MDS_HEADER_NODE_NAME_POSITION];
>>> +        strncpy((char *)reassem_queue->recv.src_node_name, (char
>>> *)data, reassem_queue->recv.src_node_name_len);
>>> +
>>>         reassem_queue->recv.exchange_id = xch_id;
>>>         reassem_queue->next_frag_num = 0;
>>>         reassem_queue->recv.dest_svc_hdl = dest_svc_hdl;
>>> @@ -519,13 +530,6 @@ uint32_t mdtm_process_recv_message_commo
>>>                  transport_adest);
>>>             return NCSCC_RC_FAILURE;
>>>         }
>>> -        /* Check whether mds header length received is not less than
>>> mds header length of this instance */
>>> -        if (len_mds_hdr < MDS_HDR_LEN) {
>>> -            m_MDS_LOG_DBG
>>> -                ("MDTM:Mds hdr len of recd msg(Frag first pkt) =
>> %d
>>> is less than local mds hdr len = %d",
>>> -                 len_mds_hdr, MDS_HDR_LEN);
>>> -            return NCSCC_RC_FAILURE;
>>> -        }
>>>         data = &buffer[MDS_HEADER_PWE_ID_POSITION +
>>> MDTM_FRAG_HDR_LEN];
>>>
>>>         pwe_id = ncs_decode_16bit(&data);
>>> @@ -642,6 +646,23 @@ uint32_t mdtm_process_recv_message_commo
>>>         data = &buffer[MDS_HEADER_APP_VERSION_ID_POSITION +
>>> MDTM_FRAG_HDR_LEN];
>>>         reassem_queue->recv.msg_fmt_ver =
>>> ncs_decode_16bit(&data);    /* For the version field */
>>>
>>> +
>>> +        data = NULL;
>>> +        data = &buffer[MDS_HEADER_NODE_NAME_LEN_POSITION +
>>> MDTM_FRAG_HDR_LEN];
>>> +        reassem_queue->recv.src_node_name_len =
>>> ncs_decode_8bit(&data);
>>> +
>>> +        /* Check whether mds header length received is not less than
>>> mds header length of this instance */
>>> +        if (len_mds_hdr < (MDS_HDR_LEN + reassem_queue-
>>>> recv.src_node_name_len)) {
>>> +            m_MDS_LOG_ERR
>>> +                ("MDTM:Mds hdr len of recd msg ( frag) = %d
>> is
>>> less than local mds hdr len = %d",
>>> +                 len_mds_hdr, (MDS_HDR_LEN +
>>> reassem_queue->recv.src_node_name_len));
>>> +            return NCSCC_RC_FAILURE;
>>> +                }
>>> +
>>> +                data = NULL;
>>> +                data = &buffer[MDS_HEADER_NODE_NAME_POSITION +
>>> MDTM_FRAG_HDR_LEN];
>>> +                strncpy((char *)reassem_queue->recv.src_node_name, 
>>> (char
>> *)data,
>>> reassem_queue->recv.src_node_name_len);
>>> +
>>>         reassem_queue->recv.exchange_id = xch_id;
>>>         reassem_queue->next_frag_num = 2;
>>>         reassem_queue->recv.dest_svc_hdl = dest_svc_hdl;
>>> diff --git a/osaf/libs/core/mds/mds_dt_tipc.c
>>> b/osaf/libs/core/mds/mds_dt_tipc.c
>>> --- a/osaf/libs/core/mds/mds_dt_tipc.c
>>> +++ b/osaf/libs/core/mds/mds_dt_tipc.c
>>> @@ -710,9 +710,11 @@ static uint32_t mdtm_process_recv_events
>>>                         assert(0);
>>>                     }
>>>                 }
>>> -            } else if (pfd[0].revents & POLLHUP) {    /* This
>> value is
>>> returned when the number of subscriptions made cross the tipc 
>>> max_subscr
>>> limit, so no more connection to the tipc topserver is present(viz no 
>>> more
>>> up/down events), so abort and exit the process */
>>> -                m_MDS_LOG_CRITICAL
>>> -                    ("MDTM: POLLHUP returned on Discovery
>>> Socket, No. of subscriptions=%d",
>>> +            } else if (pfd[0].revents & POLLHUP) {
>>> +                /* This value is returned when the number of
>>> subscriptions made cross the tipc max_subscr limit,
>>> +                   so no more connection to the tipc
>> topserver
>>> is present(viz no more up/down events),
>>> +                   so abort and exit the process */
>>> +                   m_MDS_LOG_CRITICAL("MDTM: POLLHUP
>>> returned on Discovery Socket, No. of subscriptions=%d",
>>>                      num_subscriptions);
>>>                 abort();    /* This means, the process
>> is use less
>>> as
>>>                            it has lost the
>> connectivity
>>> with the topology server
>>> @@ -980,7 +982,8 @@ static uint32_t mdtm_process_discovery_e
>>>             } else {
>>>                 m_MDS_LOG_ERR("MDTM: Dropping  the svc
>>> event for svc_id = %s(%d), subscribed by "
>>>                         "svc_id = %s(%d) as the TIPC
>>> NODEid is not in the prescribed range=0x%08x, SVC Event type=%d",
>>> -                     get_svc_names(svc_id), svc_id,
>>> get_svc_names(m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl)),
>>> m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl), node, discovery_event);
>>> +                        get_svc_names(svc_id),
>> svc_id,
>>> get_svc_names(m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl)),
>>> +
>>>     m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl), node,
>>> discovery_event);
>>>                 return NCSCC_RC_FAILURE;
>>>             }
>>>
>>>     get_subtn_adest_details(m_MDS_GET_PWE_HDL_FROM_SVC_HDL(svc_
>>> hdl), m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl),
>>> @@ -988,26 +991,30 @@ static uint32_t mdtm_process_discovery_e
>>>
>>>             if (TIPC_PUBLISHED == discovery_event) {
>>>                 m_MDS_LOG_NOTIFY("MDTM: svc up event for
>>> svc_id = %s(%d), subscri. by svc_id = %s(%d) pwe_id=%d Adest = %s",
>>> -                     get_svc_names(svc_id), svc_id,
>>> get_svc_names(m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl)),
>>> m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl), pwe_id, adest_details);
>>> +                        get_svc_names(svc_id),
>> svc_id,
>>> get_svc_names(m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl)),
>>> +
>>>     m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl), pwe_id, adest_details);
>>>
>>>                 if (NCSCC_RC_SUCCESS !=
>>> mds_mcm_svc_up(pwe_id, svc_id, role, scope,
>>>
>> vdest,
>>> policy, adest, 0, svc_hdl, subtn_ref_val,
>>>
>>> svc_sub_part_ver, archword_type)) {
>>>                     m_MDS_LOG_ERR("SVC-UP Event
>>> processsing failed for svc_id = %s(%d), subscribed by svc_id = %s(%d)",
>>> -                         get_svc_names(svc_id), svc_id,
>>> get_svc_names(m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl)),
>>> m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl));
>>> +                         get_svc_names(svc_id), svc_id,
>>> get_svc_names(m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl)),
>>> +
>>> m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl));
>>>                     return NCSCC_RC_FAILURE;
>>>                 }
>>>                 return NCSCC_RC_SUCCESS;
>>>             } else if (TIPC_WITHDRAWN == discovery_event) {
>>>                 m_MDS_LOG_NOTIFY("MDTM: svc down event
>>> for svc_id = %s(%d), subscri. by svc_id = %s(%d) pwe_id=%d Adest = %s",
>>> -                     get_svc_names(svc_id), svc_id,
>>> get_svc_names(m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl)),
>>> m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl), pwe_id, adest_details);
>>> +                        get_svc_names(svc_id),
>> svc_id,
>>> get_svc_names(m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl)),
>>> +
>>>     m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl), pwe_id, adest_details);
>>>
>>>                 if (NCSCC_RC_SUCCESS !=
>>> mds_mcm_svc_down(pwe_id, svc_id, role, scope,
>>>
>> vdest,
>>> policy, adest, 0, svc_hdl,
>>>
>>> subtn_ref_val, svc_sub_part_ver,
>>>
>>> archword_type)) {
>>>                     m_MDS_LOG_ERR("MDTM: SVC-DOWN
>>> Event processsing failed for svc_id = %s(%d), subscribed by svc_id =
>> %s(%d)\n",
>>> - get_svc_names(svc_id), svc_id,
>>> get_svc_names(m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl)),
>>> m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl));
>>> +
>> get_svc_names(svc_id),
>>> svc_id, get_svc_names(m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl)),
>>> +
>>>     m_MDS_GET_SVC_ID_FROM_SVC_HDL(svc_hdl));
>>>                     return NCSCC_RC_FAILURE;
>>>                 }
>>>                 return NCSCC_RC_SUCCESS;
>>> @@ -1089,7 +1096,18 @@ static uint32_t mdtm_process_discovery_e
>>>
>>>             if (TIPC_PUBLISHED == discovery_event) {
>>>                 m_MDS_LOG_INFO("MDTM: Raising the NODE
>>> UP event for NODE id = %d", node_id);
>>> -                return mds_mcm_node_up(svc_hdl, node_id,
>>> NULL, AF_TIPC);
>>> +                uint32_t up_node_id;
>>> +                if ((up_node_id =
>>> m_MDS_GET_NODE_ID_FROM_ADEST(m_MDS_GET_ADEST)) == node_id) {
>>> +                    m_MDS_LOG_INFO("MDTM:NODE_UP
>>> for subtn_ref_val:%lu node_name:%s, node_id:%u addr_family:%d ",
>>> +
>>>     (uint64_t)subtn_ref_val,gl_mds_mcm_cb->node_name, node_id,
>>> AF_TIPC);
>>> +                    return mds_mcm_node_up(svc_hdl,
>>> node_id, NULL, AF_TIPC, gl_mds_mcm_cb->node_name);
>>> +                } else {
>>> +
>>> +                    m_MDS_LOG_INFO("MDTM:NODE_UP
>>> for subtn_ref_val:%lu node_name:%s, node_id:%u addr_family:%d ",
>>> +
>> (uint64_t)subtn_ref_val, "REMOTE_NODE",
>>> node_id, AF_TIPC);
>>> +                    return mds_mcm_node_up(svc_hdl,
>>> node_id, NULL, AF_TIPC, "REMOTE_NODE");
>>> +                }
>>> +
>>>             } else if (TIPC_WITHDRAWN == discovery_event) {
>>>                 m_MDS_LOG_INFO("MDTM: Raising the NODE
>>> DOWN event for NODE id = %d", node_id);
>>>                 return mds_mcm_node_down(svc_hdl,
>>> node_id, AF_TIPC);
>>> @@ -2024,6 +2042,15 @@ uint32_t mds_mdtm_send_tipc(MDTM_SEND_RE
>>>        send message
>>>      */
>>>     uint32_t status = 0;
>>> +    uint32_t sum_mds_hdr_plus_mdtm_hdr_plus_len;
>>> +    int version = req->msg_arch_word & 0x7;
>>> +    if (version > 1) {
>>> +        sum_mds_hdr_plus_mdtm_hdr_plus_len =
>>> (SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN + gl_mds_mcm_cb-
>>>> node_name_len);
>>> +    } else {
>>> +        /* sending message to Old version Node     */
>>> +        sum_mds_hdr_plus_mdtm_hdr_plus_len =
>>> (SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN - 1 );
>>> +        syslog(LOG_ERR, "LOG: inservice-testing sending message to
>>> Old version Node  hdr_plus_len : %d",
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len);
>>> +    }
>>>
>>>     if (req->to == DESTINATION_SAME_PROCESS) {
>>>         MDS_DATA_RECV recv;
>>> @@ -2043,6 +2070,7 @@ uint32_t mds_mdtm_send_tipc(MDTM_SEND_RE
>>>         recv.msg_fmt_ver = req->msg_fmt_ver;
>>>         recv.src_svc_sub_part_ver = req->src_svc_sub_part_ver;
>>>
>>> +        strncpy((char *)recv.src_node_name, (char *)gl_mds_mcm_cb-
>>>> node_name, gl_mds_mcm_cb->node_name_len);
>>>         /* This is exclusively for the Bcast ENC and ENC_FLAT case
>> */
>>>         if (recv.msg.encoding == MDS_ENC_TYPE_FULL) {
>>>             ncs_dec_init_space(&recv.msg.data.fullenc_uba,
>>> recv.msg.data.fullenc_uba.start);
>>> @@ -2081,7 +2109,7 @@ uint32_t mds_mdtm_send_tipc(MDTM_SEND_RE
>>>
>>>         /* Only for the ack and not for any other message */
>>>         if (req->snd_type == MDS_SENDTYPE_ACK || req->snd_type ==
>>> MDS_SENDTYPE_RACK) {
>>> -            uint8_t len =
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN;
>>> +            uint8_t len = sum_mds_hdr_plus_mdtm_hdr_plus_len;
>>>             uint8_t buffer_ack[len];
>>>
>>>             /* Add mds_hdr */
>>> @@ -2124,7 +2152,6 @@ uint32_t mds_mdtm_send_tipc(MDTM_SEND_RE
>>>
>>>                 // determine fragment limit using a bit in
>>> destination archword
>>>                 int frag_size;
>>> -                int version = req->msg_arch_word & 0x7;
>>>                 if (version > 0) {
>>>                     // normal mode, use TIPC
>>> fragmentation
>>>                     frag_size = MDS_DIRECT_BUF_MAXSIZE;
>>> @@ -2141,13 +2168,13 @@ uint32_t mds_mdtm_send_tipc(MDTM_SEND_RE
>>>                 } else {
>>>                     uint8_t *p8;
>>>                     uint8_t *body = NULL;
>>> -                    body = calloc(1, len +
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN);
>>> +                    body = calloc(1, len +
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len);
>>>
>>>                     p8 = (uint8_t
>>> *)m_MMGR_DATA_AT_START(usrbuf, len, (char *)
>>> -
>> (body
>>> + SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN));
>>> -
>>> -                    if (p8 != (body +
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN))
>>> -                        memcpy((body +
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN), p8, len);
>>> +
>> (body
>>> + sum_mds_hdr_plus_mdtm_hdr_plus_len));
>>> +
>>> +                    if (p8 != (body +
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len))
>>> +                        memcpy((body +
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len), p8, len);
>>>
>>>                     if (NCSCC_RC_SUCCESS !=
>>> mdtm_add_mds_hdr(body, req)) {
>>>                         m_MDS_LOG_ERR("MDTM:
>>> Unable to add the mds Hdr to the send msg\n");
>>> @@ -2157,7 +2184,7 @@ uint32_t mds_mdtm_send_tipc(MDTM_SEND_RE
>>>                     }
>>>
>>>                     if (NCSCC_RC_SUCCESS !=
>>> -                        mdtm_add_frag_hdr(body, (len +
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN),
>>> +                        mdtm_add_frag_hdr(body, (len +
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len),
>>>                                   frag_seq_num,
>> 0)) {
>>> m_MDS_LOG_ERR("MDTM:
>>> Unable to add the frag Hdr to the send msg\n");
>>>
>>>     m_MMGR_FREE_BUFR_LIST(usrbuf);
>>> @@ -2169,7 +2196,7 @@ uint32_t mds_mdtm_send_tipc(MDTM_SEND_RE
>>>                         ("MDTM:Sending message with
>>> Service Seqno=%d, TO Dest_Tipc_id=<0x%08x:%u> ",
>>>                          req->svc_seq_num, tipc_id.node,
>>> tipc_id.ref);
>>>
>>> -                    len +=
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN;
>>> +                    len +=
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len;
>>>                     if (((req->snd_type ==
>>> MDS_SENDTYPE_RBCAST) || (req->snd_type == MDS_SENDTYPE_BCAST)) &&
>>>                             (version > 0) &&
>>> (tipc_mcast_enabled)) {
>>>                         m_MDS_LOG_DBG("MDTM:
>>> User Sending Multicast Data lenght=%d From svc_id = %s(%d) to svc_id =
>>> %s(%d)\n", len,
>>> @@ -2208,7 +2235,7 @@ uint32_t mds_mdtm_send_tipc(MDTM_SEND_RE
>>>         case MDS_ENC_TYPE_DIRECT_BUFF:
>>>             {
>>>                 if (req->msg.data.buff_info.len >
>>> -                    (MDTM_MAX_DIRECT_BUFF_SIZE -
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN)) {
>>> +                    (MDTM_MAX_DIRECT_BUFF_SIZE -
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len)) {
>>>                     m_MDS_LOG_CRITICAL
>>>                         ("MDTM: Passed pkt len is more
>>> than the single send direct buff\n");
>>>                     mds_free_direct_buff(req-
>>>> msg.data.buff_info.buff);
>>> @@ -2219,7 +2246,7 @@ uint32_t mds_mdtm_send_tipc(MDTM_SEND_RE
>>>                            req->msg.data.buff_info.len,
>>> get_svc_names(req->src_svc_id), req->src_svc_id, get_svc_names(req-
>>>> dest_svc_id), req->dest_svc_id);
>>>                 uint8_t *body = NULL;
>>> -                body = calloc(1,
>> (req->msg.data.buff_info.len +
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN));
>>> +                body = calloc(1,
>> (req->msg.data.buff_info.len +
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len));
>>>
>>>                 if (NCSCC_RC_SUCCESS !=
>>> mdtm_add_mds_hdr(body, req)) {
>>>                     m_MDS_LOG_ERR("MDTM: Unable to
>>> add the mds Hdr to the send msg\n");
>>> @@ -2229,19 +2256,19 @@ uint32_t mds_mdtm_send_tipc(MDTM_SEND_RE
>>>                 }
>>>                 if (NCSCC_RC_SUCCESS !=
>>>                     mdtm_add_frag_hdr(body,
>>> -
>> req->msg.data.buff_info.len
>>> + SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN,
>>> +
>> req->msg.data.buff_info.len
>>> + sum_mds_hdr_plus_mdtm_hdr_plus_len,
>>>                               frag_seq_num, 0)) {
>>>                     m_MDS_LOG_ERR("MDTM: Unable to
>>> add the frag Hdr to the send msg\n");
>>>                     free(body);
>>>                     mds_free_direct_buff(req-
>>>> msg.data.buff_info.buff);
>>>                     return NCSCC_RC_FAILURE;
>>>                 }
>>> -
>>>     memcpy(&body[SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN], req-
>>>> msg.data.buff_info.buff,
>>> +
>>>     memcpy(&body[sum_mds_hdr_plus_mdtm_hdr_plus_len], req-
>>>> msg.data.buff_info.buff,
>>>                        req->msg.data.buff_info.len);
>>>
>>>                 if (NCSCC_RC_SUCCESS !=
>>>                     mdtm_sendto(body,
>>> -                        (req->msg.data.buff_info.len
>> +
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN),
>>> +                        (req->msg.data.buff_info.len
>> +
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len),
>>>                         tipc_id)) {
>>>                     m_MDS_LOG_ERR("MDTM: Unable to
>>> send the msg thru TIPC\n");
>>>                     free(body);
>>> @@ -2298,7 +2325,17 @@ uint32_t mdtm_frag_and_send(MDTM_SEND_RE
>>>     uint8_t *p8;
>>>     uint16_t i = 1;
>>>     uint16_t frag_val = 0;
>>> -    int max_send_pkt_size = frag_size +
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN;
>>> +    uint32_t sum_mds_hdr_plus_mdtm_hdr_plus_len;
>>> +    int version = req->msg_arch_word & 0x7;
>>> +
>>> +    if (version > 1) {
>>> +        sum_mds_hdr_plus_mdtm_hdr_plus_len =
>>> (SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN + gl_mds_mcm_cb-
>>>> node_name_len);
>>> +    } else {
>>> +        sum_mds_hdr_plus_mdtm_hdr_plus_len =
>>> (SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN - 1 );
>>> +        syslog(LOG_ERR, "LOG: inservice-testing sending message to
>>> Old version Node  hdr_plus_len : %d",
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len);
>>> +    }
>>> +
>>> +    int max_send_pkt_size = frag_size +
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len;
>>>
>>>     switch (req->msg.encoding) {
>>>     case MDS_ENC_TYPE_FULL:
>>> @@ -2347,11 +2384,11 @@ uint32_t mdtm_frag_and_send(MDTM_SEND_RE
>>>             body = calloc(1, len_buf);
>>>             if (i == 1) {
>>>                 p8 = (uint8_t
>>> *)m_MMGR_DATA_AT_START(usrbuf,
>>> -                                  (len_buf -
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN),
>>> -                                  (char
>> *)(body
>>> + SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN));
>>> -
>>> -                if (p8 != (body +
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN))
>>> -                    memcpy((body +
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN), p8, (len_buf -
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN));
>>> +                                  (len_buf -
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len),
>>> +                                  (char
>> *)(body
>>> + sum_mds_hdr_plus_mdtm_hdr_plus_len));
>>> +
>>> +                if (p8 != (body +
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len))
>>> +                    memcpy((body +
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len), p8, (len_buf -
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len));
>>>
>>>                 if (NCSCC_RC_SUCCESS !=
>>> mdtm_add_mds_hdr(body, req)) {
>>>                     m_MDS_LOG_ERR("MDTM: frg MDS hdr
>>> addition failed\n");
>>> @@ -2370,9 +2407,9 @@ uint32_t mdtm_frag_and_send(MDTM_SEND_RE
>>>                     ("MDTM:Sending message with Service
>>> Seqno=%d, Fragment Seqnum=%d, frag_num=%d, TO
>>> Dest_Tipc_id=<0x%08x:%u>",
>>>                      req->svc_seq_num, seq_num, frag_val,
>>> id.node, id.ref);
>>>                 mdtm_sendto(body, len_buf, id);
>>> -                m_MMGR_REMOVE_FROM_START(&usrbuf,
>>> len_buf - SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN);
>>> +                m_MMGR_REMOVE_FROM_START(&usrbuf,
>>> len_buf - sum_mds_hdr_plus_mdtm_hdr_plus_len);
>>>                 free(body);
>>> -                len = len - (len_buf -
>>> SUM_MDS_HDR_PLUS_MDTM_HDR_PLUS_LEN);
>>> +                len = len - (len_buf -
>>> sum_mds_hdr_plus_mdtm_hdr_plus_len);
>>>             } else {
>>>                 p8 = (uint8_t
>>> *)m_MMGR_DATA_AT_START(usrbuf, len_buf -
>>> MDTM_FRAG_HDR_PLUS_LEN_2,
>>>                                   (char
>> *)(body
>>> + MDTM_FRAG_HDR_PLUS_LEN_2));
>>> @@ -2533,6 +2570,16 @@ static uint32_t mdtm_mcast_sendto(void *
>>> static uint32_t mdtm_add_mds_hdr(uint8_t *buffer, MDTM_SEND_REQ *req)
>>> {
>>>     uint8_t prot_ver = 0, enc_snd_type = 0;
>>> +    uint16_t mds_hdr_len;
>>> +    int version = req->msg_arch_word & 0x7;
>>> +    if (version > 1) {
>>> +        mds_hdr_len = (MDS_HDR_LEN + gl_mds_mcm_cb-
>>>> node_name_len);
>>> +    } else {
>>> +        /* Old MDS_HDR_LEN = 24 */
>>> +        mds_hdr_len  = (MDS_HDR_LEN - 1);
>>> +        syslog(LOG_ERR, "LOG: inservice-testing sending message to
>>> Old version Node  mds_hdr_len : %d", mds_hdr_len);
>>> +    }
>>> +
>>> #ifdef MDS_CHECKSUM_ENABLE_FLAG
>>>     uint8_t zero_8 = 0;
>>> #endif
>>> @@ -2564,7 +2611,7 @@ static uint32_t mdtm_add_mds_hdr(uint8_t
>>>
>>>     /* MDS HDR */
>>>     ncs_encode_8bit(&ptr, prot_ver);
>>> -    ncs_encode_16bit(&ptr, (uint16_t)MDS_HDR_LEN);    /* Will be
>>> updated if any additional options are being added at the end */
>>> +    ncs_encode_16bit(&ptr, (uint16_t)mds_hdr_len);    /* Will be
>>> updated if any additional options are being added at the end */
>>>     ncs_encode_32bit(&ptr, req->svc_seq_num);
>>>     ncs_encode_8bit(&ptr, enc_snd_type);
>>>     ncs_encode_16bit(&ptr, req->src_pwe_id);
>>> @@ -2594,7 +2641,10 @@ static uint32_t mdtm_add_mds_hdr(uint8_t
>>>
>>>     ncs_encode_32bit(&ptr, xch_id);
>>>     ncs_encode_16bit(&ptr, req->msg_fmt_ver);    /* New field */
>>> -
>>> +    if (version > 1) {
>>> +        ncs_encode_8bit(&ptr, gl_mds_mcm_cb->node_name_len); /*
>>> New field 1 */
>>> +        ncs_encode_octets(&ptr, (uint8_t *)gl_mds_mcm_cb-
>>>> node_name, gl_mds_mcm_cb->node_name_len); /* New field 2 */
>>> +    }
>>>     return NCSCC_RC_SUCCESS;
>>> }
>>>
>>> diff --git a/osaf/libs/core/mds/mds_main.c 
>>> b/osaf/libs/core/mds/mds_main.c
>>> --- a/osaf/libs/core/mds/mds_main.c
>>> +++ b/osaf/libs/core/mds/mds_main.c
>>> @@ -395,15 +395,47 @@ uint32_t mds_lib_req(NCS_LIB_REQ_INFO *r
>>>             }
>>>         }
>>>
>>> -        /* Get tipc_mcast_enabled */
>>> -        if ((ptr = getenv("MDS_TIPC_MCAST_ENABLED")) != NULL) {
>>> -            tipc_mcast_enabled = atoi(ptr);
>>> -            if (tipc_mcast_enabled != false)
>>> -                tipc_mcast_enabled = true;
>>> -
>>> -            m_MDS_LOG_DBG("MDS: TIPC_MCAST_ENABLED: %d
>>> Set argument \n",tipc_mcast_enabled);
>>> +#ifdef ENABLE_TIPC_TRANSPORT
>>> +        int rc;
>>> +        struct stat sockStat;
>>> +        FILE *fp;
>>> +
>>> +        rc = stat(MDS_MDTM_CONNECT_PATH, &sockStat);
>>> +        if (rc != 0) {
>>> +            /* dtm intra server not exists */
>>> +            tipc_mode_enabled = true;
>>>         }
>>>
>>> +        if (tipc_mode_enabled) {
>>> +            /* Get tipc_mcast_enabled */
>>> +            if ((ptr = getenv("MDS_TIPC_MCAST_ENABLED")) !=
>>> NULL) {
>>> +                tipc_mcast_enabled = atoi(ptr);
>>> +                if (tipc_mcast_enabled != false)
>>> +                    tipc_mcast_enabled = true;
>>> +
>>> +                m_MDS_LOG_DBG("MDS:
>>> TIPC_MCAST_ENABLED: %d  Set argument \n",tipc_mcast_enabled);
>>> +            }
>>> +
>>> +        }
>>> +#endif
>>> +        fp = fopen(PKGSYSCONFDIR "/node_name", "r");
>>> +        if (fp == NULL) {
>>> +            LOG_ER("MDS:TIPC Could not open file  node_name ");
>>> +            mds_mcm_destroy();
>>> + osaf_mutex_unlock_ordie(&gl_mds_library_mutex);
>>> +            return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);
>>> +        }
>>> +        if (EOF == fscanf(fp, "%s", gl_mds_mcm_cb->node_name)) {
>>> +            fclose(fp);
>>> +            LOG_ER("MDS:TIPC Could not get node name ");
>>> +            mds_mcm_destroy();
>>> + osaf_mutex_unlock_ordie(&gl_mds_library_mutex);
>>> +            return m_LEAP_DBG_SINK(NCSCC_RC_FAILURE);
>>> +        }
>>> +        fclose(fp);
>>> +        gl_mds_mcm_cb->node_name_len =
>>> (uint8_t)strlen(gl_mds_mcm_cb->node_name);
>>> +        m_MDS_LOG_DBG("MDS:TIPC config->node_name : %s",
>>> gl_mds_mcm_cb->node_name);
>>> +
>>>         /*  to use cluster id in mds prefix? */
>>>
>>>         /* Get gl_mds_log_level */
>>> @@ -599,15 +631,6 @@ uint32_t mds_lib_req(NCS_LIB_REQ_INFO *r
>>> void mds_init_transport(void)
>>> {
>>> #ifdef ENABLE_TIPC_TRANSPORT
>>> -    int rc;
>>> -    struct stat sockStat;
>>> -
>>> -    rc = stat(MDS_MDTM_CONNECT_PATH, &sockStat);
>>> -    if (rc != 0) {
>>> -        /* dtm intra server not exists */
>>> -        tipc_mode_enabled = true;
>>> -    }
>>> -
>>>     if (tipc_mode_enabled) {
>>>         mds_mdtm_init = mdtm_tipc_init;
>>>         mds_mdtm_destroy = mdtm_tipc_destroy;
>>>
>>> --------------------------------------------------------------------------- 
>>>
>> ---
>>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>>> Monitor end-to-end web transactions and take corrective actions now
>>> Troubleshoot faster and improve end-user experience. Signup Now!
>>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>>> _______________________________________________
>>> Opensaf-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>>
>> ------------------------------------------------------------------------------
>>  
>>
>> Site24x7 APM Insight: Get Deep Visibility into Application Performance
>> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
>> Monitor end-to-end web transactions and take corrective actions now
>> Troubleshoot faster and improve end-user experience. Signup Now!
>> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
>> _______________________________________________
>> Opensaf-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/opensaf-devel
>>
>


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to