From: hyunuktak Date: Fri, 15 Dec 2017 08:31:43 +0000 (+0900) Subject: Updated correct return error and target name X-Git-Tag: accepted/tizen/unified/20171219.072626^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F98%2F164098%2F1;p=platform%2Fcore%2Fconnectivity%2Fstc-iptables.git Updated correct return error and target name Change-Id: I562edf8699c41b1c83d14997a84fb7d5524375fb Signed-off-by: hyunuktak --- diff --git a/include/stc-iptables-log.h b/include/stc-iptables-log.h index 1919190..c2db213 100755 --- a/include/stc-iptables-log.h +++ b/include/stc-iptables-log.h @@ -40,7 +40,7 @@ void stc_iptables_log_cleanup(void); #define STC_LOGW(format, args...) __LOG(LOG_WARN, format, ##args) #define STC_LOGE(format, args...) __LOG(LOG_ERROR, format, ##args) -#define __STC_LOG_FUNC_ENTER__ __LOG(LOG_DEBUG, "Enter") -#define __STC_LOG_FUNC_EXIT__ __LOG(LOG_DEBUG, "Quit") +#define __STC_LOG_FUNC_ENTER__ /* __LOG(LOG_DEBUG, "Enter") */ +#define __STC_LOG_FUNC_EXIT__ /* __LOG(LOG_DEBUG, "Quit") */ #endif /* __STC_IPTABLES_LOG_H__ */ diff --git a/packaging/stc-iptables.spec b/packaging/stc-iptables.spec index 2f4b907..29b61fa 100644 --- a/packaging/stc-iptables.spec +++ b/packaging/stc-iptables.spec @@ -1,6 +1,6 @@ Name: stc-iptables Summary: STC(Smart Traffic Control) iptables -Version: 0.0.9 +Version: 0.0.10 Release: 0 Group: Network & Connectivity/Other License: GPL-2.0+ diff --git a/src/stc-iptables-util.c b/src/stc-iptables-util.c index 7dd1638..78dac42 100755 --- a/src/stc-iptables-util.c +++ b/src/stc-iptables-util.c @@ -149,12 +149,16 @@ gboolean handle_iptables_add_rule(StcRule *object, STC_LOGE("Failed add rule [%s:%d:%s:%d:%s:%s]", rule->chain, rule->type, rule->ifname, rule->classid, rule->nfacct_name, rule->target); - } - FREE(rule->chain); - FREE(rule->ifname); - FREE(rule->nfacct_name); - FREE(rule->target); + FREE(rule->chain); + FREE(rule->ifname); + FREE(rule->nfacct_name); + FREE(rule->target); + + STC_IPTABLES_DBUS_REPLY_ERROR(invocation, ret); + __STC_LOG_FUNC_EXIT__; + return TRUE; + } } g_variant_iter_free(iter); @@ -200,12 +204,16 @@ gboolean handle_iptables_remove_rule(StcRule *object, STC_LOGE("Failed remove rule [%s:%d:%s:%d:%s:%s]", rule->chain, rule->type, rule->ifname, rule->classid, rule->nfacct_name, rule->target); - } - FREE(rule->chain); - FREE(rule->ifname); - FREE(rule->nfacct_name); - FREE(rule->target); + FREE(rule->chain); + FREE(rule->ifname); + FREE(rule->nfacct_name); + FREE(rule->target); + + STC_IPTABLES_DBUS_REPLY_ERROR(invocation, ret); + __STC_LOG_FUNC_EXIT__; + return TRUE; + } } g_variant_iter_free(iter); @@ -327,12 +335,16 @@ gboolean handle_ip6tables_add_rule(StcRule *object, STC_LOGE("Failed add rule [%s:%d:%s:%d:%s:%s]", rule->chain, rule->type, rule->ifname, rule->classid, rule->nfacct_name, rule->target); - } - FREE(rule->chain); - FREE(rule->ifname); - FREE(rule->nfacct_name); - FREE(rule->target); + FREE(rule->chain); + FREE(rule->ifname); + FREE(rule->nfacct_name); + FREE(rule->target); + + STC_IPTABLES_DBUS_REPLY_ERROR(invocation, ret); + __STC_LOG_FUNC_EXIT__; + return TRUE; + } } g_variant_iter_free(iter); @@ -378,12 +390,16 @@ gboolean handle_ip6tables_remove_rule(StcRule *object, STC_LOGE("Failed remove rule [%s:%d:%s:%d:%s:%s]", rule->chain, rule->type, rule->ifname, rule->classid, rule->nfacct_name, rule->target); - } - FREE(rule->chain); - FREE(rule->ifname); - FREE(rule->nfacct_name); - FREE(rule->target); + FREE(rule->chain); + FREE(rule->ifname); + FREE(rule->nfacct_name); + FREE(rule->target); + + STC_IPTABLES_DBUS_REPLY_ERROR(invocation, ret); + __STC_LOG_FUNC_EXIT__; + return TRUE; + } } g_variant_iter_free(iter); diff --git a/test/stc_ipt_gdbus.c b/test/stc_ipt_gdbus.c index c168743..73920ef 100755 --- a/test/stc_ipt_gdbus.c +++ b/test/stc_ipt_gdbus.c @@ -28,7 +28,7 @@ static __thread stc_ipt_dbus_conn_data_s g_stc_ipt_dbus_conn = { NULL, NULL }; static int __stc_ipt_convert_error_string_to_enum(const char *error) { - msg("Passed error value [%s]", error); + /* msg("Passed error value [%s]", error); */ if (NULL != strstr(error, "NoReply")) return STC_ERROR_INVALID_OPERATION; diff --git a/test/stc_ipt_rule.c b/test/stc_ipt_rule.c index f9bab72..d486736 100755 --- a/test/stc_ipt_rule.c +++ b/test/stc_ipt_rule.c @@ -85,10 +85,14 @@ static void __test_print_rule(ipt_rule_s *rule) msg("Type : [IN]"); else if (rule->type == IPTABLES_RULE_OUT) msg("Type : [OUT]"); - msg("Ifname : [%s]", rule->ifname); - msg("Cgroup : [%d]", rule->classid); - msg("Nfacct : [%s]", rule->nfacct_name); - msg("Target : [%s]", rule->target); + if (rule->ifname) + msg("Ifname : [%s]", rule->ifname); + if (rule->classid > 0) + msg("Cgroup : [%d]", rule->classid); + if (rule->nfacct_name) + msg("Nfacct : [%s]", rule->nfacct_name); + if (rule->target) + msg("Target : [%s]", rule->target); msg(HR_SINGLE); } @@ -101,7 +105,6 @@ static void __test_rule_free(ipt_rule_s *rule) FREE(rule->target); FREE(rule); - rule = NULL; } static int __test_set_rule(void) @@ -146,7 +149,7 @@ static int __test_set_rule(void) g_rule->target = g_strdup(TARGET_DROP); break; default: - g_rule->target = NULL; + g_rule->target = g_strdup(""); break; } @@ -217,10 +220,8 @@ static int __stc_ipt_add_rule(void) params, &err); - if (message == NULL) { - msg(LOG_RED "Failed to invoke dbus method" LOG_END); + if (message == NULL) return err; - } stc_ipt_exe_cmd(CHECK_IPTABLES); @@ -252,10 +253,8 @@ static int __stc_ip6t_add_rule(void) params, &err); - if (message == NULL) { - msg(LOG_RED "Failed to invoke dbus method" LOG_END); + if (message == NULL) return err; - } stc_ipt_exe_cmd(CHECK_IP6TABLES); @@ -288,10 +287,8 @@ static int __stc_ipt_remove_rule(void) params, &err); - if (message == NULL) { - msg(LOG_RED "Failed to invoke dbus method" LOG_END); + if (message == NULL) return err; - } stc_ipt_exe_cmd(CHECK_IPTABLES); @@ -324,10 +321,8 @@ static int __stc_ip6t_remove_rule(void) params, &err); - if (message == NULL) { - msg(LOG_RED "Failed to invoke dbus method" LOG_END); + if (message == NULL) return err; - } stc_ipt_exe_cmd(CHECK_IP6TABLES);