ell.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/6] rtnl: Add l_rtnl_route_get_dst
@ 2022-02-07 15:07 Andrew Zaborowski
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Zaborowski @ 2022-02-07 15:07 UTC (permalink / raw)
  To: ell

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

---
 ell/ell.sym |  1 +
 ell/rtnl.c  | 14 ++++++++++++++
 ell/rtnl.h  |  2 ++
 3 files changed, 17 insertions(+)

diff --git a/ell/ell.sym b/ell/ell.sym
index 60c5525..203a91b 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -634,6 +634,7 @@ global:
 	l_rtnl_route_free;
 	l_rtnl_route_get_family;
 	l_rtnl_route_get_gateway;
+	l_rtnl_route_get_dst;
 	l_rtnl_route_get_lifetime;
 	l_rtnl_route_set_lifetime;
 	l_rtnl_route_get_mtu;
diff --git a/ell/rtnl.c b/ell/rtnl.c
index dda27cf..5f0940b 100644
--- a/ell/rtnl.c
+++ b/ell/rtnl.c
@@ -410,6 +410,20 @@ LIB_EXPORT bool l_rtnl_route_get_gateway(const struct l_rtnl_route *rt,
 					out_buf);
 }
 
+LIB_EXPORT bool l_rtnl_route_get_dst(const struct l_rtnl_route *rt, char *out_buf,
+					uint8_t *out_prefix_len)
+{
+	if (unlikely(!rt))
+		return false;
+
+	if (address_to_string(rt->family, &rt->dst.in_addr, &rt->dst.in6_addr,
+					out_buf) != 0)
+		return false;
+
+	*out_prefix_len = rt->dst_prefix_len;
+	return true;
+}
+
 LIB_EXPORT uint32_t l_rtnl_route_get_lifetime(const struct l_rtnl_route *rt,
 						uint64_t reference_time)
 {
diff --git a/ell/rtnl.h b/ell/rtnl.h
index 8028d8d..1e232df 100644
--- a/ell/rtnl.h
+++ b/ell/rtnl.h
@@ -72,6 +72,8 @@ void l_rtnl_route_free(struct l_rtnl_route *rt);
 DEFINE_CLEANUP_FUNC(l_rtnl_route_free);
 uint8_t l_rtnl_route_get_family(const struct l_rtnl_route *rt);
 bool l_rtnl_route_get_gateway(const struct l_rtnl_route *rt, char *out_buf);
+bool l_rtnl_route_get_dst(const struct l_rtnl_route *rt, char *out_buf,
+				uint8_t *out_prefix_len);
 uint32_t l_rtnl_route_get_lifetime(const struct l_rtnl_route *rt,
 					uint64_t reference_time);
 bool l_rtnl_route_set_lifetime(struct l_rtnl_route *rt, uint32_t lt,
-- 
2.32.0

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

* Re: [PATCH 2/6] rtnl: Add l_rtnl_route_get_dst
@ 2022-02-08 17:34 Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2022-02-08 17:34 UTC (permalink / raw)
  To: ell

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

Hi Andrew,

On 2/7/22 09:07, Andrew Zaborowski wrote:
> ---
>   ell/ell.sym |  1 +
>   ell/rtnl.c  | 14 ++++++++++++++
>   ell/rtnl.h  |  2 ++
>   3 files changed, 17 insertions(+)

I went ahead and applied this patch after some formatting changes.  Also patch 3.

Regards,
-Denis

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

end of thread, other threads:[~2022-02-08 17:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07 15:07 [PATCH 2/6] rtnl: Add l_rtnl_route_get_dst Andrew Zaborowski
2022-02-08 17:34 Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).