Skip to content

Commit fd6567f

Browse files
committed
Fixed tcp outbound tracking session closing and format issues in zfw_xdp_ingress.c
1 parent 6d6f55f commit fd6567f

File tree

5 files changed

+17
-7
lines changed

5 files changed

+17
-7
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format
55
---
66
###
77

8+
# [0.9.18] - 2025-5-28
9+
###
10+
11+
- Fixed issue where outbound tcp passthrough tracking will stop packet ingress forwarding prematurely when
12+
fin received from client and server.
13+
14+
- Fixed format error in zfw_xdp_ingress.c where several statements had double ; termination.
15+
816
# [0.9.17] - 2025-5-1
917

1018
- Refactored GENEVE inbound termination to continue to filter processing as non GENEVE if the GENEVE version and

src/zfw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ char *direction_string;
278278
char *masq_interface;
279279
char check_alt[IF_NAMESIZE];
280280

281-
const char *argp_program_version = "0.9.17";
281+
const char *argp_program_version = "0.9.18";
282282
struct ring_buffer *ring_buffer;
283283

284284
__u32 if_list[MAX_IF_LIST_ENTRIES];

src/zfw_monitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ char check_alt[IF_NAMESIZE];
9393
char doc[] = "zfw_monitor -- ebpf firewall monitor tool";
9494
const char *rb_map_path = "/sys/fs/bpf/tc/globals/rb_map";
9595
const char *tproxy_map_path = "/sys/fs/bpf/tc/globals/zt_tproxy_map";
96-
const char *argp_program_version = "0.9.17";
96+
const char *argp_program_version = "0.9.18";
9797
union bpf_attr rb_map;
9898
int rb_fd = -1;
9999

src/zfw_tc_ingress.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2299,7 +2299,8 @@ int bpf_sk_splice(struct __sk_buff *skb){
22992299
unsigned long long tstamp = bpf_ktime_get_ns();
23002300
struct tcp_state *tstate = get_tcp(tcp_state_key);
23012301
/*check tcp state and timeout if greater than 60 minutes without traffic*/
2302-
if(tstate && (tstamp < (tstate->tstamp + 3600000000000))){
2302+
if(tstate && (tstamp < (tstate->tstamp + 3600000000000)))
2303+
{
23032304
/*Filter modbus responses that do not match outstanding requests*/
23042305
if(local_diag->ot_filtering && (tuple->ipv4.sport == bpf_ntohs(502)) && (tuple->ipv4.dport >= bpf_ntohs(1024)) && payload_len > 0){
23052306
unsigned short *modbus_ti = (unsigned short*)((unsigned long)tcph + (tcph->doff * 4));
@@ -2456,6 +2457,7 @@ int bpf_sk_splice(struct __sk_buff *skb){
24562457
}
24572458
}
24582459
}
2460+
return TC_ACT_OK;
24592461
}
24602462
else if((tstate->est) && (tstate->cfin == 1) && (bpf_htonl(tcph->ack_seq) == (bpf_htonl(tstate->cfseq) + 1))){
24612463
tstate->sfack = 1;

src/zfw_xdp_tun_ingress.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ int xdp_redirect_prog(struct xdp_md *ctx)
200200
}
201201
event.dport = tcph->dest;
202202
event.sport = tcph->source;
203-
tun_state_key.sport = tcph->dest;;
203+
tun_state_key.sport = tcph->dest;
204204
tun_state_key.dport = tcph->source;
205205
}else if (protocol == IPPROTO_UDP){
206206
struct udphdr *udph = (struct udphdr *)((unsigned long)iph + sizeof(*iph));
@@ -209,7 +209,7 @@ int xdp_redirect_prog(struct xdp_md *ctx)
209209
}
210210
event.dport = udph->dest;
211211
event.sport = udph->source;
212-
tun_state_key.sport = udph->dest;;
212+
tun_state_key.sport = udph->dest;
213213
tun_state_key.dport = udph->source;
214214
}
215215
tun_state_key.type = 4;
@@ -256,7 +256,7 @@ int xdp_redirect_prog(struct xdp_md *ctx)
256256
}
257257
event.dport = tcph->dest;
258258
event.sport = tcph->source;
259-
tun_state_key.sport = tcph->dest;;
259+
tun_state_key.sport = tcph->dest;
260260
tun_state_key.dport = tcph->source;
261261
}else if (protocol == IPPROTO_UDP){
262262
struct udphdr *udph = (struct udphdr *)((unsigned long)ip6h + sizeof(*ip6h));
@@ -265,7 +265,7 @@ int xdp_redirect_prog(struct xdp_md *ctx)
265265
}
266266
event.dport = udph->dest;
267267
event.sport = udph->source;
268-
tun_state_key.sport = udph->dest;;
268+
tun_state_key.sport = udph->dest;
269269
tun_state_key.dport = udph->source;
270270
}
271271
struct tun_state *tus = get_tun(tun_state_key);

0 commit comments

Comments
 (0)