svn commit: r272676 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-10-06 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Tue Oct  7 06:00:09 2014
New Revision: 272676
URL: https://svnweb.freebsd.org/changeset/base/272676

Log:
  Make external NFS clients know when files have their attributes changed and
  avoid cache the file's state indefinitely. The va_filerev is what is sent
  to the client as the "change" attribute, the client is periodically fetching
  the attributes and without this option the attribute remains as some garbage
  value.
  
  Phabric:  D905
  Reported by:  Kevin Buhr 
  Reviewed by:  rmacklem, delphij
  Approved by:  delphij
  Obtained from:r272467
  Sponsored by: QNAP Systems Inc.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Tue Oct  7 04:59:11 2014(r272675)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Tue Oct  7 06:00:09 2014(r272676)
@@ -2827,6 +2827,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i
 #endif
vap->va_seq = zp->z_seq;
vap->va_flags = 0;  /* FreeBSD: Reset chflags(2) flags. */
+   vap->va_filerev = zp->z_seq;
 
/*
 * Add in any requested optional attributes and the create time.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r272677 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-10-06 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Tue Oct  7 06:00:32 2014
New Revision: 272677
URL: https://svnweb.freebsd.org/changeset/base/272677

Log:
  Make external NFS clients know when files have their attributes changed and
  avoid cache the file's state indefinitely. The va_filerev is what is sent
  to the client as the "change" attribute, the client is periodically fetching
  the attributes and without this option the attribute remains as some garbage
  value.
  
  Phabric:  D905
  Reported by:  Kevin Buhr 
  Reviewed by:  rmacklem, delphij
  Approved by:  delphij
  Obtained from:r272467
  Sponsored by: QNAP Systems Inc.

Modified:
  stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Oct 
 7 06:00:09 2014(r272676)
+++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Tue Oct 
 7 06:00:32 2014(r272677)
@@ -2812,6 +2812,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i
 #endif
vap->va_seq = zp->z_seq;
vap->va_flags = 0;  /* FreeBSD: Reset chflags(2) flags. */
+   vap->va_filerev = zp->z_seq;
 
/*
 * Add in any requested optional attributes and the create time.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273122 - releng/10.1/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2014-10-14 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Wed Oct 15 06:31:08 2014
New Revision: 273122
URL: https://svnweb.freebsd.org/changeset/base/273122

Log:
  Make external NFS clients know when files have their attributes changed and
  avoid cache the file's state indefinitely. The va_filerev is what is sent
  to the client as the "change" attribute, the client is periodically fetching
  the attributes and without this option the attribute remains as some garbage
  value.
  
  Reported by:  Kevin Buhr 
  Reviewed by:  delphij
  Approved by:  re (gjb), delphij
  Obtained from:r272467

Modified:
  releng/10.1/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c

Modified: releng/10.1/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- releng/10.1/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c  
Wed Oct 15 06:10:33 2014(r273121)
+++ releng/10.1/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c  
Wed Oct 15 06:31:08 2014(r273122)
@@ -2827,6 +2827,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i
 #endif
vap->va_seq = zp->z_seq;
vap->va_flags = 0;  /* FreeBSD: Reset chflags(2) flags. */
+   vap->va_filerev = zp->z_seq;
 
/*
 * Add in any requested optional attributes and the create time.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273159 - head/sys/fs/nfsserver

2014-10-15 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Thu Oct 16 02:24:19 2014
New Revision: 273159
URL: https://svnweb.freebsd.org/changeset/base/273159

Log:
  Add two sysctl(8) to enable/disable NFSv4 server to check when setting
  user nobody and/or setting group nogroup as owner of a file or directory.
  Usually at the client side, if there is an username that is not in the
  client's passwd database, some clients will send 'nobody@'
  in the wire and the NFSv4 server will treat it as an ERROR.
  However, if you have a valid user nobody in your passwd database,
  the NFSv4 server will treat it as a NFSERR_BADOWNER as its believes the
  client doesn't has the username mapped.
  
  Submitted by: Loic Blot 
  Reviewed by:  rmacklem
  Approved by:  rmacklem
  MFC after:2 weeks

Modified:
  head/sys/fs/nfsserver/nfs_nfsdsubs.c

Modified: head/sys/fs/nfsserver/nfs_nfsdsubs.c
==
--- head/sys/fs/nfsserver/nfs_nfsdsubs.cThu Oct 16 02:23:27 2014
(r273158)
+++ head/sys/fs/nfsserver/nfs_nfsdsubs.cThu Oct 16 02:24:19 2014
(r273159)
@@ -66,6 +66,16 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, disable_
 &disable_checkutf8, 0,
 "Disable the NFSv4 check for a UTF8 compliant name");
 
+static intenable_nobodycheck = 1;
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_nobodycheck, CTLFLAG_RW,
+&enable_nobodycheck, 0,
+"Enable the NFSv4 check when setting user nobody as owner");
+
+static intenable_nogroupcheck = 1;
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_nogroupcheck, CTLFLAG_RW,
+&enable_nogroupcheck, 0,
+"Enable the NFSv4 check when setting group nogroup as owner");
+
 static char nfsrv_hexdigit(char, int *);
 
 /*
@@ -1543,8 +1553,10 @@ nfsrv_checkuidgid(struct nfsrv_descript 
 */
if (NFSVNO_NOTSETUID(nvap) && NFSVNO_NOTSETGID(nvap))
goto out;
-   if ((NFSVNO_ISSETUID(nvap) && nvap->na_uid == nfsrv_defaultuid)
-   || (NFSVNO_ISSETGID(nvap) && nvap->na_gid == nfsrv_defaultgid)) {
+   if ((NFSVNO_ISSETUID(nvap) && nvap->na_uid == nfsrv_defaultuid &&
+   enable_nobodycheck == 1)
+   || (NFSVNO_ISSETGID(nvap) && nvap->na_gid == nfsrv_defaultgid &&
+   enable_nogroupcheck == 1)) {
error = NFSERR_BADOWNER;
goto out;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273202 - head/sys/fs/nfsserver

2014-10-16 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Fri Oct 17 02:11:09 2014
New Revision: 273202
URL: https://svnweb.freebsd.org/changeset/base/273202

Log:
  Make the sysctl(8) for checkutf8 positively defined and improve
  the description of it.
  
  Submitted by: Ronald Klop 
  Reviewed by:  rmacklem
  Approved by:  rmacklem
  Sponsored by: QNAP Systems Inc.

Modified:
  head/sys/fs/nfsserver/nfs_nfsdsubs.c

Modified: head/sys/fs/nfsserver/nfs_nfsdsubs.c
==
--- head/sys/fs/nfsserver/nfs_nfsdsubs.cFri Oct 17 00:31:51 2014
(r273201)
+++ head/sys/fs/nfsserver/nfs_nfsdsubs.cFri Oct 17 02:11:09 2014
(r273202)
@@ -61,10 +61,10 @@ static u_int32_t nfsrv_isannfserr(u_int3
 
 SYSCTL_DECL(_vfs_nfsd);
 
-static int disable_checkutf8 = 0;
-SYSCTL_INT(_vfs_nfsd, OID_AUTO, disable_checkutf8, CTLFLAG_RW,
-&disable_checkutf8, 0,
-"Disable the NFSv4 check for a UTF8 compliant name");
+static int enable_checkutf8 = 1;
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_checkutf8, CTLFLAG_RW,
+&enable_checkutf8, 0,
+"Enable the NFSv4 check for the UTF8 compliant name required by rfc3530");
 
 static intenable_nobodycheck = 1;
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_nobodycheck, CTLFLAG_RW,
@@ -2005,7 +2005,7 @@ nfsrv_parsename(struct nfsrv_descript *n
error = 0;
goto nfsmout;
}
-   if (disable_checkutf8 == 0 &&
+   if (enable_checkutf8 == 1 &&
nfsrv_checkutf8((u_int8_t *)bufp, outlen)) {
nd->nd_repstat = NFSERR_INVAL;
error = 0;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273576 - head/sys/dev/uart

2014-10-23 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Fri Oct 24 05:39:32 2014
New Revision: 273576
URL: https://svnweb.freebsd.org/changeset/base/273576

Log:
  Fix a leaked Storage Variable.
  
  Phabric:  D981
  Submitted by: myself
  Reported by:  Coverity
  CID:  1248848
  Reworked by:  kevlo
  Reviewed by:  marcel, davide, ray, kevlo
  Approved by:  marcel, kevlo

Modified:
  head/sys/dev/uart/uart_subr.c

Modified: head/sys/dev/uart/uart_subr.c
==
--- head/sys/dev/uart/uart_subr.c   Fri Oct 24 04:01:14 2014
(r273575)
+++ head/sys/dev/uart/uart_subr.c   Fri Oct 24 05:39:32 2014
(r273576)
@@ -196,7 +196,7 @@ out:
 int
 uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
 {
-   const char *spec;
+   const char *cp, *spec;
bus_addr_t addr = ~0U;
int error;
 
@@ -214,12 +214,12 @@ uart_getenv(int devtype, struct uart_dev
 * port (resp).
 */
if (devtype == UART_DEV_CONSOLE)
-   spec = kern_getenv("hw.uart.console");
+   cp = kern_getenv("hw.uart.console");
else if (devtype == UART_DEV_DBGPORT)
-   spec = kern_getenv("hw.uart.dbgport");
+   cp = kern_getenv("hw.uart.dbgport");
else
-   spec = NULL;
-   if (spec == NULL)
+   cp = NULL;
+   if (cp == NULL)
return (ENXIO);
 
/* Set defaults. */
@@ -232,6 +232,7 @@ uart_getenv(int devtype, struct uart_dev
di->parity = UART_PARITY_NONE;
 
/* Parse the attributes. */
+   spec = cp;
while (1) {
switch (uart_parse_tag(&spec)) {
case UART_TAG_BR:
@@ -267,14 +268,18 @@ uart_getenv(int devtype, struct uart_dev
di->bas.rclk = uart_parse_long(&spec);
break;
default:
+   freeenv(__DECONST(char *, cp));
return (EINVAL);
}
if (*spec == '\0')
break;
-   if (*spec != ',')
+   if (*spec != ',') {
+   freeenv(__DECONST(char *, cp));
return (EINVAL);
+   }
spec++;
}
+   freeenv(__DECONST(char *, cp));
 
/*
 * If we still have an invalid address, the specification must be
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273576 - head/sys/dev/uart

2014-10-24 Thread Marcelo Araujo
2014-10-24 13:58 GMT+08:00 Mateusz Guzik :

> On Fri, Oct 24, 2014 at 05:39:32AM +0000, Marcelo Araujo wrote:
> > Author: araujo (ports committer)
> > Date: Fri Oct 24 05:39:32 2014
> > New Revision: 273576
> > URL: https://svnweb.freebsd.org/changeset/base/273576
> >
> > Log:
> >   Fix a leaked Storage Variable.
> >
> >  int
> >  uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class
> *class)
> >  {
> > - const char *spec;
> > + const char *cp, *spec;
> >   bus_addr_t addr = ~0U;
> >   int error;
> >
> > @@ -214,12 +214,12 @@ uart_getenv(int devtype, struct uart_dev
> >* port (resp).
> >*/
> >   if (devtype == UART_DEV_CONSOLE)
> > - spec = kern_getenv("hw.uart.console");
> > + cp = kern_getenv("hw.uart.console");
> >   else if (devtype == UART_DEV_DBGPORT)
> > - spec = kern_getenv("hw.uart.dbgport");
> > + cp = kern_getenv("hw.uart.dbgport");
> >   else
> > - spec = NULL;
> > - if (spec == NULL)
> > + cp = NULL;
> > + if (cp == NULL)
> >   return (ENXIO);
> [..]
> >   default:
> > + freeenv(__DECONST(char *, cp));
> >   return (EINVAL);
> >   }
> >   if (*spec == '\0')
> >   break;
> > - if (*spec != ',')
> > + if (*spec != ',') {
> > + freeenv(__DECONST(char *, cp));
> >   return (EINVAL);
> > + }
> >   spec++;
> >   }
> > + freeenv(__DECONST(char *, cp));
> >
>
> Why not 'char *cp;'? That would avoid __DECONST entirely and would not
> require spec to change type.
>

Well, it might be possible to use 'char *cp', however as I'm not aware of
all uart implementation, I just followed the previous 'spec' declaration
type that is a constant too. I'm gonna take a look on it, to check if there
is any backward to only use 'char *cp'.


>
> There are some cosmetics around that may be worth fixing (e.g. if,
> else-if instead of switch, while (1) instead of for (;;)).
>

Yes, that for sure makes sense and it is worth.

Thanks to point all of these things.
Best Regards,
-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273761 - head/sys/dev/uart

2014-10-27 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Tue Oct 28 03:42:09 2014
New Revision: 273761
URL: https://svnweb.freebsd.org/changeset/base/273761

Log:
  Drop __DECONST as well as few fixes of style(9).
  
  Phabric:  D1012
  Suggested by: mjg, jhb
  Reviewed by:  mjg, jhb
  Sponsored by: QNAP Systems Inc.

Modified:
  head/sys/dev/uart/uart_subr.c

Modified: head/sys/dev/uart/uart_subr.c
==
--- head/sys/dev/uart/uart_subr.c   Tue Oct 28 02:05:57 2014
(r273760)
+++ head/sys/dev/uart/uart_subr.c   Tue Oct 28 03:42:09 2014
(r273761)
@@ -196,7 +196,8 @@ out:
 int
 uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class *class)
 {
-   const char *cp, *spec;
+   const char *spec;
+   char *cp;
bus_addr_t addr = ~0U;
int error;
 
@@ -213,12 +214,18 @@ uart_getenv(int devtype, struct uart_dev
 * which UART port is to be used as serial console or debug
 * port (resp).
 */
-   if (devtype == UART_DEV_CONSOLE)
+   switch (devtype) {
+   case UART_DEV_CONSOLE:
cp = kern_getenv("hw.uart.console");
-   else if (devtype == UART_DEV_DBGPORT)
+   break;
+   case UART_DEV_DBGPORT:
cp = kern_getenv("hw.uart.dbgport");
-   else
+   break;
+   default:
cp = NULL;
+   break;
+   }
+
if (cp == NULL)
return (ENXIO);
 
@@ -233,7 +240,7 @@ uart_getenv(int devtype, struct uart_dev
 
/* Parse the attributes. */
spec = cp;
-   while (1) {
+   for (;;) {
switch (uart_parse_tag(&spec)) {
case UART_TAG_BR:
di->baudrate = uart_parse_long(&spec);
@@ -268,18 +275,18 @@ uart_getenv(int devtype, struct uart_dev
di->bas.rclk = uart_parse_long(&spec);
break;
default:
-   freeenv(__DECONST(char *, cp));
+   freeenv(cp);
return (EINVAL);
}
if (*spec == '\0')
break;
if (*spec != ',') {
-   freeenv(__DECONST(char *, cp));
+   freeenv(cp);
return (EINVAL);
}
spec++;
}
-   freeenv(__DECONST(char *, cp));
+   freeenv(cp);
 
/*
 * If we still have an invalid address, the specification must be
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273576 - head/sys/dev/uart

2014-10-27 Thread Marcelo Araujo
Done: https://svnweb.freebsd.org/base?view=revision&revision=273761

Thank you guys

2014-10-25 0:14 GMT+08:00 John Baldwin :

> On Friday, October 24, 2014 05:39:32 AM Marcelo Araujo wrote:
> > Author: araujo (ports committer)
> > Date: Fri Oct 24 05:39:32 2014
> > New Revision: 273576
> > URL: https://svnweb.freebsd.org/changeset/base/273576
> >
> > Log:
> >   Fix a leaked Storage Variable.
> >
> >   Phabric:D981
> >   Submitted by:   myself
> >   Reported by:Coverity
> >   CID:1248848
> >   Reworked by:kevlo
> >   Reviewed by:marcel, davide, ray, kevlo
> >   Approved by:marcel, kevlo
> >
> > Modified:
> >   head/sys/dev/uart/uart_subr.c
> >
> > Modified: head/sys/dev/uart/uart_subr.c
> >
> ==
> > --- head/sys/dev/uart/uart_subr.c Fri Oct 24 04:01:14 2014
> (r273575)
> > +++ head/sys/dev/uart/uart_subr.c Fri Oct 24 05:39:32 2014
> (r273576)
> > @@ -196,7 +196,7 @@ out:
> >  int
> >  uart_getenv(int devtype, struct uart_devinfo *di, struct uart_class
> *class)
> > {
> > - const char *spec;
> > + const char *cp, *spec;
>
> Dropping const here is preferable to using __DECONST() for the freeenv()
> calls.
>
> --
> John Baldwin
>



-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273766 - head/sys/amd64/vmm/amd

2014-10-28 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Tue Oct 28 07:19:02 2014
New Revision: 273766
URL: https://svnweb.freebsd.org/changeset/base/273766

Log:
  Reported by:  Coverity
  CID:  1249760
  Reviewed by:  neel
  Approved by:  neel
  Sponsored by: QNAP Systems Inc.

Modified:
  head/sys/amd64/vmm/amd/vmcb.c

Modified: head/sys/amd64/vmm/amd/vmcb.c
==
--- head/sys/amd64/vmm/amd/vmcb.c   Tue Oct 28 06:17:25 2014
(r273765)
+++ head/sys/amd64/vmm/amd/vmcb.c   Tue Oct 28 07:19:02 2014
(r273766)
@@ -389,6 +389,7 @@ vmcb_setdesc(void *arg, int vcpu, int re
case VM_REG_GUEST_ES:
case VM_REG_GUEST_SS:
svm_set_dirty(sc, vcpu, VMCB_CACHE_SEG);
+   break;
case VM_REG_GUEST_GDTR:
case VM_REG_GUEST_IDTR:
svm_set_dirty(sc, vcpu, VMCB_CACHE_DT);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r273766 - head/sys/amd64/vmm/amd

2014-10-28 Thread Marcelo Araujo
2014-10-28 15:19 GMT+08:00 Marcelo Araujo :

> Author: araujo (ports committer)
> Date: Tue Oct 28 07:19:02 2014
> New Revision: 273766
> URL: https://svnweb.freebsd.org/changeset/base/273766
>
> Log:
>   Reported by:  Coverity
>   CID:  1249760
>   Reviewed by:  neel
>   Approved by:  neel
>   Sponsored by: QNAP Systems Inc.
>
> Modified:
>   head/sys/amd64/vmm/amd/vmcb.c
>
> Modified: head/sys/amd64/vmm/amd/vmcb.c
>
> ==
> --- head/sys/amd64/vmm/amd/vmcb.c   Tue Oct 28 06:17:25 2014
> (r273765)
> +++ head/sys/amd64/vmm/amd/vmcb.c   Tue Oct 28 07:19:02 2014
> (r273766)
> @@ -389,6 +389,7 @@ vmcb_setdesc(void *arg, int vcpu, int re
> case VM_REG_GUEST_ES:
> case VM_REG_GUEST_SS:
> svm_set_dirty(sc, vcpu, VMCB_CACHE_SEG);
> +   break;
> case VM_REG_GUEST_GDTR:
> case VM_REG_GUEST_IDTR:
> svm_set_dirty(sc, vcpu, VMCB_CACHE_DT);



Missing the log, my bad!!! And as we don't have 'svn "force commit"' to
append it.

Change log:
Missing break on the switch case statement.


Best Regards,
-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r273877 - stable/10/sys/fs/nfsserver

2014-10-30 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Fri Oct 31 04:01:10 2014
New Revision: 273877
URL: https://svnweb.freebsd.org/changeset/base/273877

Log:
  MFC r273159:
  Add two sysctl(8) to enable/disable NFSv4 server to check when setting
  user nobody and/or setting group nogroup as owner of a file or directory.
  Usually at the client side, if there is an username that is not in the
  client's passwd database, some clients will send 'nobody@'
  in the wire and the NFSv4 server will treat it as an ERROR.
  However, if you have a valid user nobody in your passwd database,
  the NFSv4 server will treat it as a NFSERR_BADOWNER as its believes the
  client doesn't has the username mapped.
  
  Submitted by: Loic Blot 
  Reviewed by:  rmacklem
  Approved by:  rmacklem
  Sponsored by: QNAP Systems Inc.

Modified:
  stable/10/sys/fs/nfsserver/nfs_nfsdsubs.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdsubs.c
==
--- stable/10/sys/fs/nfsserver/nfs_nfsdsubs.c   Thu Oct 30 23:47:28 2014
(r273876)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdsubs.c   Fri Oct 31 04:01:10 2014
(r273877)
@@ -66,6 +66,16 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, disable_
 &disable_checkutf8, 0,
 "Disable the NFSv4 check for a UTF8 compliant name");
 
+static intenable_nobodycheck = 1;
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_nobodycheck, CTLFLAG_RW,
+&enable_nobodycheck, 0,
+"Enable the NFSv4 check when setting user nobody as owner");
+
+static intenable_nogroupcheck = 1;
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_nogroupcheck, CTLFLAG_RW,
+&enable_nogroupcheck, 0,
+"Enable the NFSv4 check when setting group nogroup as owner");
+
 static char nfsrv_hexdigit(char, int *);
 
 /*
@@ -1543,8 +1553,10 @@ nfsrv_checkuidgid(struct nfsrv_descript 
 */
if (NFSVNO_NOTSETUID(nvap) && NFSVNO_NOTSETGID(nvap))
goto out;
-   if ((NFSVNO_ISSETUID(nvap) && nvap->na_uid == nfsrv_defaultuid)
-   || (NFSVNO_ISSETGID(nvap) && nvap->na_gid == nfsrv_defaultgid)) {
+   if ((NFSVNO_ISSETUID(nvap) && nvap->na_uid == nfsrv_defaultuid &&
+   enable_nobodycheck == 1)
+   || (NFSVNO_ISSETGID(nvap) && nvap->na_gid == nfsrv_defaultgid &&
+   enable_nogroupcheck == 1)) {
error = NFSERR_BADOWNER;
goto out;
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r269501 - head/sys/modules/igb

2014-08-03 Thread Marcelo Araujo
2014-08-04 12:23 GMT+08:00 Adrian Chadd :

> Author: adrian
> Date: Mon Aug  4 04:23:45 2014
> New Revision: 269501
> URL: http://svnweb.freebsd.org/changeset/base/269501
>
> Log:
>   Make igb(4) build outside of the kernel build.
>
>   Ths defaults to RSS being disabled.
>
> Modified:
>   head/sys/modules/igb/Makefile
>
> Modified: head/sys/modules/igb/Makefile
>
> ==
> --- head/sys/modules/igb/Makefile   Mon Aug  4 04:21:32 2014
>  (r269500)
> +++ head/sys/modules/igb/Makefile   Mon Aug  4 04:23:45 2014
>  (r269501)
> @@ -4,7 +4,7 @@
>
>  .PATH:  ${.CURDIR}/../../dev/e1000
>  KMOD= if_igb
> -SRCS= device_if.h bus_if.h pci_if.h opt_inet.h opt_inet6.h
> +SRCS= device_if.h bus_if.h pci_if.h opt_inet.h opt_inet6.h opt_rss.h
>  SRCS+= if_igb.c $(SHARED_SRCS)
>  SHARED_SRCS = e1000_api.c e1000_phy.c e1000_nvm.c e1000_mac.c
> e1000_manage.c
>  SHARED_SRCS += e1000_80003es2lan.c e1000_82542.c e1000_82541.c
> e1000_82543.c
> @@ -33,6 +33,10 @@ opt_inet.h:
>  opt_inet6.h:
> @echo "#define INET6 1" > ${.TARGET}
>  .endif
> +
> +opt_rss.h:
> +   @echo "" > ${.TARGET}
> +
>  .endif
>
>  .include 
>


Just for record, missed:

Submitted by: araujo@


Best Regards,
-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r268917 - head/sys/dev/ixgbe

2014-08-03 Thread Marcelo Araujo
2014-08-04 12:27 GMT+08:00 Marcelo Araujo :

>
>
>
> 2014-07-20 16:43 GMT+08:00 Adrian Chadd :
>
> Author: adrian
>> Date: Sun Jul 20 08:43:53 2014
>> New Revision: 268917
>> URL: http://svnweb.freebsd.org/changeset/base/268917
>>
>> Log:
>>   Add the UDP hash -> RSS mbuf hash type for the ixgbe(4) driver.
>>
>> Modified:
>>   head/sys/dev/ixgbe/ixgbe.c
>>
>> Modified: head/sys/dev/ixgbe/ixgbe.c
>>
>> ==
>> --- head/sys/dev/ixgbe/ixgbe.c  Sun Jul 20 07:45:48 2014(r268916)
>> +++ head/sys/dev/ixgbe/ixgbe.c  Sun Jul 20 08:43:53 2014(r268917)
>> @@ -4745,12 +4745,15 @@ ixgbe_rxeof(struct ix_queue *que)
>> case IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX:
>> M_HASHTYPE_SET(sendmp,
>> M_HASHTYPE_RSS_TCP_IPV6_EX);
>> break;
>> -   /* XXX no UDP support in RSS just yet */
>> -#ifdef notyet
>> -   case IGXBE_RXDADV_RSSTYPE_IPV4_UDP:
>> -   case IGXBE_RXDADV_RSSTYPE_IPV6_UDP:
>> -   case IGXBE_RXDADV_RSSTYPE_IPV6_UDP_EX:
>> -#endif /* notyet */
>> +   case IXGBE_RXDADV_RSSTYPE_IPV4_UDP:
>> +   M_HASHTYPE_SET(sendmp,
>> M_HASHTYPE_RSS_UDP_IPV4);
>> +   break;
>> +   case IXGBE_RXDADV_RSSTYPE_IPV6_UDP:
>> +   M_HASHTYPE_SET(sendmp,
>> M_HASHTYPE_RSS_UDP_IPV6);
>> +   break;
>> +   case IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX:
>> +   M_HASHTYPE_SET(sendmp,
>> M_HASHTYPE_RSS_UDP_IPV6_EX);
>> +   break;
>> default:
>> /* XXX fallthrough */
>> M_HASHTYPE_SET(sendmp, M_HASHTYPE_NONE);
>>
>
>
> Just for record, missed:
>
> Submitted by: araujo@
>
>
> Best Regards,
>


Ops, not this one :D



-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r268917 - head/sys/dev/ixgbe

2014-08-03 Thread Marcelo Araujo
2014-07-20 16:43 GMT+08:00 Adrian Chadd :

> Author: adrian
> Date: Sun Jul 20 08:43:53 2014
> New Revision: 268917
> URL: http://svnweb.freebsd.org/changeset/base/268917
>
> Log:
>   Add the UDP hash -> RSS mbuf hash type for the ixgbe(4) driver.
>
> Modified:
>   head/sys/dev/ixgbe/ixgbe.c
>
> Modified: head/sys/dev/ixgbe/ixgbe.c
>
> ==
> --- head/sys/dev/ixgbe/ixgbe.c  Sun Jul 20 07:45:48 2014(r268916)
> +++ head/sys/dev/ixgbe/ixgbe.c  Sun Jul 20 08:43:53 2014(r268917)
> @@ -4745,12 +4745,15 @@ ixgbe_rxeof(struct ix_queue *que)
> case IXGBE_RXDADV_RSSTYPE_IPV6_TCP_EX:
> M_HASHTYPE_SET(sendmp,
> M_HASHTYPE_RSS_TCP_IPV6_EX);
> break;
> -   /* XXX no UDP support in RSS just yet */
> -#ifdef notyet
> -   case IGXBE_RXDADV_RSSTYPE_IPV4_UDP:
> -   case IGXBE_RXDADV_RSSTYPE_IPV6_UDP:
> -   case IGXBE_RXDADV_RSSTYPE_IPV6_UDP_EX:
> -#endif /* notyet */
> +   case IXGBE_RXDADV_RSSTYPE_IPV4_UDP:
> +   M_HASHTYPE_SET(sendmp,
> M_HASHTYPE_RSS_UDP_IPV4);
> +   break;
> +   case IXGBE_RXDADV_RSSTYPE_IPV6_UDP:
> +   M_HASHTYPE_SET(sendmp,
> M_HASHTYPE_RSS_UDP_IPV6);
> +   break;
> +   case IXGBE_RXDADV_RSSTYPE_IPV6_UDP_EX:
> +   M_HASHTYPE_SET(sendmp,
> M_HASHTYPE_RSS_UDP_IPV6_EX);
> +   break;
> default:
> /* XXX fallthrough */
>         M_HASHTYPE_SET(sendmp, M_HASHTYPE_NONE);
>


Just for record, missed:

Submitted by: araujo@


Best Regards,
-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r269500 - head/sys/modules/ixgbe

2014-08-03 Thread Marcelo Araujo
2014-08-04 12:21 GMT+08:00 Adrian Chadd :

> Author: adrian
> Date: Mon Aug  4 04:21:32 2014
> New Revision: 269500
> URL: http://svnweb.freebsd.org/changeset/base/269500
>
> Log:
>   Make the ixgbe(4) module buildable outside of the tree.
>
>   It defaults to RSS not being enabled.
>
> Modified:
>   head/sys/modules/ixgbe/Makefile
>
> Modified: head/sys/modules/ixgbe/Makefile
>
> ==
> --- head/sys/modules/ixgbe/Makefile Mon Aug  4 04:00:48 2014
>  (r269499)
> +++ head/sys/modules/ixgbe/Makefile Mon Aug  4 04:21:32 2014
>  (r269500)
> @@ -6,7 +6,7 @@
>
>  KMOD= if_ixgbe
>  SRCS= device_if.h bus_if.h pci_if.h
> -SRCS   += opt_inet.h opt_inet6.h
> +SRCS   += opt_inet.h opt_inet6.h opt_rss.h
>  SRCS+= ixgbe.c ixv.c
>  # Shared source
>  SRCS+= ixgbe_common.c ixgbe_api.c ixgbe_phy.c ixgbe_mbx.c ixgbe_vf.c
> @@ -24,6 +24,10 @@ opt_inet.h:
>  opt_inet6.h:
> @echo "#define INET6 1" > ${.TARGET}
>  .endif
> +
> +opt_rss.h:
> +   @echo "" > ${.TARGET}
> +
>  .endif
>
>  .include 
>

This one, Just for record, missed:

Submitted by: araujo@


Best Regards,
-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r269799 - head/sys/net

2014-08-10 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Mon Aug 11 03:04:16 2014
New Revision: 269799
URL: http://svnweb.freebsd.org/changeset/base/269799

Log:
  - Remove unneeded include.
  
  Phabric:  D563
  Reviewed by:  kevlo
  Approved by:  kevlo

Modified:
  head/sys/net/if_lagg.c

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Mon Aug 11 02:20:24 2014(r269798)
+++ head/sys/net/if_lagg.c  Mon Aug 11 03:04:16 2014(r269799)
@@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r281583 - head/sys/net

2015-04-15 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Thu Apr 16 02:44:37 2015
New Revision: 281583
URL: https://svnweb.freebsd.org/changeset/base/281583

Log:
  Remove duplicate header entry.

Modified:
  head/sys/net/route.c

Modified: head/sys/net/route.c
==
--- head/sys/net/route.cThu Apr 16 02:24:40 2015(r281582)
+++ head/sys/net/route.cThu Apr 16 02:44:37 2015(r281583)
@@ -43,7 +43,6 @@
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r281684 - head/usr.sbin/bluetooth/hccontrol

2015-04-17 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Sat Apr 18 06:48:03 2015
New Revision: 281684
URL: https://svnweb.freebsd.org/changeset/base/281684

Log:
  Improve code style(9), no functional changes.
  
  Differential Revision:D2320
  Reviewed by:  takawata

Modified:
  head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c
  head/usr.sbin/bluetooth/hccontrol/le.c

Modified: head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.c
==
--- head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.cSat Apr 
18 06:16:33 2015(r281683)
+++ head/usr.sbin/bluetooth/hccontrol/host_controller_baseband.cSat Apr 
18 06:48:03 2015(r281684)
@@ -1491,7 +1491,7 @@ hci_write_page_scan_mode(int s, int argc
 static int
 hci_read_le_host_supported_command(int s, int argc, char **argv) 
 {
-   ng_hci_read_le_host_supported_rprp;
+   ng_hci_read_le_host_supported_rp rp;
int n;
n = sizeof(rp);
if (hci_simple_request(s, NG_HCI_OPCODE(NG_HCI_OGF_HC_BASEBAND,
@@ -1514,10 +1514,10 @@ hci_read_le_host_supported_command(int s
 static int
 hci_write_le_host_supported_command(int s, int argc, char **argv) 
 {
-   ng_hci_write_le_host_supported_cp   cp;
-   ng_hci_write_le_host_supported_rp   rp;
+   ng_hci_write_le_host_supported_cp cp;
+   ng_hci_write_le_host_supported_rp rp;
 
-   int n;
+   int n;
 
cp.le_supported_host = 0;
cp.simultaneous_le_host = 0;

Modified: head/usr.sbin/bluetooth/hccontrol/le.c
==
--- head/usr.sbin/bluetooth/hccontrol/le.c  Sat Apr 18 06:16:33 2015
(r281683)
+++ head/usr.sbin/bluetooth/hccontrol/le.c  Sat Apr 18 06:48:03 2015
(r281684)
@@ -46,6 +46,7 @@
 #define L2CAP_SOCKET_CHECKED
 #include 
 #include "hccontrol.h"
+
 static int le_set_scan_param(int s, int argc, char *argv[]);
 static int le_set_scan_enable(int s, int argc, char *argv[]);
 static int parse_param(int argc, char *argv[], char *buf, int *len);
@@ -56,51 +57,47 @@ static int set_le_event_mask(int s, uint
 static int set_event_mask(int s, uint64_t mask);
 static int le_enable(int s, int argc, char *argv[]);
 
-static int le_set_scan_param(int s, int argc, char *argv[])
+static int
+le_set_scan_param(int s, int argc, char *argv[])
 {
int type;
int interval;
int window;
int adrtype;
-   int  policy;
+   int policy;
+   int e, n;
 
ng_hci_le_set_scan_parameters_cp cp;
ng_hci_le_set_scan_parameters_rp rp;
-   int e,n;
 
-   if(argc != 5){
+   if (argc != 5)
return USAGE;
-   }

-   if(strcmp(argv[0], "active")==0){
+   if (strcmp(argv[0], "active") == 0)
type = 1;
-   }else if (strcmp(argv[0], "passive") == 0){
+   else if (strcmp(argv[0], "passive") == 0)
type = 0;
-   }else{
+   else
return USAGE;
-   }
 
interval = (int)(atof(argv[1])/0.625);
interval = (interval < 4)? 4: interval;
window = (int)(atof(argv[2])/0.625);
window = (window < 4) ? 4 : interval;

-   if(strcmp(argv[3], "public")==0){
+   if (strcmp(argv[3], "public") == 0)
adrtype = 0;
-   }else if (strcmp(argv[0], "random") == 0){
+   else if (strcmp(argv[0], "random") == 0)
adrtype = 1;
-   }else{
+   else
return USAGE;
-   }
 
-   if(strcmp(argv[4], "all")==0){
+   if (strcmp(argv[4], "all") == 0)
policy = 0;
-   }else if (strcmp(argv[4], "whitelist") == 0){
+   else if (strcmp(argv[4], "whitelist") == 0)
policy = 1;
-   }else{
+   else
return USAGE;
-   }
-   
 
cp.le_scan_type = type;
cp.le_scan_interval = interval;
@@ -109,43 +106,42 @@ static int le_set_scan_param(int s, int 
cp.scanning_filter_policy = policy;
n = sizeof(rp);
e = hci_request(s, NG_HCI_OPCODE(NG_HCI_OGF_LE,
-NG_HCI_OCF_LE_SET_SCAN_PARAMETERS), 
-   (void *)&cp, sizeof(cp), (void *)&rp, &n);
-   
+   NG_HCI_OCF_LE_SET_SCAN_PARAMETERS), 
+   (void *)&cp, sizeof(cp), (void *)&rp, &n);
 
return 0;
-   
 }
 
-
-static int le_set_scan_enable(int s, int argc, char *argv[])
+static int
+le_set_scan_enable(int s, int argc, char *argv[])
 {
ng_hci_le_set_scan_enable_cp cp;
ng_hci_le_set_scan_enable_rp rp;
-   int e,n,enable = 0;
+   int e, n, enable = 0;
 
-   if(argc != 1)
+   if (argc != 1)
return USAGE;
  
-   if(strcmp(argv[0], "enable") == 0){
+   if (strcmp(argv[0], "enable") == 0)
   

svn commit: r281685 - head/usr.sbin/bluetooth/hccontrol

2015-04-17 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Sat Apr 18 06:53:13 2015
New Revision: 281685
URL: https://svnweb.freebsd.org/changeset/base/281685

Log:
  Fix misspelling.

Modified:
  head/usr.sbin/bluetooth/hccontrol/le.c

Modified: head/usr.sbin/bluetooth/hccontrol/le.c
==
--- head/usr.sbin/bluetooth/hccontrol/le.c  Sat Apr 18 06:48:03 2015
(r281684)
+++ head/usr.sbin/bluetooth/hccontrol/le.c  Sat Apr 18 06:53:13 2015
(r281685)
@@ -232,7 +232,7 @@ le_read_local_supported_features(int s, 
NG_HCI_OCF_LE_READ_LOCAL_SUPPORTED_FEATURES), 
(void *)&rp, &n);
 
-   printf("LOCAL SUPPOREDED: %d %d %lu\n", e, rp.status,
+   printf("LOCAL SUPPORTED: %d %d %lu\n", e, rp.status,
rp.le_features);
 
return 0;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r281772 - head/sys/dev/ixgbe

2015-04-20 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Mon Apr 20 17:21:15 2015
New Revision: 281772
URL: https://svnweb.freebsd.org/changeset/base/281772

Log:
  Remove unused variable.
  
  Differential Revision:D2331
  Reviewed by:  erj

Modified:
  head/sys/dev/ixgbe/if_ix.c

Modified: head/sys/dev/ixgbe/if_ix.c
==
--- head/sys/dev/ixgbe/if_ix.c  Mon Apr 20 16:48:21 2015(r281771)
+++ head/sys/dev/ixgbe/if_ix.c  Mon Apr 20 17:21:15 2015(r281772)
@@ -1195,10 +1195,8 @@ ixgbe_handle_que(void *context, int pend
struct adapter  *adapter = que->adapter;
struct tx_ring  *txr = que->txr;
struct ifnet*ifp = adapter->ifp;
-   boolmore;
 
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
-   more = ixgbe_rxeof(que);
IXGBE_TX_LOCK(txr);
ixgbe_txeof(txr);
 #ifndef IXGBE_LEGACY_TX
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r281773 - head/sys/dev/ixgbe

2015-04-20 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Mon Apr 20 17:24:39 2015
New Revision: 281773
URL: https://svnweb.freebsd.org/changeset/base/281773

Log:
  Add back ixgbe_rxeof, just remove the assignment to more.

Modified:
  head/sys/dev/ixgbe/if_ix.c

Modified: head/sys/dev/ixgbe/if_ix.c
==
--- head/sys/dev/ixgbe/if_ix.c  Mon Apr 20 17:21:15 2015(r281772)
+++ head/sys/dev/ixgbe/if_ix.c  Mon Apr 20 17:24:39 2015(r281773)
@@ -1197,6 +1197,7 @@ ixgbe_handle_que(void *context, int pend
struct ifnet*ifp = adapter->ifp;
 
if (ifp->if_drv_flags & IFF_DRV_RUNNING) {
+   ixgbe_rxeof(que);
IXGBE_TX_LOCK(txr);
ixgbe_txeof(txr);
 #ifndef IXGBE_LEGACY_TX
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r281774 - head/sys/dev/xen/netfront

2015-04-20 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Mon Apr 20 17:30:13 2015
New Revision: 281774
URL: https://svnweb.freebsd.org/changeset/base/281774

Log:
  Remove unused variable.
  
  Differential Revision:D2333
  Reviewed by:  royger

Modified:
  head/sys/dev/xen/netfront/netfront.c

Modified: head/sys/dev/xen/netfront/netfront.c
==
--- head/sys/dev/xen/netfront/netfront.cMon Apr 20 17:24:39 2015
(r281773)
+++ head/sys/dev/xen/netfront/netfront.cMon Apr 20 17:30:13 2015
(r281774)
@@ -1472,7 +1472,6 @@ xn_assemble_tx_request(struct netfront_i
struct ifnet *ifp;
struct mbuf *m;
u_int nfrags;
-   netif_extra_info_t *extra;
int otherend_id;
 
ifp = sc->xn_ifp;
@@ -1546,7 +1545,6 @@ xn_assemble_tx_request(struct netfront_i
 * of fragments or hit the end of the mbuf chain.
 */
m = m_head;
-   extra = NULL;
otherend_id = xenbus_get_otherend_id(sc->xbdev);
for (m = m_head; m; m = m->m_next) {
netif_tx_request_t *tx;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r281879 - head/sys/amd64/vmm/amd

2015-04-22 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Thu Apr 23 02:50:06 2015
New Revision: 281879
URL: https://svnweb.freebsd.org/changeset/base/281879

Log:
  Missing break in switch case.
  
  Differential Revision:D2342
  Reviewed by:  neel

Modified:
  head/sys/amd64/vmm/amd/svm.c

Modified: head/sys/amd64/vmm/amd/svm.c
==
--- head/sys/amd64/vmm/amd/svm.cThu Apr 23 01:52:07 2015
(r281878)
+++ head/sys/amd64/vmm/amd/svm.cThu Apr 23 02:50:06 2015
(r281879)
@@ -802,6 +802,7 @@ svm_handle_inst_emul(struct vmcb *vmcb, 
case CPU_MODE_REAL:
vmexit->u.inst_emul.cs_base = seg.base;
vmexit->u.inst_emul.cs_d = 0;
+   break;
case CPU_MODE_PROTECTED:
case CPU_MODE_COMPATIBILITY:
vmexit->u.inst_emul.cs_base = seg.base;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282819 - stable/10/sys/dev/ixgbe

2015-05-12 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Tue May 12 16:36:54 2015
New Revision: 282819
URL: https://svnweb.freebsd.org/changeset/base/282819

Log:
  Fix the media detected for copper cables NIC based on chipsest X540T.
  
  Requested by: hiren@
  MFH:  279803

Modified:
  stable/10/sys/dev/ixgbe/ixgbe.c

Modified: stable/10/sys/dev/ixgbe/ixgbe.c
==
--- stable/10/sys/dev/ixgbe/ixgbe.c Tue May 12 15:21:19 2015
(r282818)
+++ stable/10/sys/dev/ixgbe/ixgbe.c Tue May 12 16:36:54 2015
(r282819)
@@ -1673,6 +1673,7 @@ static void
 ixgbe_media_status(struct ifnet * ifp, struct ifmediareq * ifmr)
 {
struct adapter *adapter = ifp->if_softc;
+   struct ixgbe_hw *hw = &adapter->hw;
 
INIT_DEBUGOUT("ixgbe_media_status: begin");
IXGBE_CORE_LOCK(adapter);
@@ -1688,17 +1689,28 @@ ixgbe_media_status(struct ifnet * ifp, s
 
ifmr->ifm_status |= IFM_ACTIVE;
 
-   switch (adapter->link_speed) {
-   case IXGBE_LINK_SPEED_100_FULL:
-   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
-   break;
-   case IXGBE_LINK_SPEED_1GB_FULL:
-   ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
-   break;
-   case IXGBE_LINK_SPEED_10GB_FULL:
-   ifmr->ifm_active |= adapter->optics | IFM_FDX;
-   break;
-   }
+   /*
+* Not all NIC are 1000baseSX as an example X540T.
+* We must set properly the media based on NIC model.
+*/
+   switch (hw->device_id) {
+  case IXGBE_DEV_ID_X540T:
+   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
+   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_1GB_FULL)
+   ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
+   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_10GB_FULL)
+   ifmr->ifm_active |= adapter->optics | IFM_FDX;
+   break;
+  default:
+   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
+   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_1GB_FULL)
+   ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
+   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_10GB_FULL)
+   ifmr->ifm_active |= adapter->optics | IFM_FDX;
+   break;
+   }
 
IXGBE_CORE_UNLOCK(adapter);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282833 - stable/10/sys/dev/ixgbe

2015-05-13 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Wed May 13 08:58:06 2015
New Revision: 282833
URL: https://svnweb.freebsd.org/changeset/base/282833

Log:
  Convert space to tabs in the bits that I changed in my last commit.
  No functional change.
  
  Reported by:  jmallet@

Modified:
  stable/10/sys/dev/ixgbe/ixgbe.c

Modified: stable/10/sys/dev/ixgbe/ixgbe.c
==
--- stable/10/sys/dev/ixgbe/ixgbe.c Wed May 13 08:04:50 2015
(r282832)
+++ stable/10/sys/dev/ixgbe/ixgbe.c Wed May 13 08:58:06 2015
(r282833)
@@ -1673,7 +1673,7 @@ static void
 ixgbe_media_status(struct ifnet * ifp, struct ifmediareq * ifmr)
 {
struct adapter *adapter = ifp->if_softc;
-   struct ixgbe_hw *hw = &adapter->hw;
+   struct ixgbe_hw *hw = &adapter->hw;
 
INIT_DEBUGOUT("ixgbe_media_status: begin");
IXGBE_CORE_LOCK(adapter);
@@ -1689,28 +1689,28 @@ ixgbe_media_status(struct ifnet * ifp, s
 
ifmr->ifm_status |= IFM_ACTIVE;
 
-   /*
-* Not all NIC are 1000baseSX as an example X540T.
-* We must set properly the media based on NIC model.
-*/
-   switch (hw->device_id) {
-  case IXGBE_DEV_ID_X540T:
-   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
-   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
-   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_1GB_FULL)
-   ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
-   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_10GB_FULL)
-   ifmr->ifm_active |= adapter->optics | IFM_FDX;
-   break;
-  default:
-   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
-   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
-   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_1GB_FULL)
-   ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
-   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_10GB_FULL)
-   ifmr->ifm_active |= adapter->optics | IFM_FDX;
-   break;
-   }
+   /*
+* Not all NIC are 1000baseSX as an example X540T.
+* We must set properly the media based on NIC model.
+*/
+   switch (hw->device_id) {
+   case IXGBE_DEV_ID_X540T:
+   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
+   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+   else if (adapter->link_speed == IXGBE_LINK_SPEED_1GB_FULL)
+   ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
+   else if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL)
+   ifmr->ifm_active |= adapter->optics | IFM_FDX;
+   break;
+   default:
+   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
+   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+   else if (adapter->link_speed == IXGBE_LINK_SPEED_1GB_FULL)
+   ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
+   else if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL)
+   ifmr->ifm_active |= adapter->optics | IFM_FDX;
+   break;
+   }
 
IXGBE_CORE_UNLOCK(adapter);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282939 - head/sys/dev/ixl

2015-05-14 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Fri May 15 06:11:47 2015
New Revision: 282939
URL: https://svnweb.freebsd.org/changeset/base/282939

Log:
  Free vsi->queues after use.
  
  Differential Revision:D2344
  Reviewed by:  erj

Modified:
  head/sys/dev/ixl/if_ixlv.c

Modified: head/sys/dev/ixl/if_ixlv.c
==
--- head/sys/dev/ixl/if_ixlv.c  Fri May 15 06:05:30 2015(r282938)
+++ head/sys/dev/ixl/if_ixlv.c  Fri May 15 06:11:47 2015(r282939)
@@ -1693,7 +1693,6 @@ ixlv_setup_queues(struct ixlv_sc *sc)
return (0);
 
 fail:
-   free(vsi->queues, M_DEVBUF);
for (int i = 0; i < vsi->num_queues; i++) {
que = &vsi->queues[i];
rxr = &que->rxr;
@@ -1703,6 +1702,7 @@ fail:
if (txr->base)
i40e_free_dma_mem(&sc->hw, &txr->dma);
}
+   free(vsi->queues, M_DEVBUF);
 
 early:
return (error);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r282943 - stable/10/sys/dev/ixl

2015-05-15 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Fri May 15 07:07:37 2015
New Revision: 282943
URL: https://svnweb.freebsd.org/changeset/base/282943

Log:
  MFC r282939: Free vsi->queues after use.

Modified:
  stable/10/sys/dev/ixl/if_ixlv.c

Modified: stable/10/sys/dev/ixl/if_ixlv.c
==
--- stable/10/sys/dev/ixl/if_ixlv.c Fri May 15 06:50:59 2015
(r282942)
+++ stable/10/sys/dev/ixl/if_ixlv.c Fri May 15 07:07:37 2015
(r282943)
@@ -1646,7 +1646,6 @@ ixlv_setup_queues(struct ixlv_sc *sc)
return (0);
 
 fail:
-   free(vsi->queues, M_DEVBUF);
for (int i = 0; i < vsi->num_queues; i++) {
que = &vsi->queues[i];
rxr = &que->rxr;
@@ -1656,6 +1655,7 @@ fail:
if (txr->base)
i40e_free_dma_mem(&sc->hw, &txr->dma);
}
+   free(vsi->queues, M_DEVBUF);
 
 early:
return (error);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r279803 - head/sys/dev/ixgbe

2015-03-09 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Mon Mar  9 08:22:11 2015
New Revision: 279803
URL: https://svnweb.freebsd.org/changeset/base/279803

Log:
  Fix the media detected for copper cables NIC based on chipset X540T.
  
  Phabric:D811
  Reviewed by:jfvogel
  Approved by:  jfvogel
  Sponsored by:   QNAP Systems Inc.

Modified:
  head/sys/dev/ixgbe/ixgbe.c

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Mon Mar  9 04:00:46 2015(r279802)
+++ head/sys/dev/ixgbe/ixgbe.c  Mon Mar  9 08:22:11 2015(r279803)
@@ -1699,6 +1699,7 @@ static void
 ixgbe_media_status(struct ifnet * ifp, struct ifmediareq * ifmr)
 {
struct adapter *adapter = ifp->if_softc;
+   struct ixgbe_hw *hw = &adapter->hw;
 
INIT_DEBUGOUT("ixgbe_media_status: begin");
IXGBE_CORE_LOCK(adapter);
@@ -1714,17 +1715,29 @@ ixgbe_media_status(struct ifnet * ifp, s
 
ifmr->ifm_status |= IFM_ACTIVE;
 
-   switch (adapter->link_speed) {
-   case IXGBE_LINK_SPEED_100_FULL:
-   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
-   break;
-   case IXGBE_LINK_SPEED_1GB_FULL:
-   ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
-   break;
-   case IXGBE_LINK_SPEED_10GB_FULL:
-   ifmr->ifm_active |= adapter->optics | IFM_FDX;
-   break;
-   }
+   /*
+* Not all NIC are 1000baseSX as an example X540T.
+* We must set properly the media based on NIC model.
+*/
+   switch (hw->device_id) {
+  case IXGBE_DEV_ID_X540T:
+   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
+   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_1GB_FULL)
+   ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
+   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_10GB_FULL)
+   ifmr->ifm_active |= adapter->optics | IFM_FDX;
+   break;
+  default:
+   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
+   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_1GB_FULL)
+   ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
+   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_10GB_FULL)
+   ifmr->ifm_active |= adapter->optics | IFM_FDX;
+   break;
+   }
+
 
IXGBE_CORE_UNLOCK(adapter);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r279804 - head/sys/dev/ixgbe

2015-03-09 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Mon Mar  9 08:43:27 2015
New Revision: 279804
URL: https://svnweb.freebsd.org/changeset/base/279804

Log:
  Now ifconfig(8) can set the media option as 10Gbase-T for ixgbe(4).
  
  Differential Revision:D823
  Reviewed by:  jfvogel
  Approved by:  jfvogel
  Sponsored by: QNAP Systems Inc.

Modified:
  head/sys/dev/ixgbe/ixgbe.c

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Mon Mar  9 08:22:11 2015(r279803)
+++ head/sys/dev/ixgbe/ixgbe.c  Mon Mar  9 08:43:27 2015(r279804)
@@ -1764,6 +1764,7 @@ ixgbe_media_change(struct ifnet * ifp)
return (EINVAL);
 
 switch (IFM_SUBTYPE(ifm->ifm_media)) {
+   case IFM_10G_T:
 case IFM_AUTO:
 adapter->hw.phy.autoneg_advertised =
IXGBE_LINK_SPEED_100_FULL |
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r279805 - head/sys/dev/ixgbe

2015-03-09 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Mon Mar  9 10:29:15 2015
New Revision: 279805
URL: https://svnweb.freebsd.org/changeset/base/279805

Log:
  Fix style(9) from my previous commit r279803.
  
  Spotted by:   kevlo

Modified:
  head/sys/dev/ixgbe/ixgbe.c

Modified: head/sys/dev/ixgbe/ixgbe.c
==
--- head/sys/dev/ixgbe/ixgbe.c  Mon Mar  9 08:43:27 2015(r279804)
+++ head/sys/dev/ixgbe/ixgbe.c  Mon Mar  9 10:29:15 2015(r279805)
@@ -1699,7 +1699,7 @@ static void
 ixgbe_media_status(struct ifnet * ifp, struct ifmediareq * ifmr)
 {
struct adapter *adapter = ifp->if_softc;
-   struct ixgbe_hw *hw = &adapter->hw;
+   struct ixgbe_hw *hw = &adapter->hw;
 
INIT_DEBUGOUT("ixgbe_media_status: begin");
IXGBE_CORE_LOCK(adapter);
@@ -1715,29 +1715,28 @@ ixgbe_media_status(struct ifnet * ifp, s
 
ifmr->ifm_status |= IFM_ACTIVE;
 
-   /*
-* Not all NIC are 1000baseSX as an example X540T.
-* We must set properly the media based on NIC model.
-*/
-   switch (hw->device_id) {
-  case IXGBE_DEV_ID_X540T:
-   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
-   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
-   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_1GB_FULL)
-   ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
-   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_10GB_FULL)
-   ifmr->ifm_active |= adapter->optics | IFM_FDX;
-   break;
-  default:
-   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
-   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
-   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_1GB_FULL)
-   ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
-   else if (adapter->link_speed == 
IXGBE_LINK_SPEED_10GB_FULL)
-   ifmr->ifm_active |= adapter->optics | IFM_FDX;
-   break;
-   }
-
+   /*
+* Not all NIC are 1000baseSX as an example X540T.
+* We must set properly the media based on NIC model.
+*/
+   switch (hw->device_id) {
+   case IXGBE_DEV_ID_X540T:
+   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
+   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+   else if (adapter->link_speed == IXGBE_LINK_SPEED_1GB_FULL)
+   ifmr->ifm_active |= IFM_1000_T | IFM_FDX;
+   else if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL)
+   ifmr->ifm_active |= adapter->optics | IFM_FDX;
+   break;
+   default:
+   if (adapter->link_speed == IXGBE_LINK_SPEED_100_FULL)
+   ifmr->ifm_active |= IFM_100_TX | IFM_FDX;
+   else if (adapter->link_speed == IXGBE_LINK_SPEED_1GB_FULL)
+   ifmr->ifm_active |= IFM_1000_SX | IFM_FDX;
+   else if (adapter->link_speed == IXGBE_LINK_SPEED_10GB_FULL)
+   ifmr->ifm_active |= adapter->optics | IFM_FDX;
+   break;
+   }
 
IXGBE_CORE_UNLOCK(adapter);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r271732 - in head: sbin/ifconfig share/man/man4 sys/net

2014-09-17 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Thu Sep 18 02:12:48 2014
New Revision: 271732
URL: http://svnweb.freebsd.org/changeset/base/271732

Log:
  Add laggproto broadcast, it allows sends frames to all ports of the lagg(4) 
group
  and receives frames on any port of the lagg(4).
  
  Phabric:  D549
  Reviewed by:  glebius, thompsa
  Approved by:  glebius
  Obtained from:OpenBSD
  Sponsored by: QNAP Systems Inc.

Modified:
  head/sbin/ifconfig/ifconfig.8
  head/share/man/man4/lagg.4
  head/sys/net/if_lagg.c
  head/sys/net/if_lagg.h

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Thu Sep 18 02:01:36 2014
(r271731)
+++ head/sbin/ifconfig/ifconfig.8   Thu Sep 18 02:12:48 2014
(r271732)
@@ -2332,8 +2332,8 @@ from the aggregation interface.
 .It Cm laggproto Ar proto
 Set the aggregation protocol.
 The default is failover.
-The available options are failover, fec, lacp, loadbalance, roundrobin and
-none.
+The available options are failover, fec, lacp, loadbalance, roundrobin, 
broadcast
+and none.
 .It Cm lagghash Ar option Ns Oo , Ns Ar option Oc
 Set the packet layers to hash for aggregation protocols which load balance.
 The default is

Modified: head/share/man/man4/lagg.4
==
--- head/share/man/man4/lagg.4  Thu Sep 18 02:01:36 2014(r271731)
+++ head/share/man/man4/lagg.4  Thu Sep 18 02:12:48 2014(r271732)
@@ -65,6 +65,7 @@ The driver currently supports the aggreg
 .Ic lacp ,
 .Ic loadbalance ,
 .Ic roundrobin ,
+.Ic broadcast ,
 and
 .Ic none .
 The protocols determine which ports are used for outgoing traffic
@@ -113,6 +114,9 @@ available, the VLAN tag, and the IP sour
 Distributes outgoing traffic using a round-robin scheduler
 through all active ports and accepts incoming traffic from
 any active port.
+.It Ic broadcast
+Sends frames to all ports of the LAG and receives frames on
+any port of the LAG.
 .It Ic none
 This protocol is intended to do nothing: it disables any traffic without
 disabling the

Modified: head/sys/net/if_lagg.c
==
--- head/sys/net/if_lagg.c  Thu Sep 18 02:01:36 2014(r271731)
+++ head/sys/net/if_lagg.c  Thu Sep 18 02:12:48 2014(r271732)
@@ -3,6 +3,7 @@
 /*
  * Copyright (c) 2005, 2006 Reyk Floeter 
  * Copyright (c) 2007 Andrew Thompson 
+ * Copyright (c) 2014 Marcelo Araujo 
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -147,6 +148,13 @@ static struct mbuf *lagg_lb_input(struct
struct mbuf *);
 static int lagg_lb_porttable(struct lagg_softc *, struct lagg_port *);
 
+/* Broadcast */
+static intlagg_bcast_attach(struct lagg_softc *);
+static intlagg_bcast_detach(struct lagg_softc *);
+static intlagg_bcast_start(struct lagg_softc *, struct mbuf *);
+static struct mbuf *lagg_bcast_input(struct lagg_softc *, struct lagg_port *,
+  struct mbuf *);
+
 /* 802.3ad LACP */
 static int lagg_lacp_attach(struct lagg_softc *);
 static int lagg_lacp_detach(struct lagg_softc *);
@@ -163,10 +171,11 @@ static const struct {
int (*ti_attach)(struct lagg_softc *);
 } lagg_protos[] = {
{ LAGG_PROTO_ROUNDROBIN,lagg_rr_attach },
-   { LAGG_PROTO_FAILOVER,  lagg_fail_attach },
+   { LAGG_PROTO_FAILOVER,  lagg_fail_attach },
{ LAGG_PROTO_LOADBALANCE,   lagg_lb_attach },
{ LAGG_PROTO_ETHERCHANNEL,  lagg_lb_attach },
{ LAGG_PROTO_LACP,  lagg_lacp_attach },
+   { LAGG_PROTO_BROADCAST, lagg_bcast_attach },
{ LAGG_PROTO_NONE,  NULL }
 };
 
@@ -918,6 +927,7 @@ lagg_port2req(struct lagg_port *lp, stru
case LAGG_PROTO_ROUNDROBIN:
case LAGG_PROTO_LOADBALANCE:
case LAGG_PROTO_ETHERCHANNEL:
+  case LAGG_PROTO_BROADCAST:
if (LAGG_PORTACTIVE(lp))
rp->rp_flags |= LAGG_PORT_ACTIVE;
break;
@@ -1440,6 +1450,7 @@ lagg_linkstate(struct lagg_softc *sc)
case LAGG_PROTO_ROUNDROBIN:
case LAGG_PROTO_LOADBALANCE:
case LAGG_PROTO_ETHERCHANNEL:
+  case LAGG_PROTO_BROADCAST:
speed = 0;
SLIST_FOREACH(lp, &sc->sc_ports, lp_entries)
speed += lp->lp_ifp->if_baudrate;
@@ -1722,6 +1733,91 @@ lagg_rr_input(struct lagg_softc *sc, str
 }
 
 /*
+ * Broadcast mode
+ */
+
+static int
+lagg_bcast_attach(struct lagg_softc *sc)
+{
+   sc->sc_detach = lagg_bcast_detach;
+   sc->sc_start = lagg_bcast_start;
+   sc->sc

svn commit: r271733 - in head: sbin/ifconfig share/man/man4

2014-09-17 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Thu Sep 18 02:22:02 2014
New Revision: 271733
URL: http://svnweb.freebsd.org/changeset/base/271733

Log:
  The lagg(4) interface is based on trunk(4) interface from OpenBSD.
  The FreeBSD is the only system that has the FEC protocol, that is a simple 
alias
  to loadbalance protocol and does not implement the ancient Cisco FEC standard.
  
  From now on, we remove the fec protocol from the documentation and keep the 
FEC
  code only for compatibility.
  
  Phabric:  D539
  Reviewed by:  glebius, thompsa
  Approved by:  glebius
  Sponsored by: QNAP Systems Inc.

Modified:
  head/sbin/ifconfig/ifconfig.8
  head/share/man/man4/lagg.4

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Thu Sep 18 02:12:48 2014
(r271732)
+++ head/sbin/ifconfig/ifconfig.8   Thu Sep 18 02:22:02 2014
(r271733)
@@ -2332,7 +2332,7 @@ from the aggregation interface.
 .It Cm laggproto Ar proto
 Set the aggregation protocol.
 The default is failover.
-The available options are failover, fec, lacp, loadbalance, roundrobin, 
broadcast
+The available options are failover, lacp, loadbalance, roundrobin, broadcast
 and none.
 .It Cm lagghash Ar option Ns Oo , Ns Ar option Oc
 Set the packet layers to hash for aggregation protocols which load balance.

Modified: head/share/man/man4/lagg.4
==
--- head/share/man/man4/lagg.4  Thu Sep 18 02:12:48 2014(r271732)
+++ head/share/man/man4/lagg.4  Thu Sep 18 02:22:02 2014(r271733)
@@ -61,7 +61,6 @@ option.
 The driver currently supports the aggregation protocols
 .Ic failover
 (the default),
-.Ic fec ,
 .Ic lacp ,
 .Ic loadbalance ,
 .Ic roundrobin ,
@@ -87,9 +86,6 @@ This constraint can be relaxed by settin
 .Xr sysctl 8
 variable to a nonzero value,
 which is useful for certain bridged network setups.
-.It Ic fec
-Supports Cisco EtherChannel.
-This is an alias for
 .Ic loadbalance
 mode.
 .It Ic lacp
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r271735 - head/sys/net

2014-09-17 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Thu Sep 18 03:09:34 2014
New Revision: 271735
URL: http://svnweb.freebsd.org/changeset/base/271735

Log:
  Remove old comment, we already do 802.1q tagging.
  
  Phabric:  D797
  Reviewed by:  kevlo
  Approved by:  kevlo
  Sponsored by: QNAP Systems Inc.

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Thu Sep 18 03:02:00 2014(r271734)
+++ head/sys/net/if_vlan.c  Thu Sep 18 03:09:34 2014(r271735)
@@ -29,8 +29,7 @@
 
 /*
  * if_vlan.c - pseudo-device driver for IEEE 802.1Q virtual LANs.
- * Might be extended some day to also handle IEEE 802.1p priority
- * tagging.  This is sort of sneaky in the implementation, since
+ * This is sort of sneaky in the implementation, since
  * we need to pretend to be enough of an Ethernet implementation
  * to make arp work.  The way we do this is by telling everyone
  * that we are an Ethernet, and then catch the packets that
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r271735 - head/sys/net

2014-09-17 Thread Marcelo Araujo
2014-09-18 13:18 GMT+08:00 Gleb Smirnoff :

> On Thu, Sep 18, 2014 at 03:09:35AM +0000, Marcelo Araujo wrote:
> M> Author: araujo (ports committer)
> M> Date: Thu Sep 18 03:09:34 2014
> M> New Revision: 271735
> M> URL: http://svnweb.freebsd.org/changeset/base/271735
> M>
> M> Log:
> M>   Remove old comment, we already do 802.1q tagging.
>
> But the comment speaks about 802.1p priority tagging, which
> we do not support. So the comment was absolutely correct.
>
> I'd prefer to see patch reverted.
>

Hello Glebs,

I got confused with the packet tagged and packet to be tagged. My mistake,
I'm gonna revert this revision.

My apologies for the wrong explanation to Kevin.

Thanks Glebs.


> --
>
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r271738 - head/sys/net

2014-09-17 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Thu Sep 18 05:43:19 2014
New Revision: 271738
URL: http://svnweb.freebsd.org/changeset/base/271738

Log:
  Revert r271735. The comment is absolutely correct, we do not support 802.1p 
priority tagging. I got confused with the packet tagged and packet to be tagged.
  
  Spotted by:   glebius

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Thu Sep 18 05:40:33 2014(r271737)
+++ head/sys/net/if_vlan.c  Thu Sep 18 05:43:19 2014(r271738)
@@ -29,7 +29,8 @@
 
 /*
  * if_vlan.c - pseudo-device driver for IEEE 802.1Q virtual LANs.
- * This is sort of sneaky in the implementation, since
+ * Might be extended some day to also handle IEEE 802.1p priority
+ * tagging.  This is sort of sneaky in the implementation, since
  * we need to pretend to be enough of an Ethernet implementation
  * to make arp work.  The way we do this is by telling everyone
  * that we are an Ethernet, and then catch the packets that
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r271735 - head/sys/net

2014-09-18 Thread Marcelo Araujo
Hello Adrian,

I have a patch, but it is a hack on PF and some very ugly code. Not generic
at all.
As my hands are dirty now with it, if you don't have too much time, I can
take a look on pfsense implementation.

Best Regards,

2014-09-18 22:32 GMT+08:00 Adrian Chadd :

> There is in pfsense.
>
> Let me see about twisting some arms again... :)
>
>
> -a
>
>
> On 18 September 2014 00:21, Bruce Simpson  wrote:
> > On Thu, 18 Sep 2014, at 07:04, Kevin Lo wrote:
> >> Sorry, I overlooked that.  Marcelo has a patch with 802.1p tagging
> >> support,
> >> I thought the patch was committed.
> >
> > I agree the comment change should be reverted. I changed if_ethersubr.c
> > many years ago to decode 802.1p tags into the mbuf packet header if they
> > are present.
> >
> > However, to my knowledge, there is no support (e.g. in the form of a
> > DiffServ / IntServ mapping) further up in the stack. If someone plans to
> > add this, great -- that would be needed for any form of tangible 802.1p
> > support.
> >
> > --
> > BMS (sent via webmail)
> >
>



-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r271735 - head/sys/net

2014-09-18 Thread Marcelo Araujo
Hello,

I made some tests with the implementation from pfsense and it works like a
charm with very few modifications.

I'm gonna try to make it in two steps.
1) First only submit the vlan(4) and ifconfig(8) changes.
2) Submit the changes on pf(4) and ipfw(8) in a second stage.

I'm going to use phabricator to make easier the follow up, byt the way, the
patch from pfsense partially was made by rwatson@. I'm gonna add rwatson to
the review.

Best Regards,

2014-09-18 23:41 GMT+08:00 Marcelo Araujo :

> Hello Adrian,
>
> I have a patch, but it is a hack on PF and some very ugly code. Not
> generic at all.
> As my hands are dirty now with it, if you don't have too much time, I can
> take a look on pfsense implementation.
>
> Best Regards,
>
> 2014-09-18 22:32 GMT+08:00 Adrian Chadd :
>
>> There is in pfsense.
>>
>> Let me see about twisting some arms again... :)
>>
>>
>> -a
>>
>>
>> On 18 September 2014 00:21, Bruce Simpson  wrote:
>> > On Thu, 18 Sep 2014, at 07:04, Kevin Lo wrote:
>> >> Sorry, I overlooked that.  Marcelo has a patch with 802.1p tagging
>> >> support,
>> >> I thought the patch was committed.
>> >
>> > I agree the comment change should be reverted. I changed if_ethersubr.c
>> > many years ago to decode 802.1p tags into the mbuf packet header if they
>> > are present.
>> >
>> > However, to my knowledge, there is no support (e.g. in the form of a
>> > DiffServ / IntServ mapping) further up in the stack. If someone plans to
>> > add this, great -- that would be needed for any form of tangible 802.1p
>> > support.
>> >
>> > --
>> > BMS (sent via webmail)
>> >
>>
>
>
>
> --
>
> --
> Marcelo Araujo(__)ara...@freebsd.org 
> \\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
> Power To Server. .\. /_)
>
>


-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r272467 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/nfs fs/nfsserver

2014-10-02 Thread Marcelo Araujo
Author: araujo (ports committer)
Date: Fri Oct  3 02:24:41 2014
New Revision: 272467
URL: https://svnweb.freebsd.org/changeset/base/272467

Log:
  Fix failures and warnings reported by newpynfs20090424 test tool.
  This fix addresses only issues with the pynfs reports, none of these
  issues are know to create problems for extant real clients.
  
  Submitted by: Bart Hsiao 
  Reworked by:  myself
  Reviewed by:  rmacklem
  Approved by:  rmacklem
  Sponsored by: QNAP Systems Inc.

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  head/sys/fs/nfs/nfs_commonsubs.c
  head/sys/fs/nfs/nfs_var.h
  head/sys/fs/nfs/nfsproto.h
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/fs/nfsserver/nfs_nfsdserv.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Oct 
 3 01:39:33 2014(r272466)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Oct 
 3 02:24:41 2014(r272467)
@@ -2837,6 +2837,7 @@ zfs_getattr(vnode_t *vp, vattr_t *vap, i
 #endif
vap->va_seq = zp->z_seq;
vap->va_flags = 0;  /* FreeBSD: Reset chflags(2) flags. */
+   vap->va_filerev = zp->z_seq;
 
/*
 * Add in any requested optional attributes and the create time.

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==
--- head/sys/fs/nfs/nfs_commonsubs.cFri Oct  3 01:39:33 2014
(r272466)
+++ head/sys/fs/nfs/nfs_commonsubs.cFri Oct  3 02:24:41 2014
(r272467)
@@ -820,7 +820,6 @@ nfsv4_loadattr(struct nfsrv_descript *nd
struct dqblk dqb;
uid_t savuid;
 #endif
-
if (compare) {
retnotsup = 0;
error = nfsrv_getattrbits(nd, &attrbits, NULL, &retnotsup);
@@ -902,6 +901,12 @@ nfsv4_loadattr(struct nfsrv_descript *nd
goto nfsmout;
if (compare && !(*retcmpp)) {
   NFSSETSUPP_ATTRBIT(&checkattrbits);
+
+  /* Some filesystem do not support NFSv4ACL   */
+  if (nfsrv_useacl == 0 || nfs_supportsnfsv4acls(vp) 
== 0) {
+   NFSCLRBIT_ATTRBIT(&checkattrbits, 
NFSATTRBIT_ACL);
+   NFSCLRBIT_ATTRBIT(&checkattrbits, 
NFSATTRBIT_ACLSUPPORT);
+  }
   if (!NFSEQUAL_ATTRBIT(&retattrbits, &checkattrbits)
   || retnotsup)
*retcmpp = NFSERR_NOTSAME;
@@ -1052,7 +1057,7 @@ nfsv4_loadattr(struct nfsrv_descript *nd
case NFSATTRBIT_ACL:
if (compare) {
  if (!(*retcmpp)) {
-   if (nfsrv_useacl) {
+   if (nfsrv_useacl && nfs_supportsnfsv4acls(vp)) {
NFSACL_T *naclp;
 
naclp = acl_alloc(M_WAITOK);
@@ -1073,21 +1078,22 @@ nfsv4_loadattr(struct nfsrv_descript *nd
}
  }
} else {
-   if (vp != NULL && aclp != NULL)
-   error = nfsrv_dissectacl(nd, aclp, &aceerr,
-   &cnt, p);
-   else
-   error = nfsrv_dissectacl(nd, NULL, &aceerr,
-   &cnt, p);
-   if (error)
-   goto nfsmout;
+   if (vp != NULL && aclp != NULL)
+   error = nfsrv_dissectacl(nd, aclp, &aceerr,
+   &cnt, p);
+   else
+   error = nfsrv_dissectacl(nd, NULL, &aceerr,
+   &cnt, p);
+   if (error)
+   goto nfsmout;
}
+   
attrsum += cnt;
break;
case NFSATTRBIT_ACLSUPPORT:
NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
if (compare && !(*retcmpp)) {
-   if (nfsrv_useacl) {
+   if (nfsrv_useacl && nfs_supportsnfsv4acls(vp)) {
if (fxdr_unsigned(u_int32_t, *tl) !=
NFSV4ACE_SUPTYPES)
*retcmpp = NFSERR_NOTSAME;
@@ -2090,6 +2096,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd
}
}
}
+
/*
 * Put 

Re: svn commit: r272467 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/nfs fs/nfsserver

2014-10-03 Thread Marcelo Araujo
Hey,

Yes I have, you could check here: https://reviews.freebsd.org/D798

I should added the phabric on the commit log. My bad!

Best Regards,
On Oct 4, 2014 1:12 AM, "Bryan Drewery"  wrote:

> On 10/2/2014 9:24 PM, Marcelo Araujo wrote:
> > Author: araujo (ports committer)
> > Date: Fri Oct  3 02:24:41 2014
> > New Revision: 272467
> > URL: https://svnweb.freebsd.org/changeset/base/272467
> >
> > Log:
> >   Fix failures and warnings reported by newpynfs20090424 test tool.
> >   This fix addresses only issues with the pynfs reports, none of these
> >   issues are know to create problems for extant real clients.
>
> Do you have more details than "fix bugs"? :)
>
> Even which failures were fixed would be helpful to document.
>
> >
> >   Submitted by:   Bart Hsiao 
> >   Reworked by:myself
> >   Reviewed by:rmacklem
> >   Approved by:rmacklem
> >   Sponsored by:   QNAP Systems Inc.
> >
>
>
> --
> Regards,
> Bryan Drewery
>
>
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r272467 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs fs/nfs fs/nfsserver

2014-10-03 Thread Marcelo Araujo
Sure, noted! Thanks.
On Oct 4, 2014 1:23 AM, "Ian Lepore"  wrote:

> On Sat, 2014-10-04 at 01:17 +0800, Marcelo Araujo wrote:
> > Hey,
> >
> > Yes I have, you could check here: https://reviews.freebsd.org/D798
> >
> > I should added the phabric on the commit log. My bad!
> >
>
> IMO, no amount of verbiage in phabricator linked to from a commit
> message is a substitute for a proper detailed commit message.
>
> -- Ian
>
> > Best Regards,
> > On Oct 4, 2014 1:12 AM, "Bryan Drewery"  wrote:
> >
> > > On 10/2/2014 9:24 PM, Marcelo Araujo wrote:
> > > > Author: araujo (ports committer)
> > > > Date: Fri Oct  3 02:24:41 2014
> > > > New Revision: 272467
> > > > URL: https://svnweb.freebsd.org/changeset/base/272467
> > > >
> > > > Log:
> > > >   Fix failures and warnings reported by newpynfs20090424 test tool.
> > > >   This fix addresses only issues with the pynfs reports, none of
> these
> > > >   issues are know to create problems for extant real clients.
> > >
> > > Do you have more details than "fix bugs"? :)
> > >
> > > Even which failures were fixed would be helpful to document.
> > >
> > > >
> > > >   Submitted by:   Bart Hsiao 
> > > >   Reworked by:myself
> > > >   Reviewed by:rmacklem
> > > >   Approved by:rmacklem
> > > >   Sponsored by:   QNAP Systems Inc.
> > > >
> > >
> > >
> > > --
> > > Regards,
> > > Bryan Drewery
> > >
> > >
>
>
>
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r349361 - head/usr.sbin/bhyve

2019-06-24 Thread Marcelo Araujo
Author: araujo
Date: Tue Jun 25 06:24:56 2019
New Revision: 349361
URL: https://svnweb.freebsd.org/changeset/base/349361

Log:
  Add SPDX tags to bhyve(8) HD Audio device.
  
  Reviewed by:  bcran
  Differential Revision:https://reviews.freebsd.org/D20750

Replaced:
  head/usr.sbin/bhyve/audio.c
 - copied, changed from r349351, head/usr.sbin/bhyve/audio.c
  head/usr.sbin/bhyve/audio.h
 - copied, changed from r349351, head/usr.sbin/bhyve/audio.h
  head/usr.sbin/bhyve/hda_codec.c
 - copied, changed from r349351, head/usr.sbin/bhyve/hda_codec.c
  head/usr.sbin/bhyve/hda_reg.h
 - copied, changed from r349351, head/usr.sbin/bhyve/hda_reg.h
  head/usr.sbin/bhyve/hdac_reg.h
 - copied, changed from r349351, head/usr.sbin/bhyve/hdac_reg.h
  head/usr.sbin/bhyve/pci_hda.c
 - copied, changed from r349351, head/usr.sbin/bhyve/pci_hda.c
  head/usr.sbin/bhyve/pci_hda.h
 - copied, changed from r349351, head/usr.sbin/bhyve/pci_hda.h

Copied and modified: head/usr.sbin/bhyve/audio.c (from r349351, 
head/usr.sbin/bhyve/audio.c)
==
--- head/usr.sbin/bhyve/audio.c Tue Jun 25 02:35:22 2019(r349351, copy 
source)
+++ head/usr.sbin/bhyve/audio.c Tue Jun 25 06:24:56 2019(r349361)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2016 Alex Teaca 
  * All rights reserved.
  *

Copied and modified: head/usr.sbin/bhyve/audio.h (from r349351, 
head/usr.sbin/bhyve/audio.h)
==
--- head/usr.sbin/bhyve/audio.h Tue Jun 25 02:35:22 2019(r349351, copy 
source)
+++ head/usr.sbin/bhyve/audio.h Tue Jun 25 06:24:56 2019(r349361)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2016 Alex Teaca 
  * All rights reserved.
  *

Copied and modified: head/usr.sbin/bhyve/hda_codec.c (from r349351, 
head/usr.sbin/bhyve/hda_codec.c)
==
--- head/usr.sbin/bhyve/hda_codec.c Tue Jun 25 02:35:22 2019
(r349351, copy source)
+++ head/usr.sbin/bhyve/hda_codec.c Tue Jun 25 06:24:56 2019
(r349361)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2016 Alex Teaca 
  * All rights reserved.
  *

Copied and modified: head/usr.sbin/bhyve/hda_reg.h (from r349351, 
head/usr.sbin/bhyve/hda_reg.h)
==
--- head/usr.sbin/bhyve/hda_reg.h   Tue Jun 25 02:35:22 2019
(r349351, copy source)
+++ head/usr.sbin/bhyve/hda_reg.h   Tue Jun 25 06:24:56 2019
(r349361)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2006 Stephane E. Potvin 
  * All rights reserved.
  *

Copied and modified: head/usr.sbin/bhyve/hdac_reg.h (from r349351, 
head/usr.sbin/bhyve/hdac_reg.h)
==
--- head/usr.sbin/bhyve/hdac_reg.h  Tue Jun 25 02:35:22 2019
(r349351, copy source)
+++ head/usr.sbin/bhyve/hdac_reg.h  Tue Jun 25 06:24:56 2019
(r349361)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2006 Stephane E. Potvin 
  * All rights reserved.
  *

Copied and modified: head/usr.sbin/bhyve/pci_hda.c (from r349351, 
head/usr.sbin/bhyve/pci_hda.c)
==
--- head/usr.sbin/bhyve/pci_hda.c   Tue Jun 25 02:35:22 2019
(r349351, copy source)
+++ head/usr.sbin/bhyve/pci_hda.c   Tue Jun 25 06:24:56 2019
(r349361)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2016 Alex Teaca 
  * All rights reserved.
  *

Copied and modified: head/usr.sbin/bhyve/pci_hda.h (from r349351, 
head/usr.sbin/bhyve/pci_hda.h)
==
--- head/usr.sbin/bhyve/pci_hda.h   Tue Jun 25 02:35:22 2019
(r349351, copy source)
+++ head/usr.sbin/bhyve/pci_hda.h   Tue Jun 25 06:24:56 2019
(r349361)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2016 Alex Teaca 
  * All rights reserved.
  *
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r350433 - head/sys/dev/sound/pci/hda

2019-07-29 Thread Marcelo Araujo
Author: araujo
Date: Tue Jul 30 02:01:49 2019
New Revision: 350433
URL: https://svnweb.freebsd.org/changeset/base/350433

Log:
  Fix sound on headset jack for ALC255 and ALC256 codec.
  
  PR:   219350 [1], [2]
  Submitted by: Masachika ISHIZUKA (ish_at_amail.plala.or.jp) [1]
Neel Chauhan (neel_at_neelc.org) [2]
uri Momotyuk (yurkis_at_gmail.com) [3]
  Reported by:  miwi
  Reviewed by:  mav
  Obtained from:https://github.com/trueos/trueos/pull/279 [3]
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D19017

Modified:
  head/sys/dev/sound/pci/hda/hdaa_patches.c
  head/sys/dev/sound/pci/hda/hdac.h

Modified: head/sys/dev/sound/pci/hda/hdaa_patches.c
==
--- head/sys/dev/sound/pci/hda/hdaa_patches.c   Mon Jul 29 22:07:43 2019
(r350432)
+++ head/sys/dev/sound/pci/hda/hdaa_patches.c   Tue Jul 30 02:01:49 2019
(r350433)
@@ -425,12 +425,21 @@ hdac_pin_patch(struct hdaa_widget *w)
} else if (id == HDA_CODEC_ALC298 && subid == DELL_XPS9560_SUBVENDOR) {
switch (nid) {
case 24:
-   config  = 0x01a1913c;
+   config = 0x01a1913c;
break;
case 26:
-   config  = 0x01a1913d;
+   config = 0x01a1913d;
break;
}
+   } else if (id == HDA_CODEC_ALC256 && subid == DELL_I7577_SUBVENDOR ) {
+   switch (nid) {
+   case 20:
+   patch = "as=1 seq=0";
+   break;
+   case 33:
+   patch = "as=1 seq=15";
+   break;
+   }
}
 
if (patch != NULL)
@@ -768,6 +777,10 @@ hdaa_patch_direct(struct hdaa_devinfo *devinfo)
hdaa_write_coef(dev, 0x20, 0x07, 0x7cb);
}
break;
+   }
+   if (id == HDA_CODEC_ALC255 || id == HDA_CODEC_ALC256) {
+   val = hdaa_read_coef(dev, 0x20, 0x46);
+   hdaa_write_coef(dev, 0x20, 0x46, val|0x3000);
}
if (subid == APPLE_INTEL_MAC)
hda_command(dev, HDA_CMD_12BIT(0, devinfo->nid,

Modified: head/sys/dev/sound/pci/hda/hdac.h
==
--- head/sys/dev/sound/pci/hda/hdac.h   Mon Jul 29 22:07:43 2019
(r350432)
+++ head/sys/dev/sound/pci/hda/hdac.h   Tue Jul 30 02:01:49 2019
(r350433)
@@ -203,6 +203,7 @@
 #define DELL_XPSM1210_SUBVENDORHDA_MODEL_CONSTRUCT(DELL, 0x01d7)
 #define DELL_OPLX745_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x01da)
 #define DELL_XPS9560_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x07be)
+#define DELL_I7577_SUBVENDOR   HDA_MODEL_CONSTRUCT(DELL, 0x0802)
 #define DELL_ALL_SUBVENDOR HDA_MODEL_CONSTRUCT(DELL, 0x)
 
 /* Clevo */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301479 - in head: etc/mtree share/examples

2016-06-05 Thread Marcelo Araujo
Author: araujo
Date: Mon Jun  6 02:43:41 2016
New Revision: 301479
URL: https://svnweb.freebsd.org/changeset/base/301479

Log:
  Install/Connect ypldap.conf(5) on examples.

Modified:
  head/etc/mtree/BSD.usr.dist
  head/share/examples/Makefile

Modified: head/etc/mtree/BSD.usr.dist
==
--- head/etc/mtree/BSD.usr.dist Mon Jun  6 00:35:45 2016(r301478)
+++ head/etc/mtree/BSD.usr.dist Mon Jun  6 02:43:41 2016(r301479)
@@ -425,6 +425,8 @@
 ..
 uefisign
 ..
+ypldap
+..
 ..
 firmware
 ..

Modified: head/share/examples/Makefile
==
--- head/share/examples/MakefileMon Jun  6 00:35:45 2016
(r301478)
+++ head/share/examples/MakefileMon Jun  6 02:43:41 2016
(r301479)
@@ -37,7 +37,8 @@ LDIRS=BSD_daemon \
ses \
scsi_target \
sunrpc \
-   uefisign
+   uefisign \
+   ypldap
 
 XFILES=BSD_daemon/FreeBSD.pfa \
BSD_daemon/README \
@@ -192,7 +193,8 @@ XFILES= BSD_daemon/FreeBSD.pfa \
sunrpc/sort/rsort.c \
sunrpc/sort/sort.x \
sunrpc/sort/sort_proc.c \
-   uefisign/uefikeys
+   uefisign/uefikeys \
+   ypldap/ypldap.conf
 
 BINDIR= ${SHAREDIR}/examples
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301480 - in head/etc: defaults rc.d

2016-06-05 Thread Marcelo Araujo
Author: araujo
Date: Mon Jun  6 03:55:00 2016
New Revision: 301480
URL: https://svnweb.freebsd.org/changeset/base/301480

Log:
  Add rc.d script for ypldap(8).

Added:
  head/etc/rc.d/ypldap   (contents, props changed)
Modified:
  head/etc/defaults/rc.conf

Modified: head/etc/defaults/rc.conf
==
--- head/etc/defaults/rc.conf   Mon Jun  6 02:43:41 2016(r301479)
+++ head/etc/defaults/rc.conf   Mon Jun  6 03:55:00 2016(r301480)
@@ -392,6 +392,8 @@ nis_ypxfrd_enable="NO"  # Run rpc.ypxfrd
 nis_ypxfrd_flags=""# Flags to rpc.ypxfrd (if enabled).
 nis_yppasswdd_enable="NO"  # Run rpc.yppasswdd at boot time (or NO).
 nis_yppasswdd_flags="" # Flags to rpc.yppasswdd (if enabled).
+nis_ypldap_enable="NO" # Run ypldap at boot time (or NO).
+nis_ypldap_flags=""# Flags to ypldap (if enabled).
 
 ### SNMP daemon ###
 # Be sure to understand the security implications of running SNMP v1/v2

Added: head/etc/rc.d/ypldap
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/etc/rc.d/ypldapMon Jun  6 03:55:00 2016(r301480)
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: ypldap
+# REQUIRE: ypserv
+# BEFORE: DAEMON
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name="ypldap"
+rcvar="nis_ypldap_enable"
+
+load_rc_config $name
+
+command="/usr/sbin/${name}"
+command_args="${nis_ypldap_flags}"
+
+start_precmd="ypldap_precmd"
+
+ypldap_precmd()
+{
+   force_depend ypserv nis_server || return 1
+}
+run_rc_command "$1"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301481 - head/etc/rc.d

2016-06-05 Thread Marcelo Araujo
Author: araujo
Date: Mon Jun  6 04:13:49 2016
New Revision: 301481
URL: https://svnweb.freebsd.org/changeset/base/301481

Log:
  Connect ypldap(8) script on Makefile, forgotten on my previous commit r301480.

Modified:
  head/etc/rc.d/Makefile

Modified: head/etc/rc.d/Makefile
==
--- head/etc/rc.d/Makefile  Mon Jun  6 03:55:00 2016(r301480)
+++ head/etc/rc.d/Makefile  Mon Jun  6 04:13:49 2016(r301481)
@@ -120,6 +120,7 @@ FILES=  DAEMON \
var \
watchdogd \
ypbind \
+   ypldap \
yppasswdd \
ypserv \
ypset \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301482 - head/usr.sbin/bluetooth/btpand

2016-06-05 Thread Marcelo Araujo
Author: araujo
Date: Mon Jun  6 04:18:56 2016
New Revision: 301482
URL: https://svnweb.freebsd.org/changeset/base/301482

Log:
  For pointers use NULL instead of 0.

Modified:
  head/usr.sbin/bluetooth/btpand/btpand.c

Modified: head/usr.sbin/bluetooth/btpand/btpand.c
==
--- head/usr.sbin/bluetooth/btpand/btpand.c Mon Jun  6 04:13:49 2016
(r301481)
+++ head/usr.sbin/bluetooth/btpand/btpand.c Mon Jun  6 04:18:56 2016
(r301482)
@@ -171,7 +171,7 @@ main(int argc, char *argv[])
usage();
 
if (!bdaddr_any(&remote_bdaddr) && (server_limit != 0 ||
-   control_path != 0 || (service_name != NULL && l2cap_psm != 0)))
+   control_path != NULL || (service_name != NULL && l2cap_psm != 0)))
usage();
 
/* default options */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301496 - in head: sbin/ifconfig share/man/man4 sys/net sys/sys

2016-06-06 Thread Marcelo Araujo
Author: araujo
Date: Mon Jun  6 09:51:58 2016
New Revision: 301496
URL: https://svnweb.freebsd.org/changeset/base/301496

Log:
  Add support to priority code point (PCP) that is an 3-bit field
  which refers to IEEE 802.1p class of service and maps to the frame
  priority level.
  
  Values in order of priority are: 1 (Background (lowest)),
  0 (Best effort (default)), 2 (Excellent effort),
  3 (Critical applications), 4 (Video, < 100ms latency),
  5 (Video, < 10ms latency), 6 (Internetwork control) and
  7 (Network control (highest)).
  
  Example of usage:
  root# ifconfig em0.1 create
  root# ifconfig em0.1 vlanpcp 3
  
  Note:
  The review D801 includes the pf(4) part, but as discussed with kristof,
  we won't commit the pf(4) bits for now.
  The credits of the original code is from rwatson.
  
  Differential Revision:https://reviews.freebsd.org/D801
  Reviewed by:  gnn, adrian, loos
  Discussed with: rwatson, glebius, kristof
  Tested by:many including Matthew Grooms 
  Obtained from:pfSense
  Relnotes: Yes

Modified:
  head/sbin/ifconfig/ifconfig.8
  head/sbin/ifconfig/ifvlan.c
  head/share/man/man4/vlan.4
  head/sys/net/if.h
  head/sys/net/if_vlan.c
  head/sys/net/if_vlan_var.h
  head/sys/sys/priv.h

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Mon Jun  6 09:30:31 2016
(r301495)
+++ head/sbin/ifconfig/ifconfig.8   Mon Jun  6 09:51:58 2016
(r301496)
@@ -2614,6 +2614,29 @@ Note that
 and
 .Cm vlandev
 must both be set at the same time.
+.It Cm vlanpcp Ar priority_code_point
+Priority code point 
+.Pq Dv PCP
+is an 3-bit field which refers to the IEEE 802.1p
+class of service and maps to the frame priority level.
+.Pp
+Values in order of priority are:
+.Cm 1 
+.Pq Dv Background (lowest) ,
+.Cm 0
+.Pq Dv Best effort (default) ,
+.Cm 2
+.Pq Dv Excellent effort ,
+.Cm 3
+.Pq Dv Critical applications ,
+.Cm 4
+.Pq Dv Video, < 100ms latency ,
+.Cm 5
+.Pq Dv Video, < 10ms latency ,
+.Cm 6
+.Pq Dv Internetwork control ,
+.Cm 7
+.Pq Dv Network control (highest) .
 .It Cm vlandev Ar iface
 Associate the physical interface
 .Ar iface

Modified: head/sbin/ifconfig/ifvlan.c
==
--- head/sbin/ifconfig/ifvlan.c Mon Jun  6 09:30:31 2016(r301495)
+++ head/sbin/ifconfig/ifvlan.c Mon Jun  6 09:51:58 2016(r301496)
@@ -1,6 +1,10 @@
 /*
- * Copyright (c) 1999
- * Bill Paul .  All rights reserved.
+ * Copyright (c) 1999 Bill Paul 
+ * Copyright (c) 2012 ADARA Networks, Inc.
+ * All rights reserved.
+  *
+ * Portions of this software were developed by Robert N. M. Watson under
+ * contract to ADARA Networks, Inc.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -78,10 +82,14 @@ vlan_status(int s)
 {
struct vlanreq  vreq;
 
-   if (getvlan(s, &ifr, &vreq) != -1)
-   printf("\tvlan: %d parent interface: %s\n",
-   vreq.vlr_tag, vreq.vlr_parent[0] == '\0' ?
-   "" : vreq.vlr_parent);
+   if (getvlan(s, &ifr, &vreq) == -1)
+   return;
+   printf("\tvlan: %d", vreq.vlr_tag);
+   if (ioctl(s, SIOCGVLANPCP, (caddr_t)&ifr) != -1)
+   printf(" vlanpcp: %u", ifr.ifr_vlan_pcp);
+   printf(" parent interface: %s", vreq.vlr_parent[0] == '\0' ?
+   "" : vreq.vlr_parent);
+   printf("\n");
 }
 
 static void
@@ -149,6 +157,22 @@ DECL_CMD_FUNC(setvlandev, val, d)
 }
 
 static
+DECL_CMD_FUNC(setvlanpcp, val, d)
+{
+   u_long ul;
+   char *endp;
+
+   ul = strtoul(val, &endp, 0);
+   if (*endp != '\0')
+   errx(1, "invalid value for vlanpcp");
+   if (ul > 7)
+   errx(1, "value for vlanpcp out of range");
+   ifr.ifr_vlan_pcp = ul;
+   if (ioctl(s, SIOCSVLANPCP, (caddr_t)&ifr) == -1)
+   err(1, "SIOCSVLANPCP");
+}
+
+static
 DECL_CMD_FUNC(unsetvlandev, val, d)
 {
struct vlanreq  vreq;
@@ -169,6 +193,7 @@ DECL_CMD_FUNC(unsetvlandev, val, d)
 static struct cmd vlan_cmds[] = {
DEF_CLONE_CMD_ARG("vlan",   setvlantag),
DEF_CLONE_CMD_ARG("vlandev",setvlandev),
+   DEF_CMD_ARG("vlanpcp",  setvlanpcp),
/* NB: non-clone cmds */
DEF_CMD_ARG("vlan", setvlantag),
DEF_CMD_ARG("vlandev",  setvlandev),

Modified: head/share/man/man4/vlan.4
==
--- head/share/man/man4/vlan.4  Mon Jun  6 09:30:31 2016(r301495)
+++ head/share/man/man4/vlan.4  Mon Jun  6 09:51:58 2016(r301496)
@@ -203,5 +203,3 @@ can be corrected manually if used in con
 .Sh SEE ALSO
 .Xr ifconfig 8 ,
 .Xr sysc

Re: svn commit: r301496 - in head: sbin/ifconfig share/man/man4 sys/net sys/sys

2016-06-06 Thread Marcelo Araujo
Hi Bruce,

Thanks for the email.

We have on ipfw(8) support for DSCP[1], I'm not sure if this is the
same/similar case you mentioned for IP DS(DiffServices?).
About the MPLS, the main problem for me is: I have no "network link" with
MPLS that I could even make a test, back in 2008 I was looking for options
that I could reuse on FreeBSD to have a MPLS router support, nowadays I'm
not that keen on MPLS anymore.

2016-06-06 20:03 GMT+08:00 Bruce Simpson :

> It's good to see this patch being aired out and going into mainline
> finally. However, what about IP DS mapping and/or application layer
> mapping? We may not need full-on MPLS style classification, unless we plan
> to take that code later on. (I'm looking at you, NetBSD.)
>



[1] http://svnweb.freebsd.org/base?view=revision&revision=248552


Best,
-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301536 - in head: share/man/man5 usr.sbin/ypldap

2016-06-06 Thread Marcelo Araujo
Author: araujo
Date: Tue Jun  7 01:00:08 2016
New Revision: 301536
URL: https://svnweb.freebsd.org/changeset/base/301536

Log:
  Add an entry on rc.conf(5) explaining the new options
  nis_ypldap_enable and nis_ypldap_flags.
  
  Also add an entry on ypldap(8) that it is a feature ready and
  appears on FreeBSD 11.0.
  
  Requested by: rodrigc
  Relnotes: Yes

Modified:
  head/share/man/man5/rc.conf.5
  head/usr.sbin/ypldap/ypldap.8

Modified: head/share/man/man5/rc.conf.5
==
--- head/share/man/man5/rc.conf.5   Tue Jun  7 00:27:55 2016
(r301535)
+++ head/share/man/man5/rc.conf.5   Tue Jun  7 01:00:08 2016
(r301536)
@@ -2559,6 +2559,22 @@ is set to
 these are the flags to pass to the
 .Xr ypbind 8
 service.
+.It Va nis_ypldap_enable
+.Pq Vt bool
+If set to
+.Dq Li YES ,
+run the
+.Xr ypldap 8
+daemon at system boot time.
+.It Va nis_ypldap_flags
+.Pq Vt str
+If
+.Va nis.ypldap_enable
+is set to
+.Dq Li YES ,
+these are the flags to pass to the
+.Xr ypldap 8
+daemon.
 .It Va nis_ypset_enable
 .Pq Vt bool
 If set to

Modified: head/usr.sbin/ypldap/ypldap.8
==
--- head/usr.sbin/ypldap/ypldap.8   Tue Jun  7 00:27:55 2016
(r301535)
+++ head/usr.sbin/ypldap/ypldap.8   Tue Jun  7 01:00:08 2016
(r301536)
@@ -74,7 +74,9 @@ configuration file.
 The
 .Nm
 program first appeared in
-.Ox 4.4 .
+.Ox 4.4
+and then
+.Fx 11.0 .
 .Sh AUTHORS
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r301496 - in head: sbin/ifconfig share/man/man4 sys/net sys/sys

2016-06-06 Thread Marcelo Araujo
Hi,

Because 802.1p is Layer 2 and on its specification it sets video to 4, what
DSCP does is convert those 3-bits to use on Layer 3 and try to do the CoS
as close as possible with 802.1p.

Best,

2016-06-07 0:54 GMT+08:00 Slawa Olhovchenkov :

> On Mon, Jun 06, 2016 at 09:51:58AM +0000, Marcelo Araujo wrote:
>
> > Author: araujo
> > Date: Mon Jun  6 09:51:58 2016
> > New Revision: 301496
> > URL: https://svnweb.freebsd.org/changeset/base/301496
> >
> > Log:
> >   Add support to priority code point (PCP) that is an 3-bit field
> >   which refers to IEEE 802.1p class of service and maps to the frame
> >   priority level.
> >
> >   Values in order of priority are: 1 (Background (lowest)),
> >   0 (Best effort (default)), 2 (Excellent effort),
> >   3 (Critical applications), 4 (Video, < 100ms latency),
> >   5 (Video, < 10ms latency), 6 (Internetwork control) and
> >   7 (Network control (highest)).
>
> What purpose to use 4 for video?
>
> http://www.cisco.com/c/en/us/td/docs/switches/datacenter/nexus1000/sw/4_0/qos/configuration/guide/nexus1000v_qos/qos_6dscp_val.pdf
> point video is 3.
>
> >   Example of usage:
> >   root# ifconfig em0.1 create
> >   root# ifconfig em0.1 vlanpcp 3
> >
> >   Note:
> >   The review D801 includes the pf(4) part, but as discussed with kristof,
> >   we won't commit the pf(4) bits for now.
> >   The credits of the original code is from rwatson.
> >
> >   Differential Revision:  https://reviews.freebsd.org/D801
> >   Reviewed by:gnn, adrian, loos
> >   Discussed with: rwatson, glebius, kristof
> >   Tested by:  many including Matthew Grooms 
> >   Obtained from:  pfSense
> >   Relnotes:   Yes
> >
> > Modified:
> >   head/sbin/ifconfig/ifconfig.8
> >   head/sbin/ifconfig/ifvlan.c
> >   head/share/man/man4/vlan.4
> >   head/sys/net/if.h
> >   head/sys/net/if_vlan.c
> >   head/sys/net/if_vlan_var.h
> >   head/sys/sys/priv.h
> >
> > Modified: head/sbin/ifconfig/ifconfig.8
> >
> ==
> > --- head/sbin/ifconfig/ifconfig.8 Mon Jun  6 09:30:31 2016
> (r301495)
> > +++ head/sbin/ifconfig/ifconfig.8 Mon Jun  6 09:51:58 2016
> (r301496)
> > @@ -2614,6 +2614,29 @@ Note that
> >  and
> >  .Cm vlandev
> >  must both be set at the same time.
> > +.It Cm vlanpcp Ar priority_code_point
> > +Priority code point
> > +.Pq Dv PCP
> > +is an 3-bit field which refers to the IEEE 802.1p
> > +class of service and maps to the frame priority level.
> > +.Pp
> > +Values in order of priority are:
> > +.Cm 1
> > +.Pq Dv Background (lowest) ,
> > +.Cm 0
> > +.Pq Dv Best effort (default) ,
> > +.Cm 2
> > +.Pq Dv Excellent effort ,
> > +.Cm 3
> > +.Pq Dv Critical applications ,
> > +.Cm 4
> > +.Pq Dv Video, < 100ms latency ,
> > +.Cm 5
> > +.Pq Dv Video, < 10ms latency ,
> > +.Cm 6
> > +.Pq Dv Internetwork control ,
> > +.Cm 7
> > +.Pq Dv Network control (highest) .
> >  .It Cm vlandev Ar iface
> >  Associate the physical interface
> >  .Ar iface
> >
> > Modified: head/sbin/ifconfig/ifvlan.c
> >
> ==
> > --- head/sbin/ifconfig/ifvlan.c   Mon Jun  6 09:30:31 2016
> (r301495)
> > +++ head/sbin/ifconfig/ifvlan.c   Mon Jun  6 09:51:58 2016
> (r301496)
> > @@ -1,6 +1,10 @@
> >  /*
> > - * Copyright (c) 1999
> > - *   Bill Paul .  All rights reserved.
> > + * Copyright (c) 1999 Bill Paul 
> > + * Copyright (c) 2012 ADARA Networks, Inc.
> > + * All rights reserved.
> > +  *
> > + * Portions of this software were developed by Robert N. M. Watson under
> > + * contract to ADARA Networks, Inc.
> >   *
> >   * Redistribution and use in source and binary forms, with or without
> >   * modification, are permitted provided that the following conditions
> > @@ -78,10 +82,14 @@ vlan_status(int s)
> >  {
> >   struct vlanreq  vreq;
> >
> > - if (getvlan(s, &ifr, &vreq) != -1)
> > - printf("\tvlan: %d parent interface: %s\n",
> > - vreq.vlr_tag, vreq.vlr_parent[0] == '\0' ?
> > - "" : vreq.vlr_parent);
> > + if (getvlan(s, &ifr, &vreq) == -1)
> > + return;
> > + printf("\tvlan: %d", vreq.vlr_tag);
> > + if (ioctl(s, SIOCGVLANPCP, (c

svn commit: r301541 - in head: share/man/man5 usr.sbin/ypldap

2016-06-07 Thread Marcelo Araujo
Author: araujo
Date: Tue Jun  7 07:04:05 2016
New Revision: 301541
URL: https://svnweb.freebsd.org/changeset/base/301541

Log:
  Bump date in both manpages.
  
  Reported by:  rodrigc

Modified:
  head/share/man/man5/rc.conf.5
  head/usr.sbin/ypldap/ypldap.8

Modified: head/share/man/man5/rc.conf.5
==
--- head/share/man/man5/rc.conf.5   Tue Jun  7 06:42:35 2016
(r301540)
+++ head/share/man/man5/rc.conf.5   Tue Jun  7 07:04:05 2016
(r301541)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd April 30, 2016
+.Dd June 8, 2016
 .Dt RC.CONF 5
 .Os
 .Sh NAME

Modified: head/usr.sbin/ypldap/ypldap.8
==
--- head/usr.sbin/ypldap/ypldap.8   Tue Jun  7 06:42:35 2016
(r301540)
+++ head/usr.sbin/ypldap/ypldap.8   Tue Jun  7 07:04:05 2016
(r301541)
@@ -15,7 +15,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd $Mdocdate: July 27 2015 $
+.Dd $Mdocdate: June 8 2016 $
 .Dt YPLDAP 8
 .Os
 .Sh NAME
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r301579 - in head: sbin/ifconfig share/man/man4

2016-06-07 Thread Marcelo Araujo
Author: araujo
Date: Wed Jun  8 04:18:57 2016
New Revision: 301579
URL: https://svnweb.freebsd.org/changeset/base/301579

Log:
  Bump date on ifconfig(8) and vlan(4) to reflect the changes made
  on revision r301496.

Modified:
  head/sbin/ifconfig/ifconfig.8
  head/share/man/man4/vlan.4

Modified: head/sbin/ifconfig/ifconfig.8
==
--- head/sbin/ifconfig/ifconfig.8   Wed Jun  8 03:09:30 2016
(r301578)
+++ head/sbin/ifconfig/ifconfig.8   Wed Jun  8 04:18:57 2016
(r301579)
@@ -28,7 +28,7 @@
 .\" From: @(#)ifconfig.8   8.3 (Berkeley) 1/5/94
 .\" $FreeBSD$
 .\"
-.Dd May 29, 2016
+.Dd June 8, 2016
 .Dt IFCONFIG 8
 .Os
 .Sh NAME

Modified: head/share/man/man4/vlan.4
==
--- head/share/man/man4/vlan.4  Wed Jun  8 03:09:30 2016(r301578)
+++ head/share/man/man4/vlan.4  Wed Jun  8 04:18:57 2016(r301579)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 4, 2012
+.Dd June 8, 2016
 .Dt VLAN 4
 .Os
 .Sh NAME
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r301998 - in head: sbin/pfctl share/man/man5 sys/net sys/netpfil/pf

2016-06-17 Thread Marcelo Araujo
Thanks to work on it Kristof!
On Jun 18, 2016 2:22 AM, "Kristof Provost"  wrote:

> Author: kp
> Date: Fri Jun 17 18:21:55 2016
> New Revision: 301998
> URL: https://svnweb.freebsd.org/changeset/base/301998
>
> Log:
>   pf: Filter on and set vlan PCP values
>
>   Adopt the OpenBSD syntax for setting and filtering on VLAN PCP values.
> This
>   introduces two new keywords: 'set prio' to set the PCP value, and 'prio'
> to
>   filter on it.
>
>   Reviewed by:allanjude, araujo
>   Approved by:  re (gjb)
>   Obtained from:  OpenBSD (mostly)
>   Differential Revision:  https://reviews.freebsd.org/D6786
>
> Modified:
>   head/sbin/pfctl/parse.y
>   head/sbin/pfctl/pfctl_parser.c
>   head/share/man/man5/pf.conf.5
>   head/sys/net/pfvar.h
>   head/sys/netpfil/pf/pf.c
>   head/sys/netpfil/pf/pf_ioctl.c
>
> Modified: head/sbin/pfctl/parse.y
>
> ==
> --- head/sbin/pfctl/parse.y Fri Jun 17 17:34:28 2016(r301997)
> +++ head/sbin/pfctl/parse.y Fri Jun 17 18:21:55 2016(r301998)
> @@ -217,6 +217,8 @@ struct filter_opts {
>  #define FOM_TOS0x04
>  #define FOM_KEEP   0x08
>  #define FOM_SRCTRACK   0x10
> +#define FOM_SETPRIO0x0400
> +#define FOM_PRIO   0x2000
> struct node_uid *uid;
> struct node_gid *gid;
> struct {
> @@ -240,6 +242,8 @@ struct filter_opts {
> char*match_tag;
> u_int8_t match_tag_not;
> u_intrtableid;
> +   u_int8_t prio;
> +   u_int8_t set_prio[2];
> struct {
> struct node_host*addr;
> u_int16_t   port;
> @@ -453,7 +457,7 @@ int parseport(char *, struct range *r, i
>  %token BITMASK RANDOM SOURCEHASH ROUNDROBIN STATICPORT PROBABILITY
>  %token ALTQ CBQ CODEL PRIQ HFSC FAIRQ BANDWIDTH TBRSIZE LINKSHARE REALTIME
>  %token UPPERLIMIT QUEUE PRIORITY QLIMIT HOGS BUCKETS RTABLE TARGET
> INTERVAL
> -%token LOAD RULESET_OPTIMIZATION
> +%token LOAD RULESET_OPTIMIZATION PRIO
>  %token STICKYADDRESS MAXSRCSTATES MAXSRCNODES SOURCETRACK GLOBAL RULE
>  %token MAXSRCCONN MAXSRCCONNRATE OVERLOAD FLUSH SLOPPY
>  %token TAGGED TAG IFBOUND FLOATING STATEPOLICY STATEDEFAULTS ROUTE SETTOS
> @@ -468,7 +472,7 @@ int parseport(char *, struct range *r, i
>  %type no dir af fragcache optimizer
>  %type sourcetrack flush unaryop statelock
>  %type action nataction natpasslog scrubaction
> -%type flags flag blockspec
> +%type flags flag blockspec prio
>  %type portplain portstar portrange
>  %type   hashkey
>  %type proto proto_list proto_item
> @@ -504,6 +508,7 @@ int parseport(char *, struct range *r, i
>  %typecodelopts_list codelopts_item codel_opts
>  %type  bandwidth
>  %type   filter_opts filter_opt filter_opts_l
> +%type   filter_sets filter_set filter_sets_l
>  %typeantispoof_opts antispoof_opt
> antispoof_opts_l
>  %typequeue_opts queue_opt queue_opts_l
>  %typescrub_opts scrub_opt scrub_opts_l
> @@ -889,6 +894,17 @@ anchorrule : ANCHOR anchorname dir quick
> YYERROR;
> }
> r.match_tag_not = $9.match_tag_not;
> +   if ($9.marker & FOM_PRIO) {
> +   if ($9.prio == 0)
> +   r.prio = PF_PRIO_ZERO;
> +   else
> +   r.prio = $9.prio;
> +   }
> +   if ($9.marker & FOM_SETPRIO) {
> +   r.set_prio[0] = $9.set_prio[0];
> +   r.set_prio[1] = $9.set_prio[1];
> +   r.scrub_flags |= PFSTATE_SETPRIO;
> +   }
>
> decide_address_family($8.src.host, &r.af);
> decide_address_family($8.dst.host, &r.af);
> @@ -2014,6 +2030,18 @@ pfrule   : action dir logquick interface
> r.prob = $9.prob;
> r.rtableid = $9.rtableid;
>
> +   if ($9.marker & FOM_PRIO) {
> +   if ($9.prio == 0)
> +   r.prio = PF_PRIO_ZERO;
> +   else
> +   r.prio = $9.prio;
> +   }
> +   if ($9.marker & FOM_SETPRIO) {
> +   r.set_prio[0] = $9.set_prio[0];
> +   r.set_prio[1] = $9.set_prio[1];
> +   r.scrub_flags |= PFSTATE_SETPRIO;
> +   }
> +
>

Re: svn commit: r299496 - head/contrib/atf/atf-c/detail

2016-07-04 Thread Marcelo Araujo
Isn't need to have approve from re@ to commit now? As we are closer to have
11-RELEASE.

Best,

2016-05-12 7:39 GMT+08:00 Conrad E. Meyer :

> Author: cem
> Date: Wed May 11 23:39:39 2016
> New Revision: 299496
> URL: https://svnweb.freebsd.org/changeset/base/299496
>
> Log:
>   atf map: Fix double-free in low memory error path
>
>   If atf_list_append(, X, ) fails, X is freed.  Don't free it again.
>
>   If anyone wants to walk this patch upstream, be my guest.  I literally
> cannot
>   upstream it myself due to Google's stupid CLA.
>
>   Reported by:  Coverity
>   CID:  979936
>   Sponsored by: EMC / Isilon Storage Division
>
> Modified:
>   head/contrib/atf/atf-c/detail/map.c
>
> Modified: head/contrib/atf/atf-c/detail/map.c
>
> ==
> --- head/contrib/atf/atf-c/detail/map.c Wed May 11 23:25:59 2016
> (r299495)
> +++ head/contrib/atf/atf-c/detail/map.c Wed May 11 23:39:39 2016
> (r299496)
> @@ -360,7 +360,6 @@ atf_map_insert(atf_map_t *m, const char
>  if (atf_is_error(err)) {
>  if (managed)
>  free(value);
> -free(me);
>  }
>  }
>  } else {
> ___
> svn-src-h...@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"
>



-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r299496 - head/contrib/atf/atf-c/detail

2016-07-04 Thread Marcelo Araujo
Wow yes, didn't notice.. sorry for the noise :)

2016-07-05 11:21 GMT+08:00 Ngie Cooper (yaneurabeya) 
:

>
> > On Jul 4, 2016, at 20:20, Marcelo Araujo 
> wrote:
> >
> > Isn't need to have approve from re@ to commit now? As we are closer to
> have 11-RELEASE.
> >
> > Best,
>
> The commit date was prior to the freeze.
> Thanks,
> -Ngie
>



-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302342 - head/sbin/ping6

2016-07-05 Thread Marcelo Araujo
Author: araujo
Date: Tue Jul  5 07:01:42 2016
New Revision: 302342
URL: https://svnweb.freebsd.org/changeset/base/302342

Log:
  Fix a regression introduced on revision r271909, when using argument -g
  or several hops we have segmentation fault because we overwrite the same
  structure to store information for host and gateway.
  
  Submitted by: Maryse Levavasseur 
  Reworked by:  hrs
  Approved by:  re (hrs)
  Differential Revision:https://reviews.freebsd.org/D6980

Modified:
  head/sbin/ping6/ping6.c

Modified: head/sbin/ping6/ping6.c
==
--- head/sbin/ping6/ping6.c Tue Jul  5 06:16:42 2016(r302341)
+++ head/sbin/ping6/ping6.c Tue Jul  5 07:01:42 2016(r302342)
@@ -515,7 +515,6 @@ main(int argc, char *argv[])
memcpy(&src, res->ai_addr, res->ai_addrlen);
srclen = res->ai_addrlen;
freeaddrinfo(res);
-   res = NULL;
options |= F_SRCADDR;
break;
case 's':   /* size of packet to send */
@@ -631,7 +630,7 @@ main(int argc, char *argv[])
if (error)
errx(1, "%s", gai_strerror(error));
if (res->ai_canonname)
-   hostname = res->ai_canonname;
+   hostname = strdup(res->ai_canonname);
else
hostname = target;
 
@@ -643,6 +642,7 @@ main(int argc, char *argv[])
if ((s = socket(res->ai_family, res->ai_socktype,
res->ai_protocol)) < 0)
err(1, "socket");
+   freeaddrinfo(res);
 
/* set the source address if specified. */
if ((options & F_SRCADDR) != 0) {
@@ -1208,9 +1208,6 @@ main(int argc, char *argv[])
sigaction(SIGALRM, &si_sa, 0);
summary();
 
-   if (res != NULL)
-   freeaddrinfo(res);
-
 if(packet != NULL)
 free(packet);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r302535 - head/usr.sbin/ypldap

2016-07-10 Thread Marcelo Araujo
Author: araujo
Date: Mon Jul 11 03:34:32 2016
New Revision: 302535
URL: https://svnweb.freebsd.org/changeset/base/302535

Log:
  Do not allow whitespace in macro names.
  
  Obtained from:OpenBSD (r1.19).

Modified:
  head/usr.sbin/ypldap/parse.y

Modified: head/usr.sbin/ypldap/parse.y
==
--- head/usr.sbin/ypldap/parse.yMon Jul 11 03:31:12 2016
(r302534)
+++ head/usr.sbin/ypldap/parse.yMon Jul 11 03:34:32 2016
(r302535)
@@ -144,6 +144,14 @@ include: INCLUDE STRING
{
;
 
 varset : STRING '=' STRING {
+   char *s = $1;
+   while (*s++) {
+   if (isspace((unsigned char) *s)) {
+   yyerror("macro name cannot contain "
+ "whitespace");
+   YYERROR;
+   }
+   }
if (symset($1, $3, 0) == -1)
fatal("cannot store variable");
free($1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r340707 - head/usr.sbin/bhyve

2018-11-20 Thread Marcelo Araujo
Author: araujo
Date: Tue Nov 20 22:21:19 2018
New Revision: 340707
URL: https://svnweb.freebsd.org/changeset/base/340707

Log:
  Define AHCI_PORT_IDENT and increase by 1 the VTBLK_BLK_ID_BYTES
  to avoid buffer accessed out of bounds, also switch to snprintf(3).
  
  PR:   200859
  Submitted by: Caglar 
  Obtained from:https://github.com/mist64/xhyve/pull/24
  MFC after:4 weeks
  Sponsored by: iXsystems Inc.

Modified:
  head/usr.sbin/bhyve/pci_ahci.c
  head/usr.sbin/bhyve/pci_virtio_block.c

Modified: head/usr.sbin/bhyve/pci_ahci.c
==
--- head/usr.sbin/bhyve/pci_ahci.c  Tue Nov 20 22:12:10 2018
(r340706)
+++ head/usr.sbin/bhyve/pci_ahci.c  Tue Nov 20 22:21:19 2018
(r340707)
@@ -105,7 +105,7 @@ enum sata_fis_type {
  * ATA commands
  */
 #defineATA_SF_ENAB_SATA_SF 0x10
-#defineATA_SATA_SF_AN  0x05
+#defineATA_SATA_SF_AN  0x05
 #defineATA_SF_DIS_SATA_SF  0x90
 
 /*
@@ -119,6 +119,8 @@ static FILE *dbg;
 #endif
 #define WPRINTF(format, arg...) printf(format, ##arg)
 
+#define AHCI_PORT_IDENT 20 + 1
+
 struct ahci_ioreq {
struct blockif_req io_req;
struct ahci_port *io_pr;
@@ -136,7 +138,7 @@ struct ahci_port {
struct pci_ahci_softc *pr_sc;
uint8_t *cmd_lst;
uint8_t *rfis;
-   char ident[20 + 1];
+   char ident[AHCI_PORT_IDENT];
int port;
int atapi;
int reset;
@@ -2374,7 +2376,8 @@ pci_ahci_init(struct vmctx *ctx, struct pci_devinst *p
MD5Init(&mdctx);
MD5Update(&mdctx, opts, strlen(opts));
MD5Final(digest, &mdctx);
-   sprintf(sc->port[p].ident, "BHYVE-%02X%02X-%02X%02X-%02X%02X",
+   snprintf(sc->port[p].ident, AHCI_PORT_IDENT,
+   "BHYVE-%02X%02X-%02X%02X-%02X%02X",
digest[0], digest[1], digest[2], digest[3], digest[4],
digest[5]);
 

Modified: head/usr.sbin/bhyve/pci_virtio_block.c
==
--- head/usr.sbin/bhyve/pci_virtio_block.c  Tue Nov 20 22:12:10 2018
(r340706)
+++ head/usr.sbin/bhyve/pci_virtio_block.c  Tue Nov 20 22:21:19 2018
(r340707)
@@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
 #define VTBLK_S_IOERR  1
 #defineVTBLK_S_UNSUPP  2
 
-#defineVTBLK_BLK_ID_BYTES  20
+#defineVTBLK_BLK_ID_BYTES  20 + 1
 
 /* Capability bits */
 #defineVTBLK_F_SEG_MAX (1 << 2)/* Maximum request 
segments */
@@ -344,7 +344,8 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst *
MD5Init(&mdctx);
MD5Update(&mdctx, opts, strlen(opts));
MD5Final(digest, &mdctx);
-   sprintf(sc->vbsc_ident, "BHYVE-%02X%02X-%02X%02X-%02X%02X",
+   snprintf(sc->vbsc_ident, VTBLK_BLK_ID_BYTES,
+   "BHYVE-%02X%02X-%02X%02X-%02X%02X",
digest[0], digest[1], digest[2], digest[3], digest[4], digest[5]);
 
/* setup virtio block config space */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r340707 - head/usr.sbin/bhyve

2018-11-20 Thread Marcelo Araujo
Em qua, 21 de nov de 2018 às 08:23, Shawn Webb 
escreveu:

> On Tue, Nov 20, 2018 at 10:21:19PM +0000, Marcelo Araujo wrote:
> > Author: araujo
> > Date: Tue Nov 20 22:21:19 2018
> > New Revision: 340707
> > URL: https://svnweb.freebsd.org/changeset/base/340707
> >
> > Log:
> >   Define AHCI_PORT_IDENT and increase by 1 the VTBLK_BLK_ID_BYTES
> >   to avoid buffer accessed out of bounds, also switch to snprintf(3).
> >
> >   PR: 200859
> >   Submitted by:   Caglar 
> >   Obtained from:  https://github.com/mist64/xhyve/pull/24
> >   MFC after:  4 weeks
> >   Sponsored by:   iXsystems Inc.
> >
> > Modified:
> >   head/usr.sbin/bhyve/pci_ahci.c
> >   head/usr.sbin/bhyve/pci_virtio_block.c
> >
> > Modified: head/usr.sbin/bhyve/pci_ahci.c
> >
> ==
> > --- head/usr.sbin/bhyve/pci_ahci.cTue Nov 20 22:12:10 2018
> (r340706)
> > +++ head/usr.sbin/bhyve/pci_ahci.cTue Nov 20 22:21:19 2018
> (r340707)
> > @@ -105,7 +105,7 @@ enum sata_fis_type {
> >   * ATA commands
> >   */
> >  #define  ATA_SF_ENAB_SATA_SF 0x10
> > -#define  ATA_SATA_SF_AN  0x05
> > +#define  ATA_SATA_SF_AN  0x05
> >  #define  ATA_SF_DIS_SATA_SF  0x90
> >
> >  /*
> > @@ -119,6 +119,8 @@ static FILE *dbg;
> >  #endif
> >  #define WPRINTF(format, arg...) printf(format, ##arg)
> >
> > +#define AHCI_PORT_IDENT 20 + 1
> > +
> >  struct ahci_ioreq {
> >   struct blockif_req io_req;
> >   struct ahci_port *io_pr;
> > @@ -136,7 +138,7 @@ struct ahci_port {
> >   struct pci_ahci_softc *pr_sc;
> >   uint8_t *cmd_lst;
> >   uint8_t *rfis;
> > - char ident[20 + 1];
> > + char ident[AHCI_PORT_IDENT];
> >   int port;
> >   int atapi;
> >   int reset;
> > @@ -2374,7 +2376,8 @@ pci_ahci_init(struct vmctx *ctx, struct
> pci_devinst *p
> >   MD5Init(&mdctx);
> >   MD5Update(&mdctx, opts, strlen(opts));
> >   MD5Final(digest, &mdctx);
> > - sprintf(sc->port[p].ident,
> "BHYVE-%02X%02X-%02X%02X-%02X%02X",
> > + snprintf(sc->port[p].ident, AHCI_PORT_IDENT,
> > + "BHYVE-%02X%02X-%02X%02X-%02X%02X",
> >   digest[0], digest[1], digest[2], digest[3], digest[4],
> >   digest[5]);
> >
> >
> > Modified: head/usr.sbin/bhyve/pci_virtio_block.c
> >
> ==
> > --- head/usr.sbin/bhyve/pci_virtio_block.cTue Nov 20 22:12:10 2018
>   (r340706)
> > +++ head/usr.sbin/bhyve/pci_virtio_block.cTue Nov 20 22:21:19 2018
>   (r340707)
> > @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
> >  #define VTBLK_S_IOERR1
> >  #define  VTBLK_S_UNSUPP  2
> >
> > -#define  VTBLK_BLK_ID_BYTES  20
> > +#define  VTBLK_BLK_ID_BYTES  20 + 1
> >
> >  /* Capability bits */
> >  #define  VTBLK_F_SEG_MAX (1 << 2)/* Maximum request
> segments */
> > @@ -344,7 +344,8 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst
> *
> >   MD5Init(&mdctx);
> >   MD5Update(&mdctx, opts, strlen(opts));
> >   MD5Final(digest, &mdctx);
> > - sprintf(sc->vbsc_ident, "BHYVE-%02X%02X-%02X%02X-%02X%02X",
> > + snprintf(sc->vbsc_ident, VTBLK_BLK_ID_BYTES,
> > + "BHYVE-%02X%02X-%02X%02X-%02X%02X",
> >   digest[0], digest[1], digest[2], digest[3], digest[4],
> digest[5]);
> >
> >   /* setup virtio block config space */
>
> Hey Marcelo,
>
> Thanks for committing this. Could VTBLK_BLK_ID_BYTES and
> AHCI_PORT_IDENT be merged into the same macro, defined in
> usr.sbin/bhyve/pci_emul.h? Especially since both equate to the same
> value.
>

The macro could be merged, but it is safer to have it in this way, in case
something changes specifically for one of the drivers.
I don't think pci_emul.h would be the right place for that, this file is in
charge of PCI emulation functions and it is pretty much generic among the
other drivers.

Best.


>
> Thanks,
>
> --
> Shawn Webb
> Cofounder and Security Engineer
> HardenedBSD
>
> Tor-ified Signal:+1 443-546-8752
> Tor+XMPP+OTR:latt...@is.a.hacker.sx
> GPG Key ID:  0x6A84658F52456EEE
> GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
>


-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r340722 - head/lib/libbe

2018-11-21 Thread Marcelo Araujo
On Thu, Nov 22, 2018, 12:19 AM Rodney W. Grimes <
free...@pdx.rh.cn85.dnsmgr.net wrote:

> > Author: 0mp (ports committer)
> > Date: Wed Nov 21 11:22:44 2018
> > New Revision: 340722
> > URL: https://svnweb.freebsd.org/changeset/base/340722
> >
> > Log:
> >   libbe(3): Put each error value in separate line.
> >
> >   As requested by a TODO in the source code.
> >
> >   Reviewed by:bcr
> >   Approved by:krion (mentor, implicit), mat (mentor, implicit)
> >   Differential Revision:  https://reviews.freebsd.org/D18063
>
> Who with a src bit approved the commit to src?
>

I was asking myself the same question!!


> > Modified:
> >   head/lib/libbe/libbe.3
> >
> > Modified: head/lib/libbe/libbe.3
> >
> ==
> > --- head/lib/libbe/libbe.3Wed Nov 21 06:36:15 2018(r340721)
> > +++ head/lib/libbe/libbe.3Wed Nov 21 11:22:44 2018(r340722)
> > @@ -28,7 +28,7 @@
> >  .\"
> >  .\" $FreeBSD$
> >  .\"
> > -.Dd November 17, 2018
> > +.Dd November 21, 2018
> >  .Dt LIBBE 3
> >  .Os
> >  .Sh NAME
> > @@ -440,30 +440,49 @@ The
> >  .Fn be_prop_list_free
> >  function will free the property list.
> >  .Sh DIAGNOSTICS
> > -Upon error, one of the following values will be returned.
> > -.\" TODO: make each entry on its own line.
> > -.Bd -ragged -offset indent
> > -BE_ERR_SUCCESS,
> > -BE_ERR_INVALIDNAME,
> > -BE_ERR_EXISTS,
> > -BE_ERR_NOENT,
> > -BE_ERR_PERMS,
> > -BE_ERR_DESTROYACT,
> > -BE_ERR_DESTROYMNT,
> > -BE_ERR_BADPATH,
> > -BE_ERR_PATHBUSY,
> > -BE_ERR_PATHLEN,
> > -BE_ERR_BADMOUNT,
> > -BE_ERR_NOORIGIN,
> > -BE_ERR_MOUNTED,
> > -BE_ERR_NOMOUNT,
> > -BE_ERR_ZFSOPEN,
> > -BE_ERR_ZFSCLONE,
> > -BE_ERR_IO,
> > -BE_ERR_NOPOOL,
> > -BE_ERR_NOMEM,
> > +Upon error, one of the following values will be returned:
> > +.Bl -dash -offset indent -compact
> > +.It
> > +BE_ERR_SUCCESS
> > +.It
> > +BE_ERR_INVALIDNAME
> > +.It
> > +BE_ERR_EXISTS
> > +.It
> > +BE_ERR_NOENT
> > +.It
> > +BE_ERR_PERMS
> > +.It
> > +BE_ERR_DESTROYACT
> > +.It
> > +BE_ERR_DESTROYMNT
> > +.It
> > +BE_ERR_BADPATH
> > +.It
> > +BE_ERR_PATHBUSY
> > +.It
> > +BE_ERR_PATHLEN
> > +.It
> > +BE_ERR_BADMOUNT
> > +.It
> > +BE_ERR_NOORIGIN
> > +.It
> > +BE_ERR_MOUNTED
> > +.It
> > +BE_ERR_NOMOUNT
> > +.It
> > +BE_ERR_ZFSOPEN
> > +.It
> > +BE_ERR_ZFSCLONE
> > +.It
> > +BE_ERR_IO
> > +.It
> > +BE_ERR_NOPOOL
> > +.It
> > +BE_ERR_NOMEM
> > +.It
> >  BE_ERR_UNKNOWN
> > -.Ed
> > +.El
> >  .Sh SEE ALSO
> >  .Xr be 1
> >  .Sh HISTORY
> >
> >
>
> --
> Rod Grimes
> rgri...@freebsd.org
>
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341761 - stable/12/usr.sbin/bhyve

2018-12-08 Thread Marcelo Araujo
Author: araujo
Date: Sun Dec  9 06:48:44 2018
New Revision: 341761
URL: https://svnweb.freebsd.org/changeset/base/341761

Log:
  MFC r340211:
  
  Comestic change to try to inline the memset with SSE/AVX instructions.
  Also switch from int to size_t to keep portability.
  
  Reviewed by:  brooks
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D17795

Modified:
  stable/12/usr.sbin/bhyve/pci_nvme.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/pci_nvme.c
==
--- stable/12/usr.sbin/bhyve/pci_nvme.c Sun Dec  9 06:46:53 2018
(r341760)
+++ stable/12/usr.sbin/bhyve/pci_nvme.c Sun Dec  9 06:48:44 2018
(r341761)
@@ -251,11 +251,13 @@ static void pci_nvme_io_partial(struct blockif_req *br
 (NVME_STATUS_SC_MASK << NVME_STATUS_SC_SHIFT))
 
 static __inline void
-cpywithpad(char *dst, int dst_size, const char *src, char pad)
+cpywithpad(char *dst, size_t dst_size, const char *src, char pad)
 {
-   int len = strnlen(src, dst_size);
+   size_t len;
+
+   len = strnlen(src, dst_size);
+   memset(dst, pad, dst_size);
memcpy(dst, src, len);
-   memset(dst + len, pad, dst_size - len);
 }
 
 static __inline void
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r341758 - stable/11/usr.sbin/bhyve

2018-12-08 Thread Marcelo Araujo
Author: araujo
Date: Sun Dec  9 06:42:06 2018
New Revision: 341758
URL: https://svnweb.freebsd.org/changeset/base/341758

Log:
  MFC r340046, r340050
  
  r340046:
  Add support ps/2 scancodes for NumLock, ScrollLock and numerical keypad
  keys.
  
  PR:   213835
  Submitted by: Vasily Postnicov 
  Relnotes: Yes
  Sponsored by: iXsystems Inc.
  
  r340050:
  Remove printf for debug purpose forgotten on r340046.
  
  Reported by:  Dmitry Luhtionov 

Modified:
  stable/11/usr.sbin/bhyve/ps2kbd.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bhyve/ps2kbd.c
==
--- stable/11/usr.sbin/bhyve/ps2kbd.c   Sun Dec  9 06:41:57 2018
(r341757)
+++ stable/11/usr.sbin/bhyve/ps2kbd.c   Sun Dec  9 06:42:06 2018
(r341758)
@@ -76,6 +76,107 @@ struct ps2kbd_softc {
uint8_t curcmd; /* current command for next byte */
 };
 
+#define SCANCODE_E0_PREFIX 1
+struct extended_translation {
+   uint32_t keysym;
+   uint8_t scancode;
+   int flags;
+};
+
+/*
+ * FIXME: Pause/break and Print Screen/SysRq require special handling.
+ */
+static const struct extended_translation extended_translations[] = {
+   {0xff08, 0x66}, /* Back space */
+   {0xff09, 0x0d}, /* Tab */
+   {0xff0d, 0x5a}, /* Return */
+   {0xff1b, 0x76}, /* Escape */
+   {0xff50, 0x6c, SCANCODE_E0_PREFIX}, /* Home */
+   {0xff51, 0x6b, SCANCODE_E0_PREFIX}, /* Left arrow */
+   {0xff52, 0x75, SCANCODE_E0_PREFIX}, /* Up arrow */
+   {0xff53, 0x74, SCANCODE_E0_PREFIX}, /* Right arrow */
+   {0xff54, 0x72, SCANCODE_E0_PREFIX}, /* Down arrow */
+   {0xff55, 0x7d, SCANCODE_E0_PREFIX}, /* PgUp */
+   {0xff56, 0x7a, SCANCODE_E0_PREFIX}, /* PgDown */
+   {0xff57, 0x69, SCANCODE_E0_PREFIX}, /* End */
+   {0xff63, 0x70, SCANCODE_E0_PREFIX}, /* Ins */
+   {0xff8d, 0x5a, SCANCODE_E0_PREFIX}, /* Keypad Enter */
+   {0xffe1, 0x12}, /* Left shift */
+   {0xffe2, 0x59}, /* Right shift */
+   {0xffe3, 0x14}, /* Left control */
+   {0xffe4, 0x14, SCANCODE_E0_PREFIX}, /* Right control */
+   /* {0xffe7, XXX}, Left meta */
+   /* {0xffe8, XXX}, Right meta */
+   {0xffe9, 0x11}, /* Left alt */
+   {0xfe03, 0x11, SCANCODE_E0_PREFIX}, /* AltGr */
+   {0xffea, 0x11, SCANCODE_E0_PREFIX}, /* Right alt */
+   {0xffeb, 0x1f, SCANCODE_E0_PREFIX}, /* Left Windows */
+   {0xffec, 0x27, SCANCODE_E0_PREFIX}, /* Right Windows */
+   {0xffbe, 0x05}, /* F1 */
+   {0xffbf, 0x06}, /* F2 */
+   {0xffc0, 0x04}, /* F3 */
+   {0xffc1, 0x0c}, /* F4 */
+   {0xffc2, 0x03}, /* F5 */
+   {0xffc3, 0x0b}, /* F6 */
+   {0xffc4, 0x83}, /* F7 */
+   {0xffc5, 0x0a}, /* F8 */
+   {0xffc6, 0x01}, /* F9 */
+   {0xffc7, 0x09}, /* F10 */
+   {0xffc8, 0x78}, /* F11 */
+   {0xffc9, 0x07}, /* F12 */
+   {0x, 0x71, SCANCODE_E0_PREFIX}, /* Del */
+   {0xff14, 0x7e}, /* ScrollLock */
+   /* NumLock and Keypads*/
+   {0xff7f, 0x77}, /* NumLock */
+   {0xffaf, 0x4a, SCANCODE_E0_PREFIX}, /* Keypad slash */
+   {0xffaa, 0x7c}, /* Keypad asterisk */
+   {0xffad, 0x7b}, /* Keypad minus */
+   {0xffab, 0x79}, /* Keypad plus */
+   {0xffb7, 0x6c}, /* Keypad 7 */
+   {0xff95, 0x6c}, /* Keypad home */
+   {0xffb8, 0x75}, /* Keypad 8 */
+   {0xff97, 0x75}, /* Keypad up arrow */
+   {0xffb9, 0x7d}, /* Keypad 9 */
+   {0xff9a, 0x7d}, /* Keypad PgUp */
+   {0xffb4, 0x6b}, /* Keypad 4 */
+   {0xff96, 0x6b}, /* Keypad left arrow */
+   {0xffb5, 0x73}, /* Keypad 5 */
+   {0xff9d, 0x73}, /* Keypad empty */
+   {0xffb6, 0x74}, /* Keypad 6 */
+   {0xff98, 0x74}, /* Keypad right arrow */
+   {0xffb1, 0x69}, /* Keypad 1 */
+   {0xff9c, 0x69}, /* Keypad end */
+   {0xffb2, 0x72}, /* Keypad 2 */
+   {0xff99, 0x72}, /* Keypad down arrow */
+   {0xffb3, 0x7a}, /* Keypad 3 */
+   {0xff9b, 0x7a}, /* Keypad PgDown */
+   {0xffb0

svn commit: r341757 - stable/12/usr.sbin/bhyve

2018-12-08 Thread Marcelo Araujo
Author: araujo
Date: Sun Dec  9 06:41:57 2018
New Revision: 341757
URL: https://svnweb.freebsd.org/changeset/base/341757

Log:
  MFC r340046, r340050
  
  r340046:
  Add support ps/2 scancodes for NumLock, ScrollLock and numerical keypad
  keys.
  
  PR:   213835
  Submitted by: Vasily Postnicov 
  Relnotes: Yes
  Sponsored by: iXsystems Inc.
  
  r340050:
  Remove printf for debug purpose forgotten on r340046.
  
  Reported by:  Dmitry Luhtionov 

Modified:
  stable/12/usr.sbin/bhyve/ps2kbd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/ps2kbd.c
==
--- stable/12/usr.sbin/bhyve/ps2kbd.c   Sun Dec  9 06:16:54 2018
(r341756)
+++ stable/12/usr.sbin/bhyve/ps2kbd.c   Sun Dec  9 06:41:57 2018
(r341757)
@@ -76,6 +76,107 @@ struct ps2kbd_softc {
uint8_t curcmd; /* current command for next byte */
 };
 
+#define SCANCODE_E0_PREFIX 1
+struct extended_translation {
+   uint32_t keysym;
+   uint8_t scancode;
+   int flags;
+};
+
+/*
+ * FIXME: Pause/break and Print Screen/SysRq require special handling.
+ */
+static const struct extended_translation extended_translations[] = {
+   {0xff08, 0x66}, /* Back space */
+   {0xff09, 0x0d}, /* Tab */
+   {0xff0d, 0x5a}, /* Return */
+   {0xff1b, 0x76}, /* Escape */
+   {0xff50, 0x6c, SCANCODE_E0_PREFIX}, /* Home */
+   {0xff51, 0x6b, SCANCODE_E0_PREFIX}, /* Left arrow */
+   {0xff52, 0x75, SCANCODE_E0_PREFIX}, /* Up arrow */
+   {0xff53, 0x74, SCANCODE_E0_PREFIX}, /* Right arrow */
+   {0xff54, 0x72, SCANCODE_E0_PREFIX}, /* Down arrow */
+   {0xff55, 0x7d, SCANCODE_E0_PREFIX}, /* PgUp */
+   {0xff56, 0x7a, SCANCODE_E0_PREFIX}, /* PgDown */
+   {0xff57, 0x69, SCANCODE_E0_PREFIX}, /* End */
+   {0xff63, 0x70, SCANCODE_E0_PREFIX}, /* Ins */
+   {0xff8d, 0x5a, SCANCODE_E0_PREFIX}, /* Keypad Enter */
+   {0xffe1, 0x12}, /* Left shift */
+   {0xffe2, 0x59}, /* Right shift */
+   {0xffe3, 0x14}, /* Left control */
+   {0xffe4, 0x14, SCANCODE_E0_PREFIX}, /* Right control */
+   /* {0xffe7, XXX}, Left meta */
+   /* {0xffe8, XXX}, Right meta */
+   {0xffe9, 0x11}, /* Left alt */
+   {0xfe03, 0x11, SCANCODE_E0_PREFIX}, /* AltGr */
+   {0xffea, 0x11, SCANCODE_E0_PREFIX}, /* Right alt */
+   {0xffeb, 0x1f, SCANCODE_E0_PREFIX}, /* Left Windows */
+   {0xffec, 0x27, SCANCODE_E0_PREFIX}, /* Right Windows */
+   {0xffbe, 0x05}, /* F1 */
+   {0xffbf, 0x06}, /* F2 */
+   {0xffc0, 0x04}, /* F3 */
+   {0xffc1, 0x0c}, /* F4 */
+   {0xffc2, 0x03}, /* F5 */
+   {0xffc3, 0x0b}, /* F6 */
+   {0xffc4, 0x83}, /* F7 */
+   {0xffc5, 0x0a}, /* F8 */
+   {0xffc6, 0x01}, /* F9 */
+   {0xffc7, 0x09}, /* F10 */
+   {0xffc8, 0x78}, /* F11 */
+   {0xffc9, 0x07}, /* F12 */
+   {0x, 0x71, SCANCODE_E0_PREFIX}, /* Del */
+   {0xff14, 0x7e}, /* ScrollLock */
+   /* NumLock and Keypads*/
+   {0xff7f, 0x77}, /* NumLock */
+   {0xffaf, 0x4a, SCANCODE_E0_PREFIX}, /* Keypad slash */
+   {0xffaa, 0x7c}, /* Keypad asterisk */
+   {0xffad, 0x7b}, /* Keypad minus */
+   {0xffab, 0x79}, /* Keypad plus */
+   {0xffb7, 0x6c}, /* Keypad 7 */
+   {0xff95, 0x6c}, /* Keypad home */
+   {0xffb8, 0x75}, /* Keypad 8 */
+   {0xff97, 0x75}, /* Keypad up arrow */
+   {0xffb9, 0x7d}, /* Keypad 9 */
+   {0xff9a, 0x7d}, /* Keypad PgUp */
+   {0xffb4, 0x6b}, /* Keypad 4 */
+   {0xff96, 0x6b}, /* Keypad left arrow */
+   {0xffb5, 0x73}, /* Keypad 5 */
+   {0xff9d, 0x73}, /* Keypad empty */
+   {0xffb6, 0x74}, /* Keypad 6 */
+   {0xff98, 0x74}, /* Keypad right arrow */
+   {0xffb1, 0x69}, /* Keypad 1 */
+   {0xff9c, 0x69}, /* Keypad end */
+   {0xffb2, 0x72}, /* Keypad 2 */
+   {0xff99, 0x72}, /* Keypad down arrow */
+   {0xffb3, 0x7a}, /* Keypad 3 */
+   {0xff9b, 0x7a}, /* Keypad PgDown */
+   {0xffb0

Re: svn commit: r342083 - stable/12/usr.sbin/bhyve

2018-12-14 Thread Marcelo Araujo
Your mfc was quite fast less than 1 week, usually we take a bit more of
time before we do the mfc!

On Fri, Dec 14, 2018, 10:49 PM Alexander Motin  Author: mav
> Date: Fri Dec 14 14:49:04 2018
> New Revision: 342083
> URL: https://svnweb.freebsd.org/changeset/base/342083
>
> Log:
>   MFC r341829: Allow CTL device specification in bhyve virtio-scsi.
>
>   There was a large refactoring done in CTL to allow multiple ioctl
> frontend
>   ports (and respective devices) to be created, particularly for bhyve.
>   Unfortunately, respective part of bhyve functionality got lost somehow
> from
>   the original virtio-scsi commit.  This change allows wanted device path
> to
>   be specified in either of two ways:
>-s 6,virtio-scsi,/dev/cam/ctl1.1
>-s 6,virtio-scsi,dev=/dev/cam/ctl2.3
>   If neither is specified, the default /dev/cam/ctl device is used.
>
>   While there, remove per-queue CTL device opening, which makes no sense at
>   this point.
>
> Modified:
>   stable/12/usr.sbin/bhyve/bhyve.8
>   stable/12/usr.sbin/bhyve/pci_virtio_scsi.c
> Directory Properties:
>   stable/12/   (props changed)
>
> Modified: stable/12/usr.sbin/bhyve/bhyve.8
>
> ==
> --- stable/12/usr.sbin/bhyve/bhyve.8Fri Dec 14 14:46:35 2018
> (r342082)
> +++ stable/12/usr.sbin/bhyve/bhyve.8Fri Dec 14 14:49:04 2018
> (r342083)
> @@ -24,7 +24,7 @@
>  .\"
>  .\" $FreeBSD$
>  .\"
> -.Dd October 24, 2018
> +.Dd December 11, 2018
>  .Dt BHYVE 8
>  .Os
>  .Sh NAME
> @@ -298,7 +298,16 @@ if not explicitly specified.
>  .Pp
>  SCSI devices:
>  .Bl -tag -width 10n
> -.It Pa /dev/cam/ Ns Oo , Ns Ar port and initiator_id Oc
> +.It Pa /dev/cam/ctl Ns Oo Ar pp . Ns Ar vp Oc Ns Oo , Ns Ar
> scsi-device-options Oc
> +.El
> +.Pp
> +The
> +.Ar scsi-device-options
> +are:
> +.Bl -tag -width 10n
> +.It Li iid= Ns Ar IID
> +Initiator ID to use when sending requests to specified CTL port.
> +The default value is 0.
>  .El
>  .Pp
>  TTY devices:
>
> Modified: stable/12/usr.sbin/bhyve/pci_virtio_scsi.c
>
> ==
> --- stable/12/usr.sbin/bhyve/pci_virtio_scsi.c  Fri Dec 14 14:46:35 2018
>   (r342082)
> +++ stable/12/usr.sbin/bhyve/pci_virtio_scsi.c  Fri Dec 14 14:49:04 2018
>   (r342083)
> @@ -105,7 +105,6 @@ struct pci_vtscsi_config {
>  struct pci_vtscsi_queue {
> struct pci_vtscsi_softc * vsq_sc;
> struct vqueue_info *  vsq_vq;
> -   int   vsq_ctl_fd;
> pthread_mutex_t   vsq_mtx;
> pthread_mutex_t   vsq_qmtx;
> pthread_cond_tvsq_cv;
> @@ -529,7 +528,7 @@ pci_vtscsi_request_handle(struct pci_vtscsi_queue *q,
> sbuf_delete(sb);
> }
>
> -   err = ioctl(q->vsq_ctl_fd, CTL_IO, io);
> +   err = ioctl(sc->vss_ctl_fd, CTL_IO, io);
> if (err != 0) {
> WPRINTF(("CTL_IO: err=%d (%s)\n", errno, strerror(errno)));
> cmd_wr->response = VIRTIO_SCSI_S_FAILURE;
> @@ -639,14 +638,8 @@ pci_vtscsi_init_queue(struct pci_vtscsi_softc *sc,
> int i;
>
> queue->vsq_sc = sc;
> -   queue->vsq_ctl_fd = open("/dev/cam/ctl", O_RDWR);
> queue->vsq_vq = &sc->vss_vq[num + 2];
>
> -   if (queue->vsq_ctl_fd < 0) {
> -   WPRINTF(("cannot open /dev/cam/ctl: %s\n",
> strerror(errno)));
> -   return (-1);
> -   }
> -
> pthread_mutex_init(&queue->vsq_mtx, NULL);
> pthread_mutex_init(&queue->vsq_qmtx, NULL);
> pthread_cond_init(&queue->vsq_cv, NULL);
> @@ -672,24 +665,34 @@ static int
>  pci_vtscsi_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts)
>  {
> struct pci_vtscsi_softc *sc;
> -   char *optname = NULL;
> -   char *opt;
> -   int i;
> +   char *opt, *optname;
> +   const char *devname;
> +   int i, optidx = 0;
>
> sc = calloc(1, sizeof(struct pci_vtscsi_softc));
> -   sc->vss_ctl_fd = open("/dev/cam/ctl", O_RDWR);
> +   devname = "/dev/cam/ctl";
> +   while ((opt = strsep(&opts, ",")) != NULL) {
> +   optname = strsep(&opt, "=");
> +   if (opt == NULL && optidx == 0) {
> +   if (optname[0] != 0)
> +   devname = optname;
> +   } else if (strcmp(optname, "dev") == 0 && opt != NULL) {
> +   devname = opt;
> +   } else if (strcmp(optname, "iid") == 0 && opt != NULL) {
> +   sc->vss_iid = strtoul(opt, NULL, 10);
> +   } else {
> +   fprintf(stderr, "Invalid option %s\n", optname);
> +   free(sc);
> +   return (1);
> +   }
> +   optidx++;
> +   }
>
> +   sc->vss_ctl_fd = open(devname, O_RDWR);
> if (sc->vss_ctl_fd < 0) {
> -  

svn commit: r342184 - stable/12/usr.sbin/bhyve

2018-12-17 Thread Marcelo Araujo
Author: araujo
Date: Tue Dec 18 03:00:12 2018
New Revision: 342184
URL: https://svnweb.freebsd.org/changeset/base/342184

Log:
  MFC r340707:
  
  Define AHCI_PORT_IDENT and increase by 1 the VTBLK_BLK_ID_BYTES
  to avoid buffer accessed out of bounds, also switch to snprintf(3).
  
  PR:   200859
  Submitted by: Caglar 
  Obtained from:https://github.com/mist64/xhyve/pull/24

Modified:
  stable/12/usr.sbin/bhyve/pci_ahci.c
  stable/12/usr.sbin/bhyve/pci_virtio_block.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/usr.sbin/bhyve/pci_ahci.c
==
--- stable/12/usr.sbin/bhyve/pci_ahci.c Tue Dec 18 01:12:30 2018
(r342183)
+++ stable/12/usr.sbin/bhyve/pci_ahci.c Tue Dec 18 03:00:12 2018
(r342184)
@@ -105,7 +105,7 @@ enum sata_fis_type {
  * ATA commands
  */
 #defineATA_SF_ENAB_SATA_SF 0x10
-#defineATA_SATA_SF_AN  0x05
+#defineATA_SATA_SF_AN  0x05
 #defineATA_SF_DIS_SATA_SF  0x90
 
 /*
@@ -119,6 +119,8 @@ static FILE *dbg;
 #endif
 #define WPRINTF(format, arg...) printf(format, ##arg)
 
+#define AHCI_PORT_IDENT 20 + 1
+
 struct ahci_ioreq {
struct blockif_req io_req;
struct ahci_port *io_pr;
@@ -136,7 +138,7 @@ struct ahci_port {
struct pci_ahci_softc *pr_sc;
uint8_t *cmd_lst;
uint8_t *rfis;
-   char ident[20 + 1];
+   char ident[AHCI_PORT_IDENT];
int port;
int atapi;
int reset;
@@ -2374,7 +2376,8 @@ pci_ahci_init(struct vmctx *ctx, struct pci_devinst *p
MD5Init(&mdctx);
MD5Update(&mdctx, opts, strlen(opts));
MD5Final(digest, &mdctx);
-   sprintf(sc->port[p].ident, "BHYVE-%02X%02X-%02X%02X-%02X%02X",
+   snprintf(sc->port[p].ident, AHCI_PORT_IDENT,
+   "BHYVE-%02X%02X-%02X%02X-%02X%02X",
digest[0], digest[1], digest[2], digest[3], digest[4],
digest[5]);
 

Modified: stable/12/usr.sbin/bhyve/pci_virtio_block.c
==
--- stable/12/usr.sbin/bhyve/pci_virtio_block.c Tue Dec 18 01:12:30 2018
(r342183)
+++ stable/12/usr.sbin/bhyve/pci_virtio_block.c Tue Dec 18 03:00:12 2018
(r342184)
@@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
 #define VTBLK_S_IOERR  1
 #defineVTBLK_S_UNSUPP  2
 
-#defineVTBLK_BLK_ID_BYTES  20
+#defineVTBLK_BLK_ID_BYTES  20 + 1
 
 /* Capability bits */
 #defineVTBLK_F_SEG_MAX (1 << 2)/* Maximum request 
segments */
@@ -344,7 +344,8 @@ pci_vtblk_init(struct vmctx *ctx, struct pci_devinst *
MD5Init(&mdctx);
MD5Update(&mdctx, opts, strlen(opts));
MD5Final(digest, &mdctx);
-   sprintf(sc->vbsc_ident, "BHYVE-%02X%02X-%02X%02X-%02X%02X",
+   snprintf(sc->vbsc_ident, VTBLK_BLK_ID_BYTES,
+   "BHYVE-%02X%02X-%02X%02X-%02X%02X",
digest[0], digest[1], digest[2], digest[3], digest[4], digest[5]);
 
/* setup virtio block config space */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r342349 - head/usr.sbin/ctladm

2018-12-21 Thread Marcelo Araujo
Em sáb, 22 de dez de 2018 às 01:22, Alexander Motin 
escreveu:

> Author: mav
> Date: Fri Dec 21 17:22:15 2018
> New Revision: 342349
> URL: https://svnweb.freebsd.org/changeset/base/342349
>
> Log:
>   Fix passing wrong variables to nvlist_destroy() after r333446.
>
>   Reported by:  Alexander Fedorov (IT-Grad.ru)
>   MFC after:5 days
>

Thanks to fix that!

Out of curiosity, that was reported by email, bugzilla or any other place?

Best,


>
> Modified:
>   head/usr.sbin/ctladm/ctladm.c
>
> Modified: head/usr.sbin/ctladm/ctladm.c
>
> ==
> --- head/usr.sbin/ctladm/ctladm.c   Fri Dec 21 17:18:33 2018
> (r342348)
> +++ head/usr.sbin/ctladm/ctladm.c   Fri Dec 21 17:22:15 2018
> (r342349)
> @@ -667,7 +667,7 @@ cctl_port(int fd, int argc, char **argv, char *combine
> }
>
>  bailout:
> -   nvlist_destroy(req.args_nvl);
> +   nvlist_destroy(option_list);
> free(driver);
> return (retval);
>
> @@ -2542,7 +2542,7 @@ cctl_create_lun(int fd, int argc, char **argv, char
> *c
> fprintf(stdout, "Device ID: %s\n",
> req.reqdata.create.device_id);
>
>  bailout:
> -   nvlist_destroy(req.args_nvl);
> +   nvlist_destroy(option_list);
> return (retval);
>  }
>
> @@ -2644,7 +2644,7 @@ cctl_rm_lun(int fd, int argc, char **argv, char
> *combi
> printf("LUN %d removed successfully\n", lun_id);
>
>  bailout:
> -   nvlist_destroy(req.args_nvl);
> +   nvlist_destroy(option_list);
> return (retval);
>  }
>
> @@ -2764,7 +2764,7 @@ cctl_modify_lun(int fd, int argc, char **argv, char
> *c
> printf("LUN %d modified successfully\n", lun_id);
>
>  bailout:
> -   nvlist_destroy(req.args_nvl);
> +   nvlist_destroy(option_list);
> return (retval);
>  }
>
>
>

-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r342349 - head/usr.sbin/ctladm

2018-12-21 Thread Marcelo Araujo
Em sáb, 22 de dez de 2018 às 02:53, Alexander Motin 
escreveu:

> On 21.12.2018 13:37, Marcelo Araujo wrote:
> > Em sáb, 22 de dez de 2018 às 01:22, Alexander Motin  > <mailto:m...@freebsd.org>> escreveu:
> >
> > Author: mav
> > Date: Fri Dec 21 17:22:15 2018
> > New Revision: 342349
> > URL: https://svnweb.freebsd.org/changeset/base/342349
> >
> > Log:
> >   Fix passing wrong variables to nvlist_destroy() after r333446.
> >
> >   Reported by:  Alexander Fedorov (IT-Grad.ru)
> >   MFC after:5 days
> >
> >
> > Thanks to fix that!
>
> Welcome.
>
> > Out of curiosity, that was reported by email, bugzilla or any other
> place?
> Directly to me via OpenZFS slack.
>
> --
> Alexander Motin
>

Thank you!

Best,
-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r307697 - in stable/11: sbin/natd usr.bin/calendar usr.bin/gzip usr.bin/indent usr.bin/locale usr.bin/localedef usr.bin/netstat usr.bin/procstat usr.bin/rpcgen usr.bin/systat usr.sbin/c...

2016-10-20 Thread Marcelo Araujo
Author: araujo
Date: Fri Oct 21 03:10:05 2016
New Revision: 307697
URL: https://svnweb.freebsd.org/changeset/base/307697

Log:
  MFC r303541, r303542, r303543, r303545, r303546, r303547, r304225, r304226, 
r304605, r304676, r305212, r305863:
  
  r303541:
  Use nitems() from sys/param.h.
  
  Sponsored by: gandi.net (BSD Day Taiwan)
  MFC after:2 weeks.
  
  r303542:
  Use nitems() from sys/param.h.
  
  MFC after:2 weeks.
  Sponsored by: gandi.net (BSD Day Taiwan)
  
  r303543:
  Use nitems() from sys/param.h.
  
  MFC after:2 weeks.
  Sponsored by: gandi.net (BSD Day Taiwan)
  
  r303545:
  Use nitems() from sys/param.h.
  
  MFC after:2 weeks.
  Sponsored by: gandi.net (BSD Day Taiwan)
  
  r303546:
  Use nitems() from sys/param.h.
  
  MFC after:2 weeks.
  Sponsored by: gandi.net (BSD Day Taiwan)
  
  r303547:
  Use nitems() from sys/param.h.
  
  MFC after:2 weeks.
  Sponsored by: gandi.net (BSD Day Taiwan)
  
  r304225:
  Use nitems() from sys/param.h.
  
  MFC after:2 weeks.
  
  r304226:
  Use nitems() from sys/param.h.
  
  MFC after:2 weeks.
  
  r304605:
  Fix calloc(3) argument order.
  
  Reviewed by:  trasz
  MFC after:4 weeks.
  Differential Revision:https://reviews.freebsd.org/D7532
  
  r304676:
  Fix calloc(3) argument order.
  
  MFC after:4 weeks.
  
  r305212:
  - Invert calloc(3) argument order.
  
  MFC after:4 weeks
  
  r305863:
  Invert calloc(3) argument order.
  
  Reviewed by:  ed.
  MFC after:4 weeks.
  Differential Revision:https://reviews.freebsd.org/D7902

Modified:
  stable/11/sbin/natd/natd.c
  stable/11/usr.bin/calendar/io.c
  stable/11/usr.bin/gzip/gzip.c
  stable/11/usr.bin/indent/indent.c
  stable/11/usr.bin/locale/locale.c
  stable/11/usr.bin/localedef/collate.c
  stable/11/usr.bin/netstat/pfkey.c
  stable/11/usr.bin/procstat/procstat_files.c
  stable/11/usr.bin/rpcgen/rpc_main.c
  stable/11/usr.bin/systat/main.c
  stable/11/usr.sbin/ctld/chap.c
  stable/11/usr.sbin/ctld/keys.c
  stable/11/usr.sbin/ctld/pdu.c
  stable/11/usr.sbin/fifolog/lib/fifolog_int.c
  stable/11/usr.sbin/fifolog/lib/fifolog_reader.c
  stable/11/usr.sbin/iscsid/chap.c
  stable/11/usr.sbin/iscsid/keys.c
  stable/11/usr.sbin/iscsid/pdu.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/natd/natd.c
==
--- stable/11/sbin/natd/natd.c  Fri Oct 21 02:16:11 2016(r307696)
+++ stable/11/sbin/natd/natd.c  Fri Oct 21 03:10:05 2016(r307697)
@@ -2006,7 +2006,7 @@ NewInstance(const char *name)
}
}
ninstance++;
-   ip = calloc(sizeof *ip, 1);
+   ip = calloc(1, sizeof(*ip));
ip->name = strdup(name);
ip->la = LibAliasInit (ip->la);
ip->assignAliasAddr = 0;

Modified: stable/11/usr.bin/calendar/io.c
==
--- stable/11/usr.bin/calendar/io.c Fri Oct 21 02:16:11 2016
(r307696)
+++ stable/11/usr.bin/calendar/io.c Fri Oct 21 03:10:05 2016
(r307697)
@@ -118,7 +118,7 @@ cal_fopen(const char *file)
return (NULL);
}
 
-   for (i = 0; i < sizeof(calendarHomes)/sizeof(calendarHomes[0]) ; i++) {
+   for (i = 0; i < nitems(calendarHomes); i++) {
if (chdir(calendarHomes[i]) != 0)
continue;
 

Modified: stable/11/usr.bin/gzip/gzip.c
==
--- stable/11/usr.bin/gzip/gzip.c   Fri Oct 21 02:16:11 2016
(r307696)
+++ stable/11/usr.bin/gzip/gzip.c   Fri Oct 21 03:10:05 2016
(r307697)
@@ -155,7 +155,7 @@ static suffixes_t suffixes[] = {
 #endif /* SMALL */
 #undef SUFFIX
 };
-#define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0])
+#define NUM_SUFFIXES (nitems(suffixes))
 #define SUFFIX_MAXLEN  30
 
 static const char  gzip_version[] = "FreeBSD gzip 20150413";

Modified: stable/11/usr.bin/indent/indent.c
==
--- stable/11/usr.bin/indent/indent.c   Fri Oct 21 02:16:11 2016
(r307696)
+++ stable/11/usr.bin/indent/indent.c   Fri Oct 21 03:10:05 2016
(r307697)
@@ -1133,7 +1133,7 @@ check_type:
while ((c = getc(input)) == '\n');
ungetc(c, input);
}
-   if ((size_t)ifdef_level < 
sizeof(state_stack)/sizeof(state_stack[0])) {
+   if ((size_t)ifdef_level < nitems(state_stack)) {
match_state[ifdef_level].tos = -1;
state_stack[ifdef_level++] = ps;
}

Modified: stable/11/usr.bin/locale/locale.c
==
--- stable/11/usr.bin/locale/locale.c   Fri Oct 21 02:16:11 2016
(r307696)
+++ stable/11/usr.bin/locale/locale.c   Fri Oct 21 03

Re: svn commit: r307727 - head/share/man/man4

2016-10-21 Thread Marcelo Araujo
Bump date too.

On Oct 21, 2016 10:28 PM, "hiren panchasara" 
wrote:

> On 10/21/16 at 11:29P, Michael Tuexen wrote:
> > Author: tuexen
> > Date: Fri Oct 21 11:29:25 2016
> > New Revision: 307727
> > URL: https://svnweb.freebsd.org/changeset/base/307727
> >
> > Log:
> >   Document the TCP sysctl variables insecure_rst and insecure_syn.
> >
> >   MFC after: 1 month
> >   Sponsored by: netflix
> >
> > Modified:
> >   head/share/man/man4/tcp.4
> >
> > Modified: head/share/man/man4/tcp.4
> > 
> ==
> > --- head/share/man/man4/tcp.4 Fri Oct 21 10:32:57 2016(r307726)
> > +++ head/share/man/man4/tcp.4 Fri Oct 21 11:29:25 2016(r307727)
> > @@ -34,7 +34,7 @@
> >  .\" From: @(#)tcp.4  8.1 (Berkeley) 6/5/93
> >  .\" $FreeBSD$
> >  .\"
> > -.Dd June 28, 2016
> > +.Dd October 21, 2016
> >  .Dt TCP 4
> >  .Os
> >  .Sh NAME
> > @@ -586,6 +586,12 @@ downshift.
> >  List of available TCP function blocks (TCP stacks).
> >  .It Va functions_default
> >  The default TCP function block (TCP stack).
> > +.It Va insecure_rst
> > +Use criterias defined in RFC793 instead of RFC5961 for accepting RST
> segments.
>
> I am not a native speaker but should we s/criterias /criteria / ?
> > +Default is false.
> > +.It Va insecure_syn
> > +Use criterias defined in RFC793 instead of RFC5961 for accepting SYN
> segments.
>
> Same.
> > +Default is false.
> >  .El
> >  .Sh ERRORS
> >  A socket operation may fail with one of the following errors returned:
> >
>
> Cheers,
> Hiren
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334199 - head/usr.sbin/bhyve

2018-05-24 Thread Marcelo Araujo
Author: araujo
Date: Fri May 25 02:07:05 2018
New Revision: 334199
URL: https://svnweb.freebsd.org/changeset/base/334199

Log:
  Fix a memory leak on topology_parse().
  
  strdup(3) allocates memory for a copy of the string, does the copy and
  returns a pointer to it. If there is no sufficient memory NULL is returned
  and the global errno is set to ENOMEM.
  We do a sanity check to see if it was possible to allocate enough memory.
  
  Also as we allocate memory, we need to free this memory used. Or it will
  going out of scope leaks the storage it points to.
  
  Reviewed by:  rgrimes
  MFC after:3 weeks.
  X-MFC:r332298
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D15550

Modified:
  head/usr.sbin/bhyve/bhyverun.c

Modified: head/usr.sbin/bhyve/bhyverun.c
==
--- head/usr.sbin/bhyve/bhyverun.c  Fri May 25 01:38:59 2018
(r334198)
+++ head/usr.sbin/bhyve/bhyverun.c  Fri May 25 02:07:05 2018
(r334199)
@@ -193,6 +193,7 @@ topology_parse(const char *opt)
c = 1, n = 1, s = 1, t = 1;
ns = false, scts = false;
str = strdup(opt);
+   assert(str != NULL);
 
while ((cp = strsep(&str, ",")) != NULL) {
if (sscanf(cp, "%i%n", &tmp, &chk) == 1) {
@@ -218,11 +219,13 @@ topology_parse(const char *opt)
} else if (cp[0] == '\0')
continue;
else
-   return (-1);
+   goto out;
/* Any trailing garbage causes an error */
if (cp[chk] != '\0')
-   return (-1);
+   goto out;
}
+   free(str);
+
/*
 * Range check 1 <= n <= UINT16_MAX all values
 */
@@ -248,6 +251,10 @@ topology_parse(const char *opt)
cores = c;
threads = t;
return(0);
+
+out:
+   free(str);
+   return (-1);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334199 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
On Fri, May 25, 2018, 11:11 PM Brooks Davis  wrote:

> On Fri, May 25, 2018 at 02:07:05AM +0000, Marcelo Araujo wrote:
> > Author: araujo
> > Date: Fri May 25 02:07:05 2018
> > New Revision: 334199
> > URL: https://svnweb.freebsd.org/changeset/base/334199
> >
> > Log:
> >   Fix a memory leak on topology_parse().
> >
> >   strdup(3) allocates memory for a copy of the string, does the copy and
> >   returns a pointer to it. If there is no sufficient memory NULL is
> returned
> >   and the global errno is set to ENOMEM.
> >   We do a sanity check to see if it was possible to allocate enough
> memory.
> >
> >   Also as we allocate memory, we need to free this memory used. Or it
> will
> >   going out of scope leaks the storage it points to.
> >
> >   Reviewed by:rgrimes
> >   MFC after:  3 weeks.
> >   X-MFC:  r332298
> >   Sponsored by:   iXsystems Inc.
> >   Differential Revision:  https://reviews.freebsd.org/D15550
> >
> > Modified:
> >   head/usr.sbin/bhyve/bhyverun.c
> >
> > Modified: head/usr.sbin/bhyve/bhyverun.c
> >
> ==
> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018
> (r334198)
> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018
> (r334199)
> > @@ -193,6 +193,7 @@ topology_parse(const char *opt)
> >   c = 1, n = 1, s = 1, t = 1;
> >   ns = false, scts = false;
> >   str = strdup(opt);
> > + assert(str != NULL);
>
> Using assert seems like an odd choice when you've already added a
> failure path and the strsep will crash immediately if assert is elided.
>

Why assert is an odd choice?  Have a better suggestion?

>
> -- Brooks
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334199 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
On Fri, May 25, 2018, 11:11 PM Brooks Davis  wrote:

> On Fri, May 25, 2018 at 02:07:05AM +0000, Marcelo Araujo wrote:
> > Author: araujo
> > Date: Fri May 25 02:07:05 2018
> > New Revision: 334199
> > URL: https://svnweb.freebsd.org/changeset/base/334199
> >
> > Log:
> >   Fix a memory leak on topology_parse().
> >
> >   strdup(3) allocates memory for a copy of the string, does the copy and
> >   returns a pointer to it. If there is no sufficient memory NULL is
> returned
> >   and the global errno is set to ENOMEM.
> >   We do a sanity check to see if it was possible to allocate enough
> memory.
> >
> >   Also as we allocate memory, we need to free this memory used. Or it
> will
> >   going out of scope leaks the storage it points to.
> >
> >   Reviewed by:rgrimes
> >   MFC after:  3 weeks.
> >   X-MFC:  r332298
> >   Sponsored by:   iXsystems Inc.
> >   Differential Revision:  https://reviews.freebsd.org/D15550
> >
> > Modified:
> >   head/usr.sbin/bhyve/bhyverun.c
> >
> > Modified: head/usr.sbin/bhyve/bhyverun.c
> >
> ==
> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018
> (r334198)
> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018
> (r334199)
> > @@ -193,6 +193,7 @@ topology_parse(const char *opt)
> >   c = 1, n = 1, s = 1, t = 1;
> >   ns = false, scts = false;
> >   str = strdup(opt);
> > + assert(str != NULL);
>
> Using assert seems like an odd choice when you've already added a
> failure path and the strsep will crash immediately if assert is elided.
>

Just to make a better point, I had the same discussion about assert(3) in
another review, we don't do NDEBUG even for RELEASE.

>
> -- Brooks
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334199 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
On Sat, May 26, 2018, 1:11 AM Eitan Adler  wrote:

> On 25 May 2018 at 08:23, Marcelo Araujo  wrote:
> >
> >
> > On Fri, May 25, 2018, 11:11 PM Brooks Davis  wrote:
> >>
> >> On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo wrote:
> >> > Author: araujo
> >> > Date: Fri May 25 02:07:05 2018
> >> > New Revision: 334199
> >> > URL: https://svnweb.freebsd.org/changeset/base/334199
> >> >
> >> > Log:
> >> >   Fix a memory leak on topology_parse().
> >> >
> >> >   strdup(3) allocates memory for a copy of the string, does the copy
> and
> >> >   returns a pointer to it. If there is no sufficient memory NULL is
> >> > returned
> >> >   and the global errno is set to ENOMEM.
> >> >   We do a sanity check to see if it was possible to allocate enough
> >> > memory.
> >> >
> >> >   Also as we allocate memory, we need to free this memory used. Or it
> >> > will
> >> >   going out of scope leaks the storage it points to.
> >> >
> >> >   Reviewed by:rgrimes
> >> >   MFC after:  3 weeks.
> >> >   X-MFC:  r332298
> >> >   Sponsored by:   iXsystems Inc.
> >> >   Differential Revision:  https://reviews.freebsd.org/D15550
> >> >
> >> > Modified:
> >> >   head/usr.sbin/bhyve/bhyverun.c
> >> >
> >> > Modified: head/usr.sbin/bhyve/bhyverun.c
> >> >
> >> >
> ==
> >> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018
> >> > (r334198)
> >> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018
> >> > (r334199)
> >> > @@ -193,6 +193,7 @@ topology_parse(const char *opt)
> >> >   c = 1, n = 1, s = 1, t = 1;
> >> >   ns = false, scts = false;
> >> >   str = strdup(opt);
> >> > + assert(str != NULL);
> >>
> >> Using assert seems like an odd choice when you've already added a
> >> failure path and the strsep will crash immediately if assert is elided.
> >
> >
> > Just to make a better point, I had the same discussion about assert(3) in
> > another review, we don't do NDEBUG even for RELEASE.
>
> IMHO we only use assert for asserting things ought to never be false
> except in buggy code. Using assert for handling is poor practice.
>

Again, in this case we are using it all over the place and we must replace
it. Also we should document it in somewhere perhaps in the assert(3)
otherwise myself and others will keep using it. If you use find, not only
myself is using it to check strdup! So what is the suggestion to handle
assert(3)? Deprecated it?

>
>
>
>
> --
> Eitan Adler
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334199 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
2018-05-26 1:44 GMT+08:00 Brooks Davis :

> On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote:
> > On Sat, May 26, 2018, 1:11 AM Eitan Adler  wrote:
> >
> > > On 25 May 2018 at 08:23, Marcelo Araujo 
> wrote:
> > > >
> > > >
> > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis 
> wrote:
> > > >>
> > > >> On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo wrote:
> > > >> > Author: araujo
> > > >> > Date: Fri May 25 02:07:05 2018
> > > >> > New Revision: 334199
> > > >> > URL: https://svnweb.freebsd.org/changeset/base/334199
> > > >> >
> > > >> > Log:
> > > >> >   Fix a memory leak on topology_parse().
> > > >> >
> > > >> >   strdup(3) allocates memory for a copy of the string, does the
> copy
> > > and
> > > >> >   returns a pointer to it. If there is no sufficient memory NULL
> is
> > > >> > returned
> > > >> >   and the global errno is set to ENOMEM.
> > > >> >   We do a sanity check to see if it was possible to allocate
> enough
> > > >> > memory.
> > > >> >
> > > >> >   Also as we allocate memory, we need to free this memory used.
> Or it
> > > >> > will
> > > >> >   going out of scope leaks the storage it points to.
> > > >> >
> > > >> >   Reviewed by:rgrimes
> > > >> >   MFC after:  3 weeks.
> > > >> >   X-MFC:  r332298
> > > >> >   Sponsored by:   iXsystems Inc.
> > > >> >   Differential Revision:  https://reviews.freebsd.org/D15550
> > > >> >
> > > >> > Modified:
> > > >> >   head/usr.sbin/bhyve/bhyverun.c
> > > >> >
> > > >> > Modified: head/usr.sbin/bhyve/bhyverun.c
> > > >> >
> > > >> >
> > > 
> ==
> > > >> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018
> > > >> > (r334198)
> > > >> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018
> > > >> > (r334199)
> > > >> > @@ -193,6 +193,7 @@ topology_parse(const char *opt)
> > > >> >   c = 1, n = 1, s = 1, t = 1;
> > > >> >   ns = false, scts = false;
> > > >> >   str = strdup(opt);
> > > >> > + assert(str != NULL);
> > > >>
> > > >> Using assert seems like an odd choice when you've already added a
> > > >> failure path and the strsep will crash immediately if assert is
> elided.
> > > >
> > > >
> > > > Just to make a better point, I had the same discussion about
> assert(3) in
> > > > another review, we don't do NDEBUG even for RELEASE.
> > >
> > > IMHO we only use assert for asserting things ought to never be false
> > > except in buggy code. Using assert for handling is poor practice.
> > >
> >
> > Again, in this case we are using it all over the place and we must
> replace
> > it. Also we should document it in somewhere perhaps in the assert(3)
> > otherwise myself and others will keep using it. If you use find, not only
> > myself is using it to check strdup! So what is the suggestion to handle
> > assert(3)? Deprecated it?
>
> Code that uses assert() in place of error handling is wrong and should
> be fixed. assert(condition) means that condition must never happen
> and if it does a bug has occurred (or the programmers assumptions are
> wrong).  In this case failure would not be due to a bug, but do to
> resource exhaustion which is expected to be handled.
>

I agree with you! We have plenty of place that use strdup(3) without check
the errno ENOMEN return; so do you think would be better bypass a errno
ENOMEN without check it and have a crash, or better abort(3) using
assert(3) in case we have no memory available to allocated the memory for a
copy of a string?

Personally I don't mind make couple extra lines of code to call abort(3) or
exit(3), but till there, if we don't make RELEASE using NDEBUG, what you
guys are saying to me is more personal preference than anything else.


>
> -- Brooks
>



-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334199 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
2018-05-26 2:21 GMT+08:00 Brooks Davis :

> On Sat, May 26, 2018 at 01:56:28AM +0800, Marcelo Araujo wrote:
> > 2018-05-26 1:44 GMT+08:00 Brooks Davis :
> >
> > > On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote:
> > > > On Sat, May 26, 2018, 1:11 AM Eitan Adler 
> wrote:
> > > >
> > > > > On 25 May 2018 at 08:23, Marcelo Araujo 
> > > wrote:
> > > > > >
> > > > > >
> > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis 
> > > wrote:
> > > > > >>
> > > > > >> On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo wrote:
> > > > > >> > Author: araujo
> > > > > >> > Date: Fri May 25 02:07:05 2018
> > > > > >> > New Revision: 334199
> > > > > >> > URL: https://svnweb.freebsd.org/changeset/base/334199
> > > > > >> >
> > > > > >> > Log:
> > > > > >> >   Fix a memory leak on topology_parse().
> > > > > >> >
> > > > > >> >   strdup(3) allocates memory for a copy of the string, does
> the
> > > copy
> > > > > and
> > > > > >> >   returns a pointer to it. If there is no sufficient memory
> NULL
> > > is
> > > > > >> > returned
> > > > > >> >   and the global errno is set to ENOMEM.
> > > > > >> >   We do a sanity check to see if it was possible to allocate
> > > enough
> > > > > >> > memory.
> > > > > >> >
> > > > > >> >   Also as we allocate memory, we need to free this memory
> used.
> > > Or it
> > > > > >> > will
> > > > > >> >   going out of scope leaks the storage it points to.
> > > > > >> >
> > > > > >> >   Reviewed by:rgrimes
> > > > > >> >   MFC after:  3 weeks.
> > > > > >> >   X-MFC:  r332298
> > > > > >> >   Sponsored by:   iXsystems Inc.
> > > > > >> >   Differential Revision:  https://reviews.freebsd.org/
> D15550
> > > > > >> >
> > > > > >> > Modified:
> > > > > >> >   head/usr.sbin/bhyve/bhyverun.c
> > > > > >> >
> > > > > >> > Modified: head/usr.sbin/bhyve/bhyverun.c
> > > > > >> >
> > > > > >> >
> > > > > 
> > > ==
> > > > > >> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018
> > > > > >> > (r334198)
> > > > > >> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018
> > > > > >> > (r334199)
> > > > > >> > @@ -193,6 +193,7 @@ topology_parse(const char *opt)
> > > > > >> >   c = 1, n = 1, s = 1, t = 1;
> > > > > >> >   ns = false, scts = false;
> > > > > >> >   str = strdup(opt);
> > > > > >> > + assert(str != NULL);
> > > > > >>
> > > > > >> Using assert seems like an odd choice when you've already added
> a
> > > > > >> failure path and the strsep will crash immediately if assert is
> > > elided.
> > > > > >
> > > > > >
> > > > > > Just to make a better point, I had the same discussion about
> > > assert(3) in
> > > > > > another review, we don't do NDEBUG even for RELEASE.
> > > > >
> > > > > IMHO we only use assert for asserting things ought to never be
> false
> > > > > except in buggy code. Using assert for handling is poor practice.
> > > > >
> > > >
> > > > Again, in this case we are using it all over the place and we must
> > > replace
> > > > it. Also we should document it in somewhere perhaps in the assert(3)
> > > > otherwise myself and others will keep using it. If you use find, not
> only
> > > > myself is using it to check strdup! So what is the suggestion to
> handle
> > > > assert(3)? Deprecated it?
> > >
> > > Code that uses assert() in place of error handling is wrong and should
> >

Re: svn commit: r334199 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
2018-05-26 2:21 GMT+08:00 Brooks Davis :

> On Sat, May 26, 2018 at 01:56:28AM +0800, Marcelo Araujo wrote:
> > 2018-05-26 1:44 GMT+08:00 Brooks Davis :
> >
> > > On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote:
> > > > On Sat, May 26, 2018, 1:11 AM Eitan Adler 
> wrote:
> > > >
> > > > > On 25 May 2018 at 08:23, Marcelo Araujo 
> > > wrote:
> > > > > >
> > > > > >
> > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis 
> > > wrote:
> > > > > >>
> > > > > >> On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo wrote:
> > > > > >> > Author: araujo
> > > > > >> > Date: Fri May 25 02:07:05 2018
> > > > > >> > New Revision: 334199
> > > > > >> > URL: https://svnweb.freebsd.org/changeset/base/334199
> > > > > >> >
> > > > > >> > Log:
> > > > > >> >   Fix a memory leak on topology_parse().
> > > > > >> >
> > > > > >> >   strdup(3) allocates memory for a copy of the string, does
> the
> > > copy
> > > > > and
> > > > > >> >   returns a pointer to it. If there is no sufficient memory
> NULL
> > > is
> > > > > >> > returned
> > > > > >> >   and the global errno is set to ENOMEM.
> > > > > >> >   We do a sanity check to see if it was possible to allocate
> > > enough
> > > > > >> > memory.
> > > > > >> >
> > > > > >> >   Also as we allocate memory, we need to free this memory
> used.
> > > Or it
> > > > > >> > will
> > > > > >> >   going out of scope leaks the storage it points to.
> > > > > >> >
> > > > > >> >   Reviewed by:rgrimes
> > > > > >> >   MFC after:  3 weeks.
> > > > > >> >   X-MFC:  r332298
> > > > > >> >   Sponsored by:   iXsystems Inc.
> > > > > >> >   Differential Revision:  https://reviews.freebsd.org/
> D15550
> > > > > >> >
> > > > > >> > Modified:
> > > > > >> >   head/usr.sbin/bhyve/bhyverun.c
> > > > > >> >
> > > > > >> > Modified: head/usr.sbin/bhyve/bhyverun.c
> > > > > >> >
> > > > > >> >
> > > > > 
> > > ==
> > > > > >> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59 2018
> > > > > >> > (r334198)
> > > > > >> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05 2018
> > > > > >> > (r334199)
> > > > > >> > @@ -193,6 +193,7 @@ topology_parse(const char *opt)
> > > > > >> >   c = 1, n = 1, s = 1, t = 1;
> > > > > >> >   ns = false, scts = false;
> > > > > >> >   str = strdup(opt);
> > > > > >> > + assert(str != NULL);
> > > > > >>
> > > > > >> Using assert seems like an odd choice when you've already added
> a
> > > > > >> failure path and the strsep will crash immediately if assert is
> > > elided.
> > > > > >
> > > > > >
> > > > > > Just to make a better point, I had the same discussion about
> > > assert(3) in
> > > > > > another review, we don't do NDEBUG even for RELEASE.
> > > > >
> > > > > IMHO we only use assert for asserting things ought to never be
> false
> > > > > except in buggy code. Using assert for handling is poor practice.
> > > > >
> > > >
> > > > Again, in this case we are using it all over the place and we must
> > > replace
> > > > it. Also we should document it in somewhere perhaps in the assert(3)
> > > > otherwise myself and others will keep using it. If you use find, not
> only
> > > > myself is using it to check strdup! So what is the suggestion to
> handle
> > > > assert(3)? Deprecated it?
> > >
> > > Code that uses assert() in place of error handling is wrong and should
&g

svn commit: r334216 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
Author: araujo
Date: Fri May 25 18:54:40 2018
New Revision: 334216
URL: https://svnweb.freebsd.org/changeset/base/334216

Log:
  After a long discussion about assert(3), we gonna use a HardenedBSD
  approach to chek strdup(3) memory allocation.
  
  Submitted by: Shaw Webb 
  Reported by:  brooks
  Obtained from:HardenedBSD

Modified:
  head/usr.sbin/bhyve/bhyverun.c

Modified: head/usr.sbin/bhyve/bhyverun.c
==
--- head/usr.sbin/bhyve/bhyverun.c  Fri May 25 18:11:13 2018
(r334215)
+++ head/usr.sbin/bhyve/bhyverun.c  Fri May 25 18:54:40 2018
(r334216)
@@ -193,7 +193,8 @@ topology_parse(const char *opt)
c = 1, n = 1, s = 1, t = 1;
ns = false, scts = false;
str = strdup(opt);
-   assert(str != NULL);
+   if (str == NULL)
+   goto out;
 
while ((cp = strsep(&str, ",")) != NULL) {
if (sscanf(cp, "%i%n", &tmp, &chk) == 1) {
@@ -225,6 +226,7 @@ topology_parse(const char *opt)
goto out;
}
free(str);
+   str = NULL;
 
/*
 * Range check 1 <= n <= UINT16_MAX all values
@@ -253,7 +255,8 @@ topology_parse(const char *opt)
return(0);
 
 out:
-   free(str);
+   if (str != NULL)
+   free(str);
return (-1);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334199 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
Thanks Shawn,

I think there are plenty of places to fix this case! Thanks for the extra
work :D.

2018-05-26 2:34 GMT+08:00 Shawn Webb :

> On Sat, May 26, 2018 at 02:26:33AM +0800, Marcelo Araujo wrote:
> > 2018-05-26 2:21 GMT+08:00 Brooks Davis :
> >
> > > On Sat, May 26, 2018 at 01:56:28AM +0800, Marcelo Araujo wrote:
> > > > 2018-05-26 1:44 GMT+08:00 Brooks Davis :
> > > >
> > > > > On Sat, May 26, 2018 at 01:21:33AM +0800, Marcelo Araujo wrote:
> > > > > > On Sat, May 26, 2018, 1:11 AM Eitan Adler 
> > > wrote:
> > > > > >
> > > > > > > On 25 May 2018 at 08:23, Marcelo Araujo <
> araujobsdp...@gmail.com>
> > > > > wrote:
> > > > > > > >
> > > > > > > >
> > > > > > > > On Fri, May 25, 2018, 11:11 PM Brooks Davis <
> bro...@freebsd.org>
> > > > > wrote:
> > > > > > > >>
> > > > > > > >> On Fri, May 25, 2018 at 02:07:05AM +, Marcelo Araujo
> wrote:
> > > > > > > >> > Author: araujo
> > > > > > > >> > Date: Fri May 25 02:07:05 2018
> > > > > > > >> > New Revision: 334199
> > > > > > > >> > URL: https://svnweb.freebsd.org/changeset/base/334199
> > > > > > > >> >
> > > > > > > >> > Log:
> > > > > > > >> >   Fix a memory leak on topology_parse().
> > > > > > > >> >
> > > > > > > >> >   strdup(3) allocates memory for a copy of the string,
> does
> > > the
> > > > > copy
> > > > > > > and
> > > > > > > >> >   returns a pointer to it. If there is no sufficient
> memory
> > > NULL
> > > > > is
> > > > > > > >> > returned
> > > > > > > >> >   and the global errno is set to ENOMEM.
> > > > > > > >> >   We do a sanity check to see if it was possible to
> allocate
> > > > > enough
> > > > > > > >> > memory.
> > > > > > > >> >
> > > > > > > >> >   Also as we allocate memory, we need to free this memory
> > > used.
> > > > > Or it
> > > > > > > >> > will
> > > > > > > >> >   going out of scope leaks the storage it points to.
> > > > > > > >> >
> > > > > > > >> >   Reviewed by:rgrimes
> > > > > > > >> >   MFC after:  3 weeks.
> > > > > > > >> >   X-MFC:  r332298
> > > > > > > >> >   Sponsored by:   iXsystems Inc.
> > > > > > > >> >   Differential Revision:
> https://reviews.freebsd.org/
> > > D15550
> > > > > > > >> >
> > > > > > > >> > Modified:
> > > > > > > >> >   head/usr.sbin/bhyve/bhyverun.c
> > > > > > > >> >
> > > > > > > >> > Modified: head/usr.sbin/bhyve/bhyverun.c
> > > > > > > >> >
> > > > > > > >> >
> > > > > > > 
> > > > > ==
> > > > > > > >> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 01:38:59
> 2018
> > > > > > > >> > (r334198)
> > > > > > > >> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 02:07:05
> 2018
> > > > > > > >> > (r334199)
> > > > > > > >> > @@ -193,6 +193,7 @@ topology_parse(const char *opt)
> > > > > > > >> >   c = 1, n = 1, s = 1, t = 1;
> > > > > > > >> >   ns = false, scts = false;
> > > > > > > >> >   str = strdup(opt);
> > > > > > > >> > + assert(str != NULL);
> > > > > > > >>
> > > > > > > >> Using assert seems like an odd choice when you've already
> added
> > > a
> > > > > > > >> failure path and the strsep will crash immediately if
> assert is
> > > > > elided.
> > > > > &

Re: svn commit: r334199 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
2018-05-26 3:01 GMT+08:00 Shawn Webb :

> On Sat, May 26, 2018 at 02:57:29AM +0800, Marcelo Araujo wrote:
> > Thanks Shawn,
> >
> > I think there are plenty of places to fix this case! Thanks for the extra
> > work :D.
>
> Any time. I'm glad to help. If you'd like, I might have time on Sunday
> to audit bhyve's code to find and fix more of these cases.
>

Doesn't hurt and I think it is very welcome!

Best,


>
> Thanks,
>
> --
> Shawn Webb
> Cofounder and Security Engineer
> HardenedBSD
>
> Tor-ified Signal:+1 443-546-8752
> Tor+XMPP+OTR:latt...@is.a.hacker.sx
> GPG Key ID:  0x6A84658F52456EEE
> GPG Key Fingerprint: 2ABA B6BD EF6A F486 BE89  3D9E 6A84 658F 5245 6EEE
>



-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334219 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
Author: araujo
Date: Fri May 25 19:12:30 2018
New Revision: 334219
URL: https://svnweb.freebsd.org/changeset/base/334219

Log:
  We don't need check if str is NULL as free(3) will handle NULL
  argument.
  
  Reported by:  kib@

Modified:
  head/usr.sbin/bhyve/bhyverun.c

Modified: head/usr.sbin/bhyve/bhyverun.c
==
--- head/usr.sbin/bhyve/bhyverun.c  Fri May 25 19:00:28 2018
(r334218)
+++ head/usr.sbin/bhyve/bhyverun.c  Fri May 25 19:12:30 2018
(r334219)
@@ -255,8 +255,7 @@ topology_parse(const char *opt)
return(0);
 
 out:
-   if (str != NULL)
-   free(str);
+   free(str);
return (-1);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334216 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
Fixed at r334219.

Thanks.

2018-05-26 3:08 GMT+08:00 Konstantin Belousov :

> On Fri, May 25, 2018 at 06:54:40PM +0000, Marcelo Araujo wrote:
> > Author: araujo
> > Date: Fri May 25 18:54:40 2018
> > New Revision: 334216
> > URL: https://svnweb.freebsd.org/changeset/base/334216
> >
> > Log:
> >   After a long discussion about assert(3), we gonna use a HardenedBSD
> >   approach to chek strdup(3) memory allocation.
> >
> >   Submitted by:   Shaw Webb 
> >   Reported by:brooks
> >   Obtained from:  HardenedBSD
> >
> > Modified:
> >   head/usr.sbin/bhyve/bhyverun.c
> >
> > Modified: head/usr.sbin/bhyve/bhyverun.c
> > 
> ==
> > --- head/usr.sbin/bhyve/bhyverun.cFri May 25 18:11:13 2018
> (r334215)
> > +++ head/usr.sbin/bhyve/bhyverun.cFri May 25 18:54:40 2018
> (r334216)
> > @@ -193,7 +193,8 @@ topology_parse(const char *opt)
> >   c = 1, n = 1, s = 1, t = 1;
> >   ns = false, scts = false;
> >   str = strdup(opt);
> > - assert(str != NULL);
> > + if (str == NULL)
> > + goto out;
> >
> >   while ((cp = strsep(&str, ",")) != NULL) {
> >   if (sscanf(cp, "%i%n", &tmp, &chk) == 1) {
> > @@ -225,6 +226,7 @@ topology_parse(const char *opt)
> >   goto out;
> >   }
> >   free(str);
> > + str = NULL;
> >
> >   /*
> >* Range check 1 <= n <= UINT16_MAX all values
> > @@ -253,7 +255,8 @@ topology_parse(const char *opt)
> >   return(0);
> >
> >  out:
> > - free(str);
> > + if (str != NULL)
> This check is useless.  Free(3) is fine handling NULL argument.
>
> > + free(str);
> >   return (-1);
> >  }
> >
>



-- 

-- 
Marcelo Araujo(__)ara...@freebsd.org
\\\'',)http://www.FreeBSD.org <http://www.freebsd.org/>   \/  \ ^
Power To Server. .\. /_)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334199 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
On Sat, May 26, 2018, 4:09 AM Warner Losh  wrote:

>
>
> On Fri, May 25, 2018 at 2:02 PM, Ed Maste  wrote:
>
>> On 25 May 2018 at 14:26, Marcelo Araujo  wrote:
>> >
>> >> The fact that we don't do NDEBUG builds normally does not allow us to
>> >> ignore that it exists.  It's perfectly reasonable for a user to build
>> >> with CFLAGS+=NDEBUG.  That need to work.  If code is going to fail to
>> >> handle resource errors with NDEBUG set then it needs something like
>> this
>> >> at the top of the file:
>> >
>> > Please document it in some place!
>>
>> NDEBUG is documented in assert(3). The man page should have more of an
>> explanation (and examples) of the possible pitfalls of assert()
>> though
>>
>
> NDEBUG has been documented in the assert man page since it entered Unix
> via PBW in the 7th Edition Unix from Bell Labs. It's part of the C
> standard, as well as many POSIX and SVID docs.
>

Yes I can read that! Now tell me, do we build FreeBSD without assert?

If we do, probably we can't run it without crash!


> Warner
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334199 - head/usr.sbin/bhyve

2018-05-25 Thread Marcelo Araujo
On Sat, May 26, 2018, 4:22 AM Rodney W. Grimes <
free...@pdx.rh.cn85.dnsmgr.net> wrote:

> > On Sat, May 26, 2018, 4:09 AM Warner Losh  wrote:
> >
> > >
> > >
> > > On Fri, May 25, 2018 at 2:02 PM, Ed Maste  wrote:
> > >
> > >> On 25 May 2018 at 14:26, Marcelo Araujo 
> wrote:
> > >> >
> > >> >> The fact that we don't do NDEBUG builds normally does not allow us
> to
> > >> >> ignore that it exists.  It's perfectly reasonable for a user to
> build
> > >> >> with CFLAGS+=NDEBUG.  That need to work.  If code is going to fail
> to
> > >> >> handle resource errors with NDEBUG set then it needs something like
> > >> this
> > >> >> at the top of the file:
> > >> >
> > >> > Please document it in some place!
> > >>
> > >> NDEBUG is documented in assert(3). The man page should have more of an
> > >> explanation (and examples) of the possible pitfalls of assert()
> > >> though
> > >>
> > >
> > > NDEBUG has been documented in the assert man page since it entered Unix
> > > via PBW in the 7th Edition Unix from Bell Labs. It's part of the C
> > > standard, as well as many POSIX and SVID docs.
> > >
> >
> > Yes I can read that! Now tell me, do we build FreeBSD without assert?
> >
> > If we do, probably we can't run it without crash!
>
> So that makes it perfectly fine to continue what is a well known bad
> practice?  I do not think so.
>
> Many people have tried to persuade you that the *proper* way to check
> the return from a function is with an if statement, not with an assert,
> please try to accept that this is pretty much standard accepted portable
> 'C' coding, and realize all those places you see assert(foo) checking
> the return of a function are more than likely lurking bugs to be fixed.
>

I never said that I didn't accepted that! What I have been saying the issue
is all around and we need to fix it. Please don't twist my words!

Best,

>
> --
> Rod Grimes
> rgri...@freebsd.org
>
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334275 - head/lib/libc/string

2018-05-27 Thread Marcelo Araujo
Author: araujo
Date: Mon May 28 05:01:42 2018
New Revision: 334275
URL: https://svnweb.freebsd.org/changeset/base/334275

Log:
  Update strsep(3) EXAMPLE section regards the usage of assert(3).
  
  As many people has pointed out, using assert(3) shall be not the best approach
  to verify if strdup(3) has allocated memory to string.
  
  Reviewed by:  imp
  MFC after:4 weeks.
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D15594

Modified:
  head/lib/libc/string/strsep.3

Modified: head/lib/libc/string/strsep.3
==
--- head/lib/libc/string/strsep.3   Mon May 28 04:38:10 2018
(r334274)
+++ head/lib/libc/string/strsep.3   Mon May 28 05:01:42 2018
(r334275)
@@ -31,7 +31,7 @@
 .\"@(#)strsep.38.1 (Berkeley) 6/9/93
 .\" $FreeBSD$
 .\"
-.Dd December 5, 2008
+.Dd May 28, 2018
 .Dt STRSEP 3
 .Os
 .Sh NAME
@@ -86,12 +86,12 @@ to parse a string, and prints each token in separate l
 char *token, *string, *tofree;
 
 tofree = string = strdup("abc,def,ghi");
-assert(string != NULL);
+if (string != NULL)
+   while ((token = strsep(&string, ",")) != NULL)
+   printf("%s\en", token);
 
-while ((token = strsep(&string, ",")) != NULL)
-   printf("%s\en", token);
-
 free(tofree);
+free(string);
 .Ed
 .Pp
 The following uses
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334276 - head/lib/libc/string

2018-05-27 Thread Marcelo Araujo
Author: araujo
Date: Mon May 28 06:01:02 2018
New Revision: 334276
URL: https://svnweb.freebsd.org/changeset/base/334276

Log:
  Remove unnecessary free(string) from EXAMPLES.
  
  Reported by:  se

Modified:
  head/lib/libc/string/strsep.3

Modified: head/lib/libc/string/strsep.3
==
--- head/lib/libc/string/strsep.3   Mon May 28 05:01:42 2018
(r334275)
+++ head/lib/libc/string/strsep.3   Mon May 28 06:01:02 2018
(r334276)
@@ -91,7 +91,6 @@ if (string != NULL)
printf("%s\en", token);
 
 free(tofree);
-free(string);
 .Ed
 .Pp
 The following uses
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334307 - head/usr.sbin/bhyve

2018-05-28 Thread Marcelo Araujo
Author: araujo
Date: Tue May 29 01:46:00 2018
New Revision: 334307
URL: https://svnweb.freebsd.org/changeset/base/334307

Log:
  Simplify macros EFPRINTF and EFFLUSH. [0]
  Also stdarg(3) says that each invocation of va_start() must be paired
  with a corresponding invocation of va_end() in the same function. [1]
  
  Reported by:  Coverity
  CID:  1194318[0] and 1194332[1]
  Discussed with:   jhb
  MFC after:4 weeks.
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D15548

Modified:
  head/usr.sbin/bhyve/acpi.c

Modified: head/usr.sbin/bhyve/acpi.c
==
--- head/usr.sbin/bhyve/acpi.c  Tue May 29 01:16:00 2018(r334306)
+++ head/usr.sbin/bhyve/acpi.c  Tue May 29 01:46:00 2018(r334307)
@@ -118,18 +118,14 @@ struct basl_fio {
 };
 
 #define EFPRINTF(...) \
-   err = fprintf(__VA_ARGS__); if (err < 0) goto err_exit;
+   if (fprintf(__VA_ARGS__) < 0) goto err_exit;
 
 #define EFFLUSH(x) \
-   err = fflush(x); if (err != 0) goto err_exit;
+   if (fflush(x) != 0) goto err_exit;
 
 static int
 basl_fwrite_rsdp(FILE *fp)
 {
-   int err;
-
-   err = 0;
-
EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * bhyve RSDP template\n");
EFPRINTF(fp, " */\n");
@@ -156,10 +152,6 @@ err_exit:
 static int
 basl_fwrite_rsdt(FILE *fp)
 {
-   int err;
-
-   err = 0;
-
EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * bhyve RSDT template\n");
EFPRINTF(fp, " */\n");
@@ -196,10 +188,6 @@ err_exit:
 static int
 basl_fwrite_xsdt(FILE *fp)
 {
-   int err;
-
-   err = 0;
-
EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * bhyve XSDT template\n");
EFPRINTF(fp, " */\n");
@@ -236,11 +224,8 @@ err_exit:
 static int
 basl_fwrite_madt(FILE *fp)
 {
-   int err;
int i;
 
-   err = 0;
-
EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * bhyve MADT template\n");
EFPRINTF(fp, " */\n");
@@ -326,10 +311,6 @@ err_exit:
 static int
 basl_fwrite_fadt(FILE *fp)
 {
-   int err;
-
-   err = 0;
-
EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * bhyve FADT template\n");
EFPRINTF(fp, " */\n");
@@ -547,10 +528,6 @@ err_exit:
 static int
 basl_fwrite_hpet(FILE *fp)
 {
-   int err;
-
-   err = 0;
-
EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * bhyve HPET template\n");
EFPRINTF(fp, " */\n");
@@ -596,8 +573,6 @@ err_exit:
 static int
 basl_fwrite_mcfg(FILE *fp)
 {
-   int err = 0;
-
EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * bhyve MCFG template\n");
EFPRINTF(fp, " */\n");
@@ -629,10 +604,6 @@ err_exit:
 static int
 basl_fwrite_facs(FILE *fp)
 {
-   int err;
-
-   err = 0;
-
EFPRINTF(fp, "/*\n");
EFPRINTF(fp, " * bhyve FACS template\n");
EFPRINTF(fp, " */\n");
@@ -666,7 +637,6 @@ void
 dsdt_line(const char *fmt, ...)
 {
va_list ap;
-   int err;
 
if (dsdt_error != 0)
return;
@@ -675,8 +645,10 @@ dsdt_line(const char *fmt, ...)
if (dsdt_indent_level != 0)
EFPRINTF(dsdt_fp, "%*c", dsdt_indent_level * 2, ' ');
va_start(ap, fmt);
-   if (vfprintf(dsdt_fp, fmt, ap) < 0)
+   if (vfprintf(dsdt_fp, fmt, ap) < 0) {
+   va_end(ap);
goto err_exit;
+   }
va_end(ap);
}
EFPRINTF(dsdt_fp, "\n");
@@ -735,9 +707,6 @@ dsdt_fixed_mem32(uint32_t base, uint32_t length)
 static int
 basl_fwrite_dsdt(FILE *fp)
 {
-   int err;
-
-   err = 0;
dsdt_fp = fp;
dsdt_error = 0;
dsdt_indent_level = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r334940 - head/usr.sbin/bhyve

2018-06-10 Thread Marcelo Araujo
MPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _IOV_H_
+#define_IOV_H_
+
+void seek_iov(struct iovec *iov1, size_t niov1, struct iovec *iov2,
+size_t *niov2, size_t seek);
+size_t truncate_iov(struct iovec *iov, size_t niov, size_t length);
+size_t count_iov(struct iovec *iov, size_t niov);
+ssize_t iov_to_buf(struct iovec *iov, size_t niov, void **buf);
+ssize_t buf_to_iov(void *buf, size_t buflen, struct iovec *iov, size_t niov,
+size_t seek);
+
+#endif /* _IOV_H_ */

Added: head/usr.sbin/bhyve/pci_virtio_scsi.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/usr.sbin/bhyve/pci_virtio_scsi.c   Mon Jun 11 02:09:20 2018
(r334940)
@@ -0,0 +1,718 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2016 Jakub Klama .
+ * Copyright (c) 2018 Marcelo Araujo .
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer
+ *in this position and unchanged.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "bhyverun.h"
+#include "pci_emul.h"
+#include "virtio.h"
+#include "iov.h"
+
+#define VTSCSI_RINGSZ  64
+#defineVTSCSI_REQUESTQ 1
+#defineVTSCSI_THR_PER_Q16
+#defineVTSCSI_MAXQ (VTSCSI_REQUESTQ + 2)
+#defineVTSCSI_MAXSEG   64
+
+#defineVTSCSI_IN_HEADER_LEN(_sc)   \
+   (sizeof(struct pci_vtscsi_req_cmd_rd) + _sc->vss_config.cdb_size)
+
+#defineVTSCSI_OUT_HEADER_LEN(_sc)  \
+   (sizeof(struct pci_vtscsi_req_cmd_wr) + _sc->vss_config.sense_size)
+
+#define VIRTIO_SCSI_MAX_CHANNEL 0
+#define VIRTIO_SCSI_MAX_TARGET  0
+#define VIRTIO_SCSI_MAX_LUN 16383
+
+#defineVIRTIO_SCSI_F_INOUT (1 << 0)
+#defineVIRTIO_SCSI_F_HOTPLUG   (1 << 1)
+#defineVIRTIO_SCSI_F_CHANGE(1 << 2)
+
+static int pci_vtscsi_debug = 0;
+#define DPRINTF(params) if (pci_vtscsi_debug) printf params
+#define WPRINTF(params) printf params
+
+struct pci_vtscsi_config {
+   uint32_t num_queues;
+   uint32_t seg_max;
+   uint32_t max_sectors;
+   uint32_t cmd_per_lun;
+   uint32_t event_info_size;
+   uint32_t sense_size;
+   uint32_t cdb_size;
+   uint16_t max_channel;
+   uint16_t max_target;
+   uint32_t max_lun;
+} __attribute__((packed));
+
+struct pci_vtscsi_queue {
+   struct pci_vtscsi_softc * vsq_sc;
+   struct vqueue_info *  vsq_vq;
+   int   vsq_ctl_fd;
+   pthread_mutex_t   vsq_mtx;
+   pthread_mutex_t   vsq_qmtx;
+p

Re: svn commit: r334940 - head/usr.sbin/bhyve

2018-06-10 Thread Marcelo Araujo
2018-06-11 10:25 GMT+08:00 Pedro Giffuni :

>
>
> On 10/06/2018 21:09, Marcelo Araujo wrote:
>
>> Author: araujo
>> Date: Mon Jun 11 02:09:20 2018
>> New Revision: 334940
>> URL: https://svnweb.freebsd.org/changeset/base/334940
>>
>> Log:
>>- Add bhyve virtio-scsi storage backend support.
>>   Example of configuration:
>>ctl.conf:
>>portal-group pg0 {
>>discovery-auth-group no-authentication
>>listen 0.0.0.0
>>listen [::]
>>}
>>   target iqn.2012-06.com.example:target0 {
>>auth-group no-authentication
>>portal-group pg0
>>port ioctl/5/3
>>   lun 0 {
>>path /z/test.img
>>size 8G
>>}
>>lun 1 {
>>path /z/test1.img
>>size 8G
>>}
>>}
>>   bhyve <...> -s 4,virtio-scsi,/dev/cam/ctl5.3,iid=3 
>>   From inside guest:
>>root@:~ # zpool status test
>>  pool: test
>> state: ONLINE
>>  scan: none requested
>>config:
>>   NAMESTATE READ WRITE CKSUM
>>testONLINE   0 0 0
>>  da0   ONLINE   0 0 0
>>  da1   ONLINE   0 0 0
>>   dmesg:
>>da0 at vtscsi0 bus 0 scbus0 target 0 lun 0
>>da0:  Fixed Direct Access SPC-5 SCSI device
>>da0: Serial Number MYSERIAL
>>da0: 300.000MB/s transfers
>>da0: Command Queueing enabled
>>da0: 8192MB (16777216 512 byte sectors)
>>da1 at vtscsi0 bus 0 scbus0 target 0 lun 1
>>da1:  Fixed Direct Access SPC-5 SCSI device
>>da1: Serial Number MYSERIAL0001
>>da1: 300.000MB/s transfers
>>da1: Command Queueing enabled
>>da1: 8192MB (16777216 512 byte sectors)
>>   Discussed with:   grehan
>>Reviewed by: mav
>>Obtained from:   TrueOS
>>Relnotes:Yes
>>Sponsored by:iXsystems Inc.
>>Tested with: FreeBSD HEAD, Fedora 28 (Workstation) and
>> Ubuntu 18.04.
>>Differential Revision:  https://reviews.freebsd.org/D15276
>>
>> Added:
>>head/usr.sbin/bhyve/iov.c   (contents, props changed)
>>head/usr.sbin/bhyve/iov.h   (contents, props changed)
>>head/usr.sbin/bhyve/pci_virtio_scsi.c   (contents, props changed)
>> Modified:
>>head/usr.sbin/bhyve/Makefile
>>head/usr.sbin/bhyve/bhyve.8
>>head/usr.sbin/bhyve/virtio.h
>>
>> ...
>>
>
> Added: head/usr.sbin/bhyve/pci_virtio_scsi.c
>> 
>> ==
>> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
>> +++ head/usr.sbin/bhyve/pci_virtio_scsi.c   Mon Jun 11 02:09:20
>> 2018(r334940)
>> @@ -0,0 +1,718 @@
>> +/*-
>> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
>> + *
>> + * Copyright (c) 2016 Jakub Klama .
>> + * Copyright (c) 2018 Marcelo Araujo .
>> + * All rights reserved.
>> + *
>> + * Redistribution and use in source and binary forms, with or without
>> + * modification, are permitted provided that the following conditions
>> + * are met:
>> + * 1. Redistributions of source code must retain the above copyright
>> + *notice, this list of conditions and the following disclaimer
>> + *in this position and unchanged.
>> + * 2. Redistributions in binary form must reproduce the above copyright
>> + *notice, this list of conditions and the following disclaimer in the
>> + *documentation and/or other materials provided with the
>> distribution.
>> + *
>> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
>> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
>> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
>> PURPOSE
>> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
>> LIABLE
>> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
>> CONSEQUENTIAL
>> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
>> GOODS
>> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
>> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
>> STRICT
>> + * LIABILITY, OR TORT (

svn commit: r334951 - head/usr.sbin/bhyve

2018-06-11 Thread Marcelo Araujo
Author: araujo
Date: Mon Jun 11 15:18:31 2018
New Revision: 334951
URL: https://svnweb.freebsd.org/changeset/base/334951

Log:
  More style(9) fixes, space vs tab.

Modified:
  head/usr.sbin/bhyve/pci_virtio_block.c

Modified: head/usr.sbin/bhyve/pci_virtio_block.c
==
--- head/usr.sbin/bhyve/pci_virtio_block.c  Mon Jun 11 14:45:34 2018
(r334950)
+++ head/usr.sbin/bhyve/pci_virtio_block.c  Mon Jun 11 15:18:31 2018
(r334951)
@@ -111,7 +111,7 @@ struct virtio_blk_hdr {
 #defineVBH_OP_FLUSH_OUT5
 #defineVBH_OP_IDENT8   
 #defineVBH_FLAG_BARRIER0x8000  /* OR'ed into vbh_type 
*/
-   uint32_tvbh_type;
+   uint32_tvbh_type;
uint32_tvbh_ioprio;
uint64_tvbh_sector;
 } __packed;
@@ -125,8 +125,8 @@ static int pci_vtblk_debug;
 
 struct pci_vtblk_ioreq {
struct blockif_req  io_req;
-   struct pci_vtblk_softc *io_sc;
-   uint8_t*io_status;
+   struct pci_vtblk_softc  *io_sc;
+   uint8_t *io_status;
uint16_tio_idx;
 };
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r334940 - head/usr.sbin/bhyve

2018-06-11 Thread Marcelo Araujo
2018-06-11 22:46 GMT+08:00 Pedro Giffuni :

>
>
> On 06/10/18 21:41, Marcelo Araujo wrote:
>
>
>
> 2018-06-11 10:25 GMT+08:00 Pedro Giffuni :
>
>>
>>
>> On 10/06/2018 21:09, Marcelo Araujo wrote:
>>
>>> Author: araujo
>>> Date: Mon Jun 11 02:09:20 2018
>>> New Revision: 334940
>>> URL: https://svnweb.freebsd.org/changeset/base/334940
>>>
>>> Log:
>>>- Add bhyve virtio-scsi storage backend support.
>>>   Example of configuration:
>>>ctl.conf:
>>>portal-group pg0 {
>>>discovery-auth-group no-authentication
>>>listen 0.0.0.0
>>>listen [::]
>>>}
>>>   target iqn.2012-06.com.example:target0 {
>>>auth-group no-authentication
>>>portal-group pg0
>>>port ioctl/5/3
>>>   lun 0 {
>>>path /z/test.img
>>>size 8G
>>>}
>>>lun 1 {
>>>path /z/test1.img
>>>size 8G
>>>}
>>>}
>>>   bhyve <...> -s 4,virtio-scsi,/dev/cam/ctl5.3,iid=3 
>>>   From inside guest:
>>>root@:~ # zpool status test
>>>  pool: test
>>> state: ONLINE
>>>  scan: none requested
>>>config:
>>>   NAMESTATE READ WRITE CKSUM
>>>testONLINE   0 0 0
>>>  da0   ONLINE   0 0 0
>>>  da1   ONLINE   0 0 0
>>>   dmesg:
>>>da0 at vtscsi0 bus 0 scbus0 target 0 lun 0
>>>da0:  Fixed Direct Access SPC-5 SCSI device
>>>da0: Serial Number MYSERIAL
>>>da0: 300.000MB/s transfers
>>>da0: Command Queueing enabled
>>>da0: 8192MB (16777216 512 byte sectors)
>>>da1 at vtscsi0 bus 0 scbus0 target 0 lun 1
>>>da1:  Fixed Direct Access SPC-5 SCSI device
>>>da1: Serial Number MYSERIAL0001
>>>da1: 300.000MB/s transfers
>>>da1: Command Queueing enabled
>>>da1: 8192MB (16777216 512 byte sectors)
>>>   Discussed with:   grehan
>>>Reviewed by: mav
>>>Obtained from:   TrueOS
>>>Relnotes:Yes
>>>Sponsored by:iXsystems Inc.
>>>Tested with: FreeBSD HEAD, Fedora 28 (Workstation) and
>>> Ubuntu 18.04.
>>>Differential Revision:  https://reviews.freebsd.org/D15276
>>>
>>> Added:
>>>head/usr.sbin/bhyve/iov.c   (contents, props changed)
>>>head/usr.sbin/bhyve/iov.h   (contents, props changed)
>>>head/usr.sbin/bhyve/pci_virtio_scsi.c   (contents, props changed)
>>> Modified:
>>>head/usr.sbin/bhyve/Makefile
>>>head/usr.sbin/bhyve/bhyve.8
>>>head/usr.sbin/bhyve/virtio.h
>>>
>>> ...
>>>
>>
>> Added: head/usr.sbin/bhyve/pci_virtio_scsi.c
>>> 
>>> ==
>>> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
>>> +++ head/usr.sbin/bhyve/pci_virtio_scsi.c   Mon Jun 11 02:09:20
>>> 2018(r334940)
>>> @@ -0,0 +1,718 @@
>>> +/*-
>>> + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
>>> + *
>>> + * Copyright (c) 2016 Jakub Klama 
>>> .
>>> + * Copyright (c) 2018 Marcelo Araujo 
>>> .
>>> + * All rights reserved.
>>> + *
>>> + * Redistribution and use in source and binary forms, with or without
>>> + * modification, are permitted provided that the following conditions
>>> + * are met:
>>> + * 1. Redistributions of source code must retain the above copyright
>>> + *notice, this list of conditions and the following disclaimer
>>> + *in this position and unchanged.
>>> + * 2. Redistributions in binary form must reproduce the above copyright
>>> + *notice, this list of conditions and the following disclaimer in
>>> the
>>> + *documentation and/or other materials provided with the
>>> distribution.
>>> + *
>>> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
>>> AND
>>> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
>>> + * IMP

svn commit: r335025 - head/usr.sbin/bhyve

2018-06-12 Thread Marcelo Araujo
Author: araujo
Date: Wed Jun 13 03:22:08 2018
New Revision: 335025
URL: https://svnweb.freebsd.org/changeset/base/335025

Log:
  Add SPDX tags to bhyve(8).
  
  Discussed with:   rgrimes, pfg and mav.
  Obtained from:TrueOS
  MFC after:4 weeks.
  Sponsored by: iXsystems Inc.

Modified:
  head/usr.sbin/bhyve/atkbdc.c
  head/usr.sbin/bhyve/bhyvegc.h
  head/usr.sbin/bhyve/bootrom.c
  head/usr.sbin/bhyve/bootrom.h
  head/usr.sbin/bhyve/console.c
  head/usr.sbin/bhyve/console.h
  head/usr.sbin/bhyve/fwctl.c
  head/usr.sbin/bhyve/fwctl.h
  head/usr.sbin/bhyve/pci_e82545.c
  head/usr.sbin/bhyve/pci_fbuf.c
  head/usr.sbin/bhyve/pci_irq.c
  head/usr.sbin/bhyve/pci_irq.h
  head/usr.sbin/bhyve/pci_virtio_console.c
  head/usr.sbin/bhyve/pci_virtio_rnd.c
  head/usr.sbin/bhyve/pci_xhci.c
  head/usr.sbin/bhyve/pci_xhci.h
  head/usr.sbin/bhyve/ps2kbd.c
  head/usr.sbin/bhyve/ps2kbd.h
  head/usr.sbin/bhyve/ps2mouse.c
  head/usr.sbin/bhyve/ps2mouse.h
  head/usr.sbin/bhyve/rfb.c
  head/usr.sbin/bhyve/rfb.h
  head/usr.sbin/bhyve/sockstream.c
  head/usr.sbin/bhyve/sockstream.h
  head/usr.sbin/bhyve/task_switch.c
  head/usr.sbin/bhyve/usb_emul.c
  head/usr.sbin/bhyve/usb_emul.h
  head/usr.sbin/bhyve/usb_mouse.c
  head/usr.sbin/bhyve/vga.c
  head/usr.sbin/bhyve/vga.h

Modified: head/usr.sbin/bhyve/atkbdc.c
==
--- head/usr.sbin/bhyve/atkbdc.cWed Jun 13 00:45:38 2018
(r335024)
+++ head/usr.sbin/bhyve/atkbdc.cWed Jun 13 03:22:08 2018
(r335025)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2014 Tycho Nightingale 

  * Copyright (c) 2015 Nahanni Systems Inc.
  * All rights reserved.

Modified: head/usr.sbin/bhyve/bhyvegc.h
==
--- head/usr.sbin/bhyve/bhyvegc.h   Wed Jun 13 00:45:38 2018
(r335024)
+++ head/usr.sbin/bhyve/bhyvegc.h   Wed Jun 13 03:22:08 2018
(r335025)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2015 Tycho Nightingale 

  * All rights reserved.
  *

Modified: head/usr.sbin/bhyve/bootrom.c
==
--- head/usr.sbin/bhyve/bootrom.c   Wed Jun 13 00:45:38 2018
(r335024)
+++ head/usr.sbin/bhyve/bootrom.c   Wed Jun 13 03:22:08 2018
(r335025)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2015 Neel Natu 
  * All rights reserved.
  *

Modified: head/usr.sbin/bhyve/bootrom.h
==
--- head/usr.sbin/bhyve/bootrom.h   Wed Jun 13 00:45:38 2018
(r335024)
+++ head/usr.sbin/bhyve/bootrom.h   Wed Jun 13 03:22:08 2018
(r335025)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2015 Neel Natu 
  * All rights reserved.
  *

Modified: head/usr.sbin/bhyve/console.c
==
--- head/usr.sbin/bhyve/console.c   Wed Jun 13 00:45:38 2018
(r335024)
+++ head/usr.sbin/bhyve/console.c   Wed Jun 13 03:22:08 2018
(r335025)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2015 Tycho Nightingale 

  * All rights reserved.
  *

Modified: head/usr.sbin/bhyve/console.h
==
--- head/usr.sbin/bhyve/console.h   Wed Jun 13 00:45:38 2018
(r335024)
+++ head/usr.sbin/bhyve/console.h   Wed Jun 13 03:22:08 2018
(r335025)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2015 Tycho Nightingale 

  * All rights reserved.
  *

Modified: head/usr.sbin/bhyve/fwctl.c
==
--- head/usr.sbin/bhyve/fwctl.c Wed Jun 13 00:45:38 2018(r335024)
+++ head/usr.sbin/bhyve/fwctl.c Wed Jun 13 03:22:08 2018(r335025)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2015  Peter Grehan 
  * All rights reserved.
  *

Modified: head/usr.sbin/bhyve/fwctl.h
==
--- head/usr.sbin/bhyve/fwctl.h Wed Jun 13 00:45:38 2018(r335024)
+++ head/usr.sbin/bhyve/fwctl.h Wed Jun 13 03:22:08 2018(r335025)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2015  Peter Grehan 
  * All rights reserved.
  *

Modified: head/usr.sbin/bhyve/pci_e82545.c
==
--- head/usr.sbin/bhyve/pci_e82545.cWed Jun 13 00:45:38 2018
(r335024)
+++ head/usr.sbin/bhyve/pci_e82545.cWed Jun 13 03:22:08 2018
(r335

svn commit: r335026 - in head/usr.sbin: bhyvectl bhyveload

2018-06-12 Thread Marcelo Araujo
Author: araujo
Date: Wed Jun 13 03:35:24 2018
New Revision: 335026
URL: https://svnweb.freebsd.org/changeset/base/335026

Log:
  style(9) remove unnecessary blank tabs.
  
  Obtained from:TrueOS
  MFC after:4 weeks.
  Sponsored by: iXsystems Inc.

Modified:
  head/usr.sbin/bhyvectl/bhyvectl.c
  head/usr.sbin/bhyveload/bhyveload.c

Modified: head/usr.sbin/bhyvectl/bhyvectl.c
==
--- head/usr.sbin/bhyvectl/bhyvectl.c   Wed Jun 13 03:22:08 2018
(r335025)
+++ head/usr.sbin/bhyvectl/bhyvectl.c   Wed Jun 13 03:35:24 2018
(r335026)
@@ -848,7 +848,7 @@ get_all_registers(struct vmctx *ctx, int vcpu)
if (error == 0)
printf("rflags[%d]\t0x%016lx\n", vcpu, rflags);
}
-   
+
return (error);
 }
 
@@ -1115,7 +1115,7 @@ get_misc_vmcs(struct vmctx *ctx, int vcpu)
vcpu, u64);
}
}
-   
+
if (!error && (get_tpr_threshold || get_all)) {
uint64_t threshold;
error = vm_get_vmcs_field(ctx, vcpu, VMCS_TPR_THRESHOLD,
@@ -1133,7 +1133,7 @@ get_misc_vmcs(struct vmctx *ctx, int vcpu)
vcpu, insterr);
}
}
-   
+
if (!error && (get_exit_ctls || get_all)) {
error = vm_get_vmcs_field(ctx, vcpu, VMCS_EXIT_CTLS, &ctl);
if (error == 0)
@@ -1181,7 +1181,7 @@ get_misc_vmcs(struct vmctx *ctx, int vcpu)
if (error == 0)
printf("host_rsp[%d]\t\t0x%016lx\n", vcpu, rsp);
}
-   
+
if (!error && (get_vmcs_link || get_all)) {
error = vm_get_vmcs_field(ctx, vcpu, VMCS_LINK_POINTER, &addr);
if (error == 0)

Modified: head/usr.sbin/bhyveload/bhyveload.c
==
--- head/usr.sbin/bhyveload/bhyveload.c Wed Jun 13 03:22:08 2018
(r335025)
+++ head/usr.sbin/bhyveload/bhyveload.c Wed Jun 13 03:35:24 2018
(r335026)
@@ -365,7 +365,7 @@ cb_setreg(void *arg, int r, uint64_t v)
 {
int error;
enum vm_reg_name vmreg;
-   
+
vmreg = VM_REG_LAST;
 
switch (r) {
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335027 - head/usr.sbin/bhyve

2018-06-12 Thread Marcelo Araujo
Author: araujo
Date: Wed Jun 13 04:00:21 2018
New Revision: 335027
URL: https://svnweb.freebsd.org/changeset/base/335027

Log:
  When this code was introduced at r300829 the author forgot to add
  the BSD license header that is the same as in its C header file.
  
  MFC after:4 weeks.
  Sponsored by: iXsystems Inc.

Modified:
  head/usr.sbin/bhyve/bhyvegc.c

Modified: head/usr.sbin/bhyve/bhyvegc.c
==
--- head/usr.sbin/bhyve/bhyvegc.c   Wed Jun 13 03:35:24 2018
(r335026)
+++ head/usr.sbin/bhyve/bhyvegc.c   Wed Jun 13 04:00:21 2018
(r335027)
@@ -1,3 +1,31 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2015 Tycho Nightingale 

+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
 #include 
 __FBSDID("$FreeBSD$");
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335030 - in head/sys/amd64/vmm: . amd intel io

2018-06-13 Thread Marcelo Araujo
Author: araujo
Date: Wed Jun 13 07:02:58 2018
New Revision: 335030
URL: https://svnweb.freebsd.org/changeset/base/335030

Log:
  Add SPDX tags to vmm(4).
  
  MFC after:4 weeks.
  Sponsored by: iXsystems Inc.

Modified:
  head/sys/amd64/vmm/amd/amdvi_hw.c
  head/sys/amd64/vmm/amd/amdvi_priv.h
  head/sys/amd64/vmm/amd/ivrs_drv.c
  head/sys/amd64/vmm/amd/npt.c
  head/sys/amd64/vmm/amd/npt.h
  head/sys/amd64/vmm/amd/svm.c
  head/sys/amd64/vmm/amd/svm.h
  head/sys/amd64/vmm/amd/svm_genassym.c
  head/sys/amd64/vmm/amd/svm_msr.c
  head/sys/amd64/vmm/amd/svm_msr.h
  head/sys/amd64/vmm/amd/svm_softc.h
  head/sys/amd64/vmm/amd/svm_support.S
  head/sys/amd64/vmm/amd/vmcb.c
  head/sys/amd64/vmm/amd/vmcb.h
  head/sys/amd64/vmm/intel/vmx_support.S
  head/sys/amd64/vmm/io/vatpic.c
  head/sys/amd64/vmm/io/vatpit.h
  head/sys/amd64/vmm/io/vpmtmr.c
  head/sys/amd64/vmm/io/vpmtmr.h
  head/sys/amd64/vmm/io/vrtc.c
  head/sys/amd64/vmm/io/vrtc.h
  head/sys/amd64/vmm/vmm_ioport.c
  head/sys/amd64/vmm/vmm_ioport.h

Modified: head/sys/amd64/vmm/amd/amdvi_hw.c
==
--- head/sys/amd64/vmm/amd/amdvi_hw.c   Wed Jun 13 06:11:04 2018
(r335029)
+++ head/sys/amd64/vmm/amd/amdvi_hw.c   Wed Jun 13 07:02:58 2018
(r335030)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2016, Anish Gupta (an...@freebsd.org)
  * All rights reserved.
  *

Modified: head/sys/amd64/vmm/amd/amdvi_priv.h
==
--- head/sys/amd64/vmm/amd/amdvi_priv.h Wed Jun 13 06:11:04 2018
(r335029)
+++ head/sys/amd64/vmm/amd/amdvi_priv.h Wed Jun 13 07:02:58 2018
(r335030)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2016 Anish Gupta (an...@freebsd.org)
  * All rights reserved.
  *

Modified: head/sys/amd64/vmm/amd/ivrs_drv.c
==
--- head/sys/amd64/vmm/amd/ivrs_drv.c   Wed Jun 13 06:11:04 2018
(r335029)
+++ head/sys/amd64/vmm/amd/ivrs_drv.c   Wed Jun 13 07:02:58 2018
(r335030)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2016, Anish Gupta (an...@freebsd.org)
  * All rights reserved.
  *

Modified: head/sys/amd64/vmm/amd/npt.c
==
--- head/sys/amd64/vmm/amd/npt.cWed Jun 13 06:11:04 2018
(r335029)
+++ head/sys/amd64/vmm/amd/npt.cWed Jun 13 07:02:58 2018
(r335030)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com)
  * All rights reserved.
  *

Modified: head/sys/amd64/vmm/amd/npt.h
==
--- head/sys/amd64/vmm/amd/npt.hWed Jun 13 06:11:04 2018
(r335029)
+++ head/sys/amd64/vmm/amd/npt.hWed Jun 13 07:02:58 2018
(r335030)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com)
  * All rights reserved.
  *

Modified: head/sys/amd64/vmm/amd/svm.c
==
--- head/sys/amd64/vmm/amd/svm.cWed Jun 13 06:11:04 2018
(r335029)
+++ head/sys/amd64/vmm/amd/svm.cWed Jun 13 07:02:58 2018
(r335030)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2013, Anish Gupta (akgu...@gmail.com)
  * All rights reserved.
  *

Modified: head/sys/amd64/vmm/amd/svm.h
==
--- head/sys/amd64/vmm/amd/svm.hWed Jun 13 06:11:04 2018
(r335029)
+++ head/sys/amd64/vmm/amd/svm.hWed Jun 13 07:02:58 2018
(r335030)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com)
  * All rights reserved.
  *

Modified: head/sys/amd64/vmm/amd/svm_genassym.c
==
--- head/sys/amd64/vmm/amd/svm_genassym.c   Wed Jun 13 06:11:04 2018
(r335029)
+++ head/sys/amd64/vmm/amd/svm_genassym.c   Wed Jun 13 07:02:58 2018
(r335030)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2013 Anish Gupta (akgu...@gmail.com)
  * All rights reserved.
  *

Modified: head/sys/amd64/vmm/amd/svm_msr.c
==
--- head/sys/amd64/vmm/amd/svm_msr.cWed Jun 13 06:11:04 2018
(r335029)
+++ head/sys/amd64/vmm/amd/svm_msr.cWed Jun 13 07:02:58 2018
(r335030)
@@ -1,4 +1,6 @@
 /*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
  * Copyright (c) 2014, Nee

svn commit: r335050 - head/usr.sbin/bhyve

2018-06-13 Thread Marcelo Araujo
Author: araujo
Date: Wed Jun 13 11:49:34 2018
New Revision: 335050
URL: https://svnweb.freebsd.org/changeset/base/335050

Log:
  While I was investigating CID 1194192 related with a resource leak on mrp 
memory
  allocation, I could identify that actually we use this pointer on pci_emul.c 
as
  well as on vga.c source file.
  
  I have reworked the logic here to make it more readable and also add a warn to
  explicit show the function where the memory allocation error could happen,
  also sort headers.
  
  Also CID 1194192 was marked as "Intentional".
  
  Obtained from:TrueOS
  MFC after:4 weeks.
  Sponsored by: iXsystems Inc.

Modified:
  head/usr.sbin/bhyve/mem.c

Modified: head/usr.sbin/bhyve/mem.c
==
--- head/usr.sbin/bhyve/mem.c   Wed Jun 13 11:12:52 2018(r335049)
+++ head/usr.sbin/bhyve/mem.c   Wed Jun 13 11:49:34 2018(r335050)
@@ -38,15 +38,16 @@
 __FBSDID("$FreeBSD$");
 
 #include 
-#include 
 #include 
+#include 
 #include 
 #include 
 
-#include 
-#include 
 #include 
+#include 
 #include 
+#include 
+#include 
 
 #include "mem.h"
 
@@ -285,8 +286,11 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_
err = 0;
 
mrp = malloc(sizeof(struct mmio_rb_range));
-   
-   if (mrp != NULL) {
+   if (mrp == NULL) {
+   warn("%s: couldn't allocate memory for mrp\n",
+__func__);
+   err = ENOMEM;
+   } else {
mrp->mr_param = *memp;
mrp->mr_base = memp->base;
mrp->mr_end = memp->base + memp->size - 1;
@@ -297,8 +301,7 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_
assert(perror == 0);
if (err)
free(mrp);
-   } else
-   err = ENOMEM;
+   }
 
return (err);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335103 - head/lib/libvmmapi

2018-06-13 Thread Marcelo Araujo
Author: araujo
Date: Thu Jun 14 01:28:55 2018
New Revision: 335103
URL: https://svnweb.freebsd.org/changeset/base/335103

Log:
  Fix style(9) space vs tab.
  
  Reviewed by:  jhb
  MFC after:3 weeks.
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D15774

Modified:
  head/lib/libvmmapi/vmmapi.c

Modified: head/lib/libvmmapi/vmmapi.c
==
--- head/lib/libvmmapi/vmmapi.c Thu Jun 14 01:27:35 2018(r335102)
+++ head/lib/libvmmapi/vmmapi.c Thu Jun 14 01:28:55 2018(r335103)
@@ -85,19 +85,19 @@ struct vmctx {
 static int
 vm_device_open(const char *name)
 {
-int fd, len;
-char *vmfile;
+   int fd, len;
+   char *vmfile;
 
len = strlen("/dev/vmm/") + strlen(name) + 1;
vmfile = malloc(len);
assert(vmfile != NULL);
snprintf(vmfile, len, "/dev/vmm/%s", name);
 
-/* Open the device file */
-fd = open(vmfile, O_RDWR, 0);
+   /* Open the device file */
+   fd = open(vmfile, O_RDWR, 0);
 
free(vmfile);
-return (fd);
+   return (fd);
 }
 
 int
@@ -876,7 +876,7 @@ vm_set_capability(struct vmctx *ctx, int vcpu, enum vm
vmcap.cpuid = vcpu;
vmcap.captype = cap;
vmcap.capval = val;
-   
+
return (ioctl(ctx->fd, VM_SET_CAPABILITY, &vmcap));
 }
 
@@ -1580,4 +1580,3 @@ vm_get_ioctls(size_t *len)
*len = nitems(vm_ioctl_cmds);
return (NULL);
 }
-
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335104 - head/usr.sbin/bhyve

2018-06-13 Thread Marcelo Araujo
Author: araujo
Date: Thu Jun 14 01:34:53 2018
New Revision: 335104
URL: https://svnweb.freebsd.org/changeset/base/335104

Log:
  Fix style(9) space vs tab.
  
  Reviewed by:  jhb
  MFC after:3 weeks.
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D15768

Modified:
  head/usr.sbin/bhyve/acpi.c
  head/usr.sbin/bhyve/ahci.h
  head/usr.sbin/bhyve/bhyverun.c
  head/usr.sbin/bhyve/block_if.c
  head/usr.sbin/bhyve/bootrom.h
  head/usr.sbin/bhyve/console.h
  head/usr.sbin/bhyve/consport.c
  head/usr.sbin/bhyve/inout.c
  head/usr.sbin/bhyve/mem.h
  head/usr.sbin/bhyve/mevent.c
  head/usr.sbin/bhyve/mevent_test.c
  head/usr.sbin/bhyve/pci_e82545.c
  head/usr.sbin/bhyve/pci_emul.c
  head/usr.sbin/bhyve/pci_virtio_net.c
  head/usr.sbin/bhyve/pci_xhci.c
  head/usr.sbin/bhyve/rfb.c
  head/usr.sbin/bhyve/rtc.c
  head/usr.sbin/bhyve/sockstream.c
  head/usr.sbin/bhyve/uart_emul.c
  head/usr.sbin/bhyve/usb_mouse.c
  head/usr.sbin/bhyve/vga.h
  head/usr.sbin/bhyve/virtio.c
  head/usr.sbin/bhyve/virtio.h

Modified: head/usr.sbin/bhyve/acpi.c
==
--- head/usr.sbin/bhyve/acpi.c  Thu Jun 14 01:28:55 2018(r335103)
+++ head/usr.sbin/bhyve/acpi.c  Thu Jun 14 01:34:53 2018(r335104)
@@ -885,7 +885,7 @@ basl_make_templates(void)
int len;
 
err = 0;
-   
+
/*
 * 
 */

Modified: head/usr.sbin/bhyve/ahci.h
==
--- head/usr.sbin/bhyve/ahci.h  Thu Jun 14 01:28:55 2018(r335103)
+++ head/usr.sbin/bhyve/ahci.h  Thu Jun 14 01:34:53 2018(r335104)
@@ -33,292 +33,292 @@
 #define_AHCI_H_
 
 /* ATA register defines */
-#define ATA_DATA0   /* (RW) data */
+#defineATA_DATA0   /* (RW) data */
 
-#define ATA_FEATURE 1   /* (W) feature */
-#define ATA_F_DMA   0x01/* enable DMA */
-#define ATA_F_OVL   0x02/* enable overlap */
+#defineATA_FEATURE 1   /* (W) feature */
+#defineATA_F_DMA   0x01/* enable DMA */
+#defineATA_F_OVL   0x02/* enable overlap */
 
-#define ATA_COUNT   2   /* (W) sector count */
+#defineATA_COUNT   2   /* (W) sector count */
 
-#define ATA_SECTOR  3   /* (RW) sector # */
-#define ATA_CYL_LSB 4   /* (RW) cylinder# LSB */
-#define ATA_CYL_MSB 5   /* (RW) cylinder# MSB */
-#define ATA_DRIVE   6   /* (W) Sector/Drive/Head */
-#define ATA_D_LBA   0x40/* use LBA addressing */
-#define ATA_D_IBM   0xa0/* 512 byte sectors, ECC */
+#defineATA_SECTOR  3   /* (RW) sector # */
+#defineATA_CYL_LSB 4   /* (RW) cylinder# LSB */
+#defineATA_CYL_MSB 5   /* (RW) cylinder# MSB */
+#defineATA_DRIVE   6   /* (W) Sector/Drive/Head */
+#defineATA_D_LBA   0x40/* use LBA addressing */
+#defineATA_D_IBM   0xa0/* 512 byte sectors, ECC */
 
-#define ATA_COMMAND 7   /* (W) command */
+#defineATA_COMMAND 7   /* (W) command */
 
-#define ATA_ERROR   8   /* (R) error */
-#define ATA_E_ILI   0x01/* illegal length */
-#define ATA_E_NM0x02/* no media */
-#define ATA_E_ABORT 0x04/* command aborted */
-#define ATA_E_MCR   0x08/* media change request */
-#define ATA_E_IDNF  0x10/* ID not found */
-#define ATA_E_MC0x20/* media changed */
-#define ATA_E_UNC   0x40/* uncorrectable data */
-#define ATA_E_ICRC  0x80/* UDMA crc error */
-#defineATA_E_ATAPI_SENSE_MASK  0xf0/* ATAPI sense key mask 
*/
+#defineATA_ERROR   8   /* (R) error */
+#defineATA_E_ILI   0x01/* illegal length */
+#defineATA_E_NM0x02/* no media */
+#defineATA_E_ABORT 0x04/* command aborted */
+#defineATA_E_MCR   0x08/* media change request */
+#defineATA_E_IDNF  0x10/* ID not found */
+#defineATA_E_MC0x20/* media changed */
+#defineATA_E_UNC   0x40/* uncorrectable data */
+#defineATA_E_ICRC  0x80/* UDMA crc error */
+#defineATA_E_ATAPI_SENSE_MASK  0xf0/* ATAPI sense key mask */
 
-#define ATA_IREASON 9   /* (R) interrupt reason */
-#define ATA_I_CMD  

svn commit: r335111 - svnadmin/conf

2018-06-13 Thread Marcelo Araujo
Author: araujo
Date: Thu Jun 14 06:24:29 2018
New Revision: 335111
URL: https://svnweb.freebsd.org/changeset/base/335111

Log:
  Restore miwi's src commit bit. Welcome back Martin Wilke!
  Martin Wilke will be mentored by myself for a brief period.
  
  Approved by:  core

Modified:
  svnadmin/conf/access
  svnadmin/conf/mentors

Modified: svnadmin/conf/access
==
--- svnadmin/conf/accessThu Jun 14 06:14:48 2018(r335110)
+++ svnadmin/conf/accessThu Jun 14 06:24:29 2018(r335111)
@@ -148,6 +148,7 @@ mav
 maxim
 mckusick
 melifaro
+miwi
 mizhka
 mjg
 mjoras

Modified: svnadmin/conf/mentors
==
--- svnadmin/conf/mentors   Thu Jun 14 06:14:48 2018(r335110)
+++ svnadmin/conf/mentors   Thu Jun 14 06:24:29 2018(r335111)
@@ -27,6 +27,7 @@ kadesai   ken Co-mentor: scottl, 
ambrisko
 leitao jhibbitsCo-mentor: nwhitehorn
 luporl jhibbitsCo-mentor: nwhitehorn
 mahrensmckusick
+miwi   araujo
 mjoras rstone
 peterj jhb Co-mentor: grog
 ramken Co-mentor: mav
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r335688 - stable/11/usr.sbin/bhyve

2018-06-26 Thread Marcelo Araujo
Author: araujo
Date: Wed Jun 27 03:58:02 2018
New Revision: 335688
URL: https://svnweb.freebsd.org/changeset/base/335688

Log:
  MFC r333622, r334019, r334084
  
  r333622:
  vq_getchain() can return -1 if some descriptor(s) are invalid and prints
  a diagnostic message. So we do a sanity checking on the return value
  of vq_getchain().
  
  Spotted by:   gcc49
  Reviewed by:  avg
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D15388
  
  r334019:
  Include atkbdc header where there are declared the prototype functions
  atkbdc_event and atkbdc_init.
  
  Sponsored by: iXsystems Inc.
  
  r334084:
  pthread_rwlock_unlock(3) returns 0 if successful, otherwise an error number
  will be returned to indicate the error, so I'm applying an assert(3) to do
  a sanity check of the return value.
  
  Reported by:  Coverity CID: 1391235, 1193654 and 1193651
  Reviewed by:  grehan
  Sponsored by: iXsystems Inc.
  Differential Revision:https://reviews.freebsd.org/D15533

Modified:
  stable/11/usr.sbin/bhyve/atkbdc.c
  stable/11/usr.sbin/bhyve/mem.c
  stable/11/usr.sbin/bhyve/pci_virtio_console.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/usr.sbin/bhyve/atkbdc.c
==
--- stable/11/usr.sbin/bhyve/atkbdc.c   Wed Jun 27 03:50:11 2018
(r335687)
+++ stable/11/usr.sbin/bhyve/atkbdc.c   Wed Jun 27 03:58:02 2018
(r335688)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 
 #include "acpi.h"
+#include "atkbdc.h"
 #include "inout.h"
 #include "pci_emul.h"
 #include "pci_irq.h"

Modified: stable/11/usr.sbin/bhyve/mem.c
==
--- stable/11/usr.sbin/bhyve/mem.c  Wed Jun 27 03:50:11 2018
(r335687)
+++ stable/11/usr.sbin/bhyve/mem.c  Wed Jun 27 03:58:02 2018
(r335688)
@@ -123,6 +123,7 @@ mmio_rb_add(struct mmio_rb_tree *rbt, struct mmio_rb_r
 static void
 mmio_rb_dump(struct mmio_rb_tree *rbt)
 {
+   int perror;
struct mmio_rb_range *np;
 
pthread_rwlock_rdlock(&mmio_rwlock);
@@ -130,7 +131,8 @@ mmio_rb_dump(struct mmio_rb_tree *rbt)
printf(" %lx:%lx, %s\n", np->mr_base, np->mr_end,
   np->mr_param.name);
}
-   pthread_rwlock_unlock(&mmio_rwlock);
+   perror = pthread_rwlock_unlock(&mmio_rwlock);
+   assert(perror == 0);
 }
 #endif
 
@@ -164,7 +166,7 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t padd
 
 {
struct mmio_rb_range *entry;
-   int err, immutable;
+   int err, perror, immutable;

pthread_rwlock_rdlock(&mmio_rwlock);
/*
@@ -182,7 +184,8 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t padd
/* Update the per-vCPU cache */
mmio_hint[vcpu] = entry;
} else if (mmio_rb_lookup(&mmio_rb_fallback, paddr, &entry)) {
-   pthread_rwlock_unlock(&mmio_rwlock);
+   perror = pthread_rwlock_unlock(&mmio_rwlock);
+   assert(perror == 0);
return (ESRCH);
}
}
@@ -201,15 +204,20 @@ emulate_mem(struct vmctx *ctx, int vcpu, uint64_t padd
 * config space window as 'immutable' the deadlock can be avoided.
 */
immutable = (entry->mr_param.flags & MEM_F_IMMUTABLE);
-   if (immutable)
-   pthread_rwlock_unlock(&mmio_rwlock);
+   if (immutable) {
+   perror = pthread_rwlock_unlock(&mmio_rwlock);
+   assert(perror == 0);
+   }
 
err = vmm_emulate_instruction(ctx, vcpu, paddr, vie, paging,
  mem_read, mem_write, &entry->mr_param);
 
-   if (!immutable)
-   pthread_rwlock_unlock(&mmio_rwlock);
+   if (!immutable) {
+   perror = pthread_rwlock_unlock(&mmio_rwlock);
+   assert(perror == 0);
+   }
 
+
return (err);
 }
 
@@ -217,7 +225,7 @@ static int
 register_mem_int(struct mmio_rb_tree *rbt, struct mem_range *memp)
 {
struct mmio_rb_range *entry, *mrp;
-   int err;
+   int err, perror;
 
err = 0;
 
@@ -230,7 +238,8 @@ register_mem_int(struct mmio_rb_tree *rbt, struct mem_
pthread_rwlock_wrlock(&mmio_rwlock);
if (mmio_rb_lookup(rbt, memp->base, &entry) != 0)
err = mmio_rb_add(rbt, mrp);
-   pthread_rwlock_unlock(&mmio_rwlock);
+   perror = pthread_rwlock_unlock(&mmio_rwlock);
+   assert(perror == 0);
if (err)
free(mrp);
} else
@@ -258,7 +267,7 @@ unregister_mem(struct mem_range *memp)
 {
struct mem_range *mr;
struct mmio_rb_range *entry = NULL;
-   int err, i;
+   int err, perror, i;

pthread

  1   2   3   4   5   >