-
Notifications
You must be signed in to change notification settings - Fork 230
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
feat: udp conntrack for lan interface #699
base: main
Are you sure you want to change the base?
Conversation
e927e7f
to
31dadc7
Compare
Would you like to add some test as part of CI? I'm inclined to cover this in bpf unit test. |
I write some simple python udp server/client for testing the symmetric udp datapath. I don’t know much about the CI for dae or for ebpf part. But I will have a try. |
There is no problem with the code. My unit tests are not working correctly, but I have completed some debugging functions. Since I use ipv6 for testing, my device has multiple addresses, and I have already added the python code for testing in test result section. |
5e79db6
to
e35c1b3
Compare
e35c1b3
to
3f63618
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧪 Since the PR has been fully tested, please consider merging it.
3ce3a85
to
5e049ee
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
整体的改动还是不复杂,好理解,就是 commit 切分实在是很糟糕(对不起)。留了一些想法可以讨论一下。
get_tuples(skb, &tuples, &iph, &ipv6h, &tcph, &udph, l4proto); | ||
copy_reversed_tuples(&tuples.five, &reversed_tuples_key); | ||
|
||
if (!refresh_udp_conn_state_timer(&reversed_tuples_key, true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- if (!refresh_udp_conn_state_timer(&reversed_tuples_key, true))
+ if (!refresh_udp_conn_state_timer(&reversed_tuples_key, false))
按照你的注释:
// For each flow (echo symmetric path), note the original flow direction
original direction 是 egress 所以第二参数应该为 false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
流向wan ingress方向的应该为true,而流向wan ingress方向的流量在dae中是在lan egress中处理的
流量的路径是 lan egress -> route -> wan ingress,lan egress和wan ingress首次出现的流量为true,反之亦然
我这里把lan egress和wan ingress中首次出现的flow称作了inbound_flow,不知道是否有不妥
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我知道你是把首次出现的标记为 true,你都有很明确的语义了,这个命名肯定不妥。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我没细想,也许 AI 有更好的回答,可以用 is original direction 之类的,但是这里存的是 reverse 的 tuple,所以并不是 original direction。。。 叫 require direct?
@@ -1127,6 +1194,15 @@ new_connection:; | |||
params.l4hdr = &tcph; | |||
params.flag[0] = L4ProtoType_TCP; | |||
} else { | |||
struct udp_conn_state *conn_state = | |||
refresh_udp_conn_state_timer(&tuples.five, false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同理,这里就应该是 refresh_udp_conn_state_timer(&tuples.five, true) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同理,这里就应该是 refresh_udp_conn_state_timer(&tuples.five, true) ?
同上
5e049ee
to
6f11f93
Compare
6f11f93
to
7c0817e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
除了变量名其他都 lgtm
get_tuples(skb, &tuples, &iph, &ipv6h, &tcph, &udph, l4proto); | ||
copy_reversed_tuples(&tuples.five, &reversed_tuples_key); | ||
|
||
if (!refresh_udp_conn_state_timer(&reversed_tuples_key, true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我知道你是把首次出现的标记为 true,你都有很明确的语义了,这个命名肯定不妥。
get_tuples(skb, &tuples, &iph, &ipv6h, &tcph, &udph, l4proto); | ||
copy_reversed_tuples(&tuples.five, &reversed_tuples_key); | ||
|
||
if (!refresh_udp_conn_state_timer(&reversed_tuples_key, true)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我没细想,也许 AI 有更好的回答,可以用 is original direction 之类的,但是这里存的是 reverse 的 tuple,所以并不是 original direction。。。 叫 require direct?
Background
Previously, the wan interface had implemented udp conntrack
This PR implemented udp conntrack for lan interface.
Checklist
Full Changelogs
Test Result
You can use those python codes for testing,
Try to initiate a request from wan to lan. You should be able to observe that DAE skips the packet instead of routing it.
You could try to have reply packets routed to a node and observe whether
dae0
has the reply packet.server:
client: