int ret = STC_ERROR_NONE;
struct genl *req = MALLOC0(struct genl, 1);
if (req == NULL) {
- STC_LOGE("Failed allocate memory to genl request message");
- return STC_ERROR_OUT_OF_MEMORY;
+ STC_LOGE("Failed allocate memory to genl request message"); //LCOV_EXCL_LINE
+ return STC_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
}
prepare_netlink_msg(req, NFNL_MSG_ACCT_NEW, NLM_F_CREATE | NLM_F_ACK);
add_string_attr(req, counter->name, NFACCT_NAME);
if (STC_DEBUG_LOG)
- STC_LOGD("counter name %s", counter->name);
+ STC_LOGD("counter name %s", counter->name); //LCOV_EXCL_LINE
/* padding */
add_uint64_attr(req, 0, NFACCT_PKTS);
add_uint64_attr(req, 0, NFACCT_BYTES);
+ //LCOV_EXCL_START
if (counter->quota) {
STC_LOGD("quota bytes %"PRId64, counter->quota);
NFACCT_FLAGS);
add_uint64_attr(req, htobe64(counter->quota), NFACCT_QUOTA);
}
+ //LCOV_EXCL_STOP
ret = send_nfacct_request(counter->carg->sock, req);
FREE(req);
int ret = STC_ERROR_NONE;
struct genl *req = MALLOC0(struct genl, 1);
if (req == NULL) {
- STC_LOGE("Failed allocate memory to genl request message");
- return STC_ERROR_OUT_OF_MEMORY;
+ STC_LOGE("Failed allocate memory to genl request message"); //LCOV_EXCL_LINE
+ return STC_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
}
if (STC_DEBUG_LOG)
- STC_LOGD("send remove request for %s", counter->name);
+ STC_LOGD("send remove request for %s", counter->name); //LCOV_EXCL_LINE
prepare_netlink_msg(req, NFNL_MSG_ACCT_DEL, NLM_F_ACK);
add_string_attr(req, counter->name, NFACCT_NAME);
int flag = !name ? NLM_F_DUMP : 0;
struct genl *req = MALLOC0(struct genl, 1);
if (req == NULL) {
- STC_LOGE("Failed allocate memory to genl request message");
- return STC_ERROR_OUT_OF_MEMORY;
+ STC_LOGE("Failed allocate memory to genl request message"); //LCOV_EXCL_LINE
+ return STC_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
}
prepare_netlink_msg(req, get_type, flag);
cnt->intend = NFACCT_BLOCK;
break;
case 't':
- cnt->intend = NFACCT_TETH_COUNTER;
- break;
+ cnt->intend = NFACCT_TETH_COUNTER; //LCOV_EXCL_LINE
+ break; //LCOV_EXCL_LINE
default:
return false;
}
STRING_SAVE_COPY(cnt->name, cnt_name);
+ //LCOV_EXCL_START
if (cnt->intend == NFACCT_TETH_COUNTER) {
char ifname_buf[MAX_IFACE_LENGTH];
int ifname_len;
cnt->classid = STC_TETHERING_APP_CLASSID;
return true;
}
+ //LCOV_EXCL_STOP
io_part = strtok_r(name, "_", &save_ptr);
if (io_part != NULL)
return STC_IN_CHAIN;
else if (iotype == NFACCT_COUNTER_OUT)
return STC_OUT_CHAIN;
- else if (iotype == NFACCT_COUNTER_FORWARD)
- return STC_FRWD_CHAIN;
+ else if (iotype == NFACCT_COUNTER_FORWARD) //LCOV_EXCL_LINE
+ return STC_FRWD_CHAIN; //LCOV_EXCL_LINE
return "";
}
return "";
}
+/*
static char *choose_iftype_name(nfacct_rule_s *rule)
{
return strlen(rule->ifname) != 0 ? rule->ifname :
get_iftype_name(rule->iftype);
}
+*/
static stc_error_e exec_iptables_cmd(nfacct_rule_s *rule)
{
" traffic, for iftype %d, cmd %s, j %s",
rule->iftype, set_cmd, jump_cmd);
+ //LCOV_EXCL_START
/* for tethering */
if (rule->intend == NFACCT_WARN ||
rule->intend == NFACCT_BLOCK) {
ret_value_msg_if(ret != STC_ERROR_NONE, ret,
"can't del quota counter");
}
+ //LCOV_EXCL_STOP
}
if (rule->iotype & NFACCT_COUNTER_OUT) {
"engress traffic, for iftype %d, cmd %s, j %s",
rule->iftype, set_cmd, jump_cmd);
+ //LCOV_EXCL_START
/* for tethering */
if (rule->intend == NFACCT_WARN ||
rule->intend == NFACCT_BLOCK) {
ret_value_msg_if(ret != STC_ERROR_NONE, ret,
"can't del quota counter");
}
+ //LCOV_EXCL_STOP
}
return STC_ERROR_NONE;
}