network: Rework initial interface search by using a dump

Instead of using an alternative way to list all links in order to
choose one when an "interface" is in the configuration, we can ask for
a dump of all interface an reuse the handleEvents() function.

This patch also start to rework the handleEvents() function to grab
more information out of each event, like the interface name.
This commit is contained in:
Anthony PERARD
2021-05-15 16:38:00 +01:00
parent 63fdf66ad6
commit c9bbaa7241
2 changed files with 95 additions and 41 deletions

View File

@ -28,8 +28,11 @@ class Network : public ALabel {
static const uint8_t EPOLL_MAX = 200;
static int handleEvents(struct nl_msg*, void*);
static int handleEventsDone(struct nl_msg*, void*);
static int handleScan(struct nl_msg*, void*);
void askForStateDump(void);
void worker();
void createInfoSocket();
void createEventSocket();
@ -59,6 +62,9 @@ class Network : public ALabel {
int nl80211_id_;
std::mutex mutex_;
bool want_link_dump_;
bool dump_in_progress_;
unsigned long long bandwidth_down_total_;
unsigned long long bandwidth_up_total_;