mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-23 04:25:42 +02:00
module/network: RTM_NEWLINK/DELLINK: don't do anything if nothing's changed
We're only interrested in a few of the attributes. Thus, there's no need to log or update anything, if none of those attributes haven't changed.
This commit is contained in:
parent
dcf8051f1a
commit
24842d9b28
1 changed files with 11 additions and 2 deletions
|
@ -242,7 +242,10 @@ handle_link(struct module *mod, uint16_t type,
|
|||
switch (attr->rta_type) {
|
||||
case IFLA_OPERSTATE: {
|
||||
uint8_t operstate = *(const uint8_t *)RTA_DATA(attr);
|
||||
LOG_DBG("%s: IFLA_OPERSTATE: %hhu", m->iface, operstate);
|
||||
if (m->state == operstate)
|
||||
break;
|
||||
|
||||
LOG_DBG("%s: IFLA_OPERSTATE: %hhu -> %hhu", m->iface, m->state, operstate);
|
||||
|
||||
mtx_lock(&mod->lock);
|
||||
m->state = operstate;
|
||||
|
@ -253,7 +256,10 @@ handle_link(struct module *mod, uint16_t type,
|
|||
|
||||
case IFLA_CARRIER: {
|
||||
uint8_t carrier = *(const uint8_t *)RTA_DATA(attr);
|
||||
LOG_DBG("%s: IFLA_CARRIER: %hhu", m->iface, carrier);
|
||||
if (m->carrier == carrier)
|
||||
break;
|
||||
|
||||
LOG_DBG("%s: IFLA_CARRIER: %hhu -> %hhu", m->iface, m->carrier, carrier);
|
||||
|
||||
mtx_lock(&mod->lock);
|
||||
m->carrier = carrier;
|
||||
|
@ -267,6 +273,9 @@ handle_link(struct module *mod, uint16_t type,
|
|||
break;
|
||||
|
||||
const uint8_t *mac = RTA_DATA(attr);
|
||||
if (memcmp(m->mac, mac, sizeof(m->mac)) == 0)
|
||||
break;
|
||||
|
||||
LOG_DBG("%s: IFLA_ADDRESS: %02x:%02x:%02x:%02x:%02x:%02x",
|
||||
m->iface,
|
||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
|
|
Loading…
Add table
Reference in a new issue