update 2024-11-27 16:29:02

This commit is contained in:
kenzok8 2024-11-27 16:29:02 +08:00
parent e7f98ab0e7
commit c6087f0f52
2 changed files with 8 additions and 14 deletions

View File

@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=UA2F PKG_NAME:=UA2F
PKG_VERSION:=4.8.3 PKG_VERSION:=4.9.2
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0-only PKG_LICENSE:=GPL-3.0-only

View File

@ -124,7 +124,7 @@ static void add_to_cache(const struct nf_packet *pkt) {
} }
static struct mark_op get_next_mark(const struct nf_packet *pkt, const bool has_ua) { static struct mark_op get_next_mark(const struct nf_packet *pkt, const bool has_ua) {
if (!use_conntrack) { if (!use_conntrack || !pkt->has_conntrack) {
return (struct mark_op){false, 0}; return (struct mark_op){false, 0};
} }
@ -202,7 +202,7 @@ static bool ipv6_set_transport_header(struct pkt_buff *pkt_buff) {
return true; return true;
} }
static int set_transport_header(struct pkt_buff* pkt_buff, const int ip_type) { static int set_transport_header(struct pkt_buff *pkt_buff, const int ip_type) {
if (ip_type == IPV4) { if (ip_type == IPV4) {
if (ipv4_set_transport_header(pkt_buff)) { if (ipv4_set_transport_header(pkt_buff)) {
count_ipv4_packet(); count_ipv4_packet();
@ -232,19 +232,13 @@ static int set_transport_header(struct pkt_buff* pkt_buff, const int ip_type) {
void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt) { void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt) {
if (use_conntrack) { if (use_conntrack) {
if (!pkt->has_conntrack) { if (!cache_initialized && pkt->has_conntrack) {
use_conntrack = false; init_not_http_cache(60);
syslog(LOG_WARNING, "Packet has no conntrack. Switching to no cache mode."); cache_initialized = true;
syslog(LOG_WARNING, "Note that this may lead to performance degradation. Especially on low-end routers.");
} else {
if (!cache_initialized) {
init_not_http_cache(60);
cache_initialized = true;
}
} }
} }
if (use_conntrack && should_ignore(pkt)) { if (use_conntrack && pkt->has_conntrack && should_ignore(pkt)) {
send_verdict(queue, pkt, (struct mark_op){true, CONNMARK_NOT_HTTP}, NULL); send_verdict(queue, pkt, (struct mark_op){true, CONNMARK_NOT_HTTP}, NULL);
goto end; goto end;
} }
@ -253,7 +247,7 @@ void handle_packet(const struct nf_queue *queue, const struct nf_packet *pkt) {
assert(pkt_buff != NULL); assert(pkt_buff != NULL);
int type; int type;
if (use_conntrack) { if (pkt->has_conntrack) {
type = pkt->orig.ip_version; type = pkt->orig.ip_version;
set_transport_header(pkt_buff, type); set_transport_header(pkt_buff, type);
} else { } else {