fix: samba not work (#173)

Co-authored-by: dae-bot[bot] <136105375+dae-bot[bot]@users.noreply.github.com>
This commit is contained in:
mzz 2023-07-02 19:29:18 +08:00 committed by GitHub
parent 050f9b8c92
commit dc45339065
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1307,6 +1307,10 @@ int tproxy_lan_ingress(struct __sk_buff *skb) {
sk = bpf_skc_lookup_tcp(skb, &tuple, tuple_size, BPF_F_CURRENT_NETNS, 0);
if (sk) {
if (tuples.dport == bpf_ntohs(445)) {
// samba. It is safe because the smb port cannot be customized.
goto sk_accept;
}
if (sk->state != BPF_TCP_LISTEN) {
is_old_conn = true;
goto assign;
@ -1548,7 +1552,7 @@ int tproxy_wan_egress(struct __sk_buff *skb) {
// interface.
if (tproxy_response && l4proto == IPPROTO_TCP) {
// If it is a TCP first handshake, it is not a tproxy response.
if (tcph.syn && !tcph.syn) {
if (tcph.syn && !tcph.ack) {
tproxy_response = false;
// Abnormal.
return TC_ACT_SHOT;