X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=ipsets.c;h=7a72fd35a378941304c8308f75f65b91ae6fc8d3;hb=d44f4189b6a6eb5e943f11dfff0246d3ac0e9087;hp=8f88885546c68bb16f124294c51b073d10be68a2;hpb=7dfc240dfaee099eab04bd18369edb11dfbb5045;p=project%2Ffirewall3.git diff --git a/ipsets.c b/ipsets.c index 8f88885..7a72fd3 100644 --- a/ipsets.c +++ b/ipsets.c @@ -1,7 +1,7 @@ /* * firewall3 - 3rd OpenWrt UCI firewall implementation * - * Copyright (C) 2013 Jo-Philipp Wich + * Copyright (C) 2013 Jo-Philipp Wich * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -203,13 +203,10 @@ fw3_alloc_ipset(void) { struct fw3_ipset *ipset; - ipset = malloc(sizeof(*ipset)); - + ipset = calloc(1, sizeof(*ipset)); if (!ipset) return NULL; - memset(ipset, 0, sizeof(*ipset)); - INIT_LIST_HEAD(&ipset->datatypes); ipset->enabled = true; @@ -242,7 +239,8 @@ fw3_load_ipsets(struct fw3_state *state, struct uci_package *p) if (!ipset) continue; - fw3_parse_options(ipset, fw3_ipset_opts, s); + if (!fw3_parse_options(ipset, fw3_ipset_opts, s)) + warn_elem(e, "has invalid options"); if (ipset->external) { @@ -306,7 +304,7 @@ create_ipset(struct fw3_ipset *ipset, struct fw3_state *state) if (ipset->iprange.set) { - fw3_pr(" range %s", fw3_address_to_string(&ipset->iprange, false)); + fw3_pr(" range %s", fw3_address_to_string(&ipset->iprange, false, true)); } else if (ipset->portrange.set) {