Update to ell's rntl API
cover Update to ell's rntl API
The rtnlutil code has been moved to ell, let's use it.
Daniel Wagner (3):
netdev: Use ell's rtnl APIs
netconfig: Use ell's rtnl API
rtnlutil: Remove used rtnlutil
Makefile.am | 3 +- src/netconfig.c | 31 ++- src/netdev.c | 22 +- src/rtnlutil.c | 640 ------------------------------------------------ src/rtnlutil.h | 103 -------- 5 files changed, 28 insertions(+), 771 deletions(-) delete mode 100644 src/rtnlutil.c delete mode 100644 src/rtnlutil.h
Signature · 1 line
2.25.0
PATCH 1/3 netdev: Use ell's rtnl APIs
--- src/netdev.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
src/netdev.c +11 -10
@@ -341,7 +341,7 @@ int netdev_set_powered(struct netdev *netdev, bool powered,return -EBUSY ; netdev->set_powered_cmd_id = -rtnl_set_powered (rtnl, netdev->index, powered, +l_rtnl_set_powered (rtnl, netdev->index, powered, netdev_set_powered_result, netdev, netdev_set_powered_destroy);if (!netdev->set_powered_cmd_id)
@@ -632,7 +632,8 @@ static void netdev_shutdown_one(void *data, void *user_data)struct netdev *netdev = data;if (netdev_get_is_up (netdev)) -rtnl_set_powered (rtnl, netdev->index, false,NULL ,NULL ,NULL ); +l_rtnl_set_powered (rtnl, netdev->index, false, +NULL ,NULL ,NULL ); }static bool netdev_match (const void *a,const void *b)
@@ -986,7 +987,7 @@ static void netdev_operstate_cb(int error, uint16_t type,static void netdev_connect_ok (struct netdev *netdev) { -rtnl_set_linkmode_and_operstate (rtnl, netdev->index, +l_rtnl_set_linkmode_and_operstate (rtnl, netdev->index,IF_LINK_MODE_DORMANT ,IF_OPER_UP , netdev_operstate_cb,L_UINT_TO_PTR (netdev->index),NULL );
@@ -3817,7 +3818,7 @@ static void netdev_set_iftype_cb(struct l_genl_msg *msg, void *user_data) goto done; netdev->set_powered_cmd_id = -rtnl_set_powered (rtnl, netdev->index, true, +l_rtnl_set_powered (rtnl, netdev->index, true, netdev_set_iftype_up_cb, req, netdev_set_iftype_request_destroy);if (!netdev->set_powered_cmd_id) {
@@ -3913,7 +3914,7 @@ int netdev_set_iftype(struct netdev *netdev, enum netdev_iftype type,l_genl_msg_unref (msg); }else { netdev->set_powered_cmd_id = -rtnl_set_powered (rtnl, netdev->index, false, +l_rtnl_set_powered (rtnl, netdev->index, false, netdev_set_iftype_down_cb, req, netdev_set_iftype_request_destroy);if (netdev->set_powered_cmd_id)
@@ -4116,7 +4117,7 @@ static void netdev_initial_up_cb(int error, uint16_t type, const void *data,return ; } -rtnl_set_linkmode_and_operstate (rtnl, netdev->index, +l_rtnl_set_linkmode_and_operstate (rtnl, netdev->index,IF_LINK_MODE_DORMANT ,IF_OPER_DOWN , netdev_operstate_cb,L_UINT_TO_PTR (netdev->index),NULL );
@@ -4146,7 +4147,7 @@ static void netdev_set_mac_cb(int error, uint16_t type, const void *data, strerror(-error)); netdev->set_powered_cmd_id = -rtnl_set_powered (rtnl, netdev->index, true, +l_rtnl_set_powered (rtnl, netdev->index, true, netdev_initial_up_cb, netdev,NULL ); }
@@ -4158,7 +4159,7 @@ static bool netdev_check_set_mac(struct netdev *netdev)l_debug ("Setting initial address on ifindex: %d to: " MAC , netdev->index,MAC_STR (netdev->set_mac_once)); netdev->set_powered_cmd_id = -rtnl_set_mac (rtnl, netdev->index, netdev->set_mac_once, +l_rtnl_set_mac (rtnl, netdev->index, netdev->set_mac_once, netdev_set_mac_cb, netdev,NULL );memset (netdev->set_mac_once,0 ,6 );return true;
@@ -4183,7 +4184,7 @@ static void netdev_initial_down_cb(int error, uint16_t type, const void *data,return ; netdev->set_powered_cmd_id = -rtnl_set_powered (rtnl, netdev->index, true, +l_rtnl_set_powered (rtnl, netdev->index, true, netdev_initial_up_cb, netdev,NULL ); }
@@ -4228,7 +4229,7 @@ static void netdev_getlink_cb(int error, uint16_t type, const void *data, cb = powered ? netdev_initial_down_cb : netdev_initial_up_cb; netdev->set_powered_cmd_id = -rtnl_set_powered (rtnl, ifi->ifi_index, !powered, cb, netdev, +l_rtnl_set_powered (rtnl, ifi->ifi_index, !powered, cb, netdev,NULL ); }
Signature · 1 line
2.25.0
PATCH 2/3 netconfig: Use ell's rtnl API
In reply to Daniel Wagner--- src/netconfig.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-)
src/netconfig.c +15 -15
@@ -502,8 +502,8 @@ static void netconfig_ifaddr_added(struct netconfig *netconfig, ifaddr->family = ifa->ifa_family; ifaddr->prefix_len = ifa->ifa_prefixlen; -rtnl_ifaddr_extract (ifa, len, &label, &ifaddr->ip, - &ifaddr->broadcast); +l_rtnl_ifaddr4_extract (ifa, len, &label, &ifaddr->ip, + &ifaddr->broadcast);l_debug ("%s: ifaddr %s/%u broadcast %s" , label, ifaddr->ip, ifaddr->prefix_len, ifaddr->broadcast);
@@ -519,7 +519,7 @@ static void netconfig_ifaddr_deleted(struct netconfig *netconfig,struct netconfig_ifaddr *ifaddr;struct netconfig_ifaddr query; -rtnl_ifaddr_extract (ifa, len,NULL , &query.ip,NULL ); +l_rtnl_ifaddr4_extract (ifa, len,NULL , &query.ip,NULL ); query.family = ifa->ifa_family; query.prefix_len = ifa->ifa_prefixlen;
@@ -586,7 +586,7 @@ static void netconfig_ifaddr_ipv6_added(struct netconfig *netconfig, ifaddr->family = ifa->ifa_family; ifaddr->prefix_len = ifa->ifa_prefixlen; -rtnl_ifaddr_ipv6_extract (ifa, len, &ifaddr->ip); +l_rtnl_ifaddr6_extract (ifa, len, &ifaddr->ip);l_debug ("ifindex %u: ifaddr %s/%u" , netconfig->ifindex, ifaddr->ip, ifaddr->prefix_len);
@@ -601,7 +601,7 @@ static void netconfig_ifaddr_ipv6_deleted(struct netconfig *netconfig,struct netconfig_ifaddr *ifaddr;struct netconfig_ifaddr query; -rtnl_ifaddr_ipv6_extract (ifa, len, &query.ip); +l_rtnl_ifaddr6_extract (ifa, len, &query.ip); query.family = ifa->ifa_family; query.prefix_len = ifa->ifa_prefixlen;
@@ -707,7 +707,7 @@ static bool netconfig_ipv4_routes_install(struct netconfig *netconfig,if (!network)return false; - if (!rtnl_route_ipv4_add_connected(rtnl, netconfig->ifindex, + if (!l_rtnl_route4_add_connected(rtnl, netconfig->ifindex, ifaddr->prefix_len, network, ifaddr->ip, netconfig->rtm_protocol,
@@ -727,7 +727,7 @@ static bool netconfig_ipv4_routes_install(struct netconfig *netconfig,return false; } - if (!rtnl_route_ipv4_add_gateway(rtnl, netconfig->ifindex, gateway, + if (!l_rtnl_route4_add_gateway(rtnl, netconfig->ifindex, gateway, ifaddr->ip, ROUTE_PRIORITY_OFFSET, netconfig->rtm_protocol,
@@ -806,7 +806,7 @@ static bool netconfig_ipv6_routes_install(struct netconfig *netconfig)return false; } - if (!rtnl_route_ipv6_add_gateway(rtnl, netconfig->ifindex, gateway, + if (!l_rtnl_route6_add_gateway(rtnl, netconfig->ifindex, gateway, ROUTE_PRIORITY_OFFSET, netconfig->rtm_v6_protocol, netconfig_route_add_cmd_cb,
@@ -860,7 +860,7 @@ static void netconfig_install_address(struct netconfig *netconfig,switch (ifaddr->family) {case AF_INET : - if (rtnl_ifaddr_add(rtnl, netconfig->ifindex, + if (l_rtnl_ifaddr4_add(rtnl, netconfig->ifindex, ifaddr->prefix_len, ifaddr->ip, ifaddr->broadcast, netconfig_ipv4_ifaddr_add_cmd_cb,
@@ -871,7 +871,7 @@ static void netconfig_install_address(struct netconfig *netconfig, ifaddr->prefix_len);break ;case AF_INET6 : -if (rtnl_ifaddr_ipv6_add (rtnl, netconfig->ifindex, +if (l_rtnl_ifaddr6_add (rtnl, netconfig->ifindex, ifaddr->prefix_len, ifaddr->ip, netconfig_ipv6_ifaddr_add_cmd_cb, netconfig,NULL ))
@@ -916,7 +916,7 @@ static void netconfig_uninstall_address(struct netconfig *netconfig,switch (ifaddr->family) {case AF_INET : - if (rtnl_ifaddr_delete(rtnl, netconfig->ifindex, + if (l_rtnl_ifaddr4_delete(rtnl, netconfig->ifindex, ifaddr->prefix_len, ifaddr->ip, ifaddr->broadcast, netconfig_ifaddr_del_cmd_cb, netconfig,
@@ -927,7 +927,7 @@ static void netconfig_uninstall_address(struct netconfig *netconfig, ifaddr->ip, ifaddr->prefix_len);break ;case AF_INET6 : -if (rtnl_ifaddr_ipv6_delete (rtnl, netconfig->ifindex, +if (l_rtnl_ifaddr6_delete (rtnl, netconfig->ifindex, ifaddr->prefix_len, ifaddr->ip, netconfig_ifaddr_del_cmd_cb, netconfig,NULL ))
@@ -1094,7 +1094,7 @@ static void netconfig_ipv6_select_and_uninstall(struct netconfig *netconfig)if (!gateway)return ; -if (!rtnl_route_ipv6_delete_gateway (rtnl, netconfig->ifindex, +if (!l_rtnl_route6_delete_gateway (rtnl, netconfig->ifindex, gateway,ROUTE_PRIORITY_OFFSET , netconfig->rtm_v6_protocol, netconfig_route_del_cmd_cb,NULL ,NULL )) {
@@ -1233,7 +1233,7 @@ static int netconfig_init(void) goto error; } - r =rtnl_ifaddr_get (rtnl, netconfig_ifaddr_cmd_cb,NULL ,NULL ); + r =l_rtnl_ifaddr4_dump (rtnl, netconfig_ifaddr_cmd_cb,NULL ,NULL );if (!r) {l_error ("netconfig: Failed to get addresses from RTNL link." ); goto error;
@@ -1247,7 +1247,7 @@ static int netconfig_init(void) goto error; } - r =rtnl_ifaddr_ipv6_get (rtnl, netconfig_ifaddr_ipv6_cmd_cb,NULL , + r =l_rtnl_ifaddr6_dump (rtnl, netconfig_ifaddr_ipv6_cmd_cb,NULL ,NULL );if (!r) { l_error("netconfig: Failed to get IPv6 addresses from RTNL"
Signature · 1 line
2.25.0
PATCH 3/3 rtnlutil: Remove used rtnlutil
In reply to Daniel WagnerThe rtnl code has been added to ELL. There is caller left in iwd, therefore remove the rtnlutil file.
--- Makefile.am | 3 +- src/netconfig.c | 1 - src/netdev.c | 1 - src/rtnlutil.c | 640 ------------------------------------------------ src/rtnlutil.h | 103 -------- 5 files changed, 2 insertions(+), 746 deletions(-) delete mode 100644 src/rtnlutil.c delete mode 100644 src/rtnlutil.h
Makefile.am +2 -1
@@ -39,6 +39,7 @@ ell_headers = ell/util.h \ ell/netlink.h \ ell/genl.h \ ell/dbus.h \ + ell/rtnl.h \ ell/dbus-service.h \ ell/dbus-client.h \ ell/hwdb.h \
@@ -84,6 +85,7 @@ ell_sources = ell/private.h \ ell/netlink.c \ ell/genl-private.h \ ell/genl.c \ + ell/rtnl.c \ ell/dbus-private.h \ ell/dbus.c \ ell/dbus-message.c \
@@ -217,7 +219,6 @@ src_iwd_SOURCES = src/main.c linux/nl80211.h src/iwd.h src/missing.h \ src/manager.c \ src/erp.h src/erp.c \ src/fils.h src/fils.c \ - src/rtnlutil.h src/rtnlutil.c \ src/auth-proto.h \ src/anqp.h src/anqp.c \ src/anqputil.h src/anqputil.c \
src/netconfig.c +0 -1
@@ -39,7 +39,6 @@#include "src/station.h" #include "src/common.h" #include "src/network.h" -#include "src/rtnlutil.h" #include "src/resolve.h" #include "src/netconfig.h"
src/netdev.c +0 -1
@@ -60,7 +60,6 @@#include "src/owe.h" #include "src/fils.h" #include "src/auth-proto.h" -#include "src/rtnlutil.h" #include "src/frame-xchg.h" #ifndef ENOTSUPP
src/rtnlutil.c deleted +0 -640
640 lines not on this page · raw message
src/rtnlutil.h deleted +0 -103
103 lines not on this page · raw message
Signature · 1 line
2.25.0
Hi Daniel,
Quoted 7 lines · Daniel Wagner
The rtnlutil code has been moved to ell, let's use it.
Daniel Wagner (3):
netdev: Use ell's rtnl APIs
netconfig: Use ell's rtnl API
rtnlutil: Remove used rtnlutil
All applied, thanks.
Regards,
-Denis