Merge Mainline

Signed-off-by: CN_SZTL <cnsztl@project-openwrt.eu.org>
This commit is contained in:
CN_SZTL
2021-01-21 23:13:11 +08:00
27 changed files with 253 additions and 166 deletions

View File

@@ -56,8 +56,8 @@ function act_update_luci()
end
function update_core()
core_cloud_ver=luci.sys.exec("curl -s 'https://github.com/nondanee/UnblockNeteaseMusic/commits/master' |tr -d '\n' |grep -Eo 'commit\/[0-9a-z]+' |sed -n 1p |sed 's#commit/##g'")
core_cloud_ver_mini=luci.sys.exec("curl -s 'https://github.com/nondanee/UnblockNeteaseMusic/commits/master' |tr -d '\n' |grep -Eo 'BtnGroup-item.> [0-9a-z]+' |sed -n 1p |sed 's#BtnGroup-item.> ##g'")
core_cloud_ver=luci.sys.exec("curl -s 'https://github.com/1715173329/UnblockNeteaseMusic/commits/enhanced' |tr -d '\n' |grep -Eo 'commit\/[0-9a-z]+' |sed -n 1p |sed 's#commit/##g'")
core_cloud_ver_mini=luci.sys.exec("curl -s 'https://github.com/1715173329/UnblockNeteaseMusic/commits/enhanced' |tr -d '\n' |grep -Eo 'BtnGroup-item.> [0-9a-z]+' |sed -n 1p |sed 's#BtnGroup-item.> ##g'")
if not core_cloud_ver or not core_cloud_ver_mini then
return "1"
else
@@ -82,4 +82,4 @@ function act_update_core()
luci.http.write_json({
ret = update_core();
})
end
end

View File

@@ -42,6 +42,27 @@ replace_music_source.description = translate("当音乐音质低于指定数值
replace_music_source.default = "dont_replace"
replace_music_source.rmempty = false
use_custom_cookie = s:option(Flag, "use_custom_cookie", translate("使用自定义 Cookie"))
use_custom_cookie.description = translate("使用自定义 Cookie 请求音源接口")
use_custom_cookie.default = 0
use_custom_cookie.rmempty = false
neteasemusic_cookie = s:option(Value, "neteasemusic_cookie", translate("NeteaseMusic Cookie"))
neteasemusic_cookie.description = translate("在 music.163.com 获取需要MUSIC_U值")
neteasemusic_cookie.datatype = "string"
neteasemusic_cookie:depends("use_custom_cookie", 1)
qq_cookie = s:option(Value, "qq_cookie", translate("QQ Cookie"))
qq_cookie.description = translate("在 y.qq.com 获取需要uin和qm_keyst值")
qq_cookie.placeholder = "uin=; qm_keyst="
qq_cookie.datatype = "string"
qq_cookie:depends("use_custom_cookie", 1)
youtube_key = s:option(Value, "youtube_key", translate("Youtube API Key"))
youtube_key.description = translate("API Key申请地址https://developers.google.com/youtube/v3/getting-started#before-you-start")
youtube_key.datatype = "string"
youtube_key:depends("use_custom_cookie", 1)
use_remote_qq_server = s:option(Flag, "use_remote_qq_server", translate("使用云端QQ音源解析"))
use_remote_qq_server.description = translate("通过云端服务器以获取QQ音源信息无需开通QQ绿钻")
use_remote_qq_server.default = 0
@@ -124,27 +145,6 @@ hijack.description = translate("如果使用Hosts劫持程序监听的HTTP/HT
hijack.default = "dont_hijack"
hijack:depends("advanced_mode", 1)
use_custom_cookie = s:option(Flag, "use_custom_cookie", translate("使用自定义 Cookie"))
use_custom_cookie.description = translate("使用自定义 Cookie 请求音源接口")
use_custom_cookie.default = 0
use_custom_cookie:depends("advanced_mode", 1)
neteasemusic_cookie = s:option(Value, "neteasemusic_cookie", translate("NeteaseMusic Cookie"))
neteasemusic_cookie.description = translate("在 music.163.com 获取需要MUSIC_U值")
neteasemusic_cookie.datatype = "string"
neteasemusic_cookie:depends("use_custom_cookie", 1)
qq_cookie = s:option(Value, "qq_cookie", translate("QQ Cookie"))
qq_cookie.description = translate("在 y.qq.com 获取需要uin和qm_keyst值")
qq_cookie.placeholder = "uin=; qm_keyst="
qq_cookie.datatype = "string"
qq_cookie:depends("use_custom_cookie", 1)
youtube_key = s:option(Value, "youtube_key", translate("Youtube API Key"))
youtube_key.description = translate("API Key申请地址https://developers.google.com/youtube/v3/getting-started#before-you-start")
youtube_key.datatype = "string"
youtube_key:depends("use_custom_cookie", 1)
keep_core_when_upgrade = s:option(Flag, "keep_core_when_upgrade", translate("升级时保留核心程序"))
keep_core_when_upgrade.description = translate("默认情况下在OpenWrt升级后会导致核心程序丢失开启此选项后会保留当前下载的核心程序")
keep_core_when_upgrade.default = 0

View File

@@ -4,6 +4,7 @@ config unblockneteasemusic
option music_source 'default'
option enable_flac '0'
option replace_music_source 'dont_replace'
option use_custom_cookie '0'
option use_remote_qq_server '0'
option auto_update '1'
option update_time '3'

View File

@@ -55,7 +55,7 @@ function update_luci(){
}
function check_core_latest_version(){
core_latest_ver="$(curl -s https://github.com/nondanee/UnblockNeteaseMusic/commits/master |tr -d '\n' |grep -Eo 'commit\/[0-9a-z]+' |sed -n 1p |sed 's#commit/##g')"
core_latest_ver="$(curl -s https://github.com/1715173329/UnblockNeteaseMusic/commits/enhanced |tr -d '\n' |grep -Eo 'commit\/[0-9a-z]+' |sed -n 1p |sed 's#commit/##g')"
[ -z "${core_latest_ver}" ] && { echo -e "\nFailed to check latest core version, please try again later." >> "/tmp/$NAME.log"; exit 1; }
if [ ! -e "/usr/share/$NAME/core_local_ver" ]; then
clean_log
@@ -80,10 +80,10 @@ function update_core(){
mkdir -p "/usr/share/$NAME/core" > "/dev/null" 2>&1
rm -rf /usr/share/$NAME/core/* > "/dev/null" 2>&1
curl -sL "https://github.com/nondanee/UnblockNeteaseMusic/archive/master.tar.gz" -o "/usr/share/$NAME/core/core.tar.gz" > "/dev/null" 2>&1
curl -sL "https://github.com/1715173329/UnblockNeteaseMusic/archive/enhanced.tar.gz" -o "/usr/share/$NAME/core/core.tar.gz" > "/dev/null" 2>&1
tar -zxf "/usr/share/$NAME/core/core.tar.gz" -C "/usr/share/$NAME/core/" > "/dev/null" 2>&1
mv /usr/share/$NAME/core/UnblockNeteaseMusic-master/* "/usr/share/$NAME/core/"
rm -rf "/usr/share/$NAME/core/core.tar.gz" "/usr/share/$NAME/core/UnblockNeteaseMusic-master" > "/dev/null" 2>&1
mv /usr/share/$NAME/core/UnblockNeteaseMusic-enhanced/* "/usr/share/$NAME/core/"
rm -rf "/usr/share/$NAME/core/core.tar.gz" "/usr/share/$NAME/core/UnblockNeteaseMusic-enhanced" > "/dev/null" 2>&1
if [ ! -e "/usr/share/$NAME/core/app.js" ]; then
echo -e "Failed to download core." >> "/tmp/$NAME.log"

View File

@@ -7,12 +7,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=naiveproxy
PKG_VERSION:=87.0.4280.66-1
PKG_VERSION:=88.0.4324.96-1
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/klzgrad/naiveproxy/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=17e79172fa32cb3b619614af989569aec7e866046f17e4a1b2179940f1915290
PKG_HASH:=287c5291d0371a0d1e06f08fcb29c1d80da4a07e557fb8d2bf770b357a8eb29a
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_LICENSE:=BSD 3-Clause
@@ -62,42 +62,42 @@ ifneq ($(CONFIG_CCACHE),)
export naive_ccache_flags=cc_wrapper="ccache"
endif
AFDO_VER:=87.0.4278.0_rc-r1-merged
AFDO_VER:=88.0.4324.91_rc-r1-merged
AFDO_FILE:=chromeos-chrome-amd64-$$(AFDO_VER).afdo.bz2
define Download/AFDO_PROF
URL:=https://storage.googleapis.com.cnpmjs.org/chromeos-prebuilt/afdo-job/llvm \
https://storage.googleapis.com/chromeos-prebuilt/afdo-job/llvm
URL_FILE:=$(AFDO_FILE)
FILE:=$(AFDO_FILE)
HASH:=7625590b588195918b30c63db20e06339132bbe8975f39e2e429b929682ee3ff
HASH:=d918ae36f535ffd7a3c36c7d06a0a58a3d93f03d07a670cee0f7cb4538925b34
endef
CLANG_VER:=llvmorg-12-init-5035-gd0abc757-3
CLANG_VER:=llvmorg-12-init-11462-g418f18c6-1
CLANG_FILE:=clang-$$(CLANG_VER).tgz
define Download/CLANG
URL:=https://commondatastorage.googleapis.com/chromium-browser-clang/Linux_x64
URL_FILE:=$(CLANG_FILE)
FILE:=$(CLANG_FILE)
HASH:=b0c3015209b6d624844ad230064eb5c9b4429a2eafd4854981e73217c563d93d
HASH:=59e4682179bbda9b1cf7fcc5c6e3e24445d6e9e8411bd1c893882f63c6b65308
endef
GN_VER:=e002e68a48d1c82648eadde2f6aafa20d08c36f2
GN_VER:=53d92014bf94c3893886470a1c7c1289f8818db0
GN_FILE:=gn-git_revision-$(GN_VER).zip
define Download/GN_TOOL
URL:=https://chrome-infra-packages.appspot.com/dl/gn/gn/linux-amd64/+
URL_FILE:=git_revision:$(GN_VER)
FILE:=$(GN_FILE)
HASH:=67a733dc12803f61a0565ba3a390fa08576b2c4dc1d615c5c15c2b681e900675
HASH:=e39d3da74cb2802614c0edc4877483ff50045abedb98adb40eaadb68ab4066ff
endef
PGO_VER:=4280-1605284980-f890b7d0344c87909c28619fe56e1dd48953d29e
PGO_VER:=4324-1610733451-8576f5ff23113bddfb13d417df9ef2a9be1f740d
PGO_FILE:=chrome-linux-$(PGO_VER).profdata
define Download/PGO_PROF
URL:=https://storage.googleapis.com.cnpmjs.org/chromium-optimization-profiles/pgo_profiles \
https://storage.googleapis.com/chromium-optimization-profiles/pgo_profiles
URL_FILE:=$(PGO_FILE)
FILE:=$(PGO_FILE)
HASH:=8d87e67b84b2694776c931d8eabf0760144420718fe6a5352951fae38a3a25f6
HASH:=82e03005e7fb7810a2db7eb9a07bde4c19742ac0b4709ef9e734678d155c04fc
endef
define Build/Prepare

View File

@@ -17,7 +17,7 @@ So, let's drop it in global build file.
--- a/src/BUILD.gn
+++ b/src/BUILD.gn
@@ -754,7 +754,6 @@ group("gn_all") {
@@ -758,7 +758,6 @@ group("gn_all") {
if (enable_nacl) {
deps += [ "//native_client/src/trusted/platform_qualify:vcpuid" ]
}

View File

@@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=kcptun
PKG_VERSION:=20201126
PKG_VERSION:=20210103
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/xtaci/kcptun/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=cb4cc62fe6a9f3452f20ada676996b48039f091bdae25943955ac9e2299a9c09
PKG_HASH:=0821b61b92041b764a1d621f750c1c693d913eed43051d3c109bd303d8f02472
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE.md

View File

@@ -291,7 +291,7 @@ function import_ssr_url(btn, urlname, sid) {
document.getElementsByName('cbid.shadowsocksr.' + sid + '.server')[0].value = ssm.add;
document.getElementsByName('cbid.shadowsocksr.' + sid + '.server_port')[0].value = ssm.port;
document.getElementsByName('cbid.shadowsocksr.' + sid + '.alter_id')[0].value = ssm.aid;
document.getElementsByName('cbid.shadowsocksr.' + sid + '.uuid')[0].value = ssm.id;
document.getElementsByName('cbid.shadowsocksr.' + sid + '.vmess_id')[0].value = ssm.id;
document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].value = ssm.net;
document.getElementsByName('cbid.shadowsocksr.' + sid + '.transport')[0].dispatchEvent(event);
if (ssm.net == "tcp") {

View File

@@ -232,6 +232,7 @@ gen_service_file() {
cat <<-EOF >$2
{
"server": "0.0.0.0",
"server_ipv6": "::",
"server_port": $(uci_get_by_name $1 server_port),
"password": "$(uci_get_by_name $1 password)",
"timeout": $(uci_get_by_name $1 timeout 60),
@@ -616,7 +617,7 @@ load_config() {
if [ "$SHUNT_SERVER" == "$GLOBAL_SERVER" ]; then
shunt="1"
else
shunt="$tmp_shunt_dns_port"
shunt="$tmp_shunt_port"
shunt_config_file=$TMP_PATH/shunt-ssr-retcp.json
shunt_dns_config_file=$TMP_PATH/shunt-dns-ssr-plus.json
start_shunt

View File

@@ -12,6 +12,7 @@ local n={
"rc4",
"rc4-md5",
"rc4-md5-6",
"chacha20",
}
local s={
"origin",

View File

@@ -49,9 +49,10 @@ gen_config_file() {
cat <<-EOF >$CONFIG_FILE
{
"server": "0.0.0.0",
"server_ipv6": "::",
"server_port": $(uci_get_by_type server server_port),
"local_address":"127.0.0.1",
"local_port":1086,
"local_address":"127.0.0.1",
"local_port":1086,
"password": "$(uci_get_by_type server password)",
"timeout": $(uci_get_by_type server timeout 60),
"method": "$(uci_get_by_type server encrypt_method)",

View File

@@ -0,0 +1,17 @@
# Copyright (C) 2020 Openwrt.org
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for UUgamebooster
LUCI_DEPENDS:=+uugamebooster
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-uugamebooster
PKG_VERSION:=1.0
PKG_RELEASE:=5
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@@ -0,0 +1,15 @@
module("luci.controller.uugamebooster",package.seeall)
function index()
if not nixio.fs.access("/etc/config/uugamebooster") then return end
entry({"admin", "services", "uugamebooster"}, cbi("uugamebooster/uugamebooster"), ("UU Game Booster"),99).dependent=true
entry({"admin","services","uugamebooster","status"},call("act_status")).leaf=true
end
function act_status()
local e={}
e.running=luci.sys.call("pgrep -f uugamebooster >/dev/null")==0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end

View File

@@ -0,0 +1,24 @@
require("luci.util")
mp = Map("uugamebooster", translate("UU Game Booster"))
mp.description = translate("A Paid Game Acceleration service")
mp:section(SimpleSection).template = "uugamebooster/uugamebooster_status"
s = mp:section(TypedSection, "uugamebooster")
s.anonymous=true
s.addremove=false
o = s:option(Flag, "enabled", translate("Enable"))
o.default = 0
o.optional = false
function o.write(self, section, value)
if value == "1" then
luci.sys.call("/etc/init.d/uugamebooster start >/dev/null && /etc/init.d/uugamebooster enable >/dev/null")
else
luci.sys.call("/etc/init.d/uugamebooster stop >/dev/null && /etc/init.d/uugamebooster disable >/dev/null")
end
return Flag.write(self, section, value)
end
return mp

View File

@@ -0,0 +1,21 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[uugamebooster]], [[status]])%>', null,
function(x, data) {
var tb = document.getElementById('uugamebooster_status');
if (data && tb) {
if (data.running) {
tb.innerHTML = '<em><b><font color=green>UU Game Booster <%:RUNNING%></font></b></em>';
} else {
tb.innerHTML = '<em><b><font color=red>UU Game Booster <%:NOT RUNNING%></font></b></em>';
}
}
}
);
//]]>
</script>
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<p id="uugamebooster_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@@ -0,0 +1,9 @@
msgid "Enable"
msgstr "启用"
msgid "UU Game Booster"
msgstr "网易UU网游加速器"
msgid "A Paid Game Acceleration service"
msgstr "一个富家子弟用的游戏加速器"

View File

@@ -0,0 +1,4 @@
config uugamebooster 'uugamebooster'
option enabled '0'

View File

@@ -0,0 +1,11 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@uugamebooster[-1]
add ucitrack uugamebooster
set ucitrack.@uugamebooster[-1].init=uugamebooster
commit ucitrack
EOF
rm -f /tmp/luci-indexcache
exit 0

View File

@@ -13,7 +13,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=uugamebooster
PKG_VERSION:=v2.7.2
PKG_RELEASE:=2
PKG_RELEASE:=6
include $(INCLUDE_DIR)/package.mk

View File

@@ -8,20 +8,21 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=libusb
PKG_VERSION:=1.0.22
PKG_RELEASE:=2
PKG_VERSION:=1.0.24
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=\
https://github.com/libusb/libusb/releases/download/v$(PKG_VERSION) \
@SF/$(PKG_NAME)
PKG_HASH:=75aeb9d59a4fdb800d329a545c2e6799f732362193b465ea198f2aa275518157
PKG_HASH:=7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a
PKG_MAINTAINER:= Felix Fietkau <nbd@nbd.name>
PKG_LICENSE:=LGPL-2.1-or-later
PKG_LICENSE_FILES:=COPYING
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=0
PKG_LICENSE:=LGPL-2.1
PKG_MAINTAINER := Felix Fietkau <nbd@nbd.name>
PKG_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/package.mk
@@ -45,12 +46,17 @@ CONFIGURE_ARGS += \
--disable-log
define Build/InstallDev
$(CP) $(PKG_INSTALL_DIR)/* $(1)/
$(INSTALL_DIR) $(1)/usr/include/libusb-1.0
$(CP) $(PKG_INSTALL_DIR)/usr/include/libusb-1.0/libusb.h $(1)/usr/include/libusb-1.0/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libusb-1.0.* $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libusb-1.0.pc $(1)/usr/lib/pkgconfig/
endef
define Package/libusb-1.0/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libusb*.so.* $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libusb-1.0.so.* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libusb-1.0))

View File

@@ -8,13 +8,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=mbedtls
PKG_VERSION:=2.16.8
PKG_VERSION:=2.16.9
PKG_RELEASE:=1
PKG_USE_MIPS16:=0
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=fe9e3b15c3375943bdfebbbb20dd6b4f1147b3b5d926248bd835d73247407430
PKG_HASH:=fc17ff7d8c11d08f23ae2800a18269408ad2c24ea6bb8b9363e41a01c2425697
PKG_BUILD_PARALLEL:=1
PKG_LICENSE:=GPL-2.0-or-later

View File

@@ -8,12 +8,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=dnsmasq
PKG_VERSION:=2.82
PKG_RELEASE:=7
PKG_VERSION:=2.83
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
PKG_HASH:=84523646f3116bb5e1151efb66e645030f6e6a8256f29aab444777a343ebc132
PKG_HASH:=ffc1f7e8b05e22d910b9a71d09f1128197292766dc7c54cb7018a1b2c3af4aea
PKG_LICENSE:=GPL-2.0
PKG_LICENSE_FILES:=COPYING

View File

@@ -27,7 +27,7 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
@@ -1112,7 +1112,7 @@ extern struct daemon {
@@ -1125,7 +1125,7 @@ extern struct daemon {
int inotifyfd;
#endif
#if defined(HAVE_LINUX_NETWORK)
@@ -36,7 +36,7 @@ Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
#elif defined(HAVE_BSD_NETWORK)
int dhcp_raw_fd, dhcp_icmp_fd, routefd;
#endif
@@ -1292,9 +1292,6 @@ int read_write(int fd, unsigned char *pa
@@ -1306,9 +1306,6 @@ int read_write(int fd, unsigned char *pa
void close_fds(long max_fd, int spare1, int spare2, int spare3);
int wildcard_match(const char* wildcard, const char* match);
int wildcard_matchn(const char* wildcard, const char* match, int num);

View File

@@ -1,36 +1,25 @@
diff --git a/src/dnsmasq.h b/src/dnsmasq.h
--- a/src/dnsmasq.h 2020-03-16 04:31:43.337573724 +0800
+++ b/src/dnsmasq.h 2020-03-16 04:32:07.138008046 +0800
@@ -1029,7 +1029,7 @@
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
@@ -1042,7 +1042,7 @@ extern struct daemon {
int max_logs; /* queue limit */
int cachesize, ftabsize;
int port, query_port, min_port, max_port;
- unsigned long local_ttl, neg_ttl, max_ttl, min_cache_ttl, max_cache_ttl, auth_ttl, dhcp_ttl, use_dhcp_ttl;
+ unsigned long local_ttl, neg_ttl, max_ttl, min_ttl, min_cache_ttl, max_cache_ttl, auth_ttl, dhcp_ttl, use_dhcp_ttl;
+ unsigned long local_ttl, neg_ttl, min_ttl, max_ttl, min_cache_ttl, max_cache_ttl, auth_ttl, dhcp_ttl, use_dhcp_ttl;
char *dns_client_id;
struct hostsfile *addn_hosts;
struct dhcp_context *dhcp, *dhcp6;
diff --git a/src/option.c b/src/option.c
--- a/src/option.c 2020-03-16 04:33:35.999622026 +0800
+++ b/src/option.c 2020-03-16 04:40:44.839289942 +0800
@@ -105,6 +105,7 @@
#define LOPT_TAG_IF 294
#define LOPT_PROXY 295
#define LOPT_GEN_NAMES 296
+#define LOPT_MINTTL 361
#define LOPT_MAXTTL 297
#define LOPT_NO_REBIND 298
#define LOPT_LOC_REBND 299
@@ -167,7 +168,7 @@
#define LOPT_IGNORE_CLID 358
--- a/src/option.c
+++ b/src/option.c
@@ -168,6 +168,7 @@ struct myoption {
#define LOPT_SINGLE_PORT 359
#define LOPT_SCRIPT_TIME 360
-
+
#define LOPT_PXE_VENDOR 361
+#define LOPT_MINTTL 362
#ifdef HAVE_GETOPT_LONG
static const struct option opts[] =
#else
@@ -284,6 +285,7 @@
@@ -286,6 +287,7 @@ static const struct myoption opts[] =
{ "dhcp-name-match", 1, 0, LOPT_NAME_MATCH },
{ "dhcp-broadcast", 2, 0, LOPT_BROADCAST },
{ "neg-ttl", 1, 0, LOPT_NEGTTL },
@@ -38,7 +27,7 @@ diff --git a/src/option.c b/src/option.c
{ "max-ttl", 1, 0, LOPT_MAXTTL },
{ "min-cache-ttl", 1, 0, LOPT_MINCTTL },
{ "max-cache-ttl", 1, 0, LOPT_MAXCTTL },
@@ -410,6 +412,7 @@
@@ -413,6 +415,7 @@ static struct {
{ 't', ARG_ONE, "<host_name>", gettext_noop("Specify default target in an MX record."), NULL },
{ 'T', ARG_ONE, "<integer>", gettext_noop("Specify time-to-live in seconds for replies from /etc/hosts."), NULL },
{ LOPT_NEGTTL, ARG_ONE, "<integer>", gettext_noop("Specify time-to-live in seconds for negative caching."), NULL },
@@ -46,7 +35,7 @@ diff --git a/src/option.c b/src/option.c
{ LOPT_MAXTTL, ARG_ONE, "<integer>", gettext_noop("Specify time-to-live in seconds for maximum TTL to send to clients."), NULL },
{ LOPT_MAXCTTL, ARG_ONE, "<integer>", gettext_noop("Specify time-to-live ceiling for cache."), NULL },
{ LOPT_MINCTTL, ARG_ONE, "<integer>", gettext_noop("Specify time-to-live floor for cache."), NULL },
@@ -2812,6 +2815,7 @@
@@ -2823,6 +2826,7 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
case 'T': /* --local-ttl */
case LOPT_NEGTTL: /* --neg-ttl */
@@ -54,7 +43,7 @@ diff --git a/src/option.c b/src/option.c
case LOPT_MAXTTL: /* --max-ttl */
case LOPT_MINCTTL: /* --min-cache-ttl */
case LOPT_MAXCTTL: /* --max-cache-ttl */
@@ -2823,6 +2827,8 @@
@@ -2834,6 +2838,8 @@ static int one_opt(int option, char *arg, char *errstr, char *gen_err, int comma
ret_err(gen_err);
else if (option == LOPT_NEGTTL)
daemon->neg_ttl = (unsigned long)ttl;
@@ -63,55 +52,51 @@ diff --git a/src/option.c b/src/option.c
else if (option == LOPT_MAXTTL)
daemon->max_ttl = (unsigned long)ttl;
else if (option == LOPT_MINCTTL)
diff --git a/src/rfc1035.c b/src/rfc1035.c
--- a/src/rfc1035.c 2020-03-08 23:56:19.000000000 +0800
+++ b/src/rfc1035.c 2020-03-16 04:41:50.888215364 +0800
@@ -664,11 +664,20 @@
GETSHORT(aqtype, p1);
--- a/src/rfc1035.c
+++ b/src/rfc1035.c
@@ -606,6 +606,7 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
for (j = 0; j < ntohs(header->ancount); j++)
{
int secflag = 0;
+ unsigned long mttl = 0;
unsigned char *tmp = namep;
/* the loop body overwrites the original name, so get it back here. */
if (!extract_name(header, qlen, &tmp, name, 1, 0) ||
@@ -616,6 +617,14 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
GETSHORT(aqclass, p1);
GETLONG(attl, p1);
+ unsigned long mttl = 0;
if ((daemon->max_ttl != 0) && (attl > daemon->max_ttl) && !is_sign)
+ {
+ mttl = daemon->max_ttl;
+ }
+ if ((daemon->min_ttl != 0) && (attl < daemon->min_ttl) && !is_sign)
+ {
+ mttl = daemon->min_ttl;
+ }
+ if (mttl != 0)
{
- (p1) -= 4;
- PUTLONG(daemon->max_ttl, p1);
- }
+ mttl = daemon->max_ttl;
+ }
+ if ((daemon->min_ttl != 0) && (attl < daemon->min_ttl) && !is_sign)
+ {
+ mttl = daemon->min_ttl;
+ }
+ if (mttl != 0)
+ {
+ (p1) -= 4;
+ PUTLONG(mttl, p1);
+ }
GETSHORT(ardlen, p1);
endrr = p1+ardlen;
@@ -760,11 +769,20 @@
GETSHORT(aqtype, p1);
(p1) -= 4;
PUTLONG(daemon->max_ttl, p1);
@@ -704,6 +713,7 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
for (j = 0; j < ntohs(header->ancount); j++)
{
int secflag = 0;
+ unsigned long mttl = 0;
if (!(res = extract_name(header, qlen, &p1, name, 0, 10)))
return 0; /* bad packet */
@@ -712,6 +722,14 @@ int extract_addresses(struct dns_header *header, size_t qlen, char *name, time_t
GETSHORT(aqclass, p1);
GETLONG(attl, p1);
+ unsigned long mttl = 0;
if ((daemon->max_ttl != 0) && (attl > daemon->max_ttl) && !is_sign)
- {
- (p1) -= 4;
- PUTLONG(daemon->max_ttl, p1);
- }
+ {
+ mttl = daemon->max_ttl;
+ }
+ if ((daemon->min_ttl != 0) && (attl < daemon->min_ttl) && !is_sign)
+ {
+ mttl = daemon->min_ttl;
+ }
+ if (mttl != 0)
+ {
+ (p1) -= 4;
+ PUTLONG(mttl, p1);
+ }
GETSHORT(ardlen, p1);
endrr = p1+ardlen;
+ {
+ mttl = daemon->max_ttl;
+ }
+ if ((daemon->min_ttl != 0) && (attl < daemon->min_ttl) && !is_sign)
+ {
+ mttl = daemon->min_ttl;
+ }
+ if (mttl != 0)
{
(p1) -= 4;
PUTLONG(daemon->max_ttl, p1);

View File

@@ -9,33 +9,27 @@ Subject: [PATCH] add filter-aaaa option
src/rfc1035.c | 9 +++++++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/dnsmasq.h b/src/dnsmasq.h
index 1896a64..e10d6c4 100644
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
@@ -268,7 +268,8 @@
#define OPT_IGNORE_CLID 59
@@ -270,6 +270,7 @@ struct event_desc {
#define OPT_SINGLE_PORT 60
#define OPT_LEASE_RENEW 61
-#define OPT_LAST 62
+#define OPT_FILTER_AAAA 62
+#define OPT_LAST 63
#define OPT_LAST 62
+#define OPT_FILTER_AAAA 63
#define OPTION_BITS (sizeof(unsigned int)*8)
#define OPTION_SIZE ( (OPT_LAST/OPTION_BITS)+((OPT_LAST%OPTION_BITS)!=0) )
diff --git a/src/option.c b/src/option.c
index d8c57d6..1cc65bf 100644
--- a/src/option.c
+++ b/src/option.c
@@ -168,6 +168,7 @@
#define LOPT_IGNORE_CLID 358
#define LOPT_SINGLE_PORT 359
@@ -169,6 +169,7 @@ struct myoption {
#define LOPT_SCRIPT_TIME 360
+#define LOPT_FILTER_AAAA 362
#define LOPT_PXE_VENDOR 361
#define LOPT_MINTTL 362
+#define LOPT_FILTER_AAAA 363
#ifdef HAVE_GETOPT_LONG
static const struct option opts[] =
@@ -341,6 +342,7 @@
@@ -343,6 +344,7 @@ static const struct myoption opts[] =
{ "dumpfile", 1, 0, LOPT_DUMPFILE },
{ "dumpmask", 1, 0, LOPT_DUMPMASK },
{ "dhcp-ignore-clid", 0, 0, LOPT_IGNORE_CLID },
@@ -43,7 +37,7 @@ index d8c57d6..1cc65bf 100644
{ NULL, 0, 0, 0 }
};
@@ -521,6 +523,7 @@
@@ -524,6 +526,7 @@ static struct {
{ LOPT_DUMPFILE, ARG_ONE, "<path>", gettext_noop("Path to debug packet dump file"), NULL },
{ LOPT_DUMPMASK, ARG_ONE, "<hex>", gettext_noop("Mask which packets to dump"), NULL },
{ LOPT_SCRIPT_TIME, OPT_LEASE_RENEW, NULL, gettext_noop("Call dhcp-script when lease expiry changes."), NULL },
@@ -51,24 +45,22 @@ index d8c57d6..1cc65bf 100644
{ 0, 0, NULL, NULL, NULL }
};
diff --git a/src/rfc1035.c b/src/rfc1035.c
index 24d08c1..1594962 100644
--- a/src/rfc1035.c
+++ b/src/rfc1035.c
@@ -1959,6 +1959,15 @@
@@ -1926,6 +1926,16 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
}
}
+ //patch to filter aaaa forwards
+ if (qtype == T_AAAA && option_bool(OPT_FILTER_AAAA) ){
+ //return a null reply
+ ans = 1;
+ if (!dryrun) log_query(F_CONFIG | F_IPV6 | F_NEG, name, &addr, NULL);
+ break;
+ }
+ //end of patch
+ /* patch to filter aaaa forwards */
+ if (qtype == T_AAAA && option_bool(OPT_FILTER_AAAA))
+ {
+ /* return a null reply */
+ ans = 1;
+ if (!dryrun)
+ log_query(F_CONFIG | F_IPV6 | F_NEG, name, &addr, NULL);
+ break;
+ }
+
if (!ans)
return 0; /* failed to answer a question */
}
--

View File

@@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=owipcalc
PKG_RELEASE:=4
PKG_RELEASE:=5
PKG_LICENSE:=Apache-2.0
include $(INCLUDE_DIR)/package.mk

View File

@@ -527,18 +527,17 @@ static bool cidr_network6(struct cidr *a)
static bool cidr_contains6(struct cidr *a, struct cidr *b)
{
struct cidr *n = cidr_clone(a);
struct in6_addr *x = &n->addr.v6;
struct in6_addr *x = &a->addr.v6;
struct in6_addr *y = &b->addr.v6;
uint8_t i = (128 - n->prefix) / 8;
uint8_t m = ~((1 << ((128 - n->prefix) % 8)) - 1);
uint8_t i = (128 - a->prefix) / 8;
uint8_t m = ~((1 << ((128 - a->prefix) % 8)) - 1);
uint8_t net1 = x->s6_addr[15-i] & m;
uint8_t net2 = y->s6_addr[15-i] & m;
if (printed)
qprintf(" ");
if ((b->prefix >= n->prefix) && (net1 == net2) &&
if ((b->prefix >= a->prefix) && (net1 == net2) &&
((i == 15) || !memcmp(&x->s6_addr, &y->s6_addr, 15-i)))
{
qprintf("1");