From de9677fd63a48ae79f4bf625d6df0d5de7b4fe4f Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 18 Oct 2024 04:30:10 +0000 Subject: remove addr.[ch] functions that are unused and visbility-restrict ones that are unused outside the implementation itself; based on GHPR#282 by tobias@ --- usr.bin/ssh/addr.c | 22 ++++++++++++---------- usr.bin/ssh/addr.h | 11 ----------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/usr.bin/ssh/addr.c b/usr.bin/ssh/addr.c index e83c1cfc298..9ed122aaa13 100644 --- a/usr.bin/ssh/addr.c +++ b/usr.bin/ssh/addr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: addr.c,v 1.8 2024/04/02 09:29:31 deraadt Exp $ */ +/* $OpenBSD: addr.c,v 1.9 2024/10/18 04:30:09 djm Exp $ */ /* * Copyright (c) 2004-2008 Damien Miller @@ -31,7 +31,7 @@ #define _SA(x) ((struct sockaddr *)(x)) -int +static int addr_unicast_masklen(int af) { switch (af) { @@ -57,7 +57,7 @@ masklen_valid(int af, u_int masklen) } } -int +static int addr_xaddr_to_sa(const struct xaddr *xa, struct sockaddr *sa, socklen_t *len, u_int16_t port) { @@ -134,7 +134,7 @@ addr_sa_to_xaddr(struct sockaddr *sa, socklen_t slen, struct xaddr *xa) return 0; } -int +static int addr_invert(struct xaddr *n) { int i; @@ -189,7 +189,7 @@ addr_netmask(int af, u_int l, struct xaddr *n) } } -int +static int addr_hostmask(int af, u_int l, struct xaddr *n) { if (addr_netmask(af, l, n) == -1 || addr_invert(n) == -1) @@ -224,7 +224,7 @@ addr_and(struct xaddr *dst, const struct xaddr *a, const struct xaddr *b) } } -int +static int addr_or(struct xaddr *dst, const struct xaddr *a, const struct xaddr *b) { int i; @@ -279,7 +279,7 @@ addr_cmp(const struct xaddr *a, const struct xaddr *b) } } -int +static int addr_is_all0s(const struct xaddr *a) { int i; @@ -326,7 +326,7 @@ addr_increment(struct xaddr *a) * Returns 0 if host portion of address is all-zeros, * -1 if not all zeros or on failure. */ -int +static int addr_host_is_all0s(const struct xaddr *a, u_int masklen) { struct xaddr tmp_addr, tmp_mask, tmp_result; @@ -340,7 +340,7 @@ addr_host_is_all0s(const struct xaddr *a, u_int masklen) } #if 0 -int +static int addr_host_to_all0s(struct xaddr *a, u_int masklen) { struct xaddr tmp_mask; @@ -398,7 +398,8 @@ addr_pton(const char *p, struct xaddr *n) return 0; } -int +#if 0 +static int addr_sa_pton(const char *h, const char *s, struct sockaddr *sa, socklen_t slen) { struct addrinfo hints, *ai; @@ -428,6 +429,7 @@ addr_sa_pton(const char *h, const char *s, struct sockaddr *sa, socklen_t slen) freeaddrinfo(ai); return 0; } +#endif int addr_ntop(const struct xaddr *n, char *p, size_t len) diff --git a/usr.bin/ssh/addr.h b/usr.bin/ssh/addr.h index 180e9fdc644..29438dfecf2 100644 --- a/usr.bin/ssh/addr.h +++ b/usr.bin/ssh/addr.h @@ -39,24 +39,13 @@ struct xaddr { #define addr32 xa.addr32 }; -int addr_unicast_masklen(int af); -int addr_xaddr_to_sa(const struct xaddr *xa, struct sockaddr *sa, - socklen_t *len, u_int16_t port); int addr_sa_to_xaddr(struct sockaddr *sa, socklen_t slen, struct xaddr *xa); int addr_netmask(int af, u_int l, struct xaddr *n); -int addr_hostmask(int af, u_int l, struct xaddr *n); -int addr_invert(struct xaddr *n); int addr_pton(const char *p, struct xaddr *n); -int addr_sa_pton(const char *h, const char *s, struct sockaddr *sa, - socklen_t slen); int addr_pton_cidr(const char *p, struct xaddr *n, u_int *l); int addr_ntop(const struct xaddr *n, char *p, size_t len); int addr_and(struct xaddr *dst, const struct xaddr *a, const struct xaddr *b); -int addr_or(struct xaddr *dst, const struct xaddr *a, const struct xaddr *b); int addr_cmp(const struct xaddr *a, const struct xaddr *b); -int addr_is_all0s(const struct xaddr *n); -int addr_host_is_all0s(const struct xaddr *n, u_int masklen); -int addr_host_to_all0s(struct xaddr *a, u_int masklen); int addr_host_to_all1s(struct xaddr *a, u_int masklen); int addr_netmatch(const struct xaddr *host, const struct xaddr *net, u_int masklen); -- cgit v1.2.3