diff options
| author | Bjoern A. Zeeb <bz@FreeBSD.org> | 2026-04-18 13:27:39 +0000 |
|---|---|---|
| committer | Bjoern A. Zeeb <bz@FreeBSD.org> | 2026-04-20 11:15:48 +0000 |
| commit | 395c8f0855e0039205d9cb97adec39d9b9307c8b (patch) | |
| tree | 849a9cc8e680790c4f74ea1693994abae04f8a8e | |
| parent | 4a6d7fc1a00b69925b3edc39acef0391487a8e3e (diff) | |
nfs: make no-IP kernels compile
Compiling a LINT-NOIP kernel (assumingly also a NOINET) port and ip
are set but not used in nfsrv_getclientipaddr().
Hide the variables behind #ifdef checks and do likewise for the parsing
results. Admittingly the code probably wants to be rewritten one day.
Found with: gcc15 tinderbox build
MFC after: 3 days
Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D56502
| -rw-r--r-- | sys/fs/nfsserver/nfs_nfsdstate.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index 845949b8f630..ccee9187bfec 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -4100,14 +4100,18 @@ nfsrv_getclientipaddr(struct nfsrv_descript *nd, struct nfsclient *clp) #endif u_char *addr; int error = 0, cantparse = 0; +#ifdef INET union { in_addr_t ival; u_char cval[4]; } ip; +#endif +#if defined(INET6) || defined(INET) union { in_port_t sval; u_char cval[2]; } port; +#endif /* 8 is the maximum length of the port# string. */ addr = malloc(INET6_ADDRSTRLEN + 8, M_TEMP, M_WAITOK); @@ -4243,9 +4247,15 @@ nfsrv_getclientipaddr(struct nfsrv_descript *nd, struct nfsclient *clp) j = nfsrv_getipnumber(cp); if (j >= 0) { if (i < 4) +#ifdef INET ip.cval[3 - i] = j; +#else + ; +#endif +#if defined(INET6) || defined(INET) else port.cval[5 - i] = j; +#endif } else { cantparse = 1; break; |
