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

issue: 4023262 Handle down interface states during table update #215

Merged
merged 2 commits into from
Nov 11, 2024

Conversation

BasharRadya
Copy link
Collaborator

@BasharRadya BasharRadya commented Aug 14, 2024

In this commit, we address a scenario where more than one network interface is assigned the same IP address. The current implementation supports creating RX rules for only one interface per IP address, which can lead to issues if multiple interfaces share the same IP.

Key Changes:

Added a mechanism to detect when the same IP address is assigned to multiple interfaces.
If this conflict occurs, a warning message is printed to notify the user that this configuration is not supported.
When faced with this conflict, the implementation now prioritizes the interface that is in the "Up" state, assigning the RX rules to it.
This change helps prevent potential conflicts and ensures that the most relevant (active) interface is used when an IP address conflict occurs.

Change type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Tests
  • Other

Check list

  • Code follows the style de facto guidelines of this project
  • Comments have been inserted in hard to understand places
  • Documentation has been updated (if necessary)
  • Test has been added (if possible)

@BasharRadya
Copy link
Collaborator Author

bot:retest

@BasharRadya BasharRadya changed the base branch from master to vNext August 15, 2024 08:20
@BasharRadya BasharRadya force-pushed the handle_down_interface branch 2 times, most recently from d7ac05c to 82e3e5b Compare August 15, 2024 11:47
@BasharRadya BasharRadya force-pushed the handle_down_interface branch 2 times, most recently from a61d143 to a17b2b2 Compare August 20, 2024 07:31
@BasharRadya BasharRadya added the bug Something isn't working label Aug 20, 2024
@BasharRadya BasharRadya force-pushed the handle_down_interface branch 2 times, most recently from 2e15ca1 to 4230b33 Compare August 27, 2024 13:54
Refactored ip_addr move constructor to use std::forward for improved
efficiency and move semantics.

Signed-off-by: Bashar Abdelgafer  <[email protected]>
@BasharRadya BasharRadya force-pushed the handle_down_interface branch 2 times, most recently from aed5039 to 986ac8f Compare August 29, 2024 15:28
@@ -264,19 +264,32 @@ void net_device_table_mgr::update_tbl()
if ((int)get_max_mtu() < p_net_device_val->get_mtu()) {
set_max_mtu(p_net_device_val->get_mtu());
}
auto handle_ip_insertion = [p_net_device_val](const std::unique_ptr<ip_data> &ip,
auto &net_device_map,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please replace auto with real type here. Keep auto for lambda and iterator. Motivation: this will simplify reading (what we do more frequent than writing) and allow to use ctags easier.

Comment on lines 275 to 279
if (it != net_device_map.end()) {
vlog_printf(VLOG_WARNING,
"IP ADDRESS %s ASSIGNED TO MULTIPLE INTERFACES NOT SUPPORTED\n",
ip->local_addr.to_str(family).c_str());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This approach can print multiple extra messages (per problematic interface). This is OK since this is unlikely scenario. We still can consider choosing among the following options:

  1. Print a message per problematic interface as is. I'd prefer to move the if block at the top of the lambda not to think about iterator invalidation (the previous block manipulates with the collection).
  2. Remember the fact that there is at least one duplicate IP and print a single common warning message at the end.
  3. Create a map on stack with key=IP value=net_device_val and print a single message per IP at the end with mentioning which interface will be used for each IP.

Also rewrite the warning message:

  • Don't use upper case
  • Write more "light" message, because XLIO will work as expected in multiple scenarios even with duplicate IP addresses, and the current message makes impression that XLIO won't work at all. Use something like "Duplicate IP address %s is detected on multiple interfaces. XLIO will work with a single interface".

@BasharRadya
Copy link
Collaborator Author

bot:retest

Detects when the same IP is assigned to more than one interface.
Prioritizes the "Up" interface if a conflict occurs.
Prints a warning since the current implementation only supports
one interface per IP.

Signed-off-by: Bashar Abdelgafer  <[email protected]>
@BasharRadya
Copy link
Collaborator Author

bot:retest

@galnoam galnoam merged commit 463ab3c into Mellanox:vNext Nov 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants