svn commit: r311670 - stable/11/usr.bin/netstat
Author: delphij Date: Sun Jan 8 07:25:22 2017 New Revision: 311670 URL: https://svnweb.freebsd.org/changeset/base/311670 Log: MFC r311392: Use strlcpy and snprintf in netstat(1). Expand inet6name() line buffer to NI_MAXHOST and use strlcpy/snprintf in various places. Reported by: Anton Yuzhaninov Modified: stable/11/usr.bin/netstat/if.c stable/11/usr.bin/netstat/inet.c stable/11/usr.bin/netstat/inet6.c stable/11/usr.bin/netstat/mroute.c stable/11/usr.bin/netstat/netstat.h stable/11/usr.bin/netstat/route.c stable/11/usr.bin/netstat/sctp.c stable/11/usr.bin/netstat/unix.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/netstat/if.c == --- stable/11/usr.bin/netstat/if.c Sun Jan 8 06:58:42 2017 (r311669) +++ stable/11/usr.bin/netstat/if.c Sun Jan 8 07:25:22 2017 (r311670) @@ -393,10 +393,10 @@ intpr(void (*pfunc)(char *), int af) case AF_LINK: { struct sockaddr_dl *sdl; - char linknum[10]; + char linknum[sizeof("")]; sdl = (struct sockaddr_dl *)ifa->ifa_addr; - sprintf(linknum, "", sdl->sdl_index); + snprintf(linknum, sizeof(linknum), "", sdl->sdl_index); xo_emit("{t:network/%-*.*s} ", net_len, net_len, linknum); if (sdl->sdl_nlen == 0 && Modified: stable/11/usr.bin/netstat/inet.c == --- stable/11/usr.bin/netstat/inet.cSun Jan 8 06:58:42 2017 (r311669) +++ stable/11/usr.bin/netstat/inet.cSun Jan 8 07:25:22 2017 (r311670) @@ -84,7 +84,6 @@ __FBSDID("$FreeBSD$"); #include "netstat.h" #include "nl_defs.h" -char *inetname(struct in_addr *); void inetprint(const char *, struct in_addr *, int, const char *, int, const int); #ifdef INET6 @@ -1407,21 +1406,26 @@ inetprint(const char *container, struct struct servent *sp = 0; char line[80], *cp; int width; + size_t alen, plen; if (container) xo_open_container(container); if (Wflag) - sprintf(line, "%s.", inetname(in)); + snprintf(line, sizeof(line), "%s.", inetname(in)); else - sprintf(line, "%.*s.", (Aflag && !num_port) ? 12 : 16, inetname(in)); - cp = strchr(line, '\0'); + snprintf(line, sizeof(line), "%.*s.", + (Aflag && !num_port) ? 12 : 16, inetname(in)); + alen = strlen(line); + cp = line + alen; if (!num_port && port) sp = getservbyport((int)port, proto); if (sp || port == 0) - sprintf(cp, "%.15s ", sp ? sp->s_name : "*"); + snprintf(cp, sizeof(line) - alen, + "%.15s ", sp ? sp->s_name : "*"); else - sprintf(cp, "%d ", ntohs((u_short)port)); + snprintf(cp, sizeof(line) - alen, + "%d ", ntohs((u_short)port)); width = (Aflag && !Wflag) ? 18 : ((!Wflag || af1 == AF_INET) ? 22 : 45); if (Wflag) @@ -1429,7 +1433,8 @@ inetprint(const char *container, struct else xo_emit("{d:target/%-*.*s} ", width, width, line); - int alen = cp - line - 1, plen = strlen(cp) - 1; + plen = strlen(cp) - 1; + alen--; xo_emit("{e:address/%*.*s}{e:port/%*.*s}", alen, alen, line, plen, plen, cp); @@ -1475,8 +1480,9 @@ inetname(struct in_addr *inp) } else { inp->s_addr = ntohl(inp->s_addr); #defineC(x)((u_int)((x) & 0xff)) - sprintf(line, "%u.%u.%u.%u", C(inp->s_addr >> 24), - C(inp->s_addr >> 16), C(inp->s_addr >> 8), C(inp->s_addr)); + snprintf(line, sizeof(line), "%u.%u.%u.%u", + C(inp->s_addr >> 24), C(inp->s_addr >> 16), + C(inp->s_addr >> 8), C(inp->s_addr)); } return (line); } Modified: stable/11/usr.bin/netstat/inet6.c == --- stable/11/usr.bin/netstat/inet6.c Sun Jan 8 06:58:42 2017 (r311669) +++ stable/11/usr.bin/netstat/inet6.c Sun Jan 8 07:25:22 2017 (r311670) @@ -70,8 +70,6 @@ __FBSDID("$FreeBSD$"); #include #include "netstat.h" -char *inet6name(struct in6_addr *); - static char ntop_buf[INET6_ADDRSTRLEN]; static const char *ip6nh[] = { @@ -1270,24 +1268,30 @@ inet6print(const char *container, struct struct servent *sp = 0; char line[80], *cp; int width; + size_t alen, plen; if (container) xo_open_container(container); - sprintf(line, "%.*s.", Wflag ? 39 : (Aflag && !n
svn commit: r311669 - head/usr.sbin/chown
Author: cem Date: Sun Jan 8 06:58:42 2017 New Revision: 311669 URL: https://svnweb.freebsd.org/changeset/base/311669 Log: chown/chgrp: Add SIGINFO handler PR: 191884 Submitted by: Dan McGregor Reviewed by: mjg@ (earlier version) Modified: head/usr.sbin/chown/chgrp.1 head/usr.sbin/chown/chown.8 head/usr.sbin/chown/chown.c Modified: head/usr.sbin/chown/chgrp.1 == --- head/usr.sbin/chown/chgrp.1 Sun Jan 8 06:50:53 2017(r311668) +++ head/usr.sbin/chown/chgrp.1 Sun Jan 8 06:58:42 2017(r311669) @@ -31,7 +31,7 @@ .\" @(#)chgrp.18.3 (Berkeley) 3/31/94 .\" $FreeBSD$ .\" -.Dd April 20, 2015 +.Dd January 7, 2017 .Dt CHGRP 1 .Os .Sh NAME @@ -120,6 +120,17 @@ The user invoking .Nm must belong to the specified group and be the owner of the file, or be the super-user. +.Pp +If +.Nm +receives a +.Dv SIGINFO +signal (see the +.Cm status +argument for +.Xr stty 1 ) , +then the current filename as well as the old and new group names are +displayed. .Sh FILES .Bl -tag -width /etc/group -compact .It Pa /etc/group Modified: head/usr.sbin/chown/chown.8 == --- head/usr.sbin/chown/chown.8 Sun Jan 8 06:50:53 2017(r311668) +++ head/usr.sbin/chown/chown.8 Sun Jan 8 06:58:42 2017(r311669) @@ -28,7 +28,7 @@ .\" @(#)chown.88.3 (Berkeley) 3/31/94 .\" $FreeBSD$ .\" -.Dd April 20, 2015 +.Dd January 7, 2017 .Dt CHOWN 8 .Os .Sh NAME @@ -135,6 +135,17 @@ group name. .Pp The ownership of a file may only be altered by a super-user for obvious security reasons. +.Pp +If +.Nm +receives a +.Dv SIGINFO +signal (see the +.Cm status +argument for +.Xr stty 1 ) , +then the current filename as well as the old and new file owner and group +are displayed. .Sh EXIT STATUS .Ex -std .Sh COMPATIBILITY Modified: head/usr.sbin/chown/chown.c == --- head/usr.sbin/chown/chown.c Sun Jan 8 06:50:53 2017(r311668) +++ head/usr.sbin/chown/chown.c Sun Jan 8 06:58:42 2017(r311669) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -63,11 +64,20 @@ static void a_uid(const char *); static voidchownerr(const char *); static uid_t id(const char *, const char *); static voidusage(void); +static voidprint_info(const FTSENT *, int); static uid_t uid; static gid_t gid; static int ischown; static const char *gname; +static volatile sig_atomic_t siginfo; + +static void +siginfo_handler(int sig __unused) +{ + + siginfo = 1; +} int main(int argc, char **argv) @@ -119,6 +129,8 @@ main(int argc, char **argv) if (argc < 2) usage(); + (void)signal(SIGINFO, siginfo_handler); + if (Rflag) { if (hflag && (Hflag || Lflag)) errx(1, "the -R%c and -h options may not be " @@ -189,6 +201,10 @@ main(int argc, char **argv) default: break; } + if (siginfo) { + print_info(p, 2); + siginfo = 0; + } if ((uid == (uid_t)-1 || uid == p->fts_statp->st_uid) && (gid == (gid_t)-1 || gid == p->fts_statp->st_gid)) continue; @@ -196,35 +212,8 @@ main(int argc, char **argv) == -1 && !fflag) { chownerr(p->fts_path); rval = 1; - } else if (vflag) { - printf("%s", p->fts_path); - if (vflag > 1) { - if (ischown) { - printf(": %ju:%ju -> %ju:%ju", - (uintmax_t) - p->fts_statp->st_uid, - (uintmax_t) - p->fts_statp->st_gid, - (uid == (uid_t)-1) ? - (uintmax_t) - p->fts_statp->st_uid : - (uintmax_t)uid, - (gid == (gid_t)-1) ? - (uintmax_t) - p->fts_statp->st_gid : - (uintmax_t)gid); - } else { - printf(": %ju -> %ju", - (uintmax_t) - p->fts_statp->st_gid, - (gid == (gid_t)-1) ? - (uin
svn commit: r311668 - head/bin/chmod
Author: cem Date: Sun Jan 8 06:50:53 2017 New Revision: 311668 URL: https://svnweb.freebsd.org/changeset/base/311668 Log: chmod: Add SIGINFO handler PR: 191884 Submitted by: Dan McGregor Reviewed by: mjg@ (earlier version) Modified: head/bin/chmod/chmod.1 head/bin/chmod/chmod.c Modified: head/bin/chmod/chmod.1 == --- head/bin/chmod/chmod.1 Sun Jan 8 06:26:33 2017(r311667) +++ head/bin/chmod/chmod.1 Sun Jan 8 06:50:53 2017(r311668) @@ -32,7 +32,7 @@ .\"@(#)chmod.1 8.4 (Berkeley) 3/31/94 .\" $FreeBSD$ .\" -.Dd April 20, 2015 +.Dd January 7, 2017 .Dt CHMOD 1 .Os .Sh NAME @@ -106,6 +106,16 @@ option is specified. In addition, these options override each other and the command's actions are determined by the last one specified. .Pp +If +.Nm +receives a +.Dv SIGINFO +signal (see the +.Cm status +argument for +.Xr stty 1 ) , +then the current filename as well as the old and new modes are displayed. +.Pp Only the owner of a file or the super-user is permitted to change the mode of a file. .Sh EXIT STATUS Modified: head/bin/chmod/chmod.c == --- head/bin/chmod/chmod.c Sun Jan 8 06:26:33 2017(r311667) +++ head/bin/chmod/chmod.c Sun Jan 8 06:50:53 2017(r311668) @@ -49,14 +49,24 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include #include +static volatile sig_atomic_t siginfo; + static void usage(void); static int may_have_nfs4acl(const FTSENT *ent, int hflag); +static void +siginfo_handler(int sig __unused) +{ + + siginfo = 1; +} + int main(int argc, char *argv[]) { @@ -125,6 +135,8 @@ done: argv += optind; if (argc < 2) usage(); + (void)signal(SIGINFO, siginfo_handler); + if (Rflag) { if (hflag) errx(1, "the -R and -h options may not be " @@ -192,10 +204,10 @@ done: argv += optind; && !fflag) { warn("%s", p->fts_path); rval = 1; - } else if (vflag) { + } else if (vflag || siginfo) { (void)printf("%s", p->fts_path); - if (vflag > 1) { + if (vflag > 1 || siginfo) { char m1[12], m2[12]; strmode(p->fts_statp->st_mode, m1); @@ -207,6 +219,7 @@ done: argv += optind; newmode, m2); } (void)printf("\n"); + siginfo = 0; } } if (errno) ___ 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: r311667 - in head/sys/contrib/dev/acpica: components/namespace components/tables include
Author: cem Date: Sun Jan 8 06:26:33 2017 New Revision: 311667 URL: https://svnweb.freebsd.org/changeset/base/311667 Log: Add some additional ACPI methods for DRM Add AcpiGetDataFull and AcpiGetTableWithSize. Submitted by: Matt Macy Modified: head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c head/sys/contrib/dev/acpica/components/tables/tbxface.c head/sys/contrib/dev/acpica/include/acpixf.h Modified: head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c == --- head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c Sun Jan 8 06:22:35 2017(r311666) +++ head/sys/contrib/dev/acpica/components/namespace/nsxfeval.c Sun Jan 8 06:26:33 2017(r311667) @@ -1022,23 +1022,25 @@ ACPI_EXPORT_SYMBOL (AcpiDetachData) /*** * - * FUNCTION:AcpiGetData + * FUNCTION:AcpiGetDataFull * * PARAMETERS: ObjHandle - Namespace node - * Handler - Handler used in call to AttachData + * Handle - Handler used in call to attach_data * Data- Where the data is returned + * Callback- function to execute before returning * * RETURN: Status * - * DESCRIPTION: Retrieve data that was previously attached to a namespace node. + * DESCRIPTION: Retrieve data that was previously attached to a namespace node + * and execute a callback before returning. * **/ - ACPI_STATUS -AcpiGetData ( +AcpiGetDataFull ( ACPI_HANDLE ObjHandle, ACPI_OBJECT_HANDLER Handler, -void**Data) +void**Data, +void (*Callback)(void *)) { ACPI_NAMESPACE_NODE *Node; ACPI_STATUS Status; @@ -1069,10 +1071,34 @@ AcpiGetData ( } Status = AcpiNsGetAttachedData (Node, Handler, Data); - +if (ACPI_SUCCESS(Status) && Callback) { + Callback(*Data); +} UnlockAndExit: (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); return (Status); } +ACPI_EXPORT_SYMBOL (AcpiGetDataFull) +/*** + * + * FUNCTION:AcpiGetData + * + * PARAMETERS: ObjHandle - Namespace node + * Handler - Handler used in call to AttachData + * Data- Where the data is returned + * + * RETURN: Status + * + * DESCRIPTION: Retrieve data that was previously attached to a namespace node. + * + **/ +ACPI_STATUS +AcpiGetData ( +ACPI_HANDLE ObjHandle, +ACPI_OBJECT_HANDLER Handler, +void**Data) +{ + return (AcpiGetDataFull(ObjHandle, Handler, Data, NULL)); +} ACPI_EXPORT_SYMBOL (AcpiGetData) Modified: head/sys/contrib/dev/acpica/components/tables/tbxface.c == --- head/sys/contrib/dev/acpica/components/tables/tbxface.c Sun Jan 8 06:22:35 2017(r311666) +++ head/sys/contrib/dev/acpica/components/tables/tbxface.c Sun Jan 8 06:26:33 2017(r311667) @@ -314,11 +314,12 @@ ACPI_EXPORT_SYMBOL (AcpiGetTableHeader) /*** * - * FUNCTION:AcpiGetTable + * FUNCTION:AcpiGetTableWithSize * * PARAMETERS: Signature - ACPI signature of needed table * Instance- Which instance (for SSDTs) * OutTable- Where the pointer to the table is returned + * TblSize - Size of the table * * RETURN: Status and pointer to the requested table * @@ -333,10 +334,11 @@ ACPI_EXPORT_SYMBOL (AcpiGetTableHeader) **/ ACPI_STATUS -AcpiGetTable ( +AcpiGetTableWithSize ( char*Signature, UINT32 Instance, -ACPI_TABLE_HEADER **OutTable) +ACPI_TABLE_HEADER **OutTable, +ACPI_SIZE *TblSize) { UINT32 i; UINT32 j; @@ -434,12 +436,40 @@ AcpiPutTable ( (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); return_VOID; } - ACPI_EXPORT_SYMBOL (AcpiPutTable) /*** * + * FUNCTION:AcpiGetTable + * + * PARAMETERS: Signature - ACPI signature of needed table + * Instance- Which instance (for SSDTs) + * OutTable- Where the pointer to the table is returned + * + * RETURN: Status and p
svn commit: r311666 - head/sys/fs/cd9660
Author: cem Date: Sun Jan 8 06:22:35 2017 New Revision: 311666 URL: https://svnweb.freebsd.org/changeset/base/311666 Log: Do not truncate inode calculation from ISO9660 block offset PR: 190655 Reported by: Thomas Schmitt Obtained from:NetBSD sys/fs/cd9660/cd9660_node.c,r1.31 Modified: head/sys/fs/cd9660/cd9660_node.c Modified: head/sys/fs/cd9660/cd9660_node.c == --- head/sys/fs/cd9660/cd9660_node.cSun Jan 8 06:21:49 2017 (r311665) +++ head/sys/fs/cd9660/cd9660_node.cSun Jan 8 06:22:35 2017 (r311666) @@ -316,7 +316,14 @@ isodirino(isodir, imp) { cd_ino_t ino; - ino = (isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length)) - << imp->im_bshift; - return (ino); + /* +* Note there is an inverse calculation in +* cd9660_vfsops.c:cd9660_vget_internal(): +* ip->iso_start = ino >> imp->im_bshift; +* and also a calculation of the isodir pointer +* from an inode in cd9660_vnops.c:cd9660_readlink() +*/ + ino = ((cd_ino_t)isonum_733(isodir->extent) + + isonum_711(isodir->ext_attr_length)) << imp->im_bshift; + return ino; } ___ 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: r311665 - head/sys/fs/cd9660
Author: cem Date: Sun Jan 8 06:21:49 2017 New Revision: 311665 URL: https://svnweb.freebsd.org/changeset/base/311665 Log: cd9660: Expand internal inum size to 64 bits Inums in cd9660 refer to byte offsets on the media. DVD and BD media can have entries above 4GB, especially with multi-session images. PR: 190655 Reported by: Thomas Schmitt Modified: head/sys/fs/cd9660/cd9660_lookup.c head/sys/fs/cd9660/cd9660_node.c head/sys/fs/cd9660/cd9660_node.h head/sys/fs/cd9660/cd9660_rrip.c head/sys/fs/cd9660/cd9660_vfsops.c head/sys/fs/cd9660/cd9660_vnops.c head/sys/fs/cd9660/iso.h head/sys/fs/cd9660/iso_rrip.h Modified: head/sys/fs/cd9660/cd9660_lookup.c == --- head/sys/fs/cd9660/cd9660_lookup.c Sun Jan 8 06:20:21 2017 (r311664) +++ head/sys/fs/cd9660/cd9660_lookup.c Sun Jan 8 06:21:49 2017 (r311665) @@ -51,8 +51,8 @@ __FBSDID("$FreeBSD$"); #include struct cd9660_ino_alloc_arg { - ino_t ino; - ino_t i_ino; + cd_ino_t ino; + cd_ino_t i_ino; struct iso_directory_record *ep; }; @@ -124,7 +124,7 @@ cd9660_lookup(ap) struct cd9660_ino_alloc_arg dd_arg; u_long bmask; /* block offset mask */ int error; - ino_t ino, i_ino; + cd_ino_t ino, i_ino; int ltype, reclen; u_short namelen; int isoflags; Modified: head/sys/fs/cd9660/cd9660_node.c == --- head/sys/fs/cd9660/cd9660_node.cSun Jan 8 06:20:21 2017 (r311664) +++ head/sys/fs/cd9660/cd9660_node.cSun Jan 8 06:21:49 2017 (r311665) @@ -309,12 +309,12 @@ cd9660_tstamp_conv17(pi,pu) return cd9660_tstamp_conv7(buf, pu, ISO_FTYPE_DEFAULT); } -ino_t +cd_ino_t isodirino(isodir, imp) struct iso_directory_record *isodir; struct iso_mnt *imp; { - ino_t ino; + cd_ino_t ino; ino = (isonum_733(isodir->extent) + isonum_711(isodir->ext_attr_length)) << imp->im_bshift; Modified: head/sys/fs/cd9660/cd9660_node.h == --- head/sys/fs/cd9660/cd9660_node.hSun Jan 8 06:20:21 2017 (r311664) +++ head/sys/fs/cd9660/cd9660_node.hSun Jan 8 06:21:49 2017 (r311665) @@ -58,7 +58,7 @@ typedef struct { struct iso_node { struct vnode *i_vnode; /* vnode associated with this inode */ - ino_t i_number; /* the identity of the inode */ + cd_ino_ti_number; /* the identity of the inode */ /* we use the actual starting block of the file */ struct iso_mnt *i_mnt; /* filesystem associated with this inode */ struct lockf *i_lockf; /* head of byte-level lock list */ Modified: head/sys/fs/cd9660/cd9660_rrip.c == --- head/sys/fs/cd9660/cd9660_rrip.cSun Jan 8 06:20:21 2017 (r311664) +++ head/sys/fs/cd9660/cd9660_rrip.cSun Jan 8 06:21:49 2017 (r311665) @@ -628,7 +628,7 @@ cd9660_rrip_getname(isodir,outbuf,outlen struct iso_directory_record *isodir; char *outbuf; u_short *outlen; - ino_t *inump; + cd_ino_t *inump; struct iso_mnt *imp; { ISO_RRIP_ANALYZE analyze; Modified: head/sys/fs/cd9660/cd9660_vfsops.c == --- head/sys/fs/cd9660/cd9660_vfsops.c Sun Jan 8 06:20:21 2017 (r311664) +++ head/sys/fs/cd9660/cd9660_vfsops.c Sun Jan 8 06:21:49 2017 (r311665) @@ -540,7 +540,7 @@ cd9660_root(mp, flags, vpp) struct iso_mnt *imp = VFSTOISOFS(mp); struct iso_directory_record *dp = (struct iso_directory_record *)imp->root; - ino_t ino = isodirino(dp, imp); + cd_ino_t ino = isodirino(dp, imp); /* * With RRIP we must use the `.' entry of the root directory. @@ -617,6 +617,11 @@ cd9660_fhtovp(mp, fhp, flags, vpp) return (0); } +/* + * Conform to standard VFS interface; can't vget arbitrary inodes beyond 4GB + * into media with current inode scheme and 32-bit ino_t. This shouldn't be + * needed for anything other than nfsd, and who exports a mounted DVD over NFS? + */ static int cd9660_vget(mp, ino, flags, vpp) struct mount *mp; @@ -640,10 +645,22 @@ cd9660_vget(mp, ino, flags, vpp) (struct iso_directory_record *)0)); } +/* Use special comparator for full 64-bit ino comparison. */ +static int +cd9660_vfs_hash_cmp(vp, pino) + struct vnode *vp; + cd_ino_t *pino; +{ + struct iso_node *ip; + + ip = VTOI(vp); + return (ip->i_number != *pino); +} + int cd9660_vget_internal(mp, ino, flags, vpp, relocated, isodir) struct mount *mp; - ino
svn commit: r311664 - head/sys/dev/mmc
Author: cem Date: Sun Jan 8 06:20:21 2017 New Revision: 311664 URL: https://svnweb.freebsd.org/changeset/base/311664 Log: mmc: Accept even lower voltage for Cherryview And HP x2 210, per DragonFlyBSD 240bd9cd58f8259c12c14a8006837e698. Submitted by: Johannes Lundberg No objection: gonzo@ Obtained from:DragonFlyBSD Modified: head/sys/dev/mmc/mmcreg.h Modified: head/sys/dev/mmc/mmcreg.h == --- head/sys/dev/mmc/mmcreg.h Sun Jan 8 04:27:08 2017(r311663) +++ head/sys/dev/mmc/mmcreg.h Sun Jan 8 06:20:21 2017(r311664) @@ -355,8 +355,8 @@ struct mmc_request { */ #defineMMC_OCR_VOLTAGE 0x3fffU /* Vdd Voltage mask */ #defineMMC_OCR_LOW_VOLTAGE (1u << 7) /* Low Voltage Range -- tbd */ +#defineMMC_OCR_MIN_VOLTAGE_SHIFT 7 #defineMMC_OCR_200_210 (1U << 8) /* Vdd voltage 2.00 ~ 2.10 */ -#defineMMC_OCR_MIN_VOLTAGE_SHIFT 8 #defineMMC_OCR_210_220 (1U << 9) /* Vdd voltage 2.10 ~ 2.20 */ #defineMMC_OCR_220_230 (1U << 10) /* Vdd voltage 2.20 ~ 2.30 */ #defineMMC_OCR_230_240 (1U << 11) /* Vdd voltage 2.30 ~ 2.40 */ ___ 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: r311663 - in head/sys: conf modules/wlan
Author: adrian Date: Sun Jan 8 04:27:08 2017 New Revision: 311663 URL: https://svnweb.freebsd.org/changeset/base/311663 Log: [net80211] include the prototype VHT code into the build. Note: it isn't called anywhere yet! Modified: head/sys/conf/files head/sys/modules/wlan/Makefile Modified: head/sys/conf/files == --- head/sys/conf/files Sun Jan 8 04:25:41 2017(r311662) +++ head/sys/conf/files Sun Jan 8 04:27:08 2017(r311663) @@ -3965,6 +3965,7 @@ net80211/ieee80211_sta.c optional wlan \ net80211/ieee80211_superg.coptional wlan ieee80211_support_superg net80211/ieee80211_scan_sw.c optional wlan net80211/ieee80211_tdma.c optional wlan ieee80211_support_tdma +net80211/ieee80211_vht.c optional wlan net80211/ieee80211_wds.c optional wlan net80211/ieee80211_xauth.c optional wlan wlan_xauth net80211/ieee80211_alq.c optional wlan ieee80211_alq Modified: head/sys/modules/wlan/Makefile == --- head/sys/modules/wlan/Makefile Sun Jan 8 04:25:41 2017 (r311662) +++ head/sys/modules/wlan/Makefile Sun Jan 8 04:27:08 2017 (r311663) @@ -12,7 +12,7 @@ SRCS= ieee80211.c ieee80211_action.c iee ieee80211_ratectl_none.c ieee80211_regdomain.c \ ieee80211_ht.c ieee80211_hwmp.c ieee80211_adhoc.c ieee80211_hostap.c \ ieee80211_monitor.c ieee80211_sta.c ieee80211_wds.c ieee80211_ddb.c \ - ieee80211_tdma.c ieee80211_superg.c + ieee80211_tdma.c ieee80211_superg.c ieee80211_vht.c SRCS+= bus_if.h device_if.h opt_ddb.h opt_inet.h opt_inet6.h \ opt_tdma.h opt_wlan.h ___ 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: r311662 - head/sys/net80211
Author: adrian Date: Sun Jan 8 04:25:41 2017 New Revision: 311662 URL: https://svnweb.freebsd.org/changeset/base/311662 Log: [net80211] Add initial VHT support routines. This is a skeleton set based on ieee80211_ht.c. It implements some IE parsing, some basic unfinished negotiation, and channel promotion/demotion. However, by itself it's not enough to do VHT - notably, the actual channel promotion for STA mode at least is done in ieee80211_ht.c as part of htinfo_update_chw(). I was .. quite amused when I found that out. I'm checking this in so others can see progress rather than one huge commit when VHT is "done" (which will likely be quite a while.) Added: head/sys/net80211/ieee80211_vht.c (contents, props changed) head/sys/net80211/ieee80211_vht.h (contents, props changed) Added: head/sys/net80211/ieee80211_vht.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/net80211/ieee80211_vht.c Sun Jan 8 04:25:41 2017 (r311662) @@ -0,0 +1,469 @@ +/*- + * Copyright (c) 2017 Adrian Chadd + * 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 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 +#ifdef __FreeBSD__ +__FBSDID("$FreeBSD$"); +#endif + +/* + * IEEE 802.11ac-2013 protocol support. + */ + +#include "opt_inet.h" +#include "opt_wlan.h" + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +/* define here, used throughout file */ +#defineMS(_v, _f) (((_v) & _f) >> _f##_S) +#defineSM(_v, _f) (((_v) << _f##_S) & _f) + +#defineADDSHORT(frm, v) do { \ + frm[0] = (v) & 0xff;\ + frm[1] = (v) >> 8; \ + frm += 2; \ +} while (0) +#defineADDWORD(frm, v) do {\ + frm[0] = (v) & 0xff;\ + frm[1] = ((v) >> 8) & 0xff; \ + frm[2] = ((v) >> 16) & 0xff;\ + frm[3] = ((v) >> 24) & 0xff;\ + frm += 4; \ +} while (0) + +/* + * XXX TODO: handle WLAN_ACTION_VHT_OPMODE_NOTIF + * + * Look at mac80211/vht.c:ieee80211_vht_handle_opmode() for further details. + */ + +static void +ieee80211_vht_init(void) +{ +} + +SYSINIT(wlan_vht, SI_SUB_DRIVERS, SI_ORDER_FIRST, ieee80211_vht_init, NULL); + +void +ieee80211_vht_attach(struct ieee80211com *ic) +{ +} + +void +ieee80211_vht_detach(struct ieee80211com *ic) +{ +} + +void +ieee80211_vht_vattach(struct ieee80211vap *vap) +{ + struct ieee80211com *ic = vap->iv_ic; + + if (! IEEE80211_CONF_VHT(ic)) + return; + + vap->iv_vhtcaps = ic->ic_vhtcaps; + vap->iv_vhtextcaps = ic->ic_vhtextcaps; + + /* XXX assume VHT80 support; should really check vhtcaps */ + vap->iv_flags_vht = + IEEE80211_FVHT_VHT + | IEEE80211_FVHT_USEVHT40 + | IEEE80211_FVHT_USEVHT80; + /* XXX TODO: enable VHT80+80, VHT160 capabilities */ + + memcpy(&vap->iv_vht_mcsinfo, &ic->ic_vht_mcsinfo, + sizeof(struct ieee80211_vht_mcs_info)); +} + +void +ieee80211_vht_vdetach(struct ieee80211vap *vap) +{ +} + +#if 0 +static void +vht_announce(struct ieee80211com *ic, enum ieee80211_phymode mode) +{ +} +#endif + +static int +vht_mcs_to_num(int m) +{ + + switch (m) { + case IEEE80211_VHT_MCS_SUPPORT_0_7: + return (7); + case IEEE80211_VHT_MCS_SUPPORT_0_8: + return (8); + case IEEE80211_VHT_MCS_SUPPORT_0_9: + return (9); + default: +
svn commit: r311661 - head/sys/net80211
Author: adrian Date: Sun Jan 8 04:23:05 2017 New Revision: 311661 URL: https://svnweb.freebsd.org/changeset/base/311661 Log: [net80211] add a "is VHT available" macro. We have run out of config bits, sigh, so until I expand the ic config bits, just use this macro as a substitute. Modified: head/sys/net80211/ieee80211_var.h Modified: head/sys/net80211/ieee80211_var.h == --- head/sys/net80211/ieee80211_var.h Sun Jan 8 02:32:53 2017 (r311660) +++ head/sys/net80211/ieee80211_var.h Sun Jan 8 04:23:05 2017 (r311661) @@ -88,6 +88,14 @@ #defineIEEE80211_TU_TO_TICKS(x)(((uint64_t)(x) * 1024 * hz) / (1000 * 1000)) /* + * Technically, vhtflags may be 0 /and/ 11ac is enabled. + * At some point ic should just grow a flag somewhere that + * says that VHT is supported - and then this macro can be + * changed. + */ +#defineIEEE80211_CONF_VHT(ic) ((ic)->ic_vhtcaps != 0) + +/* * 802.11 control state is split into a common portion that maps * 1-1 to a physical device and one or more "Virtual AP's" (VAP) * that are bound to an ieee80211com instance and share a single ___ 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: r311660 - head/sys/dev/sdhci
Author: ian Date: Sun Jan 8 02:32:53 2017 New Revision: 311660 URL: https://svnweb.freebsd.org/changeset/base/311660 Log: Add a new sdhci interface method, get_card_present(). Many embedded SoC controllers that are (more or less) sdhci-compatible don't implement card detect, and the related values in the PRESENT_STATE register aren't useful. A bridge driver can now implement get_card_present() to read a gpio pin or whatever else is necessary for that system. The default implementation reads the CARD_PRESENT bit from the PRESENT_STATE register, so existing drivers will keep working (or keep not-fully-working, since many drivers right now can't detect card insert/remove). Modified: head/sys/dev/sdhci/sdhci.c head/sys/dev/sdhci/sdhci.h head/sys/dev/sdhci/sdhci_if.m Modified: head/sys/dev/sdhci/sdhci.c == --- head/sys/dev/sdhci/sdhci.c Sat Jan 7 23:42:17 2017(r311659) +++ head/sys/dev/sdhci/sdhci.c Sun Jan 8 02:32:53 2017(r311660) @@ -164,8 +164,7 @@ sdhci_reset(struct sdhci_slot *slot, uin int timeout; if (slot->quirks & SDHCI_QUIRK_NO_CARD_NO_RESET) { - if (!(RD4(slot, SDHCI_PRESENT_STATE) & - SDHCI_CARD_PRESENT)) + if (!SDHCI_GET_CARD_PRESENT(slot->bus, slot)) return; } @@ -489,7 +488,7 @@ sdhci_card_task(void *arg, int pending) struct sdhci_slot *slot = arg; SDHCI_LOCK(slot); - if (RD4(slot, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT) { + if (SDHCI_GET_CARD_PRESENT(slot->bus, slot)) { if (slot->dev == NULL) { /* If card is present - attach mmc bus. */ slot->dev = device_add_child(slot->bus, "mmc", -1); @@ -718,6 +717,13 @@ sdhci_generic_min_freq(device_t brdev, s return (slot->max_clk / SDHCI_200_MAX_DIVIDER); } +bool +sdhci_generic_get_card_present(device_t brdev, struct sdhci_slot *slot) +{ + + return (RD4(slot, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT); +} + int sdhci_generic_update_ios(device_t brdev, device_t reqdev) { @@ -834,7 +840,7 @@ sdhci_start_command(struct sdhci_slot *s state = RD4(slot, SDHCI_PRESENT_STATE); /* Do not issue command if there is no card, clock or power. * Controller will not detect timeout without clock active. */ - if ((state & SDHCI_CARD_PRESENT) == 0 || + if (!SDHCI_GET_CARD_PRESENT(slot->bus, slot) || slot->power == 0 || slot->clock == 0) { cmd->error = MMC_ERR_FAILED; @@ -1323,7 +1329,7 @@ sdhci_generic_intr(struct sdhci_slot *sl /* Handle card presence interrupts. */ if (intmask & (SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE)) { - present = RD4(slot, SDHCI_PRESENT_STATE) & SDHCI_CARD_PRESENT; + present = SDHCI_GET_CARD_PRESENT(slot->bus, slot); slot->intmask &= ~(SDHCI_INT_CARD_INSERT | SDHCI_INT_CARD_REMOVE); slot->intmask |= present ? SDHCI_INT_CARD_REMOVE : Modified: head/sys/dev/sdhci/sdhci.h == --- head/sys/dev/sdhci/sdhci.h Sat Jan 7 23:42:17 2017(r311659) +++ head/sys/dev/sdhci/sdhci.h Sun Jan 8 02:32:53 2017(r311660) @@ -322,5 +322,6 @@ int sdhci_generic_acquire_host(device_t int sdhci_generic_release_host(device_t brdev, device_t reqdev); void sdhci_generic_intr(struct sdhci_slot *slot); uint32_t sdhci_generic_min_freq(device_t brdev, struct sdhci_slot *slot); +bool sdhci_generic_get_card_present(device_t brdev, struct sdhci_slot *slot); #endif /* __SDHCI_H__ */ Modified: head/sys/dev/sdhci/sdhci_if.m == --- head/sys/dev/sdhci/sdhci_if.m Sat Jan 7 23:42:17 2017 (r311659) +++ head/sys/dev/sdhci/sdhci_if.m Sun Jan 8 02:32:53 2017 (r311660) @@ -152,3 +152,9 @@ METHOD uint32_t min_freq { device_tbrdev; struct sdhci_slot *slot; } DEFAULT sdhci_generic_min_freq; + +METHOD bool get_card_present { + device_tbrdev; + struct sdhci_slot *slot; +} DEFAULT sdhci_generic_get_card_present; + ___ 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: r311659 - head/lib/libstand
Author: bapt Date: Sat Jan 7 23:42:17 2017 New Revision: 311659 URL: https://svnweb.freebsd.org/changeset/base/311659 Log: remove network mask calculation for Classful network Nowadays it's not necessary to compute network mask from the IP address and compare to given by DHCP. Submitted by: kczekirda Reviewed by: glebius, bapt MFC after:3 weeks Differential Revision:https://reviews.freebsd.org/D8740 Modified: head/lib/libstand/bootp.c Modified: head/lib/libstand/bootp.c == --- head/lib/libstand/bootp.c Sat Jan 7 22:55:23 2017(r311658) +++ head/lib/libstand/bootp.c Sat Jan 7 23:42:17 2017(r311659) @@ -62,8 +62,6 @@ __FBSDID("$FreeBSD$"); struct in_addr servip; -static n_long nmask, smask; - static time_t bot; static char vm_rfc1048[4] = VM_RFC1048; @@ -223,30 +221,19 @@ bootp(sock, flag) bcopy(rbuf.rbootp.bp_file, bootfile, sizeof(bootfile)); bootfile[sizeof(bootfile) - 1] = '\0'; - if (IN_CLASSA(ntohl(myip.s_addr))) - nmask = htonl(IN_CLASSA_NET); - else if (IN_CLASSB(ntohl(myip.s_addr))) - nmask = htonl(IN_CLASSB_NET); - else - nmask = htonl(IN_CLASSC_NET); -#ifdef BOOTP_DEBUG - if (debug) - printf("'native netmask' is %s\n", intoa(nmask)); -#endif - - /* Check subnet mask against net mask; toss if bogus */ - if ((nmask & smask) != nmask) { + if (!netmask) { + if (IN_CLASSA(ntohl(myip.s_addr))) + netmask = htonl(IN_CLASSA_NET); + else if (IN_CLASSB(ntohl(myip.s_addr))) + netmask = htonl(IN_CLASSB_NET); + else + netmask = htonl(IN_CLASSC_NET); #ifdef BOOTP_DEBUG if (debug) - printf("subnet mask (%s) bad\n", intoa(smask)); + printf("'native netmask' is %s\n", intoa(netmask)); #endif - smask = 0; } - /* Get subnet (or natural net) mask */ - netmask = nmask; - if (smask) - netmask = smask; #ifdef BOOTP_DEBUG if (debug) printf("mask: %s\n", intoa(netmask)); @@ -385,7 +372,7 @@ vend_rfc1048(cp, len) break; if (tag == TAG_SUBNET_MASK) { - bcopy(cp, &smask, sizeof(smask)); + bcopy(cp, &netmask, sizeof(netmask)); } if (tag == TAG_GATEWAY) { bcopy(cp, &gateip.s_addr, sizeof(gateip.s_addr)); @@ -445,7 +432,7 @@ vend_cmu(cp) vp = (struct cmu_vend *)cp; if (vp->v_smask.s_addr != 0) { - smask = vp->v_smask.s_addr; + netmask = vp->v_smask.s_addr; } if (vp->v_dgate.s_addr != 0) { gateip = vp->v_dgate; ___ 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: r311658 - head/sys/dev/gpio
Author: ian Date: Sat Jan 7 22:55:23 2017 New Revision: 311658 URL: https://svnweb.freebsd.org/changeset/base/311658 Log: Only write to *active once, even when GPIO_ACTIVE_LOW is set. Modified: head/sys/dev/gpio/ofw_gpiobus.c Modified: head/sys/dev/gpio/ofw_gpiobus.c == --- head/sys/dev/gpio/ofw_gpiobus.c Sat Jan 7 20:26:19 2017 (r311657) +++ head/sys/dev/gpio/ofw_gpiobus.c Sat Jan 7 22:55:23 2017 (r311658) @@ -178,9 +178,10 @@ gpio_pin_is_active(gpio_pin_t pin, bool return (rv); } - *active = tmp != 0; if (pin->flags & GPIO_ACTIVE_LOW) - *active = !(*active); + *active = tmp == 0; + else + *active = tmp != 0; return (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: r311657 - head/sys/dev/cxgbe/tom
Author: np Date: Sat Jan 7 20:26:19 2017 New Revision: 311657 URL: https://svnweb.freebsd.org/changeset/base/311657 Log: cxgbe/t4_tom: Fix tid accounting. An offloaded IPv6 connection uses 2 tids, not 1, in the hardware. MFC after:3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/tom/t4_connect.c head/sys/dev/cxgbe/tom/t4_listen.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/tom/t4_connect.c == --- head/sys/dev/cxgbe/tom/t4_connect.c Sat Jan 7 19:43:40 2017 (r311656) +++ head/sys/dev/cxgbe/tom/t4_connect.c Sat Jan 7 20:26:19 2017 (r311657) @@ -128,7 +128,7 @@ do_act_establish(struct sge_iq *iq, cons INP_WLOCK(inp); toep->tid = tid; - insert_tid(sc, tid, toep); + insert_tid(sc, tid, toep, inp->inp_vflag & INP_IPV6 ? 2 : 1); if (inp->inp_flags & INP_DROPPED) { /* socket closed by the kernel before hw told us it connected */ Modified: head/sys/dev/cxgbe/tom/t4_listen.c == --- head/sys/dev/cxgbe/tom/t4_listen.c Sat Jan 7 19:43:40 2017 (r311656) +++ head/sys/dev/cxgbe/tom/t4_listen.c Sat Jan 7 20:26:19 2017 (r311657) @@ -824,14 +824,16 @@ done_with_synqe(struct adapter *sc, stru struct inpcb *inp = lctx->inp; struct vi_info *vi = synqe->syn->m_pkthdr.rcvif->if_softc; struct l2t_entry *e = &sc->l2t->l2tab[synqe->l2e_idx]; + int ntids; INP_WLOCK_ASSERT(inp); + ntids = inp->inp_vflag & INP_IPV6 ? 2 : 1; TAILQ_REMOVE(&lctx->synq, synqe, link); inp = release_lctx(sc, lctx); if (inp) INP_WUNLOCK(inp); - remove_tid(sc, synqe->tid); + remove_tid(sc, synqe->tid, ntids); release_tid(sc, synqe->tid, &sc->sge.ctrlq[vi->pi->port_id]); t4_l2t_release(e); release_synqe(synqe); /* removed from synq list */ @@ -1180,7 +1182,7 @@ do_pass_accept_req(struct sge_iq *iq, co struct l2t_entry *e = NULL; int rscale, mtu_idx, rx_credits, rxqid, ulp_mode; struct synq_entry *synqe = NULL; - int reject_reason, v; + int reject_reason, v, ntids; uint16_t vid; #ifdef INVARIANTS unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl))); @@ -1254,6 +1256,8 @@ found: */ if (!in6_ifhasaddr(ifp, &inc.inc6_laddr)) REJECT_PASS_ACCEPT(); + + ntids = 2; } else { /* Don't offload if the ifcap isn't enabled */ @@ -1266,6 +1270,8 @@ found: */ if (!in_ifhasaddr(ifp, inc.inc_laddr)) REJECT_PASS_ACCEPT(); + + ntids = 1; } e = get_l2te_for_nexthop(pi, ifp, &inc); @@ -1343,7 +1349,7 @@ found: synqe->rcv_bufsize = rx_credits; atomic_store_rel_ptr(&synqe->wr, (uintptr_t)wr); - insert_tid(sc, tid, synqe); + insert_tid(sc, tid, synqe, ntids); TAILQ_INSERT_TAIL(&lctx->synq, synqe, link); hold_synqe(synqe); /* hold for the duration it's in the synq */ hold_lctx(lctx);/* A synqe on the list has a ref on its lctx */ @@ -1372,7 +1378,7 @@ found: if (m) m->m_pkthdr.rcvif = hw_ifp; - remove_tid(sc, synqe->tid); + remove_tid(sc, synqe->tid, ntids); free(wr, M_CXGBE); /* Yank the synqe out of the lctx synq. */ Modified: head/sys/dev/cxgbe/tom/t4_tom.c == --- head/sys/dev/cxgbe/tom/t4_tom.c Sat Jan 7 19:43:40 2017 (r311656) +++ head/sys/dev/cxgbe/tom/t4_tom.c Sat Jan 7 20:26:19 2017 (r311657) @@ -307,7 +307,7 @@ release_offload_resources(struct toepcb t4_l2t_release(toep->l2te); if (tid >= 0) { - remove_tid(sc, tid); + remove_tid(sc, tid, toep->ce ? 2 : 1); release_tid(sc, tid, toep->ctrlq); } @@ -420,12 +420,12 @@ final_cpl_received(struct toepcb *toep) } void -insert_tid(struct adapter *sc, int tid, void *ctx) +insert_tid(struct adapter *sc, int tid, void *ctx, int ntids) { struct tid_info *t = &sc->tids; t->tid_tab[tid] = ctx; - atomic_add_int(&t->tids_in_use, 1); + atomic_add_int(&t->tids_in_use, ntids); } void * @@ -445,12 +445,12 @@ update_tid(struct adapter *sc, int tid, } void -remove_tid(struct adapter *sc, int tid) +remove_tid(struct adapter *sc, int tid, int ntids) { struct tid_info *t = &sc->tids; t->tid_tab[tid] = NULL; - atomic_subtract_int(&t->tids_in_use, 1); + atomic_subtract_int(&t->tids_in_use, ntids); } void Modified: head/sys
svn commit: r311656 - head/sbin/md5
Author: allanjude Date: Sat Jan 7 19:43:40 2017 New Revision: 311656 URL: https://svnweb.freebsd.org/changeset/base/311656 Log: Add skein(3) front ends to the md5 manpage Reported by: emaste Modified: head/sbin/md5/md5.1 Modified: head/sbin/md5/md5.1 == --- head/sbin/md5/md5.1 Sat Jan 7 19:26:25 2017(r311655) +++ head/sbin/md5/md5.1 Sat Jan 7 19:43:40 2017(r311656) @@ -1,9 +1,10 @@ .\" $FreeBSD$ -.Dd April 22, 2016 +.Dd January 7, 2017 .Dt MD5 1 .Os .Sh NAME -.Nm md5 , sha1 , sha256 , sha384 , sha512, sha512t256, rmd160 +.Nm md5 , sha1 , sha256 , sha384 , sha512 , sha512t256 , rmd160 , +.Nm skein256 , skein512 , skein1024 .Nd calculate a message-digest fingerprint (checksum) for a file .Sh SYNOPSIS .Nm md5 @@ -41,11 +42,27 @@ .Op Fl c Ar string .Op Fl s Ar string .Op Ar +.Nm skein256 +.Op Fl pqrtx +.Op Fl c Ar string +.Op Fl s Ar string +.Op Ar +.Nm skein512 +.Op Fl pqrtx +.Op Fl c Ar string +.Op Fl s Ar string +.Op Ar +.Nm skein1024 +.Op Fl pqrtx +.Op Fl c Ar string +.Op Fl s Ar string +.Op Ar .Sh DESCRIPTION The -.Nm md5 , sha1 , sha256 , sha384 , sha512, sha512t256 +.Nm md5 , sha1 , sha256 , sha384 , sha512, sha512t256, rmd160, +.Nm skein256, skein512, and -.Nm rmd160 +.Nm skein1024 utilities take as input a message of arbitrary length and produce as output a .Dq fingerprint @@ -56,9 +73,9 @@ It is conjectured that it is computation produce two messages having the same message digest, or to produce any message having a given prespecified target message digest. The -.Tn MD5 , SHA-1 , SHA-256 , SHA-384 , SHA-512 +.Tn MD5 , SHA-1 , SHA-256 , SHA-384 , SHA-512, RIPEMD-160, and -.Tn RIPEMD-160 +.Tn SKEIN algorithms are intended for digital signature applications, where a large file must be .Dq compressed @@ -128,9 +145,10 @@ Run a built-in test script. .El .Sh EXIT STATUS The -.Nm md5 , sha1 , sha256 , sha512, sha512t256 +.Nm md5 , sha1 , sha256 , sha512, sha512t256, rmd160, +.Nm skein256, skein512, and -.Nm rmd160 +.Nm skein1024 utilities exit 0 on success, 1 if at least one of the input files could not be read, and 2 if at least one file does not have the same hash as the @@ -143,7 +161,8 @@ option. .Xr sha 3 , .Xr sha256 3 , .Xr sha384 3 , -.Xr sha512 3 +.Xr sha512 3 , +.Xr skein 3 .Rs .%A R. Rivest .%T The MD5 Message-Digest Algorithm ___ 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: r311225 - head/sys/netinet
On 7 Jan 2017, at 14:23, George Neville-Neil wrote: On 4 Jan 2017, at 13:26, Mark Johnston wrote: On Wed, Jan 04, 2017 at 02:19:13AM +, George V. Neville-Neil wrote: Author: gnn Date: Wed Jan 4 02:19:13 2017 New Revision: 311225 URL: https://svnweb.freebsd.org/changeset/base/311225 Log: Fix DTrace TCP tracepoints to not use mtod() as it is both unnecessary and dangerous. Those wanting data from an mbuf should use DTrace itself to get the data. I think you also need to update the types in in_kdtrace.c, and add a translator for struct mbuf * to ipinfo_t. Fair points. Actually, following up to myself, this does not need to be done just yet. The pkt_info stuff is currently always NULL. I'm working on a copyoutmbuf() subroutine that will make all of this much cleaner. Best, George ___ 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: r311655 - head/sys/crypto/skein/amd64
Author: emaste Date: Sat Jan 7 19:26:25 2017 New Revision: 311655 URL: https://svnweb.freebsd.org/changeset/base/311655 Log: libmd: add noexec stack annotation in skein_block_asm.s MFC after:1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/crypto/skein/amd64/skein_block_asm.s Modified: head/sys/crypto/skein/amd64/skein_block_asm.s == --- head/sys/crypto/skein/amd64/skein_block_asm.s Sat Jan 7 19:16:53 2017(r311654) +++ head/sys/crypto/skein/amd64/skein_block_asm.s Sat Jan 7 19:26:25 2017(r311655) @@ -1326,4 +1326,6 @@ _SP_OFFS_ = _SP_OFFS_-8 ret .endif # +.section .note.GNU-stack,"",@progbits + .end ___ 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: r311225 - head/sys/netinet
On 4 Jan 2017, at 13:26, Mark Johnston wrote: On Wed, Jan 04, 2017 at 02:19:13AM +, George V. Neville-Neil wrote: Author: gnn Date: Wed Jan 4 02:19:13 2017 New Revision: 311225 URL: https://svnweb.freebsd.org/changeset/base/311225 Log: Fix DTrace TCP tracepoints to not use mtod() as it is both unnecessary and dangerous. Those wanting data from an mbuf should use DTrace itself to get the data. I think you also need to update the types in in_kdtrace.c, and add a translator for struct mbuf * to ipinfo_t. Fair points. Best, George ___ 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: r311654 - in stable: 10/usr.bin/kdump 11/usr.bin/kdump
Author: jhb Date: Sat Jan 7 19:16:53 2017 New Revision: 311654 URL: https://svnweb.freebsd.org/changeset/base/311654 Log: MFC 306563: Decode arguments to truncate and ftruncate. In particular, decode the off_t argument as a 64-bit argument to fix decoding for 32-bit processes. Modified: stable/10/usr.bin/kdump/kdump.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.bin/kdump/kdump.c Directory Properties: stable/11/ (props changed) Modified: stable/10/usr.bin/kdump/kdump.c == --- stable/10/usr.bin/kdump/kdump.c Sat Jan 7 18:54:57 2017 (r311653) +++ stable/10/usr.bin/kdump/kdump.c Sat Jan 7 19:16:53 2017 (r311654) @@ -1252,6 +1252,12 @@ ktrsyscall(struct ktr_syscall *ktr, u_in } ip++; narg--; + break; + case SYS_ftruncate: + case SYS_truncate: + print_number(ip, narg, c); + print_number64(first, ip, narg, c); + break; } } while (narg > 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: r311654 - in stable: 10/usr.bin/kdump 11/usr.bin/kdump
Author: jhb Date: Sat Jan 7 19:16:53 2017 New Revision: 311654 URL: https://svnweb.freebsd.org/changeset/base/311654 Log: MFC 306563: Decode arguments to truncate and ftruncate. In particular, decode the off_t argument as a 64-bit argument to fix decoding for 32-bit processes. Modified: stable/11/usr.bin/kdump/kdump.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/usr.bin/kdump/kdump.c Directory Properties: stable/10/ (props changed) Modified: stable/11/usr.bin/kdump/kdump.c == --- stable/11/usr.bin/kdump/kdump.c Sat Jan 7 18:54:57 2017 (r311653) +++ stable/11/usr.bin/kdump/kdump.c Sat Jan 7 19:16:53 2017 (r311654) @@ -1341,6 +1341,12 @@ ktrsyscall(struct ktr_syscall *ktr, u_in } ip++; narg--; + break; + case SYS_ftruncate: + case SYS_truncate: + print_number(ip, narg, c); + print_number64(first, ip, narg, c); + break; } } while (narg > 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: r311653 - in stable/11/sys/i386: i386 include
Author: jah Date: Sat Jan 7 18:54:57 2017 New Revision: 311653 URL: https://svnweb.freebsd.org/changeset/base/311653 Log: MFC r310481: Move the objects used to create temporary mappings for i386 pmap zero and copy operations to the MD PCPU region. Change sysmap initialization to only allocate KVA pages for CPUs that are actually present. As a minor optimization, this also prevents false sharing between adjacent sysmap objects since the pcpu struct is already cacheline-aligned. While here, move pc_qmap_addr initialization for the BSP into pmap_bootstrap(), which allows use of pmap_quick* functions during early boot. Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D8833 Modified: stable/11/sys/i386/i386/pmap.c stable/11/sys/i386/include/pcpu.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/i386/i386/pmap.c == --- stable/11/sys/i386/i386/pmap.c Sat Jan 7 17:37:39 2017 (r311652) +++ stable/11/sys/i386/i386/pmap.c Sat Jan 7 18:54:57 2017 (r311653) @@ -257,14 +257,6 @@ vm_offset_t pv_vafree; /* freelist sto /* * All those kernel PT submaps that BSD is so fond of */ -struct sysmaps { - struct mtx lock; - pt_entry_t *CMAP1; - pt_entry_t *CMAP2; - caddr_t CADDR1; - caddr_t CADDR2; -}; -static struct sysmaps sysmaps_pcpu[MAXCPU]; pt_entry_t *CMAP3; static pd_entry_t *KPTD; caddr_t ptvmmap = 0; @@ -380,7 +372,7 @@ pmap_bootstrap(vm_paddr_t firstaddr) { vm_offset_t va; pt_entry_t *pte, *unused; - struct sysmaps *sysmaps; + struct pcpu *pc; int i; /* @@ -442,16 +434,19 @@ pmap_bootstrap(vm_paddr_t firstaddr) va = virtual_avail; pte = vtopte(va); + /* +* Initialize temporary map objects on the current CPU for use +* during early boot. * CMAP1/CMAP2 are used for zeroing and copying pages. * CMAP3 is used for the idle process page zeroing. */ - for (i = 0; i < MAXCPU; i++) { - sysmaps = &sysmaps_pcpu[i]; - mtx_init(&sysmaps->lock, "SYSMAPS", NULL, MTX_DEF); - SYSMAP(caddr_t, sysmaps->CMAP1, sysmaps->CADDR1, 1) - SYSMAP(caddr_t, sysmaps->CMAP2, sysmaps->CADDR2, 1) - } + pc = pcpu_find(curcpu); + mtx_init(&pc->pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF); + SYSMAP(caddr_t, pc->pc_cmap_pte1, pc->pc_cmap_addr1, 1) + SYSMAP(caddr_t, pc->pc_cmap_pte2, pc->pc_cmap_addr2, 1) + SYSMAP(vm_offset_t, pte, pc->pc_qmap_addr, 1) + SYSMAP(caddr_t, CMAP3, CADDR3, 1) /* @@ -521,20 +516,33 @@ pmap_bootstrap(vm_paddr_t firstaddr) } static void -pmap_init_qpages(void) +pmap_init_reserved_pages(void) { struct pcpu *pc; + vm_offset_t pages; int i; CPU_FOREACH(i) { pc = pcpu_find(i); - pc->pc_qmap_addr = kva_alloc(PAGE_SIZE); - if (pc->pc_qmap_addr == 0) - panic("pmap_init_qpages: unable to allocate KVA"); + /* +* Skip if the mapping has already been initialized, +* i.e. this is the BSP. +*/ + if (pc->pc_cmap_addr1 != 0) + continue; + mtx_init(&pc->pc_cmap_lock, "SYSMAPS", NULL, MTX_DEF); + pages = kva_alloc(PAGE_SIZE * 3); + if (pages == 0) + panic("%s: unable to allocate KVA", __func__); + pc->pc_cmap_pte1 = vtopte(pages); + pc->pc_cmap_pte2 = vtopte(pages + PAGE_SIZE); + pc->pc_cmap_addr1 = (caddr_t)pages; + pc->pc_cmap_addr2 = (caddr_t)(pages + PAGE_SIZE); + pc->pc_qmap_addr = pages + (PAGE_SIZE * 2); } } - -SYSINIT(qpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_qpages, NULL); + +SYSINIT(rpages_init, SI_SUB_CPU, SI_ORDER_ANY, pmap_init_reserved_pages, NULL); /* * Setup the PAT MSR. @@ -4209,20 +4217,22 @@ pagezero(void *page) void pmap_zero_page(vm_page_t m) { - struct sysmaps *sysmaps; + pt_entry_t *cmap_pte2; + struct pcpu *pc; - sysmaps = &sysmaps_pcpu[PCPU_GET(cpuid)]; - mtx_lock(&sysmaps->lock); - if (*sysmaps->CMAP2) - panic("pmap_zero_page: CMAP2 busy"); sched_pin(); - *sysmaps->CMAP2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M | + pc = pcpu_find(curcpu); + cmap_pte2 = pc->pc_cmap_pte2; + mtx_lock(&pc->pc_cmap_lock); + if (*cmap_pte2) + panic("pmap_zero_page: CMAP2 busy"); + *cmap_pte2 = PG_V | PG_RW | VM_PAGE_TO_PHYS(m) | PG_A | PG_M | pmap_cache_bits(m->md.pat_mode, 0); - invlcaddr(sysmaps->CADDR2); - pagezero(sysmaps->CADDR2); - *sysmaps->CMAP2 = 0; + i
svn commit: r311652 - head/usr.bin/users
Author: allanjude Date: Sat Jan 7 17:37:39 2017 New Revision: 311652 URL: https://svnweb.freebsd.org/changeset/base/311652 Log: style(9) fix Submitted by: jmallett Modified: head/usr.bin/users/users.cc Modified: head/usr.bin/users/users.cc == --- head/usr.bin/users/users.cc Sat Jan 7 16:05:19 2017(r311651) +++ head/usr.bin/users/users.cc Sat Jan 7 17:37:39 2017(r311652) @@ -27,10 +27,11 @@ * SUCH DAMAGE. */ -#include #include __FBSDID("$FreeBSD$"); +#include + #include #include #include ___ 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: r311651 - in head/lib/libc: include stdlib
Author: kib Date: Sat Jan 7 16:05:19 2017 New Revision: 311651 URL: https://svnweb.freebsd.org/changeset/base/311651 Log: Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit. libstdc++ before gcc r244057 expected that libc provided __cxa_thread_atexit_impl, and libstdc++ implemented __cxa_thread_atexit, by forwarding the calls to _impl. Mentioned gcc revision checks for __cxa_thread_atexit in libc and does not provide the symbol from libstdc++ if found. This change helps older gcc, in particular, all released versions which implement thread_local, by consolidating the implementation into libc. For that versions, if configured with the current libc, the __cxa_thread_atexit is exported from libstdc++ as a trivial wrapper around libc::__cxa_thread_atexit_impl. The __cxa_thread_atexit implementation is put into separate source file to allow for static linking with older libstdc++.a. gcc bugzilla: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78968 Reported by: Hannes Hauswedell PR: 215709 Sponsored by: The FreeBSD Foundation MFC after:2 weeks Added: head/lib/libc/stdlib/cxa_thread_atexit_impl.c - copied, changed from r311650, head/lib/libc/stdlib/cxa_thread_atexit.c Modified: head/lib/libc/include/libc_private.h head/lib/libc/stdlib/Makefile.inc head/lib/libc/stdlib/Symbol.map head/lib/libc/stdlib/cxa_thread_atexit.c Modified: head/lib/libc/include/libc_private.h == --- head/lib/libc/include/libc_private.hSat Jan 7 15:58:57 2017 (r311650) +++ head/lib/libc/include/libc_private.hSat Jan 7 16:05:19 2017 (r311651) @@ -272,6 +272,8 @@ void _malloc_thread_cleanup(void); * thread is exiting, so its thread-local dtors should be called. */ void __cxa_thread_call_dtors(void); +int __cxa_thread_atexit_hidden(void (*dtor_func)(void *), void *obj, +void *dso_symbol) __hidden; /* * These functions are used by the threading libraries in order to protect Modified: head/lib/libc/stdlib/Makefile.inc == --- head/lib/libc/stdlib/Makefile.inc Sat Jan 7 15:58:57 2017 (r311650) +++ head/lib/libc/stdlib/Makefile.inc Sat Jan 7 16:05:19 2017 (r311651) @@ -5,7 +5,9 @@ .PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/stdlib ${LIBC_SRCTOP}/stdlib MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ - bsearch.c cxa_thread_atexit.c div.c exit.c getenv.c getopt.c getopt_long.c \ + bsearch.c \ + cxa_thread_atexit.c cxa_thread_atexit_impl.c \ + div.c exit.c getenv.c getopt.c getopt_long.c \ getsubopt.c hcreate.c hcreate_r.c hdestroy_r.c heapsort.c heapsort_b.c \ hsearch_r.c imaxabs.c imaxdiv.c \ insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \ Modified: head/lib/libc/stdlib/Symbol.map == --- head/lib/libc/stdlib/Symbol.map Sat Jan 7 15:58:57 2017 (r311650) +++ head/lib/libc/stdlib/Symbol.map Sat Jan 7 16:05:19 2017 (r311651) @@ -118,6 +118,7 @@ FBSD_1.4 { FBSD_1.5 { __cxa_thread_atexit; + __cxa_thread_atexit_impl; }; FBSDprivate_1.0 { Modified: head/lib/libc/stdlib/cxa_thread_atexit.c == --- head/lib/libc/stdlib/cxa_thread_atexit.cSat Jan 7 15:58:57 2017 (r311650) +++ head/lib/libc/stdlib/cxa_thread_atexit.cSat Jan 7 16:05:19 2017 (r311651) @@ -1,7 +1,10 @@ /*- - * Copyright (c) 2016 Mahdi Mokhtari + * Copyright (c) 2017 The FreeBSD Foundation * All rights reserved. * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -27,114 +30,11 @@ #include __FBSDID("$FreeBSD$"); -#include -#include "namespace.h" -#include -#include -#include -#include -#include -#include -#include "un-namespace.h" #include "libc_private.h" -/* - * C++11 introduces the thread_local scope (like __thread with some - * additions). As a key-feature it should support non-trivial - * destructors, registered with __cxa_thread_atexit() to be executed - * at the thread termination. - * - * The implemention keeps a _Thread_local list of destructors per each - * thread, and calls __cxa_thread_call_dtors() on each thread's exit - * to do cleanup. For a thread calling exit(3), in particular, for - * the initial thread returning from main(), we call - * __cxa_thread_call_dtors() inside exit(). - * - * It could be possible that a dynamically loaded library, use - * thread_local variable but is dlclose()'d before thread exit. The - *
svn commit: r311650 - head/sys/dev/kbd
Author: lifanov (ports committer) Date: Sat Jan 7 15:58:57 2017 New Revision: 311650 URL: https://svnweb.freebsd.org/changeset/base/311650 Log: Restore priority value for OGIO_KEYMAP PR: 206678 Submitted by: ect...@gmail.com Reviewed by: cem Approved by: cem, matthew (mentor) MFC after:1 week Differential Revision:https://reviews.freebsd.org/D5095 Modified: head/sys/dev/kbd/kbd.c Modified: head/sys/dev/kbd/kbd.c == --- head/sys/dev/kbd/kbd.c Sat Jan 7 15:57:12 2017(r311649) +++ head/sys/dev/kbd/kbd.c Sat Jan 7 15:58:57 2017(r311650) @@ -884,7 +884,7 @@ genkbd_commonioctl(keyboard_t *kbd, u_lo omapp->key[i].spcl = mapp->key[i].spcl; omapp->key[i].flgs = mapp->key[i].flgs; } - return (0); + break; case PIO_KEYMAP:/* set keyboard translation table */ case OPIO_KEYMAP: /* set keyboard translation table (compat) */ #ifndef KBD_DISABLE_KEYMAP_LOAD ___ 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: r311649 - head/contrib/ngatm/snmp_atm
Author: dim Date: Sat Jan 7 15:57:12 2017 New Revision: 311649 URL: https://svnweb.freebsd.org/changeset/base/311649 Log: Fix the following clang 4.0.0 warning in ngatm's snmp_atm.c: contrib/ngatm/snmp_atm/snmp_atm.c:173:6: error: logical not is only applied to the left hand side of this bitwise operator [-Werror,-Wlogical-not-parentheses] if (!ifmr.ifm_status & IFM_AVALID) { ^~ Obviously, the masking needs to be done before the logical not operation. Add parentheses to make it so. MFC after: 3 days Modified: head/contrib/ngatm/snmp_atm/snmp_atm.c Modified: head/contrib/ngatm/snmp_atm/snmp_atm.c == --- head/contrib/ngatm/snmp_atm/snmp_atm.c Sat Jan 7 15:18:49 2017 (r311648) +++ head/contrib/ngatm/snmp_atm/snmp_atm.c Sat Jan 7 15:57:12 2017 (r311649) @@ -170,7 +170,7 @@ atmif_check_carrier(struct atmif_priv *a aif->pub.carrier = ATMIF_CARRIER_UNKNOWN; return; } - if (!ifmr.ifm_status & IFM_AVALID) { + if (!(ifmr.ifm_status & IFM_AVALID)) { aif->pub.carrier = ATMIF_CARRIER_UNKNOWN; return; } ___ 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: r311647 - head/contrib/llvm/projects/libunwind/src
Author: emaste Date: Sat Jan 7 14:40:58 2017 New Revision: 311647 URL: https://svnweb.freebsd.org/changeset/base/311647 Log: libunwind: add noexec stack annotation Reported by: vangyzen Reviewed by: kib MFC after:1 week Sponsored by: The FreeBSD Foundation Differential Revision:https://reviews.freebsd.org/D9075 Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S == --- head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Sat Jan 7 12:24:45 2017(r311646) +++ head/contrib/llvm/projects/libunwind/src/UnwindRegistersRestore.S Sat Jan 7 14:40:58 2017(r311647) @@ -527,3 +527,5 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li ret // jump to ra #endif + + .section .note.GNU-stack,"",@progbits Modified: head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S == --- head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S Sat Jan 7 12:24:45 2017(r311646) +++ head/contrib/llvm/projects/libunwind/src/UnwindRegistersSave.S Sat Jan 7 14:40:58 2017(r311647) @@ -469,3 +469,5 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext /* RISCVTODO */ #endif + +.section .note.GNU-stack,"",@progbits ___ 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: r311646 - head/sys/sys
Author: kib Date: Sat Jan 7 12:24:45 2017 New Revision: 311646 URL: https://svnweb.freebsd.org/changeset/base/311646 Log: Define _POSIX_PRIORITY_SCHEDULING as 0. sched_*(2) syscalls might be not available at runtime. Defining this constant as zero directs POSIX-compliant code to call sysconf(3) to detect the feature at runtime, and forces libc sysconf(3) to ask kernel. Noted by: ngie Reviewed by: jilles, ngie Sponsored by: The FreeBSD Foundation MFC after:1 week Differential revision:https://reviews.freebsd.org/D9055 Modified: head/sys/sys/unistd.h Modified: head/sys/sys/unistd.h == --- head/sys/sys/unistd.h Sat Jan 7 12:04:30 2017(r311645) +++ head/sys/sys/unistd.h Sat Jan 7 12:24:45 2017(r311646) @@ -65,7 +65,7 @@ #define_POSIX_MONOTONIC_CLOCK 200112L #define_POSIX_NO_TRUNC 1 #define_POSIX_PRIORITIZED_IO (-1) -#define_POSIX_PRIORITY_SCHEDULING 200112L +#define_POSIX_PRIORITY_SCHEDULING 0 #define_POSIX_RAW_SOCKETS 200112L #define_POSIX_REALTIME_SIGNALS 200112L #define_POSIX_SEMAPHORES 200112L ___ 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: r311645 - stable/10/sys/vm
Author: kib Date: Sat Jan 7 12:04:30 2017 New Revision: 311645 URL: https://svnweb.freebsd.org/changeset/base/311645 Log: MFC r310982: Ansify vm/vm_pager.c. Style. Modified: stable/10/sys/vm/vm_pager.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/vm/vm_pager.c == --- stable/10/sys/vm/vm_pager.c Sat Jan 7 11:58:14 2017(r311644) +++ stable/10/sys/vm/vm_pager.c Sat Jan 7 12:04:30 2017(r311645) @@ -107,43 +107,35 @@ static vm_object_t dead_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t off, struct ucred *cred) { - return NULL; + + return (NULL); } static void -dead_pager_putpages(object, m, count, flags, rtvals) - vm_object_t object; - vm_page_t *m; - int count; - int flags; - int *rtvals; +dead_pager_putpages(vm_object_t object, vm_page_t *m, int count, +int flags, int *rtvals) { int i; - for (i = 0; i < count; i++) { + for (i = 0; i < count; i++) rtvals[i] = VM_PAGER_AGAIN; - } } static int -dead_pager_haspage(object, pindex, prev, next) - vm_object_t object; - vm_pindex_t pindex; - int *prev; - int *next; +dead_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *prev, int *next) { - if (prev) + + if (prev != NULL) *prev = 0; - if (next) + if (next != NULL) *next = 0; - return FALSE; + return (FALSE); } static void -dead_pager_dealloc(object) - vm_object_t object; +dead_pager_dealloc(vm_object_t object) { - return; + } static struct pagerops deadpagerops = { @@ -181,7 +173,7 @@ static int bswneeded; vm_offset_t swapbkva; /* swap buffers kva */ void -vm_pager_init() +vm_pager_init(void) { struct pagerops **pgops; @@ -191,11 +183,11 @@ vm_pager_init() */ for (pgops = pagertab; pgops < &pagertab[npagers]; pgops++) if ((*pgops)->pgo_init != NULL) - (*(*pgops)->pgo_init) (); + (*(*pgops)->pgo_init)(); } void -vm_pager_bufferinit() +vm_pager_bufferinit(void) { struct buf *bp; int i; @@ -231,7 +223,7 @@ vm_pager_allocate(objtype_t type, void * ops = pagertab[type]; if (ops) - ret = (*ops->pgo_alloc) (handle, size, prot, off, cred); + ret = (*ops->pgo_alloc)(handle, size, prot, off, cred); else ret = NULL; return (ret); @@ -241,8 +233,7 @@ vm_pager_allocate(objtype_t type, void * * The object must be locked. */ void -vm_pager_deallocate(object) - vm_object_t object; +vm_pager_deallocate(vm_object_t object) { VM_OBJECT_ASSERT_WLOCKED(object); @@ -291,12 +282,13 @@ vm_pager_object_lookup(struct pagerlst * static void initpbuf(struct buf *bp) { + KASSERT(bp->b_bufobj == NULL, ("initpbuf with bufobj")); KASSERT(bp->b_vp == NULL, ("initpbuf with vp")); bp->b_rcred = NOCRED; bp->b_wcred = NOCRED; bp->b_qindex = 0; /* On no queue (QUEUE_NONE) */ - bp->b_saveaddr = (caddr_t) (MAXPHYS * (bp - swbuf)) + swapbkva; + bp->b_saveaddr = (caddr_t)(MAXPHYS * (bp - swbuf)) + swapbkva; bp->b_data = bp->b_saveaddr; bp->b_kvabase = bp->b_saveaddr; bp->b_kvasize = MAXPHYS; @@ -329,9 +321,8 @@ getpbuf(int *pfreecnt) struct buf *bp; mtx_lock(&pbuf_mtx); - for (;;) { - if (pfreecnt) { + if (pfreecnt != NULL) { while (*pfreecnt == 0) { msleep(pfreecnt, &pbuf_mtx, PVM, "wswbuf0", 0); } @@ -349,9 +340,8 @@ getpbuf(int *pfreecnt) if (pfreecnt) --*pfreecnt; mtx_unlock(&pbuf_mtx); - initpbuf(bp); - return bp; + return (bp); } /* @@ -371,14 +361,10 @@ trypbuf(int *pfreecnt) return NULL; } TAILQ_REMOVE(&bswlist, bp, b_freelist); - --*pfreecnt; - mtx_unlock(&pbuf_mtx); - initpbuf(bp); - - return bp; + return (bp); } /* ___ 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: r311644 - stable/10/sys/sys
Author: kib Date: Sat Jan 7 11:58:14 2017 New Revision: 311644 URL: https://svnweb.freebsd.org/changeset/base/311644 Log: MFC r310925: Remove unused declaration. Modified: stable/10/sys/sys/conf.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/sys/conf.h == --- stable/10/sys/sys/conf.hSat Jan 7 11:48:44 2017(r311643) +++ stable/10/sys/sys/conf.hSat Jan 7 11:58:14 2017(r311644) @@ -305,7 +305,6 @@ int make_dev_physpath_alias(int _flags, const char *_physpath); void dev_lock(void); void dev_unlock(void); -void setconf(void); #ifdef KLD_MODULE #defineMAKEDEV_ETERNAL_KLD 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: r311643 - stable/11/sys/vm
Author: kib Date: Sat Jan 7 11:48:44 2017 New Revision: 311643 URL: https://svnweb.freebsd.org/changeset/base/311643 Log: MFC r310496: Fix argument type and microoptimize swp_pager_meta_free(). Modified: stable/11/sys/vm/swap_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/swap_pager.c == --- stable/11/sys/vm/swap_pager.c Sat Jan 7 11:44:41 2017 (r311642) +++ stable/11/sys/vm/swap_pager.c Sat Jan 7 11:48:44 2017 (r311643) @@ -410,7 +410,7 @@ static daddr_t swp_pager_getswapspace(in */ static struct swblock **swp_pager_hash(vm_object_t object, vm_pindex_t index); static void swp_pager_meta_build(vm_object_t, vm_pindex_t, daddr_t); -static void swp_pager_meta_free(vm_object_t, vm_pindex_t, daddr_t); +static void swp_pager_meta_free(vm_object_t, vm_pindex_t, vm_pindex_t); static void swp_pager_meta_free_all(vm_object_t); static daddr_t swp_pager_meta_ctl(vm_object_t, vm_pindex_t, int); @@ -1866,42 +1866,42 @@ done: * with resident pages. */ static void -swp_pager_meta_free(vm_object_t object, vm_pindex_t index, daddr_t count) +swp_pager_meta_free(vm_object_t object, vm_pindex_t index, vm_pindex_t count) { + struct swblock **pswap, *swap; + vm_pindex_t c; + daddr_t v; + int n, sidx; VM_OBJECT_ASSERT_LOCKED(object); - if (object->type != OBJT_SWAP) + if (object->type != OBJT_SWAP || count == 0) return; - while (count > 0) { - struct swblock **pswap; - struct swblock *swap; - - mtx_lock(&swhash_mtx); + mtx_lock(&swhash_mtx); + for (c = 0; c < count;) { pswap = swp_pager_hash(object, index); - - if ((swap = *pswap) != NULL) { - daddr_t v = swap->swb_pages[index & SWAP_META_MASK]; - - if (v != SWAPBLK_NONE) { - swp_pager_freeswapspace(v, 1); - swap->swb_pages[index & SWAP_META_MASK] = - SWAPBLK_NONE; - if (--swap->swb_count == 0) { - *pswap = swap->swb_hnext; - uma_zfree(swap_zone, swap); - --object->un_pager.swp.swp_bcount; - } + sidx = index & SWAP_META_MASK; + n = SWAP_META_PAGES - sidx; + index += n; + if ((swap = *pswap) == NULL) { + c += n; + continue; + } + for (; c < count && sidx < SWAP_META_PAGES; ++c, ++sidx) { + if ((v = swap->swb_pages[sidx]) == SWAPBLK_NONE) + continue; + swp_pager_freeswapspace(v, 1); + swap->swb_pages[sidx] = SWAPBLK_NONE; + if (--swap->swb_count == 0) { + *pswap = swap->swb_hnext; + uma_zfree(swap_zone, swap); + --object->un_pager.swp.swp_bcount; + c += SWAP_META_PAGES - sidx; + break; } - --count; - ++index; - } else { - int n = SWAP_META_PAGES - (index & SWAP_META_MASK); - count -= n; - index += n; } - mtx_unlock(&swhash_mtx); } + mtx_unlock(&swhash_mtx); } /* ___ 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: r311642 - stable/11/sys/vm
Author: kib Date: Sat Jan 7 11:44:41 2017 New Revision: 311642 URL: https://svnweb.freebsd.org/changeset/base/311642 Log: MFC r310982: Ansify vm/vm_pager.c. Style. Modified: stable/11/sys/vm/vm_pager.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/vm/vm_pager.c == --- stable/11/sys/vm/vm_pager.c Sat Jan 7 11:32:54 2017(r311641) +++ stable/11/sys/vm/vm_pager.c Sat Jan 7 11:44:41 2017(r311642) @@ -107,43 +107,35 @@ static vm_object_t dead_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t off, struct ucred *cred) { - return NULL; + + return (NULL); } static void -dead_pager_putpages(object, m, count, flags, rtvals) - vm_object_t object; - vm_page_t *m; - int count; - int flags; - int *rtvals; +dead_pager_putpages(vm_object_t object, vm_page_t *m, int count, +int flags, int *rtvals) { int i; - for (i = 0; i < count; i++) { + for (i = 0; i < count; i++) rtvals[i] = VM_PAGER_AGAIN; - } } static int -dead_pager_haspage(object, pindex, prev, next) - vm_object_t object; - vm_pindex_t pindex; - int *prev; - int *next; +dead_pager_haspage(vm_object_t object, vm_pindex_t pindex, int *prev, int *next) { - if (prev) + + if (prev != NULL) *prev = 0; - if (next) + if (next != NULL) *next = 0; - return FALSE; + return (FALSE); } static void -dead_pager_dealloc(object) - vm_object_t object; +dead_pager_dealloc(vm_object_t object) { - return; + } static struct pagerops deadpagerops = { @@ -179,7 +171,7 @@ static int bswneeded; vm_offset_t swapbkva; /* swap buffers kva */ void -vm_pager_init() +vm_pager_init(void) { struct pagerops **pgops; @@ -189,11 +181,11 @@ vm_pager_init() */ for (pgops = pagertab; pgops < &pagertab[nitems(pagertab)]; pgops++) if ((*pgops)->pgo_init != NULL) - (*(*pgops)->pgo_init) (); + (*(*pgops)->pgo_init)(); } void -vm_pager_bufferinit() +vm_pager_bufferinit(void) { struct buf *bp; int i; @@ -230,7 +222,7 @@ vm_pager_allocate(objtype_t type, void * ops = pagertab[type]; if (ops) - ret = (*ops->pgo_alloc) (handle, size, prot, off, cred); + ret = (*ops->pgo_alloc)(handle, size, prot, off, cred); else ret = NULL; return (ret); @@ -240,8 +232,7 @@ vm_pager_allocate(objtype_t type, void * * The object must be locked. */ void -vm_pager_deallocate(object) - vm_object_t object; +vm_pager_deallocate(vm_object_t object) { VM_OBJECT_ASSERT_WLOCKED(object); @@ -362,12 +353,13 @@ vm_pager_object_lookup(struct pagerlst * static void initpbuf(struct buf *bp) { + KASSERT(bp->b_bufobj == NULL, ("initpbuf with bufobj")); KASSERT(bp->b_vp == NULL, ("initpbuf with vp")); bp->b_rcred = NOCRED; bp->b_wcred = NOCRED; bp->b_qindex = 0; /* On no queue (QUEUE_NONE) */ - bp->b_kvabase = (caddr_t) (MAXPHYS * (bp - swbuf)) + swapbkva; + bp->b_kvabase = (caddr_t)(MAXPHYS * (bp - swbuf)) + swapbkva; bp->b_data = bp->b_kvabase; bp->b_kvasize = MAXPHYS; bp->b_flags = 0; @@ -399,9 +391,8 @@ getpbuf(int *pfreecnt) struct buf *bp; mtx_lock(&pbuf_mtx); - for (;;) { - if (pfreecnt) { + if (pfreecnt != NULL) { while (*pfreecnt == 0) { msleep(pfreecnt, &pbuf_mtx, PVM, "wswbuf0", 0); } @@ -419,9 +410,8 @@ getpbuf(int *pfreecnt) if (pfreecnt) --*pfreecnt; mtx_unlock(&pbuf_mtx); - initpbuf(bp); - return bp; + return (bp); } /* @@ -441,14 +431,10 @@ trypbuf(int *pfreecnt) return NULL; } TAILQ_REMOVE(&bswlist, bp, b_freelist); - --*pfreecnt; - mtx_unlock(&pbuf_mtx); - initpbuf(bp); - - return bp; + return (bp); } /* ___ 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: r311641 - stable/11/sys/sys
Author: kib Date: Sat Jan 7 11:32:54 2017 New Revision: 311641 URL: https://svnweb.freebsd.org/changeset/base/311641 Log: MFC r310925: Remove unused declaration. Modified: stable/11/sys/sys/conf.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/conf.h == --- stable/11/sys/sys/conf.hSat Jan 7 10:55:38 2017(r311640) +++ stable/11/sys/sys/conf.hSat Jan 7 11:32:54 2017(r311641) @@ -285,7 +285,6 @@ int make_dev_physpath_alias(int _flags, const char *_physpath); void dev_lock(void); void dev_unlock(void); -void setconf(void); #ifdef KLD_MODULE #defineMAKEDEV_ETERNAL_KLD 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: r311640 - in head/sys/dev/sfxge: . common
Author: arybchik Date: Sat Jan 7 10:55:38 2017 New Revision: 311640 URL: https://svnweb.freebsd.org/changeset/base/311640 Log: sfxge(4): allow DMA descs to cross 4k boundary on EF10 Siena has limitation on maximum byte count and 4k boundary crosssing (which is stricter than maximum byte count). EF10 has limitation on maximum byte count only. Reviewed by:philip Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D9061 Modified: head/sys/dev/sfxge/common/ef10_tx.c head/sys/dev/sfxge/common/efx.h head/sys/dev/sfxge/common/efx_tx.c head/sys/dev/sfxge/common/hunt_nic.c head/sys/dev/sfxge/common/medford_nic.c head/sys/dev/sfxge/common/siena_nic.c head/sys/dev/sfxge/sfxge_tx.c Modified: head/sys/dev/sfxge/common/ef10_tx.c == --- head/sys/dev/sfxge/common/ef10_tx.c Sat Jan 7 10:52:02 2017 (r311639) +++ head/sys/dev/sfxge/common/ef10_tx.c Sat Jan 7 10:55:38 2017 (r311640) @@ -438,8 +438,9 @@ ef10_tx_qpost( size_t offset; efx_qword_t qword; - /* Fragments must not span 4k boundaries. */ - EFSYS_ASSERT(P2ROUNDUP(addr + 1, 4096) >= (addr + size)); + /* No limitations on boundary crossing */ + EFSYS_ASSERT(size <= + etp->et_enp->en_nic_cfg.enc_tx_dma_desc_size_max); id = added++ & etp->et_mask; offset = id * sizeof (efx_qword_t); @@ -584,8 +585,8 @@ ef10_tx_qdesc_dma_create( __inboolean_t eop, __out efx_desc_t *edp) { - /* Fragments must not span 4k boundaries. */ - EFSYS_ASSERT(P2ROUNDUP(addr + 1, 4096) >= addr + size); + /* No limitations on boundary crossing */ + EFSYS_ASSERT(size <= etp->et_enp->en_nic_cfg.enc_tx_dma_desc_size_max); EFSYS_PROBE4(tx_desc_dma_create, unsigned int, etp->et_index, efsys_dma_addr_t, addr, Modified: head/sys/dev/sfxge/common/efx.h == --- head/sys/dev/sfxge/common/efx.h Sat Jan 7 10:52:02 2017 (r311639) +++ head/sys/dev/sfxge/common/efx.h Sat Jan 7 10:55:38 2017 (r311640) @@ -1154,6 +1154,13 @@ typedef struct efx_nic_cfg_s { uint32_tenc_rx_batch_max; /* Number of rx descriptors the hardware requires for a push. */ uint32_tenc_rx_push_align; + /* Maximum amount of data in DMA descriptor */ + uint32_tenc_tx_dma_desc_size_max; + /* +* Boundary which DMA descriptor data must not cross or 0 if no +* limitation. +*/ + uint32_tenc_tx_dma_desc_boundary; /* * Maximum number of bytes into the packet the TCP header can start for * the hardware to apply TSO packet edits. Modified: head/sys/dev/sfxge/common/efx_tx.c == --- head/sys/dev/sfxge/common/efx_tx.c Sat Jan 7 10:52:02 2017 (r311639) +++ head/sys/dev/sfxge/common/efx_tx.c Sat Jan 7 10:55:38 2017 (r311640) @@ -748,8 +748,12 @@ siena_tx_qpost( size_t size = ebp->eb_size; efsys_dma_addr_t end = start + size; - /* Fragments must not span 4k boundaries. */ - EFSYS_ASSERT(P2ROUNDUP(start + 1, 4096) >= end); + /* +* Fragments must not span 4k boundaries. +* Here it is a stricter requirement than the maximum length. +*/ + EFSYS_ASSERT(P2ROUNDUP(start + 1, + etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= end); EFX_TX_DESC(etp, start, size, ebp->eb_eop, added); } @@ -1009,8 +1013,12 @@ siena_tx_qdesc_dma_create( __inboolean_t eop, __out efx_desc_t *edp) { - /* Fragments must not span 4k boundaries. */ - EFSYS_ASSERT(P2ROUNDUP(addr + 1, 4096) >= addr + size); + /* +* Fragments must not span 4k boundaries. +* Here it is a stricter requirement than the maximum length. +*/ + EFSYS_ASSERT(P2ROUNDUP(addr + 1, + etp->et_enp->en_nic_cfg.enc_tx_dma_desc_boundary) >= addr + size); EFSYS_PROBE4(tx_desc_dma_create, unsigned int, etp->et_index, efsys_dma_addr_t, addr, Modified: head/sys/dev/sfxge/common/hunt_nic.c == --- head/sys/dev/sfxge/common/hunt_nic.cSat Jan 7 10:52:02 2017 (r311639) +++ head/sys/dev/sfxge/common/hunt_nic.cSat Jan 7 10:55:38 2017 (r311640) @@ -304,6 +304,10 @@ hunt_board_cfg( /* Alignment for WPTR updates */ encp->enc_rx_push_align = EF10_RX_WPTR_ALIGN
svn commit: r311639 - head/sys/dev/sfxge
Author: arybchik Date: Sat Jan 7 10:52:02 2017 New Revision: 311639 URL: https://svnweb.freebsd.org/changeset/base/311639 Log: sfxge(4): treat EFX_LINK_UNKOWN as link down It is safer to consider EFX_LINK_UNKNOWN as link down. link_mode is set to EFX_LINK_UNKNOWN on port stop and fini. Reviewed by:philip Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D9060 Modified: head/sys/dev/sfxge/sfxge.h Modified: head/sys/dev/sfxge/sfxge.h == --- head/sys/dev/sfxge/sfxge.h Sat Jan 7 10:51:12 2017(r311638) +++ head/sys/dev/sfxge/sfxge.h Sat Jan 7 10:52:02 2017(r311639) @@ -326,7 +326,9 @@ struct sfxge_softc { #endif }; -#defineSFXGE_LINK_UP(sc) ((sc)->port.link_mode != EFX_LINK_DOWN) +#defineSFXGE_LINK_UP(sc) \ + ((sc)->port.link_mode != EFX_LINK_DOWN && \ +(sc)->port.link_mode != EFX_LINK_UNKNOWN) #defineSFXGE_RUNNING(sc) ((sc)->ifnet->if_drv_flags & IFF_DRV_RUNNING) #defineSFXGE_PARAM(_name) "hw.sfxge." #_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: r311638 - head/sys/dev/sfxge
Author: arybchik Date: Sat Jan 7 10:51:12 2017 New Revision: 311638 URL: https://svnweb.freebsd.org/changeset/base/311638 Log: sfxge(4): use SFXGE_LINK_UP() to report link up state Reviewed by:philip Sponsored by: Solarflare Communications, Inc. MFC after: 2 days Differential Revision: https://reviews.freebsd.org/D9059 Modified: head/sys/dev/sfxge/sfxge_port.c Modified: head/sys/dev/sfxge/sfxge_port.c == --- head/sys/dev/sfxge/sfxge_port.c Sat Jan 7 09:56:50 2017 (r311637) +++ head/sys/dev/sfxge/sfxge_port.c Sat Jan 7 10:51:12 2017 (r311638) @@ -311,8 +311,7 @@ sfxge_mac_link_update(struct sfxge_softc port->link_mode = mode; /* Push link state update to the OS */ - link_state = (port->link_mode != EFX_LINK_DOWN ? - LINK_STATE_UP : LINK_STATE_DOWN); + link_state = (SFXGE_LINK_UP(sc) ? LINK_STATE_UP : LINK_STATE_DOWN); sc->ifnet->if_baudrate = sfxge_link_baudrate[port->link_mode]; if_link_state_change(sc->ifnet, link_state); } ___ 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: r311636 - in head: sbin/camcontrol share/misc sys/cam/scsi
Author: mav Date: Sat Jan 7 09:56:12 2017 New Revision: 311636 URL: https://svnweb.freebsd.org/changeset/base/311636 Log: Make 'camcontrol modepage' support subpages. MFC after:2 weeks Modified: head/sbin/camcontrol/camcontrol.8 head/sbin/camcontrol/camcontrol.c head/sbin/camcontrol/camcontrol.h head/sbin/camcontrol/modeedit.c head/share/misc/scsi_modes head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h head/sys/cam/scsi/scsi_ch.c Modified: head/sbin/camcontrol/camcontrol.8 == --- head/sbin/camcontrol/camcontrol.8 Sat Jan 7 09:45:00 2017 (r311635) +++ head/sbin/camcontrol/camcontrol.8 Sat Jan 7 09:56:12 2017 (r311636) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 30, 2016 +.Dd January 6, 2017 .Dt CAMCONTROL 8 .Os .Sh NAME @@ -121,7 +121,7 @@ .Ic modepage .Op device id .Op generic args -.Aq Fl m Ar page | Fl l +.Aq Fl m Ar page[,subpage] | Fl l .Op Fl P Ar pgctl .Op Fl b | Fl e .Op Fl d @@ -702,9 +702,10 @@ The editor will be invoked if detects that standard input is terminal. .It Fl l Lists all available mode pages. -.It Fl m Ar mode_page -This specifies the number of the mode page the user would like to view -and/or edit. +If specified more then once, also lists subpages. +.It Fl m Ar page[,subpage] +This specifies the number of the mode page and optionally subpage the user +would like to view and/or edit. This argument is mandatory unless .Fl l is specified. Modified: head/sbin/camcontrol/camcontrol.c == --- head/sbin/camcontrol/camcontrol.c Sat Jan 7 09:45:00 2017 (r311635) +++ head/sbin/camcontrol/camcontrol.c Sat Jan 7 09:56:12 2017 (r311636) @@ -125,12 +125,9 @@ typedef enum { CAM_ARG_GET_STDINQ = 0x2000, CAM_ARG_GET_XFERRATE= 0x4000, CAM_ARG_INQ_MASK= 0x7000, - CAM_ARG_MODE_EDIT = 0x8000, - CAM_ARG_PAGE_CNTL = 0x0001, CAM_ARG_TIMEOUT = 0x0002, CAM_ARG_CMD_IN = 0x0004, CAM_ARG_CMD_OUT = 0x0008, - CAM_ARG_DBD = 0x0010, CAM_ARG_ERR_RECOVER = 0x0020, CAM_ARG_RETRIES = 0x0040, CAM_ARG_START_UNIT = 0x0080, @@ -3987,8 +3984,8 @@ reassignblocks(struct cam_device *device #ifndef MINIMALISTIC void -mode_sense(struct cam_device *device, int mode_page, int page_control, - int dbd, int retry_count, int timeout, u_int8_t *data, int datalen) +mode_sense(struct cam_device *device, int dbd, int pc, int page, int subpage, + int retry_count, int timeout, u_int8_t *data, int datalen) { union ccb *ccb; int retval; @@ -4000,15 +3997,17 @@ mode_sense(struct cam_device *device, in CCB_CLEAR_ALL_EXCEPT_HDR(&ccb->csio); - scsi_mode_sense(&ccb->csio, + scsi_mode_sense_subpage(&ccb->csio, /* retries */ retry_count, /* cbfcnp */ NULL, /* tag_action */ MSG_SIMPLE_Q_TAG, /* dbd */ dbd, - /* page_code */ page_control << 6, - /* page */ mode_page, + /* pc */ pc << 6, + /* page */ page, + /* subpage */ subpage, /* param_buf */ data, /* param_len */ datalen, + /* minimum_cmd_size */ 0, /* sense_len */ SSD_FULL_SIZE, /* timeout */ timeout ? timeout : 5000); @@ -4089,8 +4088,9 @@ void modepage(struct cam_device *device, int argc, char **argv, char *combinedopt, int retry_count, int timeout) { - int c, mode_page = -1, page_control = 0; - int binary = 0, list = 0; + char *str_subpage; + int c, page = -1, subpage = -1, pc = 0; + int binary = 0, dbd = 0, edit = 0, list = 0; while ((c = getopt(argc, argv, combinedopt)) != -1) { switch(c) { @@ -4098,40 +4098,44 @@ modepage(struct cam_device *device, int binary = 1; break; case 'd': - arglist |= CAM_ARG_DBD; + dbd = 1; break; case 'e': - arglist |= CAM_ARG_MODE_EDIT; + edit = 1; break; case 'l': - list = 1; + list++; break; case 'm': - mode_page = strtol(optarg, NULL, 0); - if (mode_page < 0) - errx(1, "invalid mode page %d", mode_page); + str_subpage = optarg; +
svn commit: r311634 - stable/11/contrib/netbsd-tests/lib/libc/ttyio
Author: ngie Date: Sat Jan 7 09:44:57 2017 New Revision: 311634 URL: https://svnweb.freebsd.org/changeset/base/311634 Log: MFC r311245: tty: don't leak s after opening it with openpty CID: 978321 Modified: stable/11/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c == --- stable/11/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c Sat Jan 7 09:44:05 2017(r311633) +++ stable/11/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c Sat Jan 7 09:44:57 2017(r311634) @@ -152,6 +152,9 @@ ATF_TC_BODY(ioctl, tc) REQUIRE_ERRNO(sigaction(SIGCHLD, &sa, NULL), -1); (void) wait(NULL); +#ifdef __FreeBSD__ + (void)close(s); +#endif ATF_REQUIRE_EQ(rc, 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: r311635 - stable/10/contrib/netbsd-tests/lib/libc/ttyio
Author: ngie Date: Sat Jan 7 09:45:00 2017 New Revision: 311635 URL: https://svnweb.freebsd.org/changeset/base/311635 Log: MFC r311245: tty: don't leak s after opening it with openpty CID: 978321 Modified: stable/10/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c == --- stable/10/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c Sat Jan 7 09:44:57 2017(r311634) +++ stable/10/contrib/netbsd-tests/lib/libc/ttyio/t_ttyio.c Sat Jan 7 09:45:00 2017(r311635) @@ -152,6 +152,9 @@ ATF_TC_BODY(ioctl, tc) REQUIRE_ERRNO(sigaction(SIGCHLD, &sa, NULL), -1); (void) wait(NULL); +#ifdef __FreeBSD__ + (void)close(s); +#endif ATF_REQUIRE_EQ(rc, 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: r311632 - stable/10/contrib/netbsd-tests/lib/libc/c063
Author: ngie Date: Sat Jan 7 09:44:02 2017 New Revision: 311632 URL: https://svnweb.freebsd.org/changeset/base/311632 Log: MFC r311247: mkfifoat_fd: close dfd after use to avoid leaking it CID: 978286 Modified: stable/10/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c == --- stable/10/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c Sat Jan 7 09:42:51 2017(r311631) +++ stable/10/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c Sat Jan 7 09:44:02 2017(r311632) @@ -63,6 +63,9 @@ ATF_TC_BODY(mkfifoat_fd, tc) ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1); ATF_REQUIRE(close(fd) == 0); ATF_REQUIRE(access(FIFO, F_OK) == 0); +#ifdef __FreeBSD__ + (void)close(dfd); +#endif } ATF_TC(mkfifoat_fdcwd); ___ 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: r311633 - stable/11/contrib/netbsd-tests/lib/libc/c063
Author: ngie Date: Sat Jan 7 09:44:05 2017 New Revision: 311633 URL: https://svnweb.freebsd.org/changeset/base/311633 Log: MFC r311247: mkfifoat_fd: close dfd after use to avoid leaking it CID: 978286 Modified: stable/11/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c == --- stable/11/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c Sat Jan 7 09:44:02 2017(r311632) +++ stable/11/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c Sat Jan 7 09:44:05 2017(r311633) @@ -63,6 +63,9 @@ ATF_TC_BODY(mkfifoat_fd, tc) ATF_REQUIRE((fd = mkfifoat(dfd, BASEFIFO, mode)) != -1); ATF_REQUIRE(close(fd) == 0); ATF_REQUIRE(access(FIFO, F_OK) == 0); +#ifdef __FreeBSD__ + (void)close(dfd); +#endif } ATF_TC(mkfifoat_fdcwd); ___ 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: r311630 - stable/11/contrib/netbsd-tests/lib/libc/c063
Author: ngie Date: Sat Jan 7 09:42:42 2017 New Revision: 311630 URL: https://svnweb.freebsd.org/changeset/base/311630 Log: MFC r311248: mknodat_fd: close dfd after use to avoid leaking it CID: 978287 Modified: stable/11/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c == --- stable/11/contrib/netbsd-tests/lib/libc/c063/t_mknodat.cSat Jan 7 09:41:21 2017(r311629) +++ stable/11/contrib/netbsd-tests/lib/libc/c063/t_mknodat.cSat Jan 7 09:42:42 2017(r311630) @@ -80,6 +80,9 @@ ATF_TC_BODY(mknodat_fd, tc) ATF_REQUIRE((fd = mknodat(dfd, BASEFILE, mode, dev)) != -1); ATF_REQUIRE(close(fd) == 0); ATF_REQUIRE(access(FILE, F_OK) == 0); +#ifdef __FreeBSD__ + (void)close(dfd); +#endif } ATF_TC(mknodat_fdcwd); ___ 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: r311631 - stable/10/contrib/netbsd-tests/lib/libc/c063
Author: ngie Date: Sat Jan 7 09:42:51 2017 New Revision: 311631 URL: https://svnweb.freebsd.org/changeset/base/311631 Log: MFC r311248: mknodat_fd: close dfd after use to avoid leaking it CID: 978287 Modified: stable/10/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/c063/t_mknodat.c == --- stable/10/contrib/netbsd-tests/lib/libc/c063/t_mknodat.cSat Jan 7 09:42:42 2017(r311630) +++ stable/10/contrib/netbsd-tests/lib/libc/c063/t_mknodat.cSat Jan 7 09:42:51 2017(r311631) @@ -80,6 +80,9 @@ ATF_TC_BODY(mknodat_fd, tc) ATF_REQUIRE((fd = mknodat(dfd, BASEFILE, mode, dev)) != -1); ATF_REQUIRE(close(fd) == 0); ATF_REQUIRE(access(FILE, F_OK) == 0); +#ifdef __FreeBSD__ + (void)close(dfd); +#endif } ATF_TC(mknodat_fdcwd); ___ 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: r311629 - stable/11/contrib/netbsd-tests/lib/libc/gen
Author: ngie Date: Sat Jan 7 09:41:21 2017 New Revision: 311629 URL: https://svnweb.freebsd.org/changeset/base/311629 Log: MFC r311235: ttyname_err: close fd if it was opened successfully CID: 978292 Modified: stable/11/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c == --- stable/11/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Sat Jan 7 09:41:18 2017(r311628) +++ stable/11/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Sat Jan 7 09:41:21 2017(r311629) @@ -78,6 +78,9 @@ ATF_TC_BODY(ttyname_err, tc) ATF_REQUIRE(ttyname(fd) == NULL); ATF_REQUIRE(errno == ENOTTY); +#ifdef __FreeBSD__ + (void)close(fd); +#endif } } ___ 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: r311628 - stable/10/contrib/netbsd-tests/lib/libc/gen
Author: ngie Date: Sat Jan 7 09:41:18 2017 New Revision: 311628 URL: https://svnweb.freebsd.org/changeset/base/311628 Log: MFC r311235: ttyname_err: close fd if it was opened successfully CID: 978292 Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c == --- stable/10/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Sat Jan 7 09:39:15 2017(r311627) +++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_ttyname.c Sat Jan 7 09:41:18 2017(r311628) @@ -78,6 +78,9 @@ ATF_TC_BODY(ttyname_err, tc) ATF_REQUIRE(ttyname(fd) == NULL); ATF_REQUIRE(errno == ENOTTY); +#ifdef __FreeBSD__ + (void)close(fd); +#endif } } ___ 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: r311626 - stable/11/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:39:12 2017 New Revision: 311626 URL: https://svnweb.freebsd.org/changeset/base/311626 Log: MFC r311240: kqueue_desc_passing: initialize m.msg_flags to 0 This mutes an uninitialized scalar warning from Coverity CID: 979620 Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_kevent.c == --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Sat Jan 7 09:37:32 2017(r311625) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Sat Jan 7 09:39:12 2017(r311626) @@ -101,6 +101,9 @@ ATF_TC_BODY(kqueue_desc_passing, tc) m.msg_namelen = 0; m.msg_control = msg; m.msg_controllen = CMSG_SPACE(sizeof(int)); +#ifdef __FreeBSD__ + m.msg_flags = 0; +#endif child = fork(); if (child == 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: r311627 - stable/10/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:39:15 2017 New Revision: 311627 URL: https://svnweb.freebsd.org/changeset/base/311627 Log: MFC r311240: kqueue_desc_passing: initialize m.msg_flags to 0 This mutes an uninitialized scalar warning from Coverity CID: 979620 Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_kevent.c == --- stable/10/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Sat Jan 7 09:39:12 2017(r311626) +++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_kevent.c Sat Jan 7 09:39:15 2017(r311627) @@ -101,6 +101,9 @@ ATF_TC_BODY(kqueue_desc_passing, tc) m.msg_namelen = 0; m.msg_control = msg; m.msg_controllen = CMSG_SPACE(sizeof(int)); +#ifdef __FreeBSD__ + m.msg_flags = 0; +#endif child = fork(); if (child == 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: r311625 - stable/10/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:37:32 2017 New Revision: 311625 URL: https://svnweb.freebsd.org/changeset/base/311625 Log: MFC r311273: setrlimit_basic: don't leak buf; free it on completion CID: 978311 Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c == --- stable/10/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Sat Jan 7 09:36:27 2017(r311624) +++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Sat Jan 7 09:37:32 2017(r311625) @@ -124,6 +124,9 @@ out: if (lim != 0) atf_tc_fail("failed to set limit (%d)", lim); +#ifdef __FreeBSD__ + free(buf); +#endif } ATF_TC(setrlimit_current); ___ 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: r311624 - stable/11/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:36:27 2017 New Revision: 311624 URL: https://svnweb.freebsd.org/changeset/base/311624 Log: MFC r311273: setrlimit_basic: don't leak buf; free it on completion CID: 978311 Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c == --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Sat Jan 7 09:33:11 2017(r311623) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c Sat Jan 7 09:36:27 2017(r311624) @@ -124,6 +124,9 @@ out: if (lim != 0) atf_tc_fail("failed to set limit (%d)", lim); +#ifdef __FreeBSD__ + free(buf); +#endif } ATF_TC(setrlimit_current); ___ 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: r311623 - in head: lib/libcam sbin/camcontrol
Author: mav Date: Sat Jan 7 09:33:11 2017 New Revision: 311623 URL: https://svnweb.freebsd.org/changeset/base/311623 Log: Make do_buff_decode() not read past the end of the buffer. Abort format processing as soon as we have no enough data. MFC after:2 weeks Modified: head/lib/libcam/scsi_cmdparse.c head/sbin/camcontrol/modeedit.c Modified: head/lib/libcam/scsi_cmdparse.c == --- head/lib/libcam/scsi_cmdparse.c Sat Jan 7 09:30:53 2017 (r311622) +++ head/lib/libcam/scsi_cmdparse.c Sat Jan 7 09:33:11 2017 (r311623) @@ -100,10 +100,11 @@ __FBSDID("$FreeBSD$"); */ static int -do_buff_decode(u_int8_t *databuf, size_t len, +do_buff_decode(u_int8_t *buff, size_t len, void (*arg_put)(void *, int , void *, int, char *), void *puthook, const char *fmt, va_list *ap) { + int ind = 0; int assigned = 0; int width; int suppress; @@ -112,21 +113,17 @@ do_buff_decode(u_int8_t *databuf, size_t static u_char mask[] = {0, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff}; int value; - u_char *base = databuf; char *intendp; char letter; char field_name[80]; -# define ARG_PUT(ARG) \ - do \ - { \ - if (!suppress) \ - { \ +#define ARG_PUT(ARG) \ + do { \ + if (!suppress) { \ if (arg_put) \ - (*arg_put)(puthook, (letter == 't' ? \ - 'b' : letter), \ - (void *)((long)(ARG)), width, \ - field_name); \ + (*arg_put)(puthook, (letter == 't' ? 'b' : \ + letter), (void *)((long)(ARG)), width, \ + field_name); \ else \ *(va_arg(*ap, int *)) = (ARG); \ assigned++; \ @@ -187,7 +184,11 @@ do_buff_decode(u_int8_t *databuf, size_t done = 1; else { if (shift <= 0) { - bits = *databuf++; + if (ind >= len) { + done = 1; + break; + } + bits = buff[ind++]; shift = 8; } value = (bits >> (shift - width)) & @@ -209,29 +210,31 @@ do_buff_decode(u_int8_t *databuf, size_t fmt++; width = strtol(fmt, &intendp, 10); fmt = intendp; + if (ind + width > len) { + done = 1; + break; + } switch(width) { case 1: - ARG_PUT(*databuf); - databuf++; + ARG_PUT(buff[ind]); + ind++; break; case 2: - ARG_PUT((*databuf) << 8 | *(databuf + 1)); - databuf += 2; + ARG_PUT(buff[ind] << 8 | buff[ind + 1]); + ind += 2; break; case 3: - ARG_PUT((*databuf) << 16 | - (*(databuf + 1)) << 8 | *(databuf + 2)); - databuf += 3; + ARG_PUT(buff[ind] << 16 | + buff[ind + 1] << 8 | buff[ind + 2]); + ind += 3; break; case 4: - ARG_PUT((*databuf) << 24 | - (*(databuf + 1)) << 16 | - (*(databuf + 2)) << 8 | - *(databuf + 3)); - databuf += 4; + ARG_PUT(buff[ind] << 24 | buff[ind + 1] << 16 | + buff[ind + 2] << 8 | buff[ind + 3]); + ind += 4; break; default: @@ -242,32 +245,35 @@ do_buff_decode(u_int8_t *databuf, size_t break; case 'c': /* Characters (i.e., not swapped) */ - case 'z': /* Cha
svn commit: r311622 - stable/11/contrib/netbsd-tests/fs/tmpfs
Author: ngie Date: Sat Jan 7 09:30:53 2017 New Revision: 311622 URL: https://svnweb.freebsd.org/changeset/base/311622 Log: MFC r311233,r311377: r311233: Fix Coverity issues - Initialize .sun_len before passing it to strlcpy and bind. - Close fd on error CID: 978283, 979581 r311377: Redo fix for CID 979581 The previous change was flawed in terms of how it calculated the buffer length for the sockaddr_un object. Use SUN_LEN where appropriate and mute the Coverity complaint by using memset(.., 0, ..) to zero out the entire structure instead of setting .sun_len to a bogus value and strlcpy'ing in the contents of argv[1]. SUN_LEN is now being passed to bind(2) as well. For some odd reason this wasn't flagged as a bug with Coverity. Modified: stable/11/contrib/netbsd-tests/fs/tmpfs/h_tools.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/fs/tmpfs/h_tools.c == --- stable/11/contrib/netbsd-tests/fs/tmpfs/h_tools.c Sat Jan 7 09:27:46 2017(r311621) +++ stable/11/contrib/netbsd-tests/fs/tmpfs/h_tools.c Sat Jan 7 09:30:53 2017(r311622) @@ -243,12 +243,21 @@ sockets_main(int argc, char **argv) return EXIT_FAILURE; } +#ifdef __FreeBSD__ + memset(&addr, 0, sizeof(addr)); +#endif (void)strlcpy(addr.sun_path, argv[1], sizeof(addr.sun_path)); addr.sun_family = PF_UNIX; - +#ifdef __FreeBSD__ + error = bind(fd, (struct sockaddr *)&addr, SUN_LEN(&addr)); +#else error = bind(fd, (struct sockaddr *)&addr, sizeof(addr)); +#endif if (error == -1) { warn("connect"); +#ifdef __FreeBSD__ + (void)close(fd); +#endif return EXIT_FAILURE; } ___ 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: r311621 - stable/11/contrib/netbsd-tests/lib/libc/gen
Author: ngie Date: Sat Jan 7 09:27:46 2017 New Revision: 311621 URL: https://svnweb.freebsd.org/changeset/base/311621 Log: MFC r311228: ftok_link: don't leak fd CID: 978291 Modified: stable/11/contrib/netbsd-tests/lib/libc/gen/t_ftok.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/gen/t_ftok.c == --- stable/11/contrib/netbsd-tests/lib/libc/gen/t_ftok.cSat Jan 7 09:27:42 2017(r311620) +++ stable/11/contrib/netbsd-tests/lib/libc/gen/t_ftok.cSat Jan 7 09:27:46 2017(r311621) @@ -68,6 +68,9 @@ ATF_TC_BODY(ftok_link, tc) fd = open(path, O_RDONLY | O_CREAT); ATF_REQUIRE(fd >= 0); +#ifdef __FreeBSD__ + (void)close(fd); +#endif ATF_REQUIRE(link(path, hlnk) == 0); ATF_REQUIRE(symlink(path, slnk) == 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: r311620 - stable/10/contrib/netbsd-tests/lib/libc/gen
Author: ngie Date: Sat Jan 7 09:27:42 2017 New Revision: 311620 URL: https://svnweb.freebsd.org/changeset/base/311620 Log: MFC r311228: ftok_link: don't leak fd CID: 978291 Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_ftok.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/gen/t_ftok.c == --- stable/10/contrib/netbsd-tests/lib/libc/gen/t_ftok.cSat Jan 7 09:26:34 2017(r311619) +++ stable/10/contrib/netbsd-tests/lib/libc/gen/t_ftok.cSat Jan 7 09:27:42 2017(r311620) @@ -68,6 +68,9 @@ ATF_TC_BODY(ftok_link, tc) fd = open(path, O_RDONLY | O_CREAT); ATF_REQUIRE(fd >= 0); +#ifdef __FreeBSD__ + (void)close(fd); +#endif ATF_REQUIRE(link(path, hlnk) == 0); ATF_REQUIRE(symlink(path, slnk) == 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: r311619 - stable/10/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:26:34 2017 New Revision: 311619 URL: https://svnweb.freebsd.org/changeset/base/311619 Log: MFC r311250: mincore_resid: free buf after use CID: 978304 Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_mincore.c == --- stable/10/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Jan 7 09:25:53 2017(r311618) +++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Jan 7 09:26:34 2017(r311619) @@ -279,6 +279,9 @@ ATF_TC_BODY(mincore_resid, tc) (void)munmap(addr2, npgs * page); (void)munmap(addr3, npgs * page); (void)unlink(path); +#ifdef __FreeBSD__ + free(buf); +#endif } ATF_TC_CLEANUP(mincore_resid, tc) ___ 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: r311618 - stable/11/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:25:53 2017 New Revision: 311618 URL: https://svnweb.freebsd.org/changeset/base/311618 Log: MFC r311250: mincore_resid: free buf after use CID: 978304 Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c == --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Jan 7 09:24:37 2017(r311617) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_mincore.c Sat Jan 7 09:25:53 2017(r311618) @@ -279,6 +279,9 @@ ATF_TC_BODY(mincore_resid, tc) (void)munmap(addr2, npgs * page); (void)munmap(addr3, npgs * page); (void)unlink(path); +#ifdef __FreeBSD__ + free(buf); +#endif } ATF_TC_CLEANUP(mincore_resid, tc) ___ 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: r311617 - stable/11/contrib/netbsd-tests/lib/libc/gen
Author: ngie Date: Sat Jan 7 09:24:37 2017 New Revision: 311617 URL: https://svnweb.freebsd.org/changeset/base/311617 Log: MFC r311229: humanize_number_basic: don't leak buf CID: 1251407 Modified: stable/11/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c == --- stable/11/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c Sat Jan 7 09:21:26 2017(r311616) +++ stable/11/contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c Sat Jan 7 09:24:37 2017(r311617) @@ -247,6 +247,9 @@ ATF_TC_BODY(humanize_number_basic, tc) newline(); atf_tc_fail_nonfatal("Failed for table entry %d", i); } +#ifdef __FreeBSD__ + free(buf); +#endif } ATF_TC(humanize_number_big); ___ 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: r311616 - stable/10/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:21:26 2017 New Revision: 311616 URL: https://svnweb.freebsd.org/changeset/base/311616 Log: MFC r311271: stat_symlink: don't leak fd; close the file descriptor when done CID: 978314 Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_stat.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_stat.c == --- stable/10/contrib/netbsd-tests/lib/libc/sys/t_stat.cSat Jan 7 09:21:21 2017(r311615) +++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_stat.cSat Jan 7 09:21:26 2017(r311616) @@ -398,6 +398,9 @@ ATF_TC_BODY(stat_symlink, tc) ATF_REQUIRE(unlink(path) == 0); ATF_REQUIRE(unlink(pathlink) == 0); +#ifdef __FreeBSD__ + (void)close(fd); +#endif } ATF_TC_CLEANUP(stat_symlink, tc) ___ 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: r311615 - stable/11/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:21:21 2017 New Revision: 311615 URL: https://svnweb.freebsd.org/changeset/base/311615 Log: MFC r311271: stat_symlink: don't leak fd; close the file descriptor when done CID: 978314 Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_stat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_stat.c == --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_stat.cSat Jan 7 09:19:55 2017(r311614) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_stat.cSat Jan 7 09:21:21 2017(r311615) @@ -398,6 +398,9 @@ ATF_TC_BODY(stat_symlink, tc) ATF_REQUIRE(unlink(path) == 0); ATF_REQUIRE(unlink(pathlink) == 0); +#ifdef __FreeBSD__ + (void)close(fd); +#endif } ATF_TC_CLEANUP(stat_symlink, tc) ___ 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: r311614 - stable/11/contrib/netbsd-tests/lib/libpthread
Author: ngie Date: Sat Jan 7 09:19:55 2017 New Revision: 311614 URL: https://svnweb.freebsd.org/changeset/base/311614 Log: MFC r311269: swapcontext1: test for getcontext(3) and swapcontext(3) success properly The beforementioned libcalls both succeed if the return codes aren't -1 CID: 976790, 976791 Modified: stable/11/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c == --- stable/11/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Sat Jan 7 09:19:51 2017(r311613) +++ stable/11/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Sat Jan 7 09:19:55 2017(r311614) @@ -30,6 +30,8 @@ __RCSID("$NetBSD"); #ifdef __FreeBSD__ #include +#include +#include #endif #include #include @@ -80,7 +82,12 @@ threadfunc(void *arg) oself = (void *)pthread_self(); printf("before swapcontext self = %p\n", oself); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(swapcontext(&octx, &nctx) != -1, "swapcontext failed: %s", + strerror(errno)); +#else PTHREAD_REQUIRE(swapcontext(&octx, &nctx)); +#endif /* NOTREACHED */ return NULL; @@ -102,7 +109,12 @@ ATF_TC_BODY(swapcontext1, tc) printf("Testing if swapcontext() alters pthread_self()\n"); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(getcontext(&nctx) != -1, "getcontext failed: %s", + strerror(errno)); +#else PTHREAD_REQUIRE(getcontext(&nctx)); +#endif PTHREAD_REQUIRE(pthread_create(&thread, NULL, threadfunc, NULL)); PTHREAD_REQUIRE(pthread_join(thread, 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: r311613 - stable/10/contrib/netbsd-tests/lib/libpthread
Author: ngie Date: Sat Jan 7 09:19:51 2017 New Revision: 311613 URL: https://svnweb.freebsd.org/changeset/base/311613 Log: MFC r311269: swapcontext1: test for getcontext(3) and swapcontext(3) success properly The beforementioned libcalls both succeed if the return codes aren't -1 CID: 976790, 976791 Modified: stable/10/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c == --- stable/10/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Sat Jan 7 09:18:11 2017(r311612) +++ stable/10/contrib/netbsd-tests/lib/libpthread/t_swapcontext.c Sat Jan 7 09:19:51 2017(r311613) @@ -30,6 +30,8 @@ __RCSID("$NetBSD"); #ifdef __FreeBSD__ #include +#include +#include #endif #include #include @@ -80,7 +82,12 @@ threadfunc(void *arg) oself = (void *)pthread_self(); printf("before swapcontext self = %p\n", oself); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(swapcontext(&octx, &nctx) != -1, "swapcontext failed: %s", + strerror(errno)); +#else PTHREAD_REQUIRE(swapcontext(&octx, &nctx)); +#endif /* NOTREACHED */ return NULL; @@ -102,7 +109,12 @@ ATF_TC_BODY(swapcontext1, tc) printf("Testing if swapcontext() alters pthread_self()\n"); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(getcontext(&nctx) != -1, "getcontext failed: %s", + strerror(errno)); +#else PTHREAD_REQUIRE(getcontext(&nctx)); +#endif PTHREAD_REQUIRE(pthread_create(&thread, NULL, threadfunc, NULL)); PTHREAD_REQUIRE(pthread_join(thread, 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: r311612 - stable/11/contrib/netbsd-tests/lib/libc/string
Author: ngie Date: Sat Jan 7 09:18:11 2017 New Revision: 311612 URL: https://svnweb.freebsd.org/changeset/base/311612 Log: MFC r311249: {strchr,strlen}_basic: don't leak the dlopen'ed handle; close after use CID: 978299, 978300 Modified: stable/11/contrib/netbsd-tests/lib/libc/string/t_strchr.c stable/11/contrib/netbsd-tests/lib/libc/string/t_strlen.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/string/t_strchr.c == --- stable/11/contrib/netbsd-tests/lib/libc/string/t_strchr.c Sat Jan 7 09:17:45 2017(r311611) +++ stable/11/contrib/netbsd-tests/lib/libc/string/t_strchr.c Sat Jan 7 09:18:11 2017(r311612) @@ -58,6 +58,9 @@ ATF_TC_HEAD(strchr_basic, tc) ATF_TC_BODY(strchr_basic, tc) { +#ifdef __FreeBSD__ + void *dl_handle; +#endif unsigned int t, a; char *off; char buf[32]; @@ -245,8 +248,12 @@ ATF_TC_BODY(strchr_basic, tc) "abcdefgh/abcdefgh/", }; - +#ifdef __FreeBSD__ + dl_handle = dlopen(NULL, RTLD_LAZY); + strchr_fn = dlsym(dl_handle, "test_strlen"); +#else strchr_fn = dlsym(dlopen(0, RTLD_LAZY), "test_strchr"); +#endif if (!strchr_fn) strchr_fn = strchr; @@ -281,6 +288,9 @@ ATF_TC_BODY(strchr_basic, tc) verify_strchr(buf + a, 0xff, t, a); } } +#ifdef __FreeBSD__ + (void)dlclose(dl_handle); +#endif } ATF_TP_ADD_TCS(tp) Modified: stable/11/contrib/netbsd-tests/lib/libc/string/t_strlen.c == --- stable/11/contrib/netbsd-tests/lib/libc/string/t_strlen.c Sat Jan 7 09:17:45 2017(r311611) +++ stable/11/contrib/netbsd-tests/lib/libc/string/t_strlen.c Sat Jan 7 09:18:11 2017(r311612) @@ -40,6 +40,9 @@ ATF_TC_HEAD(strlen_basic, tc) ATF_TC_BODY(strlen_basic, tc) { +#ifdef __FreeBSD__ + void *dl_handle; +#endif /* try to trick the compiler */ size_t (*strlen_fn)(const char *); @@ -107,7 +110,12 @@ ATF_TC_BODY(strlen_basic, tc) * During testing it is useful have the rest of the program * use a known good version! */ +#ifdef __FreeBSD__ + dl_handle = dlopen(NULL, RTLD_LAZY); + strlen_fn = dlsym(dl_handle, "test_strlen"); +#else strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen"); +#endif if (!strlen_fn) strlen_fn = strlen; @@ -134,6 +142,9 @@ ATF_TC_BODY(strlen_basic, tc) } } } +#ifdef __FreeBSD__ + (void)dlclose(dl_handle); +#endif } ATF_TC(strlen_huge); ___ 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: r311611 - stable/10/contrib/netbsd-tests/lib/libc/string
Author: ngie Date: Sat Jan 7 09:17:45 2017 New Revision: 311611 URL: https://svnweb.freebsd.org/changeset/base/311611 Log: MFC r311249: {strchr,strlen}_basic: don't leak the dlopen'ed handle; close after use CID: 978299, 978300 Modified: stable/10/contrib/netbsd-tests/lib/libc/string/t_strchr.c stable/10/contrib/netbsd-tests/lib/libc/string/t_strlen.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/string/t_strchr.c == --- stable/10/contrib/netbsd-tests/lib/libc/string/t_strchr.c Sat Jan 7 09:16:22 2017(r311610) +++ stable/10/contrib/netbsd-tests/lib/libc/string/t_strchr.c Sat Jan 7 09:17:45 2017(r311611) @@ -58,6 +58,9 @@ ATF_TC_HEAD(strchr_basic, tc) ATF_TC_BODY(strchr_basic, tc) { +#ifdef __FreeBSD__ + void *dl_handle; +#endif unsigned int t, a; char *off; char buf[32]; @@ -245,8 +248,12 @@ ATF_TC_BODY(strchr_basic, tc) "abcdefgh/abcdefgh/", }; - +#ifdef __FreeBSD__ + dl_handle = dlopen(NULL, RTLD_LAZY); + strchr_fn = dlsym(dl_handle, "test_strlen"); +#else strchr_fn = dlsym(dlopen(0, RTLD_LAZY), "test_strchr"); +#endif if (!strchr_fn) strchr_fn = strchr; @@ -281,6 +288,9 @@ ATF_TC_BODY(strchr_basic, tc) verify_strchr(buf + a, 0xff, t, a); } } +#ifdef __FreeBSD__ + (void)dlclose(dl_handle); +#endif } ATF_TP_ADD_TCS(tp) Modified: stable/10/contrib/netbsd-tests/lib/libc/string/t_strlen.c == --- stable/10/contrib/netbsd-tests/lib/libc/string/t_strlen.c Sat Jan 7 09:16:22 2017(r311610) +++ stable/10/contrib/netbsd-tests/lib/libc/string/t_strlen.c Sat Jan 7 09:17:45 2017(r311611) @@ -40,6 +40,9 @@ ATF_TC_HEAD(strlen_basic, tc) ATF_TC_BODY(strlen_basic, tc) { +#ifdef __FreeBSD__ + void *dl_handle; +#endif /* try to trick the compiler */ size_t (*strlen_fn)(const char *); @@ -107,7 +110,12 @@ ATF_TC_BODY(strlen_basic, tc) * During testing it is useful have the rest of the program * use a known good version! */ +#ifdef __FreeBSD__ + dl_handle = dlopen(NULL, RTLD_LAZY); + strlen_fn = dlsym(dl_handle, "test_strlen"); +#else strlen_fn = dlsym(dlopen(NULL, RTLD_LAZY), "test_strlen"); +#endif if (!strlen_fn) strlen_fn = strlen; @@ -134,6 +142,9 @@ ATF_TC_BODY(strlen_basic, tc) } } } +#ifdef __FreeBSD__ + (void)dlclose(dl_handle); +#endif } ATF_TC(strlen_huge); ___ 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: r311610 - stable/10/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:16:22 2017 New Revision: 311610 URL: https://svnweb.freebsd.org/changeset/base/311610 Log: MFC r311272: revoke_perm: don't leak fd at the end of the test; close it This code is unused on FreeBSD, but it mutes a valid Coverity warning which would be true on NetBSD CID: 978311 Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_revoke.c == --- stable/10/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Sat Jan 7 09:16:18 2017(r311609) +++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Sat Jan 7 09:16:22 2017(r311610) @@ -176,6 +176,9 @@ ATF_TC_BODY(revoke_perm, tc) if (WIFEXITED(sta) == 0 || WEXITSTATUS(sta) != EXIT_SUCCESS) atf_tc_fail("revoke(2) did not obey permissions"); +#ifdef __FreeBSD__ + (void)close(fd); +#endif ATF_REQUIRE(unlink(path) == 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: r311609 - stable/11/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:16:18 2017 New Revision: 311609 URL: https://svnweb.freebsd.org/changeset/base/311609 Log: MFC r311272: revoke_perm: don't leak fd at the end of the test; close it This code is unused on FreeBSD, but it mutes a valid Coverity warning which would be true on NetBSD CID: 978311 Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_revoke.c == --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Sat Jan 7 09:15:19 2017(r311608) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_revoke.c Sat Jan 7 09:16:18 2017(r311609) @@ -176,6 +176,9 @@ ATF_TC_BODY(revoke_perm, tc) if (WIFEXITED(sta) == 0 || WEXITSTATUS(sta) != EXIT_SUCCESS) atf_tc_fail("revoke(2) did not obey permissions"); +#ifdef __FreeBSD__ + (void)close(fd); +#endif ATF_REQUIRE(unlink(path) == 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: r311608 - stable/10/contrib/netbsd-tests/lib/libc/c063
Author: ngie Date: Sat Jan 7 09:15:19 2017 New Revision: 311608 URL: https://svnweb.freebsd.org/changeset/base/311608 Log: MFC r311246: fexecve: don't leak fd on fexecve(2) failure; close before calling err CID: 978285 Modified: stable/10/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c == --- stable/10/contrib/netbsd-tests/lib/libc/c063/t_fexecve.cSat Jan 7 09:14:12 2017(r311607) +++ stable/10/contrib/netbsd-tests/lib/libc/c063/t_fexecve.cSat Jan 7 09:15:19 2017(r311608) @@ -70,6 +70,9 @@ ATF_TC_BODY(fexecve, tc) error = 76; else error = EXIT_FAILURE; +#ifdef __FreeBSD__ + (void)close(fd); +#endif err(error, "fexecve"); } } ___ 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: r311607 - stable/11/contrib/netbsd-tests/lib/libc/c063
Author: ngie Date: Sat Jan 7 09:14:12 2017 New Revision: 311607 URL: https://svnweb.freebsd.org/changeset/base/311607 Log: MFC r311246: fexecve: don't leak fd on fexecve(2) failure; close before calling err CID: 978285 Modified: stable/11/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/c063/t_fexecve.c == --- stable/11/contrib/netbsd-tests/lib/libc/c063/t_fexecve.cSat Jan 7 09:12:51 2017(r311606) +++ stable/11/contrib/netbsd-tests/lib/libc/c063/t_fexecve.cSat Jan 7 09:14:12 2017(r311607) @@ -70,6 +70,9 @@ ATF_TC_BODY(fexecve, tc) error = 76; else error = EXIT_FAILURE; +#ifdef __FreeBSD__ + (void)close(fd); +#endif err(error, "fexecve"); } } ___ 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: r311606 - stable/10/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:12:51 2017 New Revision: 311606 URL: https://svnweb.freebsd.org/changeset/base/311606 Log: MFC r311270: pipe_restart: free f on function exit to quell complaint from Coverity CID: 978307 Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_pipe.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_pipe.c == --- stable/10/contrib/netbsd-tests/lib/libc/sys/t_pipe.cSat Jan 7 09:11:48 2017(r311605) +++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_pipe.cSat Jan 7 09:12:51 2017(r311606) @@ -153,6 +153,9 @@ ATF_TC_BODY(pipe_restart, tc) ATF_REQUIRE_EQ(WEXITSTATUS(st), 0); } +#ifdef __FreeBSD__ + free(f); +#endif } ATF_TP_ADD_TCS(tp) ___ 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: r311605 - stable/11/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 09:11:48 2017 New Revision: 311605 URL: https://svnweb.freebsd.org/changeset/base/311605 Log: MFC r311270: pipe_restart: free f on function exit to quell complaint from Coverity CID: 978307 Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_pipe.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_pipe.c == --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_pipe.cSat Jan 7 09:11:18 2017(r311604) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_pipe.cSat Jan 7 09:11:48 2017(r311605) @@ -153,6 +153,9 @@ ATF_TC_BODY(pipe_restart, tc) ATF_REQUIRE_EQ(WEXITSTATUS(st), 0); } +#ifdef __FreeBSD__ + free(f); +#endif } ATF_TP_ADD_TCS(tp) ___ 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: r311604 - stable/10/usr.sbin/bsnmpd/modules/snmp_bridge
Author: ngie Date: Sat Jan 7 09:11:18 2017 New Revision: 311604 URL: https://svnweb.freebsd.org/changeset/base/311604 Log: MFC r311291: bridge_get_pfval: use nitems instead of spelling it out longhand Modified: stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c == --- stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c Sat Jan 7 09:09:54 2017(r311603) +++ stable/10/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c Sat Jan 7 09:11:18 2017(r311604) @@ -1449,8 +1449,8 @@ static struct { int32_t bridge_get_pfval(uint8_t which) { - if (which > sizeof(bridge_pf_sysctl) / sizeof(bridge_pf_sysctl[0]) - || which < 1) + + if (which > nitems(bridge_pf_sysctl) || which < 1) return (-1); return (bridge_pf_sysctl[which - 1].val); ___ 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: r311603 - stable/10/contrib/bsnmp/lib
Author: ngie Date: Sat Jan 7 09:09:54 2017 New Revision: 311603 URL: https://svnweb.freebsd.org/changeset/base/311603 Log: MFC r310501: Be more strict about IpAddress type in snmp_value_parse(..) - Use inet_pton with AF_INET instead of doing longhand with sscanf. - Use gethostbyname2 with AF_INET to ensure that the hostname isn't accidentally parsed with another address family, e.g. AF_INET6. NB: IpAddress per RFC-2578 is IPv4 only. Work is in progress to add the InetAddress type and friends documented in RFC-4001 and elsewhere (which supports IPv4, IPv6, and more). Modified: stable/10/contrib/bsnmp/lib/snmp.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/bsnmp/lib/snmp.c == --- stable/10/contrib/bsnmp/lib/snmp.c Sat Jan 7 09:07:12 2017 (r311602) +++ stable/10/contrib/bsnmp/lib/snmp.c Sat Jan 7 09:09:54 2017 (r311603) @@ -51,6 +51,8 @@ #elif defined(HAVE_INTTYPES_H) #include #endif +#include +#include #include "asn1.h" #include "snmp.h" @@ -1384,29 +1386,16 @@ snmp_value_parse(const char *str, enum s case SNMP_SYNTAX_IPADDRESS: { struct hostent *he; - u_long ip[4]; - int n; - if (sscanf(str, "%lu.%lu.%lu.%lu%n", &ip[0], &ip[1], &ip[2], - &ip[3], &n) == 4 && (size_t)n == strlen(str) && - ip[0] <= 0xff && ip[1] <= 0xff && - ip[2] <= 0xff && ip[3] <= 0xff) { - v->ipaddress[0] = (u_char)ip[0]; - v->ipaddress[1] = (u_char)ip[1]; - v->ipaddress[2] = (u_char)ip[2]; - v->ipaddress[3] = (u_char)ip[3]; + if (inet_pton(AF_INET, str, &v->ipaddress) == 1) return (0); - } - - if ((he = gethostbyname(str)) == NULL) + if ((he = gethostbyname2(str, AF_INET)) == NULL) return (-1); if (he->h_addrtype != AF_INET) return (-1); - v->ipaddress[0] = he->h_addr[0]; - v->ipaddress[1] = he->h_addr[1]; - v->ipaddress[2] = he->h_addr[2]; - v->ipaddress[3] = he->h_addr[3]; + memcpy(v->ipaddress, he->h_addr, sizeof(v->ipaddress)); + return (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: r311602 - stable/11/contrib/bsnmp/lib
Author: ngie Date: Sat Jan 7 09:07:12 2017 New Revision: 311602 URL: https://svnweb.freebsd.org/changeset/base/311602 Log: MFC r310501: Be more strict about IpAddress type in snmp_value_parse(..) - Use inet_pton with AF_INET instead of doing longhand with sscanf. - Use gethostbyname2 with AF_INET to ensure that the hostname isn't accidentally parsed with another address family, e.g. AF_INET6. NB: IpAddress per RFC-2578 is IPv4 only. Work is in progress to add the InetAddress type and friends documented in RFC-4001 and elsewhere (which supports IPv4, IPv6, and more). Modified: stable/11/contrib/bsnmp/lib/snmp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/bsnmp/lib/snmp.c == --- stable/11/contrib/bsnmp/lib/snmp.c Sat Jan 7 09:03:40 2017 (r311601) +++ stable/11/contrib/bsnmp/lib/snmp.c Sat Jan 7 09:07:12 2017 (r311602) @@ -51,6 +51,8 @@ #elif defined(HAVE_INTTYPES_H) #include #endif +#include +#include #include "asn1.h" #include "snmp.h" @@ -1384,29 +1386,16 @@ snmp_value_parse(const char *str, enum s case SNMP_SYNTAX_IPADDRESS: { struct hostent *he; - u_long ip[4]; - int n; - if (sscanf(str, "%lu.%lu.%lu.%lu%n", &ip[0], &ip[1], &ip[2], - &ip[3], &n) == 4 && (size_t)n == strlen(str) && - ip[0] <= 0xff && ip[1] <= 0xff && - ip[2] <= 0xff && ip[3] <= 0xff) { - v->ipaddress[0] = (u_char)ip[0]; - v->ipaddress[1] = (u_char)ip[1]; - v->ipaddress[2] = (u_char)ip[2]; - v->ipaddress[3] = (u_char)ip[3]; + if (inet_pton(AF_INET, str, &v->ipaddress) == 1) return (0); - } - - if ((he = gethostbyname(str)) == NULL) + if ((he = gethostbyname2(str, AF_INET)) == NULL) return (-1); if (he->h_addrtype != AF_INET) return (-1); - v->ipaddress[0] = he->h_addr[0]; - v->ipaddress[1] = he->h_addr[1]; - v->ipaddress[2] = he->h_addr[2]; - v->ipaddress[3] = he->h_addr[3]; + memcpy(v->ipaddress, he->h_addr, sizeof(v->ipaddress)); + return (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: r311601 - head/etc
Author: ngie Date: Sat Jan 7 09:03:40 2017 New Revision: 311601 URL: https://svnweb.freebsd.org/changeset/base/311601 Log: Move the mibII module up so uncommenting the bridge module works Add a note about how module ordering and dependent modules MFC after:1 week Modified: head/etc/snmpd.config Modified: head/etc/snmpd.config == --- head/etc/snmpd.config Sat Jan 7 08:58:07 2017(r311600) +++ head/etc/snmpd.config Sat Jan 7 09:03:40 2017(r311601) @@ -122,6 +122,14 @@ snmpEnableAuthenTraps = 2 # order to use the enclosed variables, e.g. `usmUserStatus.$(engine).$(user1)` # can only be used if %usm is uncommented. # +# Modules are loaded in the order listed, so they must be before any +# dependent modules, e.g. "mibII" vs "bridge". +# + +# +# MIB-2 module +# +begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so" # # Bridge module @@ -141,11 +149,6 @@ snmpEnableAuthenTraps = 2 #begemotSnmpdModulePath."lm75" = "/usr/lib/snmp_lm75.so" # -# MIB-2 module -# -begemotSnmpdModulePath."mibII" = "/usr/lib/snmp_mibII.so" - -# # Netgraph module # #begemotSnmpdModulePath."netgraph" = "/usr/lib/snmp_netgraph.so" ___ 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: r311600 - stable/11/usr.sbin/bsnmpd/modules/snmp_bridge
Author: ngie Date: Sat Jan 7 08:58:07 2017 New Revision: 311600 URL: https://svnweb.freebsd.org/changeset/base/311600 Log: MFC r311291: bridge_get_pfval: use nitems instead of spelling it out longhand Modified: stable/11/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c == --- stable/11/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c Sat Jan 7 08:54:02 2017(r311599) +++ stable/11/usr.sbin/bsnmpd/modules/snmp_bridge/bridge_sys.c Sat Jan 7 08:58:07 2017(r311600) @@ -1449,8 +1449,8 @@ static struct { int32_t bridge_get_pfval(uint8_t which) { - if (which > sizeof(bridge_pf_sysctl) / sizeof(bridge_pf_sysctl[0]) - || which < 1) + + if (which > nitems(bridge_pf_sysctl) || which < 1) return (-1); return (bridge_pf_sysctl[which - 1].val); ___ 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: r311598 - stable/10/contrib/bsnmp/snmp_mibII
Author: ngie Date: Sat Jan 7 08:53:58 2017 New Revision: 311598 URL: https://svnweb.freebsd.org/changeset/base/311598 Log: MFC r310952: MIB-II: use strlcpy instead of strcpy when copying {descr,name} This is of course to avoid buffer overruns The remaining strcpy instance in the module needs to be audited for correctness CID: 1006827, 1006828 Modified: stable/10/contrib/bsnmp/snmp_mibII/mibII.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/bsnmp/snmp_mibII/mibII.c == --- stable/10/contrib/bsnmp/snmp_mibII/mibII.c Sat Jan 7 08:48:51 2017 (r311597) +++ stable/10/contrib/bsnmp/snmp_mibII/mibII.c Sat Jan 7 08:53:58 2017 (r311598) @@ -204,7 +204,7 @@ mib_if_set_dyn(const char *name) return; if ((d = malloc(sizeof(*d))) == NULL) err(1, NULL); - strcpy(d->name, name); + strlcpy(d->name, name, sizeof(d->name)); SLIST_INSERT_HEAD(&mibdynif_list, d, link); } @@ -774,8 +774,8 @@ mibif_create(u_int sysindex, const char memset(ifp->private, 0, sizeof(struct mibif_private)); ifp->sysindex = sysindex; - strcpy(ifp->name, name); - strcpy(ifp->descr, name); + strlcpy(ifp->name, name, sizeof(ifp->name)); + strlcpy(ifp->descr, name, sizeof(ifp->descr)); ifp->spec_oid = oid_zeroDotZero; map = 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: r311599 - stable/11/contrib/bsnmp/snmp_mibII
Author: ngie Date: Sat Jan 7 08:54:02 2017 New Revision: 311599 URL: https://svnweb.freebsd.org/changeset/base/311599 Log: MFC r310952: MIB-II: use strlcpy instead of strcpy when copying {descr,name} This is of course to avoid buffer overruns The remaining strcpy instance in the module needs to be audited for correctness CID: 1006827, 1006828 Modified: stable/11/contrib/bsnmp/snmp_mibII/mibII.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/bsnmp/snmp_mibII/mibII.c == --- stable/11/contrib/bsnmp/snmp_mibII/mibII.c Sat Jan 7 08:53:58 2017 (r311598) +++ stable/11/contrib/bsnmp/snmp_mibII/mibII.c Sat Jan 7 08:54:02 2017 (r311599) @@ -204,7 +204,7 @@ mib_if_set_dyn(const char *name) return; if ((d = malloc(sizeof(*d))) == NULL) err(1, NULL); - strcpy(d->name, name); + strlcpy(d->name, name, sizeof(d->name)); SLIST_INSERT_HEAD(&mibdynif_list, d, link); } @@ -774,8 +774,8 @@ mibif_create(u_int sysindex, const char memset(ifp->private, 0, sizeof(struct mibif_private)); ifp->sysindex = sysindex; - strcpy(ifp->name, name); - strcpy(ifp->descr, name); + strlcpy(ifp->name, name, sizeof(ifp->name)); + strlcpy(ifp->descr, name, sizeof(ifp->descr)); ifp->spec_oid = oid_zeroDotZero; map = 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: r311597 - stable/10/contrib/bsnmp/snmpd
Author: ngie Date: Sat Jan 7 08:48:51 2017 New Revision: 311597 URL: https://svnweb.freebsd.org/changeset/base/311597 Log: MFC r310957,r310958,r310960: r310957: Use strlcpy when copying `com` to pdu->community to avoid potential buffer overruns CID: 1006823, 1006824 r310958: Initialize ret to SNMPD_INPUT_OK at the top of snmp_input_start(..) to avoid returning an uninitialized value There are some really complicated, snakey if-statements combined with switch statements that could result in an invalid value being returned as `ret` CID: 1006551 r310960: Similar to r310954, set .len to 0 on malloc failure and to `len` only on success Modified: stable/10/contrib/bsnmp/snmpd/export.c stable/10/contrib/bsnmp/snmpd/main.c stable/10/contrib/bsnmp/snmpd/trap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/bsnmp/snmpd/export.c == --- stable/10/contrib/bsnmp/snmpd/export.c Sat Jan 7 08:47:27 2017 (r311596) +++ stable/10/contrib/bsnmp/snmpd/export.c Sat Jan 7 08:48:51 2017 (r311597) @@ -114,9 +114,11 @@ string_get(struct snmp_value *value, con } if (len == -1) len = strlen(ptr); - value->v.octetstring.len = (u_long)len; - if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) + if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) { + value->v.octetstring.len = 0; return (SNMP_ERR_RES_UNAVAIL); + } + value->v.octetstring.len = (u_long)len; memcpy(value->v.octetstring.octets, ptr, (size_t)len); return (SNMP_ERR_NOERROR); } @@ -138,9 +140,11 @@ string_get_max(struct snmp_value *value, len = strlen(ptr); if ((size_t)len > maxlen) len = maxlen; - value->v.octetstring.len = (u_long)len; - if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) + if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) { + value->v.octetstring.len = 0; return (SNMP_ERR_RES_UNAVAIL); + } + value->v.octetstring.len = (u_long)len; memcpy(value->v.octetstring.octets, ptr, (size_t)len); return (SNMP_ERR_NOERROR); } Modified: stable/10/contrib/bsnmp/snmpd/main.c == --- stable/10/contrib/bsnmp/snmpd/main.cSat Jan 7 08:47:27 2017 (r311596) +++ stable/10/contrib/bsnmp/snmpd/main.cSat Jan 7 08:48:51 2017 (r311597) @@ -492,6 +492,8 @@ snmp_input_start(const u_char *buf, size b.asn_cptr = buf; b.asn_len = len; + ret = SNMPD_INPUT_OK; + /* look whether we have enough bytes for the entire PDU. */ switch (sret = snmp_pdu_snoop(&b)) { @@ -520,8 +522,6 @@ snmp_input_start(const u_char *buf, size } code = snmp_pdu_decode_scoped(&b, pdu, ip); - ret = SNMPD_INPUT_OK; - decoded: snmpd_stats.inPkts++; Modified: stable/10/contrib/bsnmp/snmpd/trap.c == --- stable/10/contrib/bsnmp/snmpd/trap.cSat Jan 7 08:47:27 2017 (r311596) +++ stable/10/contrib/bsnmp/snmpd/trap.cSat Jan 7 08:48:51 2017 (r311597) @@ -422,7 +422,7 @@ snmp_create_v1_trap(struct snmp_pdu *pdu const struct asn_oid *trap_oid) { memset(pdu, 0, sizeof(*pdu)); - strcpy(pdu->community, com); + strlcpy(pdu->community, com, sizeof(pdu->community)); pdu->version = SNMP_V1; pdu->type = SNMP_PDU_TRAP; @@ -439,7 +439,7 @@ snmp_create_v2_trap(struct snmp_pdu *pdu const struct asn_oid *trap_oid) { memset(pdu, 0, sizeof(*pdu)); - strcpy(pdu->community, com); + strlcpy(pdu->community, com, sizeof(pdu->community)); pdu->version = SNMP_V2c; pdu->type = SNMP_PDU_TRAP2; ___ 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: r311596 - stable/11/contrib/bsnmp/snmpd
Author: ngie Date: Sat Jan 7 08:47:27 2017 New Revision: 311596 URL: https://svnweb.freebsd.org/changeset/base/311596 Log: MFC r310957,r310958,r310960: r310957: Use strlcpy when copying `com` to pdu->community to avoid potential buffer overruns CID: 1006823, 1006824 r310958: Initialize ret to SNMPD_INPUT_OK at the top of snmp_input_start(..) to avoid returning an uninitialized value There are some really complicated, snakey if-statements combined with switch statements that could result in an invalid value being returned as `ret` CID: 1006551 r310960: Similar to r310954, set .len to 0 on malloc failure and to `len` only on success Modified: stable/11/contrib/bsnmp/snmpd/export.c stable/11/contrib/bsnmp/snmpd/main.c stable/11/contrib/bsnmp/snmpd/trap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/bsnmp/snmpd/export.c == --- stable/11/contrib/bsnmp/snmpd/export.c Sat Jan 7 08:46:16 2017 (r311595) +++ stable/11/contrib/bsnmp/snmpd/export.c Sat Jan 7 08:47:27 2017 (r311596) @@ -114,9 +114,11 @@ string_get(struct snmp_value *value, con } if (len == -1) len = strlen(ptr); - value->v.octetstring.len = (u_long)len; - if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) + if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) { + value->v.octetstring.len = 0; return (SNMP_ERR_RES_UNAVAIL); + } + value->v.octetstring.len = (u_long)len; memcpy(value->v.octetstring.octets, ptr, (size_t)len); return (SNMP_ERR_NOERROR); } @@ -138,9 +140,11 @@ string_get_max(struct snmp_value *value, len = strlen(ptr); if ((size_t)len > maxlen) len = maxlen; - value->v.octetstring.len = (u_long)len; - if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) + if ((value->v.octetstring.octets = malloc((size_t)len)) == NULL) { + value->v.octetstring.len = 0; return (SNMP_ERR_RES_UNAVAIL); + } + value->v.octetstring.len = (u_long)len; memcpy(value->v.octetstring.octets, ptr, (size_t)len); return (SNMP_ERR_NOERROR); } Modified: stable/11/contrib/bsnmp/snmpd/main.c == --- stable/11/contrib/bsnmp/snmpd/main.cSat Jan 7 08:46:16 2017 (r311595) +++ stable/11/contrib/bsnmp/snmpd/main.cSat Jan 7 08:47:27 2017 (r311596) @@ -492,6 +492,8 @@ snmp_input_start(const u_char *buf, size b.asn_cptr = buf; b.asn_len = len; + ret = SNMPD_INPUT_OK; + /* look whether we have enough bytes for the entire PDU. */ switch (sret = snmp_pdu_snoop(&b)) { @@ -520,8 +522,6 @@ snmp_input_start(const u_char *buf, size } code = snmp_pdu_decode_scoped(&b, pdu, ip); - ret = SNMPD_INPUT_OK; - decoded: snmpd_stats.inPkts++; Modified: stable/11/contrib/bsnmp/snmpd/trap.c == --- stable/11/contrib/bsnmp/snmpd/trap.cSat Jan 7 08:46:16 2017 (r311595) +++ stable/11/contrib/bsnmp/snmpd/trap.cSat Jan 7 08:47:27 2017 (r311596) @@ -422,7 +422,7 @@ snmp_create_v1_trap(struct snmp_pdu *pdu const struct asn_oid *trap_oid) { memset(pdu, 0, sizeof(*pdu)); - strcpy(pdu->community, com); + strlcpy(pdu->community, com, sizeof(pdu->community)); pdu->version = SNMP_V1; pdu->type = SNMP_PDU_TRAP; @@ -439,7 +439,7 @@ snmp_create_v2_trap(struct snmp_pdu *pdu const struct asn_oid *trap_oid) { memset(pdu, 0, sizeof(*pdu)); - strcpy(pdu->community, com); + strlcpy(pdu->community, com, sizeof(pdu->community)); pdu->version = SNMP_V2c; pdu->type = SNMP_PDU_TRAP2; ___ 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: r311595 - in stable/10/usr.sbin/bsnmpd/tools: bsnmptools libbsnmptools
Author: ngie Date: Sat Jan 7 08:46:16 2017 New Revision: 311595 URL: https://svnweb.freebsd.org/changeset/base/311595 Log: MFC r310497: Warning message cleanup - Use warn instead of warnx + strerror(errno) - Remove unnecessary trailing newline from a warnx call - Add missing spaces following "," in syslog and warn* calls Modified: stable/10/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c == --- stable/10/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sat Jan 7 08:44:43 2017(r311594) +++ stable/10/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sat Jan 7 08:46:16 2017(r311595) @@ -394,7 +394,7 @@ snmptool_get(struct snmp_toolinfo *snmpt GET_NONREP(snmptoolctx)); if (snmp_dialog(&req, &resp) == -1) { - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); break; } @@ -521,7 +521,7 @@ snmptool_walk(struct snmp_toolinfo *snmp snmp_pdu_free(&resp); } else - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); } if (snmp_object_remove(snmptoolctx, &root) < 0) { @@ -554,8 +554,7 @@ parse_oid_numeric(struct snmp_value *val errno = 0; suboid = strtoul(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, - strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -634,7 +633,7 @@ parse_int(struct snmp_value *value, char v = strtol(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -682,7 +681,7 @@ parse_uint(struct snmp_value *value, cha v = strtoul(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -736,7 +735,7 @@ parse_uint64(struct snmp_value *value, c v = strtoull(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warnx("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -821,7 +820,7 @@ parse_pair_numoid_val(char *str, struct break; if (ptr[cnt] != '\0') { - warnx("Value string too long - %s",ptr); + warnx("Value string too long - %s", ptr); return (-1); } @@ -830,7 +829,7 @@ parse_pair_numoid_val(char *str, struct * to know syntax to check value boundaries. */ if (snmp_parse_numoid(oid_str, &(snmp_val->var)) < 0) { - warnx("Error parsing OID %s",oid_str); + warnx("Error parsing OID %s", oid_str); return (-1); } @@ -955,7 +954,7 @@ static int32_t add_octstring_syntax(struct snmp_value *dst, struct snmp_value *src) { if (src->v.octetstring.len > ASN_MAXOCTETSTRING) { - warnx("OctetString len too big - %u",src->v.octetstring.len); + warnx("OctetString len too big - %u", src->v.octetstring.len); return (-1); } @@ -1083,7 +1082,7 @@ snmptool_set(struct snmp_toolinfo *snmpt while ((snmp_pdu_add_bindings(snmptoolctx, snmpset_verify_vbind, snmpset_add_vbind, &req, SNMP_MAX_BINDINGS)) > 0) { if (snmp_dialog(&req, &resp)) { - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); break; } @@ -1228,7 +1227,7 @@ main(int argc, char ** argv) } if (snmp_open(NULL, NULL, NULL, NULL)) { - warnx("Failed to open snmp session: %s.", strerror(errno)); + warn("Failed to open snmp session"); snmp_tool_freeall(&snmptoolctx); exit(1); } @@ -1238,7 +1237,7 @@ main(int argc, char ** argv) if (ISSET_EDISCOVER(&snmptoolctx) && snmp_discover_engine(snmptoolctx.passwd) < 0) { - warnx("Unknown S
svn commit: r311594 - in stable/11/usr.sbin/bsnmpd/tools: bsnmptools libbsnmptools
Author: ngie Date: Sat Jan 7 08:44:43 2017 New Revision: 311594 URL: https://svnweb.freebsd.org/changeset/base/311594 Log: MFC r310497: Warning message cleanup - Use warn instead of warnx + strerror(errno) - Remove unnecessary trailing newline from a warnx call - Add missing spaces following "," in syslog and warn* calls Modified: stable/11/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c == --- stable/11/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sat Jan 7 08:44:15 2017(r311593) +++ stable/11/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c Sat Jan 7 08:44:43 2017(r311594) @@ -394,7 +394,7 @@ snmptool_get(struct snmp_toolinfo *snmpt GET_NONREP(snmptoolctx)); if (snmp_dialog(&req, &resp) == -1) { - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); break; } @@ -521,7 +521,7 @@ snmptool_walk(struct snmp_toolinfo *snmp snmp_pdu_free(&resp); } else - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); } if (snmp_object_remove(snmptoolctx, &root) < 0) { @@ -554,8 +554,7 @@ parse_oid_numeric(struct snmp_value *val errno = 0; suboid = strtoul(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, - strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -634,7 +633,7 @@ parse_int(struct snmp_value *value, char v = strtol(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -682,7 +681,7 @@ parse_uint(struct snmp_value *value, cha v = strtoul(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -736,7 +735,7 @@ parse_uint64(struct snmp_value *value, c v = strtoull(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warnx("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -821,7 +820,7 @@ parse_pair_numoid_val(char *str, struct break; if (ptr[cnt] != '\0') { - warnx("Value string too long - %s",ptr); + warnx("Value string too long - %s", ptr); return (-1); } @@ -830,7 +829,7 @@ parse_pair_numoid_val(char *str, struct * to know syntax to check value boundaries. */ if (snmp_parse_numoid(oid_str, &(snmp_val->var)) < 0) { - warnx("Error parsing OID %s",oid_str); + warnx("Error parsing OID %s", oid_str); return (-1); } @@ -955,7 +954,7 @@ static int32_t add_octstring_syntax(struct snmp_value *dst, struct snmp_value *src) { if (src->v.octetstring.len > ASN_MAXOCTETSTRING) { - warnx("OctetString len too big - %u",src->v.octetstring.len); + warnx("OctetString len too big - %u", src->v.octetstring.len); return (-1); } @@ -1083,7 +1082,7 @@ snmptool_set(struct snmp_toolinfo *snmpt while ((snmp_pdu_add_bindings(snmptoolctx, snmpset_verify_vbind, snmpset_add_vbind, &req, SNMP_MAX_BINDINGS)) > 0) { if (snmp_dialog(&req, &resp)) { - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); break; } @@ -1228,7 +1227,7 @@ main(int argc, char ** argv) } if (snmp_open(NULL, NULL, NULL, NULL)) { - warnx("Failed to open snmp session: %s.", strerror(errno)); + warn("Failed to open snmp session"); snmp_tool_freeall(&snmptoolctx); exit(1); } @@ -1238,7 +1237,7 @@ main(int argc, char ** argv) if (ISSET_EDISCOVER(&snmptoolctx) && snmp_discover_engine(snmptoolctx.passwd) < 0) { - warnx("Unknown S
svn commit: r311593 - stable/10/contrib/bsnmp/lib
Author: ngie Date: Sat Jan 7 08:44:15 2017 New Revision: 311593 URL: https://svnweb.freebsd.org/changeset/base/311593 Log: MFC r310931,r310942,r310988: r310931: Use strdup in snmp_parse_server(..) when possible instead of malloc+strcpy This simplifies the code and mutes a Coverity warning about sc->cport being improperly allocated CID: 1018247 r310942: Unbreak the build by passing the string to strdup, not its length Pointyhat to: ngie r310988: snmp_discover_engine: fix up req/resp (PDU object) handling a bit - Call snmp_pdu_free on req and resp when done with the objects - Call snmp_pdu_free on req before calling snmp_pdu_create on it again Modified: stable/10/contrib/bsnmp/lib/snmpclient.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/bsnmp/lib/snmpclient.c == --- stable/10/contrib/bsnmp/lib/snmpclient.cSat Jan 7 08:42:14 2017 (r311592) +++ stable/10/contrib/bsnmp/lib/snmpclient.cSat Jan 7 08:44:15 2017 (r311593) @@ -1793,12 +1793,14 @@ snmp_discover_engine(char *passwd) return (0); } + snmp_pdu_free(&req); + snmp_pdu_create(&req, SNMP_PDU_GET); req.engine.engine_boots = 0; req.engine.engine_time = 0; if (snmp_dialog(&req, &resp) == -1) -return (-1); + return (-1); if (resp.version != req.version) { seterr(&snmp_client, "wrong version"); @@ -1813,6 +1815,9 @@ snmp_discover_engine(char *passwd) snmp_client.engine.engine_boots = resp.engine.engine_boots; snmp_client.engine.engine_time = resp.engine.engine_time; + snmp_pdu_free(&req); + snmp_pdu_free(&resp); + return (0); } @@ -1937,20 +1942,18 @@ snmp_parse_server(struct snmp_client *sc } /* port */ free(sc->cport); - if ((sc->cport = malloc(strlen(p + 1) + 1)) == NULL) { + if ((sc->cport = strdup(p + 1)) == NULL) { seterr(sc, "%s", strerror(errno)); return (-1); } - strcpy(sc->cport, p + 1); } else if (p > s) { /* host */ free(sc->chost); - if ((sc->chost = malloc(strlen(s) + 1)) == NULL) { + if ((sc->chost = strdup(s)) == NULL) { seterr(sc, "%s", strerror(errno)); return (-1); } - strcpy(sc->chost, s); } return (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: r311592 - stable/11/contrib/bsnmp/lib
Author: ngie Date: Sat Jan 7 08:42:14 2017 New Revision: 311592 URL: https://svnweb.freebsd.org/changeset/base/311592 Log: MFC r310931,r310942,r310988: r310931: Use strdup in snmp_parse_server(..) when possible instead of malloc+strcpy This simplifies the code and mutes a Coverity warning about sc->cport being improperly allocated CID: 1018247 r310942: Unbreak the build by passing the string to strdup, not its length Pointyhat to: ngie r310988: snmp_discover_engine: fix up req/resp (PDU object) handling a bit - Call snmp_pdu_free on req and resp when done with the objects - Call snmp_pdu_free on req before calling snmp_pdu_create on it again Modified: stable/11/contrib/bsnmp/lib/snmpclient.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/bsnmp/lib/snmpclient.c == --- stable/11/contrib/bsnmp/lib/snmpclient.cSat Jan 7 08:28:51 2017 (r311591) +++ stable/11/contrib/bsnmp/lib/snmpclient.cSat Jan 7 08:42:14 2017 (r311592) @@ -1793,12 +1793,14 @@ snmp_discover_engine(char *passwd) return (0); } + snmp_pdu_free(&req); + snmp_pdu_create(&req, SNMP_PDU_GET); req.engine.engine_boots = 0; req.engine.engine_time = 0; if (snmp_dialog(&req, &resp) == -1) -return (-1); + return (-1); if (resp.version != req.version) { seterr(&snmp_client, "wrong version"); @@ -1813,6 +1815,9 @@ snmp_discover_engine(char *passwd) snmp_client.engine.engine_boots = resp.engine.engine_boots; snmp_client.engine.engine_time = resp.engine.engine_time; + snmp_pdu_free(&req); + snmp_pdu_free(&resp); + return (0); } @@ -1937,20 +1942,18 @@ snmp_parse_server(struct snmp_client *sc } /* port */ free(sc->cport); - if ((sc->cport = malloc(strlen(p + 1) + 1)) == NULL) { + if ((sc->cport = strdup(p + 1)) == NULL) { seterr(sc, "%s", strerror(errno)); return (-1); } - strcpy(sc->cport, p + 1); } else if (p > s) { /* host */ free(sc->chost); - if ((sc->chost = malloc(strlen(s) + 1)) == NULL) { + if ((sc->chost = strdup(s)) == NULL) { seterr(sc, "%s", strerror(errno)); return (-1); } - strcpy(sc->chost, s); } return (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: r311591 - stable/11/usr.sbin/bsnmpd/tools/libbsnmptools
Author: ngie Date: Sat Jan 7 08:28:51 2017 New Revision: 311591 URL: https://svnweb.freebsd.org/changeset/base/311591 Log: MFC r310954,r310987,r311222: r310954: Set value->v.octetstring.len to a correct value on malloc success/failure The previous code always set value->v.octetstring.len to len, regardless of the result from the malloc call. This misleads the caller on malloc failure. Set .len to len on success and 0 on failure. CID: 1007590 r310987: snmp_output_err_resp, snmp_output_resp: allocate `object` using calloc, not on the stack Some of the callers try to determine whether or not `object` is valid by testing the value for NULL, which will never be true if it's a stack value, so in order to be clear and correct down the call stack, use a heap allocated object. This also addresses a Coverity issue by initializing all of `object` via calloc CID: 1006392 r311222: Fix logical inversion when checking result from calloc in snmp_output_err_resp(..) CID: 1368195 Modified: stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c == --- stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Sat Jan 7 08:28:41 2017(r311590) +++ stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Sat Jan 7 08:28:51 2017(r311591) @@ -266,13 +266,13 @@ parse_octetstring(struct snmp_value *val return (-1); } - value->v.octetstring.len = len; - - if((value->v.octetstring.octets = malloc(len)) == NULL) { + if ((value->v.octetstring.octets = malloc(len)) == NULL) { + value->v.octetstring.len = 0; syslog(LOG_ERR,"malloc failed: %s", strerror(errno)); return (-1); } + value->v.octetstring.len = len; memcpy(value->v.octetstring.octets, val, len); value->syntax = SNMP_SYNTAX_OCTETSTRING; Modified: stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c == --- stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Sat Jan 7 08:28:41 2017(r311590) +++ stable/11/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Sat Jan 7 08:28:51 2017(r311591) @@ -2008,20 +2008,25 @@ snmp_output_object(struct snmp_toolinfo void snmp_output_err_resp(struct snmp_toolinfo *snmptoolctx, struct snmp_pdu *pdu) { + struct snmp_object *object; char buf[ASN_OIDSTRLEN]; - struct snmp_object object; if (pdu == NULL || (pdu->error_index > (int32_t) pdu->nbindings)) { - fprintf(stdout,"Invalid error index in PDU\n"); + fprintf(stdout, "Invalid error index in PDU\n"); + return; + } + + if ((object = calloc(1, sizeof(struct snmp_object))) == NULL) { + fprintf(stdout, "calloc: %s", strerror(errno)); return; } fprintf(stdout, "Agent %s:%s returned error \n", snmp_client.chost, snmp_client.cport); - if (!ISSET_NUMERIC(snmptoolctx) && (snmp_fill_object(snmptoolctx, &object, + if (!ISSET_NUMERIC(snmptoolctx) && (snmp_fill_object(snmptoolctx, object, &(pdu->bindings[pdu->error_index - 1])) > 0)) - snmp_output_object(snmptoolctx, &object); + snmp_output_object(snmptoolctx, object); else { asn_oid2str_r(&(pdu->bindings[pdu->error_index - 1].var), buf); fprintf(stdout,"%s", buf); @@ -2033,17 +2038,23 @@ snmp_output_err_resp(struct snmp_toolinf fprintf(stdout, "%s\n", error_strings[pdu->error_status].str); else fprintf(stdout,"%s\n", error_strings[SNMP_ERR_UNKNOWN].str); + + free(object); + object = NULL; } int32_t snmp_output_resp(struct snmp_toolinfo *snmptoolctx, struct snmp_pdu *pdu, struct asn_oid *root) { - struct snmp_object object; + struct snmp_object *object; char p[ASN_OIDSTRLEN]; int32_t error; uint32_t i; + if ((object = calloc(1, sizeof(struct snmp_object))) == NULL) + return (-1); + i = error = 0; while (i < pdu->nbindings) { if (root != NULL && !(asn_is_suboid(root, @@ -2052,18 +2063,22 @@ snmp_output_resp(struct snmp_toolinfo *s if (GET_OUTPUT(snmptoolctx) != OUTPUT_QUIET) { if (!ISSET_NUMERIC(snmptoolctx) && - (snmp_fill_object(snmptoolctx, &object, + (snmp_fill_object(snmptoolctx, object, &(pdu->bindings[i])) > 0)) -
svn commit: r311590 - stable/10/usr.sbin/bsnmpd/tools/libbsnmptools
Author: ngie Date: Sat Jan 7 08:28:41 2017 New Revision: 311590 URL: https://svnweb.freebsd.org/changeset/base/311590 Log: MFC r310954,r310987,r311222: r310954: Set value->v.octetstring.len to a correct value on malloc success/failure The previous code always set value->v.octetstring.len to len, regardless of the result from the malloc call. This misleads the caller on malloc failure. Set .len to len on success and 0 on failure. CID: 1007590 r310987: snmp_output_err_resp, snmp_output_resp: allocate `object` using calloc, not on the stack Some of the callers try to determine whether or not `object` is valid by testing the value for NULL, which will never be true if it's a stack value, so in order to be clear and correct down the call stack, use a heap allocated object. This also addresses a Coverity issue by initializing all of `object` via calloc CID: 1006392 r311222: Fix logical inversion when checking result from calloc in snmp_output_err_resp(..) CID: 1368195 Modified: stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c == --- stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Sat Jan 7 08:25:09 2017(r311589) +++ stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c Sat Jan 7 08:28:41 2017(r311590) @@ -266,13 +266,13 @@ parse_octetstring(struct snmp_value *val return (-1); } - value->v.octetstring.len = len; - - if((value->v.octetstring.octets = malloc(len)) == NULL) { + if ((value->v.octetstring.octets = malloc(len)) == NULL) { + value->v.octetstring.len = 0; syslog(LOG_ERR,"malloc failed: %s", strerror(errno)); return (-1); } + value->v.octetstring.len = len; memcpy(value->v.octetstring.octets, val, len); value->syntax = SNMP_SYNTAX_OCTETSTRING; Modified: stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c == --- stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Sat Jan 7 08:25:09 2017(r311589) +++ stable/10/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Sat Jan 7 08:28:41 2017(r311590) @@ -2008,20 +2008,25 @@ snmp_output_object(struct snmp_toolinfo void snmp_output_err_resp(struct snmp_toolinfo *snmptoolctx, struct snmp_pdu *pdu) { + struct snmp_object *object; char buf[ASN_OIDSTRLEN]; - struct snmp_object object; if (pdu == NULL || (pdu->error_index > (int32_t) pdu->nbindings)) { - fprintf(stdout,"Invalid error index in PDU\n"); + fprintf(stdout, "Invalid error index in PDU\n"); + return; + } + + if ((object = calloc(1, sizeof(struct snmp_object))) == NULL) { + fprintf(stdout, "calloc: %s", strerror(errno)); return; } fprintf(stdout, "Agent %s:%s returned error \n", snmp_client.chost, snmp_client.cport); - if (!ISSET_NUMERIC(snmptoolctx) && (snmp_fill_object(snmptoolctx, &object, + if (!ISSET_NUMERIC(snmptoolctx) && (snmp_fill_object(snmptoolctx, object, &(pdu->bindings[pdu->error_index - 1])) > 0)) - snmp_output_object(snmptoolctx, &object); + snmp_output_object(snmptoolctx, object); else { asn_oid2str_r(&(pdu->bindings[pdu->error_index - 1].var), buf); fprintf(stdout,"%s", buf); @@ -2033,17 +2038,23 @@ snmp_output_err_resp(struct snmp_toolinf fprintf(stdout, "%s\n", error_strings[pdu->error_status].str); else fprintf(stdout,"%s\n", error_strings[SNMP_ERR_UNKNOWN].str); + + free(object); + object = NULL; } int32_t snmp_output_resp(struct snmp_toolinfo *snmptoolctx, struct snmp_pdu *pdu, struct asn_oid *root) { - struct snmp_object object; + struct snmp_object *object; char p[ASN_OIDSTRLEN]; int32_t error; uint32_t i; + if ((object = calloc(1, sizeof(struct snmp_object))) == NULL) + return (-1); + i = error = 0; while (i < pdu->nbindings) { if (root != NULL && !(asn_is_suboid(root, @@ -2052,18 +2063,22 @@ snmp_output_resp(struct snmp_toolinfo *s if (GET_OUTPUT(snmptoolctx) != OUTPUT_QUIET) { if (!ISSET_NUMERIC(snmptoolctx) && - (snmp_fill_object(snmptoolctx, &object, + (snmp_fill_object(snmptoolctx, object, &(pdu->bindings[i])) > 0)) -
svn commit: r311588 - stable/11/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 08:24:49 2017 New Revision: 311588 URL: https://svnweb.freebsd.org/changeset/base/311588 Log: MFC r311242: listen_low_port: check for errors from socket(2) before continuing CID: 976778 Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_listen.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_listen.c == --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_listen.c Sat Jan 7 08:18:25 2017(r311587) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_listen.c Sat Jan 7 08:24:49 2017(r311588) @@ -110,6 +110,9 @@ ATF_TC_BODY(listen_low_port, tc) int sd, val; sd = socket(AF_INET, SOCK_STREAM, 0); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(sd != -1, "socket failed: %s", strerror(errno)); +#endif val = IP_PORTRANGE_LOW; if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE, &val, ___ 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: r311589 - stable/10/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 08:25:09 2017 New Revision: 311589 URL: https://svnweb.freebsd.org/changeset/base/311589 Log: MFC r311242: listen_low_port: check for errors from socket(2) before continuing CID: 976778 Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_listen.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_listen.c == --- stable/10/contrib/netbsd-tests/lib/libc/sys/t_listen.c Sat Jan 7 08:24:49 2017(r311588) +++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_listen.c Sat Jan 7 08:25:09 2017(r311589) @@ -110,6 +110,9 @@ ATF_TC_BODY(listen_low_port, tc) int sd, val; sd = socket(AF_INET, SOCK_STREAM, 0); +#ifdef __FreeBSD__ + ATF_REQUIRE_MSG(sd != -1, "socket failed: %s", strerror(errno)); +#endif val = IP_PORTRANGE_LOW; if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE, &val, ___ 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: r311587 - stable/10/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 08:18:25 2017 New Revision: 311587 URL: https://svnweb.freebsd.org/changeset/base/311587 Log: MFC r311239: umask_open: don't leak fd on success CID: 978315 Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_umask.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/netbsd-tests/lib/libc/sys/t_umask.c == --- stable/10/contrib/netbsd-tests/lib/libc/sys/t_umask.c Sat Jan 7 08:16:52 2017(r311586) +++ stable/10/contrib/netbsd-tests/lib/libc/sys/t_umask.c Sat Jan 7 08:18:25 2017(r311587) @@ -129,6 +129,9 @@ ATF_TC_BODY(umask_open, tc) if (fd < 0) continue; +#ifdef __FreeBSD__ + (void)close(fd); +#endif (void)memset(&st, 0, sizeof(struct stat)); if (stat(path, &st) != 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: r311586 - stable/11/contrib/netbsd-tests/lib/libc/sys
Author: ngie Date: Sat Jan 7 08:16:52 2017 New Revision: 311586 URL: https://svnweb.freebsd.org/changeset/base/311586 Log: MFC r311239: umask_open: don't leak fd on success CID: 978315 Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_umask.c Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/netbsd-tests/lib/libc/sys/t_umask.c == --- stable/11/contrib/netbsd-tests/lib/libc/sys/t_umask.c Sat Jan 7 08:08:35 2017(r311585) +++ stable/11/contrib/netbsd-tests/lib/libc/sys/t_umask.c Sat Jan 7 08:16:52 2017(r311586) @@ -129,6 +129,9 @@ ATF_TC_BODY(umask_open, tc) if (fd < 0) continue; +#ifdef __FreeBSD__ + (void)close(fd); +#endif (void)memset(&st, 0, sizeof(struct stat)); if (stat(path, &st) != 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: r311585 - in head: crypto/openssh secure/usr.sbin/sshd
Author: ngie Date: Sat Jan 7 08:08:35 2017 New Revision: 311585 URL: https://svnweb.freebsd.org/changeset/base/311585 Log: Conditionalize building libwrap support into sshd Only build libwrap support into sshd if MK_TCP_WRAPPERS != no This will unbreak the build if libwrap has been removed from the system MFC after:2 weeks PR: 210141 Submitted by: kp...@protonmail.com Differential Revision:D9049 Modified: head/crypto/openssh/config.h head/secure/usr.sbin/sshd/Makefile Modified: head/crypto/openssh/config.h == --- head/crypto/openssh/config.hSat Jan 7 07:54:23 2017 (r311584) +++ head/crypto/openssh/config.hSat Jan 7 08:08:35 2017 (r311585) @@ -1408,7 +1408,7 @@ /* #undef LASTLOG_WRITE_PUTUTXLINE */ /* Define if you want TCP Wrappers support */ -#define LIBWRAP 1 +/* #undef LIBWRAP */ /* Define to whatever link() returns for "not supported" if it doesn't return EOPNOTSUPP. */ Modified: head/secure/usr.sbin/sshd/Makefile == --- head/secure/usr.sbin/sshd/Makefile Sat Jan 7 07:54:23 2017 (r311584) +++ head/secure/usr.sbin/sshd/Makefile Sat Jan 7 08:08:35 2017 (r311585) @@ -27,7 +27,7 @@ CFLAGS+=-I${SSHDIR} -include ssh_namespa SRCS+= ssh_namespace.h # pam should always happen before ssh here for static linking -LIBADD=pam ssh util wrap +LIBADD=pam ssh util .if ${MK_LDNS} != "no" CFLAGS+= -DHAVE_LDNS=1 @@ -53,6 +53,11 @@ SRCS+= krb5_config.h LIBADD+= gssapi_krb5 gssapi krb5 .endif +.if ${MK_TCP_WRAPPERS} != "no" +CFLAGS+= -DLIBWRAP +LIBADD+= wrap +.endif + LIBADD+= crypto .if defined(LOCALBASE) ___ 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"