svn commit: r298532 - head/share/man/man9
Author: brueffer Date: Sun Apr 24 08:31:32 2016 New Revision: 298532 URL: https://svnweb.freebsd.org/changeset/base/298532 Log: Correct types for g_example_start() and g_example_access(). PR: 203498 Submitted by: ch...@triularity.org, ae MFC after:1 week Sponsored by: Essen Hackathon 2016 Modified: head/share/man/man9/g_geom.9 Modified: head/share/man/man9/g_geom.9 == --- head/share/man/man9/g_geom.9Sun Apr 24 04:28:04 2016 (r298531) +++ head/share/man/man9/g_geom.9Sun Apr 24 08:31:32 2016 (r298532) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 16, 2004 +.Dd April 24, 2016 .Dt G_GEOM 9 .Os .Sh NAME @@ -123,7 +123,7 @@ returns a pointer to the newly created g .Sh EXAMPLES Create an example geom. .Bd -literal -offset indent -static struct geom * +static void g_example_start(struct bio *bp) { @@ -148,7 +148,7 @@ g_example_spoiled(struct g_consumer *cp) [...] } -static void +static int g_example_access(struct g_provider *pp, int dr, int dw, int de) { ___ 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"
svn commit: r298535 - head/sys/netipsec
Author: ae Date: Sun Apr 24 09:02:17 2016 New Revision: 298535 URL: https://svnweb.freebsd.org/changeset/base/298535 Log: Handle non-compressed packets for IPComp in tunnel mode. RFC3173 says that the IP datagram MUST be sent in the original non-compressed form, when the total size of a compressed payload and the IPComp header is not smaller than the size of the original payload. In tunnel mode for small packets IPComp will send encapsulated IP datagrams without IPComp header. Add ip_encap handler for IPPROTO_IPV4 and IPPROTO_IPV6 to handle these datagrams. The handler does lookup for SA related to IPComp protocol and given from mbuf source and destination addresses as tunnel endpoints. It decapsulates packets only when corresponding SA is found. Reported by: gnn Reviewed by: gnn Differential Revision:https://reviews.freebsd.org/D6062 Modified: head/sys/netipsec/key.c head/sys/netipsec/key.h head/sys/netipsec/xform_ipcomp.c Modified: head/sys/netipsec/key.c == --- head/sys/netipsec/key.c Sun Apr 24 08:45:43 2016(r298534) +++ head/sys/netipsec/key.c Sun Apr 24 09:02:17 2016(r298535) @@ -1158,6 +1158,66 @@ done: return sav; } +struct secasvar * +key_allocsa_tunnel(union sockaddr_union *src, union sockaddr_union *dst, +u_int proto, const char* where, int tag) +{ + struct secashead *sah; + struct secasvar *sav; + u_int stateidx, arraysize, state; + const u_int *saorder_state_valid; + + IPSEC_ASSERT(src != NULL, ("null src address")); + IPSEC_ASSERT(dst != NULL, ("null dst address")); + KEYDEBUG(KEYDEBUG_IPSEC_STAMP, + printf("DP %s from %s:%u\n", __func__, where, tag)); + + SAHTREE_LOCK(); + if (V_key_preferred_oldsa) { + saorder_state_valid = saorder_state_valid_prefer_old; + arraysize = _ARRAYLEN(saorder_state_valid_prefer_old); + } else { + saorder_state_valid = saorder_state_valid_prefer_new; + arraysize = _ARRAYLEN(saorder_state_valid_prefer_new); + } + LIST_FOREACH(sah, &V_sahtree, chain) { + /* search valid state */ + for (stateidx = 0; stateidx < arraysize; stateidx++) { + state = saorder_state_valid[stateidx]; + LIST_FOREACH(sav, &sah->savtree[state], chain) { + /* sanity check */ + KEY_CHKSASTATE(sav->state, state, __func__); + /* do not return entries w/ unusable state */ + if (sav->state != SADB_SASTATE_MATURE && + sav->state != SADB_SASTATE_DYING) + continue; + if (IPSEC_MODE_TUNNEL != sav->sah->saidx.mode) + continue; + if (proto != sav->sah->saidx.proto) + continue; + /* check src address */ + if (key_sockaddrcmp(&src->sa, + &sav->sah->saidx.src.sa, 0) != 0) + continue; + /* check dst address */ + if (key_sockaddrcmp(&dst->sa, + &sav->sah->saidx.dst.sa, 0) != 0) + continue; + sa_addref(sav); + goto done; + } + } + } + sav = NULL; +done: + SAHTREE_UNLOCK(); + + KEYDEBUG(KEYDEBUG_IPSEC_STAMP, + printf("DP %s return SA:%p; refcnt %u\n", __func__, + sav, sav ? sav->refcnt : 0)); + return (sav); +} + /* * Must be called after calling key_allocsp(). * For both the packet without socket and key_freeso(). Modified: head/sys/netipsec/key.h == --- head/sys/netipsec/key.h Sun Apr 24 08:45:43 2016(r298534) +++ head/sys/netipsec/key.h Sun Apr 24 09:02:17 2016(r298535) @@ -76,11 +76,15 @@ extern void _key_freesp(struct secpolicy extern struct secasvar *key_allocsa(union sockaddr_union *, u_int, u_int32_t, const char*, int); +extern struct secasvar *key_allocsa_tunnel(union sockaddr_union *, +union sockaddr_union *, u_int, const char*, int); extern void key_addrefsa(struct secasvar *, const char*, int); extern void key_freesav(struct secasvar **, const char*, int); #defineKEY_ALLOCSA(dst, proto, spi)\ key_allocsa(dst, proto, spi, __FILE__, __LINE__) +#defineKEY_ALLOCSA_TUNNEL(src, dst, proto)
svn commit: r298536 - head/sys/netipsec
Author: ae Date: Sun Apr 24 09:05:29 2016 New Revision: 298536 URL: https://svnweb.freebsd.org/changeset/base/298536 Log: Use ipsec_address() function to print IP addresses. Modified: head/sys/netipsec/key_debug.c Modified: head/sys/netipsec/key_debug.c == --- head/sys/netipsec/key_debug.c Sun Apr 24 09:02:17 2016 (r298535) +++ head/sys/netipsec/key_debug.c Sun Apr 24 09:05:29 2016 (r298536) @@ -506,6 +506,8 @@ kdebug_secpolicy(struct secpolicy *sp) void kdebug_secpolicyindex(struct secpolicyindex *spidx) { + char buf[INET6_ADDRSTRLEN]; + /* sanity check */ if (spidx == NULL) panic("%s: NULL pointer was passed.\n", __func__); @@ -513,19 +515,15 @@ kdebug_secpolicyindex(struct secpolicyin printf("secpolicyindex{ dir=%u prefs=%u prefd=%u ul_proto=%u\n", spidx->dir, spidx->prefs, spidx->prefd, spidx->ul_proto); - ipsec_hexdump((caddr_t)&spidx->src, - ((struct sockaddr *)&spidx->src)->sa_len); - printf("\n"); - ipsec_hexdump((caddr_t)&spidx->dst, - ((struct sockaddr *)&spidx->dst)->sa_len); - printf("}\n"); - - return; + printf("%s -> ", ipsec_address(&spidx->src, buf, sizeof(buf))); + printf("%s }\n", ipsec_address(&spidx->dst, buf, sizeof(buf))); } void kdebug_secasindex(struct secasindex *saidx) { + char buf[INET6_ADDRSTRLEN]; + /* sanity check */ if (saidx == NULL) panic("%s: NULL pointer was passed.\n", __func__); @@ -533,14 +531,8 @@ kdebug_secasindex(struct secasindex *sai printf("secasindex{ mode=%u proto=%u\n", saidx->mode, saidx->proto); - ipsec_hexdump((caddr_t)&saidx->src, - ((struct sockaddr *)&saidx->src)->sa_len); - printf("\n"); - ipsec_hexdump((caddr_t)&saidx->dst, - ((struct sockaddr *)&saidx->dst)->sa_len); - printf("\n"); - - return; + printf("%s -> ", ipsec_address(&saidx->src, buf, sizeof(buf))); + printf("%s }\n", ipsec_address(&saidx->dst, buf, sizeof(buf))); } static void ___ 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"
svn commit: r298537 - head/etc/rc.d
Author: schweikh Date: Sun Apr 24 10:52:59 2016 New Revision: 298537 URL: https://svnweb.freebsd.org/changeset/base/298537 Log: Cosmetics: - no need to escape the newline after '|' - parenthesize the "case" string for symmetry and improved search for matching paren (e.g. with vi's %) Modified: head/etc/rc.d/zvol Modified: head/etc/rc.d/zvol == --- head/etc/rc.d/zvol Sun Apr 24 09:05:29 2016(r298536) +++ head/etc/rc.d/zvol Sun Apr 24 10:52:59 2016(r298537) @@ -19,10 +19,10 @@ required_modules="zfs" zvol_start() { # Enable swap on ZVOLs with property org.freebsd:swap=on. - zfs list -H -o org.freebsd:swap,name -t volume | \ + zfs list -H -o org.freebsd:swap,name -t volume | while read state name; do case "${state}" in - [oO][nN]) + ([oO][nN]) swapon /dev/zvol/${name} ;; esac @@ -32,10 +32,10 @@ zvol_start() zvol_stop() { # Disable swap on ZVOLs with property org.freebsd:swap=on. - zfs list -H -o org.freebsd:swap,name -t volume | \ + zfs list -H -o org.freebsd:swap,name -t volume | while read state name; do case "${state}" in - [oO][nN]) + ([oO][nN]) swapoff /dev/zvol/${name} ;; esac ___ 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"
svn commit: r298538 - head/share/man/man4
Author: brueffer Date: Sun Apr 24 11:41:36 2016 New Revision: 298538 URL: https://svnweb.freebsd.org/changeset/base/298538 Log: MLINK mfi.4 to mfi_linux.4 and mfip.4 to cover these kernel modules. The mfi(4) manpage doesn't explain the modules yet, but at least we direct users to the right place. PR: 205925 Submitted by: dvl MFC after:1 week Sponsored by: Essen Hackathon 2016 Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile == --- head/share/man/man4/MakefileSun Apr 24 10:52:59 2016 (r298537) +++ head/share/man/man4/MakefileSun Apr 24 11:41:36 2016 (r298538) @@ -660,6 +660,8 @@ MLINKS+=lp.4 plip.4 MLINKS+=malo.4 if_malo.4 MLINKS+=md.4 vn.4 MLINKS+=mem.4 kmem.4 +MLINKS+=mfi.4 mfi_linux.4 \ + mfi.4 mfip.4 MLINKS+=mlx5en.4 mce.4 MLINKS+=mn.4 if_mn.4 MLINKS+=mos.4 if_mos.4 ___ 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"
svn commit: r298539 - head/etc/rc.d
Author: se Date: Sun Apr 24 12:07:44 2016 New Revision: 298539 URL: https://svnweb.freebsd.org/changeset/base/298539 Log: Fix typo (forgotten "=" after desc). Modified: head/etc/rc.d/ccd Modified: head/etc/rc.d/ccd == --- head/etc/rc.d/ccd Sun Apr 24 11:41:36 2016(r298538) +++ head/etc/rc.d/ccd Sun Apr 24 12:07:44 2016(r298539) @@ -9,7 +9,7 @@ . /etc/rc.subr name="ccd" -desc"Concatenated disks setup" +desc="Concatenated disks setup" start_cmd="ccd_start" stop_cmd=":" ___ 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"
svn commit: r298542 - head/share/misc
Author: manu Date: Sun Apr 24 14:49:01 2016 New Revision: 298542 URL: https://svnweb.freebsd.org/changeset/base/298542 Log: Add myself as src commiter. Approved by: cognet (mentor) Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot == --- head/share/misc/committers-src.dot Sun Apr 24 13:19:30 2016 (r298541) +++ head/share/misc/committers-src.dot Sun Apr 24 14:49:01 2016 (r298542) @@ -222,6 +222,7 @@ le [label="Lukas Ertl\n...@freebsd.org\n2 lidl [label="Kurt Lidl\nl...@freebsd.org\n2015/10/21"] loos [label="Luiz Otavio O Souza\nl...@freebsd.org\n2013/07/03"] lstewart [label="Lawrence Stewart\nlstew...@freebsd.org\n2008/10/06"] +manu [label="Emmanuel Vadot\nm...@freebsd.org\n2016/04/24"] marcel [label="Marcel Moolenaar\nmar...@freebsd.org\n1999/07/03"] marius [label="Marius Strobl\nmar...@freebsd.org\n2004/04/17"] markj [label="Mark Johnston\nma...@freebsd.org\n2012/12/18"] @@ -358,6 +359,8 @@ alc -> davide andre -> qingli +andrew -> manu + anholt -> jkim avg -> art @@ -396,6 +399,7 @@ cognet -> br cognet -> jceel cognet -> kevlo cognet -> ian +cognet -> manu cognet -> wkoszek cognet -> wma cognet -> zbb ___ 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"
Re: svn commit: r298535 - head/sys/netipsec
> On 24 Apr 2016, at 09:02 , Andrey V. Elsukov wrote: > > Author: ae > Date: Sun Apr 24 09:02:17 2016 > New Revision: 298535 > URL: https://svnweb.freebsd.org/changeset/base/298535 > > Log: > Handle non-compressed packets for IPComp in tunnel mode. > > RFC3173 says that the IP datagram MUST be sent in the original > non-compressed form, when the total size of a compressed payload > and the IPComp header is not smaller than the size of the original > payload. In tunnel mode for small packets IPComp will send > encapsulated IP datagrams without IPComp header. > Add ip_encap handler for IPPROTO_IPV4 and IPPROTO_IPV6 to handle > these datagrams. The handler does lookup for SA related to IPComp > protocol and given from mbuf source and destination addresses as > tunnel endpoints. It decapsulates packets only when corresponding SA > is found. > > Reported by: gnn > Reviewed by: gnn > Differential Revision: https://reviews.freebsd.org/D6062 For one this breaks NOINET kernels, for the other > static void > ipcomp_attach(void) > { > > +#ifdef INET > + ipe4_cookie = encap_attach_func(AF_INET, IPPROTO_IPV4, > + ipcomp4_nonexp_encapcheck, &ipcomp_protosw, NULL); > +#endif > +#ifdef INET6 > + ipe6_cookie = encap_attach_func(AF_INET6, IPPROTO_IPV6, > + ipcomp6_nonexp_encapcheck, &ipcomp_protosw, NULL); This looks wrong to me but also with regards to NOINET kernels won’t compile. > +#endif > xform_register(&ipcomp_xformsw); > } > > -SYSINIT(ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, > ipcomp_attach, NULL); > +SYSINIT(ipcomp_xform_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_MIDDLE, > +ipcomp_attach, NULL); > — Bjoern A. Zeeb Charles Haddon Spurgeon: "Friendship is one of the sweetest joys of life. Many might have failed beneath the bitterness of their trial had they not found a friend." ___ 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"
svn commit: r298543 - head/sys/ofed/drivers/infiniband/core
Author: bz Date: Sun Apr 24 15:56:05 2016 New Revision: 298543 URL: https://svnweb.freebsd.org/changeset/base/298543 Log: Fix NOIP kernels to compile. Modified: head/sys/ofed/drivers/infiniband/core/cma.c Modified: head/sys/ofed/drivers/infiniband/core/cma.c == --- head/sys/ofed/drivers/infiniband/core/cma.c Sun Apr 24 14:49:01 2016 (r298542) +++ head/sys/ofed/drivers/infiniband/core/cma.c Sun Apr 24 15:56:05 2016 (r298543) @@ -2319,6 +2319,7 @@ static int cma_bind_addr(struct rdma_cm_ if (!cma_any_addr(src_addr)) return rdma_bind_addr(id, src_addr); else { +#if defined(INET6) || defined(INET) union { #ifdef INET struct sockaddr_in in; @@ -2327,6 +2328,7 @@ static int cma_bind_addr(struct rdma_cm_ struct sockaddr_in6 in6; #endif } addr; +#endif switch(dst_addr->sa_family) { #ifdef INET ___ 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"
Re: svn commit: r298535 - head/sys/netipsec
On 24.04.16 18:55, Bjoern A. Zeeb wrote: >> +#ifdef INET >> +ipe4_cookie = encap_attach_func(AF_INET, IPPROTO_IPV4, >> +ipcomp4_nonexp_encapcheck, &ipcomp_protosw, NULL); >> +#endif >> +#ifdef INET6 >> +ipe6_cookie = encap_attach_func(AF_INET6, IPPROTO_IPV6, >> +ipcomp6_nonexp_encapcheck, &ipcomp_protosw, NULL); > > This looks wrong to me but also with regards to NOINET kernels won’t compile. Thanks, I'll fix NOINET kernels, but what wrong here? -- WBR, Andrey V. Elsukov signature.asc Description: OpenPGP digital signature
Re: svn commit: r298535 - head/sys/netipsec
On 24.04.16 19:02, Andrey V. Elsukov wrote: > On 24.04.16 18:55, Bjoern A. Zeeb wrote: >>> +#ifdef INET >>> + ipe4_cookie = encap_attach_func(AF_INET, IPPROTO_IPV4, >>> + ipcomp4_nonexp_encapcheck, &ipcomp_protosw, NULL); >>> +#endif >>> +#ifdef INET6 >>> + ipe6_cookie = encap_attach_func(AF_INET6, IPPROTO_IPV6, >>> + ipcomp6_nonexp_encapcheck, &ipcomp_protosw, NULL); >> >> This looks wrong to me but also with regards to NOINET kernels won’t compile. > > Thanks, I'll fix NOINET kernels, but what wrong here? I think I understand what you mean. I will fix, thanks again. -- WBR, Andrey V. Elsukov signature.asc Description: OpenPGP digital signature
Re: svn commit: r298537 - head/etc/rc.d
Jens Schweikhardt writes: > - parenthesize the "case" string for symmetry and improved >search for matching paren (e.g. with vi's %) [...] > case "${state}" in > - [oO][nN]) > + ([oO][nN]) > swapon /dev/zvol/${name} > ;; For style consistency is more important. Why this case is special unlike the rest of rc.d/* or rc.subr ? signature.asc Description: PGP signature
svn commit: r298549 - head/sys/netipsec
Author: ae Date: Sun Apr 24 17:09:51 2016 New Revision: 298549 URL: https://svnweb.freebsd.org/changeset/base/298549 Log: Fix build for NOINET and NOINET6 kernels. Use own protosw structures for both address families. Check proto in encapcheck function and use -1 as proto argument in encap_attach_func(), both address families can have IPPROTO_IPV4 and IPPROTO_IPV6 protocols. Reported by: bz Modified: head/sys/netipsec/xform_ipcomp.c Modified: head/sys/netipsec/xform_ipcomp.c == --- head/sys/netipsec/xform_ipcomp.cSun Apr 24 16:41:54 2016 (r298548) +++ head/sys/netipsec/xform_ipcomp.cSun Apr 24 17:09:51 2016 (r298549) @@ -50,7 +50,6 @@ #include #include -#include #include #include @@ -58,6 +57,7 @@ #ifdef INET6 #include +#include #include #endif @@ -65,7 +65,6 @@ #include #include -#include #include #include @@ -101,7 +100,6 @@ ipcomp_algorithm_lookup(int alg) return NULL; } -#if defined(INET) || defined(INET6) /* * RFC 3173 p 2.2. Non-Expansion Policy: * If the total size of a compressed payload and the IPComp header, as @@ -157,19 +155,6 @@ ipcomp_nonexp_input(struct mbuf **mp, in return (IPPROTO_DONE); } -extern struct domain inetdomain; -static struct protosw ipcomp_protosw = { - .pr_type = SOCK_RAW, - .pr_domain =&inetdomain, - .pr_protocol = 0 /* IPPROTO_IPV[46] */, - .pr_flags = PR_ATOMIC | PR_ADDR | PR_LASTHDR, - .pr_input = ipcomp_nonexp_input, - .pr_output =rip_output, - .pr_ctloutput = rip_ctloutput, - .pr_usrreqs = &rip_usrreqs -}; -#endif /* INET || INET6 */ - /* * ipcomp_init() is called when an CPI is being set up. */ @@ -702,6 +687,18 @@ static struct xformsw ipcomp_xformsw = { #ifdef INET static const struct encaptab *ipe4_cookie = NULL; +extern struct domain inetdomain; +static struct protosw ipcomp4_protosw = { + .pr_type = SOCK_RAW, + .pr_domain =&inetdomain, + .pr_protocol = 0 /* IPPROTO_IPV[46] */, + .pr_flags = PR_ATOMIC | PR_ADDR | PR_LASTHDR, + .pr_input = ipcomp_nonexp_input, + .pr_output =rip_output, + .pr_ctloutput = rip_ctloutput, + .pr_usrreqs = &rip_usrreqs +}; + static int ipcomp4_nonexp_encapcheck(const struct mbuf *m, int off, int proto, void *arg __unused) @@ -711,6 +708,8 @@ ipcomp4_nonexp_encapcheck(const struct m if (V_ipcomp_enable == 0) return (0); + if (proto != IPPROTO_IPV4 && proto != IPPROTO_IPV6) + return (0); bzero(&src, sizeof(src)); bzero(&dst, sizeof(dst)); src.sa.sa_family = dst.sa.sa_family = AF_INET; @@ -723,6 +722,18 @@ ipcomp4_nonexp_encapcheck(const struct m #endif #ifdef INET6 static const struct encaptab *ipe6_cookie = NULL; +extern struct domain inet6domain; +static struct protosw ipcomp6_protosw = { + .pr_type = SOCK_RAW, + .pr_domain =&inet6domain, + .pr_protocol = 0 /* IPPROTO_IPV[46] */, + .pr_flags = PR_ATOMIC | PR_ADDR | PR_LASTHDR, + .pr_input = ipcomp_nonexp_input, + .pr_output =rip6_output, + .pr_ctloutput = rip6_ctloutput, + .pr_usrreqs = &rip6_usrreqs +}; + static int ipcomp6_nonexp_encapcheck(const struct mbuf *m, int off, int proto, void *arg __unused) @@ -732,6 +743,8 @@ ipcomp6_nonexp_encapcheck(const struct m if (V_ipcomp_enable == 0) return (0); + if (proto != IPPROTO_IPV4 && proto != IPPROTO_IPV6) + return (0); bzero(&src, sizeof(src)); bzero(&dst, sizeof(dst)); src.sa.sa_family = dst.sa.sa_family = AF_INET; @@ -760,12 +773,12 @@ ipcomp_attach(void) { #ifdef INET - ipe4_cookie = encap_attach_func(AF_INET, IPPROTO_IPV4, - ipcomp4_nonexp_encapcheck, &ipcomp_protosw, NULL); + ipe4_cookie = encap_attach_func(AF_INET, -1, + ipcomp4_nonexp_encapcheck, &ipcomp4_protosw, NULL); #endif #ifdef INET6 - ipe6_cookie = encap_attach_func(AF_INET6, IPPROTO_IPV6, - ipcomp6_nonexp_encapcheck, &ipcomp_protosw, NULL); + ipe6_cookie = encap_attach_func(AF_INET6, -1, + ipcomp6_nonexp_encapcheck, &ipcomp6_protosw, NULL); #endif xform_register(&ipcomp_xformsw); } ___ 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"
Re: svn commit: r298549 - head/sys/netipsec
> On 24 Apr 2016, at 17:09 , Andrey V. Elsukov wrote: > > Author: ae > Date: Sun Apr 24 17:09:51 2016 > New Revision: 298549 > URL: https://svnweb.freebsd.org/changeset/base/298549 > > Log: > Fix build for NOINET and NOINET6 kernels. > > Use own protosw structures for both address families. > Check proto in encapcheck function and use -1 as proto argument in > encap_attach_func(), both address families can have IPPROTO_IPV4 > and IPPROTO_IPV6 protocols. > > Reported by: bz Thanks for both fixes! :) Bjoern ___ 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"
svn commit: r298550 - head/etc/rc.d
Author: lme (ports committer) Date: Sun Apr 24 19:25:11 2016 New Revision: 298550 URL: https://svnweb.freebsd.org/changeset/base/298550 Log: Fix duplicate "name" variable that sneaked in with the rc description commit. Approved by: jhibbits Modified: head/etc/rc.d/geli2 Modified: head/etc/rc.d/geli2 == --- head/etc/rc.d/geli2 Sun Apr 24 17:09:51 2016(r298549) +++ head/etc/rc.d/geli2 Sun Apr 24 19:25:11 2016(r298550) @@ -34,7 +34,7 @@ . /etc/rc.subr name="geli2" -name="GELI disk encryption" +desc="GELI disk encryption" start_cmd="geli2_start" stop_cmd=":" ___ 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"
svn commit: r298551 - head/sbin/fsck_ffs
Author: pfg Date: Sun Apr 24 20:31:22 2016 New Revision: 298551 URL: https://svnweb.freebsd.org/changeset/base/298551 Log: fsck_ffs: Adopt some type safety for the journalling checks. fs_ncg is of type uint32, and we were indexing it with an int. Fixed this using an unsigned type and adopt some other unsigned indexes to remind us when we are dealing with unsigned numbers. Reviewed by: mckusick MFC after:5 days Modified: head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/suj.c == --- head/sbin/fsck_ffs/suj.cSun Apr 24 19:25:11 2016(r298550) +++ head/sbin/fsck_ffs/suj.cSun Apr 24 20:31:22 2016(r298551) @@ -217,7 +217,7 @@ static void closedisk(const char *devnam) { struct csum *cgsum; - int i; + u_int i; /* * Recompute the fs summary info from correct cs summaries. @@ -2252,7 +2252,7 @@ suj_build(void) struct suj_seg *seg; union jrec *rec; int off; - int i; + u_int i; TAILQ_FOREACH(seg, &allsegs, ss_next) { if (debug) @@ -2540,10 +2540,10 @@ suj_read(void) struct jsegrec *rec; ufs2_daddr_t blk; int readsize; - int blocks; + u_int blocks; int recsize; int size; - int i; + u_int i; /* * Read records until we exhaust the journal space. If we find ___ 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"
svn commit: r298552 - head/share/misc
Author: gordon (ports committer) Date: Sun Apr 24 21:19:00 2016 New Revision: 298552 URL: https://svnweb.freebsd.org/changeset/base/298552 Log: Add myself (finally) to the port committer's dot file. Approved by: mat (mentor) Differential Revision:https://reviews.freebsd.org/D6074 Modified: head/share/misc/committers-ports.dot Modified: head/share/misc/committers-ports.dot == --- head/share/misc/committers-ports.dotSun Apr 24 20:31:22 2016 (r298551) +++ head/share/misc/committers-ports.dotSun Apr 24 21:19:00 2016 (r298552) @@ -110,6 +110,7 @@ gerald [label="Gerald Pfeifer\ngerald@Fr gjb [label="Glen Barber\n...@freebsd.org\n2012/06/19"] glarkin [label="Greg Larkin\nglar...@freebsd.org\n2008/07/17"] glewis [label="Greg Lewis\ngle...@freebsd.org\n2002/04/08"] +gordon [label="Gordon Tetlow\ngor...@freebsd.org\n2014/10/14"] grembo [label="Michael Gmelin\ngre...@freebsd.org\n2014/01/21"] gnn [label="George Neville-Neil\n...@freebsd.org\n2013/09/04"] hq [label="Herve Quiroz\n...@freebsd.org\n2004/08/05"] @@ -347,6 +348,7 @@ eik -> trhodes erwin -> brix erwin -> clement erwin -> gabor +erwin -> gordon erwin -> lbr erwin -> lth erwin -> simon @@ -456,6 +458,7 @@ makc -> rakuco mat -> bmah mat -> dvl +mat -> gordon mat -> thierry mezz -> tmclaugh ___ 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"
svn commit: r298553 - head/sys/amd64/amd64
Author: cem Date: Sun Apr 24 21:35:01 2016 New Revision: 298553 URL: https://svnweb.freebsd.org/changeset/base/298553 Log: AMD64 pmap: Use howmany() macro Use param.h howmany() instead of hand-rolled version. Sponsored by: EMC / Isilon Storage Division Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Sun Apr 24 21:19:00 2016(r298552) +++ head/sys/amd64/amd64/pmap.c Sun Apr 24 21:35:01 2016(r298553) @@ -721,7 +721,7 @@ create_pagetables(vm_paddr_t *firstaddr) pml4_entry_t *p4_p; /* Allocate page table pages for the direct map */ - ndmpdp = (ptoa(Maxmem) + NBPDP - 1) >> PDPSHIFT; + ndmpdp = howmany(ptoa(Maxmem), NBPDP); if (ndmpdp < 4) /* Minimum 4GB of dirmap */ ndmpdp = 4; ndmpdpphys = howmany(ndmpdp, NPDPEPG); ___ 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"
svn commit: r298556 - head/sbin/ifconfig
Author: pfg Date: Mon Apr 25 00:41:23 2016 New Revision: 298556 URL: https://svnweb.freebsd.org/changeset/base/298556 Log: ifconfig: prevent some improbable signed integer overflows. ic_nchans, from struct:ieee80211req_chaninfo, is an unsigned int. Use an unsigned index to prevent overflowing the index. Adopt unsigned integers in other cases where it is useful to be aware of the unsigned quantities and there is no risk of the values being negative. MFC after:1 week Modified: head/sbin/ifconfig/ifieee80211.c Modified: head/sbin/ifconfig/ifieee80211.c == --- head/sbin/ifconfig/ifieee80211.cSun Apr 24 22:13:55 2016 (r298555) +++ head/sbin/ifconfig/ifieee80211.cMon Apr 25 00:41:23 2016 (r298556) @@ -225,7 +225,7 @@ static int canpromote(int i, int from, int to) { const struct ieee80211_channel *fc = &chaninfo->ic_chans[i]; - int j; + u_int j; if ((fc->ic_flags & from) != from) return i; @@ -304,7 +304,7 @@ promote(int i) static void mapfreq(struct ieee80211_channel *chan, int freq, int flags) { - int i; + u_int i; for (i = 0; i < chaninfo->ic_nchans; i++) { const struct ieee80211_channel *c = &chaninfo->ic_chans[i]; @@ -324,7 +324,7 @@ mapfreq(struct ieee80211_channel *chan, static void mapchan(struct ieee80211_channel *chan, int ieee, int flags) { - int i; + u_int i; for (i = 0; i < chaninfo->ic_nchans; i++) { const struct ieee80211_channel *c = &chaninfo->ic_chans[i]; @@ -3047,7 +3047,7 @@ copy_essid(char buf[], size_t bufsize, c { const u_int8_t *p; size_t maxlen; - int i; + u_int i; if (essid_len > bufsize) maxlen = bufsize; @@ -4251,7 +4251,7 @@ static void printkey(const struct ieee80211req_key *ik) { static const uint8_t zerodata[IEEE80211_KEYBUF_SIZE]; - int keylen = ik->ik_keylen; + u_int keylen = ik->ik_keylen; int printcontents; printcontents = printkeys && @@ -4288,7 +4288,7 @@ printkey(const struct ieee80211req_key * break; } if (printcontents) { - int i; + u_int i; printf(" <"); for (i = 0; i < keylen; i++) ___ 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"
svn commit: r298559 - head/sys/powerpc/powerpc
Author: jhibbits Date: Mon Apr 25 00:55:51 2016 New Revision: 298559 URL: https://svnweb.freebsd.org/changeset/base/298559 Log: Init static compiled-in env when no metadata present. With this, a static environment can be compiled in via config(5). This allows, among other things, the use of a compiled-in debug console (hw.uart.dbgport) for kgdb. Modified: head/sys/powerpc/powerpc/machdep.c Modified: head/sys/powerpc/powerpc/machdep.c == --- head/sys/powerpc/powerpc/machdep.c Mon Apr 25 00:52:37 2016 (r298558) +++ head/sys/powerpc/powerpc/machdep.c Mon Apr 25 00:55:51 2016 (r298559) @@ -274,6 +274,7 @@ powerpc_init(vm_offset_t fdt, vm_offset_ } else { bzero(__sbss_start, __sbss_end - __sbss_start); bzero(__bss_start, _end - __bss_start); + init_static_kenv(NULL, 0); } #ifdef BOOKE tlb1_init(); ___ 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"
svn commit: r298560 - head/sys/powerpc/powerpc
Author: jhibbits Date: Mon Apr 25 03:01:57 2016 New Revision: 298560 URL: https://svnweb.freebsd.org/changeset/base/298560 Log: OR in the unsigned form of the MCAR lower register. When ORing in a register_t to a wider integer (vm_paddr_t), it gets sign extended, so high addresses overwrite the upper word with all 0xf. Cast to the unsigned form (u_register_t), to avoid this problem, and get correct addresses printed. Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c == --- head/sys/powerpc/powerpc/trap.c Mon Apr 25 00:55:51 2016 (r298559) +++ head/sys/powerpc/powerpc/trap.c Mon Apr 25 03:01:57 2016 (r298560) @@ -434,7 +434,7 @@ printtrap(u_int vector, struct trapframe (u_long)mfspr(SPR_MSSSR0)); #elif defined(BOOKE) pa = mfspr(SPR_MCARU); - pa = (pa << 32) | mfspr(SPR_MCAR); + pa = (pa << 32) | (u_register_t)mfspr(SPR_MCAR); printf(" mcsr= 0x%lx\n", (u_long)mfspr(SPR_MCSR)); printf(" mcar= 0x%jx\n", (uintmax_t)pa); #endif ___ 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"
svn commit: r298561 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Mon Apr 25 03:14:55 2016 New Revision: 298561 URL: https://svnweb.freebsd.org/changeset/base/298561 Log: hn: Increase odrops for if_transmit method if drbr_enqueue fails. MFC after:1 week Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c == --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Apr 25 03:01:57 2016(r298560) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Apr 25 03:14:55 2016(r298561) @@ -2700,8 +2700,10 @@ hn_transmit(struct ifnet *ifp, struct mb txr = &sc->hn_tx_ring[idx]; error = drbr_enqueue(ifp, txr->hn_mbuf_br, m); - if (error) + if (error) { + if_inc_counter(ifp, IFCOUNTER_OQDROPS, 1); return error; + } if (txr->hn_oactive) return 0; ___ 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"
svn commit: r298562 - head/usr.sbin/jail
Author: jamie Date: Mon Apr 25 03:24:48 2016 New Revision: 298562 URL: https://svnweb.freebsd.org/changeset/base/298562 Log: Make jail(8) interpret escape codes in fstab the same as getfsent(3). PR: 208663 MFC after:3 days Modified: head/usr.sbin/jail/command.c Modified: head/usr.sbin/jail/command.c == --- head/usr.sbin/jail/command.cMon Apr 25 03:14:55 2016 (r298561) +++ head/usr.sbin/jail/command.cMon Apr 25 03:24:48 2016 (r298562) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "jailp.h" @@ -444,8 +445,14 @@ run_command(struct cfjail *j) strcpy(comcs, comstring->s); argc = 0; for (cs = strtok(comcs, " \t\f\v\r\n"); cs && argc < 4; -cs = strtok(NULL, " \t\f\v\r\n")) +cs = strtok(NULL, " \t\f\v\r\n")) { + if (argc <= 1 && strunvis(cs, cs) < 0) { + jail_warnx(j, "%s: %s: fstab parse error", + j->intparams[comparam]->name, comstring->s); + return -1; + } argv[argc++] = cs; + } if (argc == 0) return 0; if (argc < 3) { ___ 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"
svn commit: r298563 - head/sys/dev/hyperv/netvsc
Author: sephe Date: Mon Apr 25 03:48:28 2016 New Revision: 298563 URL: https://svnweb.freebsd.org/changeset/base/298563 Log: hyperv/hn: Allow users to configure ifq or bufring depth. MFC after:1 week Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c == --- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Apr 25 03:24:48 2016(r298562) +++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c Mon Apr 25 03:48:28 2016(r298563) @@ -291,6 +291,10 @@ static int hn_tx_ring_cnt = 0; SYSCTL_INT(_hw_hn, OID_AUTO, tx_ring_cnt, CTLFLAG_RDTUN, &hn_tx_ring_cnt, 0, "# of TX rings to use"); +static int hn_tx_swq_depth = 0; +SYSCTL_INT(_hw_hn, OID_AUTO, tx_swq_depth, CTLFLAG_RDTUN, +&hn_tx_swq_depth, 0, "Depth of IFQ or BUFRING"); + static u_int hn_cpu_index; /* @@ -348,6 +352,16 @@ hn_set_lro_lenlim(struct hn_softc *sc, i #endif static int +hn_get_txswq_depth(const struct hn_tx_ring *txr) +{ + + KASSERT(txr->hn_txdesc_cnt > 0, ("tx ring is not setup yet")); + if (hn_tx_swq_depth < txr->hn_txdesc_cnt) + return txr->hn_txdesc_cnt; + return hn_tx_swq_depth; +} + +static int hn_ifmedia_upd(struct ifnet *ifp __unused) { @@ -501,9 +515,11 @@ netvsc_attach(device_t dev) /* needed by hv_rf_on_device_add() code */ ifp->if_mtu = ETHERMTU; if (hn_use_if_start) { + int qdepth = hn_get_txswq_depth(&sc->hn_tx_ring[0]); + ifp->if_start = hn_start; - IFQ_SET_MAXLEN(&ifp->if_snd, 512); - ifp->if_snd.ifq_drv_maxlen = 511; + IFQ_SET_MAXLEN(&ifp->if_snd, qdepth); + ifp->if_snd.ifq_drv_maxlen = qdepth - 1; IFQ_SET_READY(&ifp->if_snd); } else { ifp->if_transmit = hn_transmit; @@ -2285,10 +2301,14 @@ hn_create_tx_ring(struct hn_softc *sc, i TASK_INIT(&txr->hn_tx_task, 0, hn_start_taskfunc, txr); TASK_INIT(&txr->hn_txeof_task, 0, hn_start_txeof_taskfunc, txr); } else { + int br_depth; + txr->hn_txeof = hn_xmit_txeof; TASK_INIT(&txr->hn_tx_task, 0, hn_xmit_taskfunc, txr); TASK_INIT(&txr->hn_txeof_task, 0, hn_xmit_txeof_taskfunc, txr); - txr->hn_mbuf_br = buf_ring_alloc(txr->hn_txdesc_cnt, M_NETVSC, + + br_depth = hn_get_txswq_depth(txr); + txr->hn_mbuf_br = buf_ring_alloc(br_depth, M_NETVSC, M_WAITOK, &txr->hn_tx_lock); } ___ 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"
svn commit: r298564 - in head/sys: kern sys
Author: jamie Date: Mon Apr 25 03:58:08 2016 New Revision: 298564 URL: https://svnweb.freebsd.org/changeset/base/298564 Log: Remove the PR_REMOVE flag, which was meant as a temporary marker for a jail that might be seen mid-removal. It hasn't been doing the right thing since at least the ability to resurrect dying jails, and such resurrection also makes it unnecessary. Modified: head/sys/kern/kern_jail.c head/sys/sys/jail.h Modified: head/sys/kern/kern_jail.c == --- head/sys/kern/kern_jail.c Mon Apr 25 03:48:28 2016(r298563) +++ head/sys/kern/kern_jail.c Mon Apr 25 03:58:08 2016(r298564) @@ -1222,7 +1222,7 @@ kern_jail_set(struct thread *td, struct } created = 1; mtx_lock(&ppr->pr_mtx); - if (ppr->pr_ref == 0 || (ppr->pr_flags & PR_REMOVE)) { + if (ppr->pr_ref == 0) { mtx_unlock(&ppr->pr_mtx); error = ENOENT; vfs_opterror(opts, "parent jail went away!"); @@ -2273,7 +2273,6 @@ sys_jail_remove(struct thread *td, struc /* Remove all descendants of this prison, then remove this prison. */ pr->pr_ref++; - pr->pr_flags |= PR_REMOVE; if (!LIST_EMPTY(&pr->pr_children)) { mtx_unlock(&pr->pr_mtx); lpr = NULL; @@ -2282,7 +2281,6 @@ sys_jail_remove(struct thread *td, struc if (cpr->pr_ref > 0) { tpr = cpr; cpr->pr_ref++; - cpr->pr_flags |= PR_REMOVE; } else { /* Already removed - do not do it again. */ tpr = NULL; Modified: head/sys/sys/jail.h == --- head/sys/sys/jail.h Mon Apr 25 03:48:28 2016(r298563) +++ head/sys/sys/jail.h Mon Apr 25 03:58:08 2016(r298564) @@ -210,7 +210,6 @@ struct prison_racct { /* primary jail address. */ /* Internal flag bits */ -#definePR_REMOVE 0x0100 /* In process of being removed */ #definePR_IP4 0x0200 /* IPv4 restricted or disabled */ /* by this jail or an ancestor */ #definePR_IP6 0x0400 /* IPv6 restricted or disabled */ ___ 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"
svn commit: r298565 - in head/sys: kern sys
Author: jamie Date: Mon Apr 25 04:24:00 2016 New Revision: 298565 URL: https://svnweb.freebsd.org/changeset/base/298565 Log: Add a new jail OSD method, PR_METHOD_REMOVE. It's called when a jail is removed from the user perspective, i.e. when the last pr_uref goes away, even though the jail mail still exist in the dying state. It will also be called if either PR_METHOD_CREATE or PR_METHOD_SET fail. PR: 48471 MFC after: 5 days Modified: head/sys/kern/kern_jail.c head/sys/sys/jail.h Modified: head/sys/kern/kern_jail.c == --- head/sys/kern/kern_jail.c Mon Apr 25 03:58:08 2016(r298564) +++ head/sys/kern/kern_jail.c Mon Apr 25 04:24:00 2016(r298565) @@ -556,7 +556,8 @@ kern_jail_set(struct thread *td, struct #endif unsigned long hid; size_t namelen, onamelen; - int created, cuflags, descend, enforce, error, errmsg_len, errmsg_pos; + int born, created, cuflags, descend, enforce; + int error, errmsg_len, errmsg_pos; int gotchildmax, gotenforce, gothid, gotrsnum, gotslevel; int fi, jid, jsys, len, level; int childmax, osreldt, rsnum, slevel; @@ -1767,6 +1768,7 @@ kern_jail_set(struct thread *td, struct * for now, so new ones will remain unseen until after the module * handlers have completed. */ + born = pr->pr_uref == 0; if (!created && (ch_flags & PR_PERSIST & (pr_flags ^ pr->pr_flags))) { if (pr_flags & PR_PERSIST) { pr->pr_ref++; @@ -1836,15 +1838,20 @@ kern_jail_set(struct thread *td, struct /* Let the modules do their work. */ sx_downgrade(&allprison_lock); - if (created) { + if (born) { error = osd_jail_call(pr, PR_METHOD_CREATE, opts); if (error) { - prison_deref(pr, PD_LIST_SLOCKED); + (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); + prison_deref(pr, created + ? PD_LIST_SLOCKED + : PD_DEREF | PD_LIST_SLOCKED); goto done_errmsg; } } error = osd_jail_call(pr, PR_METHOD_SET, opts); if (error) { + if (born) + (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); prison_deref(pr, created ? PD_LIST_SLOCKED : PD_DEREF | PD_LIST_SLOCKED); @@ -1896,7 +1903,7 @@ kern_jail_set(struct thread *td, struct sx_sunlock(&allprison_lock); } - goto done_errmsg; + goto done_free; done_deref_locked: prison_deref(pr, created @@ -2596,19 +2603,46 @@ static void prison_deref(struct prison *pr, int flags) { struct prison *ppr, *tpr; + int ref, lasturef; if (!(flags & PD_LOCKED)) mtx_lock(&pr->pr_mtx); for (;;) { if (flags & PD_DEUREF) { pr->pr_uref--; + lasturef = pr->pr_uref == 0; + if (lasturef) + pr->pr_ref++; KASSERT(prison0.pr_uref != 0, ("prison0 pr_uref=0")); - } + } else + lasturef = 0; if (flags & PD_DEREF) pr->pr_ref--; - /* If the prison still has references, nothing else to do. */ - if (pr->pr_ref > 0) { + ref = pr->pr_ref; + mtx_unlock(&pr->pr_mtx); + + /* +* Tell the modules if the last user reference was removed +* (even it sticks around in dying state). +*/ + if (lasturef) { + if (!(flags & (PD_LIST_SLOCKED | PD_LIST_XLOCKED))) { + if (ref > 1) { + sx_slock(&allprison_lock); + flags |= PD_LIST_SLOCKED; + } else { + sx_xlock(&allprison_lock); + flags |= PD_LIST_XLOCKED; + } + } + (void)osd_jail_call(pr, PR_METHOD_REMOVE, NULL); + mtx_lock(&pr->pr_mtx); + ref = --pr->pr_ref; mtx_unlock(&pr->pr_mtx); + } + + /* If the prison still has references, nothing else to do. */ + if (ref > 0) { if (flags & PD_LIST_SLOCKED) sx_sunlock(&allprison_lock); else if (flags & PD_LIST_XLOCKED) @@ -2616,7 +2650,6 @@ prison_deref(struct prison *pr, int flag return;
svn commit: r298566 - head/sys/kern
Author: jamie Date: Mon Apr 25 04:27:58 2016 New Revision: 298566 URL: https://svnweb.freebsd.org/changeset/base/298566 Log: Pass the current/new jail to PR_METHOD_CHECK, which pushes the call until after the jail is found or created. This requires unlocking the jail for the call and re-locking it afterward, but that works because nothing in the jail has been changed yet, and other processes won't change the important fields as long as allprison_lock remains held. Keep better track of name vs namelc in kern_jail_set. Name should always be the hierarchical name (relative to the caller), and namelc the last component. PR: 48471 MFC after:5 days Modified: head/sys/kern/kern_jail.c Modified: head/sys/kern/kern_jail.c == --- head/sys/kern/kern_jail.c Mon Apr 25 04:24:00 2016(r298565) +++ head/sys/kern/kern_jail.c Mon Apr 25 04:27:58 2016(r298566) @@ -555,7 +555,7 @@ kern_jail_set(struct thread *td, struct void *op; #endif unsigned long hid; - size_t namelen, onamelen; + size_t namelen, onamelen, pnamelen; int born, created, cuflags, descend, enforce; int error, errmsg_len, errmsg_pos; int gotchildmax, gotenforce, gothid, gotrsnum, gotslevel; @@ -580,7 +580,7 @@ kern_jail_set(struct thread *td, struct error = priv_check(td, PRIV_JAIL_ATTACH); if (error) return (error); - mypr = ppr = td->td_ucred->cr_prison; + mypr = td->td_ucred->cr_prison; if ((flags & JAIL_CREATE) && mypr->pr_childmax == 0) return (EPERM); if (flags & ~JAIL_SET_MASK) @@ -607,6 +607,13 @@ kern_jail_set(struct thread *td, struct #endif g_path = NULL; + cuflags = flags & (JAIL_CREATE | JAIL_UPDATE); + if (!cuflags) { + error = EINVAL; + vfs_opterror(opts, "no valid operation (create or update)"); + goto done_errmsg; + } + error = vfs_copyopt(opts, "jid", &jid, sizeof(jid)); if (error == ENOENT) jid = 0; @@ -1009,42 +1016,18 @@ kern_jail_set(struct thread *td, struct } /* -* Grab the allprison lock before letting modules check their -* parameters. Once we have it, do not let go so we'll have a -* consistent view of the OSD list. -*/ - sx_xlock(&allprison_lock); - error = osd_jail_call(NULL, PR_METHOD_CHECK, opts); - if (error) - goto done_unlock_list; - - /* By now, all parameters should have been noted. */ - TAILQ_FOREACH(opt, opts, link) { - if (!opt->seen && strcmp(opt->name, "errmsg")) { - error = EINVAL; - vfs_opterror(opts, "unknown parameter: %s", opt->name); - goto done_unlock_list; - } - } - - /* -* See if we are creating a new record or updating an existing one. +* Find the specified jail, or at least its parent. * This abuses the file error codes ENOENT and EEXIST. */ - cuflags = flags & (JAIL_CREATE | JAIL_UPDATE); - if (!cuflags) { - error = EINVAL; - vfs_opterror(opts, "no valid operation (create or update)"); - goto done_unlock_list; - } pr = NULL; - namelc = NULL; + ppr = mypr; if (cuflags == JAIL_CREATE && jid == 0 && name != NULL) { namelc = strrchr(name, '.'); jid = strtoul(namelc != NULL ? namelc + 1 : name, &p, 10); if (*p != '\0') jid = 0; } + sx_xlock(&allprison_lock); if (jid != 0) { /* * See if a requested jid already exists. There is an @@ -1110,6 +1093,7 @@ kern_jail_set(struct thread *td, struct * and updates keyed by the name itself (where the name must exist * because that is the jail being updated). */ + namelc = NULL; if (name != NULL) { namelc = strrchr(name, '.'); if (namelc == NULL) @@ -1120,7 +1104,6 @@ kern_jail_set(struct thread *td, struct * parent and child names, and make sure the parent * exists or matches an already found jail. */ - *namelc = '\0'; if (pr != NULL) { if (strncmp(name, ppr->pr_name, namelc - name) || ppr->pr_name[namelc - name] != '\0') { @@ -1131,6 +1114,7 @@ kern_jail_set(struct thread *td, struct goto done_unlock_list; } } else { + *namelc = '\0'; pp
svn commit: r298567 - head/sys/kern
Author: jamie Date: Mon Apr 25 04:36:54 2016 New Revision: 298567 URL: https://svnweb.freebsd.org/changeset/base/298567 Log: Use the new PR_METHOD_REMOVE to clean up jail handling in POSIX message queues. Modified: head/sys/kern/uipc_mqueue.c Modified: head/sys/kern/uipc_mqueue.c == --- head/sys/kern/uipc_mqueue.c Mon Apr 25 04:27:58 2016(r298566) +++ head/sys/kern/uipc_mqueue.c Mon Apr 25 04:36:54 2016(r298567) @@ -154,11 +154,6 @@ struct mqfs_node { #defineFPTOMQ(fp) ((struct mqueue *)(((struct mqfs_node *) \ (fp)->f_data)->mn_data)) -struct mqfs_osd { - struct task mo_task; - const void *mo_pr_root; -}; - TAILQ_HEAD(msgq, mqueue_msg); struct mqueue; @@ -244,9 +239,7 @@ static int mqfs_destroy(struct mqfs_node static voidmqfs_fileno_alloc(struct mqfs_info *mi, struct mqfs_node *mn); static voidmqfs_fileno_free(struct mqfs_info *mi, struct mqfs_node *mn); static int mqfs_allocv(struct mount *mp, struct vnode **vpp, struct mqfs_node *pn); -static int mqfs_prison_create(void *obj, void *data); -static voidmqfs_prison_destructor(void *data); -static voidmqfs_prison_remove_task(void *context, int pending); +static int mqfs_prison_remove(void *obj, void *data); /* * Message queue construction and maniplation @@ -656,9 +649,8 @@ mqfs_init(struct vfsconf *vfc) { struct mqfs_node *root; struct mqfs_info *mi; - struct prison *pr; osd_method_t methods[PR_MAXMETHOD] = { - [PR_METHOD_CREATE] = mqfs_prison_create, + [PR_METHOD_REMOVE] = mqfs_prison_remove, }; mqnode_zone = uma_zcreate("mqnode", sizeof(struct mqfs_node), @@ -686,13 +678,7 @@ mqfs_init(struct vfsconf *vfc) EVENTHANDLER_PRI_ANY); mq_fdclose = mqueue_fdclose; p31b_setcfg(CTL_P1003_1B_MESSAGE_PASSING, _POSIX_MESSAGE_PASSING); - - /* Note current jails. */ - mqfs_osd_jail_slot = osd_jail_register(mqfs_prison_destructor, methods); - sx_slock(&allprison_lock); - TAILQ_FOREACH(pr, &allprison, pr_list) - (void)mqfs_prison_create(pr, NULL); - sx_sunlock(&allprison_lock); + mqfs_osd_jail_slot = osd_jail_register(NULL, methods); return (0); } @@ -702,14 +688,11 @@ mqfs_init(struct vfsconf *vfc) static int mqfs_uninit(struct vfsconf *vfc) { - unsigned slot; struct mqfs_info *mi; if (!unloadable) return (EOPNOTSUPP); - slot = mqfs_osd_jail_slot; - mqfs_osd_jail_slot = 0; - osd_jail_deregister(slot); + osd_jail_deregister(mqfs_osd_jail_slot); EVENTHANDLER_DEREGISTER(process_exit, exit_tag); mi = &mqfs_data; mqfs_destroy(mi->mi_root); @@ -1563,64 +1546,22 @@ mqfs_rmdir(struct vop_rmdir_args *ap) #endif /* notyet */ - /* - * Set a destructor task with the prison's root + * See if this prison root is obsolete, and clean up associated queues if it is. */ static int -mqfs_prison_create(void *obj, void *data __unused) -{ - struct prison *pr = obj; - struct mqfs_osd *mo; - void *rsv; - - if (pr->pr_root == pr->pr_parent->pr_root) - return(0); - - mo = malloc(sizeof(struct mqfs_osd), M_PRISON, M_WAITOK); - rsv = osd_reserve(mqfs_osd_jail_slot); - TASK_INIT(&mo->mo_task, 0, mqfs_prison_remove_task, mo); - mtx_lock(&pr->pr_mtx); - mo->mo_pr_root = pr->pr_root; - (void)osd_jail_set_reserved(pr, mqfs_osd_jail_slot, rsv, mo); - mtx_unlock(&pr->pr_mtx); - return (0); -} - -/* - * Queue the task for after jail/OSD locks are released - */ -static void -mqfs_prison_destructor(void *data) -{ - struct mqfs_osd *mo = data; - - if (mqfs_osd_jail_slot != 0) - taskqueue_enqueue(taskqueue_thread, &mo->mo_task); - else - free(mo, M_PRISON); -} - -/* - * See if this prison root is obsolete, and clean up associated queues if it is - */ -static void -mqfs_prison_remove_task(void *context, int pending) +mqfs_prison_remove(void *obj, void *data __unused) { - struct mqfs_osd *mo = context; + const struct prison *pr = obj; + const struct prison *tpr; struct mqfs_node *pn, *tpn; - const struct prison *pr; - const void *pr_root; int found; - pr_root = mo->mo_pr_root; found = 0; - sx_slock(&allprison_lock); - TAILQ_FOREACH(pr, &allprison, pr_list) { - if (pr->pr_root == pr_root) + TAILQ_FOREACH(tpr, &allprison, pr_list) { + if (tpr->pr_root == pr->pr_root && tpr != pr && tpr->pr_ref > 0) found = 1; } - sx_sunlock(&allprison_lock); if (!found) { /* * No jails are rooted in this directory anymore, @@ -1629,15 +1570,14 @@ mqfs_p
svn commit: r298568 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Mon Apr 25 04:58:14 2016 New Revision: 298568 URL: https://svnweb.freebsd.org/changeset/base/298568 Log: hyperv/et: Strip extra white space in function name Reported by: Sascha Wildner MFC after:1 week Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/vmbus/hv_et.c Modified: head/sys/dev/hyperv/vmbus/hv_et.c == --- head/sys/dev/hyperv/vmbus/hv_et.c Mon Apr 25 04:36:54 2016 (r298567) +++ head/sys/dev/hyperv/vmbus/hv_et.c Mon Apr 25 04:58:14 2016 (r298568) @@ -100,7 +100,7 @@ hv_et_intr(struct trapframe *frame) } static void -hv_et_identify (driver_t *driver, device_t parent) +hv_et_identify(driver_t *driver, device_t parent) { if (device_find_child(parent, "hv_et", -1) != NULL) return; ___ 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"
svn commit: r298569 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Mon Apr 25 05:22:35 2016 New Revision: 298569 URL: https://svnweb.freebsd.org/changeset/base/298569 Log: hyperv/channel: Remove the unnecessary 'new' flag MFC after:1 week Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Apr 25 04:58:14 2016 (r298568) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Apr 25 05:22:35 2016 (r298569) @@ -174,13 +174,10 @@ hv_vmbus_free_vmbus_channel(hv_vmbus_cha static void vmbus_channel_process_offer(hv_vmbus_channel *new_channel) { - boolean_t f_new; hv_vmbus_channel* channel; int ret; uint32_trelid; - f_new = TRUE; - channel = NULL; relid = new_channel->offer_msg.child_rel_id; /* * Make sure this is a new offer @@ -196,14 +193,12 @@ vmbus_channel_process_offer(hv_vmbus_cha sizeof(hv_guid)) == 0 && memcmp(&channel->offer_msg.offer.interface_instance, &new_channel->offer_msg.offer.interface_instance, - sizeof(hv_guid)) == 0) { - f_new = FALSE; + sizeof(hv_guid)) == 0) break; - } } - if (f_new) { - /* Insert at tail */ + if (channel == NULL) { + /* Install the new primary channel */ TAILQ_INSERT_TAIL( &hv_vmbus_g_connection.channel_anchor, new_channel, @@ -213,7 +208,7 @@ vmbus_channel_process_offer(hv_vmbus_cha /*XXX add new channel to percpu_list */ - if (!f_new) { + if (channel != NULL) { /* * Check if this is a sub channel. */ ___ 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"
svn commit: r298570 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Mon Apr 25 05:30:42 2016 New Revision: 298570 URL: https://svnweb.freebsd.org/changeset/base/298570 Log: hyperv/channel: Minor style changes; no functional changes. MFC after:1 week Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Apr 25 05:22:35 2016 (r298569) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Apr 25 05:30:42 2016 (r298570) @@ -186,8 +186,7 @@ vmbus_channel_process_offer(hv_vmbus_cha hv_vmbus_g_connection.channels[relid] = new_channel; TAILQ_FOREACH(channel, &hv_vmbus_g_connection.channel_anchor, - list_entry) - { + list_entry) { if (memcmp(&channel->offer_msg.offer.interface_type, &new_channel->offer_msg.offer.interface_type, sizeof(hv_guid)) == 0 && @@ -199,10 +198,8 @@ vmbus_channel_process_offer(hv_vmbus_cha if (channel == NULL) { /* Install the new primary channel */ - TAILQ_INSERT_TAIL( - &hv_vmbus_g_connection.channel_anchor, - new_channel, - list_entry); + TAILQ_INSERT_TAIL(&hv_vmbus_g_connection.channel_anchor, + new_channel, list_entry); } mtx_unlock(&hv_vmbus_g_connection.channel_lock); @@ -219,10 +216,8 @@ vmbus_channel_process_offer(hv_vmbus_cha new_channel->primary_channel = channel; new_channel->device = channel->device; mtx_lock(&channel->sc_lock); - TAILQ_INSERT_TAIL( - &channel->sc_list_anchor, - new_channel, - sc_list_entry); + TAILQ_INSERT_TAIL(&channel->sc_list_anchor, + new_channel, sc_list_entry); mtx_unlock(&channel->sc_lock); if (bootverbose) { @@ -246,14 +241,13 @@ vmbus_channel_process_offer(hv_vmbus_cha /*XXX add it to percpu_list */ new_channel->state = HV_CHANNEL_OPEN_STATE; - if (channel->sc_creation_callback != NULL) { + if (channel->sc_creation_callback != NULL) channel->sc_creation_callback(new_channel); - } return; } - hv_vmbus_free_vmbus_channel(new_channel); - return; + hv_vmbus_free_vmbus_channel(new_channel); + return; } new_channel->state = HV_CHANNEL_OPEN_STATE; @@ -275,10 +269,8 @@ vmbus_channel_process_offer(hv_vmbus_cha ret = hv_vmbus_child_device_register(new_channel->device); if (ret != 0) { mtx_lock(&hv_vmbus_g_connection.channel_lock); - TAILQ_REMOVE( - &hv_vmbus_g_connection.channel_anchor, - new_channel, - list_entry); + TAILQ_REMOVE(&hv_vmbus_g_connection.channel_anchor, + new_channel, list_entry); mtx_unlock(&hv_vmbus_g_connection.channel_lock); hv_vmbus_free_vmbus_channel(new_channel); } ___ 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"
svn commit: r298571 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Mon Apr 25 05:46:44 2016 New Revision: 298571 URL: https://svnweb.freebsd.org/changeset/base/298571 Log: hyperv/channel: Remove unapplied comment MFC after:1 week Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Apr 25 05:30:42 2016 (r298570) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Apr 25 05:46:44 2016 (r298571) @@ -203,8 +203,6 @@ vmbus_channel_process_offer(hv_vmbus_cha } mtx_unlock(&hv_vmbus_g_connection.channel_lock); - /*XXX add new channel to percpu_list */ - if (channel != NULL) { /* * Check if this is a sub channel. @@ -238,8 +236,6 @@ vmbus_channel_process_offer(hv_vmbus_cha "its primary channel is <%p>.\n", new_channel, new_channel->primary_channel); - /*XXX add it to percpu_list */ - new_channel->state = HV_CHANNEL_OPEN_STATE; if (channel->sc_creation_callback != NULL) channel->sc_creation_callback(new_channel); ___ 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"
svn commit: r298572 - head/sys/dev/hyperv/vmbus
Author: sephe Date: Mon Apr 25 05:58:32 2016 New Revision: 298572 URL: https://svnweb.freebsd.org/changeset/base/298572 Log: hyperv/channel: Log a warning about duplicated primary channel offer MFC after:1 week Sponsored by: Microsoft OSTC Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Modified: head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c == --- head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Apr 25 05:46:44 2016 (r298571) +++ head/sys/dev/hyperv/vmbus/hv_channel_mgmt.c Mon Apr 25 05:58:32 2016 (r298572) @@ -242,6 +242,8 @@ vmbus_channel_process_offer(hv_vmbus_cha return; } + printf("VMBUS: duplicated primary channel%u\n", + new_channel->offer_msg.child_rel_id); hv_vmbus_free_vmbus_channel(new_channel); return; } ___ 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"
svn commit: r298573 - head/sys/compat/linux
Author: jamie Date: Mon Apr 25 06:08:45 2016 New Revision: 298573 URL: https://svnweb.freebsd.org/changeset/base/298573 Log: linux_map_osrel doesn't need to be checked in linux_prison_set, since it already was in linux_prison_check. Modified: head/sys/compat/linux/linux_mib.c Modified: head/sys/compat/linux/linux_mib.c == --- head/sys/compat/linux/linux_mib.c Mon Apr 25 05:58:32 2016 (r298572) +++ head/sys/compat/linux/linux_mib.c Mon Apr 25 06:08:45 2016 (r298573) @@ -153,7 +153,8 @@ linux_map_osrel(char *osrelease, int *os if (v < 100) return (EINVAL); - *osrel = v; + if (osrel != NULL) + *osrel = v; return (0); } @@ -249,7 +250,7 @@ linux_prison_check(void *obj __unused, v { struct vfsoptlist *opts = data; char *osname, *osrelease; - int error, jsys, len, osrel, oss_version; + int error, jsys, len, oss_version; /* Check that the parameters are correct. */ error = vfs_copyopt(opts, "linux", &jsys, sizeof(jsys)); @@ -280,7 +281,7 @@ linux_prison_check(void *obj __unused, v vfs_opterror(opts, "linux.osrelease too long"); return (ENAMETOOLONG); } - error = linux_map_osrel(osrelease, &osrel); + error = linux_map_osrel(osrelease, NULL); if (error != 0) { vfs_opterror(opts, "linux.osrelease format error"); return (error); @@ -339,11 +340,7 @@ linux_prison_set(void *obj, void *data) */ linux_alloc_prison(pr, &lpr); if (osrelease) { - error = linux_map_osrel(osrelease, &lpr->pr_osrel); - if (error) { - mtx_unlock(&pr->pr_mtx); - return (error); - } + (void)linux_map_osrel(osrelease, &lpr->pr_osrel); strlcpy(lpr->pr_osrelease, osrelease, LINUX_MAX_UTSNAME); } ___ 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"