Skip to content

Commit

Permalink
fix: remove all dnsmasq operation
Browse files Browse the repository at this point in the history
Signed-off-by: Dengfeng Liu <[email protected]>
  • Loading branch information
liudf0716 committed Jun 12, 2024
1 parent 0fb4432 commit 871265a
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 50 deletions.
41 changes: 0 additions & 41 deletions src/fw_iptables.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,52 +487,11 @@ iptables_fw_set_user_domains_trusted(void)
void
iptables_fw_clear_ipset_domains_trusted(void)
{
#ifdef AW_FW3
char f_ipset_name[128] = {0};
snprintf(f_ipset_name, 128, "%s/%s", DNSMASQ_CONF_D, CHAIN_IPSET_TDOMAIN);

remove(f_ipset_name);
iptables_flush_ipset(CHAIN_IPSET_TDOMAIN);
#else
#endif
}

void
iptables_fw_set_ipset_domains_trusted(void)
{
#ifdef AW_FW3
const s_config *config;
t_domain_trusted *domain_trusted = NULL;
FILE *fd_ipset = NULL;
char f_ipset_name[128] = {0};
int has_content = 0;

config = config_get_config();

mkdir(DNSMASQ_CONF_D, S_IRWXU|S_IRWXG|S_IRWXO);
snprintf(f_ipset_name, 128, "%s/%s", DNSMASQ_CONF_D, CHAIN_IPSET_TDOMAIN);
fd_ipset = fopen(f_ipset_name, "w");
if(fd_ipset == NULL) {
return;
}

LOCK_DOMAIN();

for (domain_trusted = config->pan_domains_trusted; domain_trusted != NULL; domain_trusted = domain_trusted->next) {
has_content = 1;
fprintf(fd_ipset, "ipset=/.%s/%s\n", domain_trusted->domain, CHAIN_IPSET_TDOMAIN);
}

UNLOCK_DOMAIN();

fclose(fd_ipset);

if(!has_content)
remove(f_ipset_name);

iptables_flush_ipset(CHAIN_IPSET_TDOMAIN);
#else
#endif
}

void
Expand Down
1 change: 0 additions & 1 deletion src/fw_iptables.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#define CHAIN_TO_INTERNET "WiFiDog_$ID$_Internet"
#define CHAIN_INCOMING "WiFiDog_$ID$_Incoming"
#define CHAIN_AUTHSERVERS "WiFiDog_$ID$_AuthServers"
#define DNSMASQ_CONF_D "/tmp/dnsmasq.d"
#define CHAIN_IPSET_TDOMAIN "WiFiDog_IPSET_TDomains"
#define CHAIN_DOMAIN_TRUSTED "WiFiDog_$ID$_TDomains"
#define CHAIN_INNER_DOMAIN_TRUSTED "WiFiDog_$ID$_ITDomains"
Expand Down
1 change: 0 additions & 1 deletion src/ping_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ static void fw_init_delay()
parse_user_trusted_domain_list();

fw_set_pan_domains_trusted();
execute("/etc/init.d/dnsmasq restart", 0);
fw_set_trusted_maclist();
}

Expand Down
1 change: 0 additions & 1 deletion src/wdctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ display_help() {
printf("wdctlx help|?\n");
printf("wdctlx stop\n");
printf("wdctlx reset\n");
printf("wdctlx demo\n");
printf("wdctlx status\n");
}

Expand Down
6 changes: 0 additions & 6 deletions src/wdctl_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@ static void
wdctl_add_trusted_pan_domains(struct bufferevent *fd, const char *arg)
{
add_trusted_pdomains(arg);
char *post_cmd = "CMD[/etc/init.d/dnsmasq restart]";
bufferevent_write(fd, post_cmd, strlen(post_cmd));
}

void
Expand All @@ -303,8 +301,6 @@ static void
wdctl_del_trusted_pan_domains(struct bufferevent *fd, const char *arg)
{
del_trusted_pdomains(arg);
char *post_cmd = "CMD[/etc/init.d/dnsmasq restart]";
bufferevent_write(fd, post_cmd, strlen(post_cmd));
}

void
Expand All @@ -318,8 +314,6 @@ static void
wdctl_clear_trusted_pan_domains(struct bufferevent *fd)
{
clear_trusted_pdomains();
char *post_cmd = "CMD[/etc/init.d/dnsmasq restart]";
bufferevent_write(fd, post_cmd, strlen(post_cmd));
}

char *
Expand Down

0 comments on commit 871265a

Please sign in to comment.