Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH 1/4] rtnlutil: Add IPv6 route deletion helper
@ 2019-10-02 20:39 Tim Kourt
  2019-10-02 20:39 ` [PATCH 2/4] netconfig: Remove IPv6 default route Tim Kourt
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Tim Kourt @ 2019-10-02 20:39 UTC (permalink / raw)
  To: iwd

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

---
 src/rtnlutil.c | 31 +++++++++++++++++++++++++++++--
 src/rtnlutil.h |  7 +++++++
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/src/rtnlutil.c b/src/rtnlutil.c
index 4090d311..f90e9dcf 100644
--- a/src/rtnlutil.c
+++ b/src/rtnlutil.c
@@ -533,7 +533,8 @@ uint32_t rtnl_ifaddr_ipv6_delete(struct l_netlink *rtnl, int ifindex,
 						ip, cb, user_data, destroy);
 }
 
-uint32_t rtnl_route_ipv6_add_gateway(struct l_netlink *rtnl, int ifindex,
+static uint32_t rtnl_route_ipv6_change(struct l_netlink *rtnl,
+					uint16_t nlmsg_type, int ifindex,
 					const char *gateway,
 					uint32_t priority_offset,
 					uint8_t proto,
@@ -581,7 +582,33 @@ uint32_t rtnl_route_ipv6_add_gateway(struct l_netlink *rtnl, int ifindex,
 						sizeof(struct in6_addr));
 	}
 
-	return l_netlink_send(rtnl, RTM_NEWROUTE, flags, rtmmsg,
+	return l_netlink_send(rtnl, nlmsg_type, flags, rtmmsg,
 				rta_buf - (void *) rtmmsg, cb, user_data,
 								destroy);
 }
+
+uint32_t rtnl_route_ipv6_add_gateway(struct l_netlink *rtnl, int ifindex,
+					const char *gateway,
+					uint32_t priority_offset,
+					uint8_t proto,
+					l_netlink_command_func_t cb,
+					void *user_data,
+					l_netlink_destroy_func_t destroy)
+{
+	return rtnl_route_ipv6_change(rtnl, RTM_NEWROUTE, ifindex, gateway,
+					priority_offset, proto, cb,
+					user_data, destroy);
+}
+
+uint32_t rtnl_route_ipv6_delete_gateway(struct l_netlink *rtnl, int ifindex,
+					const char *gateway,
+					uint32_t priority_offset,
+					uint8_t proto,
+					l_netlink_command_func_t cb,
+					void *user_data,
+					l_netlink_destroy_func_t destroy)
+{
+	return rtnl_route_ipv6_change(rtnl, RTM_DELROUTE, ifindex, gateway,
+					priority_offset, proto, cb,
+					user_data, destroy);
+}
diff --git a/src/rtnlutil.h b/src/rtnlutil.h
index 6689e16e..383d562f 100644
--- a/src/rtnlutil.h
+++ b/src/rtnlutil.h
@@ -90,3 +90,10 @@ uint32_t rtnl_route_ipv6_add_gateway(struct l_netlink *rtnl, int ifindex,
 					l_netlink_command_func_t cb,
 					void *user_data,
 					l_netlink_destroy_func_t destroy);
+uint32_t rtnl_route_ipv6_delete_gateway(struct l_netlink *rtnl, int ifindex,
+					const char *gateway,
+					uint32_t priority_offset,
+					uint8_t proto,
+					l_netlink_command_func_t cb,
+					void *user_data,
+					l_netlink_destroy_func_t destroy);
-- 
2.13.6

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

end of thread, other threads:[~2019-10-03 15:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-02 20:39 [PATCH 1/4] rtnlutil: Add IPv6 route deletion helper Tim Kourt
2019-10-02 20:39 ` [PATCH 2/4] netconfig: Remove IPv6 default route Tim Kourt
2019-10-02 20:39 ` [PATCH 3/4] netconfig: Optimize IPv4 address deletion Tim Kourt
2019-10-02 20:39 ` [PATCH 4/4] netconfig: Fix return type for module init Tim Kourt
2019-10-03 15:56 ` [PATCH 1/4] rtnlutil: Add IPv6 route deletion helper Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox