Explorar el Código

mdns: fix mdns issue

Nick Peng hace 1 mes
padre
commit
3c4f280058

+ 1 - 1
package/openwrt/Makefile

@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2018-2023 Nick Peng ([email protected])
+# Copyright (c) 2018-2025 Nick Peng ([email protected])
 # This is free software, licensed under the GNU General Public License v3.
 #
 

+ 2 - 0
package/openwrt/files/etc/init.d/smartdns

@@ -191,6 +191,7 @@ load_server()
 	config_get addition_arg "$section" "addition_arg" ""
 	config_get set_mark "$section" "set_mark" ""
 	config_get_bool use_proxy "$section" "use_proxy" "0"
+	config_get fallback "$section" "fallback" "0"
 
 	[ "$enabled" = "0" ] && return
 
@@ -230,6 +231,7 @@ load_server()
 	[ -z "$spki_pin" ] || ADDITIONAL_ARGS="$ADDITIONAL_ARGS -spki-pin $spki_pin"
 	[ -z "$set_mark" ] || ADDITIONAL_ARGS="$ADDITIONAL_ARGS -set-mark $set_mark"
 	[ "$use_proxy" = "0" ] || ADDITIONAL_ARGS="$ADDITIONAL_ARGS -proxy default-proxy"
+	[ "$fallback" = "1" ] && addition_arg="$addition_arg -fallback"
 
 	if [ -z "$port" ] || [ "$IS_URI" = "1" ]; then
 		DNS_ADDRESS="$ip"

+ 1 - 0
src/dns_conf/dns_conf.c

@@ -419,6 +419,7 @@ static void _dns_conf_auto_set_cache_size(void)
 
 static int _dns_conf_load_post(void)
 {
+	_config_current_group_pop_to_default();
 	_config_setup_smartdns_domain();
 	_dns_conf_speed_check_mode_verify();
 

+ 5 - 0
src/dns_conf/dns_conf_group.c

@@ -288,6 +288,11 @@ int _config_current_group_pop_to(struct dns_conf_group_info *group_info)
 	return 0;
 }
 
+int _config_current_group_pop_to_default(void)
+{
+	return _config_current_group_pop_to(dns_conf_default_group_info);
+}
+
 int _config_current_group_pop_all(void)
 {
 	while (dns_conf_current_group_info != NULL && dns_conf_current_group_info != dns_conf_default_group_info) {

+ 1 - 0
src/dns_conf/dns_conf_group.h

@@ -56,6 +56,7 @@ void _config_set_current_group(struct dns_conf_group_info *group_info);
 void _config_current_group_pop(void);
 int _config_current_group_push(const char *group_name);
 int _config_current_group_push_default(void);
+int _config_current_group_pop_to_default(void);
 int _config_current_group_pop_to(struct dns_conf_group_info *group_info);
 int _config_current_group_pop_all(void);
 

+ 1 - 1
src/include/smartdns/dns_plugin.h

@@ -1,6 +1,6 @@
 /*************************************************************************
  *
- * Copyright (C) 2018-2023 Ruilin Peng (Nick) <[email protected]>.
+ * Copyright (C) 2018-2025 Ruilin Peng (Nick) <[email protected]>.
  *
  * smartdns is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 1 - 1
src/include/smartdns/lib/nftset.h

@@ -1,6 +1,6 @@
 /*************************************************************************
  *
- * Copyright (C) 2018-2022 Ruilin Peng (Nick) <[email protected]>.
+ * Copyright (C) 2018-2025 Ruilin Peng (Nick) <[email protected]>.
  *
  * smartdns is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by

+ 2 - 0
test/cases/test-mdns.cc

@@ -70,6 +70,8 @@ TEST(mDNS, query)
 server 127.0.0.1:61053
 dualstack-ip-selection no
 mdns-lookup yes
+group-begin test
+address -
 )""");
 	smartdns::Client client;