if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN_FROM_NAT,
iptables_cmd, iptables_nat_chain_name);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_CHAIN_FROM_NAT,
iptables_cmd, iptables_nat_chain_name);
if (netconfig_execute_cmd(buf))
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_DROP_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_RETURN_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_INSERT_RULE,
iptables_cmd, filter, iptables_filter_prefix, filter);
filter = iptables_filter_in;
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_CREATE_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_DROP_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_RETURN_RULE,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_INSERT_RULE,
iptables_cmd, filter, iptables_filter_prefix, filter);
}
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
filter = iptables_filter_in;
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_RULE,
iptables_cmd, filter, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_FLUSH_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_DEL_CHAIN,
iptables_cmd, iptables_filter_prefix, filter);
if (netconfig_execute_cmd(buf))
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_ACCEPT_RULE,
iptables_cmd, c, iptables_filter_prefix,
iptables_filter_in, 's', addr, mask);
if (netconfig_execute_cmd(buf))
ERR("Failed to execute command: %s", buf);
- memset(buf, '0', sizeof(buf));
+ memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), IPTABLES_FMT_APPEND_ACCEPT_RULE_WITH_INTF,
iptables_cmd, c, iptables_filter_prefix, iptables_filter_in,
'i', interface, 's', addr, mask);
memset(&ifr, 0, sizeof(ifr));
if (*iface_name)
- strncpy(ifr.ifr_name, iface_name, IFNAMSIZ);
+ strncpy(ifr.ifr_name, iface_name, IFNAMSIZ - 1);
/* get an interface name by ifindex */
if (ioctl(sk, SIOCGIFINDEX, &ifr) < 0) {