[DTrace-devel] [PATCH] bpf: dt_inet_ntoa() should return the length of its result

Kris Van Hees kris.van.hees at oracle.com
Fri Jul 21 18:00:01 UTC 2023


The implementation of inet_ntoa6() and inet_ntop() is greatly helped if
dt_inet_ntoa() returns the number of characters in its result.  Thid
change is not visible to users.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 bpf/inet_ntoa.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bpf/inet_ntoa.S b/bpf/inet_ntoa.S
index 1ef3b13a..08b63b8d 100644
--- a/bpf/inet_ntoa.S
+++ b/bpf/inet_ntoa.S
@@ -114,7 +114,7 @@ dt_inet_ntoa_write_uint8:
 #undef PTR
 
 /*
- * void dt_inet_ntoa(uint8_t *src, char *dst) {
+ * uint64_t dt_inet_ntoa(uint8_t *src, char *dst) {
  *     uint64_t off, inp, len;
  *
  *     bpf_probe_read(fp + -4, 4, src);
@@ -142,6 +142,8 @@ dt_inet_ntoa_write_uint8:
  *
  *     done:
  *     dst[off] = '\0';
+ *
+ *     return off;
  * }
  *
  */
-- 
2.39.3




More information about the DTrace-devel mailing list