svn commit: r368404 - head/tools/tools/locale
Author: hrs Date: Mon Dec 7 04:45:29 2020 New Revision: 368404 URL: https://svnweb.freebsd.org/changeset/base/368404 Log: Fix the source directory when installing the results. The install target did not install them actually. Spotted by: Thomas Munro, bapt, yuripv Modified: head/tools/tools/locale/Makefile Modified: head/tools/tools/locale/Makefile == --- head/tools/tools/locale/MakefileMon Dec 7 01:09:45 2020 (r368403) +++ head/tools/tools/locale/MakefileMon Dec 7 04:45:29 2020 (r368404) @@ -95,6 +95,7 @@ install: install-${t} install-${t}: cd ${LOCALESRCDIR}/${t} && \ rm -f Makefile *.src && \ + cd ${.OBJDIR} && \ install -c ${t}/* ${LOCALESRCDIR}/${t} . endif .endfor ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r364449 - head/bin/ls
Gordon Bergling wrote in <20200824085223.ga28...@lion.0xfce3.net>: gb> thanks for your feedback. I can only define POSIX.1-200{1,8} or -susv4. So what gb> do you think about the following STANDARDS section? gb> gb> For the options that are non-existing I could correct them to -2001 and mention gb> also -susv4. gb> gb> STANDARDS gb> With the exception of options -g, -n and -o, the ls utility conforms to gb> IEEE Std 1003.1-2001 (“POSIX.1”) and Version 4 of the Single UNIX gb> Specification (“SUSv4”). The options -B, -D, -G, -I, -T, -U, -W, -Z, -b, gb> -h, -w, -y and -, are compatible extensions not defined in IEEE Std gb> 1003.1-2001 (“POSIX.1”). It might be a bit tedious, but just adding -2008 looks good to me like the following: |.St -p1003.1-2001 |and |.St -p1003.1-2008 . p1003.1-2004 is a subset of SUSv3 (and -2008 is one of SUSv4), so using p1003.1- consistently sounds less confusing when describing the conformance within the subsets. Regarding the non-standard extensions, I am not sure what "compatible" means. Some of them are extensions commonly seen on other BSD-derived OSes, some are available only on FreeBSD, and some have the same names with GNU's counterpart but different meanings. Is just mentioning "...are non-standard extensions" with no specification name sufficient and easier? I have no strong opinion on that part, but this is just my two cents. -- Hiroki pgpiGvHKetuv1.pgp Description: PGP signature
Re: svn commit: r364449 - head/bin/ls
Hi, Gordon Bergling wrote in <202008210620.07l6kc6m091...@repo.freebsd.org>: gb> Author: gbe (doc committer) gb> Date: Fri Aug 21 06:20:11 2020 gb> New Revision: 364449 gb> URL: https://svnweb.freebsd.org/changeset/base/364449 gb> gb> Log: gb> ls(1): Update POSIX conformance from 2001 to 2008 gb> gb> - Update the options that are non-existing in POSIX from 2001 to 2008 gb> - Update POSIX conformance in the STANDARDS section from 2001 to 2008 Generally speaking, conformance with POSIX.1-2001 (SUSv3) and POSIX.1-2008 (SUSv4) are independent, so a simple replacement by s/2001/2008/ removes the former information. If we want to describe -2008, please add it instead of replacing the prior version numbers. -- Hiroki pgpiyC5RvlnTz.pgp Description: PGP signature
svn commit: r364246 - svnadmin/conf
Author: hrs Date: Sat Aug 15 07:22:48 2020 New Revision: 364246 URL: https://svnweb.freebsd.org/changeset/base/364246 Log: Revert r364244 since commit of r364245 completed. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf == --- svnadmin/conf/sizelimit.confSat Aug 15 07:19:37 2020 (r364245) +++ svnadmin/conf/sizelimit.confSat Aug 15 07:22:48 2020 (r364246) @@ -19,7 +19,6 @@ andrew bapt davidcs dim2048 -hrs imp jb jeff ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r364245 - in head/tools/tools/locale: . etc/final-maps patch tools
Author: hrs Date: Sat Aug 15 07:19:37 2020 New Revision: 364245 URL: https://svnweb.freebsd.org/changeset/base/364245 Log: - Update to Unicode CLDR v35 (Unicode 12.0). - Update tools/tools/locale to add make targets to automatically generate locale source files. With this change, just typing "make obj && make -j4" will rebuild them. Check README for more details. - Fix issues in ja_JP ctypedef and range specification support in utf8-rollup.pl. - Add a temporary patch for UnicodeData.txt to fix code ranges of CJK Ideograph Extension A and Extension B. - tools/cldr2def.pl: Use eucJP for ja_JP ctypedef because eucJP is not compatible with UTF-8. - tools/convert_map.pl: Add a verbose error message. - tools/utf8-rollup.pl: Normalize entries to use Unicode, not UTF-8. Reviewed by: bapt Differential Revision:https://reviews.freebsd.org/D25503 Added: head/tools/tools/locale/patch/ head/tools/tools/locale/patch/patch-UnicodeData.txt (contents, props changed) Modified: head/tools/tools/locale/Makefile head/tools/tools/locale/README head/tools/tools/locale/etc/final-maps/map.UTF-8 head/tools/tools/locale/tools/cldr2def.pl head/tools/tools/locale/tools/convert_map.pl head/tools/tools/locale/tools/finalize head/tools/tools/locale/tools/utf8-rollup.pl Modified: head/tools/tools/locale/Makefile == --- head/tools/tools/locale/MakefileSat Aug 15 07:16:12 2020 (r364244) +++ head/tools/tools/locale/MakefileSat Aug 15 07:19:37 2020 (r364245) @@ -7,19 +7,30 @@ # # Modified by John Marino to suit DragonFly needs # +.if ${.CURDIR} == ${.OBJDIR} +.error Do make obj first. +.endif -.OBJDIR: . +LOCALESRCDIR?= ${DESTDIR}/usr/src/share +TMPDIR?= /tmp -.if !defined(UNIDIR) -.error UNIDIR is not set -.endif -PASSON=UNIDIR="${UNIDIR}" +BASEDIR= ${.CURDIR} +ETCDIR=${BASEDIR}/etc +TOOLSDIR= ${BASEDIR}/tools +PATCHDIR= ${BASEDIR}/patch +UNIDIR=${.OBJDIR:tA}/unicode -ETCDIR=${.CURDIR}/etc +PKGS= openjdk8 \ + apache-ant \ + p5-XML-Parser \ + p5-Tie-IxHash \ + p5-Text-Iconv +tools-test: + pkg info -e ${PKGS} + @echo tools ok. KNOWN= monetdef numericdef msgdef colldef ctypedef # timedef TYPES?=${KNOWN} -LOCALE_DESTDIR?= /tmp/generated-locales/ COLLATION_SPECIAL?= \ cs_CZ ISO8859-2 \ @@ -44,67 +55,81 @@ COLLATION_SPECIAL?= \ .for area enc in ${COLLATION_SPECIAL} COLLATIONS_SPECIAL_ENV+= ${area}.${enc} .endfor -PASSON+= COLLATIONS_SPECIAL="${COLLATIONS_SPECIAL_ENV}" +SETENV=env -i \ + PATH="${PATH}" \ + TMPDIR="${TMPDIR}" \ + COLLATIONS_SPECIAL="${COLLATIONS_SPECIAL_ENV}" \ + UNIDIR="${UNIDIR}" \ + BASEDIR="${BASEDIR}" \ + TOOLSDIR="${TOOLSDIR}" \ + ETCDIR="${ETCDIR}" -all: +all: posix build afterbuild +.ORDER: posix build afterbuild + +afterbuild: build + @echo "" + @find . -name *failed + .for t in ${TYPES} . if ${KNOWN:M${t}} - test -d ${t} || mkdir ${t} - make build-${t} +build: build-${t} +.ORDER: build-${t} afterbuild . endif .endfor - @echo "" - @find . -name *failed +diff: .for t in ${TYPES} +. if ${KNOWN:M${t}} +diff: diff-${t} +diff-${t}: + -/usr/bin/diff -ruN -x Makefile -x Makefile.depend \ + ${LOCALESRCDIR}/${t} ${t} +. endif +.endfor + +install: +.for t in ${TYPES} +. if ${KNOWN:M${t}} install: install-${t} install-${t}: -. if ${KNOWN:M${t}} - rm -rf ${.CURDIR}/${t}.draft - rm -f ${.CURDIR}/../../../share/${t}/Makefile - rm -f ${.CURDIR}/../../../share/${t}/*.src - mv ${.CURDIR}/${t}/* ${.CURDIR}/../../../share/${t}/ + cd ${LOCALESRCDIR}/${t} && \ + rm -f Makefile *.src && \ + install -c ${t}/* ${LOCALESRCDIR}/${t} . endif .endfor post-install: .for t in ${TYPES} . if ${KNOWN:M${t}} - (cd ${.CURDIR}/../../../share/${t} && \ - make && make install && make clean) + cd ${LOCALSRCDIR}/${t} && \ + make && make install && make clean . endif .endfor .for t in ${TYPES} -gen-${t}: - mkdir -p ${t} ${t}.draft - perl -I tools tools/cldr2def.pl \ - --unidir=$$(realpath ${UNIDIR}) \ - --etc=$$(realpath ${ETCDIR}) \ +CLEANDIRS+=${t} ${t}.draft +${t}: + mkdir -p ${t} ${t}.draft && \ + perl -I ${TOOLSDIR} ${TOOLSDIR}/cldr2def.pl \ + --unidir=${UNIDIR:tA} \ + --etc=${ETCDIR:tA} \ --type=${t} -build-${t}: gen-${t} - env ${PASSON} tools/finalize ${t} +build-${t}: ${t} + ${SETENV} OUTBASEDIR="${.OBJDIR}/${t}" ${TOOLSDIR}/finalize ${t} .endfor -gen-ctypedef: ctype-rollup -static-colldef: gen-colldef
svn commit: r364244 - svnadmin/conf
Author: hrs Date: Sat Aug 15 07:16:12 2020 New Revision: 364244 URL: https://svnweb.freebsd.org/changeset/base/364244 Log: Disable the size limitation temporarily to commit changes to tools/tools/locale. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf == --- svnadmin/conf/sizelimit.confSat Aug 15 06:24:07 2020 (r364243) +++ svnadmin/conf/sizelimit.confSat Aug 15 07:16:12 2020 (r364244) @@ -19,6 +19,7 @@ andrew bapt davidcs dim2048 +hrs imp jb jeff ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r362925 - in stable: 11/share/ctypedef 12/share/ctypedef
Author: hrs Date: Sat Jul 4 07:04:56 2020 New Revision: 362925 URL: https://svnweb.freebsd.org/changeset/base/362925 Log: MFC r362770: Fix CTYPE for ja_JP.eucJP and ja_JP.SJIS. PR: 163168 Modified: stable/11/share/ctypedef/ja_JP.eucJP.src Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/share/ctypedef/ja_JP.eucJP.src Directory Properties: stable/12/ (props changed) Modified: stable/11/share/ctypedef/ja_JP.eucJP.src == --- stable/11/share/ctypedef/ja_JP.eucJP.srcSat Jul 4 06:34:55 2020 (r362924) +++ stable/11/share/ctypedef/ja_JP.eucJP.srcSat Jul 4 07:04:56 2020 (r362925) @@ -49,7 +49,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -73,7 +72,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -85,7 +83,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -101,7 +98,6 @@ upper;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -126,45 +122,6 @@ upper ;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ ;/ ;/ ;/ @@ -173,292 +130,86 @@ upper;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ -
svn commit: r362925 - in stable: 11/share/ctypedef 12/share/ctypedef
Author: hrs Date: Sat Jul 4 07:04:56 2020 New Revision: 362925 URL: https://svnweb.freebsd.org/changeset/base/362925 Log: MFC r362770: Fix CTYPE for ja_JP.eucJP and ja_JP.SJIS. PR: 163168 Modified: stable/12/share/ctypedef/ja_JP.eucJP.src Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/share/ctypedef/ja_JP.eucJP.src Directory Properties: stable/11/ (props changed) Modified: stable/12/share/ctypedef/ja_JP.eucJP.src == --- stable/12/share/ctypedef/ja_JP.eucJP.srcSat Jul 4 06:34:55 2020 (r362924) +++ stable/12/share/ctypedef/ja_JP.eucJP.srcSat Jul 4 07:04:56 2020 (r362925) @@ -49,7 +49,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -73,7 +72,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -85,7 +83,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -101,7 +98,6 @@ upper;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -126,45 +122,6 @@ upper ;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ ;/ ;/ ;/ @@ -173,293 +130,86 @@ upper;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ -
svn commit: r362770 - head/share/ctypedef
Author: hrs Date: Mon Jun 29 03:23:13 2020 New Revision: 362770 URL: https://svnweb.freebsd.org/changeset/base/362770 Log: Fix CTYPE for ja_JP.eucJP and ja_JP.SJIS. PR: 163168 MFC after:3 days Modified: head/share/ctypedef/ja_JP.eucJP.src Modified: head/share/ctypedef/ja_JP.eucJP.src == --- head/share/ctypedef/ja_JP.eucJP.src Mon Jun 29 03:09:14 2020 (r362769) +++ head/share/ctypedef/ja_JP.eucJP.src Mon Jun 29 03:23:13 2020 (r362770) @@ -49,7 +49,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -73,7 +72,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -85,7 +83,6 @@ upper ;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -101,7 +98,6 @@ upper;/ ;/ ;/ ;/ - ;/ ;/ ;/ ;/ @@ -126,45 +122,6 @@ upper ;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ ;/ ;/ ;/ @@ -173,293 +130,86 @@ upper;/ ;/ ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ + ;/ ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ - ;/ -
svn commit: r362512 - stable/11/release/doc/en_US.ISO8859-1/hardware
Author: hrs Date: Mon Jun 22 21:41:51 2020 New Revision: 362512 URL: https://svnweb.freebsd.org/changeset/base/362512 Log: Fix a build error due to removal of hardware section in umass(4). Modified: stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml Modified: stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml == --- stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml Mon Jun 22 21:28:51 2020(r362511) +++ stable/11/release/doc/en_US.ISO8859-1/hardware/article.xml Mon Jun 22 21:41:51 2020(r362512) @@ -1543,8 +1543,6 @@ - - [, , ] Audio Devices ( driver) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r362503 - head/share/man/man5
Eugene Grosbein wrote in <202006221752.05mhqend013...@repo.freebsd.org>: eu> Author: eugen eu> Date: Mon Jun 22 17:52:13 2020 eu> New Revision: 362503 eu> URL: https://svnweb.freebsd.org/changeset/base/362503 eu> eu> Log: eu> Followup to r362502: rc.conf(5): unobsolete gif_interfaces eu> eu> There are cases when gif_interfaces cannot be replaced eu> with cloned_interfaces, such as tunnels with external IPv6 addresses eu> and internal IPv4 or vice versa. Such configuration requires eu> extra invocation of ifconfig(8) and supported with gif_interfaces only. eu> eu> Fix manual page and provide some examples. eu> eu> MFC after:1 week eu> X-MFC-With: 362502 (snip) eu> +Additionally, this option ensures that each listed interface is created eu> +via the eu> +.Cm create eu> +option to eu> +.Xr ifconfig eu> +before attempting to configure it. eu> +.Pp eu> For example, configure two eu> .Xr gif eu> interfaces with: eu> -.Bd -literal -offset indent eu> +.Bd -literal eu> gif_interfaces="gif0 gif1" eu> -ifconfig_gif0="tunnel src_addr0 dst_addr0" eu> -ifconfig_gif1="tunnel src_addr1 dst_addr1" eu> +gifconfig_gif0="100.64.0.1 100.64.0.2" eu> +ifconfig_gif0="inet 10.0.0.1 10.0.0.2 netmask 255.255.255.252" eu> +gifconfig_gif1="inet6 2a00::1 2a01::1" eu> +ifconfig_gif1="inet 10.1.0.1 10.1.0.2 netmask 255.255.255.252" These cases should be able to express by the following: ifconfig_gif0="inet 10.0.0.1 10.0.0.2 netmask 255.255.255.252" ifconfig_gif0_alias0="inet tunnel 100.64.0.1 100.64.0.2" and ifconfig_gif1="inet 10.0.0.1 10.0.0.2 netmask 255.255.255.252" ifconfig_gif1_ipv6="inet6 auto_linklocal" ifconfig_gif1_alias0="inet6 tunnel 2a00::1 2a01::1" Could you show more examples which cannot be covered by cloned_interfaces + ifconfig_*? I lost track of the discussions in the past (sorry) but want to revisit this to understand what was the limitation because it should also affect gre(8) and other tunnel pseudo-interfaces. -- Hiroki pgpTeTXjvvYhi.pgp Description: PGP signature
svn commit: r359081 - stable/12/contrib/sendmail/src
Author: hrs Date: Wed Mar 18 18:21:58 2020 New Revision: 359081 URL: https://svnweb.freebsd.org/changeset/base/359081 Log: MFC of r358404, r358410, r358412, and r358413: Fix broken STARTTLS when SharedMemoryKey is enabled. OpenSSL 1.1 API patch for sendmail had a bug which prevented sm_RSA_generate_key() function from working. This function is used to generate a temporary RSA key for a shared memory region used for TLS processing. Note that 12.0 and 12.1-RELEASE include this bug. This affects only if SM_CONF_SHM compile-time option (enabled by default) and SharedMemoryKey run-time option (not enabled by default) in a .cf file are specified. The latter corresponds to confSHARED_MEMORY_KEY in a .mc file. Fix style inconsistencies. Do not free p and g parameters after calling DH_set0_pqg(3). PR: 242861 Differential Revision:https://reviews.freebsd.org/D23734 Modified: stable/12/contrib/sendmail/src/tls.c Directory Properties: stable/12/ (props changed) Modified: stable/12/contrib/sendmail/src/tls.c == --- stable/12/contrib/sendmail/src/tls.cWed Mar 18 18:20:55 2020 (r359080) +++ stable/12/contrib/sendmail/src/tls.cWed Mar 18 18:21:58 2020 (r359081) @@ -56,10 +56,10 @@ DH_set0_pqg(dh, p, q, g) BIGNUM *q; BIGNUM *g; { - dh->p=p; + dh->p = p; if (q != NULL) - dh->q=q; - dh->g=g; + dh->q = q; + dh->g = g; return 1; /* success */ } # endif /* !defined() || OPENSSL_VERSION_NUMBER < 0x00907000L */ @@ -83,20 +83,25 @@ static unsigned char dh512_g[] = static DH * get_dh512() { - DH *dh = NULL; + DH *dh; BIGNUM *dhp_bn, *dhg_bn; if ((dh = DH_new()) == NULL) return NULL; dhp_bn = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL); dhg_bn = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL); - if ((dhp_bn == NULL) || (dhg_bn == NULL) || !DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) + if ((dhp_bn == NULL) || (dhg_bn == NULL)) { DH_free(dh); BN_free(dhp_bn); BN_free(dhg_bn); - return(NULL); + return NULL; } + if (!DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) + { + DH_free(dh); + return NULL; + } return dh; } @@ -117,7 +122,7 @@ oK0jjSXgFyeU4/NfyA+zuNeWzUL6bHmigwIBAg== static DH * get_dh2048() { - static unsigned char dh2048_p[]={ + static unsigned char dh2048_p[] = { 0xAC,0x37,0x20,0x70,0xBA,0x71,0x12,0x4B,0x10,0x1C,0xF9,0x68, 0x95,0x12,0x82,0x50,0x9D,0xAC,0xCC,0xA4,0x73,0x8A,0xC7,0x96, 0x57,0xD7,0x14,0x49,0x03,0x59,0x1B,0x1A,0x06,0xC3,0xB2,0xA4, @@ -141,22 +146,27 @@ get_dh2048() 0xE3,0xF3,0x5F,0xC8,0x0F,0xB3,0xB8,0xD7,0x96,0xCD,0x42,0xFA, 0x6C,0x79,0xA2,0x83, }; - static unsigned char dh2048_g[]={ 0x02, }; + static unsigned char dh2048_g[] = { 0x02, }; DH *dh; BIGNUM *dhp_bn, *dhg_bn; - if ((dh=DH_new()) == NULL) - return(NULL); - dhp_bn = BN_bin2bn(dh2048_p,sizeof(dh2048_p),NULL); - dhg_bn = BN_bin2bn(dh2048_g,sizeof(dh2048_g),NULL); - if ((dhp_bn == NULL) || (dhg_bn == NULL) || !DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) + if ((dh = DH_new()) == NULL) + return NULL; + dhp_bn = BN_bin2bn(dh2048_p, sizeof(dh2048_p), NULL); + dhg_bn = BN_bin2bn(dh2048_g, sizeof(dh2048_g), NULL); + if ((dhp_bn == NULL) || (dhg_bn == NULL)) { DH_free(dh); BN_free(dhp_bn); BN_free(dhg_bn); - return(NULL); + return NULL; } - return(dh); + if (!DH_set0_pqg(dh, dhp_bn, NULL, dhg_bn)) + { + DH_free(dh); + return NULL; + } + return dh; } # endif /* !NO_DH */ @@ -744,19 +754,16 @@ sm_RSA_generate_key(num, e) unsigned long e; { RSA *rsa = NULL; -BIGNUM *bn_rsa_r4; - int rc; + BIGNUM *bn_rsa_r4; bn_rsa_r4 = BN_new(); -rc = BN_set_word(bn_rsa_r4, RSA_F4); - if ((bn_rsa_r4 != NULL) && BN_set_word(bn_rsa_r4, RSA_F4) && (rsa = RSA_new()) != NULL) + if ((bn_rsa_r4 != NULL) && BN_set_word(bn_rsa_r4, e) && (rsa = RSA_new()) != NULL) { - if (!RSA_generate_key_ex(rsa, RSA_KEYLENGTH, bn_rsa_r4, NULL)) + if (!RSA_generate_key_ex(rsa, num, bn_rsa_r4, NULL)) { RSA_free(rsa); rsa = NULL; } - return NULL; } BN_free(bn_rsa_r4); return rsa; @@ -1263,7 +1270,7 @@ inittls(ctx, req, options, srv, certfile, keyfile, cac
svn commit: r359078 - stable/12/sys/dev/rtwn/pci
Author: hrs Date: Wed Mar 18 18:16:00 2020 New Revision: 359078 URL: https://svnweb.freebsd.org/changeset/base/359078 Log: MFC of r358402: Add MODULE_PNP_INFO() to autoload the rtwn_pci(4) kernel module. Reviewed by: imp Differential Revision:https://reviews.freebsd.org/D23807 Modified: stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.c stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.c == --- stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.cWed Mar 18 18:10:44 2020(r359077) +++ stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.cWed Mar 18 18:16:00 2020(r359078) @@ -96,15 +96,16 @@ static void rtwn_pci_attach_methods(struct rtwn_softc static const struct rtwn_pci_ident * rtwn_pci_probe_sub(device_t dev) { - const struct rtwn_pci_ident *ident; - int vendor_id, device_id; + int i, vendor_id, device_id; vendor_id = pci_get_vendor(dev); device_id = pci_get_device(dev); - for (ident = rtwn_pci_ident_table; ident->name != NULL; ident++) - if (vendor_id == ident->vendor && device_id == ident->device) - return (ident); + for (i = 0; i < nitems(rtwn_pci_ident_table); i++) { + if (vendor_id == rtwn_pci_ident_table[i].vendor && + device_id == rtwn_pci_ident_table[i].device) + return (_pci_ident_table[i]); + } return (NULL); } @@ -788,6 +789,8 @@ static devclass_t rtwn_pci_devclass; DRIVER_MODULE(rtwn_pci, pci, rtwn_pci_driver, rtwn_pci_devclass, NULL, NULL); MODULE_VERSION(rtwn_pci, 1); +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, rtwn, rtwn_pci_ident_table, +nitems(rtwn_pci_ident_table)); MODULE_DEPEND(rtwn_pci, pci, 1, 1, 1); MODULE_DEPEND(rtwn_pci, wlan, 1, 1, 1); MODULE_DEPEND(rtwn_pci, rtwn, 2, 2, 2); Modified: stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.h == --- stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.hWed Mar 18 18:10:44 2020(r359077) +++ stable/12/sys/dev/rtwn/pci/rtwn_pci_attach.hWed Mar 18 18:16:00 2020(r359078) @@ -35,7 +35,6 @@ struct rtwn_pci_ident { static const struct rtwn_pci_ident rtwn_pci_ident_table[] = { { 0x10ec, 0x8176, "Realtek RTL8188CE", RTWN_CHIP_RTL8192CE }, { 0x10ec, 0x8179, "Realtek RTL8188EE", RTWN_CHIP_RTL8188EE }, - { 0, 0, NULL, RTWN_CHIP_MAX_PCI } }; typedef void (*chip_pci_attach)(struct rtwn_pci_softc *); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359077 - in stable: 11/bin/sh 12/bin/sh
Author: hrs Date: Wed Mar 18 18:10:44 2020 New Revision: 359077 URL: https://svnweb.freebsd.org/changeset/base/359077 Log: MFC of r358152 and r328235: Improve performance of "read" built-in command when using a seekable fd. The read built-in command calls read(2) with a 1-byte buffer because newline characters need to be detected even on a byte stream which comes from a non-seekable file descriptor. Because of this, the following script calls >6,000 read(2) to show a 6-KiB file: while read IN; do echo "$IN"; done < /COPYRIGHT When the input byte stream is seekable, it is possible to read a data block and then reposition the file pointer to where a newline character found. This change adds a small buffer to do this and reduces the number of read(2) calls. Theoretically, multiple built-in commands reading the same seekable byte stream in a single pipe chain can share the buffer. However, this change just makes a single invocation of the read built-in allocate a buffer and deallocate it every time for simplicity. Although this causes read(2) to read the same regions multiple times, the performance penalty should be small compared to the reduction of read(2) calls. Reviewed by: jilles Differential Revision:https://reviews.freebsd.org/D23747 Modified: stable/12/bin/sh/miscbltin.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/bin/sh/miscbltin.c Directory Properties: stable/11/ (props changed) Modified: stable/12/bin/sh/miscbltin.c == --- stable/12/bin/sh/miscbltin.cWed Mar 18 18:02:33 2020 (r359076) +++ stable/12/bin/sh/miscbltin.cWed Mar 18 18:10:44 2020 (r359077) @@ -66,10 +66,79 @@ __FBSDID("$FreeBSD$"); #undef eflag +#defineREAD_BUFLEN 1024 +struct fdctx { + int fd; + size_t off;/* offset in buf */ + size_t buflen; + char*ep;/* tail pointer */ + charbuf[READ_BUFLEN]; +}; + +static void fdctx_init(int, struct fdctx *); +static void fdctx_destroy(struct fdctx *); +static ssize_t fdgetc(struct fdctx *, char *); int readcmd(int, char **); int umaskcmd(int, char **); int ulimitcmd(int, char **); +static void +fdctx_init(int fd, struct fdctx *fdc) +{ + off_t cur; + + /* Check if fd is seekable. */ + cur = lseek(fd, 0, SEEK_CUR); + *fdc = (struct fdctx){ + .fd = fd, + .buflen = (cur != -1) ? READ_BUFLEN : 1, + .ep = >buf[0], /* No data */ + }; +} + +static ssize_t +fdgetc(struct fdctx *fdc, char *c) +{ + ssize_t nread; + + if (>buf[fdc->off] == fdc->ep) { + nread = read(fdc->fd, fdc->buf, fdc->buflen); + if (nread > 0) { + fdc->off = 0; + fdc->ep = fdc->buf + nread; + } else + return (nread); + } + *c = fdc->buf[fdc->off++]; + + return (1); +} + +static void +fdctx_destroy(struct fdctx *fdc) +{ + off_t residue; + + if (fdc->buflen > 1) { + /* +* Reposition the file offset. Here is the layout of buf: +* +* | off +* v +* |*|---| +* buf ep buf+buflen +* |<- residue ->| +* +* off: current character +* ep: offset just after read(2) +* residue: length for reposition +*/ + residue = (fdc->ep - fdc->buf) - fdc->off; + if (residue > 0) + (void) lseek(fdc->fd, -residue, SEEK_CUR); + } +} + /* * The read builtin. The -r option causes backslashes to be treated like * ordinary characters. @@ -108,6 +177,7 @@ readcmd(int argc __unused, char **argv __unused) fd_set ifds; ssize_t nread; int sig; + struct fdctx fdctx; rflag = 0; prompt = NULL; @@ -173,8 +243,9 @@ readcmd(int argc __unused, char **argv __unused) backslash = 0; STARTSTACKSTR(p); lastnonifs = lastnonifsws = -1; + fdctx_init(STDIN_FILENO, ); for (;;) { - nread = read(STDIN_FILENO, , 1); + nread = fdgetc(, ); if (nread == -1) { if (errno == EINTR) { sig = pendingsig; @@ -260,6 +331,7 @@ readcmd(int argc __unused, char **argv __unused) STARTSTACKSTR(p); lastnonifs = lastnonifsws = -1; } + fdctx_destroy(); STACKSTRNUL(p); /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359077 - in stable: 11/bin/sh 12/bin/sh
Author: hrs Date: Wed Mar 18 18:10:44 2020 New Revision: 359077 URL: https://svnweb.freebsd.org/changeset/base/359077 Log: MFC of r358152 and r328235: Improve performance of "read" built-in command when using a seekable fd. The read built-in command calls read(2) with a 1-byte buffer because newline characters need to be detected even on a byte stream which comes from a non-seekable file descriptor. Because of this, the following script calls >6,000 read(2) to show a 6-KiB file: while read IN; do echo "$IN"; done < /COPYRIGHT When the input byte stream is seekable, it is possible to read a data block and then reposition the file pointer to where a newline character found. This change adds a small buffer to do this and reduces the number of read(2) calls. Theoretically, multiple built-in commands reading the same seekable byte stream in a single pipe chain can share the buffer. However, this change just makes a single invocation of the read built-in allocate a buffer and deallocate it every time for simplicity. Although this causes read(2) to read the same regions multiple times, the performance penalty should be small compared to the reduction of read(2) calls. Reviewed by: jilles Differential Revision:https://reviews.freebsd.org/D23747 Modified: stable/11/bin/sh/miscbltin.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/bin/sh/miscbltin.c Directory Properties: stable/12/ (props changed) Modified: stable/11/bin/sh/miscbltin.c == --- stable/11/bin/sh/miscbltin.cWed Mar 18 18:02:33 2020 (r359076) +++ stable/11/bin/sh/miscbltin.cWed Mar 18 18:10:44 2020 (r359077) @@ -64,10 +64,79 @@ __FBSDID("$FreeBSD$"); #undef eflag +#defineREAD_BUFLEN 1024 +struct fdctx { + int fd; + size_t off;/* offset in buf */ + size_t buflen; + char*ep;/* tail pointer */ + charbuf[READ_BUFLEN]; +}; + +static void fdctx_init(int, struct fdctx *); +static void fdctx_destroy(struct fdctx *); +static ssize_t fdgetc(struct fdctx *, char *); int readcmd(int, char **); int umaskcmd(int, char **); int ulimitcmd(int, char **); +static void +fdctx_init(int fd, struct fdctx *fdc) +{ + off_t cur; + + /* Check if fd is seekable. */ + cur = lseek(fd, 0, SEEK_CUR); + *fdc = (struct fdctx){ + .fd = fd, + .buflen = (cur != -1) ? READ_BUFLEN : 1, + .ep = >buf[0], /* No data */ + }; +} + +static ssize_t +fdgetc(struct fdctx *fdc, char *c) +{ + ssize_t nread; + + if (>buf[fdc->off] == fdc->ep) { + nread = read(fdc->fd, fdc->buf, fdc->buflen); + if (nread > 0) { + fdc->off = 0; + fdc->ep = fdc->buf + nread; + } else + return (nread); + } + *c = fdc->buf[fdc->off++]; + + return (1); +} + +static void +fdctx_destroy(struct fdctx *fdc) +{ + off_t residue; + + if (fdc->buflen > 1) { + /* +* Reposition the file offset. Here is the layout of buf: +* +* | off +* v +* |*|---| +* buf ep buf+buflen +* |<- residue ->| +* +* off: current character +* ep: offset just after read(2) +* residue: length for reposition +*/ + residue = (fdc->ep - fdc->buf) - fdc->off; + if (residue > 0) + (void) lseek(fdc->fd, -residue, SEEK_CUR); + } +} + /* * The read builtin. The -r option causes backslashes to be treated like * ordinary characters. @@ -106,6 +175,7 @@ readcmd(int argc __unused, char **argv __unused) fd_set ifds; ssize_t nread; int sig; + struct fdctx fdctx; rflag = 0; prompt = NULL; @@ -171,8 +241,9 @@ readcmd(int argc __unused, char **argv __unused) backslash = 0; STARTSTACKSTR(p); lastnonifs = lastnonifsws = -1; + fdctx_init(STDIN_FILENO, ); for (;;) { - nread = read(STDIN_FILENO, , 1); + nread = fdgetc(, ); if (nread == -1) { if (errno == EINTR) { sig = pendingsig; @@ -258,6 +329,7 @@ readcmd(int argc __unused, char **argv __unused) STARTSTACKSTR(p); lastnonifs = lastnonifsws = -1; } + fdctx_destroy(); STACKSTRNUL(p); /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359076 - in stable: 11/share/man/man4 11/sys/dev/acpica 11/usr.sbin/acpi/acpiconf 12/share/man/man4 12/sys/dev/acpica 12/usr.sbin/acpi/acpiconf
expressed as power or current depending on the value of .Va units . -.It gra2 +.It Va gra2 Battery capacity granularity between .Va warning and @@ -160,15 +226,41 @@ and This is expressed as power or current depending on the value of .Va units . -.It model +.It Va model Model number of the battery as a string. -.It serial +.It Va serial Serial number of the battery as a string. -.It type +.It Va type Type identifier of the battery as a string. -.It oeminfo +.It Va oeminfo OEM-specific information of the battery as a string. +.It Va scap +.Pq rev 1 or newer +Battery swapping capability encoded in the following: +.Bl -tag -width indent +.It ACPI_BIX_SCAP_NO Pq 0x +Non-swappable +.It ACPI_BIX_SCAP_COLD Pq 0x0001 +Cold-swappable +.It ACPI_BIX_SCAP_HOT Pq 0x0010 +Hot-swappable .El +.El +.It Dv ACPIIO_BATT_GET_BIF Vt struct acpi_bif +.Pq deprecated +Returns battery information given by the ACPI +.Li _BIF Pq Battery Information +object, +which was deprecated in ACPI 4.0 specification. +The data structure is a subset of +.Vt struct acpi_bix . +.Pp +Note that this ioctl will built a +.Vt struct acpi_bif +structure based on the obtained information +even if this object is not available and a +.Li _BIX +object is found. .It ACPIIO_BATT_GET_BST Vt struct acpi_bst Returns battery information given by the ACPI .Li _BST Pq Battery Status @@ -180,25 +272,25 @@ this ioctl will build a structure based on the obtained information and return it. .Bl -tag -width indent -.It state +.It Va state Battery state. The value is encoded in the same way as .Va state of .Vt struct acpi_battinfo . -.It rate +.It Va rate Battery present rate of charging or discharging. The unit of the value depends on .Va unit of .Vt struct acpi_bif . -.It cap +.It Va cap Battery remaining capacity. The unit of this value depends on .Va unit of .Vt struct acpi_bif . -.It volt +.It Va volt Battery present voltage. .El .El @@ -212,6 +304,8 @@ connected batteries: .It Va hw.acpi.battery.info_expire Information cache expiration time in seconds. The battery information obtained by +.Li _BIX +or .Li _BIF object will be stored and reused for successive read access to this MIB within the specified period. @@ -276,8 +370,11 @@ Battery information was changed. .An Munehiro Matsuda , .An Takanori Watanabe Aq Mt takaw...@freebsd.org , .An Mitsuru IWASAKI Aq Mt iwas...@freebsd.org , +.An Hans Petter Selasky Aq Mt hsela...@freebsd.org , and -.An Hans Petter Selasky Aq Mt hsela...@freebsd.org . +.An Hiroki Sato Aq Mt h...@freebsd.org . .Pp This manual page was written by -.An Takanori Watanabe Aq Mt takaw...@freebsd.org . +.An Takanori Watanabe Aq Mt takaw...@freebsd.org +and +.An Hiroki Sato Aq Mt h...@freebsd.org . Modified: stable/12/sys/dev/acpica/acpi_battery.c == --- stable/12/sys/dev/acpica/acpi_battery.c Wed Mar 18 17:42:18 2020 (r359075) +++ stable/12/sys/dev/acpica/acpi_battery.c Wed Mar 18 18:02:33 2020 (r359076) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); /* Default seconds before re-sampling the battery state. */ #defineACPI_BATTERY_INFO_EXPIRE5 -static int acpi_batteries_initted; +static int acpi_batteries_initialized; static int acpi_battery_info_expire = ACPI_BATTERY_INFO_EXPIRE; static struct acpi_battinfo acpi_battery_battinfo; static struct sysctl_ctx_list acpi_battery_sysctl_ctx; @@ -65,11 +65,10 @@ acpi_battery_register(device_t dev) { int error; -error = 0; ACPI_SERIAL_BEGIN(battery); -if (!acpi_batteries_initted) - error = acpi_battery_init(); +error = acpi_battery_init(); ACPI_SERIAL_END(battery); + return (error); } @@ -107,11 +106,12 @@ acpi_battery_bst_valid(struct acpi_bst *bst) bst->cap != ACPI_BATT_UNKNOWN && bst->volt != ACPI_BATT_UNKNOWN); } -/* Check _BIF results for validity. */ +/* Check _BI[FX] results for validity. */ int -acpi_battery_bif_valid(struct acpi_bif *bif) +acpi_battery_bix_valid(struct acpi_bix *bix) { -return (bif->lfcap != 0); + +return (bix->lfcap != 0); } /* Get info about one or all batteries. */ @@ -123,7 +123,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba devclass_t batt_dc; device_t batt_dev; struct acpi_bst *bst; -struct acpi_bif *bif; +struct acpi_bix *bix; struct acpi_battinfo *bi; /* @@ -139,11 +139,11 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba /* * Allocate storage for all _BST data, their derived battinfo data, - * and the current battery's _BIF data. + * and the current battery's _BIX (or _BIF) data. */ bst = malloc(devcount * sizeof(*bst), M_TEMP, M_WAITOK | M_ZERO); bi = malloc(devcount * sizeof(*bi), M_TEMP, M_WAITOK | M_ZERO); -bif = malloc(sizeof(*bif), M_TEMP, M_WAITOK | M_ZERO); +bix
svn commit: r359076 - in stable: 11/share/man/man4 11/sys/dev/acpica 11/usr.sbin/acpi/acpiconf 12/share/man/man4 12/sys/dev/acpica 12/usr.sbin/acpi/acpiconf
expressed as power or current depending on the value of .Va units . -.It gra2 +.It Va gra2 Battery capacity granularity between .Va warning and @@ -160,15 +226,41 @@ and This is expressed as power or current depending on the value of .Va units . -.It model +.It Va model Model number of the battery as a string. -.It serial +.It Va serial Serial number of the battery as a string. -.It type +.It Va type Type identifier of the battery as a string. -.It oeminfo +.It Va oeminfo OEM-specific information of the battery as a string. +.It Va scap +.Pq rev 1 or newer +Battery swapping capability encoded in the following: +.Bl -tag -width indent +.It ACPI_BIX_SCAP_NO Pq 0x +Non-swappable +.It ACPI_BIX_SCAP_COLD Pq 0x0001 +Cold-swappable +.It ACPI_BIX_SCAP_HOT Pq 0x0010 +Hot-swappable .El +.El +.It Dv ACPIIO_BATT_GET_BIF Vt struct acpi_bif +.Pq deprecated +Returns battery information given by the ACPI +.Li _BIF Pq Battery Information +object, +which was deprecated in ACPI 4.0 specification. +The data structure is a subset of +.Vt struct acpi_bix . +.Pp +Note that this ioctl will built a +.Vt struct acpi_bif +structure based on the obtained information +even if this object is not available and a +.Li _BIX +object is found. .It ACPIIO_BATT_GET_BST Vt struct acpi_bst Returns battery information given by the ACPI .Li _BST Pq Battery Status @@ -180,25 +272,25 @@ this ioctl will build a structure based on the obtained information and return it. .Bl -tag -width indent -.It state +.It Va state Battery state. The value is encoded in the same way as .Va state of .Vt struct acpi_battinfo . -.It rate +.It Va rate Battery present rate of charging or discharging. The unit of the value depends on .Va unit of .Vt struct acpi_bif . -.It cap +.It Va cap Battery remaining capacity. The unit of this value depends on .Va unit of .Vt struct acpi_bif . -.It volt +.It Va volt Battery present voltage. .El .El @@ -212,6 +304,8 @@ connected batteries: .It Va hw.acpi.battery.info_expire Information cache expiration time in seconds. The battery information obtained by +.Li _BIX +or .Li _BIF object will be stored and reused for successive read access to this MIB within the specified period. @@ -276,8 +370,11 @@ Battery information was changed. .An Munehiro Matsuda , .An Takanori Watanabe Aq Mt takaw...@freebsd.org , .An Mitsuru IWASAKI Aq Mt iwas...@freebsd.org , +.An Hans Petter Selasky Aq Mt hsela...@freebsd.org , and -.An Hans Petter Selasky Aq Mt hsela...@freebsd.org . +.An Hiroki Sato Aq Mt h...@freebsd.org . .Pp This manual page was written by -.An Takanori Watanabe Aq Mt takaw...@freebsd.org . +.An Takanori Watanabe Aq Mt takaw...@freebsd.org +and +.An Hiroki Sato Aq Mt h...@freebsd.org . Modified: stable/11/sys/dev/acpica/acpi_battery.c == --- stable/11/sys/dev/acpica/acpi_battery.c Wed Mar 18 17:42:18 2020 (r359075) +++ stable/11/sys/dev/acpica/acpi_battery.c Wed Mar 18 18:02:33 2020 (r359076) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); /* Default seconds before re-sampling the battery state. */ #defineACPI_BATTERY_INFO_EXPIRE5 -static int acpi_batteries_initted; +static int acpi_batteries_initialized; static int acpi_battery_info_expire = ACPI_BATTERY_INFO_EXPIRE; static struct acpi_battinfo acpi_battery_battinfo; static struct sysctl_ctx_list acpi_battery_sysctl_ctx; @@ -65,11 +65,10 @@ acpi_battery_register(device_t dev) { int error; -error = 0; ACPI_SERIAL_BEGIN(battery); -if (!acpi_batteries_initted) - error = acpi_battery_init(); +error = acpi_battery_init(); ACPI_SERIAL_END(battery); + return (error); } @@ -107,11 +106,12 @@ acpi_battery_bst_valid(struct acpi_bst *bst) bst->cap != ACPI_BATT_UNKNOWN && bst->volt != ACPI_BATT_UNKNOWN); } -/* Check _BIF results for validity. */ +/* Check _BI[FX] results for validity. */ int -acpi_battery_bif_valid(struct acpi_bif *bif) +acpi_battery_bix_valid(struct acpi_bix *bix) { -return (bif->lfcap != 0); + +return (bix->lfcap != 0); } /* Get info about one or all batteries. */ @@ -123,7 +123,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba devclass_t batt_dc; device_t batt_dev; struct acpi_bst *bst; -struct acpi_bif *bif; +struct acpi_bix *bix; struct acpi_battinfo *bi; /* @@ -139,11 +139,11 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba /* * Allocate storage for all _BST data, their derived battinfo data, - * and the current battery's _BIF data. + * and the current battery's _BIX (or _BIF) data. */ bst = malloc(devcount * sizeof(*bst), M_TEMP, M_WAITOK | M_ZERO); bi = malloc(devcount * sizeof(*bi), M_TEMP, M_WAITOK | M_ZERO); -bif = malloc(sizeof(*bif), M_TEMP, M_WAITOK | M_ZERO); +bix
svn commit: r359075 - in stable: 11/share/vt/keymaps 12/share/vt/keymaps
Author: hrs Date: Wed Mar 18 17:42:18 2020 New Revision: 359075 URL: https://svnweb.freebsd.org/changeset/base/359075 Log: MFC of r358061: Use 0x5c for the scan code 0x7d. Japanese keyboards traditionally use 0x5c for both Japanese yen sign key and backslash key. While a Japanese yen sign is depicted on the keytop, most of Japanese expect that the scan code 0x7d gives a backslash (0x5c), not a Japanese yen sign (0xa5). This is because JIS X 0201 encoding (aka ISO/IEC 646-JA, an extended version of ASCII which is very popular in Japan) has Japanese yen sign at 0x5c and no backslash. On the other hand, ISO/IEC 8859-1 has Japanese yen sign at 0xa5. This difference has caused a confusion after Unicode became popular since ISO/IEC 10646 adopted 8859-1 for the plane 0. Modified: stable/12/share/vt/keymaps/jp.capsctrl.kbd stable/12/share/vt/keymaps/jp.kbd Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/share/vt/keymaps/jp.capsctrl.kbd stable/11/share/vt/keymaps/jp.kbd Directory Properties: stable/11/ (props changed) Modified: stable/12/share/vt/keymaps/jp.capsctrl.kbd == --- stable/12/share/vt/keymaps/jp.capsctrl.kbd Wed Mar 18 17:35:35 2020 (r359074) +++ stable/12/share/vt/keymaps/jp.capsctrl.kbd Wed Mar 18 17:42:18 2020 (r359075) @@ -117,4 +117,4 @@ 115 '\''_'fs us '\''_'fs us O 121 ' '' 'nul' '' '' 'susp ' ' O 123 ' '' 'nul' '' '' 'susp ' ' O - 125 0xa5 '|'fs us 0xa5 '|'fs us O + 125 '\''|'fs us 0xa5 '|'fs us O Modified: stable/12/share/vt/keymaps/jp.kbd == --- stable/12/share/vt/keymaps/jp.kbd Wed Mar 18 17:35:35 2020 (r359074) +++ stable/12/share/vt/keymaps/jp.kbd Wed Mar 18 17:42:18 2020 (r359075) @@ -115,4 +115,4 @@ 115 '\''_'fs us '\''_'fs us O 121 ' '' 'nul' '' '' 'susp ' ' O 123 ' '' 'nul' '' '' 'susp ' ' O - 125 0xa5 '|'fs us 0xa5 '|'fs us O + 125 '\''|'fs us 0xa5 '|'fs us O ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359075 - in stable: 11/share/vt/keymaps 12/share/vt/keymaps
Author: hrs Date: Wed Mar 18 17:42:18 2020 New Revision: 359075 URL: https://svnweb.freebsd.org/changeset/base/359075 Log: MFC of r358061: Use 0x5c for the scan code 0x7d. Japanese keyboards traditionally use 0x5c for both Japanese yen sign key and backslash key. While a Japanese yen sign is depicted on the keytop, most of Japanese expect that the scan code 0x7d gives a backslash (0x5c), not a Japanese yen sign (0xa5). This is because JIS X 0201 encoding (aka ISO/IEC 646-JA, an extended version of ASCII which is very popular in Japan) has Japanese yen sign at 0x5c and no backslash. On the other hand, ISO/IEC 8859-1 has Japanese yen sign at 0xa5. This difference has caused a confusion after Unicode became popular since ISO/IEC 10646 adopted 8859-1 for the plane 0. Modified: stable/11/share/vt/keymaps/jp.capsctrl.kbd stable/11/share/vt/keymaps/jp.kbd Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/share/vt/keymaps/jp.capsctrl.kbd stable/12/share/vt/keymaps/jp.kbd Directory Properties: stable/12/ (props changed) Modified: stable/11/share/vt/keymaps/jp.capsctrl.kbd == --- stable/11/share/vt/keymaps/jp.capsctrl.kbd Wed Mar 18 17:35:35 2020 (r359074) +++ stable/11/share/vt/keymaps/jp.capsctrl.kbd Wed Mar 18 17:42:18 2020 (r359075) @@ -117,4 +117,4 @@ 115 '\''_'fs us '\''_'fs us O 121 ' '' 'nul' '' '' 'susp ' ' O 123 ' '' 'nul' '' '' 'susp ' ' O - 125 0xa5 '|'fs us 0xa5 '|'fs us O + 125 '\''|'fs us 0xa5 '|'fs us O Modified: stable/11/share/vt/keymaps/jp.kbd == --- stable/11/share/vt/keymaps/jp.kbd Wed Mar 18 17:35:35 2020 (r359074) +++ stable/11/share/vt/keymaps/jp.kbd Wed Mar 18 17:42:18 2020 (r359075) @@ -115,4 +115,4 @@ 115 '\''_'fs us '\''_'fs us O 121 ' '' 'nul' '' '' 'susp ' ' O 123 ' '' 'nul' '' '' 'susp ' ' O - 125 0xa5 '|'fs us 0xa5 '|'fs us O + 125 '\''|'fs us 0xa5 '|'fs us O ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359074 - in stable: 11/sys/netinet6 12/sys/netinet6
Author: hrs Date: Wed Mar 18 17:35:35 2020 New Revision: 359074 URL: https://svnweb.freebsd.org/changeset/base/359074 Log: MFC from r347887: Fix hostname to be returned in an ICMPv6 NI Reply message defined in RFC 4620, ICMPv6 Node Information Queries. A vnet jail with an IPv6 address sent a hostname of the host environment, not the jail, even if another hostname was set to the jail. This change can be tested by the following commands: # ifconfig epair0 create # jail -c -n j1 vnet host.hostname=vnetjail path=/ persist # ifconfig epair0b vnet j1 # ifconfig epair0a inet6 -ifdisabled auto_linklocal up # jexec j1 ifconfig epair0b inet6 -ifdisabled auto_linklocal up # ping6 -w ff02::1%epair0a Differential Revision:https://reviews.freebsd.org/D20207 Modified: stable/11/sys/netinet6/icmp6.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/netinet6/icmp6.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/netinet6/icmp6.c == --- stable/11/sys/netinet6/icmp6.c Wed Mar 18 17:01:03 2020 (r359073) +++ stable/11/sys/netinet6/icmp6.c Wed Mar 18 17:35:35 2020 (r359074) @@ -138,7 +138,7 @@ static int icmp6_rip6_input(struct mbuf **, int); static int icmp6_ratelimit(const struct in6_addr *, const int, const int); static const char *icmp6_redirect_diag(struct in6_addr *, struct in6_addr *, struct in6_addr *); -static struct mbuf *ni6_input(struct mbuf *, int); +static struct mbuf *ni6_input(struct mbuf *, int, struct prison *); static struct mbuf *ni6_nametodns(const char *, int, int); static int ni6_dnsmatch(const char *, int, const char *, int); static int ni6_addrs(struct icmp6_nodeinfo *, struct mbuf *, @@ -625,6 +625,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) case ICMP6_WRUREQUEST: /* ICMP6_FQDN_QUERY */ { enum { WRU, FQDN } mode; + struct prison *pr; if (!V_icmp6_nodeinfo) break; @@ -636,6 +637,14 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) else goto badlen; + pr = NULL; + sx_slock(_lock); + TAILQ_FOREACH(pr, , pr_list) + if (pr->pr_vnet == ifp->if_vnet) + break; + sx_sunlock(_lock); + if (pr == NULL) + pr = curthread->td_ucred->cr_prison; if (mode == FQDN) { #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_nodeinfo), @@ -643,11 +652,10 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) #endif n = m_copy(m, 0, M_COPYALL); if (n) - n = ni6_input(n, off); + n = ni6_input(n, off, pr); /* XXX meaningless if n == NULL */ noff = sizeof(struct ip6_hdr); } else { - struct prison *pr; u_char *p; int maxhlen, hlen; @@ -681,13 +689,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) n = NULL; break; } - maxhlen = M_TRAILINGSPACE(n) - - (sizeof(*nip6) + sizeof(*nicmp6) + 4); - pr = curthread->td_ucred->cr_prison; - mtx_lock(>pr_mtx); - hlen = strlen(pr->pr_hostname); - if (maxhlen > hlen) - maxhlen = hlen; /* * Copy IPv6 and ICMPv6 only. */ @@ -697,6 +698,13 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) bcopy(icmp6, nicmp6, sizeof(struct icmp6_hdr)); p = (u_char *)(nicmp6 + 1); bzero(p, 4); + + maxhlen = M_TRAILINGSPACE(n) - + (sizeof(*nip6) + sizeof(*nicmp6) + 4); + mtx_lock(>pr_mtx); + hlen = strlen(pr->pr_hostname); + if (maxhlen > hlen) + maxhlen = hlen; /* meaningless TTL */ bcopy(pr->pr_hostname, p + 4, maxhlen); mtx_unlock(>pr_mtx); @@ -1166,11 +1174,10 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int va * with hostname changes by sethostname(3) */ static struct mbuf * -ni6_input(struct mbuf *m, int off) +ni6_input(struct mbuf *m, int off, struct prison *pr) { struct icmp6_nodeinfo *ni6, *nni6; struct
svn commit: r359074 - in stable: 11/sys/netinet6 12/sys/netinet6
Author: hrs Date: Wed Mar 18 17:35:35 2020 New Revision: 359074 URL: https://svnweb.freebsd.org/changeset/base/359074 Log: MFC from r347887: Fix hostname to be returned in an ICMPv6 NI Reply message defined in RFC 4620, ICMPv6 Node Information Queries. A vnet jail with an IPv6 address sent a hostname of the host environment, not the jail, even if another hostname was set to the jail. This change can be tested by the following commands: # ifconfig epair0 create # jail -c -n j1 vnet host.hostname=vnetjail path=/ persist # ifconfig epair0b vnet j1 # ifconfig epair0a inet6 -ifdisabled auto_linklocal up # jexec j1 ifconfig epair0b inet6 -ifdisabled auto_linklocal up # ping6 -w ff02::1%epair0a Differential Revision:https://reviews.freebsd.org/D20207 Modified: stable/12/sys/netinet6/icmp6.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/netinet6/icmp6.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/netinet6/icmp6.c == --- stable/12/sys/netinet6/icmp6.c Wed Mar 18 17:01:03 2020 (r359073) +++ stable/12/sys/netinet6/icmp6.c Wed Mar 18 17:35:35 2020 (r359074) @@ -140,7 +140,7 @@ static int icmp6_rip6_input(struct mbuf **, int); static int icmp6_ratelimit(const struct in6_addr *, const int, const int); static const char *icmp6_redirect_diag(struct in6_addr *, struct in6_addr *, struct in6_addr *); -static struct mbuf *ni6_input(struct mbuf *, int); +static struct mbuf *ni6_input(struct mbuf *, int, struct prison *); static struct mbuf *ni6_nametodns(const char *, int, int); static int ni6_dnsmatch(const char *, int, const char *, int); static int ni6_addrs(struct icmp6_nodeinfo *, struct mbuf *, @@ -620,6 +620,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) case ICMP6_WRUREQUEST: /* ICMP6_FQDN_QUERY */ { enum { WRU, FQDN } mode; + struct prison *pr; if (!V_icmp6_nodeinfo) break; @@ -631,6 +632,14 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) else goto badlen; + pr = NULL; + sx_slock(_lock); + TAILQ_FOREACH(pr, , pr_list) + if (pr->pr_vnet == ifp->if_vnet) + break; + sx_sunlock(_lock); + if (pr == NULL) + pr = curthread->td_ucred->cr_prison; if (mode == FQDN) { if (m->m_len < off + sizeof(struct icmp6_nodeinfo)) { m = m_pullup(m, off + @@ -643,11 +652,10 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) } n = m_copym(m, 0, M_COPYALL, M_NOWAIT); if (n) - n = ni6_input(n, off); + n = ni6_input(n, off, pr); /* XXX meaningless if n == NULL */ noff = sizeof(struct ip6_hdr); } else { - struct prison *pr; u_char *p; int maxhlen, hlen; @@ -681,13 +689,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) n = NULL; break; } - maxhlen = M_TRAILINGSPACE(n) - - (sizeof(*nip6) + sizeof(*nicmp6) + 4); - pr = curthread->td_ucred->cr_prison; - mtx_lock(>pr_mtx); - hlen = strlen(pr->pr_hostname); - if (maxhlen > hlen) - maxhlen = hlen; /* * Copy IPv6 and ICMPv6 only. */ @@ -697,6 +698,13 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) bcopy(icmp6, nicmp6, sizeof(struct icmp6_hdr)); p = (u_char *)(nicmp6 + 1); bzero(p, 4); + + maxhlen = M_TRAILINGSPACE(n) - + (sizeof(*nip6) + sizeof(*nicmp6) + 4); + mtx_lock(>pr_mtx); + hlen = strlen(pr->pr_hostname); + if (maxhlen > hlen) + maxhlen = hlen; /* meaningless TTL */ bcopy(pr->pr_hostname, p + 4, maxhlen); mtx_unlock(>pr_mtx); @@ -1159,11 +1167,10 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int va * with hostname changes by sethostname(3) */ static struct mbuf * -ni6_input(struct mbuf *m, int off) +ni6_input(struct mbuf *m, int off, struct prison *pr) {
svn commit: r359068 - in head: . libexec/rc/rc.d
Author: hrs Date: Wed Mar 18 08:17:24 2020 New Revision: 359068 URL: https://svnweb.freebsd.org/changeset/base/359068 Log: Remove /etc/host.conf, which was automatically generated from nsswitch.conf for backward compatibility. This file was used over 19 years ago, before introducing nsdispatch() in the name-service lookup APIs. MFC after:3 days Deleted: head/libexec/rc/rc.d/nsswitch Modified: head/ObsoleteFiles.inc head/libexec/rc/rc.d/Makefile Modified: head/ObsoleteFiles.inc == --- head/ObsoleteFiles.inc Wed Mar 18 08:00:46 2020(r359067) +++ head/ObsoleteFiles.inc Wed Mar 18 08:17:24 2020(r359068) @@ -36,6 +36,10 @@ # xargs -n1 | sort | uniq -d; # done +# 20200318: host.conf was deprecated a long time ago. +OLD_FILES+=etc/host.conf +OLD_FILES+=etc/rc.d/nsswitch + # 20200310: new clang import which bumps version from 9.0.1 to 10.0.0. OLD_FILES+=usr/lib/clang/9.0.1/include/cuda_wrappers/algorithm OLD_FILES+=usr/lib/clang/9.0.1/include/cuda_wrappers/complex Modified: head/libexec/rc/rc.d/Makefile == --- head/libexec/rc/rc.d/Makefile Wed Mar 18 08:00:46 2020 (r359067) +++ head/libexec/rc/rc.d/Makefile Wed Mar 18 08:17:24 2020 (r359068) @@ -74,7 +74,6 @@ CONFS=DAEMON \ nfsuserd \ nisdomain \ ${_nscd} \ - nsswitch \ ntpdate \ ${_opensm} \ os-release \ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r359067 - head/share/examples/ipfw
Author: hrs Date: Wed Mar 18 08:00:46 2020 New Revision: 359067 URL: https://svnweb.freebsd.org/changeset/base/359067 Log: -F is GNU diff specific, not implemented in BSD diff. Reported by: ko...@ryuhoku.jp MFC after:3 days Modified: head/share/examples/ipfw/change_rules.sh Modified: head/share/examples/ipfw/change_rules.sh == --- head/share/examples/ipfw/change_rules.shWed Mar 18 05:28:36 2020 (r359066) +++ head/share/examples/ipfw/change_rules.shWed Mar 18 08:00:46 2020 (r359067) @@ -149,7 +149,7 @@ cat
Re: svn commit: r359046 - head/share/mk
Brooks Davis wrote in <202003171817.02hihwdy035...@repo.freebsd.org>: br> Author: brooks br> Date: Tue Mar 17 18:17:32 2020 br> New Revision: 359046 br> URL: https://svnweb.freebsd.org/changeset/base/359046 br> br> Log: br> Support SUBDIR.${MK_FOO}.${MK_BAR} expresssions. br> br> This allows simplification of Makefiles where some SUBDIR entries depend br> on two things (e.g. something that depends on C++ and some other knob). Just my two cents, but SUBDIR.${MK_FOO:M${MK_BAR}:M${MK_BAZ}}= dir should do the trick. I am not sure how many variables we need to support in practice, adding ".yes.yes..." in bsd.subdir.mk looks less flexible to me. br> Discussed with: imp, jhb br> Obtained from:CheriBSD br> MFC after:3 days br> Sponsored by: DARPA br> br> Modified: br> head/share/mk/bsd.subdir.mk br> br> Modified: head/share/mk/bsd.subdir.mk br> == br> --- head/share/mk/bsd.subdir.mk Tue Mar 17 17:28:12 2020 (r359045) br> +++ head/share/mk/bsd.subdir.mk Tue Mar 17 18:17:32 2020 (r359046) br> @@ -16,8 +16,8 @@ br> # br> # SUBDIR A list of subdirectories that should be built as well. br> # Each of the targets will execute the same target in the br> -# subdirectories. SUBDIR.yes is automatically appended br> -# to this list. br> +# subdirectories. SUBDIR.yes and SUBDIR.yes.yes are br> +# automatically appended to this list. br> # br> # +++ targets +++ br> # br> @@ -122,8 +122,8 @@ install:beforeinstall realinstall afterinstall br> # SUBDIR recursing may be disabled for MK_DIRDEPS_BUILD br> .if !target(_SUBDIR) br> br> -.if defined(SUBDIR) || defined(SUBDIR.yes) br> -SUBDIR:=${SUBDIR} ${SUBDIR.yes} br> +.if defined(SUBDIR) || defined(SUBDIR.yes) || defined(SUBDIR.yes.yes) br> +SUBDIR:=${SUBDIR} ${SUBDIR.yes} ${SUBDIR.yes.yes} br> SUBDIR:=${SUBDIR:u} br> .endif br> br> pgpAVwhKvtlsX.pgp Description: PGP signature
svn commit: r358730 - in head: sys/netinet usr.bin/netstat
Author: hrs Date: Sat Mar 7 08:41:10 2020 New Revision: 358730 URL: https://svnweb.freebsd.org/changeset/base/358730 Log: Fix an issue of net.inet.igmp.stats handler. The header of (struct igmpstat) could be cleared by sysctl(3). This can be reproduced by "netstat -s -z -p igmp". PR: 244584 MFC after:1 week Modified: head/sys/netinet/igmp.c head/usr.bin/netstat/inet.c Modified: head/sys/netinet/igmp.c == --- head/sys/netinet/igmp.c Sat Mar 7 03:58:58 2020(r358729) +++ head/sys/netinet/igmp.c Sat Mar 7 08:41:10 2020(r358730) @@ -145,6 +145,7 @@ static void igmp_v3_suppress_group_record(struct in_mu static int sysctl_igmp_default_version(SYSCTL_HANDLER_ARGS); static int sysctl_igmp_gsr(SYSCTL_HANDLER_ARGS); static int sysctl_igmp_ifinfo(SYSCTL_HANDLER_ARGS); +static int sysctl_igmp_stat(SYSCTL_HANDLER_ARGS); static const struct netisr_handler igmp_nh = { .nh_name = "igmp", @@ -260,8 +261,9 @@ VNET_DEFINE_STATIC(int, igmp_default_version) = IGMP_V /* * Virtualized sysctls. */ -SYSCTL_STRUCT(_net_inet_igmp, IGMPCTL_STATS, stats, CTLFLAG_VNET | CTLFLAG_RW, -_NAME(igmpstat), igmpstat, ""); +SYSCTL_PROC(_net_inet_igmp, IGMPCTL_STATS, stats, +CTLFLAG_VNET | CTLTYPE_STRUCT | CTLFLAG_RW | CTLFLAG_MPSAFE, +_NAME(igmpstat), 0, sysctl_igmp_stat, "S,igmpstat", ""); SYSCTL_INT(_net_inet_igmp, OID_AUTO, recvifkludge, CTLFLAG_VNET | CTLFLAG_RW, _NAME(igmp_recvifkludge), 0, "Rewrite IGMPv1/v2 reports from 0.0.0.0 to contain subnet address"); @@ -333,6 +335,59 @@ igmp_restore_context(struct mbuf *m) #endif #endif return (m->m_pkthdr.flowid); +} + +/* + * IGMP statistics. + */ +static int +sysctl_igmp_stat(SYSCTL_HANDLER_ARGS) +{ + struct igmpstat igps0; + int error; + char *p; + + error = sysctl_wire_old_buffer(req, sizeof(V_igmpstat)); + if (error) + return (error); + + if (req->oldptr != NULL) { + if (req->oldlen < sizeof(V_igmpstat)) + error = ENOMEM; + else + error = SYSCTL_OUT(req, _igmpstat, + sizeof(V_igmpstat)); + } else + req->validlen = sizeof(V_igmpstat); + if (error) + goto out; + if (req->newptr != NULL) { + if (req->newlen < sizeof(V_igmpstat)) + error = ENOMEM; + else + error = SYSCTL_IN(req, , + sizeof(igps0)); + if (error) + goto out; + /* +* igps0 must be "all zero". +*/ + p = (char *) + while (*p == '\0' && p < (char *) + sizeof(igps0)) + p++; + if (p != (char *) + sizeof(igps0)) { + error = EINVAL; + goto out; + } + /* +* Avoid overwrite of the version and length field. +*/ + igps0.igps_version = V_igmpstat.igps_version; + igps0.igps_len = V_igmpstat.igps_len; + bcopy(, _igmpstat, sizeof(V_igmpstat)); + } +out: + return (error); } /* Modified: head/usr.bin/netstat/inet.c == --- head/usr.bin/netstat/inet.c Sat Mar 7 03:58:58 2020(r358729) +++ head/usr.bin/netstat/inet.c Sat Mar 7 08:41:10 2020(r358730) @@ -1222,10 +1222,26 @@ void igmp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) { struct igmpstat igmpstat; + int error, zflag0; if (fetch_stats("net.inet.igmp.stats", 0, , sizeof(igmpstat), kread) != 0) return; + /* +* Reread net.inet.igmp.stats when zflag == 1. +* This is because this MIB contains version number and +* length of the structure which are not set when clearing +* the counters. +*/ + zflag0 = zflag; + if (zflag) { + zflag = 0; + error = fetch_stats("net.inet.igmp.stats", 0, , + sizeof(igmpstat), kread); + zflag = zflag0; + if (error) + return; + } if (igmpstat.igps_version != IGPS_VERSION_3) { xo_warnx("%s: version mismatch (%d != %d)", __func__, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r358405 - head/contrib/tnftp/src
Author: hrs Date: Thu Feb 27 19:49:59 2020 New Revision: 358405 URL: https://svnweb.freebsd.org/changeset/base/358405 Log: Fix poor performance of ftp(1) due to small SO_SNDBUF and SO_RCVBUF. ftp(1) from vendor/tnftp always tried the following for every TCP connection: 1. Get the current buffer length of SO_SNDBUF and SO_RCVBUF by getsockopt(2). 2. Invoke setsockopt(2) to set them to the same values after checking if they are in a range between 8 KiB to 8 MiB. This behavior broke dynamic buffer sizing enabled by default (net.inet.tcp.{recv,send}buf_auto sysctls) and led to a very poor transfer rate. The fetch(1) utility does not have this problem. This change prevents SO_SNDBUF and SO_RCVBUF from configuring when the buffer auto-sizing is enabled unless the buffer sizes are explicitly specified. PR: 240827 Spotted by: Yuichiro NAITO MFC after:3 days Differential Revision:https://reviews.freebsd.org/D23732 Modified: head/contrib/tnftp/src/cmds.c head/contrib/tnftp/src/ftp_var.h head/contrib/tnftp/src/main.c head/contrib/tnftp/src/util.c Modified: head/contrib/tnftp/src/cmds.c == --- head/contrib/tnftp/src/cmds.c Thu Feb 27 19:40:29 2020 (r358404) +++ head/contrib/tnftp/src/cmds.c Thu Feb 27 19:49:59 2020 (r358405) @@ -2653,10 +2653,14 @@ setxferbuf(int argc, char *argv[]) goto usage; } - if (dir & RATE_PUT) + if (dir & RATE_PUT) { sndbuf_size = size; - if (dir & RATE_GET) + auto_sndbuf = 0; + } + if (dir & RATE_GET) { rcvbuf_size = size; + auto_rcvbuf = 0; + } fprintf(ttyout, "Socket buffer sizes: send %d, receive %d.\n", sndbuf_size, rcvbuf_size); code = 0; Modified: head/contrib/tnftp/src/ftp_var.h == --- head/contrib/tnftp/src/ftp_var.hThu Feb 27 19:40:29 2020 (r358404) +++ head/contrib/tnftp/src/ftp_var.hThu Feb 27 19:49:59 2020 (r358405) @@ -298,6 +298,8 @@ GLOBAL int options;/* used during socket creation */ GLOBAL int sndbuf_size;/* socket send buffer size */ GLOBAL int rcvbuf_size;/* socket receive buffer size */ +GLOBAL int auto_sndbuf;/* flag: if != 0 then use auto sndbuf size */ +GLOBAL int auto_rcvbuf;/* flag: if != 0 then use auto rcvbuf size */ GLOBAL int macnum; /* number of defined macros */ GLOBAL struct macel macros[16]; Modified: head/contrib/tnftp/src/main.c == --- head/contrib/tnftp/src/main.c Thu Feb 27 19:40:29 2020 (r358404) +++ head/contrib/tnftp/src/main.c Thu Feb 27 19:49:59 2020 (r358405) @@ -127,6 +127,9 @@ __RCSID(" NetBSD: main.c,v 1.117 2009/07/13 19:05:41 r #include #endif /* tnftp */ +#ifdef __FreeBSD__ +#include +#endif #defineGLOBAL /* force GLOBAL decls in ftp_var.h to be declared */ #include "ftp_var.h" @@ -509,6 +512,13 @@ main(int volatile argc, char **volatile argv) (void)xsignal(SIGUSR1, crankrate); (void)xsignal(SIGUSR2, crankrate); (void)xsignal(SIGWINCH, setttywidth); + + auto_rcvbuf = ((sysctlbyname("net.inet.tcp.recvbuf_auto", + _rcvbuf, &(size_t []){[0] = sizeof(int)}[0], NULL, 0) == 0) && + auto_rcvbuf == 1); + auto_sndbuf = ((sysctlbyname("net.inet.tcp.sendbuf_auto", + _sndbuf, &(size_t []){[0] = sizeof(int)}[0], NULL, 0) == 0) && + auto_sndbuf == 1); if (argc > 0) { if (isupload) { Modified: head/contrib/tnftp/src/util.c == --- head/contrib/tnftp/src/util.c Thu Feb 27 19:40:29 2020 (r358404) +++ head/contrib/tnftp/src/util.c Thu Feb 27 19:49:59 2020 (r358405) @@ -1087,13 +1087,27 @@ setupsockbufsize(int sock) sndbuf_size); } +#ifdef __FreeBSD__ + DPRINTF("auto_rcvbuf = %d\n", auto_rcvbuf); + if (auto_sndbuf == 0) { +#endif if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, (void *)_size, sizeof(sndbuf_size)) == -1) warn("Unable to set sndbuf size %d", sndbuf_size); +#ifdef __FreeBSD__ + } +#endif +#ifdef __FreeBSD__ + DPRINTF("auto_sndbuf = %d\n", auto_sndbuf); + if (auto_rcvbuf == 0) { +#endif if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, (void *)_size, sizeof(rcvbuf_size)) == -1) warn("Unable to set rcvbuf size %d", rcvbuf_size); +#ifdef __FreeBSD__ + } +#endif } /* ___ svn-src-all@freebsd.org mailing list
svn commit: r358404 - head/contrib/sendmail/src
Author: hrs Date: Thu Feb 27 19:40:29 2020 New Revision: 358404 URL: https://svnweb.freebsd.org/changeset/base/358404 Log: Fix broken STARTTLS when SharedMemoryKey is enabled. OpenSSL 1.1 API patch for sendmail had a bug which prevented sm_RSA_generate_key() function from working. This function is used to generate a temporary RSA key for a shared memory region used for TLS processing. Note that 12.0 and 12.1-RELEASE include this bug. This affects only if SM_CONF_SHM compile-time option (enabled by default) and SharedMemoryKey run-time option (not enabled by default) in a .cf file are specified. The latter corresponds to confSHARED_MEMORY_KEY in a .mc file. PR: 242861 MFC after:3 days Differential Revision:https://reviews.freebsd.org/D23734 Modified: head/contrib/sendmail/src/tls.c Modified: head/contrib/sendmail/src/tls.c == --- head/contrib/sendmail/src/tls.c Thu Feb 27 19:40:20 2020 (r358403) +++ head/contrib/sendmail/src/tls.c Thu Feb 27 19:40:29 2020 (r358404) @@ -745,18 +745,15 @@ sm_RSA_generate_key(num, e) { RSA *rsa = NULL; BIGNUM *bn_rsa_r4; - int rc; bn_rsa_r4 = BN_new(); -rc = BN_set_word(bn_rsa_r4, RSA_F4); - if ((bn_rsa_r4 != NULL) && BN_set_word(bn_rsa_r4, RSA_F4) && (rsa = RSA_new()) != NULL) + if ((bn_rsa_r4 != NULL) && BN_set_word(bn_rsa_r4, e) && (rsa = RSA_new()) != NULL) { - if (!RSA_generate_key_ex(rsa, RSA_KEYLENGTH, bn_rsa_r4, NULL)) + if (!RSA_generate_key_ex(rsa, num, bn_rsa_r4, NULL)) { RSA_free(rsa); rsa = NULL; } - return NULL; } BN_free(bn_rsa_r4); return rsa; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r358402 - head/sys/dev/rtwn/pci
Author: hrs Date: Thu Feb 27 19:35:17 2020 New Revision: 358402 URL: https://svnweb.freebsd.org/changeset/base/358402 Log: Add MODULE_PNP_INFO() to autoload the rtwn_pci(4) kernel module. Reviewed by: imp MFC after:3 days Differential Revision:https://reviews.freebsd.org/D23807 Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.c head/sys/dev/rtwn/pci/rtwn_pci_attach.h Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.c == --- head/sys/dev/rtwn/pci/rtwn_pci_attach.c Thu Feb 27 19:07:10 2020 (r358401) +++ head/sys/dev/rtwn/pci/rtwn_pci_attach.c Thu Feb 27 19:35:17 2020 (r358402) @@ -96,15 +96,16 @@ static void rtwn_pci_attach_methods(struct rtwn_softc static const struct rtwn_pci_ident * rtwn_pci_probe_sub(device_t dev) { - const struct rtwn_pci_ident *ident; - int vendor_id, device_id; + int i, vendor_id, device_id; vendor_id = pci_get_vendor(dev); device_id = pci_get_device(dev); - for (ident = rtwn_pci_ident_table; ident->name != NULL; ident++) - if (vendor_id == ident->vendor && device_id == ident->device) - return (ident); + for (i = 0; i < nitems(rtwn_pci_ident_table); i++) { + if (vendor_id == rtwn_pci_ident_table[i].vendor && + device_id == rtwn_pci_ident_table[i].device) + return (_pci_ident_table[i]); + } return (NULL); } @@ -788,6 +789,8 @@ static devclass_t rtwn_pci_devclass; DRIVER_MODULE(rtwn_pci, pci, rtwn_pci_driver, rtwn_pci_devclass, NULL, NULL); MODULE_VERSION(rtwn_pci, 1); +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, rtwn, rtwn_pci_ident_table, +nitems(rtwn_pci_ident_table)); MODULE_DEPEND(rtwn_pci, pci, 1, 1, 1); MODULE_DEPEND(rtwn_pci, wlan, 1, 1, 1); MODULE_DEPEND(rtwn_pci, rtwn, 2, 2, 2); Modified: head/sys/dev/rtwn/pci/rtwn_pci_attach.h == --- head/sys/dev/rtwn/pci/rtwn_pci_attach.h Thu Feb 27 19:07:10 2020 (r358401) +++ head/sys/dev/rtwn/pci/rtwn_pci_attach.h Thu Feb 27 19:35:17 2020 (r358402) @@ -36,7 +36,6 @@ static const struct rtwn_pci_ident rtwn_pci_ident_tabl { 0x10ec, 0x8176, "Realtek RTL8188CE", RTWN_CHIP_RTL8192CE }, { 0x10ec, 0x8179, "Realtek RTL8188EE", RTWN_CHIP_RTL8188EE }, { 0x10ec, 0x8178, "Realtek RTL8192CE", RTWN_CHIP_RTL8192CE }, - { 0, 0, NULL, RTWN_CHIP_MAX_PCI } }; typedef void (*chip_pci_attach)(struct rtwn_pci_softc *); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r358395 - head/sys/dev/acpica
Author: hrs Date: Thu Feb 27 17:13:57 2020 New Revision: 358395 URL: https://svnweb.freebsd.org/changeset/base/358395 Log: Add workaround for models which do not follow the ACPI specification strictly. Extra objects are now simply ignored instead of rejecting everything. Modified: head/sys/dev/acpica/acpi_cmbat.c Modified: head/sys/dev/acpica/acpi_cmbat.c == --- head/sys/dev/acpica/acpi_cmbat.cThu Feb 27 16:51:41 2020 (r358394) +++ head/sys/dev/acpica/acpi_cmbat.cThu Feb 27 17:13:57 2020 (r358395) @@ -393,21 +393,34 @@ acpi_cmbat_get_bix(void *arg) } while (0) if (ACPI_PKG_VALID_EQ(res, 21)) { /* ACPI 6.0 _BIX */ - if (sc->bix.rev != ACPI_BIX_REV_1) + /* +* Some models have rev.0 _BIX with 21 members. +* In that case, treat the first 20 members as rev.0 _BIX. +*/ + if (sc->bix.rev != ACPI_BIX_REV_0 && + sc->bix.rev != ACPI_BIX_REV_1) ACPI_BIX_REV_MISMATCH_ERR(sc->bix.rev, ACPI_BIX_REV_1); } else if (ACPI_PKG_VALID_EQ(res, 20)) {/* ACPI 4.0 _BIX */ if (sc->bix.rev != ACPI_BIX_REV_0) ACPI_BIX_REV_MISMATCH_ERR(sc->bix.rev, ACPI_BIX_REV_0); - } else if (ACPI_PKG_VALID(res, 22) && - ACPI_BIX_REV_MIN_CHECK(sc->bix.rev, ACPI_BIX_REV_1 + 1)) { + } else if (ACPI_PKG_VALID(res, 22)) { + /* _BIX with 22 or more members. */ + if (ACPI_BIX_REV_MIN_CHECK(sc->bix.rev, ACPI_BIX_REV_1 + 1)) { /* -* Unknown _BIX with 22 or more members. +* Unknown revision number. * Assume 21 members are compatible with 6.0 _BIX. */ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), "Unknown _BIX revision(%u). " "Assuming compatible with revision %u.\n", sc->bix.rev, ACPI_BIX_REV_1); + } else { + /* +* Known revision number. Ignore the extra members. +*/ + ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), + "Extra objects found in _BIX were ignored.\n"); + } } else { /* Invalid _BIX. Ignore it. */ ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev), ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r358152 - head/bin/sh
Conrad Meyer wrote in : ce> Given the report and looking at the change, I suspect the problem is ce> the promotion of '-residue' from size_t (unsigned 32-bit on i386) to ce> off_t (signed 64-bit). Something like '-(off_t)residue' or even ce> 'off_t residue;' should fix it. Yes, r358235 is the correct fix. I am sorry for the breakage and thank you for fixing it quickly. -- Hiroki pgpn4_YJa9gVN.pgp Description: PGP signature
svn commit: r358152 - head/bin/sh
Author: hrs Date: Thu Feb 20 03:01:27 2020 New Revision: 358152 URL: https://svnweb.freebsd.org/changeset/base/358152 Log: Improve performance of "read" built-in command when using a seekable fd. The read built-in command calls read(2) with a 1-byte buffer because newline characters need to be detected even on a byte stream which comes from a non-seekable file descriptor. Because of this, the following script calls >6,000 read(2) to show a 6KiB file: while read IN; do echo "$IN"; done < /COPYRIGHT When the input byte stream is seekable, it is possible to read a data block and then reposition the file pointer to where a newline character found. This change adds a small buffer to do this and reduces the number of read(2) calls. Theoretically, multiple built-in commands reading the same seekable byte stream in a single pipe chain can share the buffer. However, this change just makes a single invocation of the read built-in allocate a buffer and deallocate it every time for simplicity. Although this causes read(2) to read the same regions multiple times, the performance penalty should be small compared to the reduction of read(2) calls. Reviewed by: jilles MFC after:1 week Differential Revision:https://reviews.freebsd.org/D23747 Modified: head/bin/sh/miscbltin.c Modified: head/bin/sh/miscbltin.c == --- head/bin/sh/miscbltin.c Thu Feb 20 01:45:55 2020(r358151) +++ head/bin/sh/miscbltin.c Thu Feb 20 03:01:27 2020(r358152) @@ -66,10 +66,79 @@ __FBSDID("$FreeBSD$"); #undef eflag +#defineREAD_BUFLEN 1024 +struct fdctx { + int fd; + size_t off;/* offset in buf */ + size_t buflen; + char*ep;/* tail pointer */ + charbuf[READ_BUFLEN]; +}; + +static void fdctx_init(int, struct fdctx *); +static void fdctx_destroy(struct fdctx *); +static ssize_t fdgetc(struct fdctx *, char *); int readcmd(int, char **); int umaskcmd(int, char **); int ulimitcmd(int, char **); +static void +fdctx_init(int fd, struct fdctx *fdc) +{ + off_t cur; + + /* Check if fd is seekable. */ + cur = lseek(fd, 0, SEEK_CUR); + *fdc = (struct fdctx){ + .fd = fd, + .buflen = (cur != -1) ? READ_BUFLEN : 1, + .ep = >buf[0], /* No data */ + }; +} + +static ssize_t +fdgetc(struct fdctx *fdc, char *c) +{ + ssize_t nread; + + if (>buf[fdc->off] == fdc->ep) { + nread = read(fdc->fd, fdc->buf, fdc->buflen); + if (nread > 0) { + fdc->off = 0; + fdc->ep = fdc->buf + nread; + } else + return (nread); + } + *c = fdc->buf[fdc->off++]; + + return (1); +} + +static void +fdctx_destroy(struct fdctx *fdc) +{ + size_t residue; + + if (fdc->buflen > 1) { + /* +* Reposition the file offset. Here is the layout of buf: +* +* | off +* v +* |*|---| +* buf ep buf+buflen +* |<- residue ->| +* +* off: current character +* ep: offset just after read(2) +* residue: length for reposition +*/ + residue = (fdc->ep - fdc->buf) - fdc->off; + if (residue > 0) + (void) lseek(fdc->fd, -residue, SEEK_CUR); + } +} + /* * The read builtin. The -r option causes backslashes to be treated like * ordinary characters. @@ -108,6 +177,7 @@ readcmd(int argc __unused, char **argv __unused) fd_set ifds; ssize_t nread; int sig; + struct fdctx fdctx; rflag = 0; prompt = NULL; @@ -173,8 +243,9 @@ readcmd(int argc __unused, char **argv __unused) backslash = 0; STARTSTACKSTR(p); lastnonifs = lastnonifsws = -1; + fdctx_init(STDIN_FILENO, ); for (;;) { - nread = read(STDIN_FILENO, , 1); + nread = fdgetc(, ); if (nread == -1) { if (errno == EINTR) { sig = pendingsig; @@ -260,6 +331,7 @@ readcmd(int argc __unused, char **argv __unused) STARTSTACKSTR(p); lastnonifs = lastnonifsws = -1; } + fdctx_destroy(); STACKSTRNUL(p); /* ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r358095 - in head: share/man/man4 sys/dev/acpica usr.sbin/acpi/acpiconf
ttery present rate of charging or discharging. The unit of the value depends on .Va unit of .Vt struct acpi_bif . -.It cap +.It Va cap Battery remaining capacity. The unit of this value depends on .Va unit of .Vt struct acpi_bif . -.It volt +.It Va volt Battery present voltage. .El .El @@ -212,6 +304,8 @@ connected batteries: .It Va hw.acpi.battery.info_expire Information cache expiration time in seconds. The battery information obtained by +.Li _BIX +or .Li _BIF object will be stored and reused for successive read access to this MIB within the specified period. @@ -276,8 +370,11 @@ Battery information was changed. .An Munehiro Matsuda , .An Takanori Watanabe Aq Mt takaw...@freebsd.org , .An Mitsuru IWASAKI Aq Mt iwas...@freebsd.org , +.An Hans Petter Selasky Aq Mt hsela...@freebsd.org , and -.An Hans Petter Selasky Aq Mt hsela...@freebsd.org . +.An Hiroki Sato Aq Mt h...@freebsd.org . .Pp This manual page was written by -.An Takanori Watanabe Aq Mt takaw...@freebsd.org . +.An Takanori Watanabe Aq Mt takaw...@freebsd.org +and +.An Hiroki Sato Aq Mt h...@freebsd.org . Modified: head/sys/dev/acpica/acpi_battery.c == --- head/sys/dev/acpica/acpi_battery.c Wed Feb 19 04:46:41 2020 (r358094) +++ head/sys/dev/acpica/acpi_battery.c Wed Feb 19 06:28:55 2020 (r358095) @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); /* Default seconds before re-sampling the battery state. */ #defineACPI_BATTERY_INFO_EXPIRE5 -static int acpi_batteries_initted; +static int acpi_batteries_initialized; static int acpi_battery_info_expire = ACPI_BATTERY_INFO_EXPIRE; static struct acpi_battinfo acpi_battery_battinfo; static struct sysctl_ctx_list acpi_battery_sysctl_ctx; @@ -65,11 +65,10 @@ acpi_battery_register(device_t dev) { int error; -error = 0; ACPI_SERIAL_BEGIN(battery); -if (!acpi_batteries_initted) - error = acpi_battery_init(); +error = acpi_battery_init(); ACPI_SERIAL_END(battery); + return (error); } @@ -107,11 +106,12 @@ acpi_battery_bst_valid(struct acpi_bst *bst) bst->cap != ACPI_BATT_UNKNOWN && bst->volt != ACPI_BATT_UNKNOWN); } -/* Check _BIF results for validity. */ +/* Check _BI[FX] results for validity. */ int -acpi_battery_bif_valid(struct acpi_bif *bif) +acpi_battery_bix_valid(struct acpi_bix *bix) { -return (bif->lfcap != 0); + +return (bix->lfcap != 0); } /* Get info about one or all batteries. */ @@ -123,7 +123,7 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba devclass_t batt_dc; device_t batt_dev; struct acpi_bst *bst; -struct acpi_bif *bif; +struct acpi_bix *bix; struct acpi_battinfo *bi; /* @@ -139,11 +139,11 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba /* * Allocate storage for all _BST data, their derived battinfo data, - * and the current battery's _BIF data. + * and the current battery's _BIX (or _BIF) data. */ bst = malloc(devcount * sizeof(*bst), M_TEMP, M_WAITOK | M_ZERO); bi = malloc(devcount * sizeof(*bi), M_TEMP, M_WAITOK | M_ZERO); -bif = malloc(sizeof(*bif), M_TEMP, M_WAITOK | M_ZERO); +bix = malloc(sizeof(*bix), M_TEMP, M_WAITOK | M_ZERO); /* * Pass 1: for each battery that is present and valid, get its status, @@ -173,12 +173,12 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba * Be sure we can get various info from the battery. */ if (ACPI_BATT_GET_STATUS(batt_dev, [i]) != 0 || - ACPI_BATT_GET_INFO(batt_dev, bif) != 0) + ACPI_BATT_GET_INFO(batt_dev, bix, sizeof(*bix)) != 0) continue; /* If a battery is not installed, we sometimes get strange values. */ if (!acpi_battery_bst_valid([i]) || - !acpi_battery_bif_valid(bif)) + !acpi_battery_bix_valid(bix)) continue; /* @@ -197,18 +197,18 @@ acpi_battery_get_battinfo(device_t dev, struct acpi_ba * is 0 (due to some error reading the battery), skip this * conversion. */ - if (bif->units == ACPI_BIF_UNITS_MA && bif->dvol != 0 && dev == NULL) { - bst[i].rate = (bst[i].rate * bif->dvol) / 1000; - bst[i].cap = (bst[i].cap * bif->dvol) / 1000; - bif->lfcap = (bif->lfcap * bif->dvol) / 1000; + if (bix->units == ACPI_BIX_UNITS_MA && bix->dvol != 0 && dev == NULL) { + bst[i].rate = (bst[i].rate * bix->dvol) / 1000; + bst[i].cap = (bst[i].cap * bix->dvol) / 1000; + bix->lfcap = (bix->lfcap * bix->dvol) / 1000; } /* -* The calculation above may set bif->lfcap to zero. This was +* The calculation above may set bix->lfcap to zero. This was * seen on a laptop with
svn commit: r358061 - head/share/vt/keymaps
Author: hrs Date: Tue Feb 18 01:50:44 2020 New Revision: 358061 URL: https://svnweb.freebsd.org/changeset/base/358061 Log: Use 0x5c for the scan code 0x7d. Japanese keyboards traditionally use 0x5c for both Japanese yen sign key and backslash key. While a Japanese yen sign is depicted on the keytop, most of Japanese expect that the scan code 0x7d gives a backslash (0x5c), not a Japanese yen sign (0xa5). This is because JIS X 0201 encoding (aka ISO/IEC 646-JA, an extended version of ASCII which is very popular in Japan) has Japanese yen sign at 0x5c and no backslash. On the other hand, ISO/IEC 8859-1 has Japanese yen sign at 0xa5. This difference has caused a confusion after Unicode became popular since ISO/IEC 10646 adopted 8859-1 for the plane 0. MFC after:1 week Modified: head/share/vt/keymaps/jp.capsctrl.kbd head/share/vt/keymaps/jp.kbd Modified: head/share/vt/keymaps/jp.capsctrl.kbd == --- head/share/vt/keymaps/jp.capsctrl.kbd Tue Feb 18 01:21:56 2020 (r358060) +++ head/share/vt/keymaps/jp.capsctrl.kbd Tue Feb 18 01:50:44 2020 (r358061) @@ -117,4 +117,4 @@ 115 '\''_'fs us '\''_'fs us O 121 ' '' 'nul' '' '' 'susp ' ' O 123 ' '' 'nul' '' '' 'susp ' ' O - 125 0xa5 '|'fs us 0xa5 '|'fs us O + 125 '\''|'fs us 0xa5 '|'fs us O Modified: head/share/vt/keymaps/jp.kbd == --- head/share/vt/keymaps/jp.kbdTue Feb 18 01:21:56 2020 (r358060) +++ head/share/vt/keymaps/jp.kbdTue Feb 18 01:50:44 2020 (r358061) @@ -115,4 +115,4 @@ 115 '\''_'fs us '\''_'fs us O 121 ' '' 'nul' '' '' 'susp ' ' O 123 ' '' 'nul' '' '' 'susp ' ' O - 125 0xa5 '|'fs us 0xa5 '|'fs us O + 125 '\''|'fs us 0xa5 '|'fs us O ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r352576 - stable/11/usr.bin/quota
Author: hrs Date: Sat Sep 21 14:06:16 2019 New Revision: 352576 URL: https://svnweb.freebsd.org/changeset/base/352576 Log: MFC r352567: Add a workaround for servers which respond RPC_PROGNOTREGISTERED to a clnt_create() call even when it is actually a program version mismatch. Normally the server is supposed to return RPC_PROGVERSMISMATCH when it supports the specified program but not support the specified version. Some filers return RPC_PROGNOTREGISTERED to RQUOTA v2 calls and FreeBSD does not retry with the old v1 calls. This change fixes this failure scenario. Submitted by: Jian-Bo Liao PR: 236179 Modified: stable/11/usr.bin/quota/quota.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/quota/quota.c == --- stable/11/usr.bin/quota/quota.c Sat Sep 21 14:03:41 2019 (r352575) +++ stable/11/usr.bin/quota/quota.c Sat Sep 21 14:06:16 2019 (r352576) @@ -604,7 +604,7 @@ getnfsquota(struct statfs *fst, struct quotause *qup, call_stat = callaurpc(host, RQUOTAPROG, EXT_RQUOTAVERS, RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_ext_getquota_args, (char *)_args, (xdrproc_t)xdr_getquota_rslt, (char *)_rslt); - if (call_stat == RPC_PROGVERSMISMATCH) { + if (call_stat == RPC_PROGVERSMISMATCH || call_stat == RPC_PROGNOTREGISTERED) { if (quotatype == USRQUOTA) { old_gq_args.gqa_pathp = cp + 1; old_gq_args.gqa_uid = id; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r352575 - stable/12/usr.bin/quota
Author: hrs Date: Sat Sep 21 14:03:41 2019 New Revision: 352575 URL: https://svnweb.freebsd.org/changeset/base/352575 Log: MFC r352567: Add a workaround for servers which respond RPC_PROGNOTREGISTERED to a clnt_create() call even when it is actually a program version mismatch. Normally the server is supposed to return RPC_PROGVERSMISMATCH when it supports the specified program but not support the specified version. Some filers return RPC_PROGNOTREGISTERED to RQUOTA v2 calls and FreeBSD does not retry with the old v1 calls. This change fixes this failure scenario. Submitted by: Jian-Bo Liao PR: 236179 Modified: stable/12/usr.bin/quota/quota.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/quota/quota.c == --- stable/12/usr.bin/quota/quota.c Sat Sep 21 13:34:06 2019 (r352574) +++ stable/12/usr.bin/quota/quota.c Sat Sep 21 14:03:41 2019 (r352575) @@ -606,7 +606,7 @@ getnfsquota(struct statfs *fst, struct quotause *qup, call_stat = callaurpc(host, RQUOTAPROG, EXT_RQUOTAVERS, RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_ext_getquota_args, (char *)_args, (xdrproc_t)xdr_getquota_rslt, (char *)_rslt); - if (call_stat == RPC_PROGVERSMISMATCH) { + if (call_stat == RPC_PROGVERSMISMATCH || call_stat == RPC_PROGNOTREGISTERED) { if (quotatype == USRQUOTA) { old_gq_args.gqa_pathp = cp + 1; old_gq_args.gqa_uid = id; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r352574 - head/usr.sbin/rpc.statd
Author: hrs Date: Sat Sep 21 13:34:06 2019 New Revision: 352574 URL: https://svnweb.freebsd.org/changeset/base/352574 Log: - Revert WARNS to 2 because of mismatch between (xdrproc_t) and xdr_void(). - Add prototype of from_addr(). Modified: head/usr.sbin/rpc.statd/Makefile head/usr.sbin/rpc.statd/procs.c Modified: head/usr.sbin/rpc.statd/Makefile == --- head/usr.sbin/rpc.statd/MakefileSat Sep 21 13:00:38 2019 (r352573) +++ head/usr.sbin/rpc.statd/MakefileSat Sep 21 13:34:06 2019 (r352574) @@ -7,6 +7,9 @@ SRCS= file.c sm_inter_svc.c sm_inter.h statd.c procs.c CFLAGS+= -I${.OBJDIR} LIBADD=rpcsvc +# XXX: mismatch between (xdrproc_t) and xdr_void(). +WARNS?=2 + CLEANFILES= sm_inter_svc.c sm_inter.h RPCSRC= ${SYSROOT:U${DESTDIR}}/usr/include/rpcsvc/sm_inter.x Modified: head/usr.sbin/rpc.statd/procs.c == --- head/usr.sbin/rpc.statd/procs.c Sat Sep 21 13:00:38 2019 (r352573) +++ head/usr.sbin/rpc.statd/procs.c Sat Sep 21 13:34:06 2019 (r352574) @@ -52,9 +52,10 @@ __FBSDID("$FreeBSD$"); #include "statd.h" +static const char *from_addr(struct sockaddr *); + static const char * -from_addr(saddr) - struct sockaddr *saddr; +from_addr(struct sockaddr *saddr) { static char inet_buf[INET6_ADDRSTRLEN]; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r352572 - head/usr.sbin/rpc.statd
Author: hrs Date: Sat Sep 21 12:33:41 2019 New Revision: 352572 URL: https://svnweb.freebsd.org/changeset/base/352572 Log: Fix warnings and set WARNS=6. Modified: head/usr.sbin/rpc.statd/Makefile head/usr.sbin/rpc.statd/file.c head/usr.sbin/rpc.statd/statd.c Modified: head/usr.sbin/rpc.statd/Makefile == --- head/usr.sbin/rpc.statd/MakefileSat Sep 21 01:39:49 2019 (r352571) +++ head/usr.sbin/rpc.statd/MakefileSat Sep 21 12:33:41 2019 (r352572) @@ -4,9 +4,7 @@ PROG= rpc.statd MAN= rpc.statd.8 SRCS= file.c sm_inter_svc.c sm_inter.h statd.c procs.c -CFLAGS+= -I. -WARNS?= 2 - +CFLAGS+= -I${.OBJDIR} LIBADD=rpcsvc CLEANFILES= sm_inter_svc.c sm_inter.h Modified: head/usr.sbin/rpc.statd/file.c == --- head/usr.sbin/rpc.statd/file.c Sat Sep 21 01:39:49 2019 (r352571) +++ head/usr.sbin/rpc.statd/file.c Sat Sep 21 12:33:41 2019 (r352572) @@ -201,8 +201,8 @@ void init_file(const char *filename) /* defective, re-create from scratch. */ if (!new_file) { -if ((status_file_len < HEADER_LEN) || (status_file_len - < (HEADER_LEN + sizeof(HostInfo) * status_info->noOfHosts)) ) +if ((status_file_len < (off_t)HEADER_LEN) || (status_file_len + < (off_t)(HEADER_LEN + sizeof(HostInfo) * status_info->noOfHosts)) ) { warnx("status file is corrupt"); new_file = TRUE; Modified: head/usr.sbin/rpc.statd/statd.c == --- head/usr.sbin/rpc.statd/statd.c Sat Sep 21 01:39:49 2019 (r352571) +++ head/usr.sbin/rpc.statd/statd.c Sat Sep 21 12:33:41 2019 (r352572) @@ -62,9 +62,9 @@ __FBSDID("$FreeBSD$"); int debug = 0; /* Controls syslog() calls for debug messages */ -char **hosts, *svcport_str = NULL; -int nhosts = 0; -int xcreated = 0; +static char **hosts, *svcport_str = NULL; +static int nhosts = 0; +static int xcreated = 0; static int mallocd_svcport = 0; static int *sock_fd; static int sock_fdcnt; @@ -86,7 +86,8 @@ main(int argc, char **argv) void *nc_handle; in_port_t svcport; int ch, i, s; - char *endptr, **hosts_bak; + char *endptr; + char **hosts_bak; int have_v6 = 1; int maxrec = RPC_MAXDATASIZE; int attempt_cnt, port_len, port_pos, ret; @@ -156,7 +157,7 @@ main(int argc, char **argv) if (hosts == NULL) out_of_mem(); - hosts[0] = "*"; + hosts[0] = strdup("*"); nhosts = 1; } else { hosts_bak = hosts; @@ -172,7 +173,7 @@ main(int argc, char **argv) hosts = hosts_bak; nhosts += 2; - hosts[nhosts - 2] = "::1"; + hosts[nhosts - 2] = strdup("::1"); } else { hosts_bak = realloc(hosts, (nhosts + 1) * sizeof(char *)); if (hosts_bak == NULL) { @@ -186,7 +187,7 @@ main(int argc, char **argv) hosts = hosts_bak; } } - hosts[nhosts - 1] = "127.0.0.1"; + hosts[nhosts - 1] = strdup("127.0.0.1"); } attempt_cnt = 1; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r352570 - head/usr.sbin/rpc.statd
Author: hrs Date: Sat Sep 21 01:29:59 2019 New Revision: 352570 URL: https://svnweb.freebsd.org/changeset/base/352570 Log: Fix build errors of test.c, which had been broken for a long time. This is a temporary fix and should be converted to a complete test scenarios by using this tool. Modified: head/usr.sbin/rpc.statd/Makefile head/usr.sbin/rpc.statd/test.c Modified: head/usr.sbin/rpc.statd/Makefile == --- head/usr.sbin/rpc.statd/MakefileSat Sep 21 01:23:08 2019 (r352569) +++ head/usr.sbin/rpc.statd/MakefileSat Sep 21 01:29:59 2019 (r352570) @@ -20,7 +20,8 @@ sm_inter_svc.c: ${RPCSRC} sm_inter.h: ${RPCSRC} ${RPCGEN} -h -o ${.TARGET} ${.ALLSRC} -test: test.c - cc -o test test.c -lrpcsvc +test: test.o + ${CC} ${LDFLAGS} -o ${.TARGET} ${.ALLSRC} ${LIBADD:S/^/-l/} +CLEANFILES+= test test.o .include Modified: head/usr.sbin/rpc.statd/test.c == --- head/usr.sbin/rpc.statd/test.c Sat Sep 21 01:23:08 2019 (r352569) +++ head/usr.sbin/rpc.statd/test.c Sat Sep 21 01:29:59 2019 (r352570) @@ -1,14 +1,14 @@ - #ifndef lint static const char rcsid[] = "$FreeBSD$"; #endif /* not lint */ #include +#include +#include #include #include - /* Default timeout can be changed using clnt_control() */ static struct timeval TIMEOUT = { 25, 0 }; @@ -20,7 +20,8 @@ sm_stat_1(argp, clnt) static struct sm_stat_res res; bzero((char *), sizeof(res)); - if (clnt_call(clnt, SM_STAT, xdr_sm_name, argp, xdr_sm_stat_res, , TIMEOUT) != RPC_SUCCESS) { + if (clnt_call(clnt, SM_STAT, (xdrproc_t)xdr_sm_name, argp, + (xdrproc_t)xdr_sm_stat_res, , TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (); @@ -35,7 +36,8 @@ sm_mon_1(argp, clnt) static struct sm_stat_res res; bzero((char *), sizeof(res)); - if (clnt_call(clnt, SM_MON, xdr_mon, argp, xdr_sm_stat_res, , TIMEOUT) != RPC_SUCCESS) { + if (clnt_call(clnt, SM_MON, (xdrproc_t)xdr_mon, argp, + (xdrproc_t)xdr_sm_stat_res, , TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (); @@ -50,7 +52,8 @@ sm_unmon_1(argp, clnt) static struct sm_stat res; bzero((char *), sizeof(res)); - if (clnt_call(clnt, SM_UNMON, xdr_mon_id, argp, xdr_sm_stat, , TIMEOUT) != RPC_SUCCESS) { + if (clnt_call(clnt, SM_UNMON, (xdrproc_t)xdr_mon_id, argp, + (xdrproc_t)xdr_sm_stat, , TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (); @@ -65,7 +68,8 @@ sm_unmon_all_1(argp, clnt) static struct sm_stat res; bzero((char *), sizeof(res)); - if (clnt_call(clnt, SM_UNMON_ALL, xdr_my_id, argp, xdr_sm_stat, , TIMEOUT) != RPC_SUCCESS) { + if (clnt_call(clnt, SM_UNMON_ALL, (xdrproc_t)xdr_my_id, argp, + (xdrproc_t)xdr_sm_stat, , TIMEOUT) != RPC_SUCCESS) { return (NULL); } return (); @@ -80,7 +84,8 @@ sm_simu_crash_1(argp, clnt) static char res; bzero((char *), sizeof(res)); - if (clnt_call(clnt, SM_SIMU_CRASH, xdr_void, argp, xdr_void, , TIMEOUT) != RPC_SUCCESS) { + if (clnt_call(clnt, SM_SIMU_CRASH, (xdrproc_t)xdr_void, argp, + (xdrproc_t)xdr_void, , TIMEOUT) != RPC_SUCCESS) { return (NULL); } return ((void *)); @@ -119,25 +124,20 @@ int main(int argc, char **argv) { /* Hostname given */ struct sm_stat_res *res; -if (res = sm_mon_1(, cli)) -{ + +res = sm_mon_1(, cli); +if (res) printf("Success!\n"); -} else -{ printf("Fail\n"); -} } else { -if (out = sm_simu_crash_1(, cli)) -{ +out = sm_simu_crash_1(, cli); +if (out) printf("Success!\n"); -} else -{ printf("Fail\n"); -} } return 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r352568 - head/usr.bin/top
Author: hrs Date: Sat Sep 21 00:44:37 2019 New Revision: 352568 URL: https://svnweb.freebsd.org/changeset/base/352568 Log: Impove wording and move descriptions about locale to LC_CTYPE in the ENVIRONMENT section. Modified: head/usr.bin/top/top.1 Modified: head/usr.bin/top/top.1 == --- head/usr.bin/top/top.1 Sat Sep 21 00:17:40 2019(r352567) +++ head/usr.bin/top/top.1 Sat Sep 21 00:44:37 2019(r352568) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -.Dd September 20, 2019 +.Dd September 21, 2019 .Dt TOP 1 .Os .Sh NAME @@ -66,6 +66,9 @@ It it useful when you want to watch applications, that puts their status information there. If the real name differs from argv[0], it will be displayed in parenthesis. +Non-printable characters in the command line are +encoded in C-style backslash sequences or +a three digit octal sequences. .It Fl b Use \*(lqbatch\*(rq mode. In this mode, all input from the terminal is @@ -192,10 +195,6 @@ or \*(lqall\*(rq. Boolean flags are toggles. A second specification of any of these options will negate the first. -.Pp -The display of command names changes according to the locale. -If command names displayed in the locale settings are recognized as -non-display characters, they are displayed in three digit octal sequence. .Sh "INTERACTIVE MODE" When .Nm @@ -426,6 +425,12 @@ bytes paged out to swap devices (last interval) .It Ev TOP Default set of arguments to .Nm . +.It Ev LC_CTYPE +The locale to use when displaying the +.Va argv +vector when +.Fl a +flag is specified. .El .Sh SEE ALSO .Xr kill 1 , ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r352567 - head/usr.bin/quota
Author: hrs Date: Sat Sep 21 00:17:40 2019 New Revision: 352567 URL: https://svnweb.freebsd.org/changeset/base/352567 Log: Add a workaround for servers which respond RPC_PROGNOTREGISTERED to a clnt_create() call even when it is actually a program version mismatch. Normally the server is supposed to return RPC_PROGVERSMISMATCH when it supports the specified program but not support the specified version. Some filers return RPC_PROGNOTREGISTERED to RQUOTA v2 calls and FreeBSD does not retry with the old v1 calls. This change fixes this failure scenario. Submitted by: Jian-Bo Liao PR: 236179 Modified: head/usr.bin/quota/quota.c Modified: head/usr.bin/quota/quota.c == --- head/usr.bin/quota/quota.c Fri Sep 20 22:07:59 2019(r352566) +++ head/usr.bin/quota/quota.c Sat Sep 21 00:17:40 2019(r352567) @@ -606,7 +606,7 @@ getnfsquota(struct statfs *fst, struct quotause *qup, call_stat = callaurpc(host, RQUOTAPROG, EXT_RQUOTAVERS, RQUOTAPROC_GETQUOTA, (xdrproc_t)xdr_ext_getquota_args, (char *)_args, (xdrproc_t)xdr_getquota_rslt, (char *)_rslt); - if (call_stat == RPC_PROGVERSMISMATCH) { + if (call_stat == RPC_PROGVERSMISMATCH || call_stat == RPC_PROGNOTREGISTERED) { if (quotatype == USRQUOTA) { old_gq_args.gqa_pathp = cp + 1; old_gq_args.gqa_uid = id; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r351554 - head/contrib/sendmail/src
Author: hrs Date: Tue Aug 27 20:11:45 2019 New Revision: 351554 URL: https://svnweb.freebsd.org/changeset/base/351554 Log: MFV r351553: Fix a problem which prevented -OServerSSLOptions or -OClientSSLOptions specified in the command-line option from working. This patch has been accepted by the upstream. Reviewed by and discussed with: gshapiro Modified: head/contrib/sendmail/src/conf.c head/contrib/sendmail/src/readcf.c Directory Properties: head/contrib/sendmail/ (props changed) Modified: head/contrib/sendmail/src/conf.c == --- head/contrib/sendmail/src/conf.cTue Aug 27 19:37:19 2019 (r351553) +++ head/contrib/sendmail/src/conf.cTue Aug 27 20:11:45 2019 (r351554) @@ -365,6 +365,20 @@ setdefaults(e) TLS_Srv_Opts = TLS_I_SRV; if (NULL == EVP_digest) EVP_digest = EVP_md5(); + Srv_SSL_Options = SSL_OP_ALL; + Clt_SSL_Options = SSL_OP_ALL +# ifdef SSL_OP_NO_SSLv2 + | SSL_OP_NO_SSLv2 +# endif +# ifdef SSL_OP_NO_TICKET + | SSL_OP_NO_TICKET +# endif + ; +# ifdef SSL_OP_TLSEXT_PADDING + /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */ + Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; + Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; +# endif /* SSL_OP_TLSEXT_PADDING */ #endif /* STARTTLS */ #ifdef HESIOD_INIT HesiodContext = NULL; Modified: head/contrib/sendmail/src/readcf.c == --- head/contrib/sendmail/src/readcf.c Tue Aug 27 19:37:19 2019 (r351553) +++ head/contrib/sendmail/src/readcf.c Tue Aug 27 20:11:45 2019 (r351554) @@ -159,22 +159,6 @@ readcf(cfname, safe, e) FileName = cfname; LineNumber = 0; -#if STARTTLS - Srv_SSL_Options = SSL_OP_ALL; - Clt_SSL_Options = SSL_OP_ALL -# ifdef SSL_OP_NO_SSLv2 - | SSL_OP_NO_SSLv2 -# endif -# ifdef SSL_OP_NO_TICKET - | SSL_OP_NO_TICKET -# endif - ; -# ifdef SSL_OP_TLSEXT_PADDING - /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */ - Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; - Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; -# endif /* SSL_OP_TLSEXT_PADDING */ -#endif /* STARTTLS */ if (DontLockReadFiles) sff |= SFF_NOLOCK; cf = safefopen(cfname, O_RDONLY, 0444, sff); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r351553 - vendor/sendmail/dist/src
Author: hrs Date: Tue Aug 27 19:37:19 2019 New Revision: 351553 URL: https://svnweb.freebsd.org/changeset/base/351553 Log: Fix a problem which prevented -OServerSSLOptions or -OClientSSLOptions specified in the command-line option from working. This patch has been accepted by the upstream. Reviewed by and discussed with: gshapiro Modified: vendor/sendmail/dist/src/conf.c vendor/sendmail/dist/src/readcf.c Modified: vendor/sendmail/dist/src/conf.c == --- vendor/sendmail/dist/src/conf.c Tue Aug 27 18:00:01 2019 (r351552) +++ vendor/sendmail/dist/src/conf.c Tue Aug 27 19:37:19 2019 (r351553) @@ -365,6 +365,20 @@ setdefaults(e) TLS_Srv_Opts = TLS_I_SRV; if (NULL == EVP_digest) EVP_digest = EVP_md5(); + Srv_SSL_Options = SSL_OP_ALL; + Clt_SSL_Options = SSL_OP_ALL +# ifdef SSL_OP_NO_SSLv2 + | SSL_OP_NO_SSLv2 +# endif +# ifdef SSL_OP_NO_TICKET + | SSL_OP_NO_TICKET +# endif + ; +# ifdef SSL_OP_TLSEXT_PADDING + /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */ + Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; + Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; +# endif /* SSL_OP_TLSEXT_PADDING */ #endif /* STARTTLS */ #ifdef HESIOD_INIT HesiodContext = NULL; Modified: vendor/sendmail/dist/src/readcf.c == --- vendor/sendmail/dist/src/readcf.c Tue Aug 27 18:00:01 2019 (r351552) +++ vendor/sendmail/dist/src/readcf.c Tue Aug 27 19:37:19 2019 (r351553) @@ -159,22 +159,6 @@ readcf(cfname, safe, e) FileName = cfname; LineNumber = 0; -#if STARTTLS - Srv_SSL_Options = SSL_OP_ALL; - Clt_SSL_Options = SSL_OP_ALL -# ifdef SSL_OP_NO_SSLv2 - | SSL_OP_NO_SSLv2 -# endif -# ifdef SSL_OP_NO_TICKET - | SSL_OP_NO_TICKET -# endif - ; -# ifdef SSL_OP_TLSEXT_PADDING - /* SSL_OP_TLSEXT_PADDING breaks compatibility with some sites */ - Srv_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; - Clt_SSL_Options &= ~SSL_OP_TLSEXT_PADDING; -# endif /* SSL_OP_TLSEXT_PADDING */ -#endif /* STARTTLS */ if (DontLockReadFiles) sff |= SFF_NOLOCK; cf = safefopen(cfname, O_RDONLY, 0444, sff); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests
Hi Alan and Conrad, I agree with the idea having ping6(8) as a hardlink to ping(8) to provide the historical ping6(8) behavior. Alan Somers wrote in : as> Jan (please keep him CCed on replies) has been musing about the same as> thing. That might satisfy everyone. Jan, would it be straightforward as> to implement? as> -Alan as> as> On Sun, Aug 25, 2019 at 5:51 PM Conrad Meyer wrote: as> > as> > Hi Alan, Hiroki, as> > as> > It would be pretty easy to install a `ping6` link to the `ping(8)` as> > binary with different option parsing (conditional on argv[0]). That as> > removes most of the issues of code and space duplication, I think? as> > And the goal would be for the 'ping6' name to retain option as> > compatibility with historical ping6. as> > as> > It's not an uncommon pattern; for example, 'id', 'groups', and as> > 'whoami' are all a single binary with multiple linked names. Another as> > example is Clang, which provides 'cc', 'c++', 'clang', 'clang-cpp', as> > 'clang++' and 'cpp' links to the same inode — and those have very as> > different behavior depending on argv[0]. as> > as> > It's less work than forcing the ping6 compatibility crowd to create a as> > port and doesn't hurt ping(8) much, AFAICT. Is it an acceptable as> > middle ground? as> > as> > Best, as> > Conrad as> > as> > On Sun, Aug 25, 2019 at 1:26 PM alan somers wrote: as> > > as> > > On Sun, Aug 25, 2019, 2:11 PM Hiroki Sato wrote: as> > >> as> > >> Alan Somers wrote as> > >> in : as> > >> as> > >> as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato wrote: as> > >> as> > as> > >> as> > Hi, as> > >> as> > as> > >> as> > Alan Somers wrote as> > >> as> > in <201908231522.x7nfmluj068...@repo.freebsd.org>: as> > >> as> > as> > >> as> > as> Author: asomers as> > >> as> > as> Date: Fri Aug 23 15:22:20 2019 as> > >> as> > as> New Revision: 351423 as> > >> as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 as> > >> as> > as> as> > >> as> > as> Log: as> > >> as> > as> ping6: Rename options for better consistency with ping as> > >> as> > as> as> > >> as> > as> Now equivalent options have the same flags, and nonequivalent options have as> > >> as> > as> different flags. This is a prelude to merging the two commands. as> > >> as> > as> as> > >> as> > as> Submitted by: Ján Sučan as> > >> as> > as> MFC: Never as> > >> as> > as> Sponsored by: Google LLC (Google Summer of Code 2019) as> > >> as> > as> Differential Revision: https://reviews.freebsd.org/D21345 as> > >> as> > as> > >> as> > I have an objection on renaming the existing option flags in ping6(8) as> > >> as> > for compatibility with ping(8). as> > >> as> > as> > >> as> > Is it sufficient to add INET6 support to ping(8) with consistent as> > >> as> > flags and keep CLI of ping6(8) backward compatible? People have used as> > >> as> > ping6(8) for >15 years, so it is too late to rename the flags. I do as> > >> as> > not think the renaming is useful if "ping -6 localhost" or "ping ::1" as> > >> as> > works. as> > >> as> > as> > >> as> > -- Hiroki as> > >> as> as> > >> as> If ping works with inet6, then why would we want to keep a separate as> > >> as> tool around? If it's just for the sake of people who don't want to or as> > >> as> can't update scripts, would a version in ports suffice? as> > >> as> > >> Because removing (or renaming) it causes a POLA violation. Do we as> > >> really have a strong, unavoidable reason to force people to rewrite as> > >> their script now? This is still a fairly essential and actively used as> > >> tool, not like rcp or rlogin. Although deprecating ping6(8) and as> > >> removing it from the base system in the future release at some point as> > >> may work, changing the existing interface will simply confuse people as> > >> who have used IPv6 for a long time. as> > >> as> > >> In my understanding, the purpose to integrate ping(8) and ping6(8) as> > >> into a single utility is to provide a consistent CLI and reduce as> > >> duplicate code, not to break compatibility. as> > >> as> > >> -- Hiroki as> > > as> > > as> > > Those goals are incompatible. We can't provide a consistent CLI without breaking compatibility because ping and ping6 have conflicting options. And we can't keep ping6 around while also removing duplicate code because that would be, well, duplicate code. as> > > as> > > When would be a better time than a major version bump to make a change like this? as> > > as> > > The lack of a ping6 command in freebsd 13 should serve as a pretty obvious reminder that scripts will need updating. I think that putting a version of ping6 in ports should be a sufficient crutch for those who need it, don't you? as> as> -- Hiroki pgpPqFZjpkBkt.pgp Description: PGP signature
Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests
Alan Somers wrote in : as> On Sun, Aug 25, 2019 at 1:22 PM Hiroki Sato wrote: as> > as> > Hi, as> > as> > Alan Somers wrote as> > in <201908231522.x7nfmluj068...@repo.freebsd.org>: as> > as> > as> Author: asomers as> > as> Date: Fri Aug 23 15:22:20 2019 as> > as> New Revision: 351423 as> > as> URL: https://svnweb.freebsd.org/changeset/base/351423 as> > as> as> > as> Log: as> > as> ping6: Rename options for better consistency with ping as> > as> as> > as> Now equivalent options have the same flags, and nonequivalent options have as> > as> different flags. This is a prelude to merging the two commands. as> > as> as> > as> Submitted by: Ján Sučan as> > as> MFC: Never as> > as> Sponsored by: Google LLC (Google Summer of Code 2019) as> > as> Differential Revision:https://reviews.freebsd.org/D21345 as> > as> > I have an objection on renaming the existing option flags in ping6(8) as> > for compatibility with ping(8). as> > as> > Is it sufficient to add INET6 support to ping(8) with consistent as> > flags and keep CLI of ping6(8) backward compatible? People have used as> > ping6(8) for >15 years, so it is too late to rename the flags. I do as> > not think the renaming is useful if "ping -6 localhost" or "ping ::1" as> > works. as> > as> > -- Hiroki as> as> If ping works with inet6, then why would we want to keep a separate as> tool around? If it's just for the sake of people who don't want to or as> can't update scripts, would a version in ports suffice? Because removing (or renaming) it causes a POLA violation. Do we really have a strong, unavoidable reason to force people to rewrite their script now? This is still a fairly essential and actively used tool, not like rcp or rlogin. Although deprecating ping6(8) and removing it from the base system in the future release at some point may work, changing the existing interface will simply confuse people who have used IPv6 for a long time. In my understanding, the purpose to integrate ping(8) and ping6(8) into a single utility is to provide a consistent CLI and reduce duplicate code, not to break compatibility. -- Hiroki pgpbQM7F6_L0s.pgp Description: PGP signature
svn commit: r351484 - head/etc/mtree
Author: hrs Date: Sun Aug 25 19:27:14 2019 New Revision: 351484 URL: https://svnweb.freebsd.org/changeset/base/351484 Log: Fix build (r351481). Modified: head/etc/mtree/BSD.tests.dist Modified: head/etc/mtree/BSD.tests.dist == --- head/etc/mtree/BSD.tests.dist Sun Aug 25 18:52:10 2019 (r351483) +++ head/etc/mtree/BSD.tests.dist Sun Aug 25 19:27:14 2019 (r351484) @@ -821,8 +821,6 @@ .. link .. -mixer -.. mkdir .. mkfifo @@ -1081,6 +1079,8 @@ fstyp .. makefs +.. +mixer .. newsyslog .. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r351423 - in head: . sbin/ping6 sbin/ping6/tests
Hi, Alan Somers wrote in <201908231522.x7nfmluj068...@repo.freebsd.org>: as> Author: asomers as> Date: Fri Aug 23 15:22:20 2019 as> New Revision: 351423 as> URL: https://svnweb.freebsd.org/changeset/base/351423 as> as> Log: as> ping6: Rename options for better consistency with ping as> as> Now equivalent options have the same flags, and nonequivalent options have as> different flags. This is a prelude to merging the two commands. as> as> Submitted by: Ján Sučan as> MFC: Never as> Sponsored by: Google LLC (Google Summer of Code 2019) as> Differential Revision:https://reviews.freebsd.org/D21345 I have an objection on renaming the existing option flags in ping6(8) for compatibility with ping(8). Is it sufficient to add INET6 support to ping(8) with consistent flags and keep CLI of ping6(8) backward compatible? People have used ping6(8) for >15 years, so it is too late to rename the flags. I do not think the renaming is useful if "ping -6 localhost" or "ping ::1" works. -- Hiroki pgpwhQxA_TT7M.pgp Description: PGP signature
svn commit: r351483 - head/share/man/man7
Author: hrs Date: Sun Aug 25 18:52:10 2019 New Revision: 351483 URL: https://svnweb.freebsd.org/changeset/base/351483 Log: Document soft updates journaling and GEOM-based UFS journaling. Reviewed by: mckusick Modified: head/share/man/man7/ffs.7 Modified: head/share/man/man7/ffs.7 == --- head/share/man/man7/ffs.7 Sun Aug 25 18:46:10 2019(r351482) +++ head/share/man/man7/ffs.7 Sun Aug 25 18:52:10 2019(r351483) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 26, 2001 +.Dd August 25, 2019 .Dt FFS 7 .Os .Sh NAME @@ -46,6 +46,7 @@ In the kernel configuration file: .Cd "options UFS_DIRHASH" .Cd "options UFS_EXTATTR" .Cd "options UFS_EXTATTR_AUTOSTART" +.Cd "options UFS_GJOURNAL" .Pp In .Xr fstab 5 : @@ -84,20 +85,65 @@ and enforces metadata update dependencies (e.g., updating free block maps) to ensure that the file system remains consistent. .Pp -To enable soft updates on an -.Em unmounted -file system, use the following command: +To create a new file system with the soft updates +enabled, +use +.Xr newfs 8 +command: .Pp -.D1 Nm tunefs Fl n Cm enable Ar fs +.D1 Nm newfs Fl U Ar fs .Pp .Ar fs can be either a mount point listed in .Xr fstab 5 -(e.g., -.Pa /usr ) , +.Pq e.g. , Pa /usr , or a disk device -(e.g., -.Pa /dev/da0a ) . +.Pq e.g., Pa /dev/da0a . +.Pp +It is possible to enable soft updates on an +.Em unmounted +file system by using +.Xr tunefs 8 +command: +.Pp +.D1 Nm tunefs Fl n Cm enable Ar fs +.Pp +Soft updates can also add journaling that reduces the time spent by +.Xr fsck_ffs 8 +cleaning up a filesystem after a crash from several minutes to a few seconds. +The journal is placed in an inode named +.Pa .sujournal , +and is kept as a circular log of segments containing +records that describe metadata operations. +.Pp +To create a new file system with both the soft updates +and soft updates journaling enabled, +use the following command: +.Pp +.D1 Nm newfs Fl j Ar fs +.Pp +This runs +.Xr tunefs 8 +command after +.Xr newfs 8 +command with +.Fl U +flag enabled. +It is possible to enable soft updates journaling on an +.Em unmounted +file system by using +.Xr tunefs 8 +command: +.Pp +.D1 Nm tunefs Fl j Cm enable Ar fs +.Pp +This flag automatically enables the soft updates feature +when it is not enabled. +Note that this +.Xr tunefs 8 +command will fail if a file +.Pa .sujournal +already exists before enabling the soft updates journaling. .El .Ss File Ownership Inheritance .Bl -tag -width 2n @@ -155,10 +201,9 @@ extattrctl initattr -p / 388 posix1e.acl_default .Ed .Pp On the next mount of the root file system, -the attributes will be automatically started -(if +the attributes will be automatically started if .Dv UFS_EXTATTR_AUTOSTART -is included in the kernel configuration), +is included in the kernel configuration, and ACLs will be enabled. .Ss Directory Hashing .Bl -tag -width 2n @@ -183,7 +228,52 @@ subdirectory of the file system root during the mount If found, extended attribute support will be automatically started for that file system. .El +.Ss GEOM-based Journaling +.Bl -tag -width 2n +.It Cd "options UFS_GJOURNAL" +Implements a block level journaling of a UFS file system, +which is for both data and metadata. +To enable this, +create a +.Xr gjournal 8 +GEOM provider for a block device by using the +following command: .Pp +.D1 Nm gjournal label Ar da0 +.Pp +In this example, +.Pa /dev/da0 +is used as the target block device, +and +.Pa /dev/da0.journal +is created. +Then create a new file system by using +.Xr newfs 8 +with the block level journaling flag and mount it: +.Pp +.D1 Nm newfs Fl J Ar /dev/da0.journal +.D1 Nm mount Fl o Cm async Ar /dev/da0.journal Ar /mnt +.Pp +.Cm async +option is not mandatory but recommended for better performance +because the journaling guarantees the consistency of an +.Cm async +mount. +.Pp +It is also possible to enable the block level journaling +on an existing file system. +To do so, +use +.Xr gjournal 8 +utility to label the underlying block device and +.Xr tunefs 8 +utility to enable the block level journaling flag: +.Pp +.D1 Nm gjournal label Ar da0 +.D1 Nm tunefs Fl J Cm enable Ar /dev/da0.journal +.D1 Nm mount Fl o Cm async Ar /dev/da0.journal Ar /mnt +.El +.Ss Xr sysctl 8 MIBs The following .Xr sysctl 8 MIBs are defined for use with @@ -192,11 +282,11 @@ MIBs are defined for use with .It Va vfs.ffs.doasyncfree Asynchronously write out modified i-node and indirect blocks upon reallocating file system blocks to be contiguous. -(Default: 1.) +.Pq Default: 1 . .It Va vfs.ffs.doreallocblks Enable support for the rearrangement of blocks to be contiguous. -(Default: 1.) +.Pq Default: 1 . .El .Sh SEE ALSO .Xr quota 1 , @@ -204,7 +294,9 @@ to be contiguous. .Xr extattr 3 , .Xr edquota 8 , .Xr extattrctl 8 , -.Xr sysctl 8 +.Xr fsck_ffs 8 , +.Xr sysctl 8 , +.Xr tunefs 8 .Rs .%A M. McKusick .%A W. Joy @@
svn commit: r351482 - head/sys/dev/vmware/vmci
Author: hrs Date: Sun Aug 25 18:46:10 2019 New Revision: 351482 URL: https://svnweb.freebsd.org/changeset/base/351482 Log: Add MODULE_PNP_INFO() to vmci(4). This allows devd(8) to load the kernel module automatically when FreeBSD is running on VMware. Reviewed by: mp Differential Revision:https://reviews.freebsd.org/D21182 Modified: head/sys/dev/vmware/vmci/vmci.c Modified: head/sys/dev/vmware/vmci/vmci.c == --- head/sys/dev/vmware/vmci/vmci.c Sun Aug 25 17:55:31 2019 (r351481) +++ head/sys/dev/vmware/vmci/vmci.c Sun Aug 25 18:46:10 2019 (r351482) @@ -73,6 +73,16 @@ static driver_t vmci_driver = { static devclass_t vmci_devclass; DRIVER_MODULE(vmci, pci, vmci_driver, vmci_devclass, 0, 0); MODULE_VERSION(vmci, VMCI_VERSION); +const struct { + uint16_t vendor; + uint16_t device; + const char *desc; +} vmci_ids[] = { + { VMCI_VMWARE_VENDOR_ID, VMCI_VMWARE_DEVICE_ID, + "VMware Virtual Machine Communication Interface" }, +}; +MODULE_PNP_INFO("U16:vendor;U16:device;D:#", pci, vmci, vmci_ids, +nitems(vmci_ids)); MODULE_DEPEND(vmci, pci, 1, 1, 1); @@ -112,10 +122,9 @@ static int vmci_probe(device_t dev) { - if (pci_get_vendor(dev) == VMCI_VMWARE_VENDOR_ID && - pci_get_device(dev) == VMCI_VMWARE_DEVICE_ID) { - device_set_desc(dev, - "VMware Virtual Machine Communication Interface"); + if (pci_get_vendor(dev) == vmci_ids[0].vendor && + pci_get_device(dev) == vmci_ids[0].device) { + device_set_desc(dev, vmci_ids[0].desc); return (BUS_PROBE_DEFAULT); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r349875 - in head: share/man/man4 sys/dev/usb sys/dev/usb/net sys/dev/usb/quirk
Author: hrs Date: Wed Jul 10 05:45:50 2019 New Revision: 349875 URL: https://svnweb.freebsd.org/changeset/base/349875 Log: Add support for RTL8156, 2.5GbE USB network controller, to if_cdce(4). This chip can be found in Planex USB-LAN2500R. Modified: head/share/man/man4/cdce.4 head/sys/dev/usb/net/if_cdce.c head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/usbdevs Modified: head/share/man/man4/cdce.4 == --- head/share/man/man4/cdce.4 Wed Jul 10 04:09:15 2019(r349874) +++ head/share/man/man4/cdce.4 Wed Jul 10 05:45:50 2019(r349875) @@ -28,7 +28,7 @@ .\" $NetBSD: cdce.4,v 1.4 2004/12/08 18:35:56 peter Exp $ .\" $FreeBSD$ .\" -.Dd May 21, 2018 +.Dd July 10, 2019 .Dt CDCE 4 .Os .Sh NAME @@ -89,6 +89,10 @@ Prolific PL-2501 Host-to-Host Bridge Controller Sharp Zaurus PDA .It Terayon TJ-715 DOCSIS Cable Modem +.It +Realtek RTL8156 USB GBE/2.5G Ethernet Family Controller +.It +Planex USB-LAN2500R .El .Sh DIAGNOSTICS .Bl -diag Modified: head/sys/dev/usb/net/if_cdce.c == --- head/sys/dev/usb/net/if_cdce.c Wed Jul 10 04:09:15 2019 (r349874) +++ head/sys/dev/usb/net/if_cdce.c Wed Jul 10 05:45:50 2019 (r349875) @@ -276,6 +276,7 @@ static const STRUCT_USB_HOST_ID cdce_host_devs[] = { {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLA300, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC700, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, {USB_VPI(USB_VENDOR_SHARP, USB_PRODUCT_SHARP_SLC750, CDCE_FLAG_ZAURUS | CDCE_FLAG_NO_UNION)}, + {USB_VPI(USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8156, 0)}, {USB_VENDOR(USB_VENDOR_HUAWEI), USB_IFACE_CLASS(UICLASS_VENDOR), USB_IFACE_SUBCLASS(0x02), USB_IFACE_PROTOCOL(0x16), Modified: head/sys/dev/usb/quirk/usb_quirk.c == --- head/sys/dev/usb/quirk/usb_quirk.c Wed Jul 10 04:09:15 2019 (r349874) +++ head/sys/dev/usb/quirk/usb_quirk.c Wed Jul 10 05:45:50 2019 (r349875) @@ -101,6 +101,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(ELSA, MODEM1, 0x, 0x, UQ_CFG_INDEX_1), USB_QUIRK(PLANEX2, MZKUE150N, 0x, 0x, UQ_CFG_INDEX_1), USB_QUIRK(CISCOLINKSYS, USB3GIGV1, 0x, 0x, UQ_CFG_INDEX_1), + USB_QUIRK(REALTEK, RTL8156, 0x, 0x, UQ_CFG_INDEX_2), /* Quirks for printer devices */ USB_QUIRK(HP, 895C, 0x, 0x, UQ_BROKEN_BIDIR), USB_QUIRK(HP, 880C, 0x, 0x, UQ_BROKEN_BIDIR), Modified: head/sys/dev/usb/usbdevs == --- head/sys/dev/usb/usbdevsWed Jul 10 04:09:15 2019(r349874) +++ head/sys/dev/usb/usbdevsWed Jul 10 05:45:50 2019(r349875) @@ -3962,6 +3962,7 @@ product REALTEK RTL8188RU_2 0x317f RTL8188RU product REALTEK USBKR100 0x8150 USBKR100 USB Ethernet product REALTEK RTL81520x8152 RTL8152 USB Ethernet product REALTEK RTL81530x8153 RTL8153 USB Ethernet +product REALTEK RTL81560x8156 RTL8156 USB Ethernet product REALTEK RTL8188CE_0 0x8170 RTL8188CE product REALTEK RTL81710x8171 RTL8171 product REALTEK RTL81720x8172 RTL8172 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r347887 - head/sys/netinet6
Author: hrs Date: Thu May 16 19:09:41 2019 New Revision: 347887 URL: https://svnweb.freebsd.org/changeset/base/347887 Log: Fix hostname to be returned in an ICMPv6 NI Reply message defined in RFC 4620, ICMPv6 Node Information Queries. A vnet jail with an IPv6 address sent a hostname of the host environment, not the jail, even if another hostname was set to the jail. This change can be tested by the following commands: # ifconfig epair0 create # jail -c -n j1 vnet host.hostname=vnetjail path=/ persist # ifconfig epair0b vnet j1 # ifconfig epair0a inet6 -ifdisabled auto_linklocal up # jexec j1 ifconfig epair0b inet6 -ifdisabled auto_linklocal up # ping6 -w ff02::1%epair0a Differential Revision:https://reviews.freebsd.org/D20207 MFC after:1 week Modified: head/sys/netinet6/icmp6.c Modified: head/sys/netinet6/icmp6.c == --- head/sys/netinet6/icmp6.c Thu May 16 18:54:20 2019(r347886) +++ head/sys/netinet6/icmp6.c Thu May 16 19:09:41 2019(r347887) @@ -140,7 +140,7 @@ static int icmp6_rip6_input(struct mbuf **, int); static int icmp6_ratelimit(const struct in6_addr *, const int, const int); static const char *icmp6_redirect_diag(struct in6_addr *, struct in6_addr *, struct in6_addr *); -static struct mbuf *ni6_input(struct mbuf *, int); +static struct mbuf *ni6_input(struct mbuf *, int, struct prison *); static struct mbuf *ni6_nametodns(const char *, int, int); static int ni6_dnsmatch(const char *, int, const char *, int); static int ni6_addrs(struct icmp6_nodeinfo *, struct mbuf *, @@ -627,6 +627,7 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) case ICMP6_WRUREQUEST: /* ICMP6_FQDN_QUERY */ { enum { WRU, FQDN } mode; + struct prison *pr; if (!V_icmp6_nodeinfo) break; @@ -638,6 +639,14 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) else goto badlen; + pr = NULL; + sx_slock(_lock); + TAILQ_FOREACH(pr, , pr_list) + if (pr->pr_vnet == ifp->if_vnet) + break; + sx_sunlock(_lock); + if (pr == NULL) + pr = curthread->td_ucred->cr_prison; if (mode == FQDN) { #ifndef PULLDOWN_TEST IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_nodeinfo), @@ -645,11 +654,10 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) #endif n = m_copym(m, 0, M_COPYALL, M_NOWAIT); if (n) - n = ni6_input(n, off); + n = ni6_input(n, off, pr); /* XXX meaningless if n == NULL */ noff = sizeof(struct ip6_hdr); } else { - struct prison *pr; u_char *p; int maxhlen, hlen; @@ -683,13 +691,6 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) n = NULL; break; } - maxhlen = M_TRAILINGSPACE(n) - - (sizeof(*nip6) + sizeof(*nicmp6) + 4); - pr = curthread->td_ucred->cr_prison; - mtx_lock(>pr_mtx); - hlen = strlen(pr->pr_hostname); - if (maxhlen > hlen) - maxhlen = hlen; /* * Copy IPv6 and ICMPv6 only. */ @@ -699,6 +700,13 @@ icmp6_input(struct mbuf **mp, int *offp, int proto) bcopy(icmp6, nicmp6, sizeof(struct icmp6_hdr)); p = (u_char *)(nicmp6 + 1); bzero(p, 4); + + maxhlen = M_TRAILINGSPACE(n) - + (sizeof(*nip6) + sizeof(*nicmp6) + 4); + mtx_lock(>pr_mtx); + hlen = strlen(pr->pr_hostname); + if (maxhlen > hlen) + maxhlen = hlen; /* meaningless TTL */ bcopy(pr->pr_hostname, p + 4, maxhlen); mtx_unlock(>pr_mtx); @@ -1167,11 +1175,10 @@ icmp6_mtudisc_update(struct ip6ctlparam *ip6cp, int va * with hostname changes by sethostname(3) */ static struct mbuf * -ni6_input(struct mbuf *m, int off) +ni6_input(struct mbuf *m, int off, struct prison *pr) { struct icmp6_nodeinfo *ni6, *nni6; struct mbuf *n = NULL; - struct prison *pr; u_int16_t qtype; int subjlen; int replylen = sizeof(struct ip6_hdr) + sizeof(struct icmp6_nodeinfo); @@ -1323,7 +1330,6 @@ ni6_input(struct mbuf
Re: svn commit: r345400 - in head/libexec/rc: . rc.d
Cy Schubert wrote in <201903220130.x2m1uq0p042...@repo.freebsd.org>: cy> Author: cy cy> Date: Fri Mar 22 01:30:51 2019 cy> New Revision: 345400 cy> URL: https://svnweb.freebsd.org/changeset/base/345400 cy> cy> Log: cy> Add rc.d support for ippool(8). cy> cy> I've been using ippool at my site for approximately two years. It's cy> about time this was committed. cy> cy> PR: 218433 cy> MFC after:2 weeks cy> Added: head/libexec/rc/rc.d/ippool cy> == cy> --- /dev/null 00:00:00 1970 (empty, because file is newly added) cy> +++ head/libexec/rc/rc.d/ippool Fri Mar 22 01:30:51 2019 (r345400) cy> @@ -0,0 +1,40 @@ cy> +#!/bin/sh cy> +# cy> +# $FreeBSD$ cy> +# cy> + cy> +# PROVIDE: ippool cy> +# REQUIRE: FILESYSTEMS cy> +# BEFORE: ipfilter cy> +# KEYWORD: nojail cy> + cy> +. /etc/rc.subr cy> + cy> +name="ippool" cy> +desc="user interface to the IPFilter pools" cy> +rcvar="ippool_enable" cy> +load_rc_config $name cy> +start_cmd="ippool_start" cy> +stop_cmd="${ippool_program} -F" cy> +reload_cmd="ippool_reload" cy> +extra_commands="reload" cy> +required_files="${ippool_rules}" cy> +required_modules="ipl:ipfilter" cy> + cy> +ippool_start() cy> +{ cy> + if [ -r "${ippool_rules}" ]; then cy> + echo "Loading IP Pools." cy> + ${ippool_program} -f ${ippool_rules} ${ippool_flags} cy> + fi This conditional is redundant. $required_files will check readability of $ippool_rules. And if you want to add a flag, use of precmd is the right way like the following: start_precmd="ippool_start_precmd" ippool_start_precmd() { rc_flags="-f ${ippool_rules} ${rc_flags}" } -- Hiroki pgpFuxsVkUvCd.pgp Description: PGP signature
svn commit: r344788 - head/usr.sbin/rtadvctl
Author: hrs Date: Tue Mar 5 02:53:41 2019 New Revision: 344788 URL: https://svnweb.freebsd.org/changeset/base/344788 Log: Fix grammar. Submitted by: Massimiliano Stucchi Modified: head/usr.sbin/rtadvctl/rtadvctl.8 Modified: head/usr.sbin/rtadvctl/rtadvctl.8 == --- head/usr.sbin/rtadvctl/rtadvctl.8 Tue Mar 5 01:00:38 2019 (r344787) +++ head/usr.sbin/rtadvctl/rtadvctl.8 Tue Mar 5 02:53:41 2019 (r344788) @@ -40,7 +40,7 @@ daemon .Op Ar interface ... .Sh DESCRIPTION .Nm -is a utility that communicates with +is a utility that communicates with the .Xr rtadvd 8 daemon and displays information about Router Advertisement messages being sent on each interface. @@ -63,21 +63,22 @@ The subcommands are as follows: .Bl -tag -width indent .\" .It reload Op interfaces... -Specifies to reload the configuration file. If one or more -.Ar interface -is specified, configuration entries for the interfaces will be reloaded +Specifies to reload the configuration file. +If one or more +.Ar interfaces +are specified, configuration entries for the interfaces will be reloaded selectively. .It enable interfaces... -Specifies to mark the interface as enable and to try to reload the +Specifies to mark the interface as enabled and to tries to reload the configuration entry. This subcommand is useful for dynamically-added interfaces. .Pp The .Xr rtadvd 8 -daemon marks an interface as enable if the interface exists and the -configuration file has a valid entry for that when it is invoked. +daemon marks an interface as enabled if the interface exists and the +configuration file has a valid entry for it when it is invoked. .It disable interfaces... -Specifies to mark the interface as disable. +Specifies to mark the interface as disabled. .It shutdown Makes the .Xr rtadvd 8 @@ -88,7 +89,7 @@ daemon will send several RAs with zero lifetime to inv information on each interface. It will take at most nine seconds. .It show Op interfaces... -Displays information on Router Advertisement messages being sent +Displays information about the Router Advertisement messages being sent on each interface. .El .Sh SEE ALSO ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344739 - head/usr.sbin/syslogd
Author: hrs Date: Sun Mar 3 05:30:15 2019 New Revision: 344739 URL: https://svnweb.freebsd.org/changeset/base/344739 Log: Use struct addrinfo instead of struct sockaddr_storage to store peer addresses. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Sun Mar 3 03:42:51 2019 (r344738) +++ head/usr.sbin/syslogd/syslogd.c Sun Mar 3 05:30:15 2019 (r344739) @@ -187,7 +187,10 @@ struct peer { static STAILQ_HEAD(, peer) pqueue = STAILQ_HEAD_INITIALIZER(pqueue); struct socklist { - struct sockaddr_storage sl_ss; + struct addrinfo sl_ai; +#definesl_sa sl_ai.ai_addr +#definesl_salensl_ai.ai_addrlen +#definesl_family sl_ai.ai_family int sl_socket; struct peer *sl_peer; int (*sl_recv)(struct socklist *); @@ -377,7 +380,7 @@ struct iovlist; static int allowaddr(char *); static int addfile(struct filed *); static int addpeer(struct peer *); -static int addsock(struct sockaddr *, socklen_t, struct socklist *); +static int addsock(struct addrinfo *, struct socklist *); static struct filed *cfline(const char *, const char *, const char *); static const char *cvthname(struct sockaddr *); static voiddeadq_enter(pid_t, const char *); @@ -426,9 +429,9 @@ close_filed(struct filed *f) switch (f->f_type) { case F_FORW: - if (f->f_un.f_forw.f_addr) { - freeaddrinfo(f->f_un.f_forw.f_addr); - f->f_un.f_forw.f_addr = NULL; + if (f->fu_forw_addr != NULL) { + freeaddrinfo(f->fu_forw_addr); + f->fu_forw_addr = NULL; } /* FALLTHROUGH */ @@ -474,16 +477,23 @@ addpeer(struct peer *pe0) } static int -addsock(struct sockaddr *sa, socklen_t sa_len, struct socklist *sl0) +addsock(struct addrinfo *ai, struct socklist *sl0) { struct socklist *sl; - sl = calloc(1, sizeof(*sl)); + /* Copy *ai->ai_addr to the tail of struct socklist if any. */ + sl = calloc(1, sizeof(*sl) + ((ai != NULL) ? ai->ai_addrlen : 0)); if (sl == NULL) err(1, "malloc failed"); *sl = *sl0; - if (sa != NULL && sa_len > 0) - memcpy(>sl_ss, sa, sa_len); + if (ai != NULL) { + memcpy(>sl_ai, ai, sizeof(*ai)); + if (ai->ai_addrlen > 0) { + memcpy((sl + 1), ai->ai_addr, ai->ai_addrlen); + sl->sl_sa = (struct sockaddr *)(sl + 1); + } else + sl->sl_sa = NULL; + } STAILQ_INSERT_TAIL(, sl, next); return (0); @@ -665,7 +675,7 @@ main(int argc, char *argv[]) if (s < 0) { err(1, "cannot open a pipe for signals"); } else { - addsock(NULL, 0, &(struct socklist){ + addsock(NULL, &(struct socklist){ .sl_socket = sigpipe[0], .sl_recv = socklist_recv_signal }); @@ -676,7 +686,7 @@ main(int argc, char *argv[]) if (s < 0) { dprintf("can't open %s (%d)\n", _PATH_KLOG, errno); } else { - addsock(NULL, 0, &(struct socklist){ + addsock(NULL, &(struct socklist){ .sl_socket = s, .sl_recv = socklist_recv_file, }); @@ -848,7 +858,7 @@ socklist_recv_sock(struct socklist *sl) } /* Received valid data. */ line[len] = '\0'; - if (sl->sl_ss.ss_family == AF_LOCAL) + if (sl->sl_sa != NULL && sl->sl_family == AF_LOCAL) hname = LocalHostName; else { hname = cvthname(sa); @@ -1643,7 +1653,7 @@ fprintlog_write(struct filed *f, struct iovlist *il, i case F_FORW: /* Truncate messages to RFC 5426 recommended size. */ dprintf(" %s", f->fu_forw_hname); - switch (f->fu_forw_addr->ai_addr->sa_family) { + switch (f->fu_forw_addr->ai_family) { #ifdef INET case AF_INET: dprintf(":%d\n", @@ -1670,10 +1680,12 @@ fprintlog_write(struct filed *f, struct iovlist *il, i msghdr.msg_iov = il->iov; msghdr.msg_iovlen = il->iovcnt; STAILQ_FOREACH(sl, , next) { - if (sl->sl_ss.ss_family == AF_LOCAL || - sl->sl_ss.ss_family == AF_UNSPEC || - sl->sl_socket < 0) + if (sl->sl_socket < 0) continue; + if (sl->sl_sa !=
Re: svn commit: r336028 - head/usr.bin/top
Daichi GOTO wrote in <201807061207.w66c76cr043...@repo.freebsd.org>: da> Author: daichi da> Date: Fri Jul 6 12:07:06 2018 da> New Revision: 336028 da> URL: https://svnweb.freebsd.org/changeset/base/336028 da> da> Log: da> Changed to eliminate the upper limit of command length displayed da> by "-a" and expand to match terminal width da> da> Reviewed by: eadler da> Approved by: gnn (mentor) da> Differential Revision:https://reviews.freebsd.org/D16083 da> da> Modified: da> head/usr.bin/top/display.c da> head/usr.bin/top/machine.c da> head/usr.bin/top/screen.c da> head/usr.bin/top/top.h This change breaks displaying a prompt and messages in the interactive mode by new_message() when typing "o" or "p", for example. While r336031 fixed a warning in GCC, it does not fix the problem itself. Please fix it. I also think restructure of the buffer management is required first if we want to eliminate the column width limitation. Using sbuf(9) consistently may be better than incomplete conversion from static arrays to malloc(). -- Hiroki pgpAkI9L0NzU_.pgp Description: PGP signature
Re: svn commit: r335836 - head/usr.bin/top
Hiroki Sato wrote in <20180703.020956.859981414196673670@allbsd.org>: hr> 後藤大地 wrote hr> in <459bd898-8072-426e-a968-96c1382ac...@icloud.com>: hr> hr> da> hr> da> hr> da> > 2018/07/02 15:55、Hiroki Sato のメール: hr> da> > hr> da> > Eitan Adler wrote hr> da> > in : hr> da> > hr> da> > li> On 1 July 2018 at 10:08, Conrad Meyer wrote: hr> da> > li> > Hi Daichi, hr> da> > li> > hr> da> > li> > hr> da> > li> > hr> da> > li> > I don't think code to decode UTF-8 belongs in top(1). I don't know hr> da> > li> > what the goal of this routine is, but I doubt this is the right way to hr> da> > li> > accomplish it. hr> da> > li> hr> da> > li> For the record, I agree. This is why I didn't click "accept" on the hr> da> > li> revision. I don't fully oppose leaving it in top(1) for now as we work hr> da> > li> out the API, but long term its the wrong place. hr> da> > li> hr> da> > li> https://reviews.freebsd.org/D16058 is the review. hr> da> > hr> da> > I strongly object this kind of encoding-specific routine. Please hr> da> > back out it. The problem is that top(1) does not support multibyte hr> da> > encoding in functions for printing, and using C99 wide/multibyte hr> da> > character manipulation API such as iswprint(3) is the way to solve hr> da> > it. Doing getenv("LANG") and assuming an encoding based on it is a hr> da> > very bad practice to internationalize software. hr> da> > hr> da> > -- Hiroki hr> da> hr> da> I respect what you mean. hr> da> hr> da> Once I back out, I will begin implementing it in a different way. hr> da> Please advise which function should be used for implementation hr> da> (iswprint (3) and what other functions should be used?) hr> hr> Roughly speaking, POSIX/XPG/C99 I18N model requires the following hr> steps: (snip) Are you going to back out r335836, or disagree about it? If there is no objection in the next 24 hours, I will commit the attached patch. This should be a minimal change to support multibyte characters in ARGV array depending on LC_CTYPE, not limited to UTF-8. -- Hiroki Index: usr.bin/top/display.c === --- usr.bin/top/display.c (revision 335957) +++ usr.bin/top/display.c (working copy) @@ -1248,55 +1248,6 @@ } } -/* - * printable(str) - make the string pointed to by "str" into one that is - * printable (i.e.: all ascii), by converting all non-printable - * characters into '?'. Replacements are done in place and a pointer - * to the original buffer is returned. - */ - -char * -printable(char str[]) -{ - char *ptr; - char ch; - - ptr = str; - if (utf8flag) { - while ((ch = *ptr) != '\0') { - if (0x00 == (0x80 & ch)) { -if (!isprint(ch)) { - *ptr = '?'; -} -++ptr; - } else if (0xC0 == (0xE0 & ch)) { -++ptr; -if ('\0' != *ptr) ++ptr; - } else if (0xE0 == (0xF0 & ch)) { -++ptr; -if ('\0' != *ptr) ++ptr; -if ('\0' != *ptr) ++ptr; - } else if (0xF0 == (0xF8 & ch)) { -++ptr; -if ('\0' != *ptr) ++ptr; -if ('\0' != *ptr) ++ptr; -if ('\0' != *ptr) ++ptr; - } else { -*ptr = '?'; -++ptr; - } - } - } else { - while ((ch = *ptr) != '\0') { - if (!isprint(ch)) { -*ptr = '?'; - } - ptr++; - } - } - return(str); -} - void i_uptime(struct timeval *bt, time_t *tod) { Index: usr.bin/top/display.h === --- usr.bin/top/display.h (revision 335957) +++ usr.bin/top/display.h (working copy) @@ -11,7 +11,6 @@ void clear_message(void); int display_resize(void); void i_header(const char *text); -char *printable(char *string); void display_header(int t); int display_init(struct statics *statics); void i_arc(int *stats); Index: usr.bin/top/machine.c === --- usr.bin/top/machine.c (revision 335957) +++ usr.bin/top/machine.c (working copy) @@ -986,13 +986,8 @@ if (*src == '\0') continue; len = (argbuflen - (dst - argbuf) - 1) / 4; -if (utf8flag) { - utf8strvisx(dst, src, MIN(strlen(src), len)); -} else { - strvisx(dst, src, - MIN(strlen(src), len), - VIS_NL | VIS_CSTYLE); -} +strvisx(dst, src, MIN(strlen(src), len), +VIS_NL | VIS_CSTYLE | VIS_OCTAL); while (*dst != '\0') dst++; if ((argbuflen - (dst - argbuf) - 1) / 4 > 0) @@ -1089,7 +1084,7 @@ sbuf_printf(procbuf, "%6s ", format_time(cputime)); sbuf_printf(procbuf, "%6.2f%% ", ps.wcpu ? 100.0 * weig
svn commit: r335932 - head/sys/netinet
Author: hrs Date: Wed Jul 4 06:47:34 2018 New Revision: 335932 URL: https://svnweb.freebsd.org/changeset/base/335932 Log: - Fix a double unlock in inp_block_unblock_source() and lock leakage in inp_leave_group() which caused a panic. - Make order of CTR1() and IN_MULTI_LIST_LOCK() consistent around inm_merge(). Modified: head/sys/netinet/in_mcast.c Modified: head/sys/netinet/in_mcast.c == --- head/sys/netinet/in_mcast.c Wed Jul 4 03:54:39 2018(r335931) +++ head/sys/netinet/in_mcast.c Wed Jul 4 06:47:34 2018(r335932) @@ -1579,23 +1579,24 @@ inp_block_unblock_source(struct inpcb *inp, struct soc * Begin state merge transaction at IGMP layer. */ IN_MULTI_LOCK(); - IN_MULTI_LIST_LOCK(); CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); + IN_MULTI_LIST_LOCK(); error = inm_merge(inm, imf); if (error) { CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__); + IN_MULTI_LIST_UNLOCK(); goto out_in_multi_locked; } CTR1(KTR_IGMPV3, "%s: doing igmp downcall", __func__); error = igmp_change_state(inm); + IN_MULTI_LIST_UNLOCK(); if (error) CTR1(KTR_IGMPV3, "%s: failed igmp downcall", __func__); out_in_multi_locked: IN_MULTI_UNLOCK(); - IN_MULTI_UNLOCK(); out_imf_rollback: if (error) imf_rollback(imf); @@ -2492,6 +2493,7 @@ inp_leave_group(struct inpcb *inp, struct sockopt *sop if (error) { CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__); + IN_MULTI_LIST_UNLOCK(); goto out_in_multi_locked; } @@ -2736,12 +2738,12 @@ inp_set_source_filters(struct inpcb *inp, struct socko INP_WLOCK_ASSERT(inp); IN_MULTI_LOCK(); - IN_MULTI_LIST_LOCK(); /* * Begin state merge transaction at IGMP layer. */ CTR1(KTR_IGMPV3, "%s: merge inm state", __func__); + IN_MULTI_LIST_LOCK(); error = inm_merge(inm, imf); if (error) { CTR1(KTR_IGMPV3, "%s: failed to merge inm state", __func__); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r335836 - head/usr.bin/top
Jilles Tjoelker wrote in <20180703211002.ga11...@stack.nl>: ji> > 3. Print the multibyte characters by using strvisx(3) family, which ji> > supports multibyte character, or swprintf(3) family if you want to ji> > format wide characters directly. Note that buffer length for ji> > strvisx(3) must be calculated by using MB_LEN_MAX. ji> ji> In this case, calling setlocale() and then using strvisx() seems the ji> right solution. If locales differ across processes this may result in ji> mojibake but that cannot really be helped. Even analyzing other ji> processes' locale variables is not fully reliable, since strings may be ji> incorrectly encoded even in the process's real locale, environment ji> variables cannot be read across users and the environment block may be ji> overwritten by a program. ji> ji> In general, although using conversion to wide characters allows users a ji> lot of flexibility, I don't think it is the best in all situations: ji> ji> * The result of mbstowcs() is a UTF-32 string which consumes a lot of ji> memory. A loop with mbrtowc() may also be slow. Many operations can be ji> done directly on UTF-8 strings with no or little additional complexity ji> compared to byte strings. ji> ji> * If there is an invalid multibyte character, there is little ji> flexibility to handle this usefully and securely, since so little is ji> known about the encoding. The best handling may depend on the context. ji> ji> Therefore, in /bin/sh, I have only implemented multibyte support for ji> UTF-8. All other encodings have bytes treated as characters. ji> ji> However, I do agree that getenv("LANG") is bad. Instead, setlocale() ji> should be used. After that, nl_langinfo(CODESET) can be called and the ji> result compared to "UTF-8". Yes, I agree that using mb->wc conversion is not always the best and using strvisx() for cmdbuf, not only for argv, is enough in this case. I thought it was difficult to avoid iswprint() because I was not sure of the goal of r335836 and it looked to me that it aimed to keep the original printable() function. And as you mentioned it may not be worth to try to correctly detect/support locales in different processes, either. Probably one of the simplest ways would be that relying on LC_CTYPE+strvisx() and documenting how top(1) handles multibyte characters in the manual page. -- Hiroki pgpvYI6YWCefc.pgp Description: PGP signature
Re: svn commit: r335836 - head/usr.bin/top
後藤大地 wrote in <459bd898-8072-426e-a968-96c1382ac...@icloud.com>: da> da> da> > 2018/07/02 15:55、Hiroki Sato のメール: da> > da> > Eitan Adler wrote da> > in : da> > da> > li> On 1 July 2018 at 10:08, Conrad Meyer wrote: da> > li> > Hi Daichi, da> > li> > da> > li> > da> > li> > da> > li> > I don't think code to decode UTF-8 belongs in top(1). I don't know da> > li> > what the goal of this routine is, but I doubt this is the right way to da> > li> > accomplish it. da> > li> da> > li> For the record, I agree. This is why I didn't click "accept" on the da> > li> revision. I don't fully oppose leaving it in top(1) for now as we work da> > li> out the API, but long term its the wrong place. da> > li> da> > li> https://reviews.freebsd.org/D16058 is the review. da> > da> > I strongly object this kind of encoding-specific routine. Please da> > back out it. The problem is that top(1) does not support multibyte da> > encoding in functions for printing, and using C99 wide/multibyte da> > character manipulation API such as iswprint(3) is the way to solve da> > it. Doing getenv("LANG") and assuming an encoding based on it is a da> > very bad practice to internationalize software. da> > da> > -- Hiroki da> da> I respect what you mean. da> da> Once I back out, I will begin implementing it in a different way. da> Please advise which function should be used for implementation da> (iswprint (3) and what other functions should be used?) Roughly speaking, POSIX/XPG/C99 I18N model requires the following steps: 1. Call setlocale(LC_ALL, "") first. 2. Use mbs<->wcs and/or mb<->wc conversion functions in C95/C99 to manipulate characters and strings depending on what you want to do. The printable() function should use mbtowc(3) and iswprint(3), for example. And wcslen(3) should be used to determine the length of characters to be printed instead of strlen(). Note that if mbs->wcs or mb->wc conversion fails with EILSEQ at some point, some of the character(s) are invalid for printing. This can happen because command-line parameters in top(1) are not always encoded in one specified in LC_CTYPE or LANG. It should also be handled as non-printable. However, to make matters worse, each process does not always use a single, same locale as top(1). A process invoked with LANG=ja_JP.eucJP may have EUC-JP characters in its ARGV array even if top(1) runs by another user whose LANG is en_US.UTF-8. You have to determine which locale should be used before doing mb->wc conversion. It is not so simple. 3. Print the multibyte characters by using strvisx(3) family, which supports multibyte character, or swprintf(3) family if you want to format wide characters directly. Note that buffer length for strvisx(3) must be calculated by using MB_LEN_MAX. I recommend you to learn about I18N by reading the following documents since this involves an I18N programming model, not just a matter of which function should be used. While they are quite old and contain system-specific topics, they are still useful to understand general overview of how XPG4 and the relevant C95/C99 APIs work: [1] Developer's Guide to Internationalization (801-6660) https://docs.oracle.com/cd/E19457-01/801-6660/801-6660.pdf [2] Software Internationalization Guide (526225-002) https://support.hpe.com/hpsc/doc/public/display?docId=emr_na-c02131936 [3] ISO/IEC 9899:TC2 draft (p.204, Sec. 7.11 Localization) http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf [4] Internationalization Guide, Version 2 ISBN: 978-0133535419 -- Hiroki pgpDOusTGA7M1.pgp Description: PGP signature
Re: svn commit: r335836 - head/usr.bin/top
Eitan Adler wrote in : li> On 1 July 2018 at 10:08, Conrad Meyer wrote: li> > Hi Daichi, li> > li> > li> > li> > I don't think code to decode UTF-8 belongs in top(1). I don't know li> > what the goal of this routine is, but I doubt this is the right way to li> > accomplish it. li> li> For the record, I agree. This is why I didn't click "accept" on the li> revision. I don't fully oppose leaving it in top(1) for now as we work li> out the API, but long term its the wrong place. li> li> https://reviews.freebsd.org/D16058 is the review. I strongly object this kind of encoding-specific routine. Please back out it. The problem is that top(1) does not support multibyte encoding in functions for printing, and using C99 wide/multibyte character manipulation API such as iswprint(3) is the way to solve it. Doing getenv("LANG") and assuming an encoding based on it is a very bad practice to internationalize software. -- Hiroki pgp7xYnpPuj_n.pgp Description: PGP signature
svn commit: r331979 - vendor-crypto/heimdal/7.5.0
Author: hrs Date: Wed Apr 4 04:23:24 2018 New Revision: 331979 URL: https://svnweb.freebsd.org/changeset/base/331979 Log: Tag Heimdal 7.5.0. Added: vendor-crypto/heimdal/7.5.0/ - copied from r331978, vendor-crypto/heimdal/dist/ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r331980 - svnadmin/conf
Author: hrs Date: Wed Apr 4 04:26:21 2018 New Revision: 331980 URL: https://svnweb.freebsd.org/changeset/base/331980 Log: Remove myself because import of Heimdal 7.5.0 completed. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf == --- svnadmin/conf/sizelimit.confWed Apr 4 04:23:24 2018 (r331979) +++ svnadmin/conf/sizelimit.confWed Apr 4 04:26:21 2018 (r331980) @@ -18,7 +18,6 @@ achim bapt davidcs dim -hrs imp jb jeff ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r331977 - svnadmin/conf
Author: hrs Date: Wed Apr 4 04:20:39 2018 New Revision: 331977 URL: https://svnweb.freebsd.org/changeset/base/331977 Log: Add myself temporarily to import Heimdal 7.5.0. Modified: svnadmin/conf/sizelimit.conf Modified: svnadmin/conf/sizelimit.conf == --- svnadmin/conf/sizelimit.confWed Apr 4 02:37:05 2018 (r331976) +++ svnadmin/conf/sizelimit.confWed Apr 4 04:20:39 2018 (r331977) @@ -18,6 +18,7 @@ achim bapt davidcs dim +hrs imp jb jeff ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r331200 - svnadmin/conf
Author: hrs Date: Mon Mar 19 08:28:25 2018 New Revision: 331200 URL: https://svnweb.freebsd.org/changeset/base/331200 Log: Please welcome Vincenzo Maffione (vmaffione) as a new src committer. He will work on netmap framework. I (hrs) will be his mentor. Approved by: core (implicit) Modified: svnadmin/conf/access Modified: svnadmin/conf/access == --- svnadmin/conf/accessMon Mar 19 07:37:36 2018(r331199) +++ svnadmin/conf/accessMon Mar 19 08:28:25 2018(r331200) @@ -218,6 +218,7 @@ tychon ume uqs vangyzen +vmaffione whu will wma ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r331000 - head/lib/libc/net
Author: hrs Date: Thu Mar 15 13:46:28 2018 New Revision: 331000 URL: https://svnweb.freebsd.org/changeset/base/331000 Log: Make getnameinfo(3) salen requirement less strict and document details of salen in getnameinfo(3) manual page. getnameinfo(3) returned EAI_FAIL when salen was not equal to the length corresponding to the value specified by sa->sa_family. However, POSIX or RFC 3493 does not require it and RFC 4038 Sec.6.2.3 shows an example passing sizeof(struct sockaddr_storage) to salen. This change makes the requirement less strict by accepting salen up to sizeof(struct sockaddr_storage). It also includes two more changes: one is to fix return values because both SUSv4 and RFC 3493 require EAI_FAMILY when the address length is invalid, another is to fix sa_len dependency in PF_LOCAL. Pointed out by: Christophe Beauval Reviewed by: ae Differential Revision:https://reviews.freebsd.org/D14585 Modified: head/lib/libc/net/getnameinfo.3 head/lib/libc/net/getnameinfo.c Modified: head/lib/libc/net/getnameinfo.3 == --- head/lib/libc/net/getnameinfo.3 Thu Mar 15 13:07:15 2018 (r330999) +++ head/lib/libc/net/getnameinfo.3 Thu Mar 15 13:46:28 2018 (r331000) @@ -18,7 +18,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 28, 2016 +.Dd March 15, 2018 .Dt GETNAMEINFO 3 .Os .Sh NAME @@ -80,6 +80,20 @@ or UNIX-domain respectively that is .Fa salen bytes long. +If +.Fa salen +is shorter than the length corresponding to the specified +address family or longer than +.Fn sizeof "struct sockaddr_storage" , +it returns +.Er EAI_FAMILY . +Note that +.Va sa->sa_len +should be consistent with +.Fa salen +though the value of +.Va sa->sa_len +is not directly used in this function. .Pp The host and service names associated with .Fa sa Modified: head/lib/libc/net/getnameinfo.c == --- head/lib/libc/net/getnameinfo.c Thu Mar 15 13:07:15 2018 (r330999) +++ head/lib/libc/net/getnameinfo.c Thu Mar 15 13:46:28 2018 (r331000) @@ -124,26 +124,36 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen afd = find_afd(sa->sa_family); if (afd == NULL) return (EAI_FAMILY); + /* +* getnameinfo() accepts an salen of sizeof(struct sockaddr_storage) +* at maximum as shown in RFC 4038 Sec.6.2.3. +*/ + if (salen > sizeof(struct sockaddr_storage)) + return (EAI_FAMILY); + switch (sa->sa_family) { case PF_LOCAL: /* -* PF_LOCAL uses variable sa->sa_len depending on the +* PF_LOCAL uses variable salen depending on the * content length of sun_path. Require 1 byte in * sun_path at least. */ - if (salen > afd->a_socklen || - salen <= afd->a_socklen - + if (salen <= afd->a_socklen - sizeofmember(struct sockaddr_un, sun_path)) - return (EAI_FAIL); + return (EAI_FAMILY); + else if (salen > afd->a_socklen) + salen = afd->a_socklen; break; case PF_LINK: if (salen <= afd->a_socklen - sizeofmember(struct sockaddr_dl, sdl_data)) - return (EAI_FAIL); + return (EAI_FAMILY); break; default: - if (salen != afd->a_socklen) - return (EAI_FAIL); + if (salen < afd->a_socklen) + return (EAI_FAMILY); + else + salen = afd->a_socklen; break; } @@ -517,7 +527,7 @@ getnameinfo_un(const struct afd *afd, if (serv != NULL && servlen > 0) *serv = '\0'; if (host != NULL && hostlen > 0) { - pathlen = sa->sa_len - afd->a_off; + pathlen = salen - afd->a_off; if (pathlen + 1 > hostlen) { *host = '\0'; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r330442 - head/usr.sbin/rpcbind
Author: hrs Date: Mon Mar 5 03:38:31 2018 New Revision: 330442 URL: https://svnweb.freebsd.org/changeset/base/330442 Log: - Remove extra NULL check before free(). - Fix null pointer dereference in netbuffree() and use netbuffree() where applicable. Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c Modified: head/usr.sbin/rpcbind/rpcb_svc_com.c == --- head/usr.sbin/rpcbind/rpcb_svc_com.cMon Mar 5 03:34:01 2018 (r330441) +++ head/usr.sbin/rpcbind/rpcb_svc_com.cMon Mar 5 03:38:31 2018 (r330442) @@ -183,12 +183,9 @@ map_set(RPCB *regp, char *owner) a->r_addr = strdup(reg.r_addr); a->r_owner = strdup(owner); if (!a->r_addr || !a->r_netid || !a->r_owner) { - if (a->r_netid) - free(a->r_netid); - if (a->r_addr) - free(a->r_addr); - if (a->r_owner) - free(a->r_owner); + free(a->r_netid); + free(a->r_addr); + free(a->r_owner); free(rbl); return (FALSE); } @@ -372,11 +369,8 @@ rpcbproc_uaddr2taddr_com(void *arg, struct svc_req *rq static struct netbuf nbuf; static struct netbuf *taddr; - if (taddr) { - free(taddr->buf); - free(taddr); - taddr = NULL; - } + netbuffree(taddr); + taddr = NULL; if (((nconf = rpcbind_get_conf(transp->xp_netid)) == NULL) || ((taddr = uaddr2taddr(nconf, *uaddrp)) == NULL)) { (void) memset((char *), 0, sizeof (struct netbuf)); @@ -685,8 +679,7 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *tr (unsigned long)a.rmt_prog, (unsigned long)a.rmt_vers, (unsigned long)a.rmt_proc, transp->xp_netid, uaddr ? uaddr : "unknown"); - if (uaddr) - free(uaddr); + free(uaddr); } #endif @@ -730,8 +723,7 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *tr rbl->rpcb_map.r_addr, NULL); if (uaddr == NULL || uaddr[0] == '\0') { svcerr_noprog(transp); - if (uaddr != NULL) - free(uaddr); + free(uaddr); goto error; } free(uaddr); @@ -910,18 +902,11 @@ error: if (call_msg.rm_xid != 0) (void) free_slot_by_xid(call_msg.rm_xid); out: - if (local_uaddr) - free(local_uaddr); - if (buf_alloc) - free(buf_alloc); - if (outbuf_alloc) - free(outbuf_alloc); - if (na) { - free(na->buf); - free(na); - } - if (m_uaddr != NULL) - free(m_uaddr); + free(local_uaddr); + free(buf_alloc); + free(outbuf_alloc); + netbuffree(na); + free(m_uaddr); } /* @@ -1058,8 +1043,7 @@ netbuf_copybuf(struct netbuf *dst, const struct netbuf assert(src->len <= src->maxlen); if (dst->maxlen < src->len || dst->buf == NULL) { - if (dst->buf != NULL) - free(dst->buf); + free(dst->buf); if ((dst->buf = calloc(1, src->maxlen)) == NULL) return (FALSE); dst->maxlen = src->maxlen; @@ -1088,6 +1072,9 @@ netbufdup(struct netbuf *ap) static void netbuffree(struct netbuf *ap) { + + if (ap == NULL) + return; free(ap->buf); ap->buf = NULL; free(ap); @@ -1317,13 +1304,11 @@ handle_reply(int fd, SVCXPRT *xprt) fprintf(stderr, "handle_reply: forwarding address %s to %s\n", a.rmt_uaddr, uaddr ? uaddr : "unknown"); } - if (uaddr) - free(uaddr); + free(uaddr); #endif svc_sendreply(xprt, (xdrproc_t) xdr_rmtcall_result, (char *) ); done: - if (buffer) - free(buffer); + free(buffer); if (reply_msg.rm_xid == 0) { #ifdef SVC_RUN_DEBUG ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r330441 - head/usr.sbin/rpcbind
Author: hrs Date: Mon Mar 5 03:34:01 2018 New Revision: 330441 URL: https://svnweb.freebsd.org/changeset/base/330441 Log: Partially back out changes in r327464. stdlib.h is used when RPCBIND_DEBUG is enabled. Modified: head/usr.sbin/rpcbind/rpcb_svc.c Modified: head/usr.sbin/rpcbind/rpcb_svc.c == --- head/usr.sbin/rpcbind/rpcb_svc.cMon Mar 5 02:32:23 2018 (r330440) +++ head/usr.sbin/rpcbind/rpcb_svc.cMon Mar 5 03:34:01 2018 (r330441) @@ -48,6 +48,9 @@ #include #include #include +#ifdef RPCBIND_DEBUG +#include +#endif #include #include "rpcbind.h" ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r316874 - head/sys/kern
Maxim Sobolevwrote in : so> I've committed another fix for the syslogd code in question which should so> hopefully make it functional again. Peter, please let me know if you still so> having any issues. Thanks! I am sorry for being late and thank you for fixing the breakage in the refactored code. I tried not to change the original code path but it seemed I added some bugs. I will double-check and clean up them. -- Hiroki pgpBiulC5hA_P.pgp Description: PGP signature
svn commit: r315644 - head/usr.sbin/inetd
Author: hrs Date: Mon Mar 20 17:57:24 2017 New Revision: 315644 URL: https://svnweb.freebsd.org/changeset/base/315644 Log: Simplify a pipe for signal handling. Modified: head/usr.sbin/inetd/inetd.c Modified: head/usr.sbin/inetd/inetd.c == --- head/usr.sbin/inetd/inetd.c Mon Mar 20 17:46:33 2017(r315643) +++ head/usr.sbin/inetd/inetd.c Mon Mar 20 17:57:24 2017(r315644) @@ -214,7 +214,6 @@ __FBSDID("$FreeBSD$"); #endif static voidclose_sep(struct servtab *); static voidflag_signal(int); -static voidflag_config(int); static voidconfig(void); static int cpmip(const struct servtab *, int); static voidendconfig(void); @@ -224,11 +223,9 @@ static struct servtab *getconfigent(void static int matchservent(const char *, const char *, const char *); static char*nextline(FILE *); static voidaddchild(struct servtab *, int); -static voidflag_reapchild(int); static voidreapchild(void); static voidenable(struct servtab *); static voiddisable(struct servtab *); -static voidflag_retry(int); static voidretry(void); static int setconfig(void); static voidsetup(struct servtab *); @@ -532,17 +529,17 @@ main(int argc, char **argv) } #endif - sa.sa_flags = 0; + sa = (struct sigaction){ + .sa_flags = 0, + .sa_handler = flag_signal, + }; sigemptyset(_mask); sigaddset(_mask, SIGALRM); sigaddset(_mask, SIGCHLD); sigaddset(_mask, SIGHUP); - sa.sa_handler = flag_retry; sigaction(SIGALRM, , ); config(); - sa.sa_handler = flag_config; sigaction(SIGHUP, , ); - sa.sa_handler = flag_reapchild; sigaction(SIGCHLD, , ); sa.sa_handler = SIG_IGN; sigaction(SIGPIPE, , ); @@ -591,30 +588,34 @@ main(int argc, char **argv) } /* handle any queued signal flags */ if (FD_ISSET(signalpipe[0], )) { - int nsig; + int nsig, signo; + if (ioctl(signalpipe[0], FIONREAD, ) != 0) { - syslog(LOG_ERR, "ioctl: %m"); - exit(EX_OSERR); + syslog(LOG_ERR, "ioctl: %m"); + exit(EX_OSERR); } + nsig /= sizeof(signo); while (--nsig >= 0) { - char c; - if (read(signalpipe[0], , 1) != 1) { - syslog(LOG_ERR, "read: %m"); - exit(EX_OSERR); - } - if (debug) - warnx("handling signal flag %c", c); - switch(c) { - case 'A': /* sigalrm */ - retry(); - break; - case 'C': /* sigchld */ - reapchild(); - break; - case 'H': /* sighup */ - config(); - break; - } + size_t len; + + len = read(signalpipe[0], , sizeof(signo)); + if (len != sizeof(signo)) { + syslog(LOG_ERR, "read: %m"); + exit(EX_OSERR); + } + if (debug) + warnx("handling signal flag %d", signo); + switch (signo) { + case SIGALRM: + retry(); + break; + case SIGCHLD: + reapchild(); + break; + case SIGHUP: + config(); + break; + } } } for (sep = servtab; n && sep; sep = sep->se_next) @@ -900,11 +901,12 @@ main(int argc, char **argv) */ static void -flag_signal(int c) +flag_signal(int signo) { - char ch = c; + size_t len; - if (write(signalpipe[1], , 1) != 1) { + len = write(signalpipe[1], , sizeof(signo)); + if (len != sizeof(signo)) { syslog(LOG_ERR, "write: %m"); _exit(EX_OSERR); } @@ -932,16 +934,6 @@ addchild(struct servtab *sep, pid_t pid) disable(sep); } -/* - * Some child process has exited. See if it's on somebody's list. - */ - -static void -flag_reapchild(int signo __unused) -{ - flag_signal('C'); -} - static void reapchild(void) { @@ -981,12 +973,6 @@ reapchild(void) } static void -flag_config(int signo __unused) -{ - flag_signal('H'); -} - -static void config(void) { struct servtab *sep, *new, **sepp; @@ -1250,12 +1236,6 @@ unregisterrpc(struct servtab *sep) } static void -flag_retry(int
svn commit: r315643 - head/usr.sbin/syslogd
Author: hrs Date: Mon Mar 20 17:46:33 2017 New Revision: 315643 URL: https://svnweb.freebsd.org/changeset/base/315643 Log: Fix a regression which prevented an IPv6 address in a -b option from working. PR: 217939 Differential Revision:https://reviews.freebsd.org/D10064 Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Mon Mar 20 17:26:13 2017 (r315642) +++ head/usr.sbin/syslogd/syslogd.c Mon Mar 20 17:46:33 2017 (r315643) @@ -477,7 +477,15 @@ main(int argc, char *argv[]) break; case 'b': bflag = 1; - if ((p = strchr(optarg, ':')) == NULL) { + p = strchr(optarg, ']'); + if (p != NULL) + p = strchr(p + 1, ':'); + else { + p = strchr(optarg, ':'); + if (p != NULL && strchr(p + 1, ':') != NULL) + p = NULL; /* backward compatibility */ + } + if (p == NULL) { /* A hostname or filename only. */ addpeer(&(struct peer){ .pe_name = optarg, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r314585 - head/usr.sbin/syslogd
"Ngie Cooper (yaneurabeya)"wrote in <1a3f6606-822c-4c80-adfa-48378f0f2...@gmail.com>: ya> >> How about "...accepts UDP packets sent with any source port" or ya> >> something? ya> > ya> > Yeah, that’s more accurate. ya> ya> How about this? ya> -Ngie ya> ya> $ svn diff usr.sbin/syslogd/syslogd.8 ya> Index: usr.sbin/syslogd/syslogd.8 ya> === ya> --- usr.sbin/syslogd/syslogd.8 (revision 314585) ya> +++ usr.sbin/syslogd/syslogd.8 (working copy) ya> @@ -131,7 +131,7 @@ ya> .Ar service ya> of ya> .Ql \&* ya> -allows packets to be received from any UDP port. ya> +allows UDP packets to be sent with any source port. ya> The default ya> .Ar service ya> is Looks good to me though probably I am not the best person who can judge an English expression as good or bad... -- Hiroki pgptbGS8_7fUY.pgp Description: PGP signature
Re: svn commit: r314585 - head/usr.sbin/syslogd
Ngie Cooperwrote in <201703030613.v236dxdl010...@repo.freebsd.org>: ng> Author: ngie ng> Date: Fri Mar 3 06:13:59 2017 ng> New Revision: 314585 ng> URL: https://svnweb.freebsd.org/changeset/base/314585 ng> ng> Log: ng> Correct verb change for service => `*` after r314563 ng> ng> `*` means that packets will be received from a remote peer on any port. ng> Since the point of interest is the syslogd instance (not the remote peer), ng> the appropriate verb is "received", not "sent". ng> ng> MFC after:1 month ng> X-MFC with: r314563 ng> Sponsored by: Dell EMC Isilon ng> ng> Modified: ng> head/usr.sbin/syslogd/syslogd.8 ng> ng> Modified: head/usr.sbin/syslogd/syslogd.8 ng> == ng> --- head/usr.sbin/syslogd/syslogd.8 Fri Mar 3 06:06:27 2017 (r314584) ng> +++ head/usr.sbin/syslogd/syslogd.8 Fri Mar 3 06:13:59 2017 (r314585) ng> @@ -131,7 +131,7 @@ A ng> .Ar service ng> of ng> .Ql \&* ng> -allows packets to be sent from any UDP port. ng> +allows packets to be received from any UDP port. ng> The default ng> .Ar service It is incorrect that syslogd receives a UDP packet on any local port when a "*" is specified. This address validation is done by using the source port number in a received UDP packet, so the point of interest is the remote peer. How about "...accepts UDP packets sent with any source port" or something? -- Hiroki pgpBKxACae67w.pgp Description: PGP signature
Re: svn commit: r314471 - head/sys/net
Warner Loshwrote in <201703010447.v214lm4c026...@repo.freebsd.org>: im> Author: imp im> Date: Wed Mar 1 04:47:22 2017 im> New Revision: 314471 im> URL: https://svnweb.freebsd.org/changeset/base/314471 im> im> Log: im> Fix VNET - DAD detected duplicate IPv6 address im> im> Assign a hopefully unique, locally administered etheraddr. - for im> epairNa & epairNb im> im> Submitted by: Catalin im> Pull Request: https://github.com/freebsd/freebsd/pull/92 This was discussed in D1858. epairNa and epairNb never have the same L2 addr because eaddr[5] is unique. If the goal of this change is to prevent a conflict of L2 addrs with epairNs created in another vnet jail on the same system or on the same network, eaddr[5] of epairNa (around l.839) must also be randomized at least. While I am still for a deterministic value because changing the L2 addr every time when rebooting a vnet jail is annoying, but if we use some random numbers for the vendor bits, I think eaddr[2] should be initialized in the same way. -- Hiroki pgpNekCoBbJhf.pgp Description: PGP signature
svn commit: r312921 - head/usr.sbin/syslogd
Author: hrs Date: Sat Jan 28 13:09:18 2017 New Revision: 312921 URL: https://svnweb.freebsd.org/changeset/base/312921 Log: Fix a bug which caused not to create AF_LOCAL sockets when family is specified. Spotted by: Alex Deiter Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Sat Jan 28 12:43:19 2017 (r312920) +++ head/usr.sbin/syslogd/syslogd.c Sat Jan 28 13:09:18 2017 (r312921) @@ -2908,7 +2908,8 @@ socksetup(struct peer *pe) /* Only AF_LOCAL in secure mode. */ continue; } - if (family != AF_UNSPEC && res->ai_family != family) + if (family != AF_UNSPEC && + res->ai_family != AF_LOCAL && res->ai_family != family) continue; s = socket(res->ai_family, res->ai_socktype, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312018 - head/usr.sbin/route6d
Author: hrs Date: Fri Jan 13 08:01:27 2017 New Revision: 312018 URL: https://svnweb.freebsd.org/changeset/base/312018 Log: Purge varargs.h in favor of stdarg.h. Modified: head/usr.sbin/route6d/route6d.c Modified: head/usr.sbin/route6d/route6d.c == --- head/usr.sbin/route6d/route6d.c Fri Jan 13 07:24:58 2017 (r312017) +++ head/usr.sbin/route6d/route6d.c Fri Jan 13 08:01:27 2017 (r312018) @@ -57,11 +57,7 @@ static const char _rcsid[] = "$KAME: rou #endif #include #include -#ifdef __STDC__ #include -#else -#include -#endif #include #include #include @@ -203,7 +199,6 @@ static volatile sig_atomic_t seenusr1; #define RRTF_SENDANYWAY0x4000 #defineRRTF_CHANGED0x8000 -int main(int, char **); static void sighandler(int); static void ripalarm(void); static void riprecv(void); @@ -3457,22 +3452,12 @@ ripsuptrig(void) #endif static void -#ifdef __STDC__ fatal(const char *fmt, ...) -#else -fatal(fmt, va_alist) - char*fmt; - va_dcl -#endif { va_list ap; char buf[1024]; -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif vsnprintf(buf, sizeof(buf), fmt, ap); va_end(ap); perror(buf); @@ -3484,33 +3469,18 @@ fatal(fmt, va_alist) } static void -#ifdef __STDC__ tracet(int level, const char *fmt, ...) -#else -tracet(level, fmt, va_alist) - int level; - char *fmt; - va_dcl -#endif { va_list ap; if (level <= dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif fprintf(stderr, "%s: ", hms()); vfprintf(stderr, fmt, ap); va_end(ap); } if (dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif if (level > 0) vsyslog(LOG_DEBUG, fmt, ap); else @@ -3520,32 +3490,17 @@ tracet(level, fmt, va_alist) } static void -#ifdef __STDC__ trace(int level, const char *fmt, ...) -#else -trace(level, fmt, va_alist) - int level; - char *fmt; - va_dcl -#endif { va_list ap; if (level <= dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif vfprintf(stderr, fmt, ap); va_end(ap); } if (dflag) { -#ifdef __STDC__ va_start(ap, fmt); -#else - va_start(ap); -#endif if (level > 0) vsyslog(LOG_DEBUG, fmt, ap); else ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r312013 - head/usr.sbin/route6d
Author: hrs Date: Fri Jan 13 06:22:49 2017 New Revision: 312013 URL: https://svnweb.freebsd.org/changeset/base/312013 Log: - Add static for functions and variables with internal linkage. - Quiet down -Wcast-align warnings. - Remove dead code. There is no functionality change. Modified: head/usr.sbin/route6d/route6d.c Modified: head/usr.sbin/route6d/route6d.c == --- head/usr.sbin/route6d/route6d.c Fri Jan 13 04:21:09 2017 (r312012) +++ head/usr.sbin/route6d/route6d.c Fri Jan 13 06:22:49 2017 (r312013) @@ -100,7 +100,7 @@ struct ifc {/* Configuration of an in TAILQ_HEAD(, iff) ifc_iff_head; /* list of filters */ int ifc_joined; /* joined to ff02::9 */ }; -TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head); +static TAILQ_HEAD(, ifc) ifc_head = TAILQ_HEAD_INITIALIZER(ifc_head); struct ifac { /* Adddress associated to an interface */ TAILQ_ENTRY(ifac) ifac_next; @@ -120,21 +120,21 @@ struct iff { /* Filters for an interfa int iff_plen; }; -struct ifc **index2ifc; -unsigned int nindex2ifc; -struct ifc *loopifcp = NULL; /* pointing to loopback */ +static struct ifc **index2ifc; +static unsigned intnindex2ifc; +static struct ifc *loopifcp = NULL; /* pointing to loopback */ #ifdef HAVE_POLL_H -struct pollfd set[2]; +static struct pollfd set[2]; #else -fd_set *sockvecp; /* vector to select() for receiving */ -fd_set *recvecp; -intfdmasks; -intmaxfd; /* maximum fd for select() */ +static fd_set *sockvecp; /* vector to select() for receiving */ +static fd_set *recvecp; +static int fdmasks; +static int maxfd; /* maximum fd for select() */ #endif -intrtsock; /* the routing socket */ -intripsock;/* socket to send/receive RIP datagram */ +static int rtsock; /* the routing socket */ +static int ripsock;/* socket to send/receive RIP datagram */ -struct rip6 *ripbuf; /* packet buffer for sending */ +static struct rip6 *ripbuf; /* packet buffer for sending */ /* * Maintain the routes in a linked list. When the number of the routes @@ -159,41 +159,43 @@ struct riprt { time_t rrt_t; /* when the route validated */ int rrt_index; /* ifindex from which this route got */ }; -TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head); +static TAILQ_HEAD(, riprt) riprt_head = TAILQ_HEAD_INITIALIZER(riprt_head); -intdflag = 0; /* debug flag */ -intqflag = 0; /* quiet flag */ -intnflag = 0; /* don't update kernel routing table */ -intaflag = 0; /* age out even the statically defined routes */ -inthflag = 0; /* don't split horizon */ -intlflag = 0; /* exchange site local routes */ -intPflag = 0; /* don't age out routes with RTF_PROTO[123] */ -intQflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */ -intsflag = 0; /* announce static routes w/ split horizon */ -intSflag = 0; /* announce static routes to every interface */ -unsigned long routetag = 0;/* route tag attached on originating case */ - -char *filter[MAXFILTER]; -intfiltertype[MAXFILTER]; -intnfilter = 0; - -pid_t pid; - -struct sockaddr_storage ripsin; - -intinterval = 1; -time_t nextalarm = 0; -time_t sup_trig_update = 0; +static int dflag = 0; /* debug flag */ +static int qflag = 0; /* quiet flag */ +static int nflag = 0; /* don't update kernel routing table */ +static int aflag = 0; /* age out even the statically defined routes */ +static int hflag = 0; /* don't split horizon */ +static int lflag = 0; /* exchange site local routes */ +static int Pflag = 0; /* don't age out routes with RTF_PROTO[123] */ +static int Qflag = RTF_PROTO2; /* set RTF_PROTO[123] flag to routes by RIPng */ +static int sflag = 0; /* announce static routes w/ split horizon */ +static int Sflag = 0; /* announce static routes to every interface */ +static unsigned long routetag = 0; /* route tag attached on originating case */ + +static char*filter[MAXFILTER]; +static int filtertype[MAXFILTER]; +static int nfilter = 0; -FILE *rtlog = NULL; +static pid_t pid; -int logopened = 0; +static struct sockaddr_storage ripsin; + +static int interval = 1; +static time_t nextalarm = 0; +#if 0 +static time_t sup_trig_update = 0; +#endif + +static FILE*rtlog = NULL; + +static int logopened = 0; static int seq = 0; -volatile sig_atomic_t seenalrm; -volatile sig_atomic_t seenquit; -volatile sig_atomic_t seenusr1; +static volatile sig_atomic_t seenalrm; +static volatile sig_atomic_t seenquit; +static volatile sig_atomic_t
svn commit: r311994 - head/usr.sbin/route6d
Author: hrs Date: Thu Jan 12 18:44:58 2017 New Revision: 311994 URL: https://svnweb.freebsd.org/changeset/base/311994 Log: - Fix dereference of NULL pointer which could cause a crash [1] - Fix memory leak due to lack of freeaddrinfo() [2] CID: 1018281 [1] CID: 1225057 [2] MFC after:3 days Modified: head/usr.sbin/route6d/route6d.c Modified: head/usr.sbin/route6d/route6d.c == --- head/usr.sbin/route6d/route6d.c Thu Jan 12 18:05:12 2017 (r311993) +++ head/usr.sbin/route6d/route6d.c Thu Jan 12 18:44:58 2017 (r311994) @@ -684,6 +684,7 @@ init(void) /*NOTREACHED*/ } #endif + freeaddrinfo(res); memset(, 0, sizeof(hints)); hints.ai_family = PF_INET6; @@ -699,6 +700,7 @@ init(void) /*NOTREACHED*/ } memcpy(, res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); #ifdef HAVE_POLL_H set[0].fd = ripsock; @@ -788,10 +790,17 @@ ripflush(struct ifc *ifcp, struct sockad error = sendpacket(sin6, RIPSIZE(nrt)); if (error == EAFNOSUPPORT) { /* Protocol not supported */ - tracet(1, "Could not send info to %s (%s): " - "set IFF_UP to 0\n", - ifcp->ifc_name, inet6_n2p(>ifc_ripsin.sin6_addr)); - ifcp->ifc_flags &= ~IFF_UP; /* As if down for AF_INET6 */ + if (ifcp != NULL) { + tracet(1, "Could not send info to %s (%s): " + "set IFF_UP to 0\n", + ifcp->ifc_name, + inet6_n2p(>ifc_ripsin.sin6_addr)); + /* As if down for AF_INET6 */ + ifcp->ifc_flags &= ~IFF_UP; + } else { + tracet(1, "Could not send info to %s\n", + inet6_n2p(>sin6_addr)); + } } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r311918 - head/usr.sbin/syslogd
Author: hrs Date: Wed Jan 11 07:21:59 2017 New Revision: 311918 URL: https://svnweb.freebsd.org/changeset/base/311918 Log: Add more #ifdef INET and INET6. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Wed Jan 11 07:17:03 2017 (r311917) +++ head/usr.sbin/syslogd/syslogd.c Wed Jan 11 07:21:59 2017 (r311918) @@ -89,9 +89,11 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(INET) || defined(INET6) #include -#include #include +#endif +#include #include #include @@ -127,8 +129,11 @@ static const char include_ext[] = ".conf #defineMAXUNAMES 20 /* maximum number of user names */ #definesstosa(ss) ((struct sockaddr *)(ss)) +#ifdef INET #definesstosin(ss) ((struct sockaddr_in *)(void *)(ss)) #definesatosin(sa) ((struct sockaddr_in *)(void *)(sa)) +#endif +#ifdef INET6 #definesstosin6(ss)((struct sockaddr_in6 *)(void *)(ss)) #definesatosin6(sa)((struct sockaddr_in6 *)(void *)(sa)) #defines6_addr32 __u6_addr.__u6_addr32 @@ -137,6 +142,7 @@ static const char include_ext[] = ".conf (((d)->s6_addr32[1] ^ (a)->s6_addr32[1]) & (m)->s6_addr32[1]) == 0 && \ (((d)->s6_addr32[2] ^ (a)->s6_addr32[2]) & (m)->s6_addr32[2]) == 0 && \ (((d)->s6_addr32[3] ^ (a)->s6_addr32[3]) & (m)->s6_addr32[3]) == 0 ) +#endif /* * List of peers and sockets for binding. */ @@ -1305,10 +1311,12 @@ fprintlog(struct filed *f, int flags, co case F_FORW: dprintf(" %s", f->fu_forw_hname); switch (f->fu_forw_addr->ai_addr->sa_family) { +#ifdef INET case AF_INET: dprintf(":%d\n", ntohs(satosin(f->fu_forw_addr->ai_addr)->sin_port)); break; +#endif #ifdef INET6 case AF_INET6: dprintf(":%d\n", @@ -1929,7 +1937,20 @@ init(int signo) break; case F_FORW: - port = ntohs(satosin(f->fu_forw_addr->ai_addr)->sin_port); + switch (f->fu_forw_addr->ai_addr->sa_family) { +#ifdef INET + case AF_INET: + port = ntohs(satosin(f->fu_forw_addr->ai_addr)->sin_port); + break; +#endif +#ifdef INET6 + case AF_INET6: + port = ntohs(satosin6(f->fu_forw_addr->ai_addr)->sin6_port); + break; +#endif + default: + port = 0; + } if (port != 514) { printf("%s:%d", f->fu_forw_hname, port); @@ -2410,6 +2431,7 @@ timedout(int sig __unused) static int allowaddr(char *s) { +#if defined(INET) || defined(INET6) char *cp1, *cp2; struct allowedpeer *ap; struct servent *se; @@ -2571,6 +2593,7 @@ allowaddr(char *s) } printf("port = %d\n", ap->port); } +#endif return (0); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r311354 - head/usr.sbin/inetd
Author: hrs Date: Thu Jan 5 03:25:16 2017 New Revision: 311354 URL: https://svnweb.freebsd.org/changeset/base/311354 Log: Fix build when WITHOUT_INET6 is defined. Modified: head/usr.sbin/inetd/inetd.c Modified: head/usr.sbin/inetd/inetd.c == --- head/usr.sbin/inetd/inetd.c Thu Jan 5 03:20:00 2017(r311353) +++ head/usr.sbin/inetd/inetd.c Thu Jan 5 03:25:16 2017(r311354) @@ -315,9 +315,11 @@ whichaf(struct request_info *req) sa = (struct sockaddr *)req->client->sin; if (sa == NULL) return AF_UNSPEC; +#ifdef INET6 if (sa->sa_family == AF_INET6 && IN6_IS_ADDR_V4MAPPED((sa)->sin6_addr)) return AF_INET; +#endif return sa->sa_family; } @@ -1283,6 +1285,7 @@ setsockopt(fd, SOL_SOCKET, opt, (char *) syslog(LOG_ERR, "setsockopt (SO_PRIVSTATE): %m"); #endif /* tftpd opens a new connection then needs more infos */ +#ifdef INET6 if ((sep->se_family == AF_INET6) && (strcmp(sep->se_proto, "udp") == 0) && (sep->se_accept == 0) && @@ -1295,6 +1298,7 @@ setsockopt(fd, SOL_SOCKET, opt, (char *) (char *), sizeof (flag)) < 0) syslog(LOG_ERR, "setsockopt (IPV6_V6ONLY): %m"); } +#endif #undef turnon #ifdef IPSEC ipsecsetup(sep); @@ -1332,7 +1336,9 @@ setsockopt(fd, SOL_SOCKET, opt, (char *) u_int i; socklen_t len = sep->se_ctrladdr_size; struct netconfig *netid, *netid2 = NULL; +#ifdef INET6 struct sockaddr_in sock; +#endif struct netbuf nbuf, nbuf2; if (getsockname(sep->se_fd, @@ -1347,6 +1353,7 @@ setsockopt(fd, SOL_SOCKET, opt, (char *) nbuf.len = sep->se_ctrladdr.sa_len; if (sep->se_family == AF_INET) netid = sep->se_socktype==SOCK_DGRAM? udpconf:tcpconf; +#ifdef INET6 else { netid = sep->se_socktype==SOCK_DGRAM? udp6conf:tcp6conf; if (!sep->se_nomapped) { /* INET and INET6 */ @@ -1358,6 +1365,7 @@ setsockopt(fd, SOL_SOCKET, opt, (char *) sock.sin_port = sep->se_ctrladdr6.sin6_port; } } +#endif if (debug) print_service("REG ", sep); for (i = sep->se_rpc_lowvers; i <= sep->se_rpc_highvers; i++) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r310974 - head/usr.sbin/syslogd
Author: hrs Date: Sat Dec 31 13:15:52 2016 New Revision: 310974 URL: https://svnweb.freebsd.org/changeset/base/310974 Log: - Use more descriptive names for variables. - Set O_CLOEXEC to the signal pipe and /dev/klog. - Use a single signal handler to catch both SIGHUP and SIGCHLD. - Fix a bug which did FD_SET() the writer-end of the pipe. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Sat Dec 31 13:10:08 2016 (r310973) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 31 13:15:52 2016 (r310974) @@ -321,7 +321,7 @@ static int LogFacPri; /* Put facility an static int KeepKernFac;/* Keep remotely logged kernel facility */ static int needdofsync = 0; /* Are any file(s) waiting to be fsynced? */ static struct pidfh *pfh; -static int sigp[2];/* Pipe to catch a signal during select(). */ +static int sigpipe[2]; /* Pipe to catch a signal during select(). */ static volatile sig_atomic_t MarkSet, WantDie, WantInitialize, WantReapchild; @@ -341,7 +341,6 @@ static void dofsync(void); static voiddomark(int); static voidfprintlog(struct filed *, int, const char *); static voidinit(int); -static voidinit_sh(int); static voidlogerror(const char *); static voidlogmsg(int, const char *, const char *, int); static voidlog_deadchild(pid_t, int, const char *); @@ -350,12 +349,12 @@ static intsocksetup(struct peer *); static int socklist_recv_file(struct socklist *); static int socklist_recv_sock(struct socklist *); static int socklist_recv_signal(struct socklist *); +static voidsighandler(int); static int skip_message(const char *, const char *, int); static voidprintline(const char *, char *, int); static voidprintsys(char *); static int p_open(const char *, pid_t *); static voidreapchild(int); -static voidreapchild_sh(int); static const char *ttymsg_check(struct iovec *, int, char *, int); static voidusage(void); static int validate(struct sockaddr *, const char *); @@ -582,18 +581,18 @@ main(int argc, char *argv[]) usage(); /* Pipe to catch a signal during select(). */ - s = pipe2(sigp, O_NONBLOCK); + s = pipe2(sigpipe, O_CLOEXEC); if (s < 0) { err(1, "cannot open a pipe for signals"); } else { addsock(NULL, 0, &(struct socklist){ - .sl_socket = sigp[1], + .sl_socket = sigpipe[0], .sl_recv = socklist_recv_signal }); } /* Listen by default: /dev/klog. */ - s = open(_PATH_KLOG, O_RDONLY|O_NONBLOCK, 0); + s = open(_PATH_KLOG, O_RDONLY | O_NONBLOCK | O_CLOEXEC, 0); if (s < 0) { dprintf("can't open %s (%d)\n", _PATH_KLOG, errno); } else { @@ -646,8 +645,8 @@ main(int argc, char *argv[]) (void)signal(SIGTERM, dodie); (void)signal(SIGINT, Debug ? dodie : SIG_IGN); (void)signal(SIGQUIT, Debug ? dodie : SIG_IGN); - (void)signal(SIGHUP, init_sh); - (void)signal(SIGCHLD, reapchild_sh); + (void)signal(SIGHUP, sighandler); + (void)signal(SIGCHLD, sighandler); (void)signal(SIGALRM, domark); (void)signal(SIGPIPE, SIG_IGN); /* We'll catch EPIPE instead. */ (void)alarm(TIMERINTVL); @@ -717,12 +716,31 @@ static int socklist_recv_signal(struct socklist *sl __unused) { ssize_t len; - static char buf[BUFSIZ]; - - /* Clear an wake-up signal by reading dummy data. */ - while ((len = read(sigp[0], buf, sizeof(buf))) > 0) - ; + int i, nsig, signo; + if (ioctl(sigpipe[0], FIONREAD, ) != 0) { + logerror("ioctl(FIONREAD)"); + err(1, "signal pipe read failed"); + } + nsig = i / sizeof(signo); + dprintf("# of received signals = %d\n", nsig); + for (i = 0; i < nsig; i++) { + len = read(sigpipe[0], , sizeof(signo)); + if (len != sizeof(signo)) { + logerror("signal pipe read failed"); + err(1, "signal pipe read failed"); + } + dprintf("Received signal: %d from fd=%d\n", signo, + sigpipe[0]); + switch (signo) { + case SIGHUP: + WantInitialize = 1; + break; + case SIGCHLD: + WantReapchild = 1; + break; + } + } return (0); } @@ -1512,17 +1530,6 @@ ttymsg_check(struct iovec *iov, int iovc } static void -reapchild_sh(int signo) -{ - static char buf[BUFSIZ]; - - WantReapchild = signo; - /* Send an wake-up signal to the select() loop. */ -
svn commit: r310921 - head/usr.sbin/inetd
Author: hrs Date: Sat Dec 31 11:03:34 2016 New Revision: 310921 URL: https://svnweb.freebsd.org/changeset/base/310921 Log: - Add static for symbols which need not to be exported. - Clean up warnings to the WARNS=6 level. Modified: head/usr.sbin/inetd/builtins.c head/usr.sbin/inetd/inetd.c head/usr.sbin/inetd/inetd.h Modified: head/usr.sbin/inetd/builtins.c == --- head/usr.sbin/inetd/builtins.c Sat Dec 31 11:02:33 2016 (r310920) +++ head/usr.sbin/inetd/builtins.c Sat Dec 31 11:03:34 2016 (r310921) @@ -52,25 +52,24 @@ __FBSDID("$FreeBSD$"); #include "inetd.h" -void chargen_dg(int, struct servtab *); -void chargen_stream(int, struct servtab *); -void daytime_dg(int, struct servtab *); -void daytime_stream(int, struct servtab *); -void discard_dg(int, struct servtab *); -void discard_stream(int, struct servtab *); -void echo_dg(int, struct servtab *); -void echo_stream(int, struct servtab *); +static voidchargen_dg(int, struct servtab *); +static voidchargen_stream(int, struct servtab *); +static voiddaytime_dg(int, struct servtab *); +static voiddaytime_stream(int, struct servtab *); +static voiddiscard_dg(int, struct servtab *); +static voiddiscard_stream(int, struct servtab *); +static voidecho_dg(int, struct servtab *); +static voidecho_stream(int, struct servtab *); static int get_line(int, char *, int); -void iderror(int, int, int, const char *); -void ident_stream(int, struct servtab *); -void initring(void); -uint32_t machtime(void); -void machtime_dg(int, struct servtab *); -void machtime_stream(int, struct servtab *); - -char ring[128]; -char *endring; +static voididerror(int, int, int, const char *); +static voidident_stream(int, struct servtab *); +static voidinitring(void); +static uint32_tmachtime(void); +static voidmachtime_dg(int, struct servtab *); +static voidmachtime_stream(int, struct servtab *); +static char ring[128]; +static char *endring; struct biltin biltins[] = { /* Echo received data */ @@ -105,7 +104,7 @@ struct biltin biltins[] = { * any regard for input. */ -void +static void initring(void) { int i; @@ -122,7 +121,7 @@ initring(void) * characters chosen from the range 0 to 512. We send LINESIZ+2. */ /* ARGSUSED */ -void +static void chargen_dg(int s, struct servtab *sep) { struct sockaddr_storage ss; @@ -159,7 +158,7 @@ chargen_dg(int s, struct servtab *sep) /* Character generator */ /* ARGSUSED */ -void +static void chargen_stream(int s, struct servtab *sep) { int len; @@ -196,7 +195,7 @@ chargen_stream(int s, struct servtab *se /* Return human-readable time of day */ /* ARGSUSED */ -void +static void daytime_dg(int s, struct servtab *sep) { char buffer[256]; @@ -221,7 +220,7 @@ daytime_dg(int s, struct servtab *sep) /* Return human-readable time of day */ /* ARGSUSED */ -void +static void daytime_stream(int s, struct servtab *sep __unused) { char buffer[256]; @@ -240,7 +239,7 @@ daytime_stream(int s, struct servtab *se /* Discard service -- ignore data */ /* ARGSUSED */ -void +static void discard_dg(int s, struct servtab *sep __unused) { char buffer[BUFSIZE]; @@ -250,7 +249,7 @@ discard_dg(int s, struct servtab *sep __ /* Discard service -- ignore data */ /* ARGSUSED */ -void +static void discard_stream(int s, struct servtab *sep) { int ret; @@ -273,7 +272,7 @@ discard_stream(int s, struct servtab *se /* Echo service -- echo data back */ /* ARGSUSED */ -void +static void echo_dg(int s, struct servtab *sep) { char buffer[65536]; /* Should be sizeof(max datagram). */ @@ -294,7 +293,7 @@ echo_dg(int s, struct servtab *sep) /* Echo service -- echo data back */ /* ARGSUSED */ -void +static void echo_stream(int s, struct servtab *sep) { char buffer[BUFSIZE]; @@ -322,7 +321,7 @@ echo_stream(int s, struct servtab *sep) /* Generic ident_stream error-sending func */ /* ARGSUSED */ -void +static void iderror(int lport, int fport, int s, const char *er) { char *p; @@ -340,7 +339,7 @@ iderror(int lport, int fport, int s, con /* Ident service (AKA "auth") */ /* ARGSUSED */ -void +static void ident_stream(int s, struct servtab *sep) { struct utsname un; @@ -688,7 +687,7 @@ printit: * some seventy years Bell Labs was asleep. */ -uint32_t +static uint32_t machtime(void) { @@ -698,7 +697,7 @@ machtime(void) } /* ARGSUSED */ -void +static void machtime_dg(int s, struct servtab *sep) { uint32_t result; @@ -719,7 +718,7 @@ machtime_dg(int s, struct servtab *sep) } /* ARGSUSED */ -void +static void machtime_stream(int s, struct servtab *sep __unused) { uint32_t result; Modified:
svn commit: r310893 - head/usr.sbin/syslogd
Author: hrs Date: Sat Dec 31 09:52:00 2016 New Revision: 310893 URL: https://svnweb.freebsd.org/changeset/base/310893 Log: Remove extra NULL-check before free(3). Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Sat Dec 31 09:43:35 2016 (r310892) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 31 09:52:00 2016 (r310893) @@ -710,8 +710,7 @@ main(int argc, char *argv[]) (*sl->sl_recv)(sl); } } - if (fdsr) - free(fdsr); + free(fdsr); } static int ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r310890 - head/usr.sbin/syslogd
Author: hrs Date: Sat Dec 31 06:23:05 2016 New Revision: 310890 URL: https://svnweb.freebsd.org/changeset/base/310890 Log: Replace two fat signal handlers with function calls in the main I/O multiplex loop. select() now watches a pipe which is written by the new skinny signal handlers and the received signals are handled inside the loop sequencially. This eliminates a complex signal mask to guarantee async-signal safety. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Sat Dec 31 06:07:48 2016 (r310889) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 31 06:23:05 2016 (r310890) @@ -321,8 +321,9 @@ static int LogFacPri; /* Put facility an static int KeepKernFac;/* Keep remotely logged kernel facility */ static int needdofsync = 0; /* Are any file(s) waiting to be fsynced? */ static struct pidfh *pfh; +static int sigp[2];/* Pipe to catch a signal during select(). */ -static volatile sig_atomic_t MarkSet, WantDie; +static volatile sig_atomic_t MarkSet, WantDie, WantInitialize, WantReapchild; static int allowaddr(char *); static int addfile(struct filed *); @@ -340,6 +341,7 @@ static void dofsync(void); static voiddomark(int); static voidfprintlog(struct filed *, int, const char *); static voidinit(int); +static voidinit_sh(int); static voidlogerror(const char *); static voidlogmsg(int, const char *, const char *, int); static voidlog_deadchild(pid_t, int, const char *); @@ -347,11 +349,13 @@ static void markit(void); static int socksetup(struct peer *); static int socklist_recv_file(struct socklist *); static int socklist_recv_sock(struct socklist *); +static int socklist_recv_signal(struct socklist *); static int skip_message(const char *, const char *, int); static voidprintline(const char *, char *, int); static voidprintsys(char *); static int p_open(const char *, pid_t *); static voidreapchild(int); +static voidreapchild_sh(int); static const char *ttymsg_check(struct iovec *, int, char *, int); static voidusage(void); static int validate(struct sockaddr *, const char *); @@ -435,7 +439,6 @@ main(int argc, char *argv[]) struct timeval tv, *tvp; struct peer *pe; struct socklist *sl; - sigset_t mask; pid_t ppid = 1, spid; char *p; @@ -578,6 +581,17 @@ main(int argc, char *argv[]) if ((argc -= optind) != 0) usage(); + /* Pipe to catch a signal during select(). */ + s = pipe2(sigp, O_NONBLOCK); + if (s < 0) { + err(1, "cannot open a pipe for signals"); + } else { + addsock(NULL, 0, &(struct socklist){ + .sl_socket = sigp[1], + .sl_recv = socklist_recv_signal + }); + } + /* Listen by default: /dev/klog. */ s = open(_PATH_KLOG, O_RDONLY|O_NONBLOCK, 0); if (s < 0) { @@ -632,19 +646,8 @@ main(int argc, char *argv[]) (void)signal(SIGTERM, dodie); (void)signal(SIGINT, Debug ? dodie : SIG_IGN); (void)signal(SIGQUIT, Debug ? dodie : SIG_IGN); - /* -* We don't want the SIGCHLD and SIGHUP handlers to interfere -* with each other; they are likely candidates for being called -* simultaneously (SIGHUP closes pipe descriptor, process dies, -* SIGCHLD happens). -*/ - sigemptyset(); - sigaddset(, SIGHUP); - (void)sigaction(SIGCHLD, &(struct sigaction){ - .sa_handler = reapchild, - .sa_mask = mask, - .sa_flags = SA_RESTART - }, NULL); + (void)signal(SIGHUP, init_sh); + (void)signal(SIGCHLD, reapchild_sh); (void)signal(SIGALRM, domark); (void)signal(SIGPIPE, SIG_IGN); /* We'll catch EPIPE instead. */ (void)alarm(TIMERINTVL); @@ -654,16 +657,6 @@ main(int argc, char *argv[]) dprintf("off & running\n"); - init(0); - /* prevent SIGHUP and SIGCHLD handlers from running in parallel */ - sigemptyset(); - sigaddset(, SIGCHLD); - (void)sigaction(SIGHUP, &(struct sigaction){ - .sa_handler = init, - .sa_mask = mask, - .sa_flags = SA_RESTART - }, NULL); - tvp = tv.tv_sec = tv.tv_usec = 0; @@ -677,6 +670,12 @@ main(int argc, char *argv[]) errx(1, "calloc fd_set"); for (;;) { + if (Initialized == 0) + init(0); + else if (WantInitialize) + init(WantInitialize); + if (WantReapchild) + reapchild(WantReapchild); if (MarkSet) markit(); if (WantDie) @@ -716,6 +715,19
svn commit: r310888 - head/usr.sbin/syslogd
Author: hrs Date: Sat Dec 31 03:07:48 2016 New Revision: 310888 URL: https://svnweb.freebsd.org/changeset/base/310888 Log: Retry to open an F_PIPE process when it dies unexpectedly. Reported by: Eugene Grosbein PR: 215335 Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Sat Dec 31 02:23:15 2016 (r310887) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 31 03:07:48 2016 (r310888) @@ -368,9 +368,19 @@ close_filed(struct filed *f) if (f == NULL || f->f_file == -1) return; + switch (f->f_type) { + case F_FILE: + case F_TTY: + case F_CONSOLE: + case F_FORW: + f->f_type = F_UNUSED; + break; + case F_PIPE: + f->fu_pipe_pid = 0; + break; + } (void)close(f->f_file); f->f_file = -1; - f->f_type = F_UNUSED; } static int @@ -1378,18 +1388,15 @@ fprintlog(struct filed *f, int flags, co if (f->fu_pipe_pid == 0) { if ((f->f_file = p_open(f->fu_pipe_pname, >fu_pipe_pid)) < 0) { - f->f_type = F_UNUSED; logerror(f->fu_pipe_pname); break; } } if (writev(f->f_file, iov, nitems(iov)) < 0) { int e = errno; + + deadq_enter(f->fu_pipe_pid, f->fu_pipe_pname); close_filed(f); - if (f->fu_pipe_pid > 0) - deadq_enter(f->fu_pipe_pid, - f->fu_pipe_pname); - f->fu_pipe_pid = 0; errno = e; logerror(f->fu_pipe_pname); } @@ -1520,7 +1527,6 @@ reapchild(int signo __unused) if (f->f_type == F_PIPE && f->fu_pipe_pid == pid) { close_filed(f); - f->fu_pipe_pid = 0; log_deadchild(pid, status, f->fu_pipe_pname); break; } @@ -1619,10 +1625,8 @@ die(int signo) /* flush any pending output */ if (f->f_prevcount) fprintlog(f, 0, (char *)NULL); - if (f->f_type == F_PIPE && f->fu_pipe_pid > 0) { + if (f->f_type == F_PIPE && f->fu_pipe_pid > 0) close_filed(f); - f->fu_pipe_pid = 0; - } } Initialized = was_initialized; if (signo) { @@ -1851,12 +1855,8 @@ init(int signo) close_filed(f); break; case F_PIPE: - if (f->fu_pipe_pid > 0) { - close_filed(f); - deadq_enter(f->fu_pipe_pid, - f->fu_pipe_pname); - } - f->fu_pipe_pid = 0; + deadq_enter(f->fu_pipe_pid, f->fu_pipe_pname); + close_filed(f); break; } } @@ -2753,6 +2753,8 @@ deadq_enter(pid_t pid, const char *name) struct deadq_entry *dq; int status; + if (pid == 0) + return; /* * Be paranoid, if we can't signal the process, don't enter it * into the dead queue (perhaps it's already dead). If possible, ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: 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-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r310504 - head/usr.sbin/syslogd
Ngie Cooperwrote 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 pgpQcfire8_Np.pgp Description: PGP signature
svn commit: r310494 - head/usr.sbin/syslogd
Author: hrs Date: Sat Dec 24 07:13:33 2016 New Revision: 310494 URL: https://svnweb.freebsd.org/changeset/base/310494 Log: - Remove unused code. - Use closefrom(). Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Sat Dec 24 02:31:26 2016 (r310493) +++ head/usr.sbin/syslogd/syslogd.c Sat Dec 24 07:13:33 2016 (r310494) @@ -357,7 +357,7 @@ static void usage(void); static int validate(struct sockaddr *, const char *); static voidunmapped(struct sockaddr *); static voidwallmsg(struct filed *, struct iovec *, const int iovlen); -static int waitdaemon(int, int, int); +static int waitdaemon(int); static voidtimedout(int); static voidincrease_rcvbuf(int); @@ -606,7 +606,7 @@ main(int argc, char *argv[]) } if ((!Foreground) && (!Debug)) { - ppid = waitdaemon(0, 0, 30); + ppid = waitdaemon(30); if (ppid < 0) { warn("could not become daemon"); pidfile_remove(pfh); @@ -2311,7 +2311,7 @@ markit(void) * Set a timer so we don't hang forever if it wedges. */ static int -waitdaemon(int nochdir, int noclose, int maxwait) +waitdaemon(int maxwait) { int fd; int status; @@ -2343,15 +2343,12 @@ waitdaemon(int nochdir, int noclose, int if (setsid() == -1) return (-1); - if (!nochdir) - (void)chdir("/"); - - if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + (void)chdir("/"); + if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { (void)dup2(fd, STDIN_FILENO); (void)dup2(fd, STDOUT_FILENO); (void)dup2(fd, STDERR_FILENO); - if (fd > 2) - (void)close (fd); + closefrom(STDERR_FILENO + 1); } return (getppid()); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r310456 - head/usr.sbin/syslogd
Author: hrs Date: Fri Dec 23 06:29:24 2016 New Revision: 310456 URL: https://svnweb.freebsd.org/changeset/base/310456 Log: - More ifdef INET and INET6. - Use STDERR_FILENO + 1 instead of "3". - Fix dprintf() in cvthname(). Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Fri Dec 23 05:07:28 2016 (r310455) +++ head/usr.sbin/syslogd/syslogd.c Fri Dec 23 06:29:24 2016 (r310456) @@ -748,6 +748,7 @@ socklist_recv_sock(struct socklist *sl) static void unmapped(struct sockaddr *sa) { +#if defined(INET) && defined(INET6) struct sockaddr_in6 *sin6; struct sockaddr_in sin; @@ -766,6 +767,10 @@ unmapped(struct sockaddr *sa) memcpy(_addr, >sin6_addr.s6_addr[12], sizeof(sin.sin_addr)); memcpy(sa, , sizeof(sin)); +#else + if (sa == NULL) + return; +#endif } static void @@ -1533,24 +1538,23 @@ cvthname(struct sockaddr *f) sigset_t omask, nmask; static char hname[NI_MAXHOST], ip[NI_MAXHOST]; - dprintf("cvthname(%d) len = %d, %zu\n", f->sa_family, f->sa_len, sizeof(struct sockaddr_in6)); + dprintf("cvthname(%d) len = %d\n", f->sa_family, f->sa_len); error = getnameinfo(f, f->sa_len, ip, sizeof(ip), NULL, 0, NI_NUMERICHOST); - dprintf("cvthname(%s)\n", ip); - if (error) { dprintf("Malformed from address %s\n", gai_strerror(error)); return ("???"); } + dprintf("cvthname(%s)\n", ip); + if (!resolve) return (ip); sigemptyset(); sigaddset(, SIGHUP); sigprocmask(SIG_BLOCK, , ); - error = getnameinfo((struct sockaddr *)f, - ((struct sockaddr *)f)->sa_len, - hname, sizeof hname, NULL, 0, NI_NAMEREQD); + error = getnameinfo(f, f->sa_len, hname, sizeof(hname), + NULL, 0, NI_NAMEREQD); sigprocmask(SIG_SETMASK, , NULL); if (error) { dprintf("Host name for your address (%s) unknown\n", ip); @@ -2393,7 +2397,9 @@ allowaddr(char *s) struct servent *se; int masklen = -1; struct addrinfo hints, *res; +#ifdef INET in_addr_t *addrp, *maskp; +#endif #ifdef INET6 uint32_t *addr6p, *mask6p; #endif @@ -2459,7 +2465,9 @@ allowaddr(char *s) .ss_family = res->ai_family, .ss_len = res->ai_addrlen }; - if (res->ai_family == AF_INET) { + switch (res->ai_family) { +#ifdef INET + case AF_INET: maskp = (>a_mask)->sin_addr.s_addr; addrp = (>a_addr)->sin_addr.s_addr; if (masklen < 0) { @@ -2481,9 +2489,14 @@ allowaddr(char *s) } /* Lose any host bits in the network number. */ *addrp &= *maskp; - } + break; +#endif #ifdef INET6 - else if (res->ai_family == AF_INET6 && masklen <= 128) { + case AF_INET6: + if (masklen > 128) { + freeaddrinfo(res); + return (-1); + } if (masklen < 0) masklen = 128; mask6p = (uint32_t *)(>a_mask)->sin6_addr.s6_addr32[0]; @@ -2501,9 +2514,9 @@ allowaddr(char *s) masklen -= 32; } } - } + break; #endif - else { + default: freeaddrinfo(res); return (-1); } @@ -2527,12 +2540,12 @@ allowaddr(char *s) printf("allowaddr: rule "); if (ap->isnumeric) { printf("numeric, "); - getnameinfo((struct sockaddr *)>a_addr, - ((struct sockaddr *)>a_addr)->sa_len, + getnameinfo(sstosa(>a_addr), + (sstosa(>a_addr))->sa_len, ip, sizeof ip, NULL, 0, NI_NUMERICHOST); printf("addr = %s, ", ip); - getnameinfo((struct sockaddr *)>a_mask, - ((struct sockaddr *)>a_mask)->sa_len, + getnameinfo(sstosa(>a_mask), + (sstosa(>a_mask))->sa_len, ip, sizeof ip, NULL, 0, NI_NUMERICHOST); printf("mask = %s; ", ip); } else { @@ -2552,7 +2565,9 @@ validate(struct sockaddr *sa,
svn commit: r310453 - head/usr.sbin/syslogd
Author: hrs Date: Fri Dec 23 04:59:22 2016 New Revision: 310453 URL: https://svnweb.freebsd.org/changeset/base/310453 Log: mdoc and style fixes. Modified: head/usr.sbin/syslogd/syslogd.8 Modified: head/usr.sbin/syslogd/syslogd.8 == --- head/usr.sbin/syslogd/syslogd.8 Fri Dec 23 04:38:27 2016 (r310452) +++ head/usr.sbin/syslogd/syslogd.8 Fri Dec 23 04:59:22 2016 (r310453) @@ -40,7 +40,7 @@ .Op Fl a Ar allowed_peer .Op Fl b Ar bind_address .Op Fl f Ar config_file -.Op Fl l Oo Ar mode \&: Oc Ns Ar path +.Op Fl l Oo Ar mode Ns \&: Oc Ns Ar path .Op Fl m Ar mark_interval .Op Fl P Ar pid_file .Op Fl p Ar log_socket @@ -48,7 +48,9 @@ .Sh DESCRIPTION The .Nm -utility reads and logs messages to the system console, log files, other +utility reads and logs messages to the system console, +log files, +other machines and/or users as specified by its configuration file. .Pp The options are as follows: @@ -64,7 +66,8 @@ to use IPv6 addresses only. .It Fl 8 Tells .Nm -not to interfere with 8-bit data. Normally +not to interfere with 8-bit data. +Normally .Nm will replace C1 control characters .Pq ISO 8859 and Unicode characters @@ -137,11 +140,13 @@ is IPv4 address, a missing .Ar masklen will be substituted by the historic class A or class B netmasks if .Ar ipaddr -belongs into the address range of class A or B, respectively, or -by 24 otherwise. +belongs into the address range of class A or B, +respectively, +or by 24 otherwise. If .Ar ipaddr -is IPv6 address, a missing +is IPv6 address, +a missing .Ar masklen will be substituted by 128. .It Xo @@ -191,29 +196,31 @@ is This option can be specified multiple times to bind to multiple addresses and/or ports. .It Fl C -Create log files that do not exist (permission is set to -.Li 0600 ) . +Create log files that do not exist +.Pq permission is set to Ql Li 0600 . .It Fl c Disable the compression of repeated instances of the same line into a single line of the form .Dq Li "last message repeated N times" when the output is a pipe to another program. -If specified twice, disable this compression in all cases. +If specified twice, +disable this compression in all cases. .It Fl d Put .Nm into debugging mode. This is probably only of use to developers working on .Nm . -.It Fl f +.It Fl f Ar config_file Specify the pathname of an alternate configuration file; the default is .Pa /etc/syslog.conf . .It Fl F Run .Nm -in the foreground, rather than going into daemon mode. This is useful if -some other process uses +in the foreground, +rather than going into daemon mode. +This is useful if some other process uses .Xr fork 2 and .Xr exec 3 @@ -230,52 +237,75 @@ Usually the .Dq kern facility is reserved for messages read directly from .Pa /dev/klog . -.It Fl m +.It Fl m Ar mark_interval Select the number of minutes between .Dq mark -messages; the default is 20 minutes. +messages; +the default is 20 minutes. .It Fl N -Disable binding on UDP sockets. RFC 3164 recommends that outgoing -syslogd messages should originate from the privileged port, this -option +Disable binding on UDP sockets. +RFC 3164 recommends that outgoing +.Nm +messages should originate from the privileged port, +this option .Em disables -the recommended behavior. This option inherits +the recommended behavior. +This option inherits .Fl s . .It Fl n -Disable dns query for every request. +Disable DNS query for every request. .It Fl o Prefix kernel messages with the full kernel boot file as determined by .Xr getbootfile 3 . Without this, the kernel message prefix is always .Dq Li kernel: . -.It Fl p +.It Fl p Ar log_socket Specify the pathname of an alternate log socket to be used instead; the default is .Pa /var/run/log . -.It Fl P +When a single +.Fl p +options are specified, +the default pathname is replaced with the specified one. +When two or more +.Fl p +options are specified, +the remaining pathnames are treated as additional log sockets. +.It Fl P Ar pid_file Specify an alternative file in which to store the process ID. The default is .Pa /var/run/syslog.pid . -.It Fl S +.It Fl S Ar logpriv_socket Specify the pathname of an alternate log socket for privileged -applications to be used instead; the default is +applications to be used instead; +the default is .Pa /var/run/logpriv . -.It Fl l +When a single +.Fl S +options are specified, +the default pathname is replaced with the specified one. +When two or more +.Fl S +options are specified, +the remaining pathnames are treated as additional log sockets. +.It Fl l Oo Ar mode Ns \&: Oc Ns Ar path Specify a location where .Nm should place an additional log socket. The primary use for this is to place additional log sockets in .Pa /var/run/log of various chroot filespaces. -File permissions for socket can be specified in octal representation -before socket name, delimited with a colon.
svn commit: r310452 - head/usr.bin/logger
Author: hrs Date: Fri Dec 23 04:38:27 2016 New Revision: 310452 URL: https://svnweb.freebsd.org/changeset/base/310452 Log: mdoc fixes. Modified: head/usr.bin/logger/logger.1 Modified: head/usr.bin/logger/logger.1 == --- head/usr.bin/logger/logger.1Fri Dec 23 04:37:11 2016 (r310451) +++ head/usr.bin/logger/logger.1Fri Dec 23 04:38:27 2016 (r310452) @@ -116,14 +116,18 @@ If an unknown service name is used, prints a warning and falls back to port 514. .It Fl p Ar pri Enter the message with the specified priority. -The priority may be specified numerically or as a ``facility.level'' +The priority may be specified numerically or as a +.Li facility.level pair. -For example, ``\-p local3.info'' logs the message(s) as +For example, +.Dq Fl p Li local3.info +logs the message(s) as .Ar info Ns rmational level in the .Ar local3 facility. -The default is ``user.notice.'' +The default is +.Dq Li user.notice . .It Fl S Ar addr Ns \&: Ns Ar port Specify source address and/or source port when using .Fl h @@ -135,9 +139,9 @@ flag is enabled. Note that a numeric IPv6 address in .Ar addr must be enclosed with -.Qq \&[ +.Dq \&[ and -.Qq \&] . +.Dq \&] . .It Fl t Ar tag Mark every line in the log with the specified .Ar tag ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r310434 - head/usr.bin/logger
Author: hrs Date: Thu Dec 22 23:39:11 2016 New Revision: 310434 URL: https://svnweb.freebsd.org/changeset/base/310434 Log: - Add -S option to specify the source address/port for UDP communication. - Document -S option. - Document that -h option supports AF_LOCAL. - Split preparation of UDP sockets in logmessage() into socksetup(). Modified: head/usr.bin/logger/logger.1 head/usr.bin/logger/logger.c Modified: head/usr.bin/logger/logger.1 == --- head/usr.bin/logger/logger.1Thu Dec 22 22:30:42 2016 (r310433) +++ head/usr.bin/logger/logger.1Thu Dec 22 23:39:11 2016 (r310434) @@ -28,7 +28,7 @@ .\"@(#)logger.18.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 21, 2015 +.Dd December 23, 2016 .Dt LOGGER 1 .Os .Sh NAME @@ -41,6 +41,7 @@ .Op Fl h Ar host .Op Fl P Ar port .Op Fl p Ar pri +.Op Fl S Ar addr Ns \&: Ns Ar port .Op Fl t Ar tag .Op Ar message ... .Sh DESCRIPTION @@ -80,6 +81,28 @@ This option is ignored when a message is Send the message to the remote system .Ar host instead of logging it locally. +Note that +.Nm +currently supports +.Li AF_INET +.Pq IPv4 , +.Li AF_INET6 +.Pq IPv6 , +and +.Li AF_LOCAL +.Pq Unix-domain socket +address families. +The following address formats are valid in +.Ar host : +.Pp +.Bl -tag -width "AF_LOCAL" -compact +.It Li AF_INET +192.168.2.1 +.It Li AF_INET6 +2001:db8::1 +.It Li AF_LOCAL +.Pa /var/run/log +.El .It Fl P Ar port Send the message to the specified .Ar port @@ -101,6 +124,20 @@ level in the .Ar local3 facility. The default is ``user.notice.'' +.It Fl S Ar addr Ns \&: Ns Ar port +Specify source address and/or source port when using +.Fl h +option. +The same address will be used for all of the remote addresses +when +.Fl A +flag is enabled. +Note that a numeric IPv6 address in +.Ar addr +must be enclosed with +.Qq \&[ +and +.Qq \&] . .It Fl t Ar tag Mark every line in the log with the specified .Ar tag Modified: head/usr.bin/logger/logger.c == --- head/usr.bin/logger/logger.cThu Dec 22 22:30:42 2016 (r310433) +++ head/usr.bin/logger/logger.cThu Dec 22 23:39:11 2016 (r310434) @@ -57,18 +57,22 @@ __FBSDID("$FreeBSD$"); #defineSYSLOG_NAMES #include +#definesstosa(ss) ((struct sockaddr *)(void *)ss) + +struct socks { + int sk_sock; + int sk_addrlen; + struct sockaddr_storage sk_addr; +}; + static int decode(char *, const CODE *); static int pencode(char *); -static voidlogmessage(int, const char *, const char *, const char *, +static ssize_t socksetup(const char *, const char *, const char *, + struct socks **); +static voidlogmessage(int, const char *, struct socks *, ssize_t, const char *); static voidusage(void); -struct socks { -int sock; -int addrlen; -struct sockaddr_storage addr; -}; - #ifdef INET6 static int family = PF_UNSPEC; /* protocol family (IPv4, IPv6 or both) */ #else @@ -85,17 +89,20 @@ static int send_to_all = 0; /* send mess int main(int argc, char *argv[]) { + struct socks *socks; + ssize_t nsock; int ch, logflags, pri; char *tag, *host, buf[1024]; - const char *svcname; + const char *svcname, *src; tag = NULL; host = NULL; svcname = "syslog"; + src = NULL; pri = LOG_USER | LOG_NOTICE; logflags = 0; unsetenv("TZ"); - while ((ch = getopt(argc, argv, "46Af:h:iP:p:st:")) != -1) + while ((ch = getopt(argc, argv, "46Af:h:iP:p:S:st:")) != -1) switch((char)ch) { case '4': family = PF_INET; @@ -128,6 +135,9 @@ main(int argc, char *argv[]) case 's': /* log to standard error */ logflags |= LOG_PERROR; break; + case 'S': /* source address */ + src = optarg; + break; case 't': /* tag */ tag = optarg; break; @@ -138,6 +148,16 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + if (host) { + nsock = socksetup(src, host, svcname, ); + if (nsock <= 0) + errx(1, "socket"); + } else { + if (src) + errx(1, "-h option is missing."); + nsock = 0; + } + if (tag == NULL) tag = getlogin(); /* setup for logging */ @@ -153,11 +173,11 @@ main(int argc, char *argv[]) for (p = buf, endp = buf + sizeof(buf) - 2; *argv;) { len = strlen(*argv); if (p + len > endp && p >
svn commit: r310393 - head/usr.sbin/syslogd
Author: hrs Date: Thu Dec 22 13:46:17 2016 New Revision: 310393 URL: https://svnweb.freebsd.org/changeset/base/310393 Log: - Fix a use-after-free bug when dq_timeout == 1 and sending SIGTERM to the process failed. It is an unusual situation but it can happen. - Split deadq_remove() into deadq_remove() and deadq_removebypid(). - Normalize variable names of struct deadq_entry *. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Thu Dec 22 13:38:50 2016 (r310392) +++ head/usr.sbin/syslogd/syslogd.c Thu Dec 22 13:46:17 2016 (r310393) @@ -236,9 +236,6 @@ static TAILQ_HEAD(, deadq_entry) deadq_h #define DQ_TIMO_INIT 2 -typedef struct deadq_entry *dq_t; - - /* * Struct to hold records of network addresses that are allowed to log * to us. @@ -334,7 +331,8 @@ static int addsock(struct sockaddr *, so static struct filed *cfline(const char *, const char *, const char *); static const char *cvthname(struct sockaddr *); static voiddeadq_enter(pid_t, const char *); -static int deadq_remove(pid_t); +static int deadq_remove(struct deadq_entry *); +static int deadq_removebypid(pid_t); static int decode(const char *, const CODE *); static voiddie(int) __dead2; static voiddodie(int); @@ -1509,7 +1507,7 @@ reapchild(int signo __unused) continue; /* First, look if it's a process from the dead queue. */ - if (deadq_remove(pid)) + if (deadq_removebypid(pid)) continue; /* Now, look in list of active processes. */ @@ -2252,7 +2250,7 @@ static void markit(void) { struct filed *f; - dq_t q, next; + struct deadq_entry *dq, *dq0; now = time((time_t *)NULL); MarkSeq += TIMERINTVL; @@ -2273,14 +2271,12 @@ markit(void) } /* Walk the dead queue, and see if we should signal somebody. */ - for (q = TAILQ_FIRST(_head); q != NULL; q = next) { - next = TAILQ_NEXT(q, dq_entries); - - switch (q->dq_timeout) { + TAILQ_FOREACH_SAFE(dq, _head, dq_entries, dq0) { + switch (dq->dq_timeout) { case 0: /* Already signalled once, try harder now. */ - if (kill(q->dq_pid, SIGKILL) != 0) - (void)deadq_remove(q->dq_pid); + if (kill(dq->dq_pid, SIGKILL) != 0) + (void)deadq_remove(dq); break; case 1: @@ -2292,12 +2288,13 @@ markit(void) * didn't even really exist, in case we simply * drop it from the dead queue). */ - if (kill(q->dq_pid, SIGTERM) != 0) - (void)deadq_remove(q->dq_pid); - /* FALLTHROUGH */ - + if (kill(dq->dq_pid, SIGTERM) != 0) + (void)deadq_remove(dq); + else + dq->dq_timeout--; + break; default: - q->dq_timeout--; + dq->dq_timeout--; } } MarkSet = 0; @@ -2738,7 +2735,7 @@ p_open(const char *prog, pid_t *rpid) static void deadq_enter(pid_t pid, const char *name) { - dq_t p; + struct deadq_entry *dq; int status; /* @@ -2752,36 +2749,42 @@ deadq_enter(pid_t pid, const char *name) return; } - p = malloc(sizeof(struct deadq_entry)); - if (p == NULL) { + dq = malloc(sizeof(*dq)); + if (dq == NULL) { logerror("malloc"); exit(1); } - *p = (struct deadq_entry){ + *dq = (struct deadq_entry){ .dq_pid = pid, .dq_timeout = DQ_TIMO_INIT }; - TAILQ_INSERT_TAIL(_head, p, dq_entries); + TAILQ_INSERT_TAIL(_head, dq, dq_entries); } static int -deadq_remove(pid_t pid) +deadq_remove(struct deadq_entry *dq) { - dq_t q; - - TAILQ_FOREACH(q, _head, dq_entries) { - if (q->dq_pid == pid) - break; - } - if (q != NULL) { - TAILQ_REMOVE(_head, q, dq_entries); - free(q); + if (dq != NULL) { + TAILQ_REMOVE(_head, dq, dq_entries); + free(dq); return (1); } return (0); } +static int +deadq_removebypid(pid_t pid) +{ + struct deadq_entry *dq; + + TAILQ_FOREACH(dq, _head, dq_entries) { + if (dq->dq_pid == pid) + break; + } + return (deadq_remove(dq)); +} + static
svn commit: r310386 - head/usr.sbin/syslogd
Author: hrs Date: Thu Dec 22 05:57:45 2016 New Revision: 310386 URL: https://svnweb.freebsd.org/changeset/base/310386 Log: Add a missing "default:" case. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:55:44 2016 (r310385) +++ head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:57:45 2016 (r310386) @@ -1279,6 +1279,8 @@ fprintlog(struct filed *f, int flags, co ntohs(satosin6(f->fu_forw_addr->ai_addr)->sin6_port)); break; #endif + default: + dprintf("\n"); } /* check for local vs remote messages */ if (strcasecmp(f->f_prevhost, LocalHostName)) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r310385 - head/usr.sbin/syslogd
Author: hrs Date: Thu Dec 22 05:55:44 2016 New Revision: 310385 URL: https://svnweb.freebsd.org/changeset/base/310385 Log: Initialize a structure by using a compound literal to avoid forgetting to zero unspecified members. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:28:30 2016 (r310384) +++ head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:55:44 2016 (r310385) @@ -425,7 +425,6 @@ main(int argc, char *argv[]) int ch, i, s, fdsrmax = 0, bflag = 0, pflag = 0, Sflag = 0; fd_set *fdsr = NULL; struct timeval tv, *tvp; - struct sigaction sact; struct peer *pe; struct socklist *sl; sigset_t mask; @@ -633,10 +632,11 @@ main(int argc, char *argv[]) */ sigemptyset(); sigaddset(, SIGHUP); - sact.sa_handler = reapchild; - sact.sa_mask = mask; - sact.sa_flags = SA_RESTART; - (void)sigaction(SIGCHLD, , NULL); + (void)sigaction(SIGCHLD, &(struct sigaction){ + .sa_handler = reapchild, + .sa_mask = mask, + .sa_flags = SA_RESTART + }, NULL); (void)signal(SIGALRM, domark); (void)signal(SIGPIPE, SIG_IGN); /* We'll catch EPIPE instead. */ (void)alarm(TIMERINTVL); @@ -650,10 +650,11 @@ main(int argc, char *argv[]) /* prevent SIGHUP and SIGCHLD handlers from running in parallel */ sigemptyset(); sigaddset(, SIGCHLD); - sact.sa_handler = init; - sact.sa_mask = mask; - sact.sa_flags = SA_RESTART; - (void)sigaction(SIGHUP, , NULL); + (void)sigaction(SIGHUP, &(struct sigaction){ + .sa_handler = init, + .sa_mask = mask, + .sa_flags = SA_RESTART + }, NULL); tvp = tv.tv_sec = tv.tv_usec = 0; @@ -750,7 +751,7 @@ static void unmapped(struct sockaddr *sa) { struct sockaddr_in6 *sin6; - struct sockaddr_in sin4; + struct sockaddr_in sin; if (sa == NULL || sa->sa_family != AF_INET6 || @@ -759,15 +760,14 @@ unmapped(struct sockaddr *sa) sin6 = satosin6(sa); if (!IN6_IS_ADDR_V4MAPPED(>sin6_addr)) return; - - memset(, 0, sizeof(sin4)); - sin4.sin_family = AF_INET; - sin4.sin_len = sizeof(sin4); - memcpy(_addr, >sin6_addr.s6_addr[12], - sizeof(sin4.sin_addr)); - sin4.sin_port = sin6->sin6_port; - - memcpy(sa, , sin4.sin_len); + sin = (struct sockaddr_in){ + .sin_family = AF_INET, + .sin_len = sizeof(sin), + .sin_port = sin6->sin6_port + }; + memcpy(_addr, >sin6_addr.s6_addr[12], + sizeof(sin.sin_addr)); + memcpy(sa, , sizeof(sin)); } static void @@ -2154,9 +2154,10 @@ cfline(const char *line, const char *pro else p = NULL; - memset(, 0, sizeof(hints)); - hints.ai_family = family; - hints.ai_socktype = SOCK_DGRAM; + hints = (struct addrinfo){ + .ai_family = family, + .ai_socktype = SOCK_DGRAM + }; error = getaddrinfo(f->fu_forw_hname, p ? p : "syslog", , ); if (error) { @@ -2447,16 +2448,18 @@ allowaddr(char *s) cp2 = NULL; } #endif - memset(, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; + hints = (struct addrinfo){ + .ai_family = PF_UNSPEC, + .ai_socktype = SOCK_DGRAM, + .ai_flags = AI_PASSIVE | AI_NUMERICHOST + }; if (getaddrinfo(s, NULL, , ) == 0) { ap->isnumeric = 1; memcpy(>a_addr, res->ai_addr, res->ai_addrlen); - memset(>a_mask, 0, sizeof(ap->a_mask)); - ap->a_mask.ss_family = res->ai_family; - ap->a_mask.ss_len = res->ai_addrlen; + ap->a_mask = (struct sockaddr_storage){ + .ss_family = res->ai_family, + .ss_len = res->ai_addrlen + }; if (res->ai_family == AF_INET) { maskp = (>a_mask)->sin_addr.s_addr; addrp = (>a_addr)->sin_addr.s_addr; @@ -2567,10 +2570,11 @@ validate(struct sockaddr *sa, const char return (1); (void)strlcpy(name, hname, sizeof(name)); - memset(, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; + hints = (struct addrinfo){ + .ai_family = PF_UNSPEC, + .ai_socktype =
svn commit: r310384 - head/usr.sbin/syslogd
Author: hrs Date: Thu Dec 22 05:28:30 2016 New Revision: 310384 URL: https://svnweb.freebsd.org/changeset/base/310384 Log: Fix debug log in the case of AF_INET6. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:23:38 2016 (r310383) +++ head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:28:30 2016 (r310384) @@ -1262,17 +1262,23 @@ fprintlog(struct filed *f, int flags, co f->f_time = now; switch (f->f_type) { - int port; case F_UNUSED: dprintf("\n"); break; case F_FORW: - port = ntohs(satosin(f->fu_forw_addr->ai_addr)->sin_port); - if (port != 514) { - dprintf(" %s:%d\n", f->fu_forw_hname, port); - } else { - dprintf(" %s\n", f->fu_forw_hname); + dprintf(" %s", f->fu_forw_hname); + switch (f->fu_forw_addr->ai_addr->sa_family) { + case AF_INET: + dprintf(":%d\n", + ntohs(satosin(f->fu_forw_addr->ai_addr)->sin_port)); + break; +#ifdef INET6 + case AF_INET6: + dprintf(":%d\n", + ntohs(satosin6(f->fu_forw_addr->ai_addr)->sin6_port)); + break; +#endif } /* check for local vs remote messages */ if (strcasecmp(f->f_prevhost, LocalHostName)) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r310383 - head/usr.sbin/syslogd
Author: hrs Date: Thu Dec 22 05:23:38 2016 New Revision: 310383 URL: https://svnweb.freebsd.org/changeset/base/310383 Log: - Simplify masklen->netmask conversion for AF_INET6. - Use iov[N] by array index instead of using pointer v = [0] to make the compiler catch an out-of-range access of the array. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Thu Dec 22 00:35:12 2016 (r310382) +++ head/usr.sbin/syslogd/syslogd.c Thu Dec 22 05:23:38 2016 (r310383) @@ -127,9 +127,10 @@ static const char include_ext[] = ".conf #defineMAXUNAMES 20 /* maximum number of user names */ #definesstosa(ss) ((struct sockaddr *)(ss)) -#definesatosin6(sa)((struct sockaddr_in6 *)(void *)(sa)) -#definesstosin(ss) ((struct sockaddr_in *)(ss)) +#definesstosin(ss) ((struct sockaddr_in *)(void *)(ss)) #definesatosin(sa) ((struct sockaddr_in *)(void *)(sa)) +#definesstosin6(ss)((struct sockaddr_in6 *)(void *)(ss)) +#definesatosin6(sa)((struct sockaddr_in6 *)(void *)(sa)) #defines6_addr32 __u6_addr.__u6_addr32 #defineIN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ (((d)->s6_addr32[0] ^ (a)->s6_addr32[0]) & (m)->s6_addr32[0]) == 0 && \ @@ -1147,37 +1148,40 @@ static void fprintlog(struct filed *f, int flags, const char *msg) { struct iovec iov[IOV_SIZE]; - struct iovec *v; struct addrinfo *r; int l, lsent = 0; char line[MAXLINE + 1], repbuf[80], greetings[200], *wmsg = NULL; char nul[] = "", space[] = " ", lf[] = "\n", crlf[] = "\r\n"; const char *msgret; - v = iov; if (f->f_type == F_WALL) { - v->iov_base = greetings; /* The time displayed is not synchornized with the other log * destinations (like messages). Following fragment was using * ctime(), which was updating the time every 30 sec. * With f_lasttime, time is synchronized correctly. */ - v->iov_len = snprintf(greetings, sizeof greetings, - "\r\n\7Message from syslogd@%s at %.24s ...\r\n", - f->f_prevhost, f->f_lasttime); - if (v->iov_len >= sizeof greetings) - v->iov_len = sizeof greetings - 1; - v++; - v->iov_base = nul; - v->iov_len = 0; - v++; + iov[0] = (struct iovec){ + .iov_base = greetings, + .iov_len = snprintf(greetings, sizeof(greetings), + "\r\n\7Message from syslogd@%s " + "at %.24s ...\r\n", + f->f_prevhost, f->f_lasttime) + }; + if (iov[0].iov_len >= sizeof(greetings)) + iov[0].iov_len = sizeof(greetings) - 1; + iov[1] = (struct iovec){ + .iov_base = nul, + .iov_len = 0 + }; } else { - v->iov_base = f->f_lasttime; - v->iov_len = strlen(f->f_lasttime); - v++; - v->iov_base = space; - v->iov_len = 1; - v++; + iov[0] = (struct iovec){ + .iov_base = f->f_lasttime, + .iov_len = strlen(f->f_lasttime) + }; + iov[1] = (struct iovec){ + .iov_base = space, + .iov_len = 1 + }; } if (LogFacPri) { @@ -1214,39 +1218,46 @@ fprintlog(struct filed *f, int flags, co p_s = p_n; } snprintf(fp_buf, sizeof fp_buf, "<%s.%s> ", f_s, p_s); - v->iov_base = fp_buf; - v->iov_len = strlen(fp_buf); + iov[2] = (struct iovec){ + .iov_base = fp_buf, + .iov_len = strlen(fp_buf) + }; } else { - v->iov_base = nul; - v->iov_len = 0; - } - v++; - - v->iov_base = f->f_prevhost; - v->iov_len = strlen(v->iov_base); - v++; - v->iov_base = space; - v->iov_len = 1; - v++; - + iov[2] = (struct iovec){ + .iov_base = nul, + .iov_len = 0 + }; + } + iov[3] = (struct iovec){ + .iov_base = f->f_prevhost, + .iov_len = strlen(f->f_prevhost) + }; + iov[4] = (struct iovec){ + .iov_base = space, + .iov_len = 1 + }; if (msg) { wmsg = strdup(msg); /* XXX
svn commit: r310352 - head/usr.sbin/syslogd
Author: hrs Date: Wed Dec 21 07:05:34 2016 New Revision: 310352 URL: https://svnweb.freebsd.org/changeset/base/310352 Log: Simplify type casting of struct sockaddr_in. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:49:21 2016 (r310351) +++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 07:05:34 2016 (r310352) @@ -128,6 +128,7 @@ static const char include_ext[] = ".conf #definesstosa(ss) ((struct sockaddr *)(ss)) #definesatosin6(sa)((struct sockaddr_in6 *)(void *)(sa)) +#definesstosin(ss) ((struct sockaddr_in *)(ss)) #definesatosin(sa) ((struct sockaddr_in *)(void *)(sa)) #defines6_addr32 __u6_addr.__u6_addr32 #defineIN6_ARE_MASKED_ADDR_EQUAL(d, a, m) ( \ @@ -2368,7 +2369,7 @@ allowaddr(char *s) struct servent *se; int masklen = -1; struct addrinfo hints, *res; - struct in_addr *addrp, *maskp; + in_addr_t *addrp, *maskp; #ifdef INET6 int i; u_int32_t *addr6p, *mask6p; @@ -2434,28 +2435,27 @@ allowaddr(char *s) ap->a_mask.ss_family = res->ai_family; if (res->ai_family == AF_INET) { ap->a_mask.ss_len = sizeof(struct sockaddr_in); - maskp = &((struct sockaddr_in *)>a_mask)->sin_addr; - addrp = &((struct sockaddr_in *)>a_addr)->sin_addr; + maskp = (>a_mask)->sin_addr.s_addr; + addrp = (>a_addr)->sin_addr.s_addr; if (masklen < 0) { /* use default netmask */ - if (IN_CLASSA(ntohl(addrp->s_addr))) - maskp->s_addr = htonl(IN_CLASSA_NET); - else if (IN_CLASSB(ntohl(addrp->s_addr))) - maskp->s_addr = htonl(IN_CLASSB_NET); + if (IN_CLASSA(ntohl(*addrp))) + *maskp = htonl(IN_CLASSA_NET); + else if (IN_CLASSB(ntohl(*addrp))) + *maskp = htonl(IN_CLASSB_NET); else - maskp->s_addr = htonl(IN_CLASSC_NET); + *maskp = htonl(IN_CLASSC_NET); + } else if (masklen == 0) { + *maskp = 0; } else if (masklen <= 32) { /* convert masklen to netmask */ - if (masklen == 0) - maskp->s_addr = 0; - else - maskp->s_addr = htonl(~((1 << (32 - masklen)) - 1)); + *maskp = htonl(~((1 << (32 - masklen)) - 1)); } else { freeaddrinfo(res); return (-1); } /* Lose any host bits in the network number. */ - addrp->s_addr &= maskp->s_addr; + *addrp &= *maskp; } #ifdef INET6 else if (res->ai_family == AF_INET6 && masklen <= 128) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r310351 - head/usr.sbin/syslogd
Author: hrs Date: Wed Dec 21 06:49:21 2016 New Revision: 310351 URL: https://svnweb.freebsd.org/changeset/base/310351 Log: - Initialize deadq_head statically. - Fix indent. - Add missing -S flag into usage(). - Use nitems() for an iov array instead of a macro. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:42:30 2016 (r310350) +++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:49:21 2016 (r310351) @@ -223,7 +223,8 @@ struct deadq_entry { int dq_timeout; TAILQ_ENTRY(deadq_entry)dq_entries; }; -static TAILQ_HEAD(, deadq_entry) deadq_head; +static TAILQ_HEAD(, deadq_entry) deadq_head = +TAILQ_HEAD_INITIALIZER(deadq_head); /* * The timeout to apply to processes waiting on the dead queue. Unit @@ -264,11 +265,12 @@ static STAILQ_HEAD(, allowedpeer) aphead * we move to the next interval until we reach the largest. */ static int repeatinterval[] = { 30, 120, 600 };/* # of secs before flush */ -#defineMAXREPEAT ((sizeof(repeatinterval) / sizeof(repeatinterval[0])) - 1) +#defineMAXREPEAT (nitems(repeatinterval) - 1) #defineREPEATTIME(f) ((f)->f_time + repeatinterval[(f)->f_repeatcount]) -#defineBACKOFF(f) { if (++(f)->f_repeatcount > MAXREPEAT) \ -(f)->f_repeatcount = MAXREPEAT; \ - } +#defineBACKOFF(f) do { \ + if (++(f)->f_repeatcount > MAXREPEAT) \ + (f)->f_repeatcount = MAXREPEAT; \ + } while (0) /* values for f_type */ #define F_UNUSED 0 /* unused entry */ @@ -637,8 +639,6 @@ main(int argc, char *argv[]) (void)signal(SIGPIPE, SIG_IGN); /* We'll catch EPIPE instead. */ (void)alarm(TIMERINTVL); - TAILQ_INIT(_head); - /* tuck my process id away */ pidfile_write(pfh); @@ -772,11 +772,12 @@ static void usage(void) { - fprintf(stderr, "%s\n%s\n%s\n%s\n", + fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n", "usage: syslogd [-468ACcdFknosTuv] [-a allowed_peer]", " [-b bind_address] [-f config_file]", " [-l [mode:]path] [-m mark_interval]", - " [-P pid_file] [-p log_socket]"); + " [-P pid_file] [-p log_socket]", + " [-S logpriv_socket]"); exit(1); } @@ -1325,7 +1326,7 @@ fprintlog(struct filed *f, int flags, co dprintf(" %s\n", f->fu_fname); v->iov_base = lf; v->iov_len = 1; - if (writev(f->f_file, iov, IOV_SIZE) < 0) { + if (writev(f->f_file, iov, nitems(iov)) < 0) { /* * If writev(2) fails for potentially transient errors * like the filesystem being full, ignore it. @@ -1355,7 +1356,7 @@ fprintlog(struct filed *f, int flags, co break; } } - if (writev(f->f_file, iov, IOV_SIZE) < 0) { + if (writev(f->f_file, iov, nitems(iov)) < 0) { int e = errno; close_filed(f); if (f->fu_pipe_pid > 0) @@ -1380,7 +1381,7 @@ fprintlog(struct filed *f, int flags, co v->iov_len = 2; errno = 0; /* ttymsg() only sometimes returns an errno */ - if ((msgret = ttymsg(iov, IOV_SIZE, f->fu_fname, 10))) { + if ((msgret = ttymsg(iov, nitems(iov), f->fu_fname, 10))) { f->f_type = F_UNUSED; logerror(msgret); } @@ -1391,7 +1392,7 @@ fprintlog(struct filed *f, int flags, co dprintf("\n"); v->iov_base = crlf; v->iov_len = 2; - wallmsg(f, iov, IOV_SIZE); + wallmsg(f, iov, nitems(iov)); break; } f->f_prevcount = 0; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r310350 - head/usr.sbin/syslogd
Author: hrs Date: Wed Dec 21 06:42:30 2016 New Revision: 310350 URL: https://svnweb.freebsd.org/changeset/base/310350 Log: - Add fklog into struct socklist. Files and local/remote sockets are now processed in struct socklist in a consistent manner. - Add helper functions to add a new entry of struct socklist, filed, or peer. - Use the same routine for -l, -p, and -S. - Close /dev/klog when read(2) failed. Modified: head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 05:45:59 2016 (r310349) +++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 06:42:30 2016 (r310350) @@ -144,29 +144,17 @@ struct peer { mode_t pe_mode; STAILQ_ENTRY(peer) next; }; +static STAILQ_HEAD(, peer) pqueue = STAILQ_HEAD_INITIALIZER(pqueue); + struct socklist { struct sockaddr_storage sl_ss; int sl_socket; struct peer *sl_peer; + int (*sl_recv)(struct socklist *); STAILQ_ENTRY(socklist) next; }; static STAILQ_HEAD(, socklist) shead = STAILQ_HEAD_INITIALIZER(shead); -static struct peer funix_secure = { - .pe_name = _PATH_LOG_PRIV, - .pe_mode = S_IRUSR | S_IWUSR, - .next = {NULL}, -}; -static struct peer funix_default = { - .pe_name = _PATH_LOG, - .pe_mode = DEFFILEMODE, - .next = {_secure}, -}; -static STAILQ_HEAD(, peer) pqueue = { - _default, - _secure.next.stqe_next, -}; - /* * Flags to logmsg(). */ @@ -306,7 +294,6 @@ static int Foreground = 0; /* Run in for static int resolve = 1;/* resolve hostname */ static charLocalHostName[MAXHOSTNAMELEN]; /* our hostname */ static const char *LocalDomain;/* our local domain name */ -static int fklog = -1; /* /dev/klog */ static int Initialized;/* set when we have initialized ourselves */ static int MarkInterval = 20 * 60; /* interval between marks in seconds */ static int MarkSeq;/* mark sequence number */ @@ -337,8 +324,10 @@ static struct pidfh *pfh; static volatile sig_atomic_t MarkSet, WantDie; static int allowaddr(char *); -static voidcfline(const char *, struct filed *, - const char *, const char *); +static int addfile(struct filed *); +static int addpeer(struct peer *); +static int addsock(struct sockaddr *, socklen_t, struct socklist *); +static struct filed *cfline(const char *, const char *, const char *); static const char *cvthname(struct sockaddr *); static voiddeadq_enter(pid_t, const char *); static int deadq_remove(pid_t); @@ -354,11 +343,12 @@ static void logmsg(int, const char *, co static voidlog_deadchild(pid_t, int, const char *); static voidmarkit(void); static int socksetup(struct peer *); +static int socklist_recv_file(struct socklist *); +static int socklist_recv_sock(struct socklist *); static int skip_message(const char *, const char *, int); static voidprintline(const char *, char *, int); static voidprintsys(char *); static int p_open(const char *, pid_t *); -static voidreadklog(void); static voidreapchild(int); static const char *ttymsg_check(struct iovec *, int, char *, int); static voidusage(void); @@ -381,21 +371,61 @@ close_filed(struct filed *f) f->f_type = F_UNUSED; } +static int +addfile(struct filed *f0) +{ + struct filed *f; + + f = calloc(1, sizeof(*f)); + if (f == NULL) + err(1, "malloc failed"); + *f = *f0; + STAILQ_INSERT_TAIL(, f, next); + + return (0); +} + +static int +addpeer(struct peer *pe0) +{ + struct peer *pe; + + pe = calloc(1, sizeof(*pe)); + if (pe == NULL) + err(1, "malloc failed"); + *pe = *pe0; + STAILQ_INSERT_TAIL(, pe, next); + + return (0); +} + +static int +addsock(struct sockaddr *sa, socklen_t sa_len, struct socklist *sl0) +{ + struct socklist *sl; + + sl = calloc(1, sizeof(*sl)); + if (sl == NULL) + err(1, "malloc failed"); + *sl = *sl0; + if (sa != NULL && sa_len > 0) + memcpy(>sl_ss, sa, sa_len); + STAILQ_INSERT_TAIL(, sl, next); + + return (0); +} + int main(int argc, char *argv[]) { - int ch, i, fdsrmax = 0, bflag = 0; - struct sockaddr_storage ss; + int ch, i, s, fdsrmax = 0, bflag = 0, pflag = 0, Sflag = 0; fd_set *fdsr = NULL; - char line[MAXLINE + 1]; - const char *hname; struct timeval tv, *tvp; struct sigaction sact; struct peer *pe; struct socklist *sl; sigset_t mask; pid_t ppid = 1, spid; - socklen_t sslen; char *p; if (madvise(NULL, 0, MADV_PROTECT) != 0) @@ -425,21 +455,22 @@ main(int argc, char
svn commit: r310349 - head/usr.sbin/syslogd
Author: hrs Date: Wed Dec 21 05:45:59 2016 New Revision: 310349 URL: https://svnweb.freebsd.org/changeset/base/310349 Log: - Use fnmatch(3) for domanname matching of -a options. - Document the patten matching. - Document -S flag in SYNOPSIS. Modified: head/usr.sbin/syslogd/syslogd.8 head/usr.sbin/syslogd/syslogd.c Modified: head/usr.sbin/syslogd/syslogd.8 == --- head/usr.sbin/syslogd/syslogd.8 Wed Dec 21 03:23:35 2016 (r310348) +++ head/usr.sbin/syslogd/syslogd.8 Wed Dec 21 05:45:59 2016 (r310349) @@ -28,7 +28,7 @@ .\" @(#)syslogd.8 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd June 16, 2015 +.Dd December 21, 2016 .Dt SYSLOGD 8 .Os .Sh NAME @@ -44,6 +44,7 @@ .Op Fl m Ar mark_interval .Op Fl P Ar pid_file .Op Fl p Ar log_socket +.Op Fl S Ar logpriv_socket .Sh DESCRIPTION The .Nm @@ -154,16 +155,9 @@ for the sender address. The meaning of .Ar service is as explained above. -.It Xo -.Sm off -.No * Ar domainname Op \&: Ar service -.Sm on -.Xc -Same as before, except that any source host whose name -.Em ends -in .Ar domainname -will get permission. +can contain special characters of a shell-style pattern such as +.Ql Li \&* . .El .Pp The Modified: head/usr.sbin/syslogd/syslogd.c == --- head/usr.sbin/syslogd/syslogd.c Wed Dec 21 03:23:35 2016 (r310348) +++ head/usr.sbin/syslogd/syslogd.c Wed Dec 21 05:45:59 2016 (r310349) @@ -98,6 +98,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -2476,8 +2477,7 @@ static int validate(struct sockaddr *sa, const char *hname) { int i; - size_t l1, l2; - char *cp, name[NI_MAXHOST], ip[NI_MAXHOST], port[NI_MAXSERV]; + char name[NI_MAXHOST], ip[NI_MAXHOST], port[NI_MAXSERV]; struct allowedpeer *ap; struct sockaddr_in *sin4, *a4p = NULL, *m4p = NULL; #ifdef INET6 @@ -2558,23 +2558,11 @@ validate(struct sockaddr *sa, const char else continue; } else { - cp = ap->a_name; - l1 = strlen(name); - if (*cp == '*') { - /* allow wildmatch */ - cp++; - l2 = strlen(cp); - if (l2 > l1 || memcmp(cp, [l1 - l2], l2) != 0) { - dprintf("rejected in rule %d due to name mismatch.\n", i); - continue; - } - } else { - /* exact match */ - l2 = strlen(cp); - if (l2 != l1 || memcmp(cp, name, l1) != 0) { - dprintf("rejected in rule %d due to name mismatch.\n", i); - continue; - } + if (fnmatch(ap->a_name, name, FNM_NOESCAPE) == + FNM_NOMATCH) { + dprintf("rejected in rule %d due to name " + "mismatch.\n", i); + continue; } } dprintf("accepted in rule %d.\n", i); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"