mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:39:39 +01:00
wired: Start and stop EAPoL session based on IFF_LOWER_UP signalling
This commit is contained in:
parent
ee755490c1
commit
f8b2610046
@ -45,6 +45,8 @@ struct ethdev {
|
||||
uint32_t index;
|
||||
char ifname[IFNAMSIZ];
|
||||
uint8_t addr[ETH_ALEN];
|
||||
bool active;
|
||||
bool lower_up;
|
||||
struct l_queue *eapol_sessions;
|
||||
};
|
||||
|
||||
@ -371,10 +373,14 @@ static void newlink_notify(const struct ifinfomsg *ifi, int bytes)
|
||||
uint8_t *addr = NULL;
|
||||
const char *ifname = NULL;
|
||||
uint8_t linkmode = 0, operstate = 0;
|
||||
bool active, lower_up;
|
||||
|
||||
if (ifi->ifi_type != ARPHRD_ETHER)
|
||||
return;
|
||||
|
||||
active = ifi->ifi_flags & IFF_UP;
|
||||
lower_up = ifi->ifi_flags & IFF_LOWER_UP;
|
||||
|
||||
for (attr = IFLA_RTA(ifi); RTA_OK(attr, bytes);
|
||||
attr = RTA_NEXT(attr, bytes)) {
|
||||
switch (attr->rta_type) {
|
||||
@ -397,7 +403,7 @@ static void newlink_notify(const struct ifinfomsg *ifi, int bytes)
|
||||
if (!addr || !ifname)
|
||||
return;
|
||||
|
||||
l_info("%s: linkmode %u operstate %u", ifname, linkmode, operstate);
|
||||
l_debug("%s: linkmode %u operstate %u", ifname, linkmode, operstate);
|
||||
|
||||
if (!is_ifname_valid(ifname)) {
|
||||
l_debug("Ignoring device with interface name %s", ifname);
|
||||
@ -427,20 +433,28 @@ static void newlink_notify(const struct ifinfomsg *ifi, int bytes)
|
||||
|
||||
dev = l_new(struct ethdev, 1);
|
||||
dev->index = index;
|
||||
dev->active = false;
|
||||
dev->lower_up = false;
|
||||
dev->eapol_sessions = l_queue_new();
|
||||
|
||||
l_debug("Creating device %u", dev->index);
|
||||
|
||||
l_queue_push_tail(ethdev_list, dev);
|
||||
|
||||
pae_write(dev, pae_group_addr,
|
||||
eapol_start, sizeof(eapol_start));
|
||||
}
|
||||
|
||||
if (ifname)
|
||||
strcpy(dev->ifname, ifname);
|
||||
|
||||
memcpy(dev->addr, addr, ETH_ALEN);
|
||||
|
||||
if (lower_up && !dev->lower_up)
|
||||
pae_write(dev, pae_group_addr,
|
||||
eapol_start, sizeof(eapol_start));
|
||||
else if (!lower_up && dev->lower_up)
|
||||
l_queue_destroy(dev->eapol_sessions, eapol_free);
|
||||
|
||||
dev->active = active;
|
||||
dev->lower_up = lower_up;
|
||||
}
|
||||
|
||||
static void dellink_notify(const struct ifinfomsg *ifi, int bytes)
|
||||
|
Loading…
Reference in New Issue
Block a user