Author: hiren
Date: Thu Jan  5 17:22:09 2017
New Revision: 311453
URL: https://svnweb.freebsd.org/changeset/base/311453

Log:
  sysctl net.inet.tcp.hostcache.list in a jail can see connections from other
  jails and the host. This commit fixes it.
  
  PR:           200361
  Submitted by: bz (original version), hiren (minor corrections)
  Reported by:  Marcus Reid <marcus at blazingdot dot com>
  Reviewed by:  bz, gnn
  Tested by:    Lohith Bellad <lohithbsd at gmail dot com>
  MFC after:    1 week
  Sponsored by: Limelight Networks (minor corrections)

Modified:
  head/sys/netinet/tcp_hostcache.c

Modified: head/sys/netinet/tcp_hostcache.c
==============================================================================
--- head/sys/netinet/tcp_hostcache.c    Thu Jan  5 17:19:26 2017        
(r311452)
+++ head/sys/netinet/tcp_hostcache.c    Thu Jan  5 17:22:09 2017        
(r311453)
@@ -69,10 +69,12 @@ __FBSDID("$FreeBSD$");
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/jail.h>
 #include <sys/kernel.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/malloc.h>
+#include <sys/proc.h>
 #include <sys/sbuf.h>
 #include <sys/socket.h>
 #include <sys/socketvar.h>
@@ -625,6 +627,9 @@ sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS)
        char ip6buf[INET6_ADDRSTRLEN];
 #endif
 
+       if (jailed_without_vnet(curthread->td_ucred) != 0)
+               return (EPERM);
+
        sbuf_new(&sb, NULL, linesize * (V_tcp_hostcache.cache_count + 1),
                SBUF_INCLUDENUL);
 
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to