Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions run-unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ PROJECT_SOURCES=(
"$ROOT_DIR/src/ipset_common.c"
"$ROOT_DIR/src/ipset_copy.c"
"$ROOT_DIR/src/ipset_diff.c"
"$ROOT_DIR/src/ipset_dns.c"
"$ROOT_DIR/src/ipset_exclude.c"
"$ROOT_DIR/src/ipset_load.c"
"$ROOT_DIR/src/ipset_merge.c"
Expand Down
4 changes: 2 additions & 2 deletions src/ipset6_diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ inline ipset6 *ipset6_diff(ipset6 *ips1, ipset6 *ips2) {
lo2 = ips2->netaddrs[i2].addr;
hi2 = ips2->netaddrs[i2].broadcast;
}
if(i1 < n1 && lo1 > hi1) {
if(i1 < n1) {
lo1 = ips1->netaddrs[i1].addr;
hi1 = ips1->netaddrs[i1].broadcast;
}
Expand All @@ -97,7 +97,7 @@ inline ipset6 *ipset6_diff(ipset6 *ips1, ipset6 *ips2) {
lo1 = ips1->netaddrs[i1].addr;
hi1 = ips1->netaddrs[i1].broadcast;
}
if(i2 < n2 && lo2 > hi2) {
if(i2 < n2) {
lo2 = ips2->netaddrs[i2].addr;
hi2 = ips2->netaddrs[i2].broadcast;
}
Expand Down
3 changes: 1 addition & 2 deletions src/ipset_dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,9 @@ static void *dns_thread_resolve(void *ptr)
int r;
struct addrinfo *result, *rp, hints;

memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = 0;
hints.ai_protocol = 0;

r = getaddrinfo(d->hostname, "80", &hints, &result);
if(r != 0) {
Expand Down
3 changes: 3 additions & 0 deletions tests.sanitizers.d/05-dns-thread-create-failure/cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ char *PROG = "dns-create-fail";
int debug;
int cidr_use_network = 1;
int default_prefix = 32;
int active_family = 0;
unsigned long ipv6_dropped_in_ipv4_mode = 0;
int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) {
(void)thread;
Expand Down Expand Up @@ -68,6 +70,7 @@ if ! "${CC:-clang}" \
../../src/ipset_common.c \
../../src/ipset_copy.c \
../../src/ipset_diff.c \
../../src/ipset_dns.c \
../../src/ipset_exclude.c \
../../src/ipset_load.c \
../../src/ipset_merge.c \
Expand Down
2 changes: 2 additions & 0 deletions tests.unit/combine_overflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ char *PROG = "combine_overflow";
int debug = 0;
int cidr_use_network = 1;
int default_prefix = 32;
int active_family = 0;
unsigned long ipv6_dropped_in_ipv4_mode = 0;

int main(void)
{
Expand Down
2 changes: 2 additions & 0 deletions tests.unit/copy_overflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

int cidr_use_network = 1;
int default_prefix = 32;
int active_family = 0;
unsigned long ipv6_dropped_in_ipv4_mode = 0;
char *PROG = "copy_overflow";
int debug = 0;

Expand Down
2 changes: 2 additions & 0 deletions tests.unit/empty_ipset_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ char *PROG = "unit-empty-ipset";
int debug;
int cidr_use_network = 1;
int default_prefix = 32;
int active_family = 0;
unsigned long ipv6_dropped_in_ipv4_mode = 0;

static ipset *make_single_ipset(const char *name, in_addr_t ip) {
ipset *ips = ipset_create(name, 1);
Expand Down
2 changes: 2 additions & 0 deletions tests.unit/free_all_linked_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ char *PROG = "unit-free-all";
int debug;
int cidr_use_network = 1;
int default_prefix = 32;
int active_family = 0;
unsigned long ipv6_dropped_in_ipv4_mode = 0;

int main(void) {
ipset *a = ipset_create("a", 0);
Expand Down
2 changes: 2 additions & 0 deletions tests.unit/merge_overflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ char *PROG = "merge_overflow";
int debug = 0;
int cidr_use_network = 1;
int default_prefix = 32;
int active_family = 0;
unsigned long ipv6_dropped_in_ipv4_mode = 0;

int main(void)
{
Expand Down
2 changes: 2 additions & 0 deletions tests.unit/optimize_empty_lsan.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ char *PROG = "unit-optimize-empty";
int debug;
int cidr_use_network = 1;
int default_prefix = 32;
int active_family = 0;
unsigned long ipv6_dropped_in_ipv4_mode = 0;

int main(void) {
ipset *ips = ipset_create("empty", 0);
Expand Down
Loading