diff options
author | andre <andre@FreeBSD.org> | 2006-02-18 17:16:18 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2006-02-18 17:16:18 +0000 |
commit | 6f25a951392d9da6e7c7603e3ac5f6887a808328 (patch) | |
tree | 6c594df5859b7264d04576d77ddafc68c86be436 /sys/kern | |
parent | a8296c797205758f4716e8554c70740ae7decab8 (diff) | |
download | FreeBSD-src-6f25a951392d9da6e7c7603e3ac5f6887a808328.zip FreeBSD-src-6f25a951392d9da6e7c7603e3ac5f6887a808328.tar.gz |
The sysctls kern.ipc.[max_linkhdr|max_protohdr|max_hdr|max_datalen]
can't be changed from userland. Make them read-only and provide
descriptions.
kern.ipc.max_datalen must never be less than one byte. Enforce this
with a panic in net_init_domain().
Sponsored by: TCP/IP Optimization Fundraise 2005
MFC after: 3 days
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/uipc_domain.c | 2 | ||||
-rw-r--r-- | sys/kern/uipc_mbuf.c | 15 |
2 files changed, 10 insertions, 7 deletions
diff --git a/sys/kern/uipc_domain.c b/sys/kern/uipc_domain.c index bb0be74..7a26ff5 100644 --- a/sys/kern/uipc_domain.c +++ b/sys/kern/uipc_domain.c @@ -149,6 +149,8 @@ net_init_domain(struct domain *dp) */ max_hdr = max_linkhdr + max_protohdr; max_datalen = MHLEN - max_hdr; + if (max_datalen < 1) + panic("%s: max_datalen < 1", __func__); } /* diff --git a/sys/kern/uipc_mbuf.c b/sys/kern/uipc_mbuf.c index bed8cdd..d2b1130 100644 --- a/sys/kern/uipc_mbuf.c +++ b/sys/kern/uipc_mbuf.c @@ -65,13 +65,14 @@ int m_defragrandomfailures; * sysctl(8) exported objects */ SYSCTL_DECL(_kern_ipc); -SYSCTL_INT(_kern_ipc, KIPC_MAX_LINKHDR, max_linkhdr, CTLFLAG_RW, - &max_linkhdr, 0, ""); -SYSCTL_INT(_kern_ipc, KIPC_MAX_PROTOHDR, max_protohdr, CTLFLAG_RW, - &max_protohdr, 0, ""); -SYSCTL_INT(_kern_ipc, KIPC_MAX_HDR, max_hdr, CTLFLAG_RW, &max_hdr, 0, ""); -SYSCTL_INT(_kern_ipc, KIPC_MAX_DATALEN, max_datalen, CTLFLAG_RW, - &max_datalen, 0, ""); +SYSCTL_INT(_kern_ipc, KIPC_MAX_LINKHDR, max_linkhdr, CTLFLAG_RD, + &max_linkhdr, 0, "Size of largest link layer header"); +SYSCTL_INT(_kern_ipc, KIPC_MAX_PROTOHDR, max_protohdr, CTLFLAG_RD, + &max_protohdr, 0, "Size of largest protocol layer header"); +SYSCTL_INT(_kern_ipc, KIPC_MAX_HDR, max_hdr, CTLFLAG_RD, + &max_hdr, 0, "Size of largest link plus protocol header"); +SYSCTL_INT(_kern_ipc, KIPC_MAX_DATALEN, max_datalen, CTLFLAG_RD, + &max_datalen, 0, "Minimum space left in mbuf after max_hdr"); #ifdef MBUF_STRESS_TEST SYSCTL_INT(_kern_ipc, OID_AUTO, m_defragpackets, CTLFLAG_RD, &m_defragpackets, 0, ""); |