svn commit: r310496 - head/sys/vm
Author: kib Date: Sat Dec 24 09:57:31 2016 New Revision: 310496 URL: https://svnweb.freebsd.org/changeset/base/310496 Log: Fix argument type and microoptimize swp_pager_meta_free(). The count argument natural type if vm_pindex_t, but due to the loop organization, it has to be signed type to detect the termination condition. Replace this logic by using distinguished counter for the processed pages, and terminate loop when the counter exceeds the argument. Completely process one swblock for all relevant indexes instead of doing relookup in hash when incrementing page index on the loop step. Do not drop hash mutex around iterations. Noted and reviewed by:alc Tested by:pho Sponsored by: The FreeBSD Foundation MFC after:2 weeks Modified: head/sys/vm/swap_pager.c Modified: head/sys/vm/swap_pager.c == --- head/sys/vm/swap_pager.cSat Dec 24 08:59:30 2016(r310495) +++ head/sys/vm/swap_pager.cSat Dec 24 09:57:31 2016(r310496) @@ -410,7 +410,7 @@ static daddr_t swp_pager_getswapspace(in */ static struct swblock **swp_pager_hash(vm_object_t object, vm_pindex_t index); static void swp_pager_meta_build(vm_object_t, vm_pindex_t, daddr_t); -static void swp_pager_meta_free(vm_object_t, vm_pindex_t, daddr_t); +static void swp_pager_meta_free(vm_object_t, vm_pindex_t, vm_pindex_t); static void swp_pager_meta_free_all(vm_object_t); static daddr_t swp_pager_meta_ctl(vm_object_t, vm_pindex_t, int); @@ -1869,42 +1869,42 @@ done: * with resident pages. */ static void -swp_pager_meta_free(vm_object_t object, vm_pindex_t index, daddr_t count) +swp_pager_meta_free(vm_object_t object, vm_pindex_t index, vm_pindex_t count) { + struct swblock **pswap, *swap; + vm_pindex_t c; + daddr_t v; + int n, sidx; VM_OBJECT_ASSERT_LOCKED(object); - if (object->type != OBJT_SWAP) + if (object->type != OBJT_SWAP || count == 0) return; - while (count > 0) { - struct swblock **pswap; - struct swblock *swap; - - mtx_lock(&swhash_mtx); + mtx_lock(&swhash_mtx); + for (c = 0; c < count;) { pswap = swp_pager_hash(object, index); - - if ((swap = *pswap) != NULL) { - daddr_t v = swap->swb_pages[index & SWAP_META_MASK]; - - if (v != SWAPBLK_NONE) { - swp_pager_freeswapspace(v, 1); - swap->swb_pages[index & SWAP_META_MASK] = - SWAPBLK_NONE; - if (--swap->swb_count == 0) { - *pswap = swap->swb_hnext; - uma_zfree(swap_zone, swap); - --object->un_pager.swp.swp_bcount; - } + sidx = index & SWAP_META_MASK; + n = SWAP_META_PAGES - sidx; + index += n; + if ((swap = *pswap) == NULL) { + c += n; + continue; + } + for (; c < count && sidx < SWAP_META_PAGES; ++c, ++sidx) { + if ((v = swap->swb_pages[sidx]) == SWAPBLK_NONE) + continue; + swp_pager_freeswapspace(v, 1); + swap->swb_pages[sidx] = SWAPBLK_NONE; + if (--swap->swb_count == 0) { + *pswap = swap->swb_hnext; + uma_zfree(swap_zone, swap); + --object->un_pager.swp.swp_bcount; + c += SWAP_META_PAGES - sidx; + break; } - --count; - ++index; - } else { - int n = SWAP_META_PAGES - (index & SWAP_META_MASK); - count -= n; - index += n; } - mtx_unlock(&swhash_mtx); } + mtx_unlock(&swhash_mtx); } /* ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310497 - in head/usr.sbin/bsnmpd/tools: bsnmptools libbsnmptools
Author: ngie Date: Sat Dec 24 11:22:28 2016 New Revision: 310497 URL: https://svnweb.freebsd.org/changeset/base/310497 Log: Warning message cleanup - Use warn instead of warnx + strerror(errno) - Remove unnecessary trailing newline from a warnx call - Add missing spaces following "," in syslog and warn* calls MFC after:2 weeks Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptc.c head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c Modified: head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.c == --- head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.cSat Dec 24 09:57:31 2016(r310496) +++ head/usr.sbin/bsnmpd/tools/bsnmptools/bsnmpget.cSat Dec 24 11:22:28 2016(r310497) @@ -394,7 +394,7 @@ snmptool_get(struct snmp_toolinfo *snmpt GET_NONREP(snmptoolctx)); if (snmp_dialog(&req, &resp) == -1) { - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); break; } @@ -521,7 +521,7 @@ snmptool_walk(struct snmp_toolinfo *snmp snmp_pdu_free(&resp); } else - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); } if (snmp_object_remove(snmptoolctx, &root) < 0) { @@ -554,8 +554,7 @@ parse_oid_numeric(struct snmp_value *val errno = 0; suboid = strtoul(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, - strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -634,7 +633,7 @@ parse_int(struct snmp_value *value, char v = strtol(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -682,7 +681,7 @@ parse_uint(struct snmp_value *value, cha v = strtoul(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warn("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -736,7 +735,7 @@ parse_uint64(struct snmp_value *value, c v = strtoull(val, &endptr, 10); if (errno != 0) { - warnx("Value %s not supported - %s", val, strerror(errno)); + warnx("Value %s not supported", val); errno = saved_errno; return (-1); } @@ -821,7 +820,7 @@ parse_pair_numoid_val(char *str, struct break; if (ptr[cnt] != '\0') { - warnx("Value string too long - %s",ptr); + warnx("Value string too long - %s", ptr); return (-1); } @@ -830,7 +829,7 @@ parse_pair_numoid_val(char *str, struct * to know syntax to check value boundaries. */ if (snmp_parse_numoid(oid_str, &(snmp_val->var)) < 0) { - warnx("Error parsing OID %s",oid_str); + warnx("Error parsing OID %s", oid_str); return (-1); } @@ -956,7 +955,7 @@ static int32_t add_octstring_syntax(struct snmp_value *dst, struct snmp_value *src) { if (src->v.octetstring.len > ASN_MAXOCTETSTRING) { - warnx("OctetString len too big - %u",src->v.octetstring.len); + warnx("OctetString len too big - %u", src->v.octetstring.len); return (-1); } @@ -1084,7 +1083,7 @@ snmptool_set(struct snmp_toolinfo *snmpt while ((snmp_pdu_add_bindings(snmptoolctx, snmpset_verify_vbind, snmpset_add_vbind, &req, SNMP_MAX_BINDINGS)) > 0) { if (snmp_dialog(&req, &resp)) { - warnx("Snmp dialog - %s", strerror(errno)); + warn("Snmp dialog"); break; } @@ -1229,7 +1228,7 @@ main(int argc, char ** argv) } if (snmp_open(NULL, NULL, NULL, NULL)) { - warnx("Failed to open snmp session: %s.", strerror(errno)); + warn("Failed to open snmp session"); snmp_tool_freeall(&snmptoolctx); exit(1); } @@ -1239,7 +1238,7 @@ main(int argc, char ** argv) if (ISSET_EDISCOVER(&snmptoolctx) && snmp_discover_engine(snmptoolctx.passwd) < 0) { - warnx("Unknown SNMP Engine ID: %s.", strerror(errno)); + warn("Unknown SNMP Engine
svn commit: r310498 - head/contrib/bsnmp/snmpd
Author: ngie Date: Sat Dec 24 11:23:18 2016 New Revision: 310498 URL: https://svnweb.freebsd.org/changeset/base/310498 Log: Allow SNMPv3 authNoPriv and noAuthNoPriv protocols to discover snmpEngineTime as discussed in RFC-5343 This fixes interoperability with net-snmp. Tested with the following invocations of snmpwalk (from net-snmp): - noAuthNoPriv: % snmpwalk -v 3 -n '' -u public localhost snmpEngineTime - authNoPriv: % snmpwalk -v 3 -n '' -u bsnmp -A bsnmptest -l authNoPriv -a sha localhost \ localhost snmpEngineTime - authPriv: % snmpwalk -v 3 -n '' -u bsnmp -A bsnmptest -l authPriv -a sha -x des \ -X bsnmptest localhost snmpEngineTime MFC after:1 week Obtained from:Isilon OneFS (5ec6d772cacbc, with minor tweaks) Submitted by: Austin Voecks Sponsored by: Dell EMC Isilon Modified: head/contrib/bsnmp/snmpd/action.c head/contrib/bsnmp/snmpd/main.c head/contrib/bsnmp/snmpd/snmpd.h Modified: head/contrib/bsnmp/snmpd/action.c == --- head/contrib/bsnmp/snmpd/action.c Sat Dec 24 11:22:28 2016 (r310497) +++ head/contrib/bsnmp/snmpd/action.c Sat Dec 24 11:23:18 2016 (r310498) @@ -40,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -219,6 +220,21 @@ save_boots: return (0); } +void +update_snmpd_engine_time(void) +{ + uint64_t etime; + + etime = (get_ticks() - start_tick) / 100ULL; + if (etime < INT32_MAX) + snmpd_engine.engine_time = etime; + else { + start_tick = get_ticks(); + (void)set_snmpd_engine(); + snmpd_engine.engine_time = start_tick; + } +} + /* * * System group @@ -1118,7 +1134,7 @@ op_snmp_engine(struct snmp_context *ctx value->v.integer = snmpd_engine.engine_boots; break; case LEAF_snmpEngineTime: - snmpd_engine.engine_time = (get_ticks() - start_tick) / 100ULL; + update_snmpd_engine_time(); value->v.integer = snmpd_engine.engine_time; break; case LEAF_snmpEngineMaxMessageSize: Modified: head/contrib/bsnmp/snmpd/main.c == --- head/contrib/bsnmp/snmpd/main.c Sat Dec 24 11:22:28 2016 (r310497) +++ head/contrib/bsnmp/snmpd/main.c Sat Dec 24 11:23:18 2016 (r310498) @@ -53,7 +53,6 @@ #include #include #include -#include #ifdef USE_TCPWRAPPERS #include @@ -304,7 +303,6 @@ snmp_output(struct snmp_pdu *pdu, u_char static enum snmp_code snmp_pdu_auth_user(struct snmp_pdu *pdu) { - uint64_t etime; usm_user = NULL; /* un-authenticated snmpEngineId discovery */ @@ -312,6 +310,7 @@ snmp_pdu_auth_user(struct snmp_pdu *pdu) pdu->engine.engine_len = snmpd_engine.engine_len; memcpy(pdu->engine.engine_id, snmpd_engine.engine_id, snmpd_engine.engine_len); + update_snmpd_engine_time(); pdu->engine.engine_boots = snmpd_engine.engine_boots; pdu->engine.engine_time = snmpd_engine.engine_time; pdu->flags |= SNMP_MSG_AUTODISCOVER; @@ -334,21 +333,14 @@ snmp_pdu_auth_user(struct snmp_pdu *pdu) /* authenticated snmpEngineId discovery */ if ((pdu->flags & SNMP_MSG_AUTH_FLAG) != 0) { - etime = (get_ticks() - start_tick) / 100ULL; - if (etime < INT32_MAX) - snmpd_engine.engine_time = etime; - else { - start_tick = get_ticks(); - set_snmpd_engine(); - snmpd_engine.engine_time = start_tick; - } - + update_snmpd_engine_time(); pdu->user.auth_proto = usm_user->suser.auth_proto; memcpy(pdu->user.auth_key, usm_user->suser.auth_key, sizeof(pdu->user.auth_key)); if (pdu->engine.engine_boots == 0 && pdu->engine.engine_time == 0) { + update_snmpd_engine_time(); pdu->flags |= SNMP_MSG_AUTODISCOVER; return (SNMP_CODE_OK); } @@ -643,6 +635,7 @@ decoded: pdu->engine.engine_time == 0) { asn_append_oid(&(pdu->bindings[pdu->nbindings++].var), &oid_usmNotInTimeWindows); + update_snmpd_engine_time(); pdu->engine.engine_boots = snmpd_engine.engine_boots; pdu->engine.engine_time = snmpd_engine.engine_time; } Modified: head/contrib/bsnmp/snmpd/snmpd.h ==
svn commit: r310499 - head/contrib/bsnmp/lib
Author: ngie Date: Sat Dec 24 11:26:55 2016 New Revision: 310499 URL: https://svnweb.freebsd.org/changeset/base/310499 Log: Sort #includes No functional change MFC after:3 days Modified: head/contrib/bsnmp/lib/snmp.c Modified: head/contrib/bsnmp/lib/snmp.c == --- head/contrib/bsnmp/lib/snmp.c Sat Dec 24 11:23:18 2016 (r310498) +++ head/contrib/bsnmp/lib/snmp.c Sat Dec 24 11:26:55 2016 (r310499) @@ -38,19 +38,19 @@ */ #include #include +#include +#include +#include #include #include #include #include +#include #ifdef HAVE_STDINT_H #include #elif defined(HAVE_INTTYPES_H) #include #endif -#include -#include -#include -#include #include "asn1.h" #include "snmp.h" ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310500 - head/contrib/bsnmp/lib
Author: ngie Date: Sat Dec 24 11:30:24 2016 New Revision: 310500 URL: https://svnweb.freebsd.org/changeset/base/310500 Log: Minor style(9) fixes - Trailing whitespace cleanup - Sort variables in snmp_dialog(..) by alignment No functional change MFC after:1 week Modified: head/contrib/bsnmp/lib/snmpclient.c Modified: head/contrib/bsnmp/lib/snmpclient.c == --- head/contrib/bsnmp/lib/snmpclient.c Sat Dec 24 11:26:55 2016 (r310499) +++ head/contrib/bsnmp/lib/snmpclient.c Sat Dec 24 11:30:24 2016 (r310500) @@ -1214,7 +1214,7 @@ snmp_next_reqid(struct snmp_client * c) int32_t i; i = c->next_reqid; - if (c->next_reqid >= c->max_reqid) + if (c->next_reqid >= c->max_reqid) c->next_reqid = c->min_reqid; else c->next_reqid++; @@ -1230,7 +1230,7 @@ snmp_send_packet(struct snmp_pdu * pdu) u_char *buf; struct asn_buf b; ssize_t ret; - + if ((buf = malloc(snmp_client.txbuflen)) == NULL) { seterr(&snmp_client, "%s", strerror(errno)); return (-1); @@ -1684,9 +1684,9 @@ snmp_dialog(struct snmp_v1_pdu *req, str struct timeval tv = snmp_client.timeout; struct timeval end; struct snmp_pdu pdu; - u_int i; - int32_t reqid; int ret; + int32_t reqid; + u_int i; /* * Make a copy of the request and replace the syntaxes by NULL ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310501 - head/contrib/bsnmp/lib
Author: ngie Date: Sat Dec 24 11:41:16 2016 New Revision: 310501 URL: https://svnweb.freebsd.org/changeset/base/310501 Log: Be more strict about IpAddress type in snmp_value_parse(..) - Use inet_pton with AF_INET instead of doing longhand with sscanf. - Use gethostbyname2 with AF_INET to ensure that the hostname isn't accidentally parsed with another address family, e.g. AF_INET6. NB: IpAddress per RFC-2578 is IPv4 only. Work is in progress to add the InetAddress type and friends documented in RFC-4001 and elsewhere (which supports IPv4, IPv6, and more). MFC after:2 weeks Modified: head/contrib/bsnmp/lib/snmp.c Modified: head/contrib/bsnmp/lib/snmp.c == --- head/contrib/bsnmp/lib/snmp.c Sat Dec 24 11:30:24 2016 (r310500) +++ head/contrib/bsnmp/lib/snmp.c Sat Dec 24 11:41:16 2016 (r310501) @@ -51,6 +51,8 @@ #elif defined(HAVE_INTTYPES_H) #include #endif +#include +#include #include "asn1.h" #include "snmp.h" @@ -1384,29 +1386,16 @@ snmp_value_parse(const char *str, enum s case SNMP_SYNTAX_IPADDRESS: { struct hostent *he; - u_long ip[4]; - int n; - if (sscanf(str, "%lu.%lu.%lu.%lu%n", &ip[0], &ip[1], &ip[2], - &ip[3], &n) == 4 && (size_t)n == strlen(str) && - ip[0] <= 0xff && ip[1] <= 0xff && - ip[2] <= 0xff && ip[3] <= 0xff) { - v->ipaddress[0] = (u_char)ip[0]; - v->ipaddress[1] = (u_char)ip[1]; - v->ipaddress[2] = (u_char)ip[2]; - v->ipaddress[3] = (u_char)ip[3]; + if (inet_pton(AF_INET, str, &v->ipaddress) == 1) return (0); - } - - if ((he = gethostbyname(str)) == NULL) + if ((he = gethostbyname2(str, AF_INET)) == NULL) return (-1); if (he->h_addrtype != AF_INET) return (-1); - v->ipaddress[0] = he->h_addr[0]; - v->ipaddress[1] = he->h_addr[1]; - v->ipaddress[2] = he->h_addr[2]; - v->ipaddress[3] = he->h_addr[3]; + memcpy(v->ipaddress, he->h_addr, sizeof(v->ipaddress)); + return (0); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310503 - head/contrib/bsnmp/snmp_target
Author: ngie Date: Sat Dec 24 11:49:25 2016 New Revision: 310503 URL: https://svnweb.freebsd.org/changeset/base/310503 Log: style(9): delete stray trailing whitespace after break statement MFC after:3 days Modified: head/contrib/bsnmp/snmp_target/target_snmp.c Modified: head/contrib/bsnmp/snmp_target/target_snmp.c == --- head/contrib/bsnmp/snmp_target/target_snmp.cSat Dec 24 11:47:47 2016(r310502) +++ head/contrib/bsnmp/snmp_target/target_snmp.cSat Dec 24 11:49:25 2016(r310503) @@ -299,7 +299,7 @@ op_snmp_target_addrs(struct snmp_context return (target_delete_address(addrs)); break; default: - break; + break; } return (SNMP_ERR_NOERROR); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310504 - head/usr.sbin/syslogd
Author: ngie Date: Sat Dec 24 12:50:17 2016 New Revision: 310504 URL: https://svnweb.freebsd.org/changeset/base/310504 Log: Unbreak syslogd after r310494 Don't close all file descriptors greater than STDERR_FILENO (2) in waitdaemon(..) -- only close fd (file descriptor for /dev/null used in subsequent calls to dup2) if it's greater than STDERR_FILENO. Reported by: sub...@gmail.com, da...@cs.huji.ac.il Pointyhat to: hrs X-MFC with: r310494 Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Sat Dec 24 11:49:25 2016 (r310503) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 24 12:50:17 2016 (r310504) @@ -2348,7 +2348,8 @@ waitdaemon(int maxwait) (void)dup2(fd, STDIN_FILENO); (void)dup2(fd, STDOUT_FILENO); (void)dup2(fd, STDERR_FILENO); - closefrom(STDERR_FILENO + 1); + if (fd > STDERR_FILENO) + (void)close(fd); } return (getppid()); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r309774 - head/contrib/netbsd-tests/fs/tmpfs
> On Dec 10, 2016, at 02:35, Konstantin Belousov wrote: … > Why this test is under fs/tmpfs ? I was not able to see how tmpfs is > used for this test. test_mount (the first command executed in the testcases), sets up a tmpfs mount. Thus, the test is ensuring that md(4) devices (or vnd(4) in the case of NetBSD) can be backed on tmpfs mounts. Thanks! -Ngie signature.asc Description: Message signed with OpenPGP using GPGMail
Re: svn commit: r310504 - head/usr.sbin/syslogd
Ngie Cooper wrote in <201612241250.ubocoh8c019...@repo.freebsd.org>: ng> Author: ngie ng> Date: Sat Dec 24 12:50:17 2016 ng> New Revision: 310504 ng> URL: https://svnweb.freebsd.org/changeset/base/310504 ng> ng> Log: ng> Unbreak syslogd after r310494 ng> ng> Don't close all file descriptors greater than STDERR_FILENO (2) in ng> waitdaemon(..) -- only close fd (file descriptor for /dev/null used in ng> subsequent calls to dup2) if it's greater than STDERR_FILENO. ng> ng> Reported by: sub...@gmail.com, da...@cs.huji.ac.il ng> Pointyhat to: hrs ng> X-MFC with: r310494 Thanks! -- Hiroki pgp2WNkqPMRWG.pgp Description: PGP signature
svn commit: r310524 - in head/sys/cam: ctl scsi
Author: mav Date: Sat Dec 24 17:42:34 2016 New Revision: 310524 URL: https://svnweb.freebsd.org/changeset/base/310524 Log: Improve length handling when writing sense data. - Allow maximal sense size limitation via Control Extension mode page. - When sense size limited, include descriptors atomically: whole or none. - Set new SDAT_OVFL bit if some descriptors don't fit the limit. - Report real written sense length instead of static maximal 252 bytes. MFC after:2 weeks Modified: head/sys/cam/ctl/ctl.c head/sys/cam/ctl/ctl_error.c head/sys/cam/ctl/ctl_error.h head/sys/cam/ctl/ctl_private.h head/sys/cam/scsi/scsi_all.c head/sys/cam/scsi/scsi_all.h Modified: head/sys/cam/ctl/ctl.c == --- head/sys/cam/ctl/ctl.c Sat Dec 24 14:50:13 2016(r310523) +++ head/sys/cam/ctl/ctl.c Sat Dec 24 17:42:34 2016(r310524) @@ -278,7 +278,7 @@ const static struct scsi_control_ext_pag /*page_length*/{CTL_CEM_LEN >> 8, CTL_CEM_LEN}, /*flags*/0, /*prio*/0, - /*max_sense*/0 + /*max_sense*/0xff }; const static struct scsi_info_exceptions_page ie_page_default = { @@ -9220,6 +9220,7 @@ ctl_request_sense(struct ctl_scsiio *cts struct ctl_lun *lun; uint32_t initidx; int have_error; + u_int sense_len = SSD_FULL_SIZE; scsi_sense_data_type sense_format; ctl_ua_type ua_type; uint8_t asc = 0, ascq = 0; @@ -9263,7 +9264,7 @@ ctl_request_sense(struct ctl_scsiio *cts ((lun->flags & CTL_LUN_PRIMARY_SC) == 0 && softc->ha_link < CTL_HA_LINK_UNKNOWN)) { /* "Logical unit not supported" */ - ctl_set_sense_data(sense_ptr, NULL, sense_format, + ctl_set_sense_data(sense_ptr, &sense_len, NULL, sense_format, /*current_error*/ 1, /*sense_key*/ SSD_KEY_ILLEGAL_REQUEST, /*asc*/ 0x25, @@ -9319,7 +9320,8 @@ ctl_request_sense(struct ctl_scsiio *cts } else #endif if (have_error == 0) { - ua_type = ctl_build_ua(lun, initidx, sense_ptr, sense_format); + ua_type = ctl_build_ua(lun, initidx, sense_ptr, &sense_len, + sense_format); if (ua_type != CTL_UA_NONE) have_error = 1; } @@ -9331,7 +9333,7 @@ ctl_request_sense(struct ctl_scsiio *cts asc = lun->ie_asc; ascq = lun->ie_ascq; } - ctl_set_sense_data(sense_ptr, lun, sense_format, + ctl_set_sense_data(sense_ptr, &sense_len, lun, sense_format, /*current_error*/ 1, /*sense_key*/ SSD_KEY_NO_SENSE, /*asc*/ asc, @@ -11635,14 +11637,15 @@ ctl_scsiio_precheck(struct ctl_softc *so */ if ((entry->flags & CTL_CMD_FLAG_NO_SENSE) == 0) { ctl_ua_type ua_type; + u_int sense_len = 0; ua_type = ctl_build_ua(lun, initidx, &ctsio->sense_data, - SSD_TYPE_NONE); + &sense_len, SSD_TYPE_NONE); if (ua_type != CTL_UA_NONE) { mtx_unlock(&lun->lun_lock); ctsio->scsi_status = SCSI_STATUS_CHECK_COND; ctsio->io_hdr.status = CTL_SCSI_ERROR | CTL_AUTOSENSE; - ctsio->sense_len = SSD_FULL_SIZE; + ctsio->sense_len = sense_len; ctl_done((union ctl_io *)ctsio); return (retval); } Modified: head/sys/cam/ctl/ctl_error.c == --- head/sys/cam/ctl/ctl_error.cSat Dec 24 14:50:13 2016 (r310523) +++ head/sys/cam/ctl/ctl_error.cSat Dec 24 17:42:34 2016 (r310524) @@ -65,9 +65,9 @@ __FBSDID("$FreeBSD$"); #include void -ctl_set_sense_data_va(struct scsi_sense_data *sense_data, void *lunptr, - scsi_sense_data_type sense_format, int current_error, - int sense_key, int asc, int ascq, va_list ap) +ctl_set_sense_data_va(struct scsi_sense_data *sense_data, u_int *sense_len, +void *lunptr, scsi_sense_data_type sense_format, int current_error, +int sense_key, int asc, int ascq, va_list ap) { struct ctl_lun *lun; @@ -89,20 +89,30 @@ ctl_set_sense_data_va(struct scsi_sense_ sense_format = SSD_TYPE_FIXED; } - scsi_set_sense_data_va(sense_data, sense_format, current_error, - sense_key, asc, ascq, ap); + /* +* Determine maximum sense data length to return. +*/ + if (*sense_len == 0) { + if ((lun != NULL) && (lun->MODE_CTRLE.max_sense != 0)) + *sense_len = lun->MODE_CTRLE.ma
svn commit: r310527 - head/usr.bin/logger
Author: hrs Date: Sat Dec 24 22:51:02 2016 New Revision: 310527 URL: https://svnweb.freebsd.org/changeset/base/310527 Log: Fix gcc build. Spotted by: lidl Modified: head/usr.bin/logger/logger.c Modified: head/usr.bin/logger/logger.c == --- head/usr.bin/logger/logger.cSat Dec 24 20:36:27 2016 (r310526) +++ head/usr.bin/logger/logger.cSat Dec 24 22:51:02 2016 (r310527) @@ -99,6 +99,7 @@ main(int argc, char *argv[]) host = NULL; svcname = "syslog"; src = NULL; + socks = NULL; pri = LOG_USER | LOG_NOTICE; logflags = 0; unsetenv("TZ"); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310528 - head/usr.sbin/syslogd
Author: hrs Date: Sat Dec 24 23:29:50 2016 New Revision: 310528 URL: https://svnweb.freebsd.org/changeset/base/310528 Log: - Fix -N flag (NoBind) for AF_LOCAL sockets. - Do setsockopt(SO_RCVBUF) for AF_LOCAL sockets regardless of -s flag. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Sat Dec 24 22:51:02 2016 (r310527) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 24 23:29:50 2016 (r310528) @@ -2873,9 +2873,8 @@ socksetup(struct peer *pe) for (res = res0; res != NULL; res = res->ai_next) { int s; - if (res->ai_family == AF_LOCAL) - unlink(pe->pe_name); - else if (SecureMode > 1) { + if (res->ai_family != AF_LOCAL && + SecureMode > 1) { /* Only AF_LOCAL in secure mode. */ continue; } @@ -2907,26 +2906,36 @@ socksetup(struct peer *pe) error++; continue; } + /* -* RFC 3164 recommends that client side message -* should come from the privileged syslogd port. +* Bind INET and UNIX-domain sockets. +* +* A UNIX-domain socket is always bound to a pathname +* regardless of -N flag. * -* If the system administrator choose not to obey +* For INET sockets, RFC 3164 recommends that client +* side message should come from the privileged syslogd port. +* +* If the system administrator chooses not to obey * this, we can skip the bind() step so that the * system will choose a port for us. */ - if (NoBind == 0) { + if (res->ai_family == AF_LOCAL) + unlink(pe->pe_name); + if (res->ai_family == AF_LOCAL || + NoBind == 0 || pe->pe_name != NULL) { if (bind(s, res->ai_addr, res->ai_addrlen) < 0) { logerror("bind"); close(s); error++; continue; } - if (SecureMode == 0) + if (res->ai_family == AF_LOCAL || + SecureMode == 0) increase_rcvbuf(s); } if (res->ai_family == AF_LOCAL && - chmod(pe->pe_name, pe->pe_mode) < 0) { + chmod(pe->pe_name, pe->pe_mode) < 0) { dprintf("chmod %s: %s\n", pe->pe_name, strerror(errno)); close(s); @@ -2936,7 +2945,7 @@ socksetup(struct peer *pe) dprintf("new socket fd is %d\n", s); listen(s, 5); dprintf("shutdown\n"); - if (SecureMode) { + if (SecureMode || res->ai_family == AF_LOCAL) { /* Forbid communication in secure mode. */ if (shutdown(s, SHUT_RD) < 0 && errno != ENOTCONN) { @@ -2944,9 +2953,9 @@ socksetup(struct peer *pe) if (!Debug) die(0); } - dprintf("listening on inet socket\n"); + dprintf("listening on socket\n"); } else - dprintf("sending on inet socket\n"); + dprintf("sending on socket\n"); addsock(res->ai_addr, res->ai_addrlen, &(struct socklist){ .sl_socket = s, ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310529 - head/sys/net80211
Author: avos Date: Sat Dec 24 23:43:14 2016 New Revision: 310529 URL: https://svnweb.freebsd.org/changeset/base/310529 Log: net80211: fix 'pending CAC -> RUN transition lost' bug. Ensure that CAC -> RUN state transition will be requested for every vap only once. Modified: head/sys/net80211/ieee80211_proto.c Modified: head/sys/net80211/ieee80211_proto.c == --- head/sys/net80211/ieee80211_proto.c Sat Dec 24 23:29:50 2016 (r310528) +++ head/sys/net80211/ieee80211_proto.c Sat Dec 24 23:43:14 2016 (r310529) @@ -1840,7 +1840,7 @@ ieee80211_cac_completeswitch(struct ieee ieee80211_new_state_locked(vap0, IEEE80211_S_RUN, 0); TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) - if (vap->iv_state == IEEE80211_S_CAC) + if (vap->iv_state == IEEE80211_S_CAC && vap != vap0) ieee80211_new_state_locked(vap, IEEE80211_S_RUN, 0); IEEE80211_UNLOCK(ic); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r310530 - head/usr.sbin/jls
Author: jamie Date: Sat Dec 24 23:51:27 2016 New Revision: 310530 URL: https://svnweb.freebsd.org/changeset/base/310530 Log: Improve IP address list representation in libxo output. Extract decision-making about special-case printing of certain jail parameters into a function. Refactor emitting of IPv4 and IPv6 address lists into a function. Resulting user-facing changes: XO_VERSION is bumped to 2. In verbose mode (-v), IPv4 and IPv6-Addresses are now properly emitted as separate lists. This only affects the output in encoding styles, i.e. xml and json. {{ "__version": "1","__version": "2", "jail-information": {"jail-information": { "jail": ["jail": [ {{ "jid": 166, "jid": 166, "hostname": "foo.com", "hostname": "foo.com", "path": "/var/jail/foo", "path": "/var/jail/foo", "name": "foo", "name": "foo", "state": "ACTIVE", "state": "ACTIVE", "cpusetid": 2, "cpusetid": 2, "ipv4_addrs": [ "ipv4_addrs": [ "10.1.1.1", "10.1.1.1", "10.1.1.2", "10.1.1.2", "10.1.1.3", | "10.1.1.3" > ], > "ipv6_addrs": [ "fe80::1000:1", "fe80::1000:1", "fe80::1000:2" "fe80::1000:2" ]] }} ]] }} }} In -n mode, ip4.addr and ip6.addr are formatted in the encoding styles' native list types, e.g. instead of comma-separated lists, JSON arrays are printed. jls -n all --libxo json ... "ip4.addr": [ "10.1.1.1", "10.1.1.2", "10.1.1.3" ], "ip4.saddrsel": true, "ip6.addr": [ "fe80::1000:1", "fe80::1000:2" ], ... jls -n all --libxo xml ... 10.1.1.1 10.1.1.2 10.1.1.3 true fe80::1000:1 fe80::1000:2 ... PR: 215008 Submitted by: Christian Schwarz Differential Revision:https://reviews.freebsd.org/D8766 Modified: head/usr.sbin/jls/jls.c Modified: head/usr.sbin/jls/jls.c == --- head/usr.sbin/jls/jls.c Sat Dec 24 23:43:14 2016(r310529) +++ head/usr.sbin/jls/jls.c Sat Dec 24 23:51:27 2016(r310530) @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); #defineJP_USER 0x0100 #defineJP_OPT 0x0200 -#define JLS_XO_VERSION "1" +#define JLS_XO_VERSION "2" #definePRINT_DEFAULT 0x01 #definePRINT_HEADER0x02 @@ -77,7 +77,10 @@ static int sort_param(const void *a, con static char *noname(const char *name); static char *nononame(const char *name); static int print_jail(int pflags, int jflags); +static int special_print(int pflags, struct jailparam *param); static void quoted_print(int pflags, char *name, char *value); +static void emit_ip_addr_list(int af_family, const char *list_name, + struct jailparam *param); int main(int argc, char **argv) @@ -379,8 +382,7 @@ print_jail(int pflags, int jflags) { char *nname, *xo_nname; char **param_values; - int i, ai, jid, count, n, spc; - char ipbuf[INET6_ADDRSTRLEN]; + int i, jid, n, spc; jid = jailparam_get(params, nparams, jflags); if (jid < 0) @@ -401,29 +403,13 @@ print_jail(int pflags, int jflags) n = 6; #ifdef INET if (ip4_ok && !strcmp(params[n].jp_name, "ip4.addr")) { - count = params[n].jp_valuelen / sizeof(struct in_addr); - for (ai = 0; ai < count; ai++) - if (inet_ntop(AF_INET, - &((struct in_addr *)params[n].jp_value)[ai], - ipbuf, sizeof(ipbuf)) == NULL) - xo_err(1, "inet_ntop"); - else { - xo_emit("{P: }{l:ipv4_addrs}{P:\n}", ipbuf); - } + emit_ip_addr_list(AF_INET, "ipv4_addrs", params + n); n++; } #endif #ifdef INET6 if (ip6_ok && !strcmp(params[n].jp_name, "ip6.addr")) { - count = params[n].jp_valuelen / sizeof(struct in6_addr); - for (ai = 0; ai < coun