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

[Backport v3.7-branch] net: Update IP address refcount properly when address already exists #85659

Conversation

jukkar
Copy link
Member

@jukkar jukkar commented Feb 12, 2025

This is a backport of #85485 to v3.7. It also contains required commit from #78393 so that the fix can be applied cleanly.

If an IP address already exists when it is tried to be added to the network interface, then just return it but update ref count if it was not updated. This could happen if the address was added and then removed, but for example an active connection was still using it and keeping the ref count > 0. In this case we must update the ref count so that the IP address is not removed if the connection is closed.

Fixes #85380

rlubos and others added 2 commits February 12, 2025 12:29
net_if_ipv4/6_addr_rm() were missing the iface mutex lock, this commit
adds it.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
If an IP address already exists when it is tried to be added to the
network interface, then just return it but update ref count if it was
not updated. This could happen if the address was added and then removed,
but for example an active connection was still using it and keeping the
ref count > 0. In this case we must update the ref count so that the IP
address is not removed if the connection is closed.

Fixes zephyrproject-rtos#85380

Signed-off-by: Jukka Rissanen <jukka.rissanen@nordicsemi.no>
@jukkar jukkar added area: Networking Backport Backport PR and backport failure issues labels Feb 12, 2025
@jukkar jukkar added this to the v3.7.2 milestone Feb 12, 2025
@nashif nashif merged commit 0ea0868 into zephyrproject-rtos:v3.7-branch Feb 21, 2025
30 checks passed
@jukkar jukkar deleted the fix/85380/netif-ip-address-disappears.v3.7 branch February 21, 2025 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Networking Backport Backport PR and backport failure issues
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants