aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/mountd
diff options
context:
space:
mode:
authorMike Karels <karels@FreeBSD.org>2021-10-27 03:48:23 +0000
committerMike Karels <karels@FreeBSD.org>2021-12-10 16:26:37 +0000
commite5d4e532a0dcf6c8073998848eb6e035fd18c0ca (patch)
tree3c35b860eb30daa46bc9737b06e338e7e16ff3b4 /usr.sbin/mountd
parent1ab4b70db5d06497698438215cf007f5e1d79f4d (diff)
mountd: deprecate exports to a network without mask
The exports file format allows export to a network using an explicit mask or prefix length (CIDR). It also allows a network with just a dotted address, in which case the historical mask was used. Deprecate this usage, and warn when it is used. Document that this is deprecated. (cherry picked from commit 92aebdeaff57091c77398912accb4c758c6a0fcb)
Diffstat (limited to 'usr.sbin/mountd')
-rw-r--r--usr.sbin/mountd/exports.57
-rw-r--r--usr.sbin/mountd/mountd.c5
2 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/mountd/exports.5 b/usr.sbin/mountd/exports.5
index bba10ddc7be1..d5aa49a1f428 100644
--- a/usr.sbin/mountd/exports.5
+++ b/usr.sbin/mountd/exports.5
@@ -28,7 +28,7 @@
.\" @(#)exports.5 8.3 (Berkeley) 3/29/95
.\" $FreeBSD$
.\"
-.Dd November 20, 2020
+.Dd November 9, 2021
.Dt EXPORTS 5
.Os
.Sh NAME
@@ -338,9 +338,10 @@ to the
option, or by using a separate
.Fl mask
option.
-If the mask is not specified, it will default to the mask for that network
-class (A, B or C; see
+If the mask is not specified, it will default to the historical mask
+for that network class (A, B, or C; see
.Xr inet 4 ) .
+This usage is deprecated, and will elicit a warning log message.
See the
.Sx EXAMPLES
section below.
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index 0c077b857d7e..569ea0fbf707 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -3418,6 +3418,9 @@ get_net(char *cp, struct netmsk *net, int maskflg)
(opt_flags & OP_MASK) == 0) {
in_addr_t addr;
+ syslog(LOG_WARNING,
+ "WARNING: No mask specified for %s, "
+ "using out-of-date default", name);
addr = ((struct sockaddr_in *)sa)->sin_addr.s_addr;
if (IN_CLASSA(addr))
preflen = 8;
@@ -3425,7 +3428,7 @@ get_net(char *cp, struct netmsk *net, int maskflg)
preflen = 16;
else if (IN_CLASSC(addr))
preflen = 24;
- else if (IN_CLASSD(addr))
+ else if (IN_CLASSD(addr)) /* XXX Multicast??? */
preflen = 28;
else
preflen = 32; /* XXX */