From owner-svn-src-stable-10@FreeBSD.ORG Sun Nov 23 04:17:40 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E84F4C5; Sun, 23 Nov 2014 04:17:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6BD07F97; Sun, 23 Nov 2014 04:17:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAN4HeTI006061; Sun, 23 Nov 2014 04:17:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAN4HebY006059; Sun, 23 Nov 2014 04:17:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201411230417.sAN4HebY006059@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Nov 2014 04:17:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274909 - in stable/10/usr.sbin: ctld iscsid X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Nov 2014 04:17:40 -0000 Author: mav Date: Sun Nov 23 04:17:39 2014 New Revision: 274909 URL: https://svnweb.freebsd.org/changeset/base/274909 Log: MFC r274328: Make both iSCSI initiator and target support base64 encoded CHAP data. While all tested initiators and targets use hex-encoded CHAP data, RFC also allows base64 encoding there, and Microsoft certificaition tool uses it. Modified: stable/10/usr.sbin/ctld/chap.c stable/10/usr.sbin/iscsid/chap.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/chap.c ============================================================================== --- stable/10/usr.sbin/ctld/chap.c Sun Nov 23 01:08:42 2014 (r274908) +++ stable/10/usr.sbin/ctld/chap.c Sun Nov 23 04:17:39 2014 (r274909) @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -105,6 +107,29 @@ chap_hex2int(const char hex) } } +static int +chap_b642bin(const char *b64, void **binp, size_t *bin_lenp) +{ + char *bin; + int b64_len, bin_len; + + b64_len = strlen(b64); + bin_len = (b64_len + 3) / 4 * 3; + bin = calloc(bin_len, 1); + if (bin == NULL) + log_err(1, "calloc"); + + bin_len = b64_pton(b64, bin, bin_len); + if (bin_len < 0) { + log_warnx("malformed base64 variable"); + free(bin); + return (-1); + } + *binp = bin; + *bin_lenp = bin_len; + return (0); +} + /* * XXX: Review this _carefully_. */ @@ -116,8 +141,12 @@ chap_hex2bin(const char *hex, void **bin char *bin; size_t bin_off, bin_len; + if (strncasecmp(hex, "0b", strlen("0b")) == 0) + return (chap_b642bin(hex + 2, binp, bin_lenp)); + if (strncasecmp(hex, "0x", strlen("0x")) != 0) { - log_warnx("malformed variable, should start with \"0x\""); + log_warnx("malformed variable, should start with \"0x\"" + " or \"0b\""); return (-1); } @@ -160,6 +189,25 @@ chap_hex2bin(const char *hex, void **bin return (0); } +#ifdef USE_BASE64 +static char * +chap_bin2hex(const char *bin, size_t bin_len) +{ + unsigned char *b64, *tmp; + size_t b64_len; + + b64_len = (bin_len + 2) / 3 * 4 + 3; /* +2 for "0b", +1 for '\0'. */ + b64 = malloc(b64_len); + if (b64 == NULL) + log_err(1, "malloc"); + + tmp = b64; + tmp += sprintf(tmp, "0b"); + b64_ntop(bin, bin_len, tmp, b64_len - 2); + + return (b64); +} +#else static char * chap_bin2hex(const char *bin, size_t bin_len) { @@ -181,6 +229,7 @@ chap_bin2hex(const char *bin, size_t bin return (hex); } +#endif /* !USE_BASE64 */ struct chap * chap_new(void) Modified: stable/10/usr.sbin/iscsid/chap.c ============================================================================== --- stable/10/usr.sbin/iscsid/chap.c Sun Nov 23 01:08:42 2014 (r274908) +++ stable/10/usr.sbin/iscsid/chap.c Sun Nov 23 04:17:39 2014 (r274909) @@ -33,6 +33,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -105,6 +107,29 @@ chap_hex2int(const char hex) } } +static int +chap_b642bin(const char *b64, void **binp, size_t *bin_lenp) +{ + char *bin; + int b64_len, bin_len; + + b64_len = strlen(b64); + bin_len = (b64_len + 3) / 4 * 3; + bin = calloc(bin_len, 1); + if (bin == NULL) + log_err(1, "calloc"); + + bin_len = b64_pton(b64, bin, bin_len); + if (bin_len < 0) { + log_warnx("malformed base64 variable"); + free(bin); + return (-1); + } + *binp = bin; + *bin_lenp = bin_len; + return (0); +} + /* * XXX: Review this _carefully_. */ @@ -116,8 +141,12 @@ chap_hex2bin(const char *hex, void **bin char *bin; size_t bin_off, bin_len; + if (strncasecmp(hex, "0b", strlen("0b")) == 0) + return (chap_b642bin(hex + 2, binp, bin_lenp)); + if (strncasecmp(hex, "0x", strlen("0x")) != 0) { - log_warnx("malformed variable, should start with \"0x\""); + log_warnx("malformed variable, should start with \"0x\"" + " or \"0b\""); return (-1); } @@ -160,6 +189,25 @@ chap_hex2bin(const char *hex, void **bin return (0); } +#ifdef USE_BASE64 +static char * +chap_bin2hex(const char *bin, size_t bin_len) +{ + unsigned char *b64, *tmp; + size_t b64_len; + + b64_len = (bin_len + 2) / 3 * 4 + 3; /* +2 for "0b", +1 for '\0'. */ + b64 = malloc(b64_len); + if (b64 == NULL) + log_err(1, "malloc"); + + tmp = b64; + tmp += sprintf(tmp, "0b"); + b64_ntop(bin, bin_len, tmp, b64_len - 2); + + return (b64); +} +#else static char * chap_bin2hex(const char *bin, size_t bin_len) { @@ -181,6 +229,7 @@ chap_bin2hex(const char *bin, size_t bin return (hex); } +#endif /* !USE_BASE64 */ struct chap * chap_new(void) From owner-svn-src-stable-10@FreeBSD.ORG Mon Nov 24 00:47:06 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A041044B; Mon, 24 Nov 2014 00:47:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8B037D62; Mon, 24 Nov 2014 00:47:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAO0l64l089209; Mon, 24 Nov 2014 00:47:06 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAO0l4rG089198; Mon, 24 Nov 2014 00:47:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201411240047.sAO0l4rG089198@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Nov 2014 00:47:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274939 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2014 00:47:06 -0000 Author: mav Date: Mon Nov 24 00:47:04 2014 New Revision: 274939 URL: https://svnweb.freebsd.org/changeset/base/274939 Log: MFC r273635, r273793, r274797: Add basic iSNS client to the iSCSI target. This makes ctld(8) register its iSCSI targets and portals on configured iSNS servers to allow initiators find them without active discovery. Fetching of allowed initiators from iSNS is not implemented now, so target ACLs still should be configured manually. Relnotes: Yes Sponsored by: iXsystems, Inc. Added: stable/10/usr.sbin/ctld/isns.c - copied, changed from r273635, head/usr.sbin/ctld/isns.c stable/10/usr.sbin/ctld/isns.h - copied unchanged from r273635, head/usr.sbin/ctld/isns.h Modified: stable/10/usr.sbin/ctld/Makefile stable/10/usr.sbin/ctld/ctl.conf.5 stable/10/usr.sbin/ctld/ctld.c stable/10/usr.sbin/ctld/ctld.h stable/10/usr.sbin/ctld/parse.y stable/10/usr.sbin/ctld/token.l Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/Makefile ============================================================================== --- stable/10/usr.sbin/ctld/Makefile Mon Nov 24 00:34:49 2014 (r274938) +++ stable/10/usr.sbin/ctld/Makefile Mon Nov 24 00:47:04 2014 (r274939) @@ -1,7 +1,8 @@ # $FreeBSD$ PROG= ctld -SRCS= chap.c ctld.c discovery.c kernel.c keys.c log.c login.c parse.y pdu.c token.l y.tab.h +SRCS= chap.c ctld.c discovery.c isns.c kernel.c keys.c log.c +SRCS+= login.c parse.y pdu.c token.l y.tab.h CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}/../../sys CFLAGS+= -I${.CURDIR}/../../sys/cam/ctl Modified: stable/10/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- stable/10/usr.sbin/ctld/ctl.conf.5 Mon Nov 24 00:34:49 2014 (r274938) +++ stable/10/usr.sbin/ctld/ctl.conf.5 Mon Nov 24 00:47:04 2014 (r274939) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 22, 2014 +.Dd October 28, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -106,6 +106,15 @@ The timeout for login sessions, after wh will be forcibly terminated. The default is 60. A setting of 0 disables the timeout. +.It Ic isns-server Ar address +An IPv4 or IPv6 address and optionally port of iSNS server to register on. +.It Ic isns-period Ar seconds +iSNS registration period. +Registered Network Entity not updated during this period will be unregistered. +The default is 900. +.It Ic isns-timeout Ar seconds +Timeout for iSNS requests. +The default is 5. .El .Ss auth-group Context .Bl -tag -width indent Modified: stable/10/usr.sbin/ctld/ctld.c ============================================================================== --- stable/10/usr.sbin/ctld/ctld.c Mon Nov 24 00:34:49 2014 (r274938) +++ stable/10/usr.sbin/ctld/ctld.c Mon Nov 24 00:47:04 2014 (r274939) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include "ctld.h" +#include "isns.h" bool proxy_mode = false; @@ -89,7 +90,10 @@ conf_new(void) TAILQ_INIT(&conf->conf_targets); TAILQ_INIT(&conf->conf_auth_groups); TAILQ_INIT(&conf->conf_portal_groups); + TAILQ_INIT(&conf->conf_isns); + conf->conf_isns_period = 900; + conf->conf_isns_timeout = 5; conf->conf_debug = 0; conf->conf_timeout = 60; conf->conf_maxproc = 30; @@ -103,6 +107,7 @@ conf_delete(struct conf *conf) struct target *targ, *tmp; struct auth_group *ag, *cagtmp; struct portal_group *pg, *cpgtmp; + struct isns *is, *istmp; assert(conf->conf_pidfh == NULL); @@ -112,6 +117,8 @@ conf_delete(struct conf *conf) auth_group_delete(ag); TAILQ_FOREACH_SAFE(pg, &conf->conf_portal_groups, pg_next, cpgtmp) portal_group_delete(pg); + TAILQ_FOREACH_SAFE(is, &conf->conf_isns, i_next, istmp) + isns_delete(is); free(conf->conf_pidfile_path); free(conf); } @@ -619,47 +626,28 @@ portal_group_find(const struct conf *con return (NULL); } -int -portal_group_add_listen(struct portal_group *pg, const char *value, bool iser) +static int +parse_addr_port(char *arg, const char *def_port, struct addrinfo **ai) { struct addrinfo hints; - struct portal *portal; - char *addr, *ch, *arg; + char *addr, *ch; const char *port; int error, colons = 0; - portal = portal_new(pg); - portal->p_listen = checked_strdup(value); - portal->p_iser = iser; - - arg = portal->p_listen; - if (arg[0] == '\0') { - log_warnx("empty listen address"); - portal_delete(portal); - return (1); - } if (arg[0] == '[') { /* * IPv6 address in square brackets, perhaps with port. */ arg++; addr = strsep(&arg, "]"); - if (arg == NULL) { - log_warnx("invalid listen address %s", - portal->p_listen); - portal_delete(portal); + if (arg == NULL) return (1); - } if (arg[0] == '\0') { - port = "3260"; + port = def_port; } else if (arg[0] == ':') { port = arg + 1; - } else { - log_warnx("invalid listen address %s", - portal->p_listen); - portal_delete(portal); + } else return (1); - } } else { /* * Either IPv6 address without brackets - and without @@ -671,11 +659,11 @@ portal_group_add_listen(struct portal_gr } if (colons > 1) { addr = arg; - port = "3260"; + port = def_port; } else { addr = strsep(&arg, ":"); if (arg == NULL) - port = "3260"; + port = def_port; else port = arg; } @@ -685,11 +673,23 @@ portal_group_add_listen(struct portal_gr hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = AI_PASSIVE; + error = getaddrinfo(addr, port, &hints, ai); + if (error != 0) + return (1); + return (0); +} - error = getaddrinfo(addr, port, &hints, &portal->p_ai); - if (error != 0) { - log_warnx("getaddrinfo for %s failed: %s", - portal->p_listen, gai_strerror(error)); +int +portal_group_add_listen(struct portal_group *pg, const char *value, bool iser) +{ + struct portal *portal; + + portal = portal_new(pg); + portal->p_listen = checked_strdup(value); + portal->p_iser = iser; + + if (parse_addr_port(portal->p_listen, "3260", &portal->p_ai)) { + log_warnx("invalid listen address %s", portal->p_listen); portal_delete(portal); return (1); } @@ -702,6 +702,258 @@ portal_group_add_listen(struct portal_gr return (0); } +int +isns_new(struct conf *conf, const char *addr) +{ + struct isns *isns; + + isns = calloc(1, sizeof(*isns)); + if (isns == NULL) + log_err(1, "calloc"); + isns->i_conf = conf; + TAILQ_INSERT_TAIL(&conf->conf_isns, isns, i_next); + isns->i_addr = checked_strdup(addr); + + if (parse_addr_port(isns->i_addr, "3205", &isns->i_ai)) { + log_warnx("invalid iSNS address %s", isns->i_addr); + isns_delete(isns); + return (1); + } + + /* + * XXX: getaddrinfo(3) may return multiple addresses; we should turn + * those into multiple servers. + */ + + return (0); +} + +void +isns_delete(struct isns *isns) +{ + + TAILQ_REMOVE(&isns->i_conf->conf_isns, isns, i_next); + free(isns->i_addr); + if (isns->i_ai != NULL) + freeaddrinfo(isns->i_ai); + free(isns); +} + +static int +isns_do_connect(struct isns *isns) +{ + int s; + + s = socket(isns->i_ai->ai_family, isns->i_ai->ai_socktype, + isns->i_ai->ai_protocol); + if (s < 0) { + log_warn("socket(2) failed for %s", isns->i_addr); + return (-1); + } + if (connect(s, isns->i_ai->ai_addr, isns->i_ai->ai_addrlen)) { + log_warn("connect(2) failed for %s", isns->i_addr); + close(s); + return (-1); + } + return(s); +} + +static int +isns_do_register(struct isns *isns, int s, const char *hostname) +{ + struct conf *conf = isns->i_conf; + struct target *target; + struct portal *portal; + struct portal_group *pg; + struct isns_req *req; + int res = 0; + uint32_t error; + + req = isns_req_create(ISNS_FUNC_DEVATTRREG, ISNS_FLAG_CLIENT); + isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name); + isns_req_add_delim(req); + isns_req_add_str(req, 1, hostname); + isns_req_add_32(req, 2, 2); /* 2 -- iSCSI */ + isns_req_add_32(req, 6, conf->conf_isns_period); + TAILQ_FOREACH(pg, &conf->conf_portal_groups, pg_next) { + if (pg->pg_unassigned) + continue; + TAILQ_FOREACH(portal, &pg->pg_portals, p_next) { + isns_req_add_addr(req, 16, portal->p_ai); + isns_req_add_port(req, 17, portal->p_ai); + } + } + TAILQ_FOREACH(target, &conf->conf_targets, t_next) { + isns_req_add_str(req, 32, target->t_name); + isns_req_add_32(req, 33, 1); /* 1 -- Target*/ + if (target->t_alias != NULL) + isns_req_add_str(req, 34, target->t_alias); + pg = target->t_portal_group; + isns_req_add_32(req, 51, pg->pg_tag); + TAILQ_FOREACH(portal, &pg->pg_portals, p_next) { + isns_req_add_addr(req, 49, portal->p_ai); + isns_req_add_port(req, 50, portal->p_ai); + } + } + res = isns_req_send(s, req); + if (res < 0) { + log_warn("send(2) failed for %s", isns->i_addr); + goto quit; + } + res = isns_req_receive(s, req); + if (res < 0) { + log_warn("receive(2) failed for %s", isns->i_addr); + goto quit; + } + error = isns_req_get_status(req); + if (error != 0) { + log_warnx("iSNS register error %d for %s", error, isns->i_addr); + res = -1; + } +quit: + isns_req_free(req); + return (res); +} + +static int +isns_do_check(struct isns *isns, int s, const char *hostname) +{ + struct conf *conf = isns->i_conf; + struct isns_req *req; + int res = 0; + uint32_t error; + + req = isns_req_create(ISNS_FUNC_DEVATTRQRY, ISNS_FLAG_CLIENT); + isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name); + isns_req_add_str(req, 1, hostname); + isns_req_add_delim(req); + isns_req_add(req, 2, 0, NULL); + res = isns_req_send(s, req); + if (res < 0) { + log_warn("send(2) failed for %s", isns->i_addr); + goto quit; + } + res = isns_req_receive(s, req); + if (res < 0) { + log_warn("receive(2) failed for %s", isns->i_addr); + goto quit; + } + error = isns_req_get_status(req); + if (error != 0) { + log_warnx("iSNS check error %d for %s", error, isns->i_addr); + res = -1; + } +quit: + isns_req_free(req); + return (res); +} + +static int +isns_do_deregister(struct isns *isns, int s, const char *hostname) +{ + struct conf *conf = isns->i_conf; + struct isns_req *req; + int res = 0; + uint32_t error; + + req = isns_req_create(ISNS_FUNC_DEVDEREG, ISNS_FLAG_CLIENT); + isns_req_add_str(req, 32, TAILQ_FIRST(&conf->conf_targets)->t_name); + isns_req_add_delim(req); + isns_req_add_str(req, 1, hostname); + res = isns_req_send(s, req); + if (res < 0) { + log_warn("send(2) failed for %s", isns->i_addr); + goto quit; + } + res = isns_req_receive(s, req); + if (res < 0) { + log_warn("receive(2) failed for %s", isns->i_addr); + goto quit; + } + error = isns_req_get_status(req); + if (error != 0) { + log_warnx("iSNS deregister error %d for %s", error, isns->i_addr); + res = -1; + } +quit: + isns_req_free(req); + return (res); +} + +void +isns_register(struct isns *isns, struct isns *oldisns) +{ + struct conf *conf = isns->i_conf; + int s, res; + char hostname[256]; + + if (TAILQ_EMPTY(&conf->conf_targets) || + TAILQ_EMPTY(&conf->conf_portal_groups)) + return; + set_timeout(conf->conf_isns_timeout, false); + s = isns_do_connect(isns); + if (s < 0) { + set_timeout(0, false); + return; + } + gethostname(hostname, sizeof(hostname)); + + if (oldisns == NULL || TAILQ_EMPTY(&oldisns->i_conf->conf_targets)) + oldisns = isns; + res = isns_do_deregister(oldisns, s, hostname); + res = isns_do_register(isns, s, hostname); + close(s); + set_timeout(0, false); +} + +void +isns_check(struct isns *isns) +{ + struct conf *conf = isns->i_conf; + int s, res; + char hostname[256]; + + if (TAILQ_EMPTY(&conf->conf_targets) || + TAILQ_EMPTY(&conf->conf_portal_groups)) + return; + set_timeout(conf->conf_isns_timeout, false); + s = isns_do_connect(isns); + if (s < 0) { + set_timeout(0, false); + return; + } + gethostname(hostname, sizeof(hostname)); + + res = isns_do_check(isns, s, hostname); + if (res < 0) { + res = isns_do_deregister(isns, s, hostname); + res = isns_do_register(isns, s, hostname); + } + close(s); + set_timeout(0, false); +} + +void +isns_deregister(struct isns *isns) +{ + struct conf *conf = isns->i_conf; + int s, res; + char hostname[256]; + + if (TAILQ_EMPTY(&conf->conf_targets) || + TAILQ_EMPTY(&conf->conf_portal_groups)) + return; + set_timeout(conf->conf_isns_timeout, false); + s = isns_do_connect(isns); + if (s < 0) + return; + gethostname(hostname, sizeof(hostname)); + + res = isns_do_deregister(isns, s, hostname); + close(s); + set_timeout(0, false); +} + static bool valid_hex(const char ch) { @@ -1251,6 +1503,7 @@ conf_apply(struct conf *oldconf, struct struct lun *oldlun, *newlun, *tmplun; struct portal_group *oldpg, *newpg; struct portal *oldp, *newp; + struct isns *oldns, *newns; pid_t otherpid; int changed, cumulated_error = 0, error; int one = 1; @@ -1288,6 +1541,16 @@ conf_apply(struct conf *oldconf, struct } } + /* Deregister on removed iSNS servers. */ + TAILQ_FOREACH(oldns, &oldconf->conf_isns, i_next) { + TAILQ_FOREACH(newns, &newconf->conf_isns, i_next) { + if (strcmp(oldns->i_addr, newns->i_addr) == 0) + break; + } + if (newns == NULL) + isns_deregister(oldns); + } + /* * XXX: If target or lun removal fails, we should somehow "move" * the old lun or target into newconf, so that subsequent @@ -1317,10 +1580,8 @@ conf_apply(struct conf *oldconf, struct oldlun->l_ctl_lun); cumulated_error++; } - lun_delete(oldlun); } kernel_port_remove(oldtarg); - target_delete(oldtarg); continue; } @@ -1343,7 +1604,6 @@ conf_apply(struct conf *oldconf, struct oldlun->l_ctl_lun); cumulated_error++; } - lun_delete(oldlun); continue; } @@ -1569,6 +1829,19 @@ conf_apply(struct conf *oldconf, struct } } + /* (Re-)Register on remaining/new iSNS servers. */ + TAILQ_FOREACH(newns, &newconf->conf_isns, i_next) { + TAILQ_FOREACH(oldns, &oldconf->conf_isns, i_next) { + if (strcmp(oldns->i_addr, newns->i_addr) == 0) + break; + } + isns_register(newns, oldns); + } + + /* Schedule iSNS update */ + if (!TAILQ_EMPTY(&newconf->conf_isns)) + set_timeout((newconf->conf_isns_period + 2) / 3, false); + return (cumulated_error); } @@ -1580,7 +1853,7 @@ timed_out(void) } static void -sigalrm_handler(int dummy __unused) +sigalrm_handler_fatal(int dummy __unused) { /* * It would be easiest to just log an error and exit. We can't @@ -1600,19 +1873,35 @@ sigalrm_handler(int dummy __unused) } static void -set_timeout(const struct conf *conf) +sigalrm_handler(int dummy __unused) +{ + + sigalrm_received = true; +} + +void +set_timeout(int timeout, int fatal) { struct sigaction sa; struct itimerval itv; int error; - if (conf->conf_timeout <= 0) { + if (timeout <= 0) { log_debugx("session timeout disabled"); + bzero(&itv, sizeof(itv)); + error = setitimer(ITIMER_REAL, &itv, NULL); + if (error != 0) + log_err(1, "setitimer"); + sigalrm_received = false; return; } + sigalrm_received = false; bzero(&sa, sizeof(sa)); - sa.sa_handler = sigalrm_handler; + if (fatal) + sa.sa_handler = sigalrm_handler_fatal; + else + sa.sa_handler = sigalrm_handler; sigfillset(&sa.sa_mask); error = sigaction(SIGALRM, &sa, NULL); if (error != 0) @@ -1622,12 +1911,10 @@ set_timeout(const struct conf *conf) * First SIGALRM will arive after conf_timeout seconds. * If we do nothing, another one will arrive a second later. */ + log_debugx("setting session timeout to %d seconds", timeout); bzero(&itv, sizeof(itv)); itv.it_interval.tv_sec = 1; - itv.it_value.tv_sec = conf->conf_timeout; - - log_debugx("setting session timeout to %d seconds", - conf->conf_timeout); + itv.it_value.tv_sec = timeout; error = setitimer(ITIMER_REAL, &itv, NULL); if (error != 0) log_err(1, "setitimer"); @@ -1713,7 +2000,7 @@ handle_connection(struct portal *portal, setproctitle("%s", host); conn = connection_new(portal, fd, host, client_sa); - set_timeout(conf); + set_timeout(conf->conf_timeout, true); kernel_capsicate(); login(conn); if (conn->conn_session_type == CONN_SESSION_TYPE_NORMAL) { @@ -1760,7 +2047,7 @@ main_loop(struct conf *conf, bool dont_f pidfile_write(conf->conf_pidfh); for (;;) { - if (sighup_received || sigterm_received) + if (sighup_received || sigterm_received || timed_out()) return; #ifdef ICL_KERNEL_PROXY @@ -1884,6 +2171,7 @@ int main(int argc, char **argv) { struct conf *oldconf, *newconf, *tmpconf; + struct isns *newns; const char *config_path = DEFAULT_CONFIG_PATH; int debug = 0, ch, error; bool dont_daemonize = false; @@ -1943,6 +2231,10 @@ main(int argc, char **argv) } } + /* Schedule iSNS update */ + if (!TAILQ_EMPTY(&newconf->conf_isns)) + set_timeout((newconf->conf_isns_period + 2) / 3, false); + for (;;) { main_loop(newconf, dont_daemonize); if (sighup_received) { @@ -1978,12 +2270,25 @@ main(int argc, char **argv) error = conf_apply(oldconf, newconf); if (error != 0) log_warnx("failed to apply configuration"); + conf_delete(oldconf); + oldconf = NULL; log_warnx("exiting on signal"); exit(0); } else { nchildren -= wait_for_children(false); assert(nchildren >= 0); + if (timed_out()) { + set_timeout(0, false); + TAILQ_FOREACH(newns, &newconf->conf_isns, i_next) + isns_check(newns); + /* Schedule iSNS update */ + if (!TAILQ_EMPTY(&newconf->conf_isns)) { + set_timeout((newconf->conf_isns_period + + 2) / 3, + false); + } + } } } /* NOTREACHED */ Modified: stable/10/usr.sbin/ctld/ctld.h ============================================================================== --- stable/10/usr.sbin/ctld/ctld.h Mon Nov 24 00:34:49 2014 (r274938) +++ stable/10/usr.sbin/ctld/ctld.h Mon Nov 24 00:47:04 2014 (r274939) @@ -146,11 +146,21 @@ struct target { char *t_alias; }; +struct isns { + TAILQ_ENTRY(isns) i_next; + struct conf *i_conf; + char *i_addr; + struct addrinfo *i_ai; +}; + struct conf { char *conf_pidfile_path; TAILQ_HEAD(, target) conf_targets; TAILQ_HEAD(, auth_group) conf_auth_groups; TAILQ_HEAD(, portal_group) conf_portal_groups; + TAILQ_HEAD(, isns) conf_isns; + int conf_isns_period; + int conf_isns_timeout; int conf_debug; int conf_timeout; int conf_maxproc; @@ -277,6 +287,12 @@ struct portal_group *portal_group_find(c int portal_group_add_listen(struct portal_group *pg, const char *listen, bool iser); +int isns_new(struct conf *conf, const char *addr); +void isns_delete(struct isns *is); +void isns_register(struct isns *isns, struct isns *oldisns); +void isns_check(struct isns *isns); +void isns_deregister(struct isns *isns); + struct target *target_new(struct conf *conf, const char *name); void target_delete(struct target *target); struct target *target_find(struct conf *conf, @@ -354,6 +370,7 @@ void log_debugx(const char *, ...) __p char *checked_strdup(const char *); bool valid_iscsi_name(const char *name); +void set_timeout(int timeout, int fatal); bool timed_out(void); #endif /* !CTLD_H */ Copied and modified: stable/10/usr.sbin/ctld/isns.c (from r273635, head/usr.sbin/ctld/isns.c) ============================================================================== --- head/usr.sbin/ctld/isns.c Sat Oct 25 12:50:26 2014 (r273635, copy source) +++ stable/10/usr.sbin/ctld/isns.c Mon Nov 24 00:47:04 2014 (r274939) @@ -63,7 +63,7 @@ isns_req_alloc(void) req->ir_buflen = sizeof(struct isns_hdr); req->ir_usedlen = 0; req->ir_buf = calloc(req->ir_buflen, 1); - if (req == NULL) { + if (req->ir_buf == NULL) { free(req); log_err(1, "calloc"); return (NULL); Copied: stable/10/usr.sbin/ctld/isns.h (from r273635, head/usr.sbin/ctld/isns.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/usr.sbin/ctld/isns.h Mon Nov 24 00:47:04 2014 (r274939, copy of r273635, head/usr.sbin/ctld/isns.h) @@ -0,0 +1,92 @@ +/*- + * Copyright (c) 2014 Alexander Motin + * 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 AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ISNS_H +#define _ISNS_H + +#define ISNS_VERSION 0x0001 + +#define ISNS_FUNC_DEVATTRREG 0x0001 +#define ISNS_FUNC_DEVATTRQRY 0x0002 +#define ISNS_FUNC_DEVGETNEXT 0x0003 +#define ISNS_FUNC_DEVDEREG 0x0004 +#define ISNS_FUNC_SCNREG 0x0005 +#define ISNS_FUNC_SCNDEREG 0x0006 +#define ISNS_FUNC_SCNEVENT 0x0007 +#define ISNS_FUNC_SCN 0x0008 +#define ISNS_FUNC_DDREG 0x0009 +#define ISNS_FUNC_DDDEREG 0x000a +#define ISNS_FUNC_DDSREG 0x000b +#define ISNS_FUNC_DDSDEREG 0x000c +#define ISNS_FUNC_ESI 0x000d +#define ISNS_FUNC_HEARTBEAT 0x000e +#define ISNS_FUNC_RESPONSE 0x8000 + +#define ISNS_FLAG_CLIENT 0x8000 +#define ISNS_FLAG_SERVER 0x4000 +#define ISNS_FLAG_AUTH 0x2000 +#define ISNS_FLAG_REPLACE 0x1000 +#define ISNS_FLAG_LAST 0x0800 +#define ISNS_FLAG_FIRST 0x0400 + +struct isns_hdr { + uint8_t ih_version[2]; + uint8_t ih_function[2]; + uint8_t ih_length[2]; + uint8_t ih_flags[2]; + uint8_t ih_transaction[2]; + uint8_t ih_sequence[2]; +}; + +struct isns_tlv { + uint8_t it_tag[4]; + uint8_t it_length[4]; + uint8_t it_value[]; +}; + +struct isns_req { + u_int ir_buflen; + u_int ir_usedlen; + uint8_t *ir_buf; +}; + +struct isns_req * isns_req_alloc(void); +struct isns_req * isns_req_create(uint16_t func, uint16_t flags); +void isns_req_free(struct isns_req *req); +void isns_req_add(struct isns_req *req, uint32_t tag, uint32_t len, + const void *value); +void isns_req_add_delim(struct isns_req *req); +void isns_req_add_str(struct isns_req *req, uint32_t tag, const char *value); +void isns_req_add_32(struct isns_req *req, uint32_t tag, uint32_t value); +void isns_req_add_addr(struct isns_req *req, uint32_t tag, struct addrinfo *ai); +void isns_req_add_port(struct isns_req *req, uint32_t tag, struct addrinfo *ai); +int isns_req_send(int s, struct isns_req *req); +int isns_req_receive(int s, struct isns_req *req); +uint32_t isns_req_get_status(struct isns_req *req); + +#endif /* _ISNS_H */ Modified: stable/10/usr.sbin/ctld/parse.y ============================================================================== --- stable/10/usr.sbin/ctld/parse.y Mon Nov 24 00:34:49 2014 (r274938) +++ stable/10/usr.sbin/ctld/parse.y Mon Nov 24 00:47:04 2014 (r274939) @@ -61,6 +61,7 @@ extern void yyrestart(FILE *); %token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP INITIATOR_NAME %token INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC NUM OPENING_BRACKET %token OPTION PATH PIDFILE PORTAL_GROUP SERIAL SIZE STR TARGET TIMEOUT +%token ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT %union { @@ -87,6 +88,12 @@ statement: | pidfile | + isns_server + | + isns_period + | + isns_timeout + | auth_group | portal_group @@ -123,6 +130,29 @@ pidfile: PIDFILE STR } ; +isns_server: ISNS_SERVER STR + { + int error; + + error = isns_new(conf, $2); + free($2); + if (error != 0) + return (1); + } + ; + +isns_period: ISNS_PERIOD NUM + { + conf->conf_isns_period = $2; + } + ; + +isns_timeout: ISNS_TIMEOUT NUM + { + conf->conf_isns_timeout = $2; + } + ; + auth_group: AUTH_GROUP auth_group_name OPENING_BRACKET auth_group_entries CLOSING_BRACKET { Modified: stable/10/usr.sbin/ctld/token.l ============================================================================== --- stable/10/usr.sbin/ctld/token.l Mon Nov 24 00:34:49 2014 (r274938) +++ stable/10/usr.sbin/ctld/token.l Mon Nov 24 00:47:04 2014 (r274939) @@ -67,6 +67,9 @@ maxproc { return MAXPROC; } option { return OPTION; } path { return PATH; } pidfile { return PIDFILE; } +isns-server { return ISNS_SERVER; } +isns-period { return ISNS_PERIOD; } +isns-timeout { return ISNS_TIMEOUT; } portal-group { return PORTAL_GROUP; } serial { return SERIAL; } size { return SIZE; } From owner-svn-src-stable-10@FreeBSD.ORG Mon Nov 24 01:25:20 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 22DE4EBD; Mon, 24 Nov 2014 01:25:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E9A52124; Mon, 24 Nov 2014 01:25:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAO1PJT7008068; Mon, 24 Nov 2014 01:25:19 GMT (envelope-from grehan@FreeBSD.org) Received: (from grehan@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAO1PJkd008067; Mon, 24 Nov 2014 01:25:19 GMT (envelope-from grehan@FreeBSD.org) Message-Id: <201411240125.sAO1PJkd008067@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: grehan set sender to grehan@FreeBSD.org using -f From: Peter Grehan Date: Mon, 24 Nov 2014 01:25:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274942 - stable/10/sys/boot/common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2014 01:25:20 -0000 Author: grehan Date: Mon Nov 24 01:25:19 2014 New Revision: 274942 URL: https://svnweb.freebsd.org/changeset/base/274942 Log: MFC r274407 Fix incorrect reading of 32-bit modinfo by 64-bit loaders. The various structures in the mod_metadata set of a FreeBSD kernel and modules contain pointers. The FreeBSD loader correctly deals with a mismatch in loader and kernel pointer size (e.g. 32-bit i386/ppc loader, loading 64-bit amd64/ppc64 kernels), but wasn't dealing with the inverse case where a 64-bit loader was loading a 32-bit kernel. Modified: stable/10/sys/boot/common/load_elf.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/boot/common/load_elf.c ============================================================================== --- stable/10/sys/boot/common/load_elf.c Mon Nov 24 01:13:58 2014 (r274941) +++ stable/10/sys/boot/common/load_elf.c Mon Nov 24 01:25:19 2014 (r274942) @@ -610,6 +610,14 @@ struct mod_metadata64 { u_int64_t md_cval; /* common string label */ }; #endif +#if defined(__amd64__) && __ELF_WORD_SIZE == 32 +struct mod_metadata32 { + int md_version; /* structure version MDTV_* */ + int md_type; /* type of entry MDT_* */ + u_int32_t md_data; /* specific data */ + u_int32_t md_cval; /* common string label */ +}; +#endif int __elfN(parse_modmetadata)(struct preloaded_file *fp, elf_file_t ef) @@ -617,6 +625,8 @@ __elfN(parse_modmetadata)(struct preload struct mod_metadata md; #if (defined(__i386__) || defined(__powerpc__)) && __ELF_WORD_SIZE == 64 struct mod_metadata64 md64; +#elif defined(__amd64__) && __ELF_WORD_SIZE == 32 + struct mod_metadata32 md32; #endif struct mod_depend *mdepend; struct mod_version mver; @@ -652,6 +662,18 @@ __elfN(parse_modmetadata)(struct preload md.md_type = md64.md_type; md.md_cval = (const char *)(uintptr_t)md64.md_cval; md.md_data = (void *)(uintptr_t)md64.md_data; +#elif defined(__amd64__) && __ELF_WORD_SIZE == 32 + COPYOUT(v, &md32, sizeof(md32)); + error = __elfN(reloc_ptr)(fp, ef, v, &md32, sizeof(md32)); + if (error == EOPNOTSUPP) { + md32.md_cval += ef->off; + md32.md_data += ef->off; + } else if (error != 0) + return (error); + md.md_version = md32.md_version; + md.md_type = md32.md_type; + md.md_cval = (const char *)(uintptr_t)md32.md_cval; + md.md_data = (void *)(uintptr_t)md32.md_data; #else COPYOUT(v, &md, sizeof(md)); error = __elfN(reloc_ptr)(fp, ef, v, &md, sizeof(md)); From owner-svn-src-stable-10@FreeBSD.ORG Mon Nov 24 01:56:34 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A5552313; Mon, 24 Nov 2014 01:56:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 91D633E3; Mon, 24 Nov 2014 01:56:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAO1uYEC021951; Mon, 24 Nov 2014 01:56:34 GMT (envelope-from kevlo@FreeBSD.org) Received: (from kevlo@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAO1uYB8021950; Mon, 24 Nov 2014 01:56:34 GMT (envelope-from kevlo@FreeBSD.org) Message-Id: <201411240156.sAO1uYB8021950@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kevlo set sender to kevlo@FreeBSD.org using -f From: Kevin Lo Date: Mon, 24 Nov 2014 01:56:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274943 - stable/10/lib/libc/stdio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2014 01:56:34 -0000 Author: kevlo Date: Mon Nov 24 01:56:33 2014 New Revision: 274943 URL: https://svnweb.freebsd.org/changeset/base/274943 Log: MFC r273760: Fix prototypes. Modified: stable/10/lib/libc/stdio/open_memstream.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/stdio/open_memstream.3 ============================================================================== --- stable/10/lib/libc/stdio/open_memstream.3 Mon Nov 24 01:25:19 2014 (r274942) +++ stable/10/lib/libc/stdio/open_memstream.3 Mon Nov 24 01:56:33 2014 (r274943) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 27, 2013 +.Dd October 28, 2014 .Dt OPEN_MEMSTREAM 3 .Os .Sh NAME @@ -37,10 +37,10 @@ .Sh SYNOPSIS .In stdio.h .Ft FILE * -.Fn open_memstream "char **bufp" "size_t **sizep" +.Fn open_memstream "char **bufp" "size_t *sizep" .In wchar.h .Ft FILE * -.Fn open_wmemstream "wchar_t **bufp" "size_t **sizep" +.Fn open_wmemstream "wchar_t **bufp" "size_t *sizep" .Sh DESCRIPTION The .Fn open_memstream From owner-svn-src-stable-10@FreeBSD.ORG Mon Nov 24 07:57:19 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E298CFC; Mon, 24 Nov 2014 07:57:19 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 894EEB15; Mon, 24 Nov 2014 07:57:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAO7vJ6p091638; Mon, 24 Nov 2014 07:57:19 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAO7vJSM091637; Mon, 24 Nov 2014 07:57:19 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411240757.sAO7vJSM091637@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Nov 2014 07:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274947 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2014 07:57:19 -0000 Author: trasz Date: Mon Nov 24 07:57:18 2014 New Revision: 274947 URL: https://svnweb.freebsd.org/changeset/base/274947 Log: MFC 273583: Tidy up the login code; no functional changes. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/login.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/login.c ============================================================================== --- stable/10/usr.sbin/ctld/login.c Mon Nov 24 02:36:43 2014 (r274946) +++ stable/10/usr.sbin/ctld/login.c Mon Nov 24 07:57:18 2014 (r274947) @@ -672,6 +672,7 @@ login(struct connection *conn) struct iscsi_bhs_login_response *bhslr2; struct keys *request_keys, *response_keys; struct auth_group *ag; + struct portal_group *pg; const char *initiator_name, *initiator_alias, *session_type, *target_name, *auth_method; @@ -688,6 +689,8 @@ login(struct connection *conn) log_errx(1, "received Login PDU with non-zero TSIH"); } + pg = conn->conn_portal->p_portal_group; + memcpy(conn->conn_initiator_isid, bhslr->bhslr_isid, sizeof(conn->conn_initiator_isid)); @@ -741,9 +744,7 @@ login(struct connection *conn) log_errx(1, "received Login PDU without TargetName"); } - conn->conn_target = - target_find(conn->conn_portal->p_portal_group->pg_conf, - target_name); + conn->conn_target = target_find(pg->pg_conf, target_name); if (conn->conn_target == NULL) { login_send_error(request, 0x02, 0x03); log_errx(1, "requested target \"%s\" not found", @@ -760,14 +761,14 @@ login(struct connection *conn) log_debugx("initiator requests to connect " "to target \"%s\"; auth-group \"%s\"", conn->conn_target->t_name, - conn->conn_target->t_auth_group->ag_name); + ag->ag_name); } else { log_debugx("initiator requests to connect " "to target \"%s\"", conn->conn_target->t_name); } } else { assert(conn->conn_session_type == CONN_SESSION_TYPE_DISCOVERY); - ag = conn->conn_portal->p_portal_group->pg_discovery_auth_group; + ag = pg->pg_discovery_auth_group; if (ag->ag_name != NULL) { log_debugx("initiator requests " "discovery session; auth-group \"%s\"", ag->ag_name); @@ -837,8 +838,7 @@ login(struct connection *conn) response = login_new_response(request); bhslr2 = (struct iscsi_bhs_login_response *)response->pdu_bhs; bhslr2->bhslr_flags |= BHSLR_FLAGS_TRANSIT; - login_set_nsg(response, - BHSLR_STAGE_OPERATIONAL_NEGOTIATION); + login_set_nsg(response, BHSLR_STAGE_OPERATIONAL_NEGOTIATION); response_keys = keys_new(); /* * Required by Linux initiator. @@ -852,8 +852,8 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - keys_add_int(response_keys, "TargetPortalGroupTag", - conn->conn_portal->p_portal_group->pg_tag); + keys_add_int(response_keys, + "TargetPortalGroupTag", pg->pg_tag); } keys_save(response_keys, response); pdu_send(response); @@ -903,8 +903,8 @@ login(struct connection *conn) if (conn->conn_target->t_alias != NULL) keys_add(response_keys, "TargetAlias", conn->conn_target->t_alias); - keys_add_int(response_keys, "TargetPortalGroupTag", - conn->conn_portal->p_portal_group->pg_tag); + keys_add_int(response_keys, + "TargetPortalGroupTag", pg->pg_tag); } keys_save(response_keys, response); From owner-svn-src-stable-10@FreeBSD.ORG Mon Nov 24 07:59:46 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 358B5117; Mon, 24 Nov 2014 07:59:46 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 20907B3A; Mon, 24 Nov 2014 07:59:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAO7xk01092047; Mon, 24 Nov 2014 07:59:46 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAO7xj0t092042; Mon, 24 Nov 2014 07:59:45 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411240759.sAO7xj0t092042@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Nov 2014 07:59:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274949 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2014 07:59:46 -0000 Author: trasz Date: Mon Nov 24 07:59:44 2014 New Revision: 274949 URL: https://svnweb.freebsd.org/changeset/base/274949 Log: MFC r273584: Make the initiator-name and initiator-portal checks a little nicer. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/ctld.c stable/10/usr.sbin/ctld/ctld.h stable/10/usr.sbin/ctld/login.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctld.c ============================================================================== --- stable/10/usr.sbin/ctld/ctld.c Mon Nov 24 07:57:20 2014 (r274948) +++ stable/10/usr.sbin/ctld/ctld.c Mon Nov 24 07:59:44 2014 (r274949) @@ -325,6 +325,18 @@ auth_name_find(const struct auth_group * return (NULL); } +int +auth_name_check(const struct auth_group *ag, const char *initiator_name) +{ + if (!auth_name_defined(ag)) + return (0); + + if (auth_name_find(ag, initiator_name) == NULL) + return (1); + + return (0); +} + const struct auth_portal * auth_portal_new(struct auth_group *ag, const char *portal) { @@ -437,6 +449,19 @@ next: return (NULL); } +int +auth_portal_check(const struct auth_group *ag, const struct sockaddr_storage *sa) +{ + + if (!auth_portal_defined(ag)) + return (0); + + if (auth_portal_find(ag, sa) == NULL) + return (1); + + return (0); +} + struct auth_group * auth_group_new(struct conf *conf, const char *name) { Modified: stable/10/usr.sbin/ctld/ctld.h ============================================================================== --- stable/10/usr.sbin/ctld/ctld.h Mon Nov 24 07:57:20 2014 (r274948) +++ stable/10/usr.sbin/ctld/ctld.h Mon Nov 24 07:59:44 2014 (r274949) @@ -273,12 +273,16 @@ const struct auth_name *auth_name_new(st bool auth_name_defined(const struct auth_group *ag); const struct auth_name *auth_name_find(const struct auth_group *ag, const char *initiator_name); +int auth_name_check(const struct auth_group *ag, + const char *initiator_name); const struct auth_portal *auth_portal_new(struct auth_group *ag, const char *initiator_portal); bool auth_portal_defined(const struct auth_group *ag); const struct auth_portal *auth_portal_find(const struct auth_group *ag, const struct sockaddr_storage *sa); +int auth_portal_check(const struct auth_group *ag, + const struct sockaddr_storage *sa); struct portal_group *portal_group_new(struct conf *conf, const char *name); void portal_group_delete(struct portal_group *pg); Modified: stable/10/usr.sbin/ctld/login.c ============================================================================== --- stable/10/usr.sbin/ctld/login.c Mon Nov 24 07:57:20 2014 (r274948) +++ stable/10/usr.sbin/ctld/login.c Mon Nov 24 07:59:44 2014 (r274949) @@ -780,28 +780,15 @@ login(struct connection *conn) /* * Enforce initiator-name and initiator-portal. */ - if (auth_name_defined(ag)) { - if (auth_name_find(ag, initiator_name) == NULL) { - login_send_error(request, 0x02, 0x02); - log_errx(1, "initiator does not match allowed " - "initiator names"); - } - log_debugx("initiator matches allowed initiator names"); - } else { - log_debugx("auth-group does not define initiator name " - "restrictions"); + if (auth_name_check(ag, initiator_name) != 0) { + login_send_error(request, 0x02, 0x02); + log_errx(1, "initiator does not match allowed initiator names"); } - if (auth_portal_defined(ag)) { - if (auth_portal_find(ag, &conn->conn_initiator_sa) == NULL) { - login_send_error(request, 0x02, 0x02); - log_errx(1, "initiator does not match allowed " - "initiator portals"); - } - log_debugx("initiator matches allowed initiator portals"); - } else { - log_debugx("auth-group does not define initiator portal " - "restrictions"); + if (auth_portal_check(ag, &conn->conn_initiator_sa) != 0) { + login_send_error(request, 0x02, 0x02); + log_errx(1, "initiator does not match allowed " + "initiator portals"); } /* From owner-svn-src-stable-10@FreeBSD.ORG Mon Nov 24 08:04:41 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 684818D9; Mon, 24 Nov 2014 08:04:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 53DC3D1B; Mon, 24 Nov 2014 08:04:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAO84f0L096225; Mon, 24 Nov 2014 08:04:41 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAO84f2T096224; Mon, 24 Nov 2014 08:04:41 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411240804.sAO84f2T096224@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Nov 2014 08:04:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274950 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2014 08:04:41 -0000 Author: trasz Date: Mon Nov 24 08:04:40 2014 New Revision: 274950 URL: https://svnweb.freebsd.org/changeset/base/274950 Log: MFC r273467: Comment out parts about iSER; it's not implemented. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/ctl.conf.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- stable/10/usr.sbin/ctld/ctl.conf.5 Mon Nov 24 07:59:44 2014 (r274949) +++ stable/10/usr.sbin/ctld/ctl.conf.5 Mon Nov 24 08:04:40 2014 (r274950) @@ -55,7 +55,7 @@ file is: .No portal-group Ar name No { .Dl listen Ar address -.Dl listen-iser Ar address +.\".Dl listen-iser Ar address .Dl discovery-auth-group Ar name .Dl ... } @@ -177,9 +177,9 @@ may be used to permit discovery without authentication. .It Ic listen Ar address An IPv4 or IPv6 address and port to listen on for incoming connections. -.It Ic listen-iser Ar address -An IPv4 or IPv6 address and port to listen on for incoming connections -using iSER (iSCSI over RDMA) protocol. +.\".It Ic listen-iser Ar address +.\"An IPv4 or IPv6 address and port to listen on for incoming connections +.\"using iSER (iSCSI over RDMA) protocol. .El .Ss target Context .Bl -tag -width indent From owner-svn-src-stable-10@FreeBSD.ORG Mon Nov 24 08:06:29 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C0322A23; Mon, 24 Nov 2014 08:06:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ABC09D31; Mon, 24 Nov 2014 08:06:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAO86TWW096527; Mon, 24 Nov 2014 08:06:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAO86Tu4096526; Mon, 24 Nov 2014 08:06:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411240806.sAO86Tu4096526@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Nov 2014 08:06:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274951 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2014 08:06:29 -0000 Author: trasz Date: Mon Nov 24 08:06:29 2014 New Revision: 274951 URL: https://svnweb.freebsd.org/changeset/base/274951 Log: MFC r273470: Fix ctl.conf example to use proper paths to ZVOLs. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/ctl.conf.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- stable/10/usr.sbin/ctld/ctl.conf.5 Mon Nov 24 08:04:40 2014 (r274950) +++ stable/10/usr.sbin/ctld/ctl.conf.5 Mon Nov 24 08:06:29 2014 (r274951) @@ -321,7 +321,7 @@ target iqn.2012-06.com.example:target0 { alias "Example target" auth-group no-authentication lun 0 { - path /dev/zvol/example_0 + path /dev/zvol/tank/example_0 blocksize 4096 size 4G } @@ -330,7 +330,7 @@ target iqn.2012-06.com.example:target0 { target iqn.2012-06.com.example:target3 { chap chapuser chapsecret lun 0 { - path /dev/zvol/example_3 + path /dev/zvol/tank/example_3 } } @@ -338,10 +338,10 @@ target iqn.2012-06.com.example:target2 { auth-group example2 portal-group example2 lun 0 { - path /dev/zvol/example2_0 + path /dev/zvol/tank/example2_0 } lun 1 { - path /dev/zvol/example2_1 + path /dev/zvol/tank/example2_1 option foo bar } } From owner-svn-src-stable-10@FreeBSD.ORG Mon Nov 24 08:09:51 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3F1ECB67; Mon, 24 Nov 2014 08:09:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2A358D43; Mon, 24 Nov 2014 08:09:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAO89pRn097107; Mon, 24 Nov 2014 08:09:51 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAO89pHF097106; Mon, 24 Nov 2014 08:09:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411240809.sAO89pHF097106@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 24 Nov 2014 08:09:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r274952 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Nov 2014 08:09:51 -0000 Author: trasz Date: Mon Nov 24 08:09:50 2014 New Revision: 274952 URL: https://svnweb.freebsd.org/changeset/base/274952 Log: MFC r273585: Improve ctld.conf example. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/ctl.conf.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- stable/10/usr.sbin/ctld/ctl.conf.5 Mon Nov 24 08:06:29 2014 (r274951) +++ stable/10/usr.sbin/ctld/ctl.conf.5 Mon Nov 24 08:09:50 2014 (r274952) @@ -304,17 +304,24 @@ configuration file. .Bd -literal pidfile /var/run/ctld.pid -auth-group example2 { +auth-group ag0 { chap-mutual "user" "secret" "mutualuser" "mutualsecret" chap-mutual "user2" "secret2" "mutualuser" "mutualsecret" } -portal-group example2 { +auth-group ag1 { + auth-type none + initiator-name "iqn.2012-06.com.example:initiatorhost1" + initiator-name "iqn.2012-06.com.example:initiatorhost2" + initiator-portal 192.168.1.1/24 + initiator-portal [2001:db8::de:ef] +} + +portal-group pg0 { discovery-auth-group no-authentication - listen 127.0.0.1 - listen 0.0.0.0:3261 - listen [::]:3261 - listen [fe80::be:ef] + listen 0.0.0.0:3260 + listen [::]:3260 + listen [fe80::be:ef]:3261 } target iqn.2012-06.com.example:target0 { @@ -327,16 +334,16 @@ target iqn.2012-06.com.example:target0 { } } -target iqn.2012-06.com.example:target3 { +target iqn.2012-06.com.example:target1 { chap chapuser chapsecret lun 0 { - path /dev/zvol/tank/example_3 + path /dev/zvol/tank/example_1 } } target iqn.2012-06.com.example:target2 { - auth-group example2 - portal-group example2 + auth-group ag0 + portal-group pg0 lun 0 { path /dev/zvol/tank/example2_0 } From owner-svn-src-stable-10@FreeBSD.ORG Tue Nov 25 12:19:06 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DBFB29A6; Tue, 25 Nov 2014 12:19:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AE19EFDC; Tue, 25 Nov 2014 12:19:06 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAPCJ6cf025734; Tue, 25 Nov 2014 12:19:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAPCJ60Y025733; Tue, 25 Nov 2014 12:19:06 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201411251219.sAPCJ60Y025733@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 25 Nov 2014 12:19:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275031 - in stable: 10/contrib/libarchive/cpio 9/contrib/libarchive/cpio X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2014 12:19:07 -0000 Author: dim Date: Tue Nov 25 12:19:05 2014 New Revision: 275031 URL: https://svnweb.freebsd.org/changeset/base/275031 Log: MFC r274846: Fix the following -Werror warning from clang 3.5.0, while building usr.bin/cpio on amd64 (or any arch with 64-bit time_t): contrib/libarchive/cpio/cpio.c:1143:6: error: absolute value function 'abs' given an argument of type 'long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value] if (abs(mtime - now) > (365/2)*86400) ^ contrib/libarchive/cpio/cpio.c:1143:6: note: use function 'labs' instead if (abs(mtime - now) > (365/2)*86400) ^~~ labs 1 error generated. This is because time_t is a long on amd64. To avoid the warning, just copy the equivalent test from a few lines before, which is used in the Windows case, and which is type safe. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D1198 Modified: stable/10/contrib/libarchive/cpio/cpio.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/contrib/libarchive/cpio/cpio.c Directory Properties: stable/9/contrib/libarchive/ (props changed) Modified: stable/10/contrib/libarchive/cpio/cpio.c ============================================================================== --- stable/10/contrib/libarchive/cpio/cpio.c Tue Nov 25 11:23:12 2014 (r275030) +++ stable/10/contrib/libarchive/cpio/cpio.c Tue Nov 25 12:19:05 2014 (r275031) @@ -1140,7 +1140,8 @@ list_item_verbose(struct cpio *cpio, str else fmt = cpio->day_first ? "%d %b %H:%M" : "%b %d %H:%M"; #else - if (abs(mtime - now) > (365/2)*86400) + if (mtime - now > 365*86400/2 + || mtime - now < -365*86400/2) fmt = cpio->day_first ? "%e %b %Y" : "%b %e %Y"; else fmt = cpio->day_first ? "%e %b %H:%M" : "%b %e %H:%M"; From owner-svn-src-stable-10@FreeBSD.ORG Tue Nov 25 12:45:34 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 090CF4A1; Tue, 25 Nov 2014 12:45:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E8118376; Tue, 25 Nov 2014 12:45:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAPCjXMC040255; Tue, 25 Nov 2014 12:45:33 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAPCjXMg040254; Tue, 25 Nov 2014 12:45:33 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201411251245.sAPCjXMg040254@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 25 Nov 2014 12:45:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275034 - in stable: 10/usr.bin/locate/locate 7/usr.bin/locate/locate 8/usr.bin/locate/locate 9/usr.bin/locate/locate X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2014 12:45:34 -0000 Author: dim Date: Tue Nov 25 12:45:31 2014 New Revision: 275034 URL: https://svnweb.freebsd.org/changeset/base/275034 Log: MFC r274847: Fix the following -Werror warnings from clang 3.5.0, while building usr.bin/locate: usr.bin/locate/locate/util.c:249:29: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value] MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i)); ^ usr.bin/locate/locate/util.c:249:29: note: remove the call to 'abs' since unsigned values cannot be negative MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i)); ^~~ usr.bin/locate/locate/util.c:274:32: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value] MAXPATHLEN, abs(word) < abs(htonl(word)) ? word : ^ usr.bin/locate/locate/util.c:274:32: note: remove the call to 'abs' since unsigned values cannot be negative MAXPATHLEN, abs(word) < abs(htonl(word)) ? word : ^~~ The problem is that ntohl() always returns an unsigned quantity. In this case, it's expected to be cast back to a signed integer, but to stop complaints about abs() we just store it into an integer, and don't call ntohl() again. Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D1196 Modified: stable/10/usr.bin/locate/locate/util.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/7/usr.bin/locate/locate/util.c stable/8/usr.bin/locate/locate/util.c stable/9/usr.bin/locate/locate/util.c Directory Properties: stable/7/usr.bin/locate/ (props changed) stable/8/usr.bin/locate/ (props changed) stable/9/usr.bin/locate/ (props changed) Modified: stable/10/usr.bin/locate/locate/util.c ============================================================================== --- stable/10/usr.bin/locate/locate/util.c Tue Nov 25 12:44:18 2014 (r275033) +++ stable/10/usr.bin/locate/locate/util.c Tue Nov 25 12:45:31 2014 (r275034) @@ -235,7 +235,7 @@ getwm(p) char buf[INTSIZE]; int i; } u; - register int i; + register int i, hi; for (i = 0; i < (int)INTSIZE; i++) u.buf[i] = *p++; @@ -243,10 +243,11 @@ getwm(p) i = u.i; if (i > MAXPATHLEN || i < -(MAXPATHLEN)) { - i = ntohl(i); - if (i > MAXPATHLEN || i < -(MAXPATHLEN)) + hi = ntohl(i); + if (hi > MAXPATHLEN || hi < -(MAXPATHLEN)) errx(1, "integer out of +-MAXPATHLEN (%d): %u", - MAXPATHLEN, abs(i) < abs(htonl(i)) ? i : htonl(i)); + MAXPATHLEN, abs(i) < abs(hi) ? i : hi); + return(hi); } return(i); } @@ -263,16 +264,16 @@ int getwf(fp) FILE *fp; { - register int word; + register int word, hword; word = getw(fp); if (word > MAXPATHLEN || word < -(MAXPATHLEN)) { - word = ntohl(word); - if (word > MAXPATHLEN || word < -(MAXPATHLEN)) + hword = ntohl(word); + if (hword > MAXPATHLEN || hword < -(MAXPATHLEN)) errx(1, "integer out of +-MAXPATHLEN (%d): %u", - MAXPATHLEN, abs(word) < abs(htonl(word)) ? word : - htonl(word)); + MAXPATHLEN, abs(word) < abs(hword) ? word : hword); + return(hword); } return(word); } From owner-svn-src-stable-10@FreeBSD.ORG Tue Nov 25 12:58:22 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6DAEFD8D; Tue, 25 Nov 2014 12:58:22 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 58F9C6A8; Tue, 25 Nov 2014 12:58:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAPCwM9o047053; Tue, 25 Nov 2014 12:58:22 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAPCwMtq047052; Tue, 25 Nov 2014 12:58:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201411251258.sAPCwMtq047052@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 25 Nov 2014 12:58:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275036 - in stable: 10/contrib/binutils/gas/config 9/contrib/binutils/gas/config X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2014 12:58:22 -0000 Author: dim Date: Tue Nov 25 12:58:21 2014 New Revision: 275036 URL: https://svnweb.freebsd.org/changeset/base/275036 Log: MFC r274856: Avoid undefined behaviour in gas's rotate_left() macro for n == 0. Otherwise, clang can effectively remove the first iteration of the for loops where this macro is invoked, and as a result, "cmp r0, #99" fails to assemble. Obtained from: joerg at netbsd Modified: stable/10/contrib/binutils/gas/config/tc-arm.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/9/contrib/binutils/gas/config/tc-arm.c Directory Properties: stable/9/contrib/binutils/ (props changed) Modified: stable/10/contrib/binutils/gas/config/tc-arm.c ============================================================================== --- stable/10/contrib/binutils/gas/config/tc-arm.c Tue Nov 25 12:52:00 2014 (r275035) +++ stable/10/contrib/binutils/gas/config/tc-arm.c Tue Nov 25 12:58:21 2014 (r275036) @@ -6062,7 +6062,7 @@ parse_operands (char *str, const unsigne /* Functions for operand encoding. ARM, then Thumb. */ -#define rotate_left(v, n) (v << n | v >> (32 - n)) +#define rotate_left(v, n) (v << (n % 32) | v >> ((32 - n) % 32)) /* If VAL can be encoded in the immediate field of an ARM instruction, return the encoded form. Otherwise, return FAIL. */ From owner-svn-src-stable-10@FreeBSD.ORG Tue Nov 25 13:12:47 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AAE3E449; Tue, 25 Nov 2014 13:12:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 961F08DA; Tue, 25 Nov 2014 13:12:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAPDCljt056184; Tue, 25 Nov 2014 13:12:47 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAPDClgm056183; Tue, 25 Nov 2014 13:12:47 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201411251312.sAPDClgm056183@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 25 Nov 2014 13:12:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275038 - in stable: 10/usr.sbin/rtadvd 8/usr.sbin/rtadvd 9/usr.sbin/rtadvd X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2014 13:12:47 -0000 Author: dim Date: Tue Nov 25 13:12:45 2014 New Revision: 275038 URL: https://svnweb.freebsd.org/changeset/base/275038 Log: MFC r274898: Fix the following -Werror warnings from clang 3.5.0, while building usr.sbin/rtadvd: usr.sbin/rtadvd/rtadvd.c:1291:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value] abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) { ^ usr.sbin/rtadvd/rtadvd.c:1291:7: note: remove the call to 'abs' since unsigned values cannot be negative abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) { ^~~ usr.sbin/rtadvd/rtadvd.c:1324:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value] abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) { ^ usr.sbin/rtadvd/rtadvd.c:1324:7: note: remove the call to 'abs' since unsigned values cannot be negative abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) { ^~~ 2 errors generated. These warnings occur because both preferred_time and pfx_pltimeexpire are uint32_t's, so the subtraction expression is also unsigned, and calling abs() is a no-op. However, the intention was to look at the absolute difference between the two unsigned quantities. Introduce a small static function to clarify what we're doing, and call that instead. Reviewed by: hrs Differential Revision: https://reviews.freebsd.org/D1197 Modified: stable/10/usr.sbin/rtadvd/rtadvd.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/8/usr.sbin/rtadvd/rtadvd.c stable/9/usr.sbin/rtadvd/rtadvd.c Directory Properties: stable/8/usr.sbin/rtadvd/ (props changed) stable/9/usr.sbin/rtadvd/ (props changed) Modified: stable/10/usr.sbin/rtadvd/rtadvd.c ============================================================================== --- stable/10/usr.sbin/rtadvd/rtadvd.c Tue Nov 25 13:06:47 2014 (r275037) +++ stable/10/usr.sbin/rtadvd/rtadvd.c Tue Nov 25 13:12:45 2014 (r275038) @@ -1230,6 +1230,12 @@ ra_input(int len, struct nd_router_adver return; } +static uint32_t +udiff(uint32_t u, uint32_t v) +{ + return (u >= v ? u - v : v - u); +} + /* return a non-zero value if the received prefix is inconsitent with ours */ static int prefix_check(struct nd_opt_prefix_info *pinfo, @@ -1288,7 +1294,7 @@ prefix_check(struct nd_opt_prefix_info * preferred_time += now.tv_sec; if (!pfx->pfx_timer && rai->rai_clockskew && - abs(preferred_time - pfx->pfx_pltimeexpire) > rai->rai_clockskew) { + udiff(preferred_time, pfx->pfx_pltimeexpire) > rai->rai_clockskew) { syslog(LOG_INFO, "<%s> preferred lifetime for %s/%d" " (decr. in real time) inconsistent on %s:" @@ -1321,7 +1327,7 @@ prefix_check(struct nd_opt_prefix_info * valid_time += now.tv_sec; if (!pfx->pfx_timer && rai->rai_clockskew && - abs(valid_time - pfx->pfx_vltimeexpire) > rai->rai_clockskew) { + udiff(valid_time, pfx->pfx_vltimeexpire) > rai->rai_clockskew) { syslog(LOG_INFO, "<%s> valid lifetime for %s/%d" " (decr. in real time) inconsistent on %s:" From owner-svn-src-stable-10@FreeBSD.ORG Tue Nov 25 13:29:16 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 22F5BAD8; Tue, 25 Nov 2014 13:29:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E726FA8D; Tue, 25 Nov 2014 13:29:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAPDTF7T061882; Tue, 25 Nov 2014 13:29:15 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAPDTFo0061881; Tue, 25 Nov 2014 13:29:15 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201411251329.sAPDTFo0061881@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Tue, 25 Nov 2014 13:29:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275039 - in stable: 10/usr.sbin/bsnmpd/modules/snmp_hostres 7/usr.sbin/bsnmpd/modules/snmp_hostres 8/usr.sbin/bsnmpd/modules/snmp_hostres 9/usr.sbin/bsnmpd/modules/snmp_hostres X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2014 13:29:16 -0000 Author: dim Date: Tue Nov 25 13:29:13 2014 New Revision: 275039 URL: https://svnweb.freebsd.org/changeset/base/275039 Log: MFC r274900: Fix the following -Werror warnings from clang 3.5.0, while building bsnmpd's snmp_hostres module: usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:204:20: error: absolute value function 'abs' given an argument of type 'const long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value] str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600); ^ usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:204:20: note: use function 'labs' instead str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600); ^~~ labs usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:205:22: error: absolute value function 'abs' given an argument of type 'const long' but has parameter of type 'int' which may cause truncation of value [-Werror,-Wabsolute-value] str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60); ^ usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c:205:22: note: use function 'labs' instead str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60); ^~~ labs Since tm::tm_gmtoff is a long, use labs(3) instead. Modified: stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/7/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c stable/8/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c stable/9/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c Directory Properties: stable/7/usr.sbin/bsnmpd/ (props changed) stable/8/usr.sbin/bsnmpd/ (props changed) stable/9/usr.sbin/bsnmpd/ (props changed) Modified: stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c ============================================================================== --- stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c Tue Nov 25 13:12:45 2014 (r275038) +++ stable/10/usr.sbin/bsnmpd/modules/snmp_hostres/hostres_snmp.c Tue Nov 25 13:29:13 2014 (r275039) @@ -201,8 +201,8 @@ make_date_time(u_char *str, const struct else str[8] = '+'; - str[9] = (u_char)(abs(tm->tm_gmtoff) / 3600); - str[10] = (u_char)((abs(tm->tm_gmtoff) % 3600) / 60); + str[9] = (u_char)(labs(tm->tm_gmtoff) / 3600); + str[10] = (u_char)((labs(tm->tm_gmtoff) % 3600) / 60); return (11); } From owner-svn-src-stable-10@FreeBSD.ORG Tue Nov 25 13:47:57 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E74CF543; Tue, 25 Nov 2014 13:47:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D12DDCC3; Tue, 25 Nov 2014 13:47:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAPDlvCw071932; Tue, 25 Nov 2014 13:47:57 GMT (envelope-from dteske@FreeBSD.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAPDls67071916; Tue, 25 Nov 2014 13:47:54 GMT (envelope-from dteske@FreeBSD.org) Message-Id: <201411251347.sAPDls67071916@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: dteske set sender to dteske@FreeBSD.org using -f From: Devin Teske Date: Tue, 25 Nov 2014 13:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275040 - in stable/10: . gnu/lib/libdialog lib lib/libdpv lib/libfigpar share/mk sys/sys usr.bin usr.bin/dpv X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2014 13:47:58 -0000 Author: dteske Date: Tue Nov 25 13:47:53 2014 New Revision: 275040 URL: https://svnweb.freebsd.org/changeset/base/275040 Log: MFC r274116: Add new libraries/utilities for data throughput visualization. dpv(3): dialog progress view library dpv(1): stream data from stdin or multiple paths with dialog progress view figpar(3): configuration file parsing library MFC r274120, r274121, r274123, r274124, r274144, r274146, r274159, r274192, r274203, r274209, r274226, r274270, and r274851: Fixes following r274116 Reviews: D714 Relnotes: New libdpv/libfigpar and dpv(1) utility Reviewed by: jelischer, shurd Discussed at: MeetBSD California 2014 Vendor/Dev Summit Discussed on: -current Thanks to: ngie, ian, jelischer, shurd, bapt Added: stable/10/lib/libdpv/ - copied from r274116, head/lib/libdpv/ stable/10/lib/libfigpar/ - copied from r274116, head/lib/libfigpar/ stable/10/usr.bin/dpv/ - copied from r274116, head/usr.bin/dpv/ Modified: stable/10/Makefile.inc1 stable/10/gnu/lib/libdialog/Makefile stable/10/lib/Makefile stable/10/lib/libdpv/Makefile stable/10/lib/libdpv/dialog_util.c stable/10/lib/libdpv/dialogrc.c stable/10/lib/libdpv/dialogrc.h stable/10/lib/libdpv/dpv.c stable/10/share/mk/bsd.libnames.mk stable/10/sys/sys/param.h stable/10/usr.bin/Makefile stable/10/usr.bin/dpv/Makefile stable/10/usr.bin/dpv/dpv.c Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Tue Nov 25 13:29:13 2014 (r275039) +++ stable/10/Makefile.inc1 Tue Nov 25 13:47:53 2014 (r275040) @@ -1510,6 +1510,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 ${_lib_atf} \ lib/libbz2 ${_libcom_err} lib/libcrypt \ lib/libelf lib/libexpat \ + lib/libfigpar \ ${_lib_libgssapi} ${_lib_libipx} \ lib/libkiconv lib/libkvm lib/liblzma lib/libmd \ lib/ncurses/ncurses lib/ncurses/ncursesw \ @@ -1520,7 +1521,8 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 ${_cddl_lib_libzfs_core} \ lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ ${_secure_lib_libcrypto} ${_lib_libldns} \ - ${_secure_lib_libssh} ${_secure_lib_libssl} + ${_secure_lib_libssh} ${_secure_lib_libssl} \ + gnu/lib/libdialog .if ${MK_GNUCXX} != no _prebuild_libs+= gnu/lib/libstdc++ gnu/lib/libsupc++ gnu/lib/libstdc++__L: lib/msun__L @@ -1637,6 +1639,8 @@ _lib_libypclnt= lib/libypclnt lib/libradius__L: lib/libmd__L .endif +gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw__L + .for _lib in ${_prereq_libs} ${_lib}__PL: .PHONY .MAKE .if exists(${.CURDIR}/${_lib}) Modified: stable/10/gnu/lib/libdialog/Makefile ============================================================================== --- stable/10/gnu/lib/libdialog/Makefile Tue Nov 25 13:29:13 2014 (r275039) +++ stable/10/gnu/lib/libdialog/Makefile Tue Nov 25 13:47:53 2014 (r275040) @@ -13,6 +13,9 @@ SRCS= argv.c arrows.c buildlist.c butto INCS= dialog.h dlg_colors.h dlg_config.h dlg_keys.h MAN= dialog.3 +DPADD= ${LIBNCURSESW} ${LIBM} +LDADD= -lncursesw -lm + CFLAGS+= -I${.CURDIR} -I${DIALOG} -D_XOPEN_SOURCE_EXTENDED -DGCC_UNUSED=__unused .PATH: ${DIALOG} WARNS?= 1 Modified: stable/10/lib/Makefile ============================================================================== --- stable/10/lib/Makefile Tue Nov 25 13:29:13 2014 (r275039) +++ stable/10/lib/Makefile Tue Nov 25 13:47:53 2014 (r275040) @@ -39,12 +39,14 @@ SUBDIR= ${SUBDIR_ORDERED} \ libcrypt \ libdevinfo \ libdevstat \ + libdpv \ libdwarf \ libedit \ ${_libefi} \ libexecinfo \ libexpat \ libfetch \ + libfigpar \ libgeom \ ${_libgpib} \ ${_libgssapi} \ @@ -121,7 +123,7 @@ SUBDIR_DEPEND_libc++= libcxxrt SUBDIR_DEPEND_libc= libcompiler_rt SUBDIR_DEPEND_libcam= libsbuf SUBDIR_DEPEND_libdevstat= libkvm -SUBDIR_DEPEND_libdiaglog= ncurses +SUBDIR_DEPEND_libdpv= libfigpar ncurses libutil SUBDIR_DEPEND_libedit= ncurses SUBDIR_DEPEND_libg++= msun SUBDIR_DEPEND_libgeom= libexpat libsbuf Modified: stable/10/lib/libdpv/Makefile ============================================================================== --- head/lib/libdpv/Makefile Tue Nov 4 23:46:01 2014 (r274116) +++ stable/10/lib/libdpv/Makefile Tue Nov 25 13:47:53 2014 (r275040) @@ -6,11 +6,13 @@ INCS= dpv.h MAN= dpv.3 MLINKS= dpv.3 dpv_free.3 -CFLAGS+= -I${.CURDIR} -LDFLAGS+= -ldialog -lfigpar -lncurses -lutil +DPADD= ${LIBDIALOG} ${LIBFIGPAR} ${LIBNCURSESW} ${LIBUTIL} +LDADD= -ldialog -lfigpar -lncursesw -lutil SRCS= dialog_util.c dialogrc.c dprompt.c dpv.c status.c util.c +CFLAGS+= -I${.CURDIR} + WARNS?= 6 .include Modified: stable/10/lib/libdpv/dialog_util.c ============================================================================== --- head/lib/libdpv/dialog_util.c Tue Nov 4 23:46:01 2014 (r274116) +++ stable/10/lib/libdpv/dialog_util.c Tue Nov 25 13:47:53 2014 (r275040) @@ -62,7 +62,7 @@ char *title = NULL; char *backtitle = NULL; int dheight = 0; int dwidth = 0; -char *dargv[64] = { NULL }; +static char *dargv[64] = { NULL }; /* TTY/Screen characteristics */ static struct winsize *maxsize = NULL; Modified: stable/10/lib/libdpv/dialogrc.c ============================================================================== --- head/lib/libdpv/dialogrc.c Tue Nov 4 23:46:01 2014 (r274116) +++ stable/10/lib/libdpv/dialogrc.c Tue Nov 25 13:47:53 2014 (r275040) @@ -49,58 +49,58 @@ char gauge_color[STR_BUFSIZE] = "47b"; / char separator[STR_BUFSIZE] = ""; /* Function prototypes */ -static int setattr(struct config *, uint32_t, char *, char *); -static int setbool(struct config *, uint32_t, char *, char *); -static int setnum(struct config *, uint32_t, char *, char *); -static int setstr(struct config *, uint32_t, char *, char *); +static int setattr(struct fp_config *, uint32_t, char *, char *); +static int setbool(struct fp_config *, uint32_t, char *, char *); +static int setnum(struct fp_config *, uint32_t, char *, char *); +static int setstr(struct fp_config *, uint32_t, char *, char *); /* * Anatomy of DIALOGRC (~/.dialogrc by default) * NOTE: Must appear after private function prototypes (above) * NB: Brace-initialization of union requires cast to *first* member of union */ -static struct config dialogrc_config[] = { - /* TYPE Directive DEFAULT HANDLER */ - {TYPE_INT, "aspect", {(void *)0}, &setnum}, - {TYPE_STR, "separate_widget", {separator}, &setstr}, - {TYPE_INT, "tab_len", {(void *)0}, &setnum}, - {TYPE_BOOL, "visit_items", {(void *)0}, &setbool}, - {TYPE_BOOL, "use_shadow", {(void *)1}, &setbool}, - {TYPE_BOOL, "use_colors", {(void *)1}, &setbool}, - {TYPE_STR, "screen_color", {NULL}, &setattr}, - {TYPE_STR, "shadow_color", {NULL}, &setattr}, - {TYPE_STR, "dialog_color", {NULL}, &setattr}, - {TYPE_STR, "title_color", {NULL}, &setattr}, - {TYPE_STR, "border_color", {NULL}, &setattr}, - {TYPE_STR, "button_active_color", {NULL}, &setattr}, - {TYPE_STR, "button_inactive_color", {NULL}, &setattr}, - {TYPE_STR, "button_key_active_color", {NULL}, &setattr}, - {TYPE_STR, "button_key_inactive_color", {NULL}, &setattr}, - {TYPE_STR, "button_label_active_color", {NULL}, &setattr}, - {TYPE_STR, "button_label_inactive_color", {NULL}, &setattr}, - {TYPE_STR, "inputbox_color", {NULL}, &setattr}, - {TYPE_STR, "inputbox_border_color", {NULL}, &setattr}, - {TYPE_STR, "searchbox_color", {NULL}, &setattr}, - {TYPE_STR, "searchbox_title_color", {NULL}, &setattr}, - {TYPE_STR, "searchbox_border_color", {NULL}, &setattr}, - {TYPE_STR, "position_indicator_color", {NULL}, &setattr}, - {TYPE_STR, "menubox_color", {NULL}, &setattr}, - {TYPE_STR, "menubox_border_color", {NULL}, &setattr}, - {TYPE_STR, "item_color", {NULL}, &setattr}, - {TYPE_STR, "item_selected_color", {NULL}, &setattr}, - {TYPE_STR, "tag_color", {NULL}, &setattr}, - {TYPE_STR, "tag_selected_color", {NULL}, &setattr}, - {TYPE_STR, "tag_key_color", {NULL}, &setattr}, - {TYPE_STR, "tag_key_selected_color", {NULL}, &setattr}, - {TYPE_STR, "check_color", {NULL}, &setattr}, - {TYPE_STR, "check_selected_color", {NULL}, &setattr}, - {TYPE_STR, "uarrow_color", {NULL}, &setattr}, - {TYPE_STR, "darrow_color", {NULL}, &setattr}, - {TYPE_STR, "itemhelp_color", {NULL}, &setattr}, - {TYPE_STR, "form_active_text_color", {NULL}, &setattr}, - {TYPE_STR, "form_text_color", {NULL}, &setattr}, - {TYPE_STR, "form_item_readonly_color", {NULL}, &setattr}, - {TYPE_STR, "gauge_color", {gauge_color}, &setattr}, +static struct fp_config dialogrc_config[] = { + /* TYPE Directive DEFAULT HANDLER */ + {FP_TYPE_INT, "aspect", {(void *)0}, &setnum}, + {FP_TYPE_STR, "separate_widget", {separator}, &setstr}, + {FP_TYPE_INT, "tab_len", {(void *)0}, &setnum}, + {FP_TYPE_BOOL, "visit_items", {(void *)0}, &setbool}, + {FP_TYPE_BOOL, "use_shadow", {(void *)1}, &setbool}, + {FP_TYPE_BOOL, "use_colors", {(void *)1}, &setbool}, + {FP_TYPE_STR, "screen_color", {NULL}, &setattr}, + {FP_TYPE_STR, "shadow_color", {NULL}, &setattr}, + {FP_TYPE_STR, "dialog_color", {NULL}, &setattr}, + {FP_TYPE_STR, "title_color", {NULL}, &setattr}, + {FP_TYPE_STR, "border_color", {NULL}, &setattr}, + {FP_TYPE_STR, "button_active_color", {NULL}, &setattr}, + {FP_TYPE_STR, "button_inactive_color", {NULL}, &setattr}, + {FP_TYPE_STR, "button_key_active_color", {NULL}, &setattr}, + {FP_TYPE_STR, "button_key_inactive_color", {NULL}, &setattr}, + {FP_TYPE_STR, "button_label_active_color", {NULL}, &setattr}, + {FP_TYPE_STR, "button_label_inactive_color",{NULL}, &setattr}, + {FP_TYPE_STR, "inputbox_color", {NULL}, &setattr}, + {FP_TYPE_STR, "inputbox_border_color", {NULL}, &setattr}, + {FP_TYPE_STR, "searchbox_color", {NULL}, &setattr}, + {FP_TYPE_STR, "searchbox_title_color", {NULL}, &setattr}, + {FP_TYPE_STR, "searchbox_border_color", {NULL}, &setattr}, + {FP_TYPE_STR, "position_indicator_color", {NULL}, &setattr}, + {FP_TYPE_STR, "menubox_color", {NULL}, &setattr}, + {FP_TYPE_STR, "menubox_border_color", {NULL}, &setattr}, + {FP_TYPE_STR, "item_color", {NULL}, &setattr}, + {FP_TYPE_STR, "item_selected_color", {NULL}, &setattr}, + {FP_TYPE_STR, "tag_color", {NULL}, &setattr}, + {FP_TYPE_STR, "tag_selected_color", {NULL}, &setattr}, + {FP_TYPE_STR, "tag_key_color", {NULL}, &setattr}, + {FP_TYPE_STR, "tag_key_selected_color", {NULL}, &setattr}, + {FP_TYPE_STR, "check_color", {NULL}, &setattr}, + {FP_TYPE_STR, "check_selected_color", {NULL}, &setattr}, + {FP_TYPE_STR, "uarrow_color", {NULL}, &setattr}, + {FP_TYPE_STR, "darrow_color", {NULL}, &setattr}, + {FP_TYPE_STR, "itemhelp_color", {NULL}, &setattr}, + {FP_TYPE_STR, "form_active_text_color", {NULL}, &setattr}, + {FP_TYPE_STR, "form_text_color", {NULL}, &setattr}, + {FP_TYPE_STR, "form_item_readonly_color", {NULL}, &setattr}, + {FP_TYPE_STR, "gauge_color", {gauge_color}, &setattr}, {0, NULL, {0}, NULL} }; @@ -108,7 +108,7 @@ static struct config dialogrc_config[] = * figpar call-back for interpreting value as .dialogrc `Attribute' */ static int -setattr(struct config *option, uint32_t line __unused, +setattr(struct fp_config *option, uint32_t line __unused, char *directive __unused, char *value) { char *cp = value; @@ -204,7 +204,7 @@ write_attrbuf: * figpar call-back for interpreting value as .dialogrc `Boolean' */ static int -setbool(struct config *option, uint32_t line __unused, +setbool(struct fp_config *option, uint32_t line __unused, char *directive __unused, char *value) { @@ -227,8 +227,8 @@ setbool(struct config *option, uint32_t * figpar call-back for interpreting value as .dialogrc `Number' */ static int -setnum(struct config *option, uint32_t line __unused, char *directive __unused, - char *value) +setnum(struct fp_config *option, uint32_t line __unused, + char *directive __unused, char *value) { if (option == NULL) { @@ -247,8 +247,8 @@ setnum(struct config *option, uint32_t l * figpar call-back for interpreting value as .dialogrc `String' */ static int -setstr(struct config *option, uint32_t line __unused, char *directive __unused, - char *value) +setstr(struct fp_config *option, uint32_t line __unused, + char *directive __unused, char *value) { size_t len; @@ -315,7 +315,7 @@ parse_dialogrc(void) } /* Process file (either $DIALOGRC if set, or `$HOME/.dialogrc') */ - res = parse_config(dialogrc_config, path, NULL, BREAK_ON_EQUALS); + res = parse_config(dialogrc_config, path, NULL, FP_BREAK_ON_EQUALS); /* Set some globals based on what we parsed */ use_shadow = dialogrc_config_option("use_shadow")->value.boolean; @@ -328,10 +328,10 @@ parse_dialogrc(void) /* * Return a pointer to the `.dialogrc' config option specific to `directive' or - * static dummy_config (full of NULLs) if none found (see get_config_option(3); - * part of figpar(3)). + * static fp_dummy_config (full of NULLs) if none found (see + * get_config_option(3); part of figpar(3)). */ -struct config * +struct fp_config * dialogrc_config_option(const char *directive) { return (get_config_option(dialogrc_config, directive)); Modified: stable/10/lib/libdpv/dialogrc.h ============================================================================== --- head/lib/libdpv/dialogrc.h Tue Nov 4 23:46:01 2014 (r274116) +++ stable/10/lib/libdpv/dialogrc.h Tue Nov 25 13:47:53 2014 (r275040) @@ -48,9 +48,9 @@ extern char gauge_color[]; extern char separator[]; __BEGIN_DECLS -void dialogrc_free(void); -int parse_dialogrc(void); -struct config *dialogrc_config_option(const char *_directive); +void dialogrc_free(void); +int parse_dialogrc(void); +struct fp_config *dialogrc_config_option(const char *_directive); __END_DECLS #endif /* !_DIALOGRC_H_ */ Modified: stable/10/lib/libdpv/dpv.c ============================================================================== --- head/lib/libdpv/dpv.c Tue Nov 4 23:46:01 2014 (r274116) +++ stable/10/lib/libdpv/dpv.c Tue Nov 25 13:47:53 2014 (r275040) @@ -77,8 +77,8 @@ char *msg_pending = NULL; /* dpv_config. char *pprompt = NULL; /* dpv_config.pprompt */ /* Status-Line format for when using dialog(3) */ -const char *status_format_custom = NULL; -char status_format_default[DPV_STATUS_FORMAT_MAX]; +static const char *status_format_custom = NULL; +static char status_format_default[DPV_STATUS_FORMAT_MAX]; /* * Takes a pointer to a dpv_config structure containing layout details and Modified: stable/10/share/mk/bsd.libnames.mk ============================================================================== --- stable/10/share/mk/bsd.libnames.mk Tue Nov 25 13:29:13 2014 (r275039) +++ stable/10/share/mk/bsd.libnames.mk Tue Nov 25 13:47:53 2014 (r275040) @@ -42,12 +42,14 @@ LIBDEVINFO?= ${DESTDIR}${LIBDIR}/libdevi LIBDEVSTAT?= ${DESTDIR}${LIBDIR}/libdevstat.a LIBDIALOG?= ${DESTDIR}${LIBDIR}/libdialog.a LIBDNS?= ${DESTDIR}${LIBDIR}/libdns.a +LIBDPV?= ${DESTDIR}${LIBDIR}/libdpv.a LIBDTRACE?= ${DESTDIR}${LIBDIR}/libdtrace.a LIBDWARF?= ${DESTDIR}${LIBDIR}/libdwarf.a LIBEDIT?= ${DESTDIR}${LIBDIR}/libedit.a LIBELF?= ${DESTDIR}${LIBDIR}/libelf.a LIBEXECINFO?= ${DESTDIR}${LIBDIR}/libexecinfo.a LIBFETCH?= ${DESTDIR}${LIBDIR}/libfetch.a +LIBFIGPAR?= ${DESTDIR}${LIBDIR}/libfigpar.a LIBFL?= "don't use LIBFL, use LIBL" LIBFORM?= ${DESTDIR}${LIBDIR}/libform.a LIBG2C?= ${DESTDIR}${LIBDIR}/libg2c.a Modified: stable/10/sys/sys/param.h ============================================================================== --- stable/10/sys/sys/param.h Tue Nov 25 13:29:13 2014 (r275039) +++ stable/10/sys/sys/param.h Tue Nov 25 13:47:53 2014 (r275040) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1001502 /* Master, propagated to newvers */ +#define __FreeBSD_version 1001503 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, Modified: stable/10/usr.bin/Makefile ============================================================================== --- stable/10/usr.bin/Makefile Tue Nov 25 13:29:13 2014 (r275039) +++ stable/10/usr.bin/Makefile Tue Nov 25 13:47:53 2014 (r275040) @@ -36,6 +36,7 @@ SUBDIR= alias \ ctlstat \ cut \ dirname \ + dpv \ du \ ee \ elf2aout \ Modified: stable/10/usr.bin/dpv/Makefile ============================================================================== --- head/usr.bin/dpv/Makefile Tue Nov 4 23:46:01 2014 (r274116) +++ stable/10/usr.bin/dpv/Makefile Tue Nov 25 13:47:53 2014 (r275040) @@ -4,8 +4,8 @@ PROG= dpv CFLAGS+= -I${.CURDIR} -DPADD+= ${LIBDPV} ${LIBDIALOG} ${LIBFIGPAR} ${LIBNCURSES} ${LIBUTIL} -LDADD+= -ldpv -ldialog -lfigpar -lncurses -lutil +DPADD= ${LIBDPV} ${LIBDIALOG} ${LIBFIGPAR} ${LIBNCURSESW} ${LIBUTIL} ${LIBM} +LDADD= -ldpv -ldialog -lfigpar -lncursesw -lutil -lm WARNS?= 6 Modified: stable/10/usr.bin/dpv/dpv.c ============================================================================== --- head/usr.bin/dpv/dpv.c Tue Nov 4 23:46:01 2014 (r274116) +++ stable/10/usr.bin/dpv/dpv.c Tue Nov 25 13:47:53 2014 (r275040) @@ -177,7 +177,7 @@ operate_on_bytes(struct dpv_file_node *f fsync(out); } - overall_read += r; + dpv_overall_read += r; file->read += r; /* Calculate percentage of completion (if possible) */ @@ -226,7 +226,7 @@ operate_on_lines(struct dpv_file_node *f /* Process the buffer for number of lines */ for (p = buf; p != NULL && *p != '\0';) if ((p = strchr(p, '\n')) != NULL) - overall_read++, p++, file->read++; + dpv_overall_read++, p++, file->read++; /* Calculate percentage of completion (if possible) */ if (file->length >= 0) { From owner-svn-src-stable-10@FreeBSD.ORG Tue Nov 25 16:11:14 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 696DD118 for ; Tue, 25 Nov 2014 16:11:14 +0000 (UTC) Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 35342F16 for ; Tue, 25 Nov 2014 16:11:14 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 175B820A05 for ; Tue, 25 Nov 2014 11:11:11 -0500 (EST) Received: from web6 ([10.202.2.216]) by compute4.internal (MEProxy); Tue, 25 Nov 2014 11:11:11 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.net; h= message-id:x-sasl-enc:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=mesmtp; bh=O18jIn/5YnloeRajnjv09JKiHXY=; b=E47X M/pP1c3LeEfX4lL+JahmUa/k5bw8S9qPSu1YJZ8k7KBYL/dH7Oq274EB33ZpRb6i 7tSA5mXU+vEp1LRdXhkCYcqwrg0bI0nL5RLJuDnhZFmcvUiWAcfQtLsSwRjF7+Xi pX2hAIAyYLeNj1EdNOZX8OGwbamHkxpmOa1+7ag= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:x-sasl-enc:from:to :mime-version:content-transfer-encoding:content-type:in-reply-to :references:subject:date; s=smtpout; bh=O18jIn/5YnloeRajnjv09JKi HXY=; b=DMPp5mny3UscifU2vRmQ8krqNkmfKsnnrBMAKjiqiMioZ4g+UofyklnD EO9DeBWeWZKNQW27QS5xv6b73eACuLGVGVlq5ItM2ky7eoQRbVgAK9IeB4as7Pof 6E2C7+ES8+53CM98qGE16nwenu+fR+hp6W2sOwFmjqgma5UNJZM= Received: by web6.nyi.internal (Postfix, from userid 99) id DC82B4FD38; Tue, 25 Nov 2014 11:11:10 -0500 (EST) Message-Id: <1416931870.3322540.195254433.1209A14B@webmail.messagingengine.com> X-Sasl-Enc: qMgUXTQpDM2agMlR6biy/2YZuF+575101xmM6OIbdFUk 1416931870 From: Bruce Simpson To: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-53201334 In-Reply-To: <201411251312.sAPDClgm056183@svn.freebsd.org> References: <201411251312.sAPDClgm056183@svn.freebsd.org> Subject: Re: svn commit: r275038 - in stable: 10/usr.sbin/rtadvd 8/usr.sbin/rtadvd 9/usr.sbin/rtadvd Date: Tue, 25 Nov 2014 16:11:10 +0000 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2014 16:11:14 -0000 rtadvd(8) has a few other bugs apart from this. It could probably stand to use CLOCK_MONOTONIC where that's possible, also... -- BMS (sent via webmail) From owner-svn-src-stable-10@FreeBSD.ORG Wed Nov 26 00:44:49 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D26C4334; Wed, 26 Nov 2014 00:44:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BE8AADF; Wed, 26 Nov 2014 00:44:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAQ0inIW089619; Wed, 26 Nov 2014 00:44:49 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAQ0inxp089616; Wed, 26 Nov 2014 00:44:49 GMT (envelope-from np@FreeBSD.org) Message-Id: <201411260044.sAQ0inxp089616@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 26 Nov 2014 00:44:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275092 - in stable/10/sys/dev/cxgbe: . common X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2014 00:44:49 -0000 Author: np Date: Wed Nov 26 00:44:48 2014 New Revision: 275092 URL: https://svnweb.freebsd.org/changeset/base/275092 Log: MFC r274724: cxgbe(4): figure out the max payload size and save it for later. Modified: stable/10/sys/dev/cxgbe/common/common.h stable/10/sys/dev/cxgbe/t4_main.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/cxgbe/common/common.h ============================================================================== --- stable/10/sys/dev/cxgbe/common/common.h Wed Nov 26 00:13:51 2014 (r275091) +++ stable/10/sys/dev/cxgbe/common/common.h Wed Nov 26 00:44:48 2014 (r275092) @@ -238,6 +238,7 @@ struct vpd_params { struct pci_params { unsigned int vpd_cap_addr; + unsigned int mps; unsigned short speed; unsigned short width; }; Modified: stable/10/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/10/sys/dev/cxgbe/t4_main.c Wed Nov 26 00:13:51 2014 (r275091) +++ stable/10/sys/dev/cxgbe/t4_main.c Wed Nov 26 00:44:48 2014 (r275092) @@ -590,6 +590,8 @@ t4_attach(device_t dev) v = pci_read_config(dev, i + PCIER_DEVICE_CTL, 2); v |= PCIEM_CTL_RELAXED_ORD_ENABLE; pci_write_config(dev, i + PCIER_DEVICE_CTL, v, 2); + + sc->params.pci.mps = 128 << ((v & PCIEM_CTL_MAX_PAYLOAD) >> 5); } sc->traceq = -1; From owner-svn-src-stable-10@FreeBSD.ORG Wed Nov 26 09:37:36 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E73FBFC8; Wed, 26 Nov 2014 09:37:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B7ED1C1A; Wed, 26 Nov 2014 09:37:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAQ9baMA038100; Wed, 26 Nov 2014 09:37:36 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAQ9bakU038097; Wed, 26 Nov 2014 09:37:36 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201411260937.sAQ9bakU038097@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Wed, 26 Nov 2014 09:37:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275107 - in stable/10/contrib/ofed: librdmacm/examples librdmacm/examples/build usr.lib X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Nov 2014 09:37:37 -0000 Author: hselasky Date: Wed Nov 26 09:37:35 2014 New Revision: 275107 URL: https://svnweb.freebsd.org/changeset/base/275107 Log: MFC r273774: Make some infiniband example utilities easily buildable: - Add new Makefiles. - Add more include directories when building. - Fixed a printf() formatting string. Sponsored by: Mellanox Technologies Added: stable/10/contrib/ofed/librdmacm/examples/build/ - copied from r273774, head/contrib/ofed/librdmacm/examples/build/ Modified: stable/10/contrib/ofed/librdmacm/examples/rping.c stable/10/contrib/ofed/usr.lib/Makefile.inc Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/ofed/librdmacm/examples/rping.c ============================================================================== --- stable/10/contrib/ofed/librdmacm/examples/rping.c Wed Nov 26 08:44:05 2014 (r275106) +++ stable/10/contrib/ofed/librdmacm/examples/rping.c Wed Nov 26 09:37:35 2014 (r275107) @@ -1148,8 +1148,9 @@ int main(int argc, char *argv[]) if ((cb->size < RPING_MIN_BUFSIZE) || (cb->size > (RPING_BUFSIZE - 1))) { fprintf(stderr, "Invalid size %d " - "(valid range is %Zd to %d)\n", - cb->size, RPING_MIN_BUFSIZE, RPING_BUFSIZE); + "(valid range is %d to %d)\n", + (int)cb->size, (int)(RPING_MIN_BUFSIZE), + (int)(RPING_BUFSIZE)); ret = EINVAL; } else DEBUG_LOG("size %d\n", (int) atoi(optarg)); Modified: stable/10/contrib/ofed/usr.lib/Makefile.inc ============================================================================== --- stable/10/contrib/ofed/usr.lib/Makefile.inc Wed Nov 26 08:44:05 2014 (r275106) +++ stable/10/contrib/ofed/usr.lib/Makefile.inc Wed Nov 26 09:37:35 2014 (r275107) @@ -7,11 +7,18 @@ COMPLIBDIR= ${OPENSMDIR}/complib VENDORLIBDIR= ${OPENSMDIR}/libvendor IBVERBSDIR= ${.CURDIR}/../../libibverbs IBINC= ${.CURDIR}/../../include +RDMACMDIR= ${.CURDIR}/../../librdmacm + +CFLAGS+= -I${.CURDIR} \ + -I${IBINC}/infiniband \ + -I${IBINC} \ + -I${IBCOMMONDIR}/include/infiniband \ + -I${IBCOMMONDIR}/include \ + -I${IBMADDIR}/include/infiniband \ + -I${IBMADDIR}/include \ + -I${UMADDIR}/include/infiniband \ + -I${UMADDIR}/include \ + -I${OPENSMDIR}/include \ + -I${RDMACMDIR}/include \ + -I${IBVERBSDIR}/include -CFLAGS+= -I${.CURDIR} -I${IBINC}/infiniband -CFLAGS+= -I${IBCOMMONDIR}/include/infiniband -CFLAGS+= -I${IBMADDIR}/include/infiniband -CFLAGS+= -I${UMADDIR}/include/infiniband -CFLAGS+= -I${OPENSMDIR}/include -# CFLAGS+= -I${UMADDIR}/include -# CFLAGS+= -I${IBVERBSDIR}/include From owner-svn-src-stable-10@FreeBSD.ORG Thu Nov 27 08:41:32 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 20287F9A; Thu, 27 Nov 2014 08:41:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 02CE5F20; Thu, 27 Nov 2014 08:41:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAR8fVOT098596; Thu, 27 Nov 2014 08:41:31 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAR8fVQD098595; Thu, 27 Nov 2014 08:41:31 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201411270841.sAR8fVQD098595@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 27 Nov 2014 08:41:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275179 - stable/10/sbin/fsck X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2014 08:41:32 -0000 Author: ae Date: Thu Nov 27 08:41:31 2014 New Revision: 275179 URL: https://svnweb.freebsd.org/changeset/base/275179 Log: MFC r274750: Use geom attribute "PART::type" to determine partition type and choose relevant fsck_xxx utility. Modified: stable/10/sbin/fsck/fsck.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/fsck/fsck.c ============================================================================== --- stable/10/sbin/fsck/fsck.c Thu Nov 27 08:31:20 2014 (r275178) +++ stable/10/sbin/fsck/fsck.c Thu Nov 27 08:41:31 2014 (r275179) @@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#define FSTYPENAMES -#include +#include #include #include @@ -81,10 +80,21 @@ static void addentry(struct fstypelist * static void maketypelist(char *); static void catopt(char **, const char *); static void mangle(char *, int *, const char ** volatile *, int *); -static const char *getfslab(const char *); +static const char *getfstype(const char *); static void usage(void) __dead2; static int isok(struct fstab *); +static struct { + const char *ptype; + const char *name; +} ptype_map[] = { + { "ufs", "ffs" }, + { "ffs", "ffs" }, + { "fat", "msdosfs" }, + { "efi", "msdosfs" }, + { NULL, NULL }, +}; + int main(int argc, char *argv[]) { @@ -203,7 +213,7 @@ main(int argc, char *argv[]) if ((fs = getfsfile(spec)) == NULL && (fs = getfsspec(spec)) == NULL) { if (vfstype == NULL) - vfstype = getfslab(spec); + vfstype = getfstype(spec); if (vfstype == NULL) errx(1, "Could not determine filesystem type"); type = vfstype; @@ -535,41 +545,27 @@ mangle(char *opts, int *argcp, const cha *maxargcp = maxargc; } - static const char * -getfslab(const char *str) +getfstype(const char *str) { - struct disklabel dl; - int fd; - char p; - const char *vfstype; - u_char t; + struct diocgattr_arg attr; + int fd, i; - /* deduce the file system type from the disk label */ if ((fd = open(str, O_RDONLY)) == -1) err(1, "cannot open `%s'", str); - if (ioctl(fd, DIOCGDINFO, &dl) == -1) { + strncpy(attr.name, "PART::type", sizeof(attr.name)); + memset(&attr.value, 0, sizeof(attr.value)); + attr.len = sizeof(attr.value); + if (ioctl(fd, DIOCGATTR, &attr) == -1) { (void) close(fd); return(NULL); } - (void) close(fd); - - p = str[strlen(str) - 1]; - - if ((p - 'a') >= dl.d_npartitions) - errx(1, "partition `%s' is not defined on disk", str); - - if ((t = dl.d_partitions[p - 'a'].p_fstype) >= FSMAXTYPES) - errx(1, "partition `%s' is not of a legal vfstype", - str); - - if ((vfstype = fstypenames[t]) == NULL) - errx(1, "vfstype `%s' on partition `%s' is not supported", - fstypenames[t], str); - - return vfstype; + for (i = 0; ptype_map[i].ptype != NULL; i++) + if (strstr(attr.value.str, ptype_map[i].ptype) != NULL) + return (ptype_map[i].name); + return (NULL); } From owner-svn-src-stable-10@FreeBSD.ORG Thu Nov 27 10:31:12 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4489BF78; Thu, 27 Nov 2014 10:31:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 310A9CA9; Thu, 27 Nov 2014 10:31:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sARAVCsU051044; Thu, 27 Nov 2014 10:31:12 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sARAVCIq051043; Thu, 27 Nov 2014 10:31:12 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411271031.sARAVCIq051043@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 27 Nov 2014 10:31:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275185 - stable/10/share/man/man4 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2014 10:31:12 -0000 Author: trasz Date: Thu Nov 27 10:31:11 2014 New Revision: 275185 URL: https://svnweb.freebsd.org/changeset/base/275185 Log: MFC r273690: Mention VAAI and ODX in ctl(4). Sponsored by: The FreeBSD Foundation Modified: stable/10/share/man/man4/ctl.4 Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/ctl.4 ============================================================================== --- stable/10/share/man/man4/ctl.4 Thu Nov 27 09:53:17 2014 (r275184) +++ stable/10/share/man/man4/ctl.4 Thu Nov 27 10:31:11 2014 (r275185) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd April 2, 2013 +.Dd October 23, 2014 .Dt CTL 4 .Os .Sh NAME @@ -57,7 +57,7 @@ Tagged queueing .It SCSI task attribute support (ordered, head of queue, simple tags) .It -SCSI implicit command ordering support. +SCSI implicit command ordering support .It Full task management support (abort, LUN reset, target reset, etc.) .It @@ -67,6 +67,12 @@ Support for multiple simultaneous initia .It Support for multiple simultaneous backing stores .It +Support for VMWare VAAI: COMPARE AND WRITE, XCOPY, WRITE SAME, +and UNMAP commands +.It +Support for Microsoft ODX: POPULATE TOKEN/WRITE USING TOKEN, +WRITE SAME, and UNMAP commands +.It Persistent reservation support .It Mode sense/select support From owner-svn-src-stable-10@FreeBSD.ORG Thu Nov 27 10:45:56 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC9E15B2; Thu, 27 Nov 2014 10:45:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B8770ED7; Thu, 27 Nov 2014 10:45:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sARAjuaS056716; Thu, 27 Nov 2014 10:45:56 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sARAjuo6056714; Thu, 27 Nov 2014 10:45:56 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411271045.sARAjuo6056714@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 27 Nov 2014 10:45:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275186 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2014 10:45:56 -0000 Author: trasz Date: Thu Nov 27 10:45:55 2014 New Revision: 275186 URL: https://svnweb.freebsd.org/changeset/base/275186 Log: MFC r273768: Remove the distinction between strings and numbers from ctld(8) yacc parser. This fixes problems with passing strings that look like numbers to clauses that expect strings; previously it caused syntax errors and had to be worked by user, using quotes. The workaround introduced in r267833 is no longer neccessary. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/parse.y stable/10/usr.sbin/ctld/token.l Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/parse.y ============================================================================== --- stable/10/usr.sbin/ctld/parse.y Thu Nov 27 10:31:11 2014 (r275185) +++ stable/10/usr.sbin/ctld/parse.y Thu Nov 27 10:45:55 2014 (r275186) @@ -101,21 +101,45 @@ statement: target ; -debug: DEBUG NUM +debug: DEBUG STR { - conf->conf_debug = $2; + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $2); + free($2); + return (1); + } + + conf->conf_debug = tmp; } ; -timeout: TIMEOUT NUM +timeout: TIMEOUT STR { - conf->conf_timeout = $2; + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $2); + free($2); + return (1); + } + + conf->conf_timeout = tmp; } ; -maxproc: MAXPROC NUM +maxproc: MAXPROC STR { - conf->conf_maxproc = $2; + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $2); + free($2); + return (1); + } + + conf->conf_maxproc = tmp; } ; @@ -583,9 +607,17 @@ target_lun: LUN lun_number } ; -lun_number: NUM +lun_number: STR { - lun = lun_new(target, $1); + uint64_t tmp; + + if (expand_number($1, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $1); + free($1); + return (1); + } + + lun = lun_new(target, tmp); if (lun == NULL) return (1); } @@ -626,15 +658,23 @@ lun_backend: BACKEND STR } ; -lun_blocksize: BLOCKSIZE NUM +lun_blocksize: BLOCKSIZE STR { + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $2); + free($2); + return (1); + } + if (lun->l_blocksize != 0) { log_warnx("blocksize for lun %d, target \"%s\" " "specified more than once", lun->l_lun, target->t_name); return (1); } - lun_set_blocksize(lun, $2); + lun_set_blocksize(lun, tmp); } ; @@ -689,31 +729,26 @@ lun_serial: SERIAL STR } lun_set_serial(lun, $2); free($2); - } | SERIAL NUM + } + ; + +lun_size: SIZE STR { - char *str = NULL; + uint64_t tmp; - if (lun->l_serial != NULL) { - log_warnx("serial for lun %d, target \"%s\" " - "specified more than once", - lun->l_lun, target->t_name); + if (expand_number($2, &tmp) != 0) { + log_warnx("invalid numeric value \"%s\"", $2); + free($2); return (1); } - asprintf(&str, "%ju", $2); - lun_set_serial(lun, str); - free(str); - } - ; -lun_size: SIZE NUM - { if (lun->l_size != 0) { log_warnx("size for lun %d, target \"%s\" " "specified more than once", lun->l_lun, target->t_name); return (1); } - lun_set_size(lun, $2); + lun_set_size(lun, tmp); } ; %% Modified: stable/10/usr.sbin/ctld/token.l ============================================================================== --- stable/10/usr.sbin/ctld/token.l Thu Nov 27 10:31:11 2014 (r275185) +++ stable/10/usr.sbin/ctld/token.l Thu Nov 27 10:45:55 2014 (r275186) @@ -75,12 +75,6 @@ serial { return SERIAL; } size { return SIZE; } target { return TARGET; } timeout { return TIMEOUT; } -[0-9]+[kKmMgGtTpPeE]? { if (expand_number(yytext, &yylval.num) == 0) - return NUM; - else { - yylval.str = strdup(yytext); return STR; - } - } \"[^"]+\" { yylval.str = strndup(yytext + 1, strlen(yytext) - 2); return STR; } [a-zA-Z0-9\.\-_/\:\[\]]+ { yylval.str = strdup(yytext); return STR; } From owner-svn-src-stable-10@FreeBSD.ORG Thu Nov 27 10:48:07 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9F8A57DF; Thu, 27 Nov 2014 10:48:07 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8202DEF6; Thu, 27 Nov 2014 10:48:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sARAm7AL057052; Thu, 27 Nov 2014 10:48:07 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sARAm7kY057051; Thu, 27 Nov 2014 10:48:07 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411271048.sARAm7kY057051@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 27 Nov 2014 10:48:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275187 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2014 10:48:07 -0000 Author: trasz Date: Thu Nov 27 10:48:06 2014 New Revision: 275187 URL: https://svnweb.freebsd.org/changeset/base/275187 Log: MFC r273770: Fix build after previous commit. While here, improve error messages. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/parse.y Modified: stable/10/usr.sbin/ctld/parse.y ============================================================================== --- stable/10/usr.sbin/ctld/parse.y Thu Nov 27 10:45:55 2014 (r275186) +++ stable/10/usr.sbin/ctld/parse.y Thu Nov 27 10:48:06 2014 (r275187) @@ -59,17 +59,15 @@ extern void yyrestart(FILE *); %token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL %token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP INITIATOR_NAME -%token INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC NUM OPENING_BRACKET +%token INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC OPENING_BRACKET %token OPTION PATH PIDFILE PORTAL_GROUP SERIAL SIZE STR TARGET TIMEOUT %token ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT %union { - uint64_t num; char *str; } -%token NUM %token STR %% @@ -106,7 +104,7 @@ debug: DEBUG STR uint64_t tmp; if (expand_number($2, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $2); + yyerror("invalid numeric value"); free($2); return (1); } @@ -120,7 +118,7 @@ timeout: TIMEOUT STR uint64_t tmp; if (expand_number($2, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $2); + yyerror("invalid numeric value"); free($2); return (1); } @@ -134,7 +132,7 @@ maxproc: MAXPROC STR uint64_t tmp; if (expand_number($2, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $2); + yyerror("invalid numeric value"); free($2); return (1); } @@ -165,15 +163,31 @@ isns_server: ISNS_SERVER STR } ; -isns_period: ISNS_PERIOD NUM +isns_period: ISNS_PERIOD STR { - conf->conf_isns_period = $2; + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + yyerror("invalid numeric value"); + free($2); + return (1); + } + + conf->conf_isns_period = tmp; } ; -isns_timeout: ISNS_TIMEOUT NUM +isns_timeout: ISNS_TIMEOUT STR { - conf->conf_isns_timeout = $2; + uint64_t tmp; + + if (expand_number($2, &tmp) != 0) { + yyerror("invalid numeric value"); + free($2); + return (1); + } + + conf->conf_isns_timeout = tmp; } ; @@ -612,7 +626,7 @@ lun_number: STR uint64_t tmp; if (expand_number($1, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $1); + yyerror("invalid numeric value"); free($1); return (1); } @@ -663,7 +677,7 @@ lun_blocksize: BLOCKSIZE STR uint64_t tmp; if (expand_number($2, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $2); + yyerror("invalid numeric value"); free($2); return (1); } @@ -737,7 +751,7 @@ lun_size: SIZE STR uint64_t tmp; if (expand_number($2, &tmp) != 0) { - log_warnx("invalid numeric value \"%s\"", $2); + yyerror("invalid numeric value"); free($2); return (1); } From owner-svn-src-stable-10@FreeBSD.ORG Thu Nov 27 10:51:11 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 44C1E94D; Thu, 27 Nov 2014 10:51:11 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 175CDFA8; Thu, 27 Nov 2014 10:51:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sARApALp057973; Thu, 27 Nov 2014 10:51:10 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sARApAOg057972; Thu, 27 Nov 2014 10:51:10 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411271051.sARApAOg057972@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Thu, 27 Nov 2014 10:51:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275188 - stable/10 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Nov 2014 10:51:11 -0000 Author: trasz Date: Thu Nov 27 10:51:10 2014 New Revision: 275188 URL: https://svnweb.freebsd.org/changeset/base/275188 Log: I've merged r273770 in a right directory, but committed in a wrong one. Fix it (hopefully). Sponsored by: The FreeBSD Foundation Modified: Directory Properties: stable/10/ (props changed) From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 28 08:52:39 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0F0D510A; Fri, 28 Nov 2014 08:52:39 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EF3317A9; Fri, 28 Nov 2014 08:52:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAS8qcI6084199; Fri, 28 Nov 2014 08:52:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAS8qcpG084198; Fri, 28 Nov 2014 08:52:38 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201411280852.sAS8qcpG084198@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 28 Nov 2014 08:52:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275200 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2014 08:52:39 -0000 Author: mav Date: Fri Nov 28 08:52:38 2014 New Revision: 275200 URL: https://svnweb.freebsd.org/changeset/base/275200 Log: MFC r274786: Log errors for absent LUNs too. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Fri Nov 28 04:07:06 2014 (r275199) +++ stable/10/sys/cam/ctl/ctl.c Fri Nov 28 08:52:38 2014 (r275200) @@ -13681,7 +13681,7 @@ static int ctl_process_done(union ctl_io *io) { struct ctl_lun *lun; - struct ctl_softc *ctl_softc; + struct ctl_softc *ctl_softc = control_softc; void (*fe_done)(union ctl_io *io); uint32_t targ_port = ctl_port_idx(io->io_hdr.nexus.targ_port); @@ -13747,10 +13747,8 @@ ctl_process_done(union ctl_io *io) if (lun == NULL) { CTL_DEBUG_PRINT(("NULL LUN for lun %d\n", io->io_hdr.nexus.targ_mapped_lun)); - fe_done(io); goto bailout; } - ctl_softc = lun->ctl_softc; mtx_lock(&lun->lun_lock); @@ -13822,6 +13820,8 @@ ctl_process_done(union ctl_io *io) } else mtx_unlock(&lun->lun_lock); +bailout: + /* * If this command has been aborted, make sure we set the status * properly. The FETD is responsible for freeing the I/O and doing @@ -13904,8 +13904,6 @@ ctl_process_done(union ctl_io *io) } else fe_done(io); -bailout: - return (CTL_RETVAL_COMPLETE); } From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 28 08:53:45 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F0B44250; Fri, 28 Nov 2014 08:53:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DCDBE7B4; Fri, 28 Nov 2014 08:53:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAS8riYV084414; Fri, 28 Nov 2014 08:53:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAS8riad084413; Fri, 28 Nov 2014 08:53:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201411280853.sAS8riad084413@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 28 Nov 2014 08:53:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275201 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2014 08:53:45 -0000 Author: mav Date: Fri Nov 28 08:53:44 2014 New Revision: 275201 URL: https://svnweb.freebsd.org/changeset/base/275201 Log: MFC r274789: Reduce race between LUN destruction and request arrival. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Fri Nov 28 08:52:38 2014 (r275200) +++ stable/10/sys/cam/ctl/ctl.c Fri Nov 28 08:53:44 2014 (r275201) @@ -11717,15 +11717,18 @@ ctl_scsiio_precheck(struct ctl_softc *ct targ_lun = ctsio->io_hdr.nexus.targ_mapped_lun; if ((targ_lun < CTL_MAX_LUNS) - && (ctl_softc->ctl_luns[targ_lun] != NULL)) { - lun = ctl_softc->ctl_luns[targ_lun]; + && ((lun = ctl_softc->ctl_luns[targ_lun]) != NULL)) { /* * If the LUN is invalid, pretend that it doesn't exist. * It will go away as soon as all pending I/O has been * completed. */ + mtx_lock(&lun->lun_lock); if (lun->flags & CTL_LUN_DISABLED) { + mtx_unlock(&lun->lun_lock); lun = NULL; + ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = NULL; + ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = NULL; } else { ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr = lun; ctsio->io_hdr.ctl_private[CTL_PRIV_BACKEND_LUN].ptr = @@ -11738,7 +11741,6 @@ ctl_scsiio_precheck(struct ctl_softc *ct * Every I/O goes into the OOA queue for a * particular LUN, and stays there until completion. */ - mtx_lock(&lun->lun_lock); TAILQ_INSERT_TAIL(&lun->ooa_queue, &ctsio->io_hdr, ooa_links); } From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 28 08:54:44 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6CDBF39D; Fri, 28 Nov 2014 08:54:44 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4002B7C1; Fri, 28 Nov 2014 08:54:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAS8si9x084631; Fri, 28 Nov 2014 08:54:44 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAS8siM0084630; Fri, 28 Nov 2014 08:54:44 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201411280854.sAS8siM0084630@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 28 Nov 2014 08:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275202 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2014 08:54:44 -0000 Author: mav Date: Fri Nov 28 08:54:43 2014 New Revision: 275202 URL: https://svnweb.freebsd.org/changeset/base/275202 Log: MFC r274790: Remove bunch of unused lun variables. Modified: stable/10/sys/cam/ctl/ctl.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Fri Nov 28 08:53:44 2014 (r275201) +++ stable/10/sys/cam/ctl/ctl.c Fri Nov 28 08:54:43 2014 (r275202) @@ -7378,14 +7378,11 @@ ctl_read_defect(struct ctl_scsiio *ctsio struct scsi_read_defect_data_12 *ccb12; struct scsi_read_defect_data_hdr_10 *data10; struct scsi_read_defect_data_hdr_12 *data12; - struct ctl_lun *lun; uint32_t alloc_len, data_len; uint8_t format; CTL_DEBUG_PRINT(("ctl_read_defect\n")); - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; - if (ctsio->cdb[0] == READ_DEFECT_DATA_10) { ccb10 = (struct scsi_read_defect_data_10 *)&ctsio->cdb; format = ccb10->format; @@ -7748,7 +7745,6 @@ fill_one: int ctl_report_supported_tmf(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; struct scsi_report_supported_tmf *cdb; struct scsi_report_supported_tmf_data *data; int retval; @@ -7757,7 +7753,6 @@ ctl_report_supported_tmf(struct ctl_scsi CTL_DEBUG_PRINT(("ctl_report_supported_tmf\n")); cdb = (struct scsi_report_supported_tmf *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; retval = CTL_RETVAL_COMPLETE; @@ -7794,7 +7789,6 @@ ctl_report_supported_tmf(struct ctl_scsi int ctl_report_timestamp(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; struct scsi_report_timestamp *cdb; struct scsi_report_timestamp_data *data; struct timeval tv; @@ -7805,7 +7799,6 @@ ctl_report_timestamp(struct ctl_scsiio * CTL_DEBUG_PRINT(("ctl_report_timestamp\n")); cdb = (struct scsi_report_timestamp *)ctsio->cdb; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; retval = CTL_RETVAL_COMPLETE; @@ -9809,15 +9802,9 @@ no_sense: int ctl_tur(struct ctl_scsiio *ctsio) { - struct ctl_lun *lun; - - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; CTL_DEBUG_PRINT(("ctl_tur\n")); - if (lun == NULL) - return (EINVAL); - ctsio->scsi_status = SCSI_STATUS_OK; ctsio->io_hdr.status = CTL_SUCCESS; @@ -10490,10 +10477,8 @@ static int ctl_inquiry_evpd(struct ctl_scsiio *ctsio) { struct scsi_inquiry *cdb; - struct ctl_lun *lun; int alloc_len, retval; - lun = (struct ctl_lun *)ctsio->io_hdr.ctl_private[CTL_PRIV_LUN].ptr; cdb = (struct scsi_inquiry *)ctsio->cdb; retval = CTL_RETVAL_COMPLETE; From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 28 08:56:38 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4D20E4ED; Fri, 28 Nov 2014 08:56:38 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 136737D8; Fri, 28 Nov 2014 08:56:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAS8ubKx084959; Fri, 28 Nov 2014 08:56:37 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAS8ubpY084958; Fri, 28 Nov 2014 08:56:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201411280856.sAS8ubpY084958@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 28 Nov 2014 08:56:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275203 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2014 08:56:38 -0000 Author: mav Date: Fri Nov 28 08:56:37 2014 New Revision: 275203 URL: https://svnweb.freebsd.org/changeset/base/275203 Log: MFC r274840, r274940: Make iSCSI frontend less chatty while waiting for tasks termination. Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Fri Nov 28 08:54:43 2014 (r275202) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Fri Nov 28 08:56:37 2014 (r275203) @@ -1062,7 +1062,7 @@ cfiscsi_session_terminate_tasks(struct c { struct cfiscsi_data_wait *cdw; union ctl_io *io; - int error, last; + int error, last, wait; io = ctl_alloc_io(cs->cs_target->ct_port.ctl_pool_ref); if (io == NULL) { @@ -1078,6 +1078,7 @@ cfiscsi_session_terminate_tasks(struct c io->io_hdr.nexus.targ_lun = 0; io->taskio.tag_type = CTL_TAG_SIMPLE; /* XXX */ io->taskio.task_action = CTL_TASK_I_T_NEXUS_RESET; + wait = cs->cs_outstanding_ctl_pdus; refcount_acquire(&cs->cs_outstanding_ctl_pdus); error = ctl_queue(io); if (error != CTL_RETVAL_COMPLETE) { @@ -1105,16 +1106,19 @@ cfiscsi_session_terminate_tasks(struct c /* * Wait for CTL to terminate all the tasks. */ + if (wait > 0) + CFISCSI_SESSION_WARN(cs, + "waiting for CTL to terminate %d tasks", wait); for (;;) { refcount_acquire(&cs->cs_outstanding_ctl_pdus); last = refcount_release(&cs->cs_outstanding_ctl_pdus); if (last != 0) break; - CFISCSI_SESSION_WARN(cs, "waiting for CTL to terminate tasks, " - "%d remaining", cs->cs_outstanding_ctl_pdus); tsleep(__DEVOLATILE(void *, &cs->cs_outstanding_ctl_pdus), 0, "cfiscsi_terminate", hz / 100); } + if (wait > 0) + CFISCSI_SESSION_WARN(cs, "tasks terminated"); } static void From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 28 09:23:16 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D6CCCDAF; Fri, 28 Nov 2014 09:23:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C3982A92; Fri, 28 Nov 2014 09:23:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAS9NGbC099107; Fri, 28 Nov 2014 09:23:16 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAS9NGOU099106; Fri, 28 Nov 2014 09:23:16 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201411280923.sAS9NGOU099106@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 28 Nov 2014 09:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275204 - stable/10/sys/cam/scsi X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2014 09:23:17 -0000 Author: mav Date: Fri Nov 28 09:23:15 2014 New Revision: 275204 URL: https://svnweb.freebsd.org/changeset/base/275204 Log: MFC r274756: Remove residual xpt_release_device() call left after r272406 cleanup. Excessive release here could trigger use-after-free condition and kernel panic on LUN 0 disconnect. Modified: stable/10/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/10/sys/cam/scsi/scsi_xpt.c Fri Nov 28 08:56:37 2014 (r275203) +++ stable/10/sys/cam/scsi/scsi_xpt.c Fri Nov 28 09:23:15 2014 (r275204) @@ -2041,23 +2041,7 @@ scsi_scan_bus(struct cam_periph *periph, scan_info->lunindex[target_id]++; } else { mtx_unlock(&target->luns_mtx); - /* - * We're done with scanning all luns. - * - * Nuke the bogus device for lun 0 if lun 0 - * wasn't on the list. - */ - if (first != 0) { - TAILQ_FOREACH(device, - &target->ed_entries, links) { - if (device->lun_id == 0) { - break; - } - } - if (device) { - xpt_release_device(device); - } - } + /* We're done with scanning all luns. */ } } else { mtx_unlock(&target->luns_mtx); From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 28 19:21:47 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC46F775; Fri, 28 Nov 2014 19:21:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9DF19906; Fri, 28 Nov 2014 19:21:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sASJLli2079728; Fri, 28 Nov 2014 19:21:47 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sASJLlcC079727; Fri, 28 Nov 2014 19:21:47 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201411281921.sASJLlcC079727@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 28 Nov 2014 19:21:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275212 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2014 19:21:47 -0000 Author: hselasky Date: Fri Nov 28 19:21:46 2014 New Revision: 275212 URL: https://svnweb.freebsd.org/changeset/base/275212 Log: MFC r274017, r274088 and r275205: Provide an on-stack temporary buffer for small IOCTL requests. Avoiding a memory allocation per IOCTL request can give a significant speedup for applications which heavily rely on IOCTLs. Modified: stable/10/sys/kern/sys_generic.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sys_generic.c ============================================================================== --- stable/10/sys/kern/sys_generic.c Fri Nov 28 14:51:49 2014 (r275211) +++ stable/10/sys/kern/sys_generic.c Fri Nov 28 19:21:46 2014 (r275212) @@ -75,6 +75,20 @@ __FBSDID("$FreeBSD$"); #include +/* + * The following macro defines how many bytes will be allocated from + * the stack instead of memory allocated when passing the IOCTL data + * structures from userspace and to the kernel. Some IOCTLs having + * small data structures are used very frequently and this small + * buffer on the stack gives a significant speedup improvement for + * those requests. The value of this define should be greater or equal + * to 64 bytes and should also be power of two. The data structure is + * currently hard-aligned to a 8-byte boundary on the stack. This + * should currently be sufficient for all supported platforms. + */ +#define SYS_IOCTL_SMALL_SIZE 128 /* bytes */ +#define SYS_IOCTL_SMALL_ALIGN 8 /* bytes */ + int iosize_max_clamp = 1; SYSCTL_INT(_debug, OID_AUTO, iosize_max_clamp, CTLFLAG_RW, &iosize_max_clamp, 0, "Clamp max i/o size to INT_MAX"); @@ -646,6 +660,7 @@ struct ioctl_args { int sys_ioctl(struct thread *td, struct ioctl_args *uap) { + u_char smalldata[SYS_IOCTL_SMALL_SIZE] __aligned(SYS_IOCTL_SMALL_ALIGN); u_long com; int arg, error; u_int size; @@ -680,17 +695,18 @@ sys_ioctl(struct thread *td, struct ioct arg = (intptr_t)uap->data; data = (void *)&arg; size = 0; - } else - data = malloc((u_long)size, M_IOCTLOPS, M_WAITOK); + } else { + if (size > SYS_IOCTL_SMALL_SIZE) + data = malloc((u_long)size, M_IOCTLOPS, M_WAITOK); + else + data = smalldata; + } } else data = (void *)&uap->data; if (com & IOC_IN) { error = copyin(uap->data, data, (u_int)size); - if (error) { - if (size > 0) - free(data, M_IOCTLOPS); - return (error); - } + if (error != 0) + goto out; } else if (com & IOC_OUT) { /* * Zero the buffer so the user always @@ -704,7 +720,8 @@ sys_ioctl(struct thread *td, struct ioct if (error == 0 && (com & IOC_OUT)) error = copyout(data, uap->data, (u_int)size); - if (size > 0) +out: + if (size > SYS_IOCTL_SMALL_SIZE) free(data, M_IOCTLOPS); return (error); } From owner-svn-src-stable-10@FreeBSD.ORG Fri Nov 28 20:39:36 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 29D504E8; Fri, 28 Nov 2014 20:39:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EFBEBF58; Fri, 28 Nov 2014 20:39:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sASKdZdi014117; Fri, 28 Nov 2014 20:39:35 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sASKdZSV014116; Fri, 28 Nov 2014 20:39:35 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201411282039.sASKdZSV014116@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 28 Nov 2014 20:39:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275213 - stable/10/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Nov 2014 20:39:36 -0000 Author: cy Date: Fri Nov 28 20:39:35 2014 New Revision: 275213 URL: https://svnweb.freebsd.org/changeset/base/275213 Log: MFC r274744. Set the current vnet inside the ioctl handler for ipfilter. Without this fix, the vnet was NULL and would crash. This fix is similar to what was done inside the ioctl handler for PF. Tested by: (1) Boot a kernel with "options VIMAGE" enabled (2) Type: echo "map lo0 from 10.0.0.0/24 to ! 10.0.0.0/24 -> 127.0.0.1/32" > /etc/ipnat.rules ; service ipnat onerestart PR: 176992 Differential Revision: https://reviews.freebsd.org/D1191 Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Nov 28 19:21:46 2014 (r275212) +++ stable/10/sys/contrib/ipfilter/netinet/ip_fil_freebsd.c Fri Nov 28 20:39:35 2014 (r275213) @@ -33,6 +33,9 @@ static const char rcsid[] = "@(#)$Id$"; #include #include # include +#if defined(__FreeBSD_version) && (__FreeBSD_version >= 800000) +#include +#endif # include # include #if !defined(__hpux) @@ -52,6 +55,12 @@ static const char rcsid[] = "@(#)$Id$"; #include #include #include +#if defined(__FreeBSD_version) && (__FreeBSD_version >= 800000) +#include +#else +#define CURVNET_SET(arg) +#define CURVNET_RESTORE() +#endif #if defined(__osf__) # include #endif @@ -323,7 +332,9 @@ ipfioctl(dev, cmd, data, mode SPL_NET(s); + CURVNET_SET(TD_TO_VNET(p)); error = ipf_ioctlswitch(&ipfmain, unit, data, cmd, mode, p->p_uid, p); + CURVNET_RESTORE(); if (error != -1) { SPL_X(s); return error; From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 04:18:58 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 63E43E20; Sat, 29 Nov 2014 04:18:58 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4F781D5; Sat, 29 Nov 2014 04:18:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAT4IwT2032209; Sat, 29 Nov 2014 04:18:58 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAT4Iv2g032203; Sat, 29 Nov 2014 04:18:57 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201411290418.sAT4Iv2g032203@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 29 Nov 2014 04:18:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275228 - stable/10/contrib/ofed/libmlx4/src X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 04:18:58 -0000 Author: hselasky Date: Sat Nov 29 04:18:56 2014 New Revision: 275228 URL: https://svnweb.freebsd.org/changeset/base/275228 Log: MFC r275109: Add support for 64-byte CQE size. Sponsored by: Mellanox Technologies Modified: stable/10/contrib/ofed/libmlx4/src/cq.c stable/10/contrib/ofed/libmlx4/src/mlx4-abi.h stable/10/contrib/ofed/libmlx4/src/mlx4.c stable/10/contrib/ofed/libmlx4/src/mlx4.h stable/10/contrib/ofed/libmlx4/src/verbs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/contrib/ofed/libmlx4/src/cq.c ============================================================================== --- stable/10/contrib/ofed/libmlx4/src/cq.c Sat Nov 29 01:58:52 2014 (r275227) +++ stable/10/contrib/ofed/libmlx4/src/cq.c Sat Nov 29 04:18:56 2014 (r275228) @@ -109,15 +109,16 @@ struct mlx4_err_cqe { static struct mlx4_cqe *get_cqe(struct mlx4_cq *cq, int entry) { - return cq->buf.buf + entry * MLX4_CQ_ENTRY_SIZE; + return cq->buf.buf + entry * cq->cqe_size; } static void *get_sw_cqe(struct mlx4_cq *cq, int n) { struct mlx4_cqe *cqe = get_cqe(cq, n & cq->ibv_cq.cqe); + struct mlx4_cqe *tcqe = cq->cqe_size == 64 ? cqe + 1 : cqe; - return (!!(cqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK) ^ - !!(n & (cq->ibv_cq.cqe + 1))) ? NULL : cqe; + return (!!(tcqe->owner_sr_opcode & MLX4_CQE_OWNER_MASK) ^ + !!(n & (cq->ibv_cq.cqe + 1))) ? NULL : tcqe; } static struct mlx4_cqe *next_cqe_sw(struct mlx4_cq *cq) @@ -402,6 +403,7 @@ void __mlx4_cq_clean(struct mlx4_cq *cq, uint8_t owner_bit; int nfreed = 0; int is_xrc_srq = 0; + int cqe_inc = cq->cqe_size == 64 ? 1 : 0; if (srq && srq->ibv_srq.xrc_cq) is_xrc_srq = 1; @@ -423,6 +425,7 @@ void __mlx4_cq_clean(struct mlx4_cq *cq, */ while ((int) --prod_index - (int) cq->cons_index >= 0) { cqe = get_cqe(cq, prod_index & cq->ibv_cq.cqe); + cqe += cqe_inc; if (is_xrc_srq && (ntohl(cqe->g_mlpath_rqpn & 0xffffff) == srq->srqn) && !(cqe->owner_sr_opcode & MLX4_CQE_IS_SEND_MASK)) { @@ -434,6 +437,7 @@ void __mlx4_cq_clean(struct mlx4_cq *cq, ++nfreed; } else if (nfreed) { dest = get_cqe(cq, (prod_index + nfreed) & cq->ibv_cq.cqe); + dest += cqe_inc; owner_bit = dest->owner_sr_opcode & MLX4_CQE_OWNER_MASK; memcpy(dest, cqe, sizeof *cqe); dest->owner_sr_opcode = owner_bit | @@ -473,28 +477,32 @@ void mlx4_cq_resize_copy_cqes(struct mlx { struct mlx4_cqe *cqe; int i; + int cqe_inc = cq->cqe_size == 64 ? 1 : 0; i = cq->cons_index; cqe = get_cqe(cq, (i & old_cqe)); + cqe += cqe_inc; while ((cqe->owner_sr_opcode & MLX4_CQE_OPCODE_MASK) != MLX4_CQE_OPCODE_RESIZE) { cqe->owner_sr_opcode = (cqe->owner_sr_opcode & ~MLX4_CQE_OWNER_MASK) | (((i + 1) & (cq->ibv_cq.cqe + 1)) ? MLX4_CQE_OWNER_MASK : 0); - memcpy(buf + ((i + 1) & cq->ibv_cq.cqe) * MLX4_CQ_ENTRY_SIZE, - cqe, MLX4_CQ_ENTRY_SIZE); + memcpy(buf + ((i + 1) & cq->ibv_cq.cqe) * cq->cqe_size, + cqe - cqe_inc, cq->cqe_size); ++i; cqe = get_cqe(cq, (i & old_cqe)); + cqe += cqe_inc; } ++cq->cons_index; } -int mlx4_alloc_cq_buf(struct mlx4_device *dev, struct mlx4_buf *buf, int nent) +int mlx4_alloc_cq_buf(struct mlx4_device *dev, struct mlx4_buf *buf, int nent, + int entry_size) { - if (mlx4_alloc_buf(buf, align(nent * MLX4_CQ_ENTRY_SIZE, dev->page_size), + if (mlx4_alloc_buf(buf, align(nent * entry_size, dev->page_size), dev->page_size)) return -1; - memset(buf->buf, 0, nent * MLX4_CQ_ENTRY_SIZE); + memset(buf->buf, 0, nent * entry_size); return 0; } Modified: stable/10/contrib/ofed/libmlx4/src/mlx4-abi.h ============================================================================== --- stable/10/contrib/ofed/libmlx4/src/mlx4-abi.h Sat Nov 29 01:58:52 2014 (r275227) +++ stable/10/contrib/ofed/libmlx4/src/mlx4-abi.h Sat Nov 29 04:18:56 2014 (r275228) @@ -40,9 +40,11 @@ struct mlx4_alloc_ucontext_resp { struct ibv_get_context_resp ibv_resp; + __u32 dev_caps; __u32 qp_tab_size; __u16 bf_reg_size; __u16 bf_regs_per_page; + __u32 cqe_size; }; struct mlx4_alloc_pd_resp { Modified: stable/10/contrib/ofed/libmlx4/src/mlx4.c ============================================================================== --- stable/10/contrib/ofed/libmlx4/src/mlx4.c Sat Nov 29 01:58:52 2014 (r275227) +++ stable/10/contrib/ofed/libmlx4/src/mlx4.c Sat Nov 29 04:18:56 2014 (r275228) @@ -201,6 +201,7 @@ static struct ibv_context *mlx4_alloc_co context->bf_buf_size = 0; } + context->cqe_size = resp.cqe_size; pthread_spin_init(&context->uar_lock, PTHREAD_PROCESS_PRIVATE); context->ibv_ctx.ops = mlx4_ctx_ops; Modified: stable/10/contrib/ofed/libmlx4/src/mlx4.h ============================================================================== --- stable/10/contrib/ofed/libmlx4/src/mlx4.h Sat Nov 29 01:58:52 2014 (r275227) +++ stable/10/contrib/ofed/libmlx4/src/mlx4.h Sat Nov 29 04:18:56 2014 (r275228) @@ -103,10 +103,6 @@ #endif enum { - MLX4_CQ_ENTRY_SIZE = 0x20 -}; - -enum { MLX4_STAT_RATE_OFFSET = 5 }; @@ -192,6 +188,7 @@ struct mlx4_context { int max_qp_wr; int max_sge; int max_cqe; + int cqe_size; struct { struct mlx4_srq **table; @@ -226,6 +223,7 @@ struct mlx4_cq { uint32_t *set_ci_db; uint32_t *arm_db; int arm_sn; + int cqe_size; }; struct mlx4_srq { @@ -369,7 +367,8 @@ int mlx4_dereg_mr(struct ibv_mr *mr); struct ibv_cq *mlx4_create_cq(struct ibv_context *context, int cqe, struct ibv_comp_channel *channel, int comp_vector); -int mlx4_alloc_cq_buf(struct mlx4_device *dev, struct mlx4_buf *buf, int nent); +int mlx4_alloc_cq_buf(struct mlx4_device *dev, struct mlx4_buf *buf, int nent, + int entry_size); int mlx4_resize_cq(struct ibv_cq *cq, int cqe); int mlx4_destroy_cq(struct ibv_cq *cq); int mlx4_poll_cq(struct ibv_cq *cq, int ne, struct ibv_wc *wc); Modified: stable/10/contrib/ofed/libmlx4/src/verbs.c ============================================================================== --- stable/10/contrib/ofed/libmlx4/src/verbs.c Sat Nov 29 01:58:52 2014 (r275227) +++ stable/10/contrib/ofed/libmlx4/src/verbs.c Sat Nov 29 04:18:56 2014 (r275228) @@ -168,6 +168,7 @@ struct ibv_cq *mlx4_create_cq(struct ibv struct mlx4_create_cq_resp resp; struct mlx4_cq *cq; int ret; + struct mlx4_context *mctx = to_mctx(context); /* Sanity check CQ size before proceeding */ if (cqe > 0x3fffff) @@ -184,9 +185,11 @@ struct ibv_cq *mlx4_create_cq(struct ibv cqe = align_queue_size(cqe + 1); - if (mlx4_alloc_cq_buf(to_mdev(context->device), &cq->buf, cqe)) + if (mlx4_alloc_cq_buf(to_mdev(context->device), &cq->buf, cqe, mctx->cqe_size)) goto err; + cq->cqe_size = mctx->cqe_size; + cq->set_ci_db = mlx4_alloc_db(to_mctx(context), MLX4_DB_TYPE_CQ); if (!cq->set_ci_db) goto err_buf; @@ -247,7 +250,8 @@ int mlx4_resize_cq(struct ibv_cq *ibcq, goto out; } - ret = mlx4_alloc_cq_buf(to_mdev(ibcq->context->device), &buf, cqe); + ret = mlx4_alloc_cq_buf(to_mdev(ibcq->context->device), &buf, cqe, + cq->cqe_size); if (ret) goto out; From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 05:07:25 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8FBA04D7; Sat, 29 Nov 2014 05:07:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7C17D755; Sat, 29 Nov 2014 05:07:25 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAT57P4q055323; Sat, 29 Nov 2014 05:07:25 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAT57PMa055321; Sat, 29 Nov 2014 05:07:25 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201411290507.sAT57PMa055321@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Sat, 29 Nov 2014 05:07:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275230 - stable/10/sys/dev/usb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 05:07:25 -0000 Author: hselasky Date: Sat Nov 29 05:07:24 2014 New Revision: 275230 URL: https://svnweb.freebsd.org/changeset/base/275230 Log: MFC r274020: Reduce boot verbosity. Modified: stable/10/sys/dev/usb/usb_hub.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/usb/usb_hub.c ============================================================================== --- stable/10/sys/dev/usb/usb_hub.c Sat Nov 29 04:21:40 2014 (r275229) +++ stable/10/sys/dev/usb/usb_hub.c Sat Nov 29 05:07:24 2014 (r275230) @@ -1502,13 +1502,13 @@ uhub_attach(device_t dev) if (usb_disable_port_power != 0 || sc->sc_disable_port_power != 0) { /* turn the power off */ - DPRINTFN(0, "Turning port %d power off\n", portno); + DPRINTFN(2, "Turning port %d power off\n", portno); err = usbd_req_clear_port_feature(udev, NULL, portno, UHF_PORT_POWER); } else { #endif /* turn the power on */ - DPRINTFN(0, "Turning port %d power on\n", portno); + DPRINTFN(2, "Turning port %d power on\n", portno); err = usbd_req_set_port_feature(udev, NULL, portno, UHF_PORT_POWER); #if USB_HAVE_DISABLE_ENUM From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 08:33:56 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 69B06D79; Sat, 29 Nov 2014 08:33:56 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4A859A9F; Sat, 29 Nov 2014 08:33:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sAT8XuSW053385; Sat, 29 Nov 2014 08:33:56 GMT (envelope-from rodrigc@FreeBSD.org) Received: (from rodrigc@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sAT8XtMi053382; Sat, 29 Nov 2014 08:33:55 GMT (envelope-from rodrigc@FreeBSD.org) Message-Id: <201411290833.sAT8XtMi053382@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: rodrigc set sender to rodrigc@FreeBSD.org using -f From: Craig Rodrigues Date: Sat, 29 Nov 2014 08:33:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275236 - in stable/10: . cddl/lib/libzfs cddl/lib/libzpool X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 08:33:56 -0000 Author: rodrigc Date: Sat Nov 29 08:33:54 2014 New Revision: 275236 URL: https://svnweb.freebsd.org/changeset/base/275236 Log: MFC r272484: Add dependencies to various libraries to libzfs and libzpool. Submitted by: sef Modified: stable/10/Makefile.inc1 stable/10/cddl/lib/libzfs/Makefile stable/10/cddl/lib/libzpool/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/Makefile.inc1 ============================================================================== --- stable/10/Makefile.inc1 Sat Nov 29 07:41:02 2014 (r275235) +++ stable/10/Makefile.inc1 Sat Nov 29 08:33:54 2014 (r275236) @@ -1516,7 +1516,9 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 lib/ncurses/ncurses lib/ncurses/ncursesw \ lib/libopie lib/libpam ${_lib_libthr} \ lib/libradius lib/libsbuf lib/libtacplus \ + lib/libgeom \ ${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \ + ${_cddl_lib_libuutil} \ ${_cddl_lib_libavl} \ ${_cddl_lib_libzfs_core} \ lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ @@ -1528,6 +1530,8 @@ _prebuild_libs+= gnu/lib/libstdc++ gnu/l gnu/lib/libstdc++__L: lib/msun__L .endif +lib/libgeom__L: lib/libexpat__L + .if defined(WITH_ATF) || ${MK_TESTS} != "no" .if !defined(WITH_ATF) # Ensure that the ATF libraries will be built during make libraries, even @@ -1558,9 +1562,11 @@ lib/libopie__L lib/libtacplus__L: lib/li _cddl_lib_libumem= cddl/lib/libumem _cddl_lib_libnvpair= cddl/lib/libnvpair _cddl_lib_libavl= cddl/lib/libavl +_cddl_lib_libuutil= cddl/lib/libuutil _cddl_lib_libzfs_core= cddl/lib/libzfs_core _cddl_lib= cddl/lib cddl/lib/libzfs_core__L: cddl/lib/libnvpair__L +cddl/lib/libzfs__L: lib/libgeom__L .endif .if ${MK_CRYPT} != "no" Modified: stable/10/cddl/lib/libzfs/Makefile ============================================================================== --- stable/10/cddl/lib/libzfs/Makefile Sat Nov 29 07:41:02 2014 (r275235) +++ stable/10/cddl/lib/libzfs/Makefile Sat Nov 29 08:33:54 2014 (r275236) @@ -7,8 +7,11 @@ LIB= zfs DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBUMEM} ${LIBUTIL} ${LIBM} ${LIBNVPAIR} \ - ${LIBAVL} ${LIBZFS_CORE} -LDADD= -lmd -lpthread -lumem -lutil -lm -lnvpair -lavl -lzfs_core + ${LIBAVL} ${LIBZFS_CORE} ${LIBUUTIL} ${LIBBSDXML} ${LIBGEOM} \ + ${LIBNVPAIR} + +LDADD= -lmd -lpthread -lumem -lutil -luutil -lm -lnvpair -lavl \ + -lbsdxml -lgeom -lnvpair -lzfs_core SRCS= deviceid.c \ fsshare.c \ Modified: stable/10/cddl/lib/libzpool/Makefile ============================================================================== --- stable/10/cddl/lib/libzpool/Makefile Sat Nov 29 07:41:02 2014 (r275235) +++ stable/10/cddl/lib/libzpool/Makefile Sat Nov 29 08:33:54 2014 (r275236) @@ -56,8 +56,9 @@ CFLAGS+= -I${.CURDIR}/../../../lib/libpt CFLAGS+= -I${.CURDIR}/../../../lib/libpthread/sys CFLAGS+= -I${.CURDIR}/../../../lib/libthr/arch/${MACHINE_CPUARCH}/include -DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBZ} -LDADD= -lmd -lpthread -lz +DPADD= ${LIBMD} ${LIBPTHREAD} ${LIBZ} ${LIBNVPAIR} \ + ${LIBAVL} ${LIBUMEM} +LDADD= -lmd -lpthread -lz -lnvpair -lavl -lumem # atomic.S doesn't like profiling. NO_PROFILE= From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:32:18 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 512F4D3A; Sat, 29 Nov 2014 15:32:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 327533BB; Sat, 29 Nov 2014 15:32:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFWIQG051230; Sat, 29 Nov 2014 15:32:18 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFWGWV051223; Sat, 29 Nov 2014 15:32:16 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291532.sATFWGWV051223@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:32:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275244 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:32:18 -0000 Author: trasz Date: Sat Nov 29 15:32:15 2014 New Revision: 275244 URL: https://svnweb.freebsd.org/changeset/base/275244 Log: MFC r273813: Add discovery-filter. This makes it possible to restrict which targets are returned during discovery based on initiator portal, name, and CHAP credentials. Modified: stable/10/usr.sbin/ctld/ctl.conf.5 stable/10/usr.sbin/ctld/ctld.c stable/10/usr.sbin/ctld/ctld.h stable/10/usr.sbin/ctld/discovery.c stable/10/usr.sbin/ctld/login.c stable/10/usr.sbin/ctld/parse.y stable/10/usr.sbin/ctld/token.l Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- stable/10/usr.sbin/ctld/ctl.conf.5 Sat Nov 29 15:02:45 2014 (r275243) +++ stable/10/usr.sbin/ctld/ctl.conf.5 Sat Nov 29 15:32:15 2014 (r275244) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2014 +.Dd October 29, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -175,6 +175,43 @@ Another predefined .Qq Ar no-authentication , may be used to permit discovery without authentication. +.It Ic discovery-filter Ar filter +Determines which targets are returned during discovery. +Filter can be either +.Qq Ar none , +.Qq Ar portal , +.Qq Ar portal-name , +or +.Qq Ar portal-name-auth . +When set to +.Qq Ar none , +discovery will return all targets assigned to that portal group. +When set to +.Qq Ar portal , +discovery will not return targets that cannot be accessed by the +initiator because of their +.Sy initiator-portal . +When set to +.Qq Ar portal-name , +the check will include both +.Sy initiator-portal +and +.Sy initiator-name . +When set to +.Qq Ar portal-name-auth , +the check will include +.Sy initiator-portal , +.Sy initiator-name , +and authentication credentials, ie. if the target does not require +CHAP authentication, or if CHAP user and secret used during discovery +match CHAP user and secret required to access the target. +Note that when using +.Qq Ar portal-name-auth , +targets that require CHAP authentication will only be returned if +.Sy discovery-auth-group +requires CHAP. +The default is +.Qq Ar none . .It Ic listen Ar address An IPv4 or IPv6 address and port to listen on for incoming connections. .\".It Ic listen-iser Ar address Modified: stable/10/usr.sbin/ctld/ctld.c ============================================================================== --- stable/10/usr.sbin/ctld/ctld.c Sat Nov 29 15:02:45 2014 (r275243) +++ stable/10/usr.sbin/ctld/ctld.c Sat Nov 29 15:32:15 2014 (r275244) @@ -979,6 +979,53 @@ isns_deregister(struct isns *isns) set_timeout(0, false); } +static int +portal_group_set_filter(struct portal_group *pg, int filter) +{ + + if (pg->pg_discovery_filter == PG_FILTER_UNKNOWN) { + pg->pg_discovery_filter = filter; + return (0); + } + + if (pg->pg_discovery_filter == filter) + return (0); + + return (1); +} + +int +portal_group_set_filter_str(struct portal_group *pg, const char *str) +{ + int error, filter; + + if (strcmp(str, "none") == 0) { + filter = PG_FILTER_NONE; + } else if (strcmp(str, "portal") == 0) { + filter = PG_FILTER_PORTAL; + } else if (strcmp(str, "portal-name") == 0) { + filter = PG_FILTER_PORTAL_NAME; + } else if (strcmp(str, "portal-name-auth") == 0) { + filter = PG_FILTER_PORTAL_NAME_AUTH; + } else { + log_warnx("invalid discovery-filter \"%s\" for portal-group " + "\"%s\"; valid values are \"none\", \"portal\", " + "\"portal-name\", and \"portal-name-auth\"", + str, pg->pg_name); + return (1); + } + + error = portal_group_set_filter(pg, filter); + if (error != 0) { + log_warnx("cannot set discovery-filter to \"%s\" for " + "portal-group \"%s\"; already has a different " + "value", str, pg->pg_name); + return (1); + } + + return (error); +} + static bool valid_hex(const char ch) { @@ -1478,6 +1525,9 @@ conf_verify(struct conf *conf) assert(pg->pg_discovery_auth_group != NULL); } + if (pg->pg_discovery_filter == PG_FILTER_UNKNOWN) + pg->pg_discovery_filter = PG_FILTER_NONE; + TAILQ_FOREACH(targ, &conf->conf_targets, t_next) { if (targ->t_portal_group == pg) break; Modified: stable/10/usr.sbin/ctld/ctld.h ============================================================================== --- stable/10/usr.sbin/ctld/ctld.h Sat Nov 29 15:02:45 2014 (r275243) +++ stable/10/usr.sbin/ctld/ctld.h Sat Nov 29 15:32:15 2014 (r275244) @@ -103,11 +103,18 @@ struct portal { int p_socket; }; +#define PG_FILTER_UNKNOWN 0 +#define PG_FILTER_NONE 1 +#define PG_FILTER_PORTAL 2 +#define PG_FILTER_PORTAL_NAME 3 +#define PG_FILTER_PORTAL_NAME_AUTH 4 + struct portal_group { TAILQ_ENTRY(portal_group) pg_next; struct conf *pg_conf; char *pg_name; struct auth_group *pg_discovery_auth_group; + int pg_discovery_filter; bool pg_unassigned; TAILQ_HEAD(, portal) pg_portals; @@ -200,6 +207,8 @@ struct connection { int conn_immediate_data; int conn_header_digest; int conn_data_digest; + const char *conn_user; + struct chap *conn_chap; }; struct pdu { @@ -290,6 +299,8 @@ struct portal_group *portal_group_find(c const char *name); int portal_group_add_listen(struct portal_group *pg, const char *listen, bool iser); +int portal_group_set_filter_str(struct portal_group *pg, + const char *filter); int isns_new(struct conf *conf, const char *addr); void isns_delete(struct isns *is); Modified: stable/10/usr.sbin/ctld/discovery.c ============================================================================== --- stable/10/usr.sbin/ctld/discovery.c Sat Nov 29 15:02:45 2014 (r275243) +++ stable/10/usr.sbin/ctld/discovery.c Sat Nov 29 15:32:15 2014 (r275244) @@ -201,6 +201,65 @@ discovery_add_target(struct keys *respon } } +static bool +discovery_target_filtered_out(const struct connection *conn, + const struct target *targ) +{ + const struct auth_group *ag; + const struct portal_group *pg; + const struct auth *auth; + int error; + + ag = targ->t_auth_group; + pg = conn->conn_portal->p_portal_group; + + assert(pg->pg_discovery_auth_group != PG_FILTER_UNKNOWN); + + if (pg->pg_discovery_filter >= PG_FILTER_PORTAL && + auth_portal_check(ag, &conn->conn_initiator_sa) != 0) { + log_debugx("initiator does not match initiator portals " + "allowed for target \"%s\"; skipping", targ->t_name); + return (true); + } + + if (pg->pg_discovery_filter >= PG_FILTER_PORTAL_NAME && + auth_name_check(ag, conn->conn_initiator_name) != 0) { + log_debugx("initiator does not match initiator names " + "allowed for target \"%s\"; skipping", targ->t_name); + return (true); + } + + if (pg->pg_discovery_filter >= PG_FILTER_PORTAL_NAME_AUTH && + ag->ag_type != AG_TYPE_NO_AUTHENTICATION) { + if (conn->conn_chap == NULL) { + assert(pg->pg_discovery_auth_group->ag_type == + AG_TYPE_NO_AUTHENTICATION); + + log_debugx("initiator didn't authenticate, but target " + "\"%s\" requires CHAP; skipping", targ->t_name); + return (true); + } + + assert(conn->conn_user != NULL); + auth = auth_find(ag, conn->conn_user); + if (auth == NULL) { + log_debugx("CHAP user \"%s\" doesn't match target " + "\"%s\"; skipping", conn->conn_user, targ->t_name); + return (true); + } + + error = chap_authenticate(conn->conn_chap, auth->a_secret); + if (error != 0) { + log_debugx("password for CHAP user \"%s\" doesn't " + "match target \"%s\"; skipping", + conn->conn_user, targ->t_name); + return (true); + } + } + + return (false); +} + void discovery(struct connection *conn) { @@ -232,6 +291,10 @@ discovery(struct connection *conn) targ->t_name); continue; } + if (discovery_target_filtered_out(conn, targ)) { + /* Ignore this target. */ + continue; + } discovery_add_target(response_keys, targ); } } else { @@ -239,8 +302,13 @@ discovery(struct connection *conn) if (targ == NULL) { log_debugx("initiator requested information on unknown " "target \"%s\"; returning nothing", send_targets); - } else - discovery_add_target(response_keys, targ); + } else { + if (discovery_target_filtered_out(conn, targ)) { + /* Ignore this target. */ + } else { + discovery_add_target(response_keys, targ); + } + } } keys_save(response_keys, response); Modified: stable/10/usr.sbin/ctld/login.c ============================================================================== --- stable/10/usr.sbin/ctld/login.c Sat Nov 29 15:02:45 2014 (r275243) +++ stable/10/usr.sbin/ctld/login.c Sat Nov 29 15:32:15 2014 (r275244) @@ -441,7 +441,12 @@ login_chap(struct connection *conn, stru "transitioning to Negotiation Phase", auth->a_user); login_send_chap_success(request, auth); pdu_delete(request); - chap_delete(chap); + + /* + * Leave username and CHAP information for discovery(). + */ + conn->conn_user = auth->a_user; + conn->conn_chap = chap; } static void Modified: stable/10/usr.sbin/ctld/parse.y ============================================================================== --- stable/10/usr.sbin/ctld/parse.y Sat Nov 29 15:02:45 2014 (r275243) +++ stable/10/usr.sbin/ctld/parse.y Sat Nov 29 15:32:15 2014 (r275244) @@ -58,10 +58,10 @@ extern void yyrestart(FILE *); %} %token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL -%token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP INITIATOR_NAME -%token INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC OPENING_BRACKET -%token OPTION PATH PIDFILE PORTAL_GROUP SERIAL SIZE STR TARGET TIMEOUT -%token ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT +%token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP DISCOVERY_FILTER +%token INITIATOR_NAME INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC +%token OPENING_BRACKET OPTION PATH PIDFILE PORTAL_GROUP SERIAL SIZE STR +%token TARGET TIMEOUT ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT %union { @@ -327,6 +327,8 @@ portal_group_entries: portal_group_entry: portal_group_discovery_auth_group | + portal_group_discovery_filter + | portal_group_listen | portal_group_listen_iser @@ -352,6 +354,17 @@ portal_group_discovery_auth_group: DISCO } ; +portal_group_discovery_filter: DISCOVERY_FILTER STR + { + int error; + + error = portal_group_set_filter_str(portal_group, $2); + free($2); + if (error != 0) + return (1); + } + ; + portal_group_listen: LISTEN STR { int error; Modified: stable/10/usr.sbin/ctld/token.l ============================================================================== --- stable/10/usr.sbin/ctld/token.l Sat Nov 29 15:02:45 2014 (r275243) +++ stable/10/usr.sbin/ctld/token.l Sat Nov 29 15:32:15 2014 (r275244) @@ -58,6 +58,7 @@ chap-mutual { return CHAP_MUTUAL; } debug { return DEBUG; } device-id { return DEVICE_ID; } discovery-auth-group { return DISCOVERY_AUTH_GROUP; } +discovery-filter { return DISCOVERY_FILTER; } initiator-name { return INITIATOR_NAME; } initiator-portal { return INITIATOR_PORTAL; } listen { return LISTEN; } From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:34:18 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id CC0A2F53; Sat, 29 Nov 2014 15:34:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AD4BD3D6; Sat, 29 Nov 2014 15:34:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFYIOZ051747; Sat, 29 Nov 2014 15:34:18 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFYIh4051743; Sat, 29 Nov 2014 15:34:18 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291534.sATFYIh4051743@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:34:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275245 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:34:18 -0000 Author: trasz Date: Sat Nov 29 15:34:17 2014 New Revision: 275245 URL: https://svnweb.freebsd.org/changeset/base/275245 Log: MFC r273816: Simplify code; no functional changes. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/ctld.c stable/10/usr.sbin/ctld/ctld.h stable/10/usr.sbin/ctld/parse.y Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctld.c ============================================================================== --- stable/10/usr.sbin/ctld/ctld.c Sat Nov 29 15:32:15 2014 (r275244) +++ stable/10/usr.sbin/ctld/ctld.c Sat Nov 29 15:34:17 2014 (r275245) @@ -522,25 +522,10 @@ auth_group_find(const struct conf *conf, return (NULL); } -static int -auth_group_set_type(struct auth_group *ag, int type) -{ - - if (ag->ag_type == AG_TYPE_UNKNOWN) { - ag->ag_type = type; - return (0); - } - - if (ag->ag_type == type) - return (0); - - return (1); -} - int -auth_group_set_type_str(struct auth_group *ag, const char *str) +auth_group_set_type(struct auth_group *ag, const char *str) { - int error, type; + int type; if (strcmp(str, "none") == 0) { type = AG_TYPE_NO_AUTHENTICATION; @@ -560,20 +545,22 @@ auth_group_set_type_str(struct auth_grou return (1); } - error = auth_group_set_type(ag, type); - if (error != 0) { - if (ag->ag_name != NULL) + if (ag->ag_type != AG_TYPE_UNKNOWN && ag->ag_type != type) { + if (ag->ag_name != NULL) { log_warnx("cannot set auth-type to \"%s\" for " "auth-group \"%s\"; already has a different " "type", str, ag->ag_name); - else + } else { log_warnx("cannot set auth-type to \"%s\" for target " "\"%s\"; already has a different type", str, ag->ag_target->t_name); + } return (1); } - return (error); + ag->ag_type = type; + + return (0); } static struct portal * @@ -979,25 +966,10 @@ isns_deregister(struct isns *isns) set_timeout(0, false); } -static int -portal_group_set_filter(struct portal_group *pg, int filter) -{ - - if (pg->pg_discovery_filter == PG_FILTER_UNKNOWN) { - pg->pg_discovery_filter = filter; - return (0); - } - - if (pg->pg_discovery_filter == filter) - return (0); - - return (1); -} - int -portal_group_set_filter_str(struct portal_group *pg, const char *str) +portal_group_set_filter(struct portal_group *pg, const char *str) { - int error, filter; + int filter; if (strcmp(str, "none") == 0) { filter = PG_FILTER_NONE; @@ -1015,15 +987,17 @@ portal_group_set_filter_str(struct porta return (1); } - error = portal_group_set_filter(pg, filter); - if (error != 0) { + if (pg->pg_discovery_filter != PG_FILTER_UNKNOWN && + pg->pg_discovery_filter != filter) { log_warnx("cannot set discovery-filter to \"%s\" for " "portal-group \"%s\"; already has a different " "value", str, pg->pg_name); return (1); } - return (error); + pg->pg_discovery_filter = filter; + + return (0); } static bool Modified: stable/10/usr.sbin/ctld/ctld.h ============================================================================== --- stable/10/usr.sbin/ctld/ctld.h Sat Nov 29 15:32:15 2014 (r275244) +++ stable/10/usr.sbin/ctld/ctld.h Sat Nov 29 15:34:17 2014 (r275245) @@ -266,7 +266,7 @@ struct auth_group *auth_group_new(struct void auth_group_delete(struct auth_group *ag); struct auth_group *auth_group_find(const struct conf *conf, const char *name); -int auth_group_set_type_str(struct auth_group *ag, +int auth_group_set_type(struct auth_group *ag, const char *type); const struct auth *auth_new_chap(struct auth_group *ag, @@ -299,7 +299,7 @@ struct portal_group *portal_group_find(c const char *name); int portal_group_add_listen(struct portal_group *pg, const char *listen, bool iser); -int portal_group_set_filter_str(struct portal_group *pg, +int portal_group_set_filter(struct portal_group *pg, const char *filter); int isns_new(struct conf *conf, const char *addr); Modified: stable/10/usr.sbin/ctld/parse.y ============================================================================== --- stable/10/usr.sbin/ctld/parse.y Sat Nov 29 15:32:15 2014 (r275244) +++ stable/10/usr.sbin/ctld/parse.y Sat Nov 29 15:34:17 2014 (r275245) @@ -238,7 +238,7 @@ auth_group_auth_type: AUTH_TYPE STR { int error; - error = auth_group_set_type_str(auth_group, $2); + error = auth_group_set_type(auth_group, $2); free($2); if (error != 0) return (1); @@ -358,7 +358,7 @@ portal_group_discovery_filter: DISCOVERY { int error; - error = portal_group_set_filter_str(portal_group, $2); + error = portal_group_set_filter(portal_group, $2); free($2); if (error != 0) return (1); @@ -480,7 +480,7 @@ target_auth_type: AUTH_TYPE STR } target->t_auth_group->ag_target = target; } - error = auth_group_set_type_str(target->t_auth_group, $2); + error = auth_group_set_type(target->t_auth_group, $2); free($2); if (error != 0) return (1); From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:36:12 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 14A99385; Sat, 29 Nov 2014 15:36:12 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB1273E7; Sat, 29 Nov 2014 15:36:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFaBSL052297; Sat, 29 Nov 2014 15:36:11 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFaBqX052293; Sat, 29 Nov 2014 15:36:11 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291536.sATFaBqX052293@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:36:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275246 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:36:12 -0000 Author: trasz Date: Sat Nov 29 15:36:10 2014 New Revision: 275246 URL: https://svnweb.freebsd.org/changeset/base/275246 Log: MFC r273820: Make it possible to optionally use semicolon to separate statements. This makes it possible to format stuff like this: target xxx { lun 0 { path /foo/bar; size 4G; } } Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/parse.y stable/10/usr.sbin/ctld/token.l Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/parse.y ============================================================================== --- stable/10/usr.sbin/ctld/parse.y Sat Nov 29 15:34:17 2014 (r275245) +++ stable/10/usr.sbin/ctld/parse.y Sat Nov 29 15:36:10 2014 (r275246) @@ -60,7 +60,7 @@ extern void yyrestart(FILE *); %token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL %token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP DISCOVERY_FILTER %token INITIATOR_NAME INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC -%token OPENING_BRACKET OPTION PATH PIDFILE PORTAL_GROUP SERIAL SIZE STR +%token OPENING_BRACKET OPTION PATH PIDFILE PORTAL_GROUP SEMICOLON SERIAL SIZE STR %token TARGET TIMEOUT ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT %union @@ -75,6 +75,8 @@ extern void yyrestart(FILE *); statements: | statements statement + | + statements statement SEMICOLON ; statement: @@ -220,6 +222,8 @@ auth_group_name: STR auth_group_entries: | auth_group_entries auth_group_entry + | + auth_group_entries auth_group_entry SEMICOLON ; auth_group_entry: @@ -322,6 +326,8 @@ portal_group_name: STR portal_group_entries: | portal_group_entries portal_group_entry + | + portal_group_entries portal_group_entry SEMICOLON ; portal_group_entry: @@ -406,6 +412,8 @@ target_name: STR target_entries: | target_entries target_entry + | + target_entries target_entry SEMICOLON ; target_entry: @@ -653,6 +661,8 @@ lun_number: STR lun_entries: | lun_entries lun_entry + | + lun_entries lun_entry SEMICOLON ; lun_entry: Modified: stable/10/usr.sbin/ctld/token.l ============================================================================== --- stable/10/usr.sbin/ctld/token.l Sat Nov 29 15:34:17 2014 (r275245) +++ stable/10/usr.sbin/ctld/token.l Sat Nov 29 15:36:10 2014 (r275246) @@ -83,6 +83,7 @@ timeout { return TIMEOUT; } \} { return CLOSING_BRACKET; } #.*$ /* ignore comments */; \n { lineno++; } +; { return SEMICOLON; } [ \t]+ /* ignore whitespace */; . { yylval.str = strdup(yytext); return STR; } %% From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:37:51 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E7F72696; Sat, 29 Nov 2014 15:37:51 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D44E35E2; Sat, 29 Nov 2014 15:37:51 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFbpJI052857; Sat, 29 Nov 2014 15:37:51 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFbpLN052856; Sat, 29 Nov 2014 15:37:51 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291537.sATFbpLN052856@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:37:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275247 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:37:52 -0000 Author: trasz Date: Sat Nov 29 15:37:51 2014 New Revision: 275247 URL: https://svnweb.freebsd.org/changeset/base/275247 Log: MFC r273821: Keep the token list sorted. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/parse.y Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/parse.y ============================================================================== --- stable/10/usr.sbin/ctld/parse.y Sat Nov 29 15:36:10 2014 (r275246) +++ stable/10/usr.sbin/ctld/parse.y Sat Nov 29 15:37:51 2014 (r275247) @@ -59,9 +59,9 @@ extern void yyrestart(FILE *); %token ALIAS AUTH_GROUP AUTH_TYPE BACKEND BLOCKSIZE CHAP CHAP_MUTUAL %token CLOSING_BRACKET DEBUG DEVICE_ID DISCOVERY_AUTH_GROUP DISCOVERY_FILTER -%token INITIATOR_NAME INITIATOR_PORTAL LISTEN LISTEN_ISER LUN MAXPROC -%token OPENING_BRACKET OPTION PATH PIDFILE PORTAL_GROUP SEMICOLON SERIAL SIZE STR -%token TARGET TIMEOUT ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT +%token INITIATOR_NAME INITIATOR_PORTAL ISNS_SERVER ISNS_PERIOD ISNS_TIMEOUT +%token LISTEN LISTEN_ISER LUN MAXPROC OPENING_BRACKET OPTION +%token PATH PIDFILE PORTAL_GROUP SEMICOLON SERIAL SIZE STR TARGET TIMEOUT %union { From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:39:32 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id C675C7DE; Sat, 29 Nov 2014 15:39:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2A475EE; Sat, 29 Nov 2014 15:39:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFdWmW053157; Sat, 29 Nov 2014 15:39:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFdWPg053155; Sat, 29 Nov 2014 15:39:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291539.sATFdWPg053155@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:39:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275248 - in stable/10: usr.bin/iscsictl usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:39:32 -0000 Author: trasz Date: Sat Nov 29 15:39:31 2014 New Revision: 275248 URL: https://svnweb.freebsd.org/changeset/base/275248 Log: MFC r273822: Fix iscsictl(8) and ctld(8) to correctly handle Windows newlines (CRLF) in iscsi.conf and ctl.conf. Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.bin/iscsictl/token.l stable/10/usr.sbin/ctld/token.l Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.bin/iscsictl/token.l ============================================================================== --- stable/10/usr.bin/iscsictl/token.l Sat Nov 29 15:37:51 2014 (r275247) +++ stable/10/usr.bin/iscsictl/token.l Sat Nov 29 15:39:31 2014 (r275248) @@ -90,6 +90,7 @@ chapDigest { return IGNORED; } = { return EQUALS; } ; { return SEMICOLON; } #.*$ /* ignore comments */; +\r\n { lineno++; } \n { lineno++; } [ \t]+ /* ignore whitespace */; . { yylval.str = strdup(yytext); return STR; } Modified: stable/10/usr.sbin/ctld/token.l ============================================================================== --- stable/10/usr.sbin/ctld/token.l Sat Nov 29 15:37:51 2014 (r275247) +++ stable/10/usr.sbin/ctld/token.l Sat Nov 29 15:39:31 2014 (r275248) @@ -82,6 +82,7 @@ timeout { return TIMEOUT; } \{ { return OPENING_BRACKET; } \} { return CLOSING_BRACKET; } #.*$ /* ignore comments */; +\r\n { lineno++; } \n { lineno++; } ; { return SEMICOLON; } [ \t]+ /* ignore whitespace */; From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:41:57 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 16A3391D; Sat, 29 Nov 2014 15:41:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 020E2692; Sat, 29 Nov 2014 15:41:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFfucw056928; Sat, 29 Nov 2014 15:41:56 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFfujs056925; Sat, 29 Nov 2014 15:41:56 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291541.sATFfujs056925@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:41:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275249 - in stable/10: sbin/mount_nfs sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:41:57 -0000 Author: trasz Date: Sat Nov 29 15:41:55 2014 New Revision: 275249 URL: https://svnweb.freebsd.org/changeset/base/275249 Log: MFC r273849: Add support for "timeo", "actimeo", "noac", and "proto" options to mount_nfs(8). They are implemented on Linux, OS X, and Solaris, and thus can be expected to appear in automounter maps. Sponsored by: The FreeBSD Foundation Modified: stable/10/sbin/mount_nfs/mount_nfs.8 stable/10/sbin/mount_nfs/mount_nfs.c stable/10/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/10/sbin/mount_nfs/mount_nfs.8 Sat Nov 29 15:39:31 2014 (r275248) +++ stable/10/sbin/mount_nfs/mount_nfs.8 Sat Nov 29 15:41:55 2014 (r275249) @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd August 5, 2014 +.Dd October 30, 2014 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -118,6 +118,8 @@ for regular files, and 30 -> 60 seconds The algorithm to calculate the timeout is based on the age of the file. The older the file, the longer the cache is considered valid, subject to the limits above. +.It Cm actimeo Ns = Ns Aq Ar seconds +Set four cache timeouts above to specified value. .It Cm allgssname This option can be used along with .Fl o Cm gssname @@ -211,6 +213,8 @@ NFS Version 4 protocol. This option is only meaningful when used with the .Cm minorversion option. +.It Cm noac +Disable attribute caching. .It Cm noconn For UDP mount points, do not do a .Xr connect 2 . @@ -282,6 +286,15 @@ use a reserved socket port number (see b .It Cm port Ns = Ns Aq Ar port_number Use specified port number for NFS requests. The default is to query the portmapper for the NFS port. +.It Cm proto Ns = Ns Aq Ar protocol +Specify transport protocol version to use. +Currently, they are: +.Bd -literal +udp - Use UDP over IPv4 +tcp - Use TCP over IPv4 +udp6 - Use UDP over IPv6 +tcp6 - Use TCP over IPv6 +.Ed .It Cm rdirplus Used with NFSV3 to specify that the \fBReaddirPlus\fR RPC should be used. @@ -369,6 +382,9 @@ value if there is a low retransmit rate option should be specified when using this option to manually tune the timeout interval.) +.It Cm timeo Ns = Ns Aq Ar value +Alias for +.Cm timeout . .It Cm udp Use UDP transport. .It Cm vers Ns = Ns Aq Ar vers_number Modified: stable/10/sbin/mount_nfs/mount_nfs.c ============================================================================== --- stable/10/sbin/mount_nfs/mount_nfs.c Sat Nov 29 15:39:31 2014 (r275248) +++ stable/10/sbin/mount_nfs/mount_nfs.c Sat Nov 29 15:41:55 2014 (r275249) @@ -284,6 +284,35 @@ main(int argc, char *argv[]) err(1, "asprintf"); } else if (strcmp(opt, "principal") == 0) { got_principal = 1; + } else if (strcmp(opt, "proto") == 0) { + pass_flag_to_nmount=0; + if (strcmp(val, "tcp") == 0) { + nfsproto = IPPROTO_TCP; + opflags |= OF_NOINET6; + build_iovec(&iov, &iovlen, + "tcp", NULL, 0); + } else if (strcmp(val, "udp") == 0) { + mnttcp_ok = 0; + nfsproto = IPPROTO_UDP; + opflags |= OF_NOINET6; + build_iovec(&iov, &iovlen, + "udp", NULL, 0); + } else if (strcmp(val, "tcp6") == 0) { + nfsproto = IPPROTO_TCP; + opflags |= OF_NOINET4; + build_iovec(&iov, &iovlen, + "tcp", NULL, 0); + } else if (strcmp(val, "udp6") == 0) { + mnttcp_ok = 0; + nfsproto = IPPROTO_UDP; + opflags |= OF_NOINET4; + build_iovec(&iov, &iovlen, + "udp", NULL, 0); + } else { + errx(1, + "illegal proto value -- %s", + val); + } } else if (strcmp(opt, "sec") == 0) { /* * Don't add this option to Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvfsops.c Sat Nov 29 15:39:31 2014 (r275248) +++ stable/10/sys/fs/nfsclient/nfs_clvfsops.c Sat Nov 29 15:41:55 2014 (r275249) @@ -722,15 +722,15 @@ nfs_decode_args(struct mount *mp, struct } static const char *nfs_opts[] = { "from", "nfs_args", - "noatime", "noexec", "suiddir", "nosuid", "nosymfollow", "union", + "noac", "noatime", "noexec", "suiddir", "nosuid", "nosymfollow", "union", "noclusterr", "noclusterw", "multilabel", "acls", "force", "update", "async", "noconn", "nolockd", "conn", "lockd", "intr", "rdirplus", "readdirsize", "soft", "hard", "mntudp", "tcp", "udp", "wsize", "rsize", - "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "resvport", - "readahead", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", - "principal", "nfsv4", "gssname", "allgssname", "dirpath", "minorversion", - "nametimeo", "negnametimeo", "nocto", "noncontigwr", "pnfs", - "wcommitsize", + "retrans", "actimeo", "acregmin", "acregmax", "acdirmin", "acdirmax", + "resvport", "readahead", "hostname", "timeo", "timeout", "addr", "fh", + "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", + "minorversion", "nametimeo", "negnametimeo", "nocto", "noncontigwr", + "pnfs", "wcommitsize", NULL }; /* @@ -815,6 +815,12 @@ nfs_mount(struct mount *mp) } /* Handle the new style options. */ + if (vfs_getopt(mp->mnt_optnew, "noac", NULL, NULL) == 0) { + args.acdirmin = args.acdirmax = + args.acregmin = args.acregmax = 0; + args.flags |= NFSMNT_ACDIRMIN | NFSMNT_ACDIRMAX | + NFSMNT_ACREGMIN | NFSMNT_ACREGMAX; + } if (vfs_getopt(mp->mnt_optnew, "noconn", NULL, NULL) == 0) args.flags |= NFSMNT_NOCONN; if (vfs_getopt(mp->mnt_optnew, "conn", NULL, NULL) == 0) @@ -930,6 +936,18 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_RETRANS; } + if (vfs_getopt(mp->mnt_optnew, "actimeo", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.acregmin); + if (ret != 1 || args.acregmin < 0) { + vfs_mount_error(mp, "illegal actimeo: %s", + opt); + error = EINVAL; + goto out; + } + args.acdirmin = args.acdirmax = args.acregmax = args.acregmin; + args.flags |= NFSMNT_ACDIRMIN | NFSMNT_ACDIRMAX | + NFSMNT_ACREGMIN | NFSMNT_ACREGMAX; + } if (vfs_getopt(mp->mnt_optnew, "acregmin", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.acregmin); if (ret != 1 || args.acregmin < 0) { @@ -979,6 +997,16 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_WCOMMITSIZE; } + if (vfs_getopt(mp->mnt_optnew, "timeo", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &args.timeo); + if (ret != 1 || args.timeo <= 0) { + vfs_mount_error(mp, "illegal timeo: %s", + opt); + error = EINVAL; + goto out; + } + args.flags |= NFSMNT_TIMEO; + } if (vfs_getopt(mp->mnt_optnew, "timeout", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &args.timeo); if (ret != 1 || args.timeo <= 0) { From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:43:33 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3CE6DAC2; Sat, 29 Nov 2014 15:43:33 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 292A96A5; Sat, 29 Nov 2014 15:43:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFhXQO057181; Sat, 29 Nov 2014 15:43:33 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFhXUQ057180; Sat, 29 Nov 2014 15:43:33 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291543.sATFhXUQ057180@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:43:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275250 - stable/10/sbin/mount_nfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:43:33 -0000 Author: trasz Date: Sat Nov 29 15:43:32 2014 New Revision: 275250 URL: https://svnweb.freebsd.org/changeset/base/275250 Log: MFC r273851: Note that the "timeout" nfs option is in tenths of a second. Sponsored by: The FreeBSD Foundation Modified: stable/10/sbin/mount_nfs/mount_nfs.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/10/sbin/mount_nfs/mount_nfs.8 Sat Nov 29 15:41:55 2014 (r275249) +++ stable/10/sbin/mount_nfs/mount_nfs.8 Sat Nov 29 15:43:32 2014 (r275250) @@ -370,7 +370,8 @@ LAN and WAN configurations compared to U Some old NFS servers do not support this method; UDP mounts may be required for interoperability. .It Cm timeout Ns = Ns Aq Ar value -Set the initial retransmit timeout to the specified value. +Set the initial retransmit timeout to the specified value, +expressed in tenths of a second. May be useful for fine tuning UDP mounts over internetworks with high packet loss rates or an overloaded server. Try increasing the interval if From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:48:48 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 26CEFD1F; Sat, 29 Nov 2014 15:48:48 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 131836CB; Sat, 29 Nov 2014 15:48:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFmlow058075; Sat, 29 Nov 2014 15:48:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFmlSX058074; Sat, 29 Nov 2014 15:48:47 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291548.sATFmlSX058074@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275252 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:48:48 -0000 Author: trasz Date: Sat Nov 29 15:48:47 2014 New Revision: 275252 URL: https://svnweb.freebsd.org/changeset/base/275252 Log: MFC r273852: Fix handling of "conn" mount_nfs(8) option. Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvfsops.c Sat Nov 29 15:45:19 2014 (r275251) +++ stable/10/sys/fs/nfsclient/nfs_clvfsops.c Sat Nov 29 15:48:47 2014 (r275252) @@ -824,7 +824,7 @@ nfs_mount(struct mount *mp) if (vfs_getopt(mp->mnt_optnew, "noconn", NULL, NULL) == 0) args.flags |= NFSMNT_NOCONN; if (vfs_getopt(mp->mnt_optnew, "conn", NULL, NULL) == 0) - args.flags |= NFSMNT_NOCONN; + args.flags &= ~NFSMNT_NOCONN; if (vfs_getopt(mp->mnt_optnew, "nolockd", NULL, NULL) == 0) args.flags |= NFSMNT_NOLOCKD; if (vfs_getopt(mp->mnt_optnew, "lockd", NULL, NULL) == 0) From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:50:16 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 581B0E61; Sat, 29 Nov 2014 15:50:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 39DD76D9; Sat, 29 Nov 2014 15:50:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFoGqw058379; Sat, 29 Nov 2014 15:50:16 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFoEDb058371; Sat, 29 Nov 2014 15:50:14 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291550.sATFoEDb058371@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:50:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275253 - stable/10/lib/libc/posix1e X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:50:16 -0000 Author: trasz Date: Sat Nov 29 15:50:13 2014 New Revision: 275253 URL: https://svnweb.freebsd.org/changeset/base/275253 Log: MFC r273853: Make it clear that ACL flags are NFSv4-only. Sponsored by: The FreeBSD Foundation Modified: stable/10/lib/libc/posix1e/acl_add_flag_np.3 stable/10/lib/libc/posix1e/acl_clear_flags_np.3 stable/10/lib/libc/posix1e/acl_delete_flag_np.3 stable/10/lib/libc/posix1e/acl_get_flag_np.3 stable/10/lib/libc/posix1e/acl_get_flagset_np.3 stable/10/lib/libc/posix1e/acl_set_entry_type_np.3 stable/10/lib/libc/posix1e/acl_set_flagset_np.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/posix1e/acl_add_flag_np.3 ============================================================================== --- stable/10/lib/libc/posix1e/acl_add_flag_np.3 Sat Nov 29 15:48:47 2014 (r275252) +++ stable/10/lib/libc/posix1e/acl_add_flag_np.3 Sat Nov 29 15:50:13 2014 (r275253) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_ADD_FLAG_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_add_flag_np function -is a non-portable call that adds the flags contained in +is a non-portable call that adds the NFSv4 ACL flags contained in .Fa flags to the flagset .Fa flagset_d . Modified: stable/10/lib/libc/posix1e/acl_clear_flags_np.3 ============================================================================== --- stable/10/lib/libc/posix1e/acl_clear_flags_np.3 Sat Nov 29 15:48:47 2014 (r275252) +++ stable/10/lib/libc/posix1e/acl_clear_flags_np.3 Sat Nov 29 15:50:13 2014 (r275253) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_CLEAR_FLAGS_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_clear_flags_np function -is a non-portable call that clears all flags from flagset +is a non-portable call that clears all NFSv4 ACL flags from flagset .Fa flagset_d . .Sh RETURN VALUES .Rv -std acl_clear_flags_np Modified: stable/10/lib/libc/posix1e/acl_delete_flag_np.3 ============================================================================== --- stable/10/lib/libc/posix1e/acl_delete_flag_np.3 Sat Nov 29 15:48:47 2014 (r275252) +++ stable/10/lib/libc/posix1e/acl_delete_flag_np.3 Sat Nov 29 15:50:13 2014 (r275253) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 10, 2001 +.Dd October 30, 2014 .Dt ACL_DELETE_FLAG_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_delete_flag_np function -is a non-portable call that removes specific flags from flagset +is a non-portable call that removes specific NFSv4 ACL flags from flagset .Fa flags . .Sh RETURN VALUES .Rv -std acl_delete_flag_np Modified: stable/10/lib/libc/posix1e/acl_get_flag_np.3 ============================================================================== --- stable/10/lib/libc/posix1e/acl_get_flag_np.3 Sat Nov 29 15:48:47 2014 (r275252) +++ stable/10/lib/libc/posix1e/acl_get_flag_np.3 Sat Nov 29 15:50:13 2014 (r275253) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_GET_FLAG_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_get_flag_np function -is a non-portable function that checks if a flag is set in +is a non-portable function that checks if a NFSv4 ACL flag is set in a flagset. .Sh RETURN VALUES If the flag in Modified: stable/10/lib/libc/posix1e/acl_get_flagset_np.3 ============================================================================== --- stable/10/lib/libc/posix1e/acl_get_flagset_np.3 Sat Nov 29 15:48:47 2014 (r275252) +++ stable/10/lib/libc/posix1e/acl_get_flagset_np.3 Sat Nov 29 15:50:13 2014 (r275253) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_GET_FLAGSET_NP 3 .Os .Sh NAME @@ -44,7 +44,7 @@ The function is a non-portable call that returns via .Fa flagset_np_p -a descriptor to the flagset in the ACL entry +a descriptor to the flagset in the NFSv4 ACL entry .Fa entry_d . Subsequent operations using the returned flagset operate on the flagset within the ACL entry. Modified: stable/10/lib/libc/posix1e/acl_set_entry_type_np.3 ============================================================================== --- stable/10/lib/libc/posix1e/acl_set_entry_type_np.3 Sat Nov 29 15:48:47 2014 (r275252) +++ stable/10/lib/libc/posix1e/acl_set_entry_type_np.3 Sat Nov 29 15:50:13 2014 (r275253) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_SET_ENTRY_TYPE_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_set_entry_type_np function -is a non-portable call that sets the type of the ACL entry +is a non-portable call that sets the type of the NFSv4 ACL entry .Fa entry_d to the value referred to by .Fa entry_type . Modified: stable/10/lib/libc/posix1e/acl_set_flagset_np.3 ============================================================================== --- stable/10/lib/libc/posix1e/acl_set_flagset_np.3 Sat Nov 29 15:48:47 2014 (r275252) +++ stable/10/lib/libc/posix1e/acl_set_flagset_np.3 Sat Nov 29 15:50:13 2014 (r275253) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 25, 2009 +.Dd October 30, 2014 .Dt ACL_SET_FLAGSET_NP 3 .Os .Sh NAME @@ -42,7 +42,7 @@ The .Fn acl_set_flagset_np function -is a non-portable call that sets the flags of ACL entry +is a non-portable call that sets the flags of NFSv4 ACL entry .Fa entry_d with the flags contained in .Fa flagset_d . From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:51:49 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8BC41F9B; Sat, 29 Nov 2014 15:51:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 55CA47CB; Sat, 29 Nov 2014 15:51:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFpn8O061963; Sat, 29 Nov 2014 15:51:49 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFpnwK061962; Sat, 29 Nov 2014 15:51:49 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291551.sATFpnwK061962@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275254 - stable/10/lib/libc/posix1e X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:51:49 -0000 Author: trasz Date: Sat Nov 29 15:51:48 2014 New Revision: 275254 URL: https://svnweb.freebsd.org/changeset/base/275254 Log: MFC r273854: Update acl(3) to expand on NFSv4 ACL support. Sponsored by: The FreeBSD Foundation Modified: stable/10/lib/libc/posix1e/acl.3 Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/posix1e/acl.3 ============================================================================== --- stable/10/lib/libc/posix1e/acl.3 Sat Nov 29 15:50:13 2014 (r275253) +++ stable/10/lib/libc/posix1e/acl.3 Sat Nov 29 15:51:48 2014 (r275254) @@ -27,12 +27,12 @@ .\" .\" $FreeBSD$ .\" -.Dd November 12, 2013 +.Dd October 30, 2014 .Dt ACL 3 .Os .Sh NAME .Nm acl -.Nd introduction to the POSIX.1e ACL security API +.Nd introduction to the POSIX.1e/NFSv4 ACL security API .Sh LIBRARY .Lb libc .Sh SYNOPSIS @@ -42,13 +42,15 @@ .Fx permits file systems to export Access Control Lists via the VFS, and provides a library for userland access to and manipulation of these ACLs. -Not all file systems provide support for ACLs, and some may require that +.Fx +supports POSIX.1e and NFSv4 ACLs, but +not all file systems provide support for ACLs, and some may require that ACL support be explicitly enabled by the administrator. The library calls include routines to allocate, duplicate, retrieve, set, and validate ACLs associated with file objects. As well as the POSIX.1e routines, there are a number of non-portable -extensions defined that allow for alternative ACL semantics than the -POSIX.1e semantics, such as NFSv4, AFS, NTFS, Coda, and NWFS semantics. +extensions defined that allow for ACL semantics alternative to +POSIX.1e, such as NFSv4. Where routines are non-standard, they are suffixed with _np to indicate that they are not portable. .Pp @@ -292,6 +294,8 @@ POSIX.1e support was introduced in .Fx 5.0 was the first version to include a complete ACL implementation based on extended attributes for the UFS and UFS2 file systems. +NFSv4 ACL support was introduced in +.Fx 8.0 . .Pp The .Xr getfacl 1 From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:55:36 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 89AB5173; Sat, 29 Nov 2014 15:55:36 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 750A97E0; Sat, 29 Nov 2014 15:55:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFtaAG062491; Sat, 29 Nov 2014 15:55:36 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFtanV062490; Sat, 29 Nov 2014 15:55:36 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291555.sATFtanV062490@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:55:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275255 - stable/10/sbin/mount_nfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:55:36 -0000 Author: trasz Date: Sat Nov 29 15:55:35 2014 New Revision: 275255 URL: https://svnweb.freebsd.org/changeset/base/275255 Log: MFC r273848: Get rid of obsolete code in mount_nfs(8). MFC r273861: Remove two functions unused after r273848. Would be nice if clang or at least scan-build yelled about it. Sponsored by: The FreeBSD Foundation Modified: stable/10/sbin/mount_nfs/mount_nfs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mount_nfs/mount_nfs.c ============================================================================== --- stable/10/sbin/mount_nfs/mount_nfs.c Sat Nov 29 15:51:48 2014 (r275254) +++ stable/10/sbin/mount_nfs/mount_nfs.c Sat Nov 29 15:55:35 2014 (r275255) @@ -130,7 +130,6 @@ enum tryret { TRYRET_LOCALERR /* Local failure. */ }; -static int fallback_mount(struct iovec *iov, int iovlen); static int sec_name_to_num(char *sec); static char *sec_num_to_name(int num); static int getnfsargs(char *, struct iovec **iov, int *iovlen); @@ -150,7 +149,6 @@ main(int argc, char *argv[]) int c; struct iovec *iov; int num, iovlen; - int osversion; char *name, *p, *spec, *fstype; char mntpath[MAXPATHLEN], errmsg[255]; char hostname[MAXHOSTNAMELEN + 1], *gssname, gssn[MAXHOSTNAMELEN + 50]; @@ -472,255 +470,13 @@ main(int argc, char *argv[]) build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); - /* - * XXX: - * Backwards compatibility routines for older kernels. - * Remove this and fallback_mount() code when we do not need to support - * NFS mounts against older kernels which still need - * struct nfs_args to be passed in via nmount(). - */ - osversion = getosreldate(); - if (osversion >= 702100) { - if (nmount(iov, iovlen, 0)) - err(1, "%s, %s", mntpath, errmsg); - } else { - if (fallback_mount(iov, iovlen)) - err(1, "%s, %s", mntpath, errmsg); - } + if (nmount(iov, iovlen, 0)) + err(1, "%s, %s", mntpath, errmsg); exit(0); } static int -findopt(struct iovec *iov, int iovlen, const char *name, - char **valuep, int *lenp) -{ - int i; - - for (i = 0; i < iovlen/2; i++, iov += 2) { - if (strcmp(name, iov[0].iov_base) == 0) { - if (valuep) - *valuep = iov[1].iov_base; - if (lenp) - *lenp = iov[1].iov_len; - return (0); - } - } - return (ENOENT); -} - -static void -copyopt(struct iovec **newiov, int *newiovlen, - struct iovec *iov, int iovlen, const char *name) -{ - char *value; - int len; - - if (findopt(iov, iovlen, name, &value, &len) == 0) - build_iovec(newiov, newiovlen, name, value, len); -} - -/* - * XXX: This function is provided for backwards - * compatibility with older kernels which did not support - * passing NFS mount options to nmount() as individual - * parameters. It should be eventually be removed. - */ -static int -fallback_mount(struct iovec *iov, int iovlen) -{ - struct nfs_args args = { - .version = NFS_ARGSVERSION, - .addr = NULL, - .addrlen = sizeof (struct sockaddr_in), - .sotype = SOCK_STREAM, - .proto = 0, - .fh = NULL, - .fhsize = 0, - .flags = NFSMNT_RESVPORT, - .wsize = NFS_WSIZE, - .rsize = NFS_RSIZE, - .readdirsize = NFS_READDIRSIZE, - .timeo = 10, - .retrans = NFS_RETRANS, - .maxgrouplist = NFS_MAXGRPS, - .readahead = NFS_DEFRAHEAD, - .wcommitsize = 0, /* was: NQ_DEFLEASE */ - .deadthresh = NFS_MAXDEADTHRESH, /* was: NQ_DEADTHRESH */ - .hostname = NULL, - /* args version 4 */ - .acregmin = NFS_MINATTRTIMO, - .acregmax = NFS_MAXATTRTIMO, - .acdirmin = NFS_MINDIRATTRTIMO, - .acdirmax = NFS_MAXDIRATTRTIMO, - }; - int ret; - char *opt; - struct iovec *newiov; - int newiovlen; - - if (findopt(iov, iovlen, "dumbtimer", NULL, NULL) == 0) - args.flags |= NFSMNT_DUMBTIMR; - if (findopt(iov, iovlen, "noconn", NULL, NULL) == 0) - args.flags |= NFSMNT_NOCONN; - if (findopt(iov, iovlen, "conn", NULL, NULL) == 0) - args.flags |= NFSMNT_NOCONN; - if (findopt(iov, iovlen, "nolockd", NULL, NULL) == 0) - args.flags |= NFSMNT_NOLOCKD; - if (findopt(iov, iovlen, "lockd", NULL, NULL) == 0) - args.flags &= ~NFSMNT_NOLOCKD; - if (findopt(iov, iovlen, "intr", NULL, NULL) == 0) - args.flags |= NFSMNT_INT; - if (findopt(iov, iovlen, "rdirplus", NULL, NULL) == 0) - args.flags |= NFSMNT_RDIRPLUS; - if (findopt(iov, iovlen, "resvport", NULL, NULL) == 0) - args.flags |= NFSMNT_RESVPORT; - if (findopt(iov, iovlen, "noresvport", NULL, NULL) == 0) - args.flags &= ~NFSMNT_RESVPORT; - if (findopt(iov, iovlen, "soft", NULL, NULL) == 0) - args.flags |= NFSMNT_SOFT; - if (findopt(iov, iovlen, "hard", NULL, NULL) == 0) - args.flags &= ~NFSMNT_SOFT; - if (findopt(iov, iovlen, "mntudp", NULL, NULL) == 0) - args.sotype = SOCK_DGRAM; - if (findopt(iov, iovlen, "udp", NULL, NULL) == 0) - args.sotype = SOCK_DGRAM; - if (findopt(iov, iovlen, "tcp", NULL, NULL) == 0) - args.sotype = SOCK_STREAM; - if (findopt(iov, iovlen, "nfsv3", NULL, NULL) == 0) - args.flags |= NFSMNT_NFSV3; - if (findopt(iov, iovlen, "readdirsize", &opt, NULL) == 0) { - if (opt == NULL) { - errx(1, "illegal readdirsize"); - } - ret = sscanf(opt, "%d", &args.readdirsize); - if (ret != 1 || args.readdirsize <= 0) { - errx(1, "illegal readdirsize: %s", opt); - } - args.flags |= NFSMNT_READDIRSIZE; - } - if (findopt(iov, iovlen, "readahead", &opt, NULL) == 0) { - if (opt == NULL) { - errx(1, "illegal readahead"); - } - ret = sscanf(opt, "%d", &args.readahead); - if (ret != 1 || args.readahead <= 0) { - errx(1, "illegal readahead: %s", opt); - } - args.flags |= NFSMNT_READAHEAD; - } - if (findopt(iov, iovlen, "wsize", &opt, NULL) == 0) { - if (opt == NULL) { - errx(1, "illegal wsize"); - } - ret = sscanf(opt, "%d", &args.wsize); - if (ret != 1 || args.wsize <= 0) { - errx(1, "illegal wsize: %s", opt); - } - args.flags |= NFSMNT_WSIZE; - } - if (findopt(iov, iovlen, "rsize", &opt, NULL) == 0) { - if (opt == NULL) { - errx(1, "illegal rsize"); - } - ret = sscanf(opt, "%d", &args.rsize); - if (ret != 1 || args.rsize <= 0) { - errx(1, "illegal wsize: %s", opt); - } - args.flags |= NFSMNT_RSIZE; - } - if (findopt(iov, iovlen, "retrans", &opt, NULL) == 0) { - if (opt == NULL) { - errx(1, "illegal retrans"); - } - ret = sscanf(opt, "%d", &args.retrans); - if (ret != 1 || args.retrans <= 0) { - errx(1, "illegal retrans: %s", opt); - } - args.flags |= NFSMNT_RETRANS; - } - if (findopt(iov, iovlen, "acregmin", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.acregmin); - if (ret != 1 || args.acregmin < 0) { - errx(1, "illegal acregmin: %s", opt); - } - args.flags |= NFSMNT_ACREGMIN; - } - if (findopt(iov, iovlen, "acregmax", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.acregmax); - if (ret != 1 || args.acregmax < 0) { - errx(1, "illegal acregmax: %s", opt); - } - args.flags |= NFSMNT_ACREGMAX; - } - if (findopt(iov, iovlen, "acdirmin", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.acdirmin); - if (ret != 1 || args.acdirmin < 0) { - errx(1, "illegal acdirmin: %s", opt); - } - args.flags |= NFSMNT_ACDIRMIN; - } - if (findopt(iov, iovlen, "acdirmax", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.acdirmax); - if (ret != 1 || args.acdirmax < 0) { - errx(1, "illegal acdirmax: %s", opt); - } - args.flags |= NFSMNT_ACDIRMAX; - } - if (findopt(iov, iovlen, "wcommitsize", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.wcommitsize); - if (ret != 1 || args.wcommitsize < 0) { - errx(1, "illegal wcommitsize: %s", opt); - } - args.flags |= NFSMNT_WCOMMITSIZE; - } - if (findopt(iov, iovlen, "deadthresh", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.deadthresh); - if (ret != 1 || args.deadthresh <= 0) { - errx(1, "illegal deadthresh: %s", opt); - } - args.flags |= NFSMNT_DEADTHRESH; - } - if (findopt(iov, iovlen, "timeout", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.timeo); - if (ret != 1 || args.timeo <= 0) { - errx(1, "illegal timeout: %s", opt); - } - args.flags |= NFSMNT_TIMEO; - } - if (findopt(iov, iovlen, "maxgroups", &opt, NULL) == 0) { - ret = sscanf(opt, "%d", &args.maxgrouplist); - if (ret != 1 || args.timeo <= 0) { - errx(1, "illegal maxgroups: %s", opt); - } - args.flags |= NFSMNT_MAXGRPS; - } - if (findopt(iov, iovlen, "addr", &opt, - &args.addrlen) == 0) { - args.addr = (struct sockaddr *) opt; - } - if (findopt(iov, iovlen, "fh", &opt, &args.fhsize) == 0) { - args.fh = opt; - } - if (findopt(iov, iovlen, "hostname", &args.hostname, - NULL) == 0) { - } - if (args.hostname == NULL) { - errx(1, "Invalid hostname"); - } - - newiov = NULL; - newiovlen = 0; - - build_iovec(&newiov, &newiovlen, "nfs_args", &args, sizeof(args)); - copyopt(&newiov, &newiovlen, iov, iovlen, "fstype"); - copyopt(&newiov, &newiovlen, iov, iovlen, "fspath"); - copyopt(&newiov, &newiovlen, iov, iovlen, "errmsg"); - - return nmount(newiov, newiovlen, 0); -} - -static int sec_name_to_num(char *sec) { if (!strcmp(sec, "krb5")) From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 15:57:32 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8073743D; Sat, 29 Nov 2014 15:57:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6B82F7FC; Sat, 29 Nov 2014 15:57:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATFvWMh062870; Sat, 29 Nov 2014 15:57:32 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATFvWAb062868; Sat, 29 Nov 2014 15:57:32 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291557.sATFvWAb062868@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 15:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275257 - stable/10/sbin/mount_nfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 15:57:32 -0000 Author: trasz Date: Sat Nov 29 15:57:31 2014 New Revision: 275257 URL: https://svnweb.freebsd.org/changeset/base/275257 Log: MFC r273896: Build mount_nfs(8) with WARNS=6. Sponsored by: The FreeBSD Foundation Modified: stable/10/sbin/mount_nfs/Makefile stable/10/sbin/mount_nfs/mount_nfs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mount_nfs/Makefile ============================================================================== --- stable/10/sbin/mount_nfs/Makefile Sat Nov 29 15:56:52 2014 (r275256) +++ stable/10/sbin/mount_nfs/Makefile Sat Nov 29 15:57:31 2014 (r275257) @@ -10,7 +10,6 @@ MLINKS= mount_nfs.8 mount_oldnfs.8 MOUNT= ${.CURDIR}/../mount UMNTALL= ${.CURDIR}/../../usr.sbin/rpc.umntall CFLAGS+= -DNFS -I${MOUNT} -I${UMNTALL} -WARNS?= 3 LINKS= ${BINDIR}/mount_nfs ${BINDIR}/mount_oldnfs Modified: stable/10/sbin/mount_nfs/mount_nfs.c ============================================================================== --- stable/10/sbin/mount_nfs/mount_nfs.c Sat Nov 29 15:56:52 2014 (r275256) +++ stable/10/sbin/mount_nfs/mount_nfs.c Sat Nov 29 15:57:31 2014 (r275257) @@ -79,7 +79,7 @@ __FBSDID("$FreeBSD$"); #include "mounttab.h" /* Table for af,sotype -> netid conversions. */ -struct nc_protos { +static struct nc_protos { const char *netid; int af; int sotype; @@ -102,20 +102,21 @@ struct nfhret { #define ISBGRND 2 #define OF_NOINET4 4 #define OF_NOINET6 8 -int retrycnt = -1; -int opflags = 0; -int nfsproto = IPPROTO_TCP; -int mnttcp_ok = 1; -int noconn = 0; -char *portspec = NULL; /* Server nfs port; NULL means look up via rpcbind. */ -struct sockaddr *addr; -int addrlen = 0; -u_char *fh = NULL; -int fhsize = 0; -int secflavor = -1; -int got_principal = 0; +static int retrycnt = -1; +static int opflags = 0; +static int nfsproto = IPPROTO_TCP; +static int mnttcp_ok = 1; +static int noconn = 0; +/* The 'portspec' is the server nfs port; NULL means look up via rpcbind. */ +static const char *portspec = NULL; +static struct sockaddr *addr; +static int addrlen = 0; +static u_char *fh = NULL; +static int fhsize = 0; +static int secflavor = -1; +static int got_principal = 0; -enum mountmode { +static enum mountmode { ANY, V2, V3, @@ -130,8 +131,8 @@ enum tryret { TRYRET_LOCALERR /* Local failure. */ }; -static int sec_name_to_num(char *sec); -static char *sec_num_to_name(int num); +static int sec_name_to_num(const char *sec); +static const char *sec_num_to_name(int num); static int getnfsargs(char *, struct iovec **iov, int *iovlen); /* void set_rpc_maxgrouplist(int); */ static struct netconfig *getnetconf_cached(const char *netid); @@ -149,9 +150,10 @@ main(int argc, char *argv[]) int c; struct iovec *iov; int num, iovlen; - char *name, *p, *spec, *fstype; + char *mntname, *p, *spec, *tmp; char mntpath[MAXPATHLEN], errmsg[255]; - char hostname[MAXHOSTNAMELEN + 1], *gssname, gssn[MAXHOSTNAMELEN + 50]; + char hostname[MAXHOSTNAMELEN + 1], gssn[MAXHOSTNAMELEN + 50]; + const char *fstype, *gssname; iov = NULL; iovlen = 0; @@ -226,7 +228,7 @@ main(int argc, char *argv[]) while (opt) { char *pval = NULL; char *pnextopt = NULL; - char *val = ""; + const char *val = ""; pass_flag_to_nmount = 1; pnextopt = strchr(opt, ','); if (pnextopt != NULL) { @@ -276,10 +278,10 @@ main(int argc, char *argv[]) portspec = "2049"; } else if (strcmp(opt, "port") == 0) { pass_flag_to_nmount=0; - asprintf(&portspec, "%d", - atoi(val)); - if (portspec == NULL) + asprintf(&tmp, "%d", atoi(val)); + if (tmp == NULL) err(1, "asprintf"); + portspec = tmp; } else if (strcmp(opt, "principal") == 0) { got_principal = 1; } else if (strcmp(opt, "proto") == 0) { @@ -364,9 +366,11 @@ main(int argc, char *argv[]) } pass_flag_to_nmount=0; } - if (pass_flag_to_nmount) - build_iovec(&iov, &iovlen, opt, val, + if (pass_flag_to_nmount) { + build_iovec(&iov, &iovlen, opt, + __DECONST(void *, val), strlen(val) + 1); + } opt = pnextopt; } } @@ -426,7 +430,7 @@ main(int argc, char *argv[]) } spec = *argv++; - name = *argv; + mntname = *argv; if (retrycnt == -1) /* The default is to keep retrying forever. */ @@ -455,18 +459,19 @@ main(int argc, char *argv[]) hostname); gssname = gssn; } - build_iovec(&iov, &iovlen, "gssname", gssname, - strlen(gssname) + 1); + build_iovec(&iov, &iovlen, "gssname", + __DECONST(void *, gssname), strlen(gssname) + 1); } if (!getnfsargs(spec, &iov, &iovlen)) exit(1); /* resolve the mountpoint with realpath(3) */ - if (checkpath(name, mntpath) != 0) + if (checkpath(mntname, mntpath) != 0) err(1, "%s", mntpath); - build_iovec(&iov, &iovlen, "fstype", fstype, (size_t)-1); + build_iovec(&iov, &iovlen, "fstype", + __DECONST(void *, fstype), (size_t)-1); build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); build_iovec(&iov, &iovlen, "errmsg", errmsg, sizeof(errmsg)); @@ -477,7 +482,7 @@ main(int argc, char *argv[]) } static int -sec_name_to_num(char *sec) +sec_name_to_num(const char *sec) { if (!strcmp(sec, "krb5")) return (RPCSEC_GSS_KRB5); @@ -490,7 +495,7 @@ sec_name_to_num(char *sec) return (-1); } -static char * +static const char * sec_num_to_name(int flavor) { switch (flavor) { @@ -674,10 +679,9 @@ nfs_tryproto(struct addrinfo *ai, char * struct rpc_err rpcerr; CLIENT *clp; struct netconfig *nconf, *nconf_mnt; - const char *netid, *netid_mnt; - char *secname; + const char *netid, *netid_mnt, *secname; int doconnect, nfsvers, mntvers, sotype; - enum clnt_stat stat; + enum clnt_stat clntstat; enum mountmode trymntmode; sotype = 0; @@ -721,6 +725,7 @@ nfs_tryproto(struct addrinfo *ai, char * tryagain: if (trymntmode == V4) { nfsvers = 4; + mntvers = 3; /* Workaround for GCC. */ } else if (trymntmode == V2) { nfsvers = 2; mntvers = 1; @@ -780,10 +785,10 @@ tryagain: try.tv_sec = 10; try.tv_usec = 0; - stat = clnt_call(clp, NFSPROC_NULL, (xdrproc_t)xdr_void, NULL, + clntstat = clnt_call(clp, NFSPROC_NULL, (xdrproc_t)xdr_void, NULL, (xdrproc_t)xdr_void, NULL, try); - if (stat != RPC_SUCCESS) { - if (stat == RPC_PROGVERSMISMATCH && trymntmode == ANY) { + if (clntstat != RPC_SUCCESS) { + if (clntstat == RPC_PROGVERSMISMATCH && trymntmode == ANY) { clnt_destroy(clp); trymntmode = V2; goto tryagain; @@ -792,7 +797,7 @@ tryagain: snprintf(errbuf, sizeof errbuf, "[%s] %s:%s: %s", netid, hostp, spec, clnt_sperror(clp, "NFSPROC_NULL")); clnt_destroy(clp); - return (returncode(stat, &rpcerr)); + return (returncode(clntstat, &rpcerr)); } clnt_destroy(clp); @@ -812,8 +817,10 @@ tryagain: build_iovec(iov, iovlen, "addr", addr, addrlen); secname = sec_num_to_name(secflavor); - if (secname != NULL) - build_iovec(iov, iovlen, "sec", secname, (size_t)-1); + if (secname != NULL) { + build_iovec(iov, iovlen, "sec", + __DECONST(void *, secname), (size_t)-1); + } build_iovec(iov, iovlen, "nfsv4", NULL, 0); build_iovec(iov, iovlen, "dirpath", spec, (size_t)-1); @@ -833,12 +840,12 @@ tryagain: clp->cl_auth = authsys_create_default(); nfhret.auth = secflavor; nfhret.vers = mntvers; - stat = clnt_call(clp, MOUNTPROC_MNT, (xdrproc_t)xdr_dir, spec, + clntstat = clnt_call(clp, MOUNTPROC_MNT, (xdrproc_t)xdr_dir, spec, (xdrproc_t)xdr_fh, &nfhret, try); auth_destroy(clp->cl_auth); - if (stat != RPC_SUCCESS) { - if (stat == RPC_PROGVERSMISMATCH && trymntmode == ANY) { + if (clntstat != RPC_SUCCESS) { + if (clntstat == RPC_PROGVERSMISMATCH && trymntmode == ANY) { clnt_destroy(clp); trymntmode = V2; goto tryagain; @@ -847,7 +854,7 @@ tryagain: snprintf(errbuf, sizeof errbuf, "[%s] %s:%s: %s", netid_mnt, hostp, spec, clnt_sperror(clp, "RPCPROG_MNT")); clnt_destroy(clp); - return (returncode(stat, &rpcerr)); + return (returncode(clntstat, &rpcerr)); } clnt_destroy(clp); @@ -873,8 +880,10 @@ tryagain: build_iovec(iov, iovlen, "addr", addr, addrlen); build_iovec(iov, iovlen, "fh", fh, fhsize); secname = sec_num_to_name(nfhret.auth); - if (secname) - build_iovec(iov, iovlen, "sec", secname, (size_t)-1); + if (secname) { + build_iovec(iov, iovlen, "sec", + __DECONST(void *, secname), (size_t)-1); + } if (nfsvers == 3) build_iovec(iov, iovlen, "nfsv3", NULL, 0); @@ -886,9 +895,10 @@ tryagain: * return code. */ static enum tryret -returncode(enum clnt_stat stat, struct rpc_err *rpcerr) +returncode(enum clnt_stat clntstat, struct rpc_err *rpcerr) { - switch (stat) { + + switch (clntstat) { case RPC_TIMEDOUT: return (TRYRET_TIMEOUT); case RPC_PMAPFAILURE: From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 16:01:45 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0444E597; Sat, 29 Nov 2014 16:01:45 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E4D46818; Sat, 29 Nov 2014 16:01:44 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATG1ivx066961; Sat, 29 Nov 2014 16:01:44 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATG1iSu066960; Sat, 29 Nov 2014 16:01:44 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291601.sATG1iSu066960@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 16:01:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275258 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 16:01:45 -0000 Author: trasz Date: Sat Nov 29 16:01:44 2014 New Revision: 275258 URL: https://svnweb.freebsd.org/changeset/base/275258 Log: MFC r274278: Improve wording in ctl.conf(5). Sponsored by: The FreeBSD Foundation Modified: stable/10/usr.sbin/ctld/ctl.conf.5 Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- stable/10/usr.sbin/ctld/ctl.conf.5 Sat Nov 29 15:57:31 2014 (r275257) +++ stable/10/usr.sbin/ctld/ctl.conf.5 Sat Nov 29 16:01:44 2014 (r275258) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2014 +.Dd November 8, 2014 .Dt CTL.CONF 5 .Os .Sh NAME @@ -202,9 +202,10 @@ When set to the check will include .Sy initiator-portal , .Sy initiator-name , -and authentication credentials, ie. if the target does not require -CHAP authentication, or if CHAP user and secret used during discovery -match CHAP user and secret required to access the target. +and authentication credentials. +The target is returned if it does not require CHAP authentication, +or if the CHAP user and secret used during discovery match those +used by the target. Note that when using .Qq Ar portal-name-auth , targets that require CHAP authentication will only be returned if From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 16:07:16 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 307946F5; Sat, 29 Nov 2014 16:07:16 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1CF328CB; Sat, 29 Nov 2014 16:07:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATG7Fpb067680; Sat, 29 Nov 2014 16:07:15 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATG7FvO067679; Sat, 29 Nov 2014 16:07:15 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201411291607.sATG7FvO067679@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sat, 29 Nov 2014 16:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275259 - stable/10/usr.sbin/iscsid X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 16:07:16 -0000 Author: trasz Date: Sat Nov 29 16:07:15 2014 New Revision: 275259 URL: https://svnweb.freebsd.org/changeset/base/275259 Log: MFC r271366 (by mav@): Fix memory leak, reported by Coverity. Modified: stable/10/usr.sbin/iscsid/login.c Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/iscsid/login.c ============================================================================== --- stable/10/usr.sbin/iscsid/login.c Sat Nov 29 16:01:44 2014 (r275258) +++ stable/10/usr.sbin/iscsid/login.c Sat Nov 29 16:07:15 2014 (r275259) @@ -210,6 +210,7 @@ login_handle_redirection(struct connecti log_debugx("received redirection to \"%s\"", target_address); kernel_modify(conn, target_address); + keys_delete(response_keys); } static struct pdu * From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 22:48:43 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 69321ECC; Sat, 29 Nov 2014 22:48:43 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5240DF60; Sat, 29 Nov 2014 22:48:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATMmhoU058064; Sat, 29 Nov 2014 22:48:43 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATMmfgM058051; Sat, 29 Nov 2014 22:48:41 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201411292248.sATMmfgM058051@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Sat, 29 Nov 2014 22:48:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275273 - in stable/10: share/man/man4 sys/amd64/conf sys/conf sys/dev/virtio/console sys/i386/conf sys/modules/virtio sys/modules/virtio/console X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 22:48:43 -0000 Author: bryanv Date: Sat Nov 29 22:48:40 2014 New Revision: 275273 URL: https://svnweb.freebsd.org/changeset/base/275273 Log: MFC r273515, r274055, r274063, r274215, r274065, r274502: Add VirtIO console driver. Added: stable/10/share/man/man4/virtio_console.4 - copied, changed from r273515, head/share/man/man4/virtio_console.4 stable/10/sys/dev/virtio/console/ - copied from r273515, head/sys/dev/virtio/console/ stable/10/sys/modules/virtio/console/ - copied from r273515, head/sys/modules/virtio/console/ Modified: stable/10/share/man/man4/Makefile stable/10/share/man/man4/virtio.4 stable/10/sys/amd64/conf/NOTES stable/10/sys/conf/files.amd64 stable/10/sys/conf/files.i386 stable/10/sys/dev/virtio/console/virtio_console.c stable/10/sys/i386/conf/NOTES stable/10/sys/modules/virtio/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/share/man/man4/Makefile ============================================================================== --- stable/10/share/man/man4/Makefile Sat Nov 29 22:42:53 2014 (r275272) +++ stable/10/share/man/man4/Makefile Sat Nov 29 22:48:40 2014 (r275273) @@ -559,6 +559,7 @@ MAN= aac.4 \ ${_virtio.4} \ ${_virtio_balloon.4} \ ${_virtio_blk.4} \ + ${_virtio_console.4} \ ${_virtio_random.4} \ ${_virtio_scsi.4} \ vkbd.4 \ @@ -810,6 +811,7 @@ _nxge.4= nxge.4 _virtio.4= virtio.4 _virtio_balloon.4=virtio_balloon.4 _virtio_blk.4= virtio_blk.4 +_virtio_console.4=virtio_console.4 _virtio_random.4= virtio_random.4 _virtio_scsi.4= virtio_scsi.4 _vmx.4= vmx.4 Modified: stable/10/share/man/man4/virtio.4 ============================================================================== --- stable/10/share/man/man4/virtio.4 Sat Nov 29 22:42:53 2014 (r275272) +++ stable/10/share/man/man4/virtio.4 Sat Nov 29 22:48:40 2014 (r275273) @@ -85,6 +85,7 @@ device driver. .Sh SEE ALSO .Xr virtio_balloon 4 , .Xr virtio_blk 4 , +.Xr virtio_console 4 , .Xr virtio_scsi 4 , .Xr vtnet 4 .Sh HISTORY Copied and modified: stable/10/share/man/man4/virtio_console.4 (from r273515, head/share/man/man4/virtio_console.4) ============================================================================== --- head/share/man/man4/virtio_console.4 Thu Oct 23 04:47:32 2014 (r273515, copy source) +++ stable/10/share/man/man4/virtio_console.4 Sat Nov 29 22:48:40 2014 (r275273) @@ -56,6 +56,7 @@ each port is accessible through .Sh FILES .Bl -tag -width ".Pa /dev/ttyV?.??" -compact .It Pa /dev/ttyV?.?? +.El .Sh SEE ALSO .Xr tty 4 .Xr virtio 4 Modified: stable/10/sys/amd64/conf/NOTES ============================================================================== --- stable/10/sys/amd64/conf/NOTES Sat Nov 29 22:42:53 2014 (r275272) +++ stable/10/sys/amd64/conf/NOTES Sat Nov 29 22:48:40 2014 (r275273) @@ -477,6 +477,7 @@ device virtio_blk # VirtIO Block device device virtio_scsi # VirtIO SCSI device device virtio_balloon # VirtIO Memory Balloon device device virtio_random # VirtIO Entropy device +device virtio_console # VirtIO Console device device hyperv # HyperV drivers Modified: stable/10/sys/conf/files.amd64 ============================================================================== --- stable/10/sys/conf/files.amd64 Sat Nov 29 22:42:53 2014 (r275272) +++ stable/10/sys/conf/files.amd64 Sat Nov 29 22:48:40 2014 (r275273) @@ -469,6 +469,7 @@ dev/virtio/block/virtio_blk.c optional dev/virtio/balloon/virtio_balloon.c optional virtio_balloon dev/virtio/scsi/virtio_scsi.c optional virtio_scsi dev/virtio/random/virtio_random.c optional virtio_random +dev/virtio/console/virtio_console.c optional virtio_console isa/syscons_isa.c optional sc isa/vga_isa.c optional vga kern/imgact_binmisc.c optional imagact_binmisc Modified: stable/10/sys/conf/files.i386 ============================================================================== --- stable/10/sys/conf/files.i386 Sat Nov 29 22:42:53 2014 (r275272) +++ stable/10/sys/conf/files.i386 Sat Nov 29 22:48:40 2014 (r275273) @@ -416,6 +416,7 @@ dev/virtio/block/virtio_blk.c optional dev/virtio/balloon/virtio_balloon.c optional virtio_balloon dev/virtio/scsi/virtio_scsi.c optional virtio_scsi dev/virtio/random/virtio_random.c optional virtio_random +dev/virtio/console/virtio_console.c optional virtio_console i386/acpica/acpi_machdep.c optional acpi acpi_wakecode.o optional acpi \ dependency "$S/i386/acpica/acpi_wakecode.S assym.s" \ Modified: stable/10/sys/dev/virtio/console/virtio_console.c ============================================================================== --- head/sys/dev/virtio/console/virtio_console.c Thu Oct 23 04:47:32 2014 (r273515) +++ stable/10/sys/dev/virtio/console/virtio_console.c Sat Nov 29 22:48:40 2014 (r275273) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -55,143 +56,154 @@ __FBSDID("$FreeBSD$"); #include "virtio_if.h" -#define VTCON_MAX_PORTS 1 +#define VTCON_MAX_PORTS 32 #define VTCON_TTY_PREFIX "V" #define VTCON_BULK_BUFSZ 128 +/* + * The buffer cannot cross more than one page boundary due to the + * size of the sglist segment array used. + */ +CTASSERT(VTCON_BULK_BUFSZ <= PAGE_SIZE); + struct vtcon_softc; +struct vtcon_softc_port; struct vtcon_port { - struct vtcon_softc *vtcport_sc; - TAILQ_ENTRY(vtcon_port) vtcport_next; - struct mtx vtcport_mtx; - int vtcport_id; - struct tty *vtcport_tty; - struct virtqueue *vtcport_invq; - struct virtqueue *vtcport_outvq; - char vtcport_name[16]; + struct mtx vtcport_mtx; + struct vtcon_softc *vtcport_sc; + struct vtcon_softc_port *vtcport_scport; + struct tty *vtcport_tty; + struct virtqueue *vtcport_invq; + struct virtqueue *vtcport_outvq; + int vtcport_id; + int vtcport_flags; +#define VTCON_PORT_FLAG_GONE 0x01 +#define VTCON_PORT_FLAG_CONSOLE 0x02 + +#if defined(KDB) + int vtcport_alt_break_state; +#endif }; -#define VTCON_PORT_MTX(_port) &(_port)->vtcport_mtx -#define VTCON_PORT_LOCK_INIT(_port) \ - mtx_init(VTCON_PORT_MTX((_port)), (_port)->vtcport_name, NULL, MTX_DEF) -#define VTCON_PORT_LOCK(_port) mtx_lock(VTCON_PORT_MTX((_port))) -#define VTCON_PORT_UNLOCK(_port) mtx_unlock(VTCON_PORT_MTX((_port))) -#define VTCON_PORT_LOCK_DESTROY(_port) mtx_destroy(VTCON_PORT_MTX((_port))) -#define VTCON_PORT_LOCK_ASSERT(_port) \ - mtx_assert(VTCON_PORT_MTX((_port)), MA_OWNED) -#define VTCON_PORT_LOCK_ASSERT_NOTOWNED(_port) \ - mtx_assert(VTCON_PORT_MTX((_port)), MA_NOTOWNED) +#define VTCON_PORT_LOCK(_port) mtx_lock(&(_port)->vtcport_mtx) +#define VTCON_PORT_UNLOCK(_port) mtx_unlock(&(_port)->vtcport_mtx) + +struct vtcon_softc_port { + struct vtcon_softc *vcsp_sc; + struct vtcon_port *vcsp_port; + struct virtqueue *vcsp_invq; + struct virtqueue *vcsp_outvq; +}; struct vtcon_softc { device_t vtcon_dev; struct mtx vtcon_mtx; uint64_t vtcon_features; - uint32_t vtcon_flags; -#define VTCON_FLAG_DETACHED 0x0001 -#define VTCON_FLAG_SIZE 0x0010 -#define VTCON_FLAG_MULTIPORT 0x0020 - - struct task vtcon_ctrl_task; - struct virtqueue *vtcon_ctrl_rxvq; - struct virtqueue *vtcon_ctrl_txvq; - uint32_t vtcon_max_ports; - TAILQ_HEAD(, vtcon_port) - vtcon_ports; + uint32_t vtcon_flags; +#define VTCON_FLAG_DETACHED 0x01 +#define VTCON_FLAG_SIZE 0x02 +#define VTCON_FLAG_MULTIPORT 0x04 /* * Ports can be added and removed during runtime, but we have * to allocate all the virtqueues during attach. This array is * indexed by the port ID. */ - struct vtcon_port_extra { - struct vtcon_port *port; - struct virtqueue *invq; - struct virtqueue *outvq; - } *vtcon_portsx; + struct vtcon_softc_port *vtcon_ports; + + struct task vtcon_ctrl_task; + struct virtqueue *vtcon_ctrl_rxvq; + struct virtqueue *vtcon_ctrl_txvq; + struct mtx vtcon_ctrl_tx_mtx; }; -#define VTCON_MTX(_sc) &(_sc)->vtcon_mtx -#define VTCON_LOCK_INIT(_sc, _name) \ - mtx_init(VTCON_MTX((_sc)), (_name), NULL, MTX_DEF) -#define VTCON_LOCK(_sc) mtx_lock(VTCON_MTX((_sc))) -#define VTCON_UNLOCK(_sc) mtx_unlock(VTCON_MTX((_sc))) -#define VTCON_LOCK_DESTROY(_sc) mtx_destroy(VTCON_MTX((_sc))) -#define VTCON_LOCK_ASSERT(_sc) mtx_assert(VTCON_MTX((_sc)), MA_OWNED) -#define VTCON_LOCK_ASSERT_NOTOWNED(_sc) \ - mtx_assert(VTCON_MTX((_sc)), MA_NOTOWNED) +#define VTCON_LOCK(_sc) mtx_lock(&(_sc)->vtcon_mtx) +#define VTCON_UNLOCK(_sc) mtx_unlock(&(_sc)->vtcon_mtx) +#define VTCON_LOCK_ASSERT(_sc) \ + mtx_assert(&(_sc)->vtcon_mtx, MA_OWNED) +#define VTCON_LOCK_ASSERT_NOTOWNED(_sc) \ + mtx_assert(&(_sc)->vtcon_mtx, MA_NOTOWNED) + +#define VTCON_CTRL_TX_LOCK(_sc) mtx_lock(&(_sc)->vtcon_ctrl_tx_mtx) +#define VTCON_CTRL_TX_UNLOCK(_sc) mtx_unlock(&(_sc)->vtcon_ctrl_tx_mtx) #define VTCON_ASSERT_VALID_PORTID(_sc, _id) \ KASSERT((_id) >= 0 && (_id) < (_sc)->vtcon_max_ports, \ ("%s: port ID %d out of range", __func__, _id)) -#define VTCON_FEATURES 0 +#define VTCON_FEATURES VIRTIO_CONSOLE_F_MULTIPORT static struct virtio_feature_desc vtcon_feature_desc[] = { { VIRTIO_CONSOLE_F_SIZE, "ConsoleSize" }, { VIRTIO_CONSOLE_F_MULTIPORT, "MultiplePorts" }, + { VIRTIO_CONSOLE_F_EMERG_WRITE, "EmergencyWrite" }, { 0, NULL } }; static int vtcon_modevent(module_t, int, void *); +static void vtcon_drain_all(void); static int vtcon_probe(device_t); static int vtcon_attach(device_t); static int vtcon_detach(device_t); static int vtcon_config_change(device_t); +static void vtcon_setup_features(struct vtcon_softc *); static void vtcon_negotiate_features(struct vtcon_softc *); +static int vtcon_alloc_scports(struct vtcon_softc *); static int vtcon_alloc_virtqueues(struct vtcon_softc *); static void vtcon_read_config(struct vtcon_softc *, struct virtio_console_config *); static void vtcon_determine_max_ports(struct vtcon_softc *, struct virtio_console_config *); -static void vtcon_deinit_ports(struct vtcon_softc *); +static void vtcon_destroy_ports(struct vtcon_softc *); static void vtcon_stop(struct vtcon_softc *); -static void vtcon_ctrl_rx_vq_intr(void *); -static int vtcon_ctrl_enqueue_msg(struct vtcon_softc *, +static int vtcon_ctrl_event_enqueue(struct vtcon_softc *, struct virtio_console_control *); -static int vtcon_ctrl_add_msg(struct vtcon_softc *); -static void vtcon_ctrl_readd_msg(struct vtcon_softc *, +static int vtcon_ctrl_event_create(struct vtcon_softc *); +static void vtcon_ctrl_event_requeue(struct vtcon_softc *, struct virtio_console_control *); -static int vtcon_ctrl_populate(struct vtcon_softc *); -static void vtcon_ctrl_send_msg(struct vtcon_softc *, - struct virtio_console_control *control); -static void vtcon_ctrl_send_event(struct vtcon_softc *, uint32_t, - uint16_t, uint16_t); +static int vtcon_ctrl_event_populate(struct vtcon_softc *); +static void vtcon_ctrl_event_drain(struct vtcon_softc *); static int vtcon_ctrl_init(struct vtcon_softc *); -static void vtcon_ctrl_drain(struct vtcon_softc *); static void vtcon_ctrl_deinit(struct vtcon_softc *); static void vtcon_ctrl_port_add_event(struct vtcon_softc *, int); static void vtcon_ctrl_port_remove_event(struct vtcon_softc *, int); static void vtcon_ctrl_port_console_event(struct vtcon_softc *, int); static void vtcon_ctrl_port_open_event(struct vtcon_softc *, int); -static void vtcon_ctrl_process_msg(struct vtcon_softc *, +static void vtcon_ctrl_process_event(struct vtcon_softc *, struct virtio_console_control *); static void vtcon_ctrl_task_cb(void *, int); +static void vtcon_ctrl_event_intr(void *); +static void vtcon_ctrl_poll(struct vtcon_softc *, + struct virtio_console_control *control); +static void vtcon_ctrl_send_control(struct vtcon_softc *, uint32_t, + uint16_t, uint16_t); -static int vtcon_port_add_inbuf(struct vtcon_port *); -static void vtcon_port_readd_inbuf(struct vtcon_port *, void *); +static int vtcon_port_enqueue_buf(struct vtcon_port *, void *, size_t); +static int vtcon_port_create_buf(struct vtcon_port *); +static void vtcon_port_requeue_buf(struct vtcon_port *, void *); static int vtcon_port_populate(struct vtcon_port *); static void vtcon_port_destroy(struct vtcon_port *); -static int vtcon_port_create(struct vtcon_softc *, int, - struct vtcon_port **); -static void vtcon_port_drain_inbufs(struct vtcon_port *); -static void vtcon_port_teardown(struct vtcon_port *, int); +static int vtcon_port_create(struct vtcon_softc *, int); +static void vtcon_port_drain_bufs(struct virtqueue *); +static void vtcon_port_drain(struct vtcon_port *); +static void vtcon_port_teardown(struct vtcon_port *); static void vtcon_port_change_size(struct vtcon_port *, uint16_t, uint16_t); +static void vtcon_port_update_console_size(struct vtcon_softc *); static void vtcon_port_enable_intr(struct vtcon_port *); static void vtcon_port_disable_intr(struct vtcon_port *); -static void vtcon_port_intr(struct vtcon_port *); -static void vtcon_port_in_vq_intr(void *); -static void vtcon_port_put(struct vtcon_port *, void *, int); -static void vtcon_port_send_ctrl_msg(struct vtcon_port *, uint16_t, +static void vtcon_port_in(struct vtcon_port *); +static void vtcon_port_intr(void *); +static void vtcon_port_out(struct vtcon_port *, void *, int); +static void vtcon_port_submit_event(struct vtcon_port *, uint16_t, uint16_t); -static struct vtcon_port *vtcon_port_lookup_by_id(struct vtcon_softc *, int); static int vtcon_tty_open(struct tty *); static void vtcon_tty_close(struct tty *); @@ -248,9 +260,11 @@ vtcon_modevent(module_t mod, int type, v error = 0; break; case MOD_QUIESCE: + error = 0; + break; case MOD_UNLOAD: - error = vtcon_pending_free != 0 ? EBUSY : 0; - /* error = EOPNOTSUPP; */ + vtcon_drain_all(); + error = 0; break; case MOD_SHUTDOWN: error = 0; @@ -263,6 +277,20 @@ vtcon_modevent(module_t mod, int type, v return (error); } +static void +vtcon_drain_all(void) +{ + int first; + + for (first = 1; vtcon_pending_free != 0; first = 0) { + if (first != 0) { + printf("virtio_console: Waiting for all detached TTY " + "devices to have open fds closed.\n"); + } + pause("vtcondra", hz); + } +} + static int vtcon_probe(device_t dev) { @@ -285,33 +313,39 @@ vtcon_attach(device_t dev) sc = device_get_softc(dev); sc->vtcon_dev = dev; - VTCON_LOCK_INIT(sc, device_get_nameunit(dev)); - TASK_INIT(&sc->vtcon_ctrl_task, 0, vtcon_ctrl_task_cb, sc); - TAILQ_INIT(&sc->vtcon_ports); + mtx_init(&sc->vtcon_mtx, "vtconmtx", NULL, MTX_DEF); + mtx_init(&sc->vtcon_ctrl_tx_mtx, "vtconctrlmtx", NULL, MTX_DEF); virtio_set_feature_desc(dev, vtcon_feature_desc); - vtcon_negotiate_features(sc); - - if (virtio_with_feature(dev, VIRTIO_CONSOLE_F_SIZE)) - sc->vtcon_flags |= VTCON_FLAG_SIZE; - if (virtio_with_feature(dev, VIRTIO_CONSOLE_F_MULTIPORT)) - sc->vtcon_flags |= VTCON_FLAG_MULTIPORT; + vtcon_setup_features(sc); vtcon_read_config(sc, &concfg); vtcon_determine_max_ports(sc, &concfg); + error = vtcon_alloc_scports(sc); + if (error) { + device_printf(dev, "cannot allocate softc port structures\n"); + goto fail; + } + error = vtcon_alloc_virtqueues(sc); if (error) { device_printf(dev, "cannot allocate virtqueues\n"); goto fail; } - if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) + if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) { + TASK_INIT(&sc->vtcon_ctrl_task, 0, vtcon_ctrl_task_cb, sc); error = vtcon_ctrl_init(sc); - else - error = vtcon_port_create(sc, 0, NULL); - if (error) - goto fail; + if (error) + goto fail; + } else { + error = vtcon_port_create(sc, 0); + if (error) + goto fail; + if (sc->vtcon_flags & VTCON_FLAG_SIZE) + vtcon_port_update_console_size(sc); + } error = virtio_setup_intr(dev, INTR_TYPE_TTY); if (error) { @@ -321,7 +355,7 @@ vtcon_attach(device_t dev) vtcon_enable_interrupts(sc); - vtcon_ctrl_send_event(sc, VIRTIO_CONSOLE_BAD_ID, + vtcon_ctrl_send_control(sc, VIRTIO_CONSOLE_BAD_ID, VIRTIO_CONSOLE_DEVICE_READY, 1); fail: @@ -344,14 +378,14 @@ vtcon_detach(device_t dev) vtcon_stop(sc); VTCON_UNLOCK(sc); - taskqueue_drain(taskqueue_thread, &sc->vtcon_ctrl_task); - - if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) + if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) { + taskqueue_drain(taskqueue_thread, &sc->vtcon_ctrl_task); vtcon_ctrl_deinit(sc); + } - vtcon_deinit_ports(sc); - - VTCON_LOCK_DESTROY(sc); + vtcon_destroy_ports(sc); + mtx_destroy(&sc->vtcon_mtx); + mtx_destroy(&sc->vtcon_ctrl_tx_mtx); return (0); } @@ -360,30 +394,16 @@ static int vtcon_config_change(device_t dev) { struct vtcon_softc *sc; - struct vtcon_port *port; - uint16_t cols, rows; sc = device_get_softc(dev); /* - * With the multiport feature, all configuration changes are - * done through control virtqueue events. This is a spurious - * interrupt. + * When the multiport feature is negotiated, all configuration + * changes are done through control virtqueue events. */ - if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) - return (0); - - if (sc->vtcon_flags & VTCON_FLAG_SIZE) { - /* - * For now, assume the first (only) port is the 'console'. - * Note QEMU does not implement this feature yet. - */ - VTCON_LOCK(sc); - if ((port = vtcon_port_lookup_by_id(sc, 0)) != NULL) { - vtcon_get_console_size(sc, &cols, &rows); - vtcon_port_change_size(port, cols, rows); - } - VTCON_UNLOCK(sc); + if ((sc->vtcon_flags & VTCON_FLAG_MULTIPORT) == 0) { + if (sc->vtcon_flags & VTCON_FLAG_SIZE) + vtcon_port_update_console_size(sc); } return (0); @@ -401,6 +421,21 @@ vtcon_negotiate_features(struct vtcon_so sc->vtcon_features = virtio_negotiate_features(dev, features); } +static void +vtcon_setup_features(struct vtcon_softc *sc) +{ + device_t dev; + + dev = sc->vtcon_dev; + + vtcon_negotiate_features(sc); + + if (virtio_with_feature(dev, VIRTIO_CONSOLE_F_SIZE)) + sc->vtcon_flags |= VTCON_FLAG_SIZE; + if (virtio_with_feature(dev, VIRTIO_CONSOLE_F_MULTIPORT)) + sc->vtcon_flags |= VTCON_FLAG_MULTIPORT; +} + #define VTCON_GET_CONFIG(_dev, _feature, _field, _cfg) \ if (virtio_with_feature(_dev, _feature)) { \ virtio_read_device_config(_dev, \ @@ -417,7 +452,6 @@ vtcon_read_config(struct vtcon_softc *sc bzero(concfg, sizeof(struct virtio_console_config)); - /* Read the configuration if the feature was negotiated. */ VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_SIZE, cols, concfg); VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_SIZE, rows, concfg); VTCON_GET_CONFIG(dev, VIRTIO_CONSOLE_F_MULTIPORT, max_nr_ports, concfg); @@ -426,20 +460,36 @@ vtcon_read_config(struct vtcon_softc *sc #undef VTCON_GET_CONFIG static int +vtcon_alloc_scports(struct vtcon_softc *sc) +{ + struct vtcon_softc_port *scport; + int max, i; + + max = sc->vtcon_max_ports; + + sc->vtcon_ports = malloc(sizeof(struct vtcon_softc_port) * max, + M_DEVBUF, M_NOWAIT | M_ZERO); + if (sc->vtcon_ports == NULL) + return (ENOMEM); + + for (i = 0; i < max; i++) { + scport = &sc->vtcon_ports[i]; + scport->vcsp_sc = sc; + } + + return (0); +} + +static int vtcon_alloc_virtqueues(struct vtcon_softc *sc) { device_t dev; struct vq_alloc_info *info; - struct vtcon_port_extra *portx; + struct vtcon_softc_port *scport; int i, idx, portidx, nvqs, error; dev = sc->vtcon_dev; - sc->vtcon_portsx = malloc(sizeof(struct vtcon_port_extra) * - sc->vtcon_max_ports, M_DEVBUF, M_NOWAIT | M_ZERO); - if (sc->vtcon_portsx == NULL) - return (ENOMEM); - nvqs = sc->vtcon_max_ports * 2; if (sc->vtcon_flags & VTCON_FLAG_MULTIPORT) nvqs += 2; @@ -448,12 +498,12 @@ vtcon_alloc_virtqueues(struct vtcon_soft if (info == NULL) return (ENOMEM); - for (i = 0, idx = 0, portidx = 0; i < nvqs / 2; i++, idx+=2) { + for (i = 0, idx = 0, portidx = 0; i < nvqs / 2; i++, idx += 2) { if (i == 1) { /* The control virtqueues are after the first port. */ VQ_ALLOC_INFO_INIT(&info[idx], 0, - vtcon_ctrl_rx_vq_intr, sc, &sc->vtcon_ctrl_rxvq, + vtcon_ctrl_event_intr, sc, &sc->vtcon_ctrl_rxvq, "%s-control rx", device_get_nameunit(dev)); VQ_ALLOC_INFO_INIT(&info[idx+1], 0, NULL, sc, &sc->vtcon_ctrl_txvq, @@ -461,14 +511,14 @@ vtcon_alloc_virtqueues(struct vtcon_soft continue; } - portx = &sc->vtcon_portsx[portidx]; + scport = &sc->vtcon_ports[portidx]; - VQ_ALLOC_INFO_INIT(&info[idx], 0, vtcon_port_in_vq_intr, - portx, &portx->invq, "%s-port%d in", - device_get_nameunit(dev), portidx); + VQ_ALLOC_INFO_INIT(&info[idx], 0, vtcon_port_intr, + scport, &scport->vcsp_invq, "%s-port%d in", + device_get_nameunit(dev), i); VQ_ALLOC_INFO_INIT(&info[idx+1], 0, NULL, - NULL, &portx->outvq, "%s-port%d out", - device_get_nameunit(dev), portidx); + NULL, &scport->vcsp_outvq, "%s-port%d out", + device_get_nameunit(dev), i); portidx++; } @@ -494,18 +544,37 @@ vtcon_determine_max_ports(struct vtcon_s } static void -vtcon_deinit_ports(struct vtcon_softc *sc) +vtcon_destroy_ports(struct vtcon_softc *sc) { - struct vtcon_port *port, *tmp; + struct vtcon_softc_port *scport; + struct vtcon_port *port; + struct virtqueue *vq; + int i; - TAILQ_FOREACH_SAFE(port, &sc->vtcon_ports, vtcport_next, tmp) { - vtcon_port_teardown(port, 1); - } + if (sc->vtcon_ports == NULL) + return; - if (sc->vtcon_portsx != NULL) { - free(sc->vtcon_portsx, M_DEVBUF); - sc->vtcon_portsx = NULL; + VTCON_LOCK(sc); + for (i = 0; i < sc->vtcon_max_ports; i++) { + scport = &sc->vtcon_ports[i]; + + port = scport->vcsp_port; + if (port != NULL) { + scport->vcsp_port = NULL; + VTCON_PORT_LOCK(port); + VTCON_UNLOCK(sc); + vtcon_port_teardown(port); + VTCON_LOCK(sc); + } + + vq = scport->vcsp_invq; + if (vq != NULL) + vtcon_port_drain_bufs(vq); } + VTCON_UNLOCK(sc); + + free(sc->vtcon_ports, M_DEVBUF); + sc->vtcon_ports = NULL; } static void @@ -516,50 +585,38 @@ vtcon_stop(struct vtcon_softc *sc) virtio_stop(sc->vtcon_dev); } -static void -vtcon_ctrl_rx_vq_intr(void *xsc) -{ - struct vtcon_softc *sc; - - sc = xsc; - - /* - * Some events require us to potentially block, but it easier - * to just defer all event handling to a seperate thread. - */ - taskqueue_enqueue(taskqueue_thread, &sc->vtcon_ctrl_task); -} - static int -vtcon_ctrl_enqueue_msg(struct vtcon_softc *sc, +vtcon_ctrl_event_enqueue(struct vtcon_softc *sc, struct virtio_console_control *control) { - struct sglist_seg segs[1]; + struct sglist_seg segs[2]; struct sglist sg; struct virtqueue *vq; - int error __unused; + int error; vq = sc->vtcon_ctrl_rxvq; - sglist_init(&sg, 1, segs); - error = sglist_append(&sg, control, sizeof(*control)); - KASSERT(error == 0 && sg.sg_nseg == 1, - ("%s: error %d adding control msg to sglist", __func__, error)); + sglist_init(&sg, 2, segs); + error = sglist_append(&sg, control, + sizeof(struct virtio_console_control)); + KASSERT(error == 0, ("%s: error %d adding control to sglist", + __func__, error)); - return (virtqueue_enqueue(vq, control, &sg, 0, 1)); + return (virtqueue_enqueue(vq, control, &sg, 0, sg.sg_nseg)); } static int -vtcon_ctrl_add_msg(struct vtcon_softc *sc) +vtcon_ctrl_event_create(struct vtcon_softc *sc) { struct virtio_console_control *control; int error; - control = malloc(sizeof(*control), M_DEVBUF, M_ZERO | M_NOWAIT); + control = malloc(sizeof(struct virtio_console_control), M_DEVBUF, + M_ZERO | M_NOWAIT); if (control == NULL) return (ENOMEM); - error = vtcon_ctrl_enqueue_msg(sc, control); + error = vtcon_ctrl_event_enqueue(sc, control); if (error) free(control, M_DEVBUF); @@ -567,20 +624,20 @@ vtcon_ctrl_add_msg(struct vtcon_softc *s } static void -vtcon_ctrl_readd_msg(struct vtcon_softc *sc, +vtcon_ctrl_event_requeue(struct vtcon_softc *sc, struct virtio_console_control *control) { int error; - bzero(control, sizeof(*control)); + bzero(control, sizeof(struct virtio_console_control)); - error = vtcon_ctrl_enqueue_msg(sc, control); + error = vtcon_ctrl_event_enqueue(sc, control); KASSERT(error == 0, ("%s: cannot requeue control buffer %d", __func__, error)); } static int -vtcon_ctrl_populate(struct vtcon_softc *sc) +vtcon_ctrl_event_populate(struct vtcon_softc *sc) { struct virtqueue *vq; int nbufs, error; @@ -589,64 +646,36 @@ vtcon_ctrl_populate(struct vtcon_softc * error = ENOSPC; for (nbufs = 0; !virtqueue_full(vq); nbufs++) { - error = vtcon_ctrl_add_msg(sc); + error = vtcon_ctrl_event_create(sc); if (error) break; } if (nbufs > 0) { virtqueue_notify(vq); - /* - * EMSGSIZE signifies the virtqueue did not have enough - * entries available to hold the last buf. This is not - * an error. - */ - if (error == EMSGSIZE) - error = 0; + error = 0; } return (error); } static void -vtcon_ctrl_send_msg(struct vtcon_softc *sc, - struct virtio_console_control *control) +vtcon_ctrl_event_drain(struct vtcon_softc *sc) { - struct sglist_seg segs[1]; - struct sglist sg; + struct virtio_console_control *control; struct virtqueue *vq; - int error; - - vq = sc->vtcon_ctrl_txvq; - KASSERT(virtqueue_empty(vq), - ("%s: virtqueue is not emtpy", __func__)); - - sglist_init(&sg, 1, segs); - error = sglist_append(&sg, control, sizeof(*control)); - KASSERT(error == 0 && sg.sg_nseg == 1, - ("%s: error %d adding control msg to sglist", __func__, error)); - - error = virtqueue_enqueue(vq, control, &sg, 1, 0); - if (error == 0) { - virtqueue_notify(vq); - virtqueue_poll(vq, NULL); - } -} + int last; -static void -vtcon_ctrl_send_event(struct vtcon_softc *sc, uint32_t portid, uint16_t event, - uint16_t value) -{ - struct virtio_console_control control; + vq = sc->vtcon_ctrl_rxvq; + last = 0; - if ((sc->vtcon_flags & VTCON_FLAG_MULTIPORT) == 0) + if (vq == NULL) return; - control.id = portid; - control.event = event; - control.value = value; - - vtcon_ctrl_send_msg(sc, &control); + VTCON_LOCK(sc); + while ((control = virtqueue_drain(vq, &last)) != NULL) + free(control, M_DEVBUF); + VTCON_UNLOCK(sc); } static int @@ -654,111 +683,120 @@ vtcon_ctrl_init(struct vtcon_softc *sc) { int error; - error = vtcon_ctrl_populate(sc); + error = vtcon_ctrl_event_populate(sc); return (error); } static void -vtcon_ctrl_drain(struct vtcon_softc *sc) -{ - struct virtio_console_control *control; - struct virtqueue *vq; - int last; - - vq = sc->vtcon_ctrl_rxvq; - last = 0; - - if (vq == NULL) - return; - - while ((control = virtqueue_drain(vq, &last)) != NULL) - free(control, M_DEVBUF); -} - -static void vtcon_ctrl_deinit(struct vtcon_softc *sc) { - vtcon_ctrl_drain(sc); + vtcon_ctrl_event_drain(sc); } static void vtcon_ctrl_port_add_event(struct vtcon_softc *sc, int id) { device_t dev; - struct vtcon_port *port; int error; dev = sc->vtcon_dev; - if (vtcon_port_lookup_by_id(sc, id) != NULL) { + /* This single thread only way for ports to be created. */ + if (sc->vtcon_ports[id].vcsp_port != NULL) { device_printf(dev, "%s: adding port %d, but already exists\n", __func__, id); return; } - error = vtcon_port_create(sc, id, &port); + error = vtcon_port_create(sc, id); if (error) { device_printf(dev, "%s: cannot create port %d: %d\n", __func__, id, error); + vtcon_ctrl_send_control(sc, id, VIRTIO_CONSOLE_PORT_READY, 0); return; } - - vtcon_port_send_ctrl_msg(port, VIRTIO_CONSOLE_PORT_READY, 1); } static void vtcon_ctrl_port_remove_event(struct vtcon_softc *sc, int id) { device_t dev; + struct vtcon_softc_port *scport; struct vtcon_port *port; dev = sc->vtcon_dev; + scport = &sc->vtcon_ports[id]; - port = vtcon_port_lookup_by_id(sc, id); + VTCON_LOCK(sc); + port = scport->vcsp_port; if (port == NULL) { + VTCON_UNLOCK(sc); device_printf(dev, "%s: remove port %d, but does not exist\n", __func__, id); return; } - vtcon_port_teardown(port, 1); + scport->vcsp_port = NULL; + VTCON_PORT_LOCK(port); + VTCON_UNLOCK(sc); + vtcon_port_teardown(port); } static void vtcon_ctrl_port_console_event(struct vtcon_softc *sc, int id) { device_t dev; + struct vtcon_softc_port *scport; + struct vtcon_port *port; dev = sc->vtcon_dev; + scport = &sc->vtcon_ports[id]; - /* - * BMV: I don't think we need to do anything. - */ - device_printf(dev, "%s: port %d console event\n", __func__, id); + VTCON_LOCK(sc); + port = scport->vcsp_port; + if (port == NULL) { + VTCON_UNLOCK(sc); + device_printf(dev, "%s: console port %d, but does not exist\n", + __func__, id); + return; + } + + VTCON_PORT_LOCK(port); + VTCON_UNLOCK(sc); + port->vtcport_flags |= VTCON_PORT_FLAG_CONSOLE; + vtcon_port_submit_event(port, VIRTIO_CONSOLE_PORT_OPEN, 1); + VTCON_PORT_UNLOCK(port); } static void vtcon_ctrl_port_open_event(struct vtcon_softc *sc, int id) { device_t dev; + struct vtcon_softc_port *scport; struct vtcon_port *port; dev = sc->vtcon_dev; + scport = &sc->vtcon_ports[id]; - port = vtcon_port_lookup_by_id(sc, id); + VTCON_LOCK(sc); + port = scport->vcsp_port; if (port == NULL) { + VTCON_UNLOCK(sc); device_printf(dev, "%s: open port %d, but does not exist\n", __func__, id); return; } + VTCON_PORT_LOCK(port); + VTCON_UNLOCK(sc); vtcon_port_enable_intr(port); + VTCON_PORT_UNLOCK(port); } static void -vtcon_ctrl_process_msg(struct vtcon_softc *sc, +vtcon_ctrl_process_event(struct vtcon_softc *sc, struct virtio_console_control *control) { device_t dev; @@ -803,47 +841,120 @@ vtcon_ctrl_task_cb(void *xsc, int pendin struct vtcon_softc *sc; struct virtqueue *vq; struct virtio_console_control *control; + int detached; sc = xsc; vq = sc->vtcon_ctrl_rxvq; VTCON_LOCK(sc); - while ((sc->vtcon_flags & VTCON_FLAG_DETACHED) == 0) { + + while ((detached = (sc->vtcon_flags & VTCON_FLAG_DETACHED)) == 0) { control = virtqueue_dequeue(vq, NULL); if (control == NULL) break; VTCON_UNLOCK(sc); - vtcon_ctrl_process_msg(sc, control); + vtcon_ctrl_process_event(sc, control); VTCON_LOCK(sc); - vtcon_ctrl_readd_msg(sc, control); + vtcon_ctrl_event_requeue(sc, control); + } + + if (!detached) { + virtqueue_notify(vq); + if (virtqueue_enable_intr(vq) != 0) + taskqueue_enqueue(taskqueue_thread, + &sc->vtcon_ctrl_task); } + VTCON_UNLOCK(sc); +} - if (virtqueue_enable_intr(vq) != 0) - taskqueue_enqueue(taskqueue_thread, &sc->vtcon_ctrl_task); +static void +vtcon_ctrl_event_intr(void *xsc) +{ + struct vtcon_softc *sc; + + sc = xsc; + + /* + * Only some events require us to potentially block, but it + * easier to just defer all event handling to the taskqueue. + */ + taskqueue_enqueue(taskqueue_thread, &sc->vtcon_ctrl_task); +} + +static void +vtcon_ctrl_poll(struct vtcon_softc *sc, + struct virtio_console_control *control) +{ + struct sglist_seg segs[2]; + struct sglist sg; + struct virtqueue *vq; + int error; + + vq = sc->vtcon_ctrl_txvq; + + sglist_init(&sg, 2, segs); + error = sglist_append(&sg, control, + sizeof(struct virtio_console_control)); + KASSERT(error == 0, ("%s: error %d adding control to sglist", + __func__, error)); + + /* + * We cannot use the softc lock to serialize access to this *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@FreeBSD.ORG Sat Nov 29 23:05:02 2014 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B16B011E; Sat, 29 Nov 2014 23:05:02 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 82F1C136; Sat, 29 Nov 2014 23:05:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sATN52sI066969; Sat, 29 Nov 2014 23:05:02 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sATN52EQ066968; Sat, 29 Nov 2014 23:05:02 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201411292305.sATN52EQ066968@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Sat, 29 Nov 2014 23:05:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r275274 - stable/10/sys/dev/virtio/network X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Nov 2014 23:05:02 -0000 Author: bryanv Date: Sat Nov 29 23:05:01 2014 New Revision: 275274 URL: https://svnweb.freebsd.org/changeset/base/275274 Log: MFC r274325: Enable LRO by default when available on vtnet interfaces The prior change to not enable LRO by default has confused several people. The configurations where LRO is problematic is not the typical use case for VirtIO, and due to other issues, this often requires checksum offloading to be disabled anyways. Modified: stable/10/sys/dev/virtio/network/if_vtnet.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- stable/10/sys/dev/virtio/network/if_vtnet.c Sat Nov 29 22:48:40 2014 (r275273) +++ stable/10/sys/dev/virtio/network/if_vtnet.c Sat Nov 29 23:05:01 2014 (r275274) @@ -967,9 +967,14 @@ vtnet_setup_interface(struct vtnet_softc ifp->if_capabilities |= IFCAP_VLAN_HWTSO; } - if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) + if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_CSUM)) { ifp->if_capabilities |= IFCAP_RXCSUM | IFCAP_RXCSUM_IPV6; + if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) || + virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6)) + ifp->if_capabilities |= IFCAP_LRO; + } + if (ifp->if_capabilities & IFCAP_HWCSUM) { /* * VirtIO does not support VLAN tagging, but we can fake @@ -987,12 +992,6 @@ vtnet_setup_interface(struct vtnet_softc * Capabilities after here are not enabled by default. */ - if (ifp->if_capabilities & IFCAP_RXCSUM) { - if (virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO4) || - virtio_with_feature(dev, VIRTIO_NET_F_GUEST_TSO6)) - ifp->if_capabilities |= IFCAP_LRO; - } - if (sc->vtnet_flags & VTNET_FLAG_VLAN_FILTER) { ifp->if_capabilities |= IFCAP_VLAN_HWFILTER;