illiliti / eiwd

iwd without dbus -- maintained fork of original dylanaraps/eiwd
GNU Lesser General Public License v2.1
42 stars 2 forks source link

wip: fix leaks and use after frees #5

Closed git-bruh closed 8 months ago

git-bruh commented 1 year ago

A lot of the stubbed out DBUS calls are actually responsible for correlating a netdev with allocated resources and free-ing them, for example, take dpp.c

So for this we basically have to emulate what DBus does, which is being done in dbus-stub.c, just a garbage example, it needs to be re written to use l_hashmap

Most of the other function calls like l_dbus_interface_property are useless and just return failure

Also this change must be made to the ell submodule so that our dbus.h hacks can take precedence

diff --git a/ell/ell.h b/ell/ell.h
index 647f411..7ca19ce 100644
--- a/ell/ell.h
+++ b/ell/ell.h
@@ -51,9 +51,6 @@
 #include <ell/netlink.h>
 #include <ell/genl.h>
 #include <ell/rtnl.h>
-#include <ell/dbus.h>
-#include <ell/dbus-service.h>
-#include <ell/dbus-client.h>
 #include <ell/dhcp.h>
 #include <ell/dhcp6.h>
 #include <ell/icmp6.h>
illiliti commented 11 months ago

Thanks for working on this. Yeah, having leaks is not ideal, but fixing them is neither too because, looking at your work, that would make maintaining eiwd a lot harder due to non-trivial stub functions which also require modifying ell submodule in order to be in effect. If stubs were simple, say "return NULL", and not touching ell submodule at all, then I would welcome that, but from what I see I afraid I don't have a capacity to maintain such intrusive changes. Hence the question: is it possible to take a different approach to fixing these leaks?

git-bruh commented 11 months ago

yeah there's no sane way to fix this since the callbacks for allocating and free-ing stuff are sent over dbus only