}
if (strcmp(policy, "-") != 0) {
- struct xt_counters count;
+ struct xt_counters count = {};
if (counters) {
char *ctrs;
xtables_error(PARAMETER_PROBLEM,
"invalid policy counters "
"for chain '%s'\n", chain);
-
- } else {
- memset(&count, 0, sizeof(count));
}
DEBUGP("Setting policy of chain %s to %s\n",
int do_command6(int argc, char *argv[], char **table,
struct xtc_handle **handle, bool restore)
{
- struct iptables_command_state cs;
+ struct iptables_command_state cs = {
+ .jumpto = "",
+ .argv = argv,
+ };
struct ip6t_entry *e = NULL;
unsigned int nsaddrs = 0, ndaddrs = 0;
struct in6_addr *saddrs = NULL, *daddrs = NULL;
struct xtables_target *t;
unsigned long long cnt;
- memset(&cs, 0, sizeof(cs));
- cs.jumpto = "";
- cs.argv = argv;
-
/* re-set optind to 0 in case do_command6 gets called
* a second time */
optind = 0;
}
if (strcmp(policy, "-") != 0) {
- struct xt_counters count;
+ struct xt_counters count = {};
if (counters) {
char *ctrs;
xtables_error(PARAMETER_PROBLEM,
"invalid policy counters "
"for chain '%s'\n", chain);
-
- } else {
- memset(&count, 0, sizeof(count));
}
DEBUGP("Setting policy of chain %s to %s\n",
int do_command4(int argc, char *argv[], char **table,
struct xtc_handle **handle, bool restore)
{
- struct iptables_command_state cs;
+ struct iptables_command_state cs = {
+ .jumpto = "",
+ .argv = argv,
+ };
struct ipt_entry *e = NULL;
unsigned int nsaddrs = 0, ndaddrs = 0;
struct in_addr *saddrs = NULL, *smasks = NULL;
struct xtables_target *t;
unsigned long long cnt;
- memset(&cs, 0, sizeof(cs));
- cs.jumpto = "";
- cs.argv = argv;
-
/* re-set optind to 0 in case do_command4 gets called
* a second time */
optind = 0;
struct iptables_command_state *cs = data;
struct ebt_entry *fw = &cs->eb;
uint8_t invflags = 0;
- char iifname[IFNAMSIZ], oifname[IFNAMSIZ];
-
- memset(iifname, 0, sizeof(iifname));
- memset(oifname, 0, sizeof(oifname));
+ char iifname[IFNAMSIZ] = {}, oifname[IFNAMSIZ] = {};
parse_meta(e, ctx->meta.key, iifname, NULL, oifname, NULL, &invflags);
host_to_addr(const char *name, unsigned int *naddr)
{
struct in_addr *addr;
- struct addrinfo hints;
+ struct addrinfo hints = {
+ .ai_flags = AI_CANONNAME,
+ .ai_family = AF_INET,
+ .ai_socktype = SOCK_RAW,
+ };;
struct addrinfo *res, *p;
int err;
unsigned int i;
- memset(&hints, 0, sizeof(hints));
- hints.ai_flags = AI_CANONNAME;
- hints.ai_family = AF_INET;
- hints.ai_socktype = SOCK_RAW;
-
*naddr = 0;
err = getaddrinfo(name, NULL, &hints, &res);
if (err != 0)
int do_commandarp(struct nft_handle *h, int argc, char *argv[], char **table)
{
- struct arptables_command_state cs;
+ struct arptables_command_state cs = {
+ .jumpto = "",
+ };
int invert = 0;
unsigned int nsaddrs = 0, ndaddrs = 0;
struct in_addr *saddrs = NULL, *daddrs = NULL;
int ret = 1;
struct xtables_target *t;
- memset(&cs, 0, sizeof(cs));
- cs.jumpto = "";
-
opts = original_opts;
global_option_offset = 0;
unsigned int flags = 0;
struct xtables_target *t, *w;
struct xtables_match *m;
- struct iptables_command_state cs;
+ struct iptables_command_state cs = {
+ .argv = argv,
+ .eb.bitmask = EBT_NOPROTO,
+ };
char command = 'h';
const char *chain = NULL;
int exec_style = EXEC_STYLE_PRG;
.table = *table,
};
- memset(&cs, 0, sizeof(cs));
- cs.argv = argv;
-
if (nft_init(h, xtables_bridge) < 0)
xtables_error(OTHER_PROBLEM,
"Could not initialize nftables layer.");
/* prevent getopt to spoil our error reporting */
opterr = false;
- cs.eb.bitmask = EBT_NOPROTO;
printf("nft ");
/* Getopt saves the day */
unsigned int flags = 0;
struct xtables_target *t, *w;
struct xtables_match *m;
- struct iptables_command_state cs;
+ struct iptables_command_state cs = {
+ .argv = argv,
+ };
char command = 'h';
const char *chain = NULL;
const char *policy = NULL;
struct xtables_rule_match *xtrm_i;
struct ebt_match *match;
- memset(&cs, 0, sizeof(cs));
- cs.argv = argv;
-
if (nft_init(h, xtables_bridge) < 0)
xtables_error(OTHER_PROBLEM,
"Could not initialize nftables layer.");
struct mnl_socket *nl;
char buf[MNL_SOCKET_BUFFER_SIZE];
uint32_t nfgroup = 0;
- struct cb_arg cb_arg;
+ struct cb_arg cb_arg = {};
int ret, c;
xtables_globals.program_name = "xtables-monitor";
init_extensions4();
#endif
- memset(&cb_arg, 0, sizeof(cb_arg));
opterr = 0;
while ((c = getopt_long(argc, argv, "ceht46V", options, NULL)) != -1) {
switch (c) {