-
Notifications
You must be signed in to change notification settings - Fork 18
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: 3382805 Fixing incorrect handling of src field of IPv4 routing #126
base: vNext
Are you sure you want to change the base?
Conversation
Instead of using src address of the routing resolution result to identify interface, especially in IPv4 multicast case, use the if_index of the routing result. Signed-off-by: Alexander Grissik <agrissik@nvidia.com>
In case of IPv4 bind to any ip avoid trying to register dst_entry as observer with routing src field which should be used for outgoing address selection and not for routing rule decisions. What was happening: If we found routing for any IP, we looked if that routing has src-ip field. In case of IPv4, if routing entry has no src-ip (which is common), we forcefully set it to the first address of the device related to this routing entry. And so, we go and look for another routing entry by giving now the src field of the routing we found. That src field affects the routing rule selection. Appart the fact this is not hte goal of the src routing field, in most cases it ends up with the same device we dicovered at first place. Signed-off-by: Alexander Grissik <agrissik@nvidia.com>
Route entry src field should be used for src addr selection algorithm. Forcing src addr based on interface IPs may lead to wrong src addr selection. Signed-off-by: Alexander Grissik <agrissik@nvidia.com>
Registering a route entry per device is not used. The entry does not track device up/down events. Signed-off-by: Alexander Grissik <agrissik@nvidia.com>
The m_src_addr field can be used now. No need for special one. Signed-off-by: Alexander Grissik <agrissik@nvidia.com>
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.
Review is not finished yet
} | ||
|
||
si_udp_logdbg("IPPROTO_IP, %s=%d.%d.%d.%d, mc_if:%d.%d.%d.%d mc_if:%d.%d.%d.%d", |
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.
Inconsistency between format and arguments.
Also, you can use ip_address
object to print pretty to_str()
which is IP version independent. You already need to wrap mc_grp
with ip_address
for resolve_if_ip()
.
@@ -1127,31 +1127,16 @@ int sockinfo_udp::setsockopt(int __level, int __optname, __const void *__optval, | |||
break; | |||
} | |||
|
|||
// Find local interface IP address | |||
// Find local if for this MC ADD/DROP |
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.
[suggestion] local interface
instead of local if
.
rt_mgr_logdbg("dst ip '%s' resolved to if_index: %d, src-addr: %s, gw-addr: %s, " | ||
"route-mtu: %" PRIu32, | ||
dst_addr.to_str(family).c_str(), res.if_index, | ||
res.src.to_str(family).c_str(), res.gw.to_str(family).c_str(), res.mtu); | ||
p_val->get_src_addr().to_str(family).c_str(), | ||
p_val->get_gw_addr().to_str(family).c_str(), res.mtu); |
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.
[suggestion] Mix of res
and p_val
in the arguments can lead to inconvenient changes in the future. I'd suggest to use a single object consistently (p_val
in this case). Not critical.
Description
Fix usage of src routing field of IPv4
What
The src field should be used for src address selection only (As done for IPv6) and not as identifying interfaces or routing decisions.
This eliminates incorrect behavior and warnings such as "could not figure out source ip for rtv".
Why ?
Functionality
Change type
What kind of change does this PR introduce?
Check list