diff --git a/luci-app-momo/htdocs/luci-static/resources/tools/momo.js b/luci-app-momo/htdocs/luci-static/resources/tools/momo.js
index b820d5cf..edda6e20 100644
--- a/luci-app-momo/htdocs/luci-static/resources/tools/momo.js
+++ b/luci-app-momo/htdocs/luci-static/resources/tools/momo.js
@@ -103,8 +103,11 @@ return baseclass.extend({
let promise = Promise.resolve();
for(let offset = 0; offset < bytes.length; offset += chunkSize) {
- const chunkBytes = bytes.slice(offset, Math.min(offset + chunkSize, bytes.length));
- const chunk = decoder.decode(chunkBytes);
+ const chunkStart = offset;
+ const chunkEnd = Math.min(offset + chunkSize, bytes.length);
+ const isLastChunk = chunkEnd === bytes.length;
+ const chunkBytes = bytes.slice(chunkStart, chunkEnd);
+ const chunk = decoder.decode(chunkBytes, { stream: !isLastChunk });
const append = offset > 0;
promise = promise.then(() => callFileWrite(path, chunk, append, mode));
}
diff --git a/luci-app-nikki/htdocs/luci-static/resources/tools/nikki.js b/luci-app-nikki/htdocs/luci-static/resources/tools/nikki.js
index f5da382f..e8dae45e 100644
--- a/luci-app-nikki/htdocs/luci-static/resources/tools/nikki.js
+++ b/luci-app-nikki/htdocs/luci-static/resources/tools/nikki.js
@@ -120,8 +120,11 @@ return baseclass.extend({
let promise = Promise.resolve();
for(let offset = 0; offset < bytes.length; offset += chunkSize) {
- const chunkBytes = bytes.slice(offset, Math.min(offset + chunkSize, bytes.length));
- const chunk = decoder.decode(chunkBytes);
+ const chunkStart = offset;
+ const chunkEnd = Math.min(offset + chunkSize, bytes.length);
+ const isLastChunk = chunkEnd === bytes.length;
+ const chunkBytes = bytes.slice(chunkStart, chunkEnd);
+ const chunk = decoder.decode(chunkBytes, { stream: !isLastChunk });
const append = offset > 0;
promise = promise.then(() => callFileWrite(path, chunk, append, mode));
}
diff --git a/luci-app-syncthing/Makefile b/luci-app-syncthing/Makefile
deleted file mode 100644
index 2219fcb2..00000000
--- a/luci-app-syncthing/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (C) 2020 Gyj1109
-# 适配 OpenWrt 25.12 修改版
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=luci-app-syncthing
-PKG_VERSION:=1.0
-PKG_RELEASE:=3
-
-LUCI_TITLE:=LuCI support for Syncthing
-LUCI_PKGARCH:=all
-# 适配 25.12:确保安装了 syncthing 后,LuCI 界面能正确拉起
-LUCI_DEPENDS:=+syncthing
-
-include $(TOPDIR)/feeds/luci/luci.mk
-
-# 明确定义配置文件的归属,这对 25.12 的 apk 管理器非常重要
-define Package/$(PKG_NAME)/conffiles
-/etc/config/syncthing
-endef
-
-$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/luci-app-syncthing/README.md b/luci-app-syncthing/README.md
deleted file mode 100644
index b07298c1..00000000
--- a/luci-app-syncthing/README.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# luci-app-syncthing
-在Potat0000源码基础上进行了汉化优化,官方openwrt23.05.3编译后可使用
diff --git a/luci-app-syncthing/luasrc/controller/syncthing.lua b/luci-app-syncthing/luasrc/controller/syncthing.lua
deleted file mode 100644
index ee2ca7ef..00000000
--- a/luci-app-syncthing/luasrc/controller/syncthing.lua
+++ /dev/null
@@ -1,17 +0,0 @@
-module("luci.controller.syncthing", package.seeall)
-
-function index()
- if not nixio.fs.access("/etc/config/syncthing") then
- return
- end
-
- entry({"admin", "services", "syncthing"}, cbi("syncthing"), _("文件同步"), 10).dependent = true
- entry({"admin", "services", "syncthing", "status"}, call("act_status")).leaf = true
-end
-
-function act_status()
- local e = {}
- e.running = luci.sys.call("pgrep syncthing >/dev/null") == 0
- luci.http.prepare_content("application/json")
- luci.http.write_json(e)
-end
diff --git a/luci-app-syncthing/luasrc/model/cbi/syncthing.lua b/luci-app-syncthing/luasrc/model/cbi/syncthing.lua
deleted file mode 100644
index 324ea054..00000000
--- a/luci-app-syncthing/luasrc/model/cbi/syncthing.lua
+++ /dev/null
@@ -1,48 +0,0 @@
-require("nixio.fs")
-
-m = Map("syncthing", translate("Syncthing同步工具"))
-
-m:section(SimpleSection).template = "syncthing/syncthing_status"
-
-s = m:section(TypedSection, "syncthing")
-
-s.anonymous = true
-
-o = s:option(Flag, "enabled", translate("启用"))
-o.default = 0
-o.rmempty = false
-
-gui_address = s:option(Value, "gui_address", translate("GUI访问地址"))
-gui_address.description = translate("使用0.0.0.0以监控所有访问。")
-gui_address.default = "http://0.0.0.0:8384"
-gui_address.placeholder = "http://0.0.0.0:8384"
-gui_address.rmempty = false
-
-home = s:option(Value, "home", translate("配置文件目录"))
-home.description = translate("只有保存在/etc/syncthing中的配置会自动备份!")
-home.default = "/etc/syncthing"
-home.placeholder = "/etc/syncthing"
-home.rmempty = false
-
-user = s:option(ListValue, "user", translate("用户"))
-user.description = translate("默认是syncthing,但这可能会导致权限被拒绝。Syncthing官方不建议以root身份运行。")
-user:value("", translate("syncthing"))
-for u in luci.util.execi("cat /etc/passwd | cut -d ':' -f1") do
- user:value(u)
-end
-
-macprocs = s:option(Value, "macprocs", translate("线程限制"))
-macprocs.description = translate("0表示匹配CPU数量(默认),>0表示显式指定并发数。")
-macprocs.default = "0"
-macprocs.placeholder = "0"
-macprocs.datatype = "range(0,32)"
-macprocs.rmempty = false
-
-nice = s:option(Value, "nice", translate("优先级"))
-nice.description = translate("显式指定优先级值。0是最高,19是最低。(暂时不允许设置负值)")
-nice.default = "19"
-nice.placeholder = "19"
-nice.datatype = "range(0,19)"
-nice.rmempty = false
-
-return m
diff --git a/luci-app-syncthing/luasrc/view/syncthing/syncthing_status.htm b/luci-app-syncthing/luasrc/view/syncthing/syncthing_status.htm
deleted file mode 100644
index 566cc020..00000000
--- a/luci-app-syncthing/luasrc/view/syncthing/syncthing_status.htm
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
diff --git a/luci-app-syncthing/root/etc/uci-defaults/luci-syncthing b/luci-app-syncthing/root/etc/uci-defaults/luci-syncthing
deleted file mode 100644
index 3adb7997..00000000
--- a/luci-app-syncthing/root/etc/uci-defaults/luci-syncthing
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-touch /etc/config/syncthing
-
-uci -q batch <<-EOF >/dev/null
- delete ucitrack.@syncthing[-1]
- add ucitrack syncthing
- set ucitrack.@syncthing[-1].exec='/etc/init.d/syncthing stop && /etc/init.d/syncthing start'
- commit ucitrack
-EOF
-# remove LuCI cache
-rm -f /tmp/luci*
-exit 0
diff --git a/luci-app-syncthing/root/usr/share/rpcd/acl.d/luci-app-syncthing.json b/luci-app-syncthing/root/usr/share/rpcd/acl.d/luci-app-syncthing.json
deleted file mode 100644
index 9fc9cc54..00000000
--- a/luci-app-syncthing/root/usr/share/rpcd/acl.d/luci-app-syncthing.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "luci-app-syncthing": {
- "description": "Grant UCI access for luci-app-syncthing",
- "read": {
- "uci": [ "syncthing" ]
- },
- "write": {
- "uci": [ "syncthing" ]
- }
- }
-}
diff --git a/luci-mod-istorenext/README.md b/luci-mod-istorenext/README.md
new file mode 100644
index 00000000..0da4f072
--- /dev/null
+++ b/luci-mod-istorenext/README.md
@@ -0,0 +1,20 @@
+## 自定义后端与luci共享session
+
+### 主要流程:
+```
+1. nginx转发/cgi-bin/luci/istorenext/开头的请求到自定义后端
+
+2. 如果自定义后端返回403,则下一步。否则直接透传,回到步骤1。
+
+3. nginx渲染登录界面,登录URL参数会加上istorenextlogin=1。用户登录时会用POST请求
+
+4. 当nginx收到POST的请求且istorenextlogin=1就转发给luci
+
+5. luci登录失败的话,会返回403,回到步骤3;luci登录成功的话会原地重定向,URL中还是有istorenextlogin=1,但是变成GET请求,到下一步
+
+6. nginx收到GET请求且istorenextlogin=1就再次重定向到没有istorenextlogin=1的URL,回到步骤1,由于已经登录且cookie共享,自定义后端就不会再返回403,除非session过期了
+
+```
+
+### 示例
+`./root-demo` 文件夹下包含一个自定义后端的 demo。demo判断登录则渲染200页面,没登录就403。
diff --git a/oaf/Makefile b/oaf/Makefile
index 5c2d4ee7..02080f61 100644
--- a/oaf/Makefile
+++ b/oaf/Makefile
@@ -22,15 +22,19 @@ define KernelPackage/oaf/description
open appfilter kernel module
endef
-
-EXTRA_CFLAGS:=-Wno-declaration-after-statement -Wno-strict-prototypes -Wno-unused-variable -Wno-implicit-fallthrough -Wno-missing-braces -Wno-parentheses -Wno-format -Wno-missing-prototypes -Wno-missing-declarations
-
-
+KCFLAGS := -Wno-error=missing-prototypes \
+ -Wno-error=missing-declarations \
+ -Wno-error=unused-variable \
+ -Wno-error=declaration-after-statement \
+ -Wno-error=implicit-fallthrough \
+ -Wno-error=missing-braces \
+ -Wno-error=parentheses \
+ -Wno-error=format
MAKE_OPTS:= \
$(KERNEL_MAKE_FLAGS) \
M="$(PKG_BUILD_DIR)" \
- EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
+ KCFLAGS="$(KCFLAGS)" \
$(EXTRA_KCONFIG)
define Build/Compile
diff --git a/oaf/src/af_client.c b/oaf/src/af_client.c
index 0102a268..2b772656 100644
--- a/oaf/src/af_client.c
+++ b/oaf/src/af_client.c
@@ -34,9 +34,6 @@ DEFINE_RWLOCK(af_client_lock);
u32 total_client = 0;
struct list_head af_client_list_table[MAX_AF_CLIENT_HASH_SIZE];
-int af_send_msg_to_user(char *pbuf, uint16_t len);
-extern char *ipv6_to_str(const struct in6_addr *addr, char *str);
-
static void init_client_timer(af_client_info_t *client);
static void stop_client_timer(af_client_info_t *client);
@@ -94,7 +91,7 @@ void af_client_list_reset_report_num(void)
AF_CLIENT_UNLOCK_W();
}
-int get_mac_hash_code(unsigned char *mac)
+static int get_mac_hash_code(unsigned char *mac)
{
if (!mac)
return 0;
@@ -222,7 +219,7 @@ void check_client_expire(void)
}
#define MAX_EXPIRED_VISIT_INFO_COUNT 10
-void flush_expired_visit_info(af_client_info_t *node)
+static void flush_expired_visit_info(af_client_info_t *node)
{
int i;
int count = 0;
@@ -259,7 +256,7 @@ void flush_expired_visit_info(af_client_info_t *node)
}
}
-int __af_visit_info_report(af_client_info_t *node)
+static int __af_visit_info_report(af_client_info_t *node)
{
unsigned char mac_str[32] = {0};
unsigned char ip_str[32] = {0};
@@ -270,6 +267,8 @@ int __af_visit_info_report(af_client_info_t *node)
cJSON *visit_info_array = NULL;
cJSON *root_obj = NULL;
+ flush_expired_visit_info(node);
+
root_obj = cJSON_CreateObject();
if (!root_obj)
{
@@ -331,7 +330,7 @@ static inline int get_packet_dir(struct net_device *in)
-void af_update_client_status(af_client_info_t *node)
+static void af_update_client_status(af_client_info_t *node)
{
if (node->last_flow.down_bytes > 0){
node->period_flow.down_bytes += (node->flow.down_bytes - node->last_flow.down_bytes);
@@ -471,8 +470,6 @@ static u_int32_t af_client_hook2(unsigned int hook,
int (*okfn)(struct sk_buff *))
{
#endif
- struct ethhdr *ethhdr = NULL;
- unsigned char smac[ETH_ALEN];
af_client_info_t *nfc = NULL;
int pkt_dir = 0;
struct iphdr *iph = NULL;
diff --git a/oaf/src/af_client_fs.c b/oaf/src/af_client_fs.c
index fcf22c4e..7a8e8548 100644
--- a/oaf/src/af_client_fs.c
+++ b/oaf/src/af_client_fs.c
@@ -20,12 +20,11 @@
#include
#include "af_utils.h"
-#include "cJSON.h"
-#include "af_log.h"
-#include "af_client.h"
-extern char *ipv6_to_str(const struct in6_addr *addr, char *str);
-
-extern struct list_head af_client_list_table[MAX_AF_CLIENT_HASH_SIZE];
+#include "cJSON.h"
+#include "af_log.h"
+#include "af_client.h"
+#include "af_client_fs.h"
+extern struct list_head af_client_list_table[MAX_AF_CLIENT_HASH_SIZE];
struct af_client_iter_state
{
unsigned int bucket;
@@ -183,13 +182,11 @@ static const struct proc_ops af_client_fops = {
-static int af_visiting_seq_show(struct seq_file *s, void *v)
-{
- unsigned char mac_str[32] = {0};
- unsigned char ip_str[32] = {0};
- static int index = 0;
- int i;
- af_client_info_t *node = (af_client_info_t *)v;
+static int af_visiting_seq_show(struct seq_file *s, void *v)
+{
+ unsigned char mac_str[32] = {0};
+ static int index = 0;
+ af_client_info_t *node = (af_client_info_t *)v;
if (v == SEQ_START_TOKEN)
{
index = 0;
diff --git a/oaf/src/af_config.c b/oaf/src/af_config.c
index 2add00c4..a4f796b3 100644
--- a/oaf/src/af_config.c
+++ b/oaf/src/af_config.c
@@ -75,7 +75,7 @@ clean
"op":3,
}
*/
-int af_config_handle(char *config, unsigned int len)
+static int af_config_handle(char *config, unsigned int len)
{
cJSON *config_obj = NULL;
cJSON *cmd_obj = NULL;
diff --git a/oaf/src/af_conntrack.c b/oaf/src/af_conntrack.c
index 44bf045d..710381d2 100644
--- a/oaf/src/af_conntrack.c
+++ b/oaf/src/af_conntrack.c
@@ -264,7 +264,7 @@ static const struct proc_ops af_conn_fops = {
#define AF_CONN_PROC_STR "af_conn"
-int af_conn_init_procfs(void)
+static int af_conn_init_procfs(void)
{
struct proc_dir_entry *pde;
struct net *net = &init_net;
@@ -278,7 +278,7 @@ int af_conn_init_procfs(void)
return 0;
}
-void af_conn_remove_procfs(void)
+static void af_conn_remove_procfs(void)
{
struct net *net = &init_net;
remove_proc_entry(AF_CONN_PROC_STR, net->proc_net);
diff --git a/oaf/src/af_log.c b/oaf/src/af_log.c
index c6b28c30..187e3a82 100644
--- a/oaf/src/af_log.c
+++ b/oaf/src/af_log.c
@@ -138,16 +138,16 @@ static struct ctl_table oaf_table[] = {
};
#define OAF_SYS_PROC_DIR "oaf"
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0))
static struct ctl_table oaf_root_table[] = {
{
.procname = OAF_SYS_PROC_DIR,
.mode = 0555,
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0))
.child = oaf_table,
-#endif
},
{}
};
+#endif
static struct ctl_table_header *oaf_table_header;
diff --git a/oaf/src/af_rule_config.c b/oaf/src/af_rule_config.c
index 6f3b7b1c..7a266f5b 100644
--- a/oaf/src/af_rule_config.c
+++ b/oaf/src/af_rule_config.c
@@ -6,6 +6,8 @@
#include "app_filter.h"
#include "af_utils.h"
#include "af_log.h"
+#include "af_config.h"
+#include "af_rule_config.h"
#define AF_MAX_APP_TYPE_NUM 32
#define AF_MAX_APP_NUM 512
@@ -21,26 +23,8 @@ extern u_int32_t g_update_jiffies;
char g_app_id_array[AF_MAX_APP_TYPE_NUM][AF_MAX_APP_NUM] = {0};
-void af_show_app_status(void)
-{
- int i, j;
- for (i = 0; i < AF_MAX_APP_TYPE_NUM; i++)
- {
- for (j = 0; j < AF_MAX_APP_NUM; j++)
- {
- af_rule_read_lock();
- if (g_app_id_array[i][j] == AF_TRUE)
- {
- AF_DEBUG("%d, %d\n", i, j);
- }
- af_rule_read_unlock();
- }
- }
- AF_DEBUG("\n\n\n");
-}
-
-int af_change_app_status(cJSON *data_obj, int status)
+static int af_change_app_status(cJSON *data_obj, int status)
{
int i;
int id;
@@ -113,4 +97,4 @@ int af_config_clean_appid(cJSON *data)
{
af_init_app_status();
return 0;
-}
\ No newline at end of file
+}
diff --git a/oaf/src/af_user_config.c b/oaf/src/af_user_config.c
index a48252b8..3aea0e7c 100644
--- a/oaf/src/af_user_config.c
+++ b/oaf/src/af_user_config.c
@@ -7,6 +7,7 @@
#include "af_utils.h"
#include "af_log.h"
#include "cJSON.h"
+#include "af_config.h"
#include "af_whitelist_config.h"
#include "af_user_config.h"
@@ -89,7 +90,7 @@ af_mac_node_t *af_mac_add(unsigned char *mac)
return node;
}
-int is_user_match_enable(void)
+static __maybe_unused int is_user_match_enable(void)
{
return total_mac > 0;
}
diff --git a/oaf/src/af_utils.c b/oaf/src/af_utils.c
index a79f611a..dcd355a1 100644
--- a/oaf/src/af_utils.c
+++ b/oaf/src/af_utils.c
@@ -83,7 +83,7 @@ void dump_str(char *name, unsigned char *p, int len)
strncpy(buf, p, len);
printk("[%s]\n", buf);
}
-int isprint_char(unsigned char c)
+static int isprint_char(unsigned char c)
{
if (c >= 0x20 && c <= 0x7e)
return 1;
@@ -279,12 +279,14 @@ static int k_vsscanf(const char *buf, const char *fmt, va_list args)
case 'X':
base = 16;
break;
- case 'i':
- base = 0;
- case 'd':
- is_sign = 1;
- case 'u':
- break;
+ case 'i':
+ base = 0;
+ fallthrough;
+ case 'd':
+ is_sign = 1;
+ fallthrough;
+ case 'u':
+ break;
case '%':
if (*str++ != '%')
return num;
@@ -399,4 +401,4 @@ int mac_to_hex(u8 *mac, u8 *mac_hex)
mac_hex[i] = mac_tmp[i];
}
return 0;
-}
\ No newline at end of file
+}
diff --git a/oaf/src/app_filter.c b/oaf/src/app_filter.c
index dd957efc..848bf696 100644
--- a/oaf/src/app_filter.c
+++ b/oaf/src/app_filter.c
@@ -80,8 +80,8 @@ int hash_mac(unsigned char *mac)
return ((mac[0] ^ mac[1]) + (mac[2] ^ mac[3]) + (mac[4] ^ mac[5])) % MAX_AF_MAC_HASH_SIZE;
}
-int __add_app_feature(char *feature, int appid, char *name, int proto, int src_port,
- port_info_t dport_info, char *host_url, char *request_url, char *dict, char *search_str, int ignore)
+static int __add_app_feature(char *feature, int appid, char *name, int proto, int src_port,
+ port_info_t dport_info, char *host_url, char *request_url, char *dict, char *search_str, int ignore)
{
af_feature_node_t *node = NULL;
char *p = dict;
@@ -149,7 +149,7 @@ int __add_app_feature(char *feature, int appid, char *name, int proto, int src_p
}
return 0;
}
-int validate_range_value(char *range_str)
+static int validate_range_value(char *range_str)
{
if (!range_str)
return 0;
@@ -170,7 +170,7 @@ int validate_range_value(char *range_str)
return 1;
}
-int parse_range_value(char *range_str, range_value_t *range)
+static int parse_range_value(char *range_str, range_value_t *range)
{
char pure_range[128] = {0};
if (!validate_range_value(range_str))
@@ -207,7 +207,7 @@ int parse_range_value(char *range_str, range_value_t *range)
return 0;
}
-int parse_port_info(char *port_str, port_info_t *info)
+static int parse_port_info(char *port_str, port_info_t *info)
{
char *p = port_str;
char *begin = port_str;
@@ -239,7 +239,7 @@ int parse_port_info(char *port_str, port_info_t *info)
return 0;
}
-int af_match_port(port_info_t *info, int port)
+static int af_match_port(port_info_t *info, int port)
{
int i;
int with_not = 0;
@@ -276,7 +276,7 @@ int af_match_port(port_info_t *info, int port)
return 0;
}
//[tcp;;443;baidu.com;;]
-int add_app_feature(int appid, char *name, char *feature)
+static int add_app_feature(int appid, char *name, char *feature)
{
char proto_str[16] = {0};
char src_port_str[16] = {0};
@@ -287,7 +287,6 @@ int add_app_feature(int appid, char *name, char *feature)
char dict[128] = {0};
int proto = IPPROTO_TCP;
int param_num = 0;
- int dst_port = 0;
int src_port = 0;
char tmp_buf[128] = {0};
int ignore = 0;
@@ -373,7 +372,7 @@ int add_app_feature(int appid, char *name, char *feature)
return 0;
}
-void af_init_feature(char *feature_str)
+static void af_init_feature(char *feature_str)
{
int app_id;
char app_name[128] = {0};
@@ -420,7 +419,7 @@ void af_init_feature(char *feature_str)
if (*p == ',')
{
if (p - begin > MAX_FEATURE_STR_LEN){
- printk("error, feature len error %d\n", p - len);
+ printk("error, feature len error %d\n", (int)(p - begin));
break;
}
memcpy((char *)feature, begin, p - begin);
@@ -433,7 +432,7 @@ void af_init_feature(char *feature_str)
{
if (p - begin > MAX_FEATURE_STR_LEN){
- printk("error, feature len error %d\n", p - len);
+ printk("error, feature len error %d\n", (int)(p - begin));
}
else{
memcpy((char *)feature, begin, p - begin);
@@ -447,7 +446,7 @@ void af_init_feature(char *feature_str)
kfree(feature_buf);
}
-void load_feature_buf_from_file(char **config_buf)
+static void load_feature_buf_from_file(char **config_buf)
{
struct inode *inode = NULL;
struct file *fp = NULL;
@@ -494,7 +493,7 @@ void load_feature_buf_from_file(char **config_buf)
filp_close(fp, NULL);
}
-int load_feature_config(void)
+static __maybe_unused int load_feature_config(void)
{
char *feature_buf = NULL;
char *p;
@@ -553,7 +552,7 @@ static void af_clean_feature_list(void)
feature_list_write_unlock();
}
-void af_add_feature_msg_handle(char *data, int len)
+static void af_add_feature_msg_handle(char *data, int len)
{
char feature[MAX_FEATURE_LINE_LEN] = {0};
if (len <= 0 || len >= MAX_FEATURE_LINE_LEN){
@@ -603,13 +602,12 @@ static unsigned char *read_skb(struct sk_buff *skb, unsigned int from, unsigned
return msg_buf;
}
-int parse_flow_proto(struct sk_buff *skb, flow_info_t *flow)
+static int parse_flow_proto(struct sk_buff *skb, flow_info_t *flow)
{
unsigned char *ipp;
int ipp_len;
struct tcphdr *tcph = NULL;
struct udphdr *udph = NULL;
- struct nf_conn *ct = NULL;
struct iphdr *iph = NULL;
struct ipv6hdr *ip6h = NULL;
if (!skb)
@@ -660,7 +658,7 @@ int parse_flow_proto(struct sk_buff *skb, flow_info_t *flow)
return -1;
}
-int check_domain(char *h, int len)
+static int check_domain(char *h, int len)
{
int i;
for (i = 0; i < len; i++)
@@ -676,7 +674,7 @@ int check_domain(char *h, int len)
return 1;
}
-int dpi_https_proto(flow_info_t *flow)
+static int dpi_https_proto(flow_info_t *flow)
{
int i;
short url_len = 0;
@@ -732,7 +730,7 @@ int dpi_https_proto(flow_info_t *flow)
return -1;
}
-void dpi_http_proto(flow_info_t *flow)
+static void dpi_http_proto(flow_info_t *flow)
{
int i = 0;
int start = 0;
@@ -868,7 +866,7 @@ static void dump_flow_info(flow_info_t *flow)
}
-char *k_memstr(char *data, char *str, int size)
+static char *k_memstr(char *data, char *str, int size)
{
char *p;
char len = strlen(str);
@@ -880,7 +878,7 @@ char *k_memstr(char *data, char *str, int size)
return NULL;
}
-int af_match_by_pos(flow_info_t *flow, af_feature_node_t *node)
+static int af_match_by_pos(flow_info_t *flow, af_feature_node_t *node)
{
int i;
unsigned int pos = 0;
@@ -927,7 +925,7 @@ int af_match_by_pos(flow_info_t *flow, af_feature_node_t *node)
return AF_FALSE;
}
-int af_match_by_url(flow_info_t *flow, af_feature_node_t *node)
+static int af_match_by_url(flow_info_t *flow, af_feature_node_t *node)
{
char reg_url_buf[MAX_URL_MATCH_LEN] = {0};
@@ -973,7 +971,7 @@ int af_match_by_url(flow_info_t *flow, af_feature_node_t *node)
return AF_FALSE;
}
-int af_match_one(flow_info_t *flow, af_feature_node_t *node)
+static int af_match_one(flow_info_t *flow, af_feature_node_t *node)
{
int ret = AF_FALSE;
if (!flow || !node)
@@ -1017,7 +1015,7 @@ int af_match_one(flow_info_t *flow, af_feature_node_t *node)
}
-int af_match_quic(flow_info_t *flow)
+static int af_match_quic(flow_info_t *flow)
{
unsigned char *data;
unsigned char first_byte;
@@ -1055,7 +1053,7 @@ int af_match_quic(flow_info_t *flow)
}
-int match_feature(flow_info_t *flow)
+static int match_feature(flow_info_t *flow)
{
af_feature_node_t *n, *node;
@@ -1080,7 +1078,7 @@ int match_feature(flow_info_t *flow)
}
-int match_app_filter_user(af_client_info_t *client){
+static int match_app_filter_user(af_client_info_t *client){
if (!g_user_mode){ // auto mode
if (af_whitelist_mac_find(client->mac)){
AF_LMT_DEBUG("match whitelist mac = " MAC_FMT "\n", MAC_ARRAY(client->mac));
@@ -1095,7 +1093,7 @@ int match_app_filter_user(af_client_info_t *client){
}
-int match_app_filter_rule(int appid, af_client_info_t *client)
+static int match_app_filter_rule(int appid, af_client_info_t *client)
{
if (!match_app_filter_user(client))
return AF_FALSE;
@@ -1136,7 +1134,7 @@ static int af_get_visit_index(af_client_info_t *node, int app_id)
return 0;
}
-int af_update_client_app_info(af_client_info_t *node, int app_id, int drop)
+static int af_update_client_app_info(af_client_info_t *node, int app_id, int drop)
{
int index = -1;
if (!node)
@@ -1159,7 +1157,7 @@ int af_update_client_app_info(af_client_info_t *node, int app_id, int drop)
}
int af_send_msg_to_user(char *pbuf, uint16_t len);
-int af_match_bcast_packet(flow_info_t *f)
+static __maybe_unused int af_match_bcast_packet(flow_info_t *f)
{
if (!f)
return 0;
@@ -1168,7 +1166,7 @@ int af_match_bcast_packet(flow_info_t *f)
return 0;
}
-int af_match_local_packet(flow_info_t *f)
+static int af_match_local_packet(flow_info_t *f)
{
if (!f)
return 0;
@@ -1179,7 +1177,7 @@ int af_match_local_packet(flow_info_t *f)
return 0;
}
-int update_url_visiting_info(af_client_info_t *client, flow_info_t *flow)
+static int update_url_visiting_info(af_client_info_t *client, flow_info_t *flow)
{
char *host = NULL;
unsigned int len = 0;
@@ -1204,7 +1202,7 @@ int update_url_visiting_info(af_client_info_t *client, flow_info_t *flow)
}
-int dpi_main(struct sk_buff *skb, flow_info_t *flow)
+static int dpi_main(struct sk_buff *skb, flow_info_t *flow)
{
dpi_http_proto(flow);
dpi_https_proto(flow);
@@ -1213,7 +1211,7 @@ int dpi_main(struct sk_buff *skb, flow_info_t *flow)
return 0;
}
-void af_get_smac(struct sk_buff *skb, u_int8_t *smac)
+static void af_get_smac(struct sk_buff *skb, u_int8_t *smac)
{
struct ethhdr *ethhdr = NULL;
ethhdr = eth_hdr(skb);
@@ -1222,16 +1220,16 @@ void af_get_smac(struct sk_buff *skb, u_int8_t *smac)
else
memcpy(smac, &skb->cb[40], ETH_ALEN);
}
-int is_ipv4_broadcast(uint32_t ip)
+static int is_ipv4_broadcast(uint32_t ip)
{
return (ip & 0x00FFFFFF) == 0x00FFFFFF;
}
-int is_ipv4_multicast(uint32_t ip)
+static int is_ipv4_multicast(uint32_t ip)
{
return (ip & 0xF0000000) == 0xE0000000;
}
-int af_check_bcast_ip(flow_info_t *f)
+static int af_check_bcast_ip(flow_info_t *f)
{
if (0 == f->src || 0 == f->dst)
@@ -1252,9 +1250,8 @@ int af_check_bcast_ip(flow_info_t *f)
action: 0: accept, 1: drop
return: 0: no change, 1: change
*/
-u_int32_t check_app_action_changed(int action, u_int32_t app_id, af_client_info_t *client)
+static u_int32_t check_app_action_changed(int action, u_int32_t app_id, af_client_info_t *client)
{
- u_int8_t drop = 0;
int changed = 0;
u_int32_t max_jiffies = 30 * HZ;
u_int32_t interval_jiffies = jiffies - g_update_jiffies;
@@ -1273,7 +1270,7 @@ u_int32_t check_app_action_changed(int action, u_int32_t app_id, af_client_info_
return changed;
}
-u_int32_t app_filter_hook_bypass_handle(struct sk_buff *skb, struct net_device *dev)
+static u_int32_t app_filter_hook_bypass_handle(struct sk_buff *skb, struct net_device *dev)
{
flow_info_t flow;
af_conn_t *conn;
@@ -1446,18 +1443,16 @@ EXIT:
}
-u_int32_t app_filter_hook_gateway_handle(struct sk_buff *skb, struct net_device *dev)
+static u_int32_t app_filter_hook_gateway_handle(struct sk_buff *skb, struct net_device *dev)
{
unsigned long long total_packets = 0;
flow_info_t flow;
- u_int8_t smac[ETH_ALEN];
enum ip_conntrack_info ctinfo;
struct nf_conn *ct = NULL;
struct nf_conn_acct *acct;
af_client_info_t *client = NULL;
u_int32_t ret = NF_ACCEPT;
u_int32_t app_id = 0;
- u_int8_t drop = 0;
u_int8_t malloc_data = 0;
if (!strstr(dev->name, g_lan_ifname))
@@ -1776,7 +1771,7 @@ static void oaf_timer_func(unsigned long ptr)
mod_timer(&oaf_timer, jiffies + OAF_TIMER_INTERVAL * HZ);
}
-void init_oaf_timer(void)
+static void init_oaf_timer(void)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
timer_setup(&oaf_timer, oaf_timer_func, 0);
@@ -1787,7 +1782,7 @@ void init_oaf_timer(void)
AF_INFO("init oaf timer...ok");
}
-void fini_oaf_timer(void)
+static void fini_oaf_timer(void)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 16, 0)
del_timer_sync(&oaf_timer);
@@ -1891,7 +1886,7 @@ static void oaf_msg_rcv(struct sk_buff *skb)
}
}
-int netlink_oaf_init(void)
+static int netlink_oaf_init(void)
{
struct netlink_kernel_cfg nl_cfg = {0};
nl_cfg.input = oaf_msg_rcv;
@@ -1958,4 +1953,3 @@ static void app_filter_fini(void)
module_init(app_filter_init);
module_exit(app_filter_fini);
-
diff --git a/oaf/src/app_filter.h b/oaf/src/app_filter.h
index 9ad88d87..945787fe 100644
--- a/oaf/src/app_filter.h
+++ b/oaf/src/app_filter.h
@@ -172,5 +172,7 @@ typedef struct flow_info{
int regexp_match(char *reg, char *text);
int hash_mac(unsigned char *mac);
+char *ipv6_to_str(const struct in6_addr *addr, char *str);
+int af_send_msg_to_user(char *pbuf, uint16_t len);
#endif
diff --git a/oaf/src/cJSON.c b/oaf/src/cJSON.c
index 7dcb2e52..fe42bc5e 100644
--- a/oaf/src/cJSON.c
+++ b/oaf/src/cJSON.c
@@ -171,7 +171,9 @@ static const char *parse_string(cJSON *item,const char *str)
switch (len) {
case 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
+ fallthrough;
case 2: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
+ fallthrough;
case 1: *--ptr2 =(uc | firstByteMark[len]);
}
ptr2+=len;ptr+=4;
diff --git a/oaf/src/cJSON.h b/oaf/src/cJSON.h
index 97b701c9..b0ead3fb 100644
--- a/oaf/src/cJSON.h
+++ b/oaf/src/cJSON.h
@@ -80,6 +80,7 @@ extern cJSON *cJSON_CreateObject(void);
extern void cJSON_Minify(char *json);
// These utilities create an Array of count items.
extern cJSON *cJSON_CreateIntArray(int *numbers,int count);
+extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
// Append item to the specified array/object.
extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
diff --git a/oaf/src/regexp.c b/oaf/src/regexp.c
index 6d42d531..e31fc3c0 100644
--- a/oaf/src/regexp.c
+++ b/oaf/src/regexp.c
@@ -18,6 +18,8 @@ typedef struct RE{
int match_longest = 0;
char *match_first = NULL;
+int regexp_match(char *reg, char *text);
+
static void * getmem(size_t size)
{
@@ -221,10 +223,9 @@ static int matchques(RE *cur, RE *regexp, char *text)
}
static int (*matchfun[TYPENUM][2])(RE *, RE *, char *) = {
- 0, 0, 0, 0, 0, 0, 0, 0,
- matchstar, matchstar_l,
- matchplus, matchplus_l,
- matchques, matchques,
+ [STAR] = { matchstar, matchstar_l },
+ [PLUS] = { matchplus, matchplus_l },
+ [QUES] = { matchques, matchques },
};
static int matchhere(RE *regexp, char *text)
@@ -261,7 +262,7 @@ int regexp_match(char *reg, char *text)
}
do{
- if(ret = matchhere(regexp, text))
+ if ((ret = matchhere(regexp, text)))
{
goto out;
}
@@ -273,7 +274,7 @@ out:
}
-void TEST_reg_func(char *reg, char * str, int ret)
+static __maybe_unused void TEST_reg_func(char *reg, char * str, int ret)
{
if (ret != regexp_match(reg, str)) {
@@ -293,7 +294,7 @@ void TEST_reg_func(char *reg, char * str, int ret)
}
}
-void TEST_regexp(void)
+static __maybe_unused void TEST_regexp(void)
{
TEST_reg_func(".*baidu.com$", "www.baidu.com", 1);
TEST_reg_func("^sina.com", "www.sina.com.cn", 0);
diff --git a/v2ray-geodata/Makefile b/v2ray-geodata/Makefile
index 788299c0..169f0aaf 100644
--- a/v2ray-geodata/Makefile
+++ b/v2ray-geodata/Makefile
@@ -21,13 +21,13 @@ define Download/geoip
HASH:=b71d1999439dde2de2d2b6844a2befa50c50211ff739785c005ca7c230a17d6a
endef
-GEOSITE_VER:=20260721145917
+GEOSITE_VER:=20260724024523
GEOSITE_FILE:=dlc.dat.$(GEOSITE_VER)
define Download/geosite
URL:=https://github.com/v2fly/domain-list-community/releases/download/$(GEOSITE_VER)/
URL_FILE:=dlc.dat
FILE:=$(GEOSITE_FILE)
- HASH:=0d14a73927ac45e727e382c8b53fcfafe05667a146b14bffa4a4c341b3ca6889
+ HASH:=3c2de6ed0b21dab8883a39a9a54d940ac2fd2e6e0c460dfb6ee6c0075ed81b7f
endef
GEOSITE_IRAN_VER:=202607130116