Index | Thread | Search

From:
David Gwynne <david@gwynne.id.au>
Subject:
ether_ntoa(3): make the argument const
To:
tech@openbsd.org
Date:
Mon, 23 Jun 2025 15:07:25 +1000

Download raw body.

Thread
this drives me nuts when i want to print something out of what's already
const. casting it works, but feels gross.

i dont know what the abi/api version issues for this would be though.

ok?

Index: sys/netinet/if_ether.h
===================================================================
RCS file: /cvs/src/sys/netinet/if_ether.h,v
diff -u -p -r1.94 if_ether.h
--- sys/netinet/if_ether.h	2 Mar 2025 21:28:32 -0000	1.94
+++ sys/netinet/if_ether.h	23 Jun 2025 05:05:05 -0000
@@ -388,7 +388,7 @@ u_int32_t ether_crc32_be(const u_int8_t 
 #else /* _KERNEL */
 
 __BEGIN_DECLS
-char *ether_ntoa(struct ether_addr *);
+char *ether_ntoa(const struct ether_addr *);
 struct ether_addr *ether_aton(const char *);
 int ether_ntohost(char *, struct ether_addr *);
 int ether_hostton(const char *, struct ether_addr *);
Index: lib/libc/net/ethers.c
===================================================================
RCS file: /cvs/src/lib/libc/net/ethers.c,v
diff -u -p -r1.27 ethers.c
--- lib/libc/net/ethers.c	25 Jan 2019 00:19:25 -0000	1.27
+++ lib/libc/net/ethers.c	23 Jun 2025 05:05:05 -0000
@@ -42,7 +42,7 @@
 static char * _ether_aton(const char *, struct ether_addr *);
 
 char *
-ether_ntoa(struct ether_addr *e)
+ether_ntoa(const struct ether_addr *e)
 {
 	static char a[] = "xx:xx:xx:xx:xx:xx";