Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: samba not work #173

Merged
merged 3 commits into from
Jul 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion control/kern/tproxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down