-
Notifications
You must be signed in to change notification settings - Fork 17
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
Support ICMP Time Exceeded Message #issues57 #274
base: main
Are you sure you want to change the base?
Conversation
autotest/units/001_one_port/081_time_exceeded_in_transit/gen.py
Outdated
Show resolved
Hide resolved
...s/001_one_port/081_time_exceeded_in_transit/controlplane_full_config_hidden_ip_disabled.conf
Outdated
Show resolved
Hide resolved
e3986bf
to
572877c
Compare
|
else if (type == common::idp::updateGlobalBase::requestType::update_host_config) | ||
{ | ||
result = update_host_config(std::get<common::idp::updateGlobalBase::update_host_config::request>(data)); | ||
} |
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.
This commit is about supporting some kind of ICMP response message.
Could you clarify these changes please?
I'm not following why we have this "update_host_config" sub-theme going on.
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.
The icmp response should contain the IP of the current local device. It was decided that the IP of the local device will be obtained from the configuration.
A new section was introduced in the config (), which is passed to Dataplane
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.
Then it should be done in a separate commit, otherwise it's hard to grasp the intentions, especially from the commit title.
I suggest to split the first commit into two -- one that will add that update mechanism with commit description equal to what you told me here, and the other that will actually do ICMP-related things
Also we shouldn't have commits like "fix comments" etc. |
572877c
to
8c028c0
Compare
ee2c91c
to
fb65b5f
Compare
fb65b5f
to
d04e3dc
Compare
uint8_t zero_buf[16]{}; | ||
return !memcmp(bytes, zero_buf, std::size(bytes)); |
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.
Still, we don't need to create temporary object/array for comparison. std::all_of
is perfectly fine:
[[nodiscard]] bool is_default() const
{
return std::all_of(address.begin(), address.end(), [](uint8_t byte) {
return byte == 0;
});
}
namespace | ||
{ | ||
const uint8_t TTL = 128; | ||
} |
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.
We don't need an anonymous namespace since we're using that only in this cpp file.
I suggest just constexpr uint8_t TTL = 128;
uint32_t create_icmp_package_time_exceeded(rte_mbuf* mbuf_target, const CreateTimeExceededPackagePayload& payload) | ||
{ | ||
if (mbuf_target == nullptr || payload.mbuf_source == nullptr) | ||
{ | ||
return 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.
return false
when the function returns uint32_t
?
uint8_t addr[16]; | ||
rte_memcpy(addr, ip_header->dst_addr, 16); | ||
rte_memcpy(ip_header->dst_addr, ip_header->src_addr, 16); | ||
rte_memcpy(ip_header->src_addr, addr, 16); |
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 believe we can use RTE_SWAP
for this
// copy network header and next 64bits of source package (RFC 792) | ||
rte_ipv4_hdr* ip_header = rte_pktmbuf_mtod_offset(mbuf_target, rte_ipv4_hdr*, metadata->network_headerOffset); | ||
rte_memcpy(rte_pktmbuf_mtod_offset(mbuf_target, char*, metadata->transport_headerOffset + sizeof(rte_icmp_hdr)), | ||
rte_pktmbuf_mtod_offset(payload.mbuf_source, char*, YADECAP_METADATA(payload.mbuf_source)->network_headerOffset), |
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.
why YADECAP_METADATA(payload.mbuf_source)
instead of just metadata
?
rte_ipv6_hdr* ip_header = rte_pktmbuf_mtod_offset(mbuf_target, rte_ipv6_hdr*, metadata->network_headerOffset); | ||
|
||
rte_memcpy(rte_pktmbuf_mtod_offset(mbuf_target, char*, metadata->transport_headerOffset + sizeof(rte_icmp_hdr)), | ||
rte_pktmbuf_mtod_offset(payload.mbuf_source, char*, YADECAP_METADATA(payload.mbuf_source)->network_headerOffset), |
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.
same here
Overall LGTM apart from really tiny issues |
Also do this, please. Not just in pr description, but in an actual commit message too |
No description provided.