Skip to content

netlink: clean up sockets, close files#367

Merged
openwrt-bot merged 1 commit intoopenwrt:masterfrom
systemcrash:exit_cleanup
Jan 10, 2026
Merged

netlink: clean up sockets, close files#367
openwrt-bot merged 1 commit intoopenwrt:masterfrom
systemcrash:exit_cleanup

Conversation

@systemcrash
Copy link
Contributor

@systemcrash systemcrash commented Dec 30, 2025

Sockets are handled for most usage paths, except for shutdown. Handle those at shutdown.

Closes #366

@systemcrash systemcrash mentioned this pull request Dec 30, 2025
@systemcrash
Copy link
Contributor Author

ping @Alphix

@Alphix
Copy link
Contributor

Alphix commented Dec 30, 2025

Question: atexit doesn't have to be called in main(). Would it be possible to call it in the respective netlink/router registration code so that the init/shutdown logic stays internal to those files (and that the functions can be static instead of exported)?

@systemcrash
Copy link
Contributor Author

I have no preference either way - but the init routines are likewise not static because they're called from odhcpd.c main(). So I figured parity. How about now?

@systemcrash
Copy link
Contributor Author

Welp, I've taken it for a quick spin and nothing exploded :)

@systemcrash
Copy link
Contributor Author

At your leisure, then, @Noltari

@Alphix
Copy link
Contributor

Alphix commented Jan 3, 2026

Might be a silly question, but why are we bothering with cleanup on exit? Is it because you get spam in some profiling tool otherwise?

@systemcrash
Copy link
Contributor Author

Just good practice, if nothing else.

Sockets are handled for most usage paths, except for shutdown. Handle
those at shutdown.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: openwrt#367
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
@openwrt-bot openwrt-bot merged commit 3cbbea8 into openwrt:master Jan 10, 2026
9 checks passed
@Noltari
Copy link
Member

Noltari commented Jan 10, 2026

Merged, thanks @systemcrash!

@systemcrash systemcrash deleted the exit_cleanup branch January 19, 2026 00:05
Noltari pushed a commit to Noltari/odhcpd that referenced this pull request Jan 25, 2026
Sockets are handled for most usage paths, except for shutdown. Handle
those at shutdown.

(cherry picked from commit 3cbbea8)
Signed-off-by: Paul Donald <newtwen+github@gmail.com>
Link: openwrt#367
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cleanup

4 participants