-
Notifications
You must be signed in to change notification settings - Fork 23
loopback: fix domain detection #354
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
Conversation
📝 WalkthroughWalkthroughRefactors in two IP datapath files. In ip_forward.c, a local Pre-merge checks❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
aharivel
left a comment
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 - this is a good refactoring with safer domain detection
modules/infra/datapath/eth_input.c
Outdated
| if (unlikely(eth_in->domain == ETH_DOMAIN_LOOPBACK)) | ||
| goto next; | ||
|
|
||
| if (unlikely(rte_is_multicast_ether_addr(ð->dst_addr))) { | ||
| if (unlikely(eth_in->iface->type == GR_IFACE_TYPE_LOOPBACK)) { | ||
| eth_in->domain = ETH_DOMAIN_LOOPBACK; | ||
| } else if (unlikely(rte_is_multicast_ether_addr(ð->dst_addr))) { |
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.
I'm not sure that moving the code fixes anything actually ?
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.
According to @zeeke, this is not fixing the original issue which was that packets coming from bgpd in gr-loop0 are dropped:
--------- 12:48:56.581331143 cpu 2 ---------
control_input:
loopback_input:
eth_input: 36:17:d0:da:c7:97 > 36:17:d0:da:c7:97 type=IP(0x0800) iface=gr-loop0
ip_input: 192.168.2.1 > 192.168.2.2 ttl=1 proto=TCP(6)
ip_error_ttl_exceeded:
icmp_output:
ip_output: 192.168.2.1 > 192.168.2.1 ttl=64 proto=ICMP(1)
eth_output: aa:c1:ab:ec:80:1e > aa:c1:ab:ec:80:1e type=IP(0x0800) iface=p1
port_output:
port_tx-p1q1:
I don't understand how this can happen. My suspicion was that eth_in->domain was somehow overwritten. I prefer keeping the writing of domain localized in eth_input, but the real bug is elsewhere.
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.
well: don't fix it if it isn't broken.
+1 on the other commit though.
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.
I really prefer moving the assignment in eth_input even if it isn't broken. Otherwise, you are checking the value of eth_in->domain without any guarantee that it has indeed been initialized by the parent node (could be port_rx). But still, that does not fix the issue that @zeeke reported.
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.
I'd rather fix the eth_domain in the port RX in that case, and ensure all input data are set before entering into eth_input.
If we want to rework that part (which isn't related to the original bug), we should set the vlan demux and set the eth domain before entering into eth_input.
That way, we'd be ready for L2 bridges support, as well as tunneled ethernet (vxlan, or evpn).
|
tested-by: Maxime Leroy |
8648af1 to
ab891df
Compare
|
acked-by: Maxime Leroy |
The gr_mbuf_trace_add() call was only reached for packets that passed the TTL check since packets with TTL <= 1 were enqueued and the loop continued immediately, skipping the trace recording. Refactor the code to use a common code path with a goto label where both TTL exceeded and normally forwarded packets are traced before being enqueued to their respective edges. Signed-off-by: Robin Jarry <[email protected]> Tested-by: Maxime Leroy <[email protected]> Acked-by: Maxime Leroy <[email protected]>
In commit e5570d2 ("policy: add stateful dynamic source nat support"), the assignment ip_output_mbuf_data(mbuf)->nh = nh was moved earlier in the processing path. This assignment overwrites the mbuf metadata that e points to, since eth_input_mbuf_data and ip_output_mbuf_data share the same memory area. As a result, accessing e->domain after this assignment reads garbage data, causing incorrect routing decisions when checking whether a packet should be sent to ip_output directly versus being forwarded. Cache the domain value in a local variable before the mbuf metadata is overwritten to ensure the correct routing decision is made. Fixes: e5570d2 ("policy: add stateful dynamic source nat support") Signed-off-by: Robin Jarry <[email protected]> Tested-by: Maxime Leroy <[email protected]> Acked-by: Maxime Leroy <[email protected]>
ab891df to
912d36e
Compare
Summary by CodeRabbit