#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__ */
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+
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);
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);
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);
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);
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;
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);
}
FREE(rule->target);
FREE(rule);
- rule = NULL;
}
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;
}
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);
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);
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);
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);