Hi Minh, Regarding to check max unit32, I think it's not necessary. Because the atoi() returns the converted integral number as an int value. It cannot bigger than max of uint32.
Best Regards, Thuan ________________________________ From: Minh Hon Chau <minh.c...@dektech.com.au> Sent: Monday, May 4, 2020 12:37 PM To: Thuan Tran <thuan.t...@dektech.com.au>; Thang Duc Nguyen <thang.d.ngu...@dektech.com.au> Cc: opensaf-devel@lists.sourceforge.net <opensaf-devel@lists.sourceforge.net> Subject: Re: [PATCH 1/1] ntf: fix ntfimcn fail to send notification with no space error [#3181] Hi Thuan Ack with comment. I think we need to check the max value of unit32t for ntf_var_data_limit when we source from the env var. Thanks Minh On 27/4/20 9:05 pm, thuan.tran wrote: > - Support NTFA_VARIABLE_DATA_LIMIT configuration for NTF Agent. > Default value is SHRT_MAX(32767). > - In system that object creation may have many info attributes/values, > it should configure this env variable to suitable value for ntfimcn > able send notification. > --- > src/ntf/agent/ntfa_util.c | 13 ++++++++++++- > src/ntf/ntfd/ntfd.conf | 4 ++++ > src/ntf/ntfimcnd/ntfimcn_imm.c | 18 ++++++++++++------ > 3 files changed, 28 insertions(+), 7 deletions(-) > > diff --git a/src/ntf/agent/ntfa_util.c b/src/ntf/agent/ntfa_util.c > index 5bc859259..379348ab5 100644 > --- a/src/ntf/agent/ntfa_util.c > +++ b/src/ntf/agent/ntfa_util.c > @@ -60,8 +60,19 @@ static unsigned int ntfa_create(void) > /* No longer needed */ > m_NCS_SEL_OBJ_DESTROY(&ntfa_cb.ntfs_sync_sel); > > - /* TODO: fix env variable */ > + char *ptr = NULL; > + int optval = 0; > ntfa_cb.ntf_var_data_limit = NTFA_VARIABLE_DATA_LIMIT; > + if ((ptr = getenv("NTFA_VARIABLE_DATA_LIMIT")) != NULL) { > + optval = atoi(ptr); > + if (optval > 0) { > + ntfa_cb.ntf_var_data_limit = optval; > + LOG_NO("NTFA_VARIABLE_DATA_LIMIT=%d", optval); > + } else { > + LOG_WA("Invalid NTFA_VARIABLE_DATA_LIMIT, using default > %d", > + NTFA_VARIABLE_DATA_LIMIT); > + } > + } > return rc; > > error: > diff --git a/src/ntf/ntfd/ntfd.conf b/src/ntf/ntfd/ntfd.conf > index 91bfcd2e2..f2f67496f 100644 > --- a/src/ntf/ntfd/ntfd.conf > +++ b/src/ntf/ntfd/ntfd.conf > @@ -24,6 +24,10 @@ export NTFSV_ENV_HEALTHCHECK_KEY="Default" > # directory and the directory component of the path name (if any) is > ignored. > #export NTFSCN_TRACE_PATHNAME=osafntfcn > > +# Uncomment the next line to configure max allowed variable data size for the > +# osafntfcn (configuration notifier). Default value is 32767 bytes > +#export NTFA_VARIABLE_DATA_LIMIT=32767 > + > # Only log priority LOG_WARNING and higher to the system log file. > # All logging will be recorded in a new node local log file > $PKGLOGDIR/osaf.log. > # Uncomment the next line to enable this service to log to OpenSAF node > local log file. > diff --git a/src/ntf/ntfimcnd/ntfimcn_imm.c b/src/ntf/ntfimcnd/ntfimcn_imm.c > index c58e8a268..3f2c1a873 100644 > --- a/src/ntf/ntfimcnd/ntfimcn_imm.c > +++ b/src/ntf/ntfimcnd/ntfimcn_imm.c > @@ -680,8 +680,10 @@ static void saImmOiCcbApplyCallback(SaImmOiHandleT > immOiHandle, > ccbUtilOperationData, rdn_attr_name, ccbLast); > if (internal_rc != 0) { > LOG_ER( > - "%s send_object_create_notification fail", > - __FUNCTION__); > + "%s send_object_create_notification %s > fail", > + __FUNCTION__, > + osaf_extended_name_borrow( > + &ccbUtilOperationData->objectName)); > goto done; > } > break; > @@ -706,8 +708,10 @@ static void saImmOiCcbApplyCallback(SaImmOiHandleT > immOiHandle, > ccbUtilOperationData, invoke_name_ptr, ccbLast); > if (internal_rc != 0) { > LOG_ER( > - "%s send_object_delete_notification fail", > - __FUNCTION__); > + "%s send_object_delete_notification %s > fail", > + __FUNCTION__, > + osaf_extended_name_borrow( > + &ccbUtilOperationData->objectName)); > goto done; > } > break; > @@ -720,8 +724,10 @@ static void saImmOiCcbApplyCallback(SaImmOiHandleT > immOiHandle, > ccbUtilOperationData, invoke_name_ptr, ccbLast); > if (internal_rc != 0) { > LOG_ER( > - "%s send_object_modify_notification fail", > - __FUNCTION__); > + "%s send_object_modify_notification %s > fail", > + __FUNCTION__, > + osaf_extended_name_borrow( > + &ccbUtilOperationData->objectName)); > goto done; > } > break; _______________________________________________ Opensaf-devel mailing list Opensaf-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/opensaf-devel