Skip to content
Open
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: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ VERSION := 0.4

LIBS := -levent
CFLAGS += -g -O2
override CFLAGS += -std=gnu99 -Wall

all: $(OUT)

Expand Down
6 changes: 4 additions & 2 deletions dnstc.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ static int dnstc_onenter(parser_section *section)
instance->config.bindaddr.sin_family = AF_INET;
instance->config.bindaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);

for (parser_entry *entry = &section->entries[0]; entry->key; entry++)
parser_entry *entry;
for (entry = &section->entries[0]; entry->key; entry++)
entry->addr =
(strcmp(entry->key, "local_ip") == 0) ? (void*)&instance->config.bindaddr.sin_addr :
(strcmp(entry->key, "local_port") == 0) ? (void*)&instance->config.bindaddr.sin_port :
Expand All @@ -136,7 +137,8 @@ static int dnstc_onexit(parser_section *section)
dnstc_instance *instance = section->data;

section->data = NULL;
for (parser_entry *entry = &section->entries[0]; entry->key; entry++)
parser_entry *entry;
for (entry = &section->entries[0]; entry->key; entry++)
entry->addr = NULL;

instance->config.bindaddr.sin_port = htons(instance->config.bindaddr.sin_port);
Expand Down
3 changes: 2 additions & 1 deletion parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,8 @@ int parser_run(parser_context *context)
parser_error(context, "expected token before ``{''"); // } - I love folding
}
else {
for (parser_section *p = context->sections; p; p = p->next) {
parser_section *p;
for (p = context->sections; p; p = p->next) {
if (strcmp(p->name, section_token) == 0) {
section = p;
break;
Expand Down
6 changes: 4 additions & 2 deletions redsocks.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ static int redsocks_onenter(parser_section *section)
instance->config.min_backoff_ms = 100;
instance->config.max_backoff_ms = 60000;

for (parser_entry *entry = &section->entries[0]; entry->key; entry++)
parser_entry *entry;
for (entry = &section->entries[0]; entry->key; entry++)
entry->addr =
(strcmp(entry->key, "local_ip") == 0) ? (void*)&instance->config.bindaddr.sin_addr :
(strcmp(entry->key, "local_port") == 0) ? (void*)&instance->config.bindaddr.sin_port :
Expand All @@ -152,7 +153,8 @@ static int redsocks_onexit(parser_section *section)
redsocks_instance *instance = section->data;

section->data = NULL;
for (parser_entry *entry = &section->entries[0]; entry->key; entry++)
parser_entry *entry;
for (entry = &section->entries[0]; entry->key; entry++)
entry->addr = NULL;

instance->config.bindaddr.sin_port = htons(instance->config.bindaddr.sin_port);
Expand Down
6 changes: 4 additions & 2 deletions redudp.c
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,8 @@ static int redudp_onenter(parser_section *section)
instance->config.udp_timeout = 30;
instance->config.udp_timeout_stream = 180;

for (parser_entry *entry = &section->entries[0]; entry->key; entry++)
parser_entry *entry;
for (entry = &section->entries[0]; entry->key; entry++)
entry->addr =
(strcmp(entry->key, "local_ip") == 0) ? (void*)&instance->config.bindaddr.sin_addr :
(strcmp(entry->key, "local_port") == 0) ? (void*)&instance->config.bindaddr.sin_port :
Expand All @@ -730,7 +731,8 @@ static int redudp_onexit(parser_section *section)
redudp_instance *instance = section->data;

section->data = NULL;
for (parser_entry *entry = &section->entries[0]; entry->key; entry++)
parser_entry *entry;
for (entry = &section->entries[0]; entry->key; entry++)
entry->addr = NULL;

instance->config.bindaddr.sin_port = htons(instance->config.bindaddr.sin_port);
Expand Down
3 changes: 2 additions & 1 deletion utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ int red_recv_udp_pkt(int fd, char *buf, size_t buflen, struct sockaddr_in *inadd

if (toaddr) {
memset(toaddr, 0, sizeof(*toaddr));
for (struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
struct cmsghdr* cmsg;
for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
if (
cmsg->cmsg_level == SOL_IP &&
cmsg->cmsg_type == IP_ORIGDSTADDR &&
Expand Down