rtnl: add 'power_up' flag to l_rtnl_set_mac
PATCH 1/1 rtnl: add 'power_up' flag to l_rtnl_set_mac
The use of l_rtnl_set_mac in IWD is always followed by powering up the device. Bringing the device back up requires calling l_rtnl_set_powered which makes another async call into the kernel. In order to reduce complexity we can include the IFF_UP flag to the MAC change message which will both change the MAC and bring the interface up all in one go.
The existing behavior is maintained by passing false to 'power_up'.
--- ell/rtnl.c | 5 +++++ ell/rtnl.h | 1 + 2 files changed, 6 insertions(+)
ell/rtnl.c +5 -0
@@ -167,6 +167,7 @@ uint32_t l_rtnl_set_linkmode_and_operstate(struct l_netlink *rtnl, int ifindex,uint32_t l_rtnl_set_mac (struct l_netlink *rtnl,int ifindex,const uint8_t addr[static 6 ], +bool power_up,l_netlink_command_func_t cb,void *user_data,l_netlink_destroy_func_t destroy)
@@ -183,6 +184,10 @@ uint32_t l_rtnl_set_mac(struct l_netlink *rtnl, int ifindex, rtmmsg->ifi_family =AF_UNSPEC ; rtmmsg->ifi_index = ifindex; +if (power_up) { + rtmmsg->ifi_change =IFF_UP ; + rtmmsg->ifi_flags =IFF_UP ; + } rta_buf = (void *) rtmmsg +NLMSG_ALIGN (sizeof (struct ifinfomsg ));
ell/rtnl.h +1 -0
@@ -38,6 +38,7 @@ uint32_t l_rtnl_set_linkmode_and_operstate(struct l_netlink *rtnl, int ifindex,uint32_t l_rtnl_set_mac (struct l_netlink *rtnl,int ifindex,const uint8_t addr[static 6 ], +bool power_up,l_netlink_command_func_t cb,void *user_data,l_netlink_destroy_func_t destroy);
Signature · 1 line
2.24.1
Denis Kenzior
AppliedHi James,
Quoted 6 lines · James Prestwood
The use of
l_rtnl_set_macin IWD is always followed by powering up the device. Bringing the device back up requires callingl_rtnl_set_poweredwhich makes another async call into the kernel. In order to reduce complexity we can include theIFF_UPflag to the MAC change message which will both change the MAC and bring the interface up all in one go.
Quoted 6 lines
The existing behavior is maintained by passing false to '
power_up'.--- ell/rtnl.c | 5 +++++ ell/rtnl.h | 1 + 2 files changed, 6 insertions(+)
Applied, thanks.
Regards,
-Denis