All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 1/8] netconfig: Track the IPv6 route add netlink command
@ 2021-09-29 20:00 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2021-09-29 20:00 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 429 bytes --]

Hi Andrew,

On 9/24/21 8:11 PM, Andrew Zaborowski wrote:
> For symmetry with IPv4, save the command id for this netlink command so
> we can later add logic to the callback as well as be able to cancel the
> command.  No functional change in this commit alone.
> ---
>   src/netconfig.c | 31 +++++++++++++++++++++++++++----
>   1 file changed, 27 insertions(+), 4 deletions(-)
> 

Applied, thanks.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/8] netconfig: Track the IPv6 route add netlink command
@ 2021-09-25  1:11 Andrew Zaborowski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Zaborowski @ 2021-09-25  1:11 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 2297 bytes --]

For symmetry with IPv4, save the command id for this netlink command so
we can later add logic to the callback as well as be able to cancel the
command.  No functional change in this commit alone.
---
 src/netconfig.c | 31 +++++++++++++++++++++++++++----
 1 file changed, 27 insertions(+), 4 deletions(-)

diff --git a/src/netconfig.c b/src/netconfig.c
index 421270c9..da775480 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -74,6 +74,7 @@ struct netconfig {
 	uint32_t addr4_add_cmd_id;
 	uint32_t addr6_add_cmd_id;
 	uint32_t route4_add_gateway_cmd_id;
+	uint32_t route6_add_cmd_id;
 };
 
 static struct l_netlink *rtnl;
@@ -739,6 +740,21 @@ static void netconfig_route_add_cmd_cb(int error, uint16_t type,
 	netconfig->notify = NULL;
 }
 
+static void netconfig_route6_add_cb(int error, uint16_t type,
+					const void *data, uint32_t len,
+					void *user_data)
+{
+	struct netconfig *netconfig = user_data;
+
+	netconfig->route6_add_cmd_id = 0;
+
+	if (error) {
+		l_error("netconfig: Failed to add route. Error %d: %s",
+						error, strerror(-error));
+		return;
+	}
+}
+
 static bool netconfig_ipv4_routes_install(struct netconfig *netconfig)
 {
 	L_AUTO_FREE_VAR(char *, gateway) = NULL;
@@ -859,10 +875,12 @@ static void netconfig_ipv6_ifaddr_add_cmd_cb(int error, uint16_t type,
 
 	gateway = netconfig_get_static6_gateway(netconfig, &gateway_mac);
 	if (gateway) {
-		L_WARN_ON(!l_rtnl_route_add(rtnl, netconfig->ifindex,
-						gateway,
-						netconfig_route_generic_cb,
-						netconfig, NULL));
+		netconfig->route6_add_cmd_id = l_rtnl_route_add(rtnl,
+							netconfig->ifindex,
+							gateway,
+							netconfig_route6_add_cb,
+							netconfig, NULL);
+		L_WARN_ON(unlikely(!netconfig->route6_add_cmd_id));
 		l_rtnl_route_free(gateway);
 
 		if (gateway_mac && !l_rtnl_neighbor_set_hwaddr(rtnl,
@@ -1360,6 +1378,11 @@ bool netconfig_reset(struct netconfig *netconfig)
 		netconfig->route4_add_gateway_cmd_id = 0;
 	}
 
+	if (netconfig->route6_add_cmd_id) {
+		l_netlink_cancel(rtnl, netconfig->route6_add_cmd_id);
+		netconfig->route6_add_cmd_id = 0;
+	}
+
 	if (netconfig->addr4_add_cmd_id) {
 		l_netlink_cancel(rtnl, netconfig->addr4_add_cmd_id);
 		netconfig->addr4_add_cmd_id = 0;
-- 
2.30.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-29 20:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 20:00 [PATCH 1/8] netconfig: Track the IPv6 route add netlink command Denis Kenzior
  -- strict thread matches above, loose matches on Subject: below --
2021-09-25  1:11 Andrew Zaborowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.