CVS commit: src/libexec/httpd
Module Name:src Committed By: mrg Date: Thu Jan 17 07:46:16 UTC 2019 Modified Files: src/libexec/httpd: CHANGES bozohttpd.8 bozohttpd.c cgi-bozo.c daemon-bozo.c dir-index-bozo.c Log Message: - call this 20190116 - adjust the directory indexing again: - don't include "index.html" in html headers - additional escaping of names - re-add top/bottom borders - adds an aquamarine table header - Zebra-stripes table rows using CSS instead of code all from "Rajeev V. Pillai" To generate a diff of this commit: cvs rdiff -u -r1.35 -r1.36 src/libexec/httpd/CHANGES cvs rdiff -u -r1.77 -r1.78 src/libexec/httpd/bozohttpd.8 cvs rdiff -u -r1.107 -r1.108 src/libexec/httpd/bozohttpd.c cvs rdiff -u -r1.46 -r1.47 src/libexec/httpd/cgi-bozo.c cvs rdiff -u -r1.20 -r1.21 src/libexec/httpd/daemon-bozo.c cvs rdiff -u -r1.29 -r1.30 src/libexec/httpd/dir-index-bozo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/httpd/CHANGES diff -u src/libexec/httpd/CHANGES:1.35 src/libexec/httpd/CHANGES:1.36 --- src/libexec/httpd/CHANGES:1.35 Thu Jan 17 07:34:06 2019 +++ src/libexec/httpd/CHANGES Thu Jan 17 07:46:16 2019 @@ -1,8 +1,9 @@ -$NetBSD: CHANGES,v 1.35 2019/01/17 07:34:06 mrg Exp $ +$NetBSD: CHANGES,v 1.36 2019/01/17 07:46:16 mrg Exp $ changes in bozohttpd 20190116: - o fix CGI '+' parameter handling, and a double free. from - rajeev_v_pil...@yahoo.com + o fix CGI '+' parameter handling, some error checking, and a double + free. from rajeev_v_pil...@yahoo.com + o more directory indexing clean up. from rajeev_v_pil...@yahoo.com changes in bozohttpd 20181215: o fix .htpasswd bypass for authenticated users. reported by JP, Index: src/libexec/httpd/bozohttpd.8 diff -u src/libexec/httpd/bozohttpd.8:1.77 src/libexec/httpd/bozohttpd.8:1.78 --- src/libexec/httpd/bozohttpd.8:1.77 Tue Jan 8 06:04:29 2019 +++ src/libexec/httpd/bozohttpd.8 Thu Jan 17 07:46:16 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: bozohttpd.8,v 1.77 2019/01/08 06:04:29 mrg Exp $ +.\" $NetBSD: bozohttpd.8,v 1.78 2019/01/17 07:46:16 mrg Exp $ .\" .\" $eterna: bozohttpd.8,v 1.101 2011/11/18 01:25:11 mrg Exp $ .\" @@ -597,7 +597,7 @@ The focus has always been simplicity and and regular code audits. This manual documents .Nm -version 20181215. +version 20190116. .Sh AUTHORS .An -nosplit .Nm @@ -632,7 +632,7 @@ provided cgi-bin support fixes, and more .Aq Mt a...@netbsd.org cleaned up many internal interfaces, made .Nm -linkable as a library and provided the Lua binding. +linkable as a library and provided the Lua binding .It .An DEGROOTE Arnaud .Aq Mt degro...@netbsd.org @@ -688,7 +688,7 @@ provided many fixes and enhancements for fixed memory leaks, various issues with userdir support, information disclosure issues, added support for using CGI handlers with directory indexing, found several security issues and provided -various other fixes. +various other fixes .It .An Arnaud Lacombe .Aq Mt a...@netbsd.org @@ -706,7 +706,7 @@ provided a cgi-bin fix .Aq Mt j...@netbsd.org Added the .Fl P -option (pidfile support) and provided some man page fixes. +option (pidfile support) and provided some man page fixes .It .An Luke Mewburn .Aq Mt lu...@netbsd.org @@ -715,7 +715,8 @@ HTTP basic authorization support and muc .It .An Rajeev V. Pillai .Aq Mt rajeev_v_pil...@yahoo.com -provided several fixes for virtual hosting and directory indexing +provided several fixes for virtual hosting and directory indexing and +fixes for CGI .It .An Jeremy C. Reed .Aq Mt r...@netbsd.org @@ -737,11 +738,11 @@ provided minor compile fixes and a CGI c .Aq Mt rum...@ephemeral.org provided the .Fl V -option. +option .It .An Thor Lancelot Simon .Aq Mt t...@netbsd.org -enhanced cgi-bin support. +enhanced cgi-bin support .It .An Joerg Sonnenberger .Aq Mt jo...@netbsd.org @@ -758,7 +759,7 @@ provided http authorization fixes .Aq Mt x...@kittenz.org provided chroot and change-to-user support, and other various fixes .It -Coyote Point provided various CGI fixes. +Coyote Point provided various CGI fixes .El .Pp There are probably others I have forgotten (let me know if you care) Index: src/libexec/httpd/bozohttpd.c diff -u src/libexec/httpd/bozohttpd.c:1.107 src/libexec/httpd/bozohttpd.c:1.108 --- src/libexec/httpd/bozohttpd.c:1.107 Sat Dec 15 12:52:36 2018 +++ src/libexec/httpd/bozohttpd.c Thu Jan 17 07:46:16 2019 @@ -1,9 +1,9 @@ -/* $NetBSD: bozohttpd.c,v 1.107 2018/12/15 12:52:36 leot Exp $ */ +/* $NetBSD: bozohttpd.c,v 1.108 2019/01/17 07:46:16 mrg Exp $ */ /* $eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $ */ /* - * Copyright (c) 1997-2018 Matthew R. Green + * Copyright (c) 1997-2019 Matthew R. Green * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -109,7 +109,7 @@ #define INDEX_HTML
CVS commit: src/libexec/httpd
Module Name:src Committed By: mrg Date: Thu Jan 17 07:39:00 UTC 2019 Modified Files: src/libexec/httpd: Makefile src/libexec/httpd/testsuite: t11.out Log Message: add 'check' target to toplevel makefile. fix the t11.out output now that CGI parsing works better. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/libexec/httpd/Makefile cvs rdiff -u -r1.1 -r1.2 src/libexec/httpd/testsuite/t11.out Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/httpd/Makefile diff -u src/libexec/httpd/Makefile:1.27 src/libexec/httpd/Makefile:1.28 --- src/libexec/httpd/Makefile:1.27 Sun May 21 15:28:41 2017 +++ src/libexec/httpd/Makefile Thu Jan 17 07:39:00 2019 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.27 2017/05/21 15:28:41 riastradh Exp $ +# $NetBSD: Makefile,v 1.28 2019/01/17 07:39:00 mrg Exp $ # # $eterna: Makefile,v 1.30 2010/07/11 00:34:27 mrg Exp $ # @@ -77,6 +77,9 @@ bozohttpd.8.txt: bozohttpd.8 CLEANFILES+= bozohttpd.8.html bozohttpd.8.txt +check: + cd ${.CURDIR}/testsuite && ${MAKE} check + # Create a distfile: uses /tmp BASE=bozohttpd-${BOZOVER} TAR=${BASE}.tar Index: src/libexec/httpd/testsuite/t11.out diff -u src/libexec/httpd/testsuite/t11.out:1.1 src/libexec/httpd/testsuite/t11.out:1.2 --- src/libexec/httpd/testsuite/t11.out:1.1 Tue Jan 31 14:33:54 2017 +++ src/libexec/httpd/testsuite/t11.out Thu Jan 17 07:39:00 2019 @@ -1 +1,11 @@ HTTP/1.1 200 OK +Content-Type: text/html +Content-Length: 194 +Server: bozohttpd/20181215 +Allow: GET, HEAD, POST + +404 Not Found +404 Not Found +cgi-bin/echo.bat: This item has not been found + +
CVS commit: src/libexec/httpd
Module Name:src Committed By: mrg Date: Thu Jan 17 07:34:06 UTC 2019 Modified Files: src/libexec/httpd: CHANGES cgi-bozo.c daemon-bozo.c Log Message: - fix CGI '+' param and error handling. - remove unused parameter to daemon_poll_err(). both from "Rajeev V. Pillai" To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/libexec/httpd/CHANGES cvs rdiff -u -r1.45 -r1.46 src/libexec/httpd/cgi-bozo.c cvs rdiff -u -r1.19 -r1.20 src/libexec/httpd/daemon-bozo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/libexec/httpd/CHANGES diff -u src/libexec/httpd/CHANGES:1.34 src/libexec/httpd/CHANGES:1.35 --- src/libexec/httpd/CHANGES:1.34 Wed Dec 19 12:40:32 2018 +++ src/libexec/httpd/CHANGES Thu Jan 17 07:34:06 2019 @@ -1,4 +1,8 @@ -$NetBSD: CHANGES,v 1.34 2018/12/19 12:40:32 mrg Exp $ +$NetBSD: CHANGES,v 1.35 2019/01/17 07:34:06 mrg Exp $ + +changes in bozohttpd 20190116: + o fix CGI '+' parameter handling, and a double free. from + rajeev_v_pil...@yahoo.com changes in bozohttpd 20181215: o fix .htpasswd bypass for authenticated users. reported by JP, Index: src/libexec/httpd/cgi-bozo.c diff -u src/libexec/httpd/cgi-bozo.c:1.45 src/libexec/httpd/cgi-bozo.c:1.46 --- src/libexec/httpd/cgi-bozo.c:1.45 Sat Nov 24 13:03:15 2018 +++ src/libexec/httpd/cgi-bozo.c Thu Jan 17 07:34:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: cgi-bozo.c,v 1.45 2018/11/24 13:03:15 christos Exp $ */ +/* $NetBSD: cgi-bozo.c,v 1.46 2019/01/17 07:34:06 mrg Exp $ */ /* $eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $ */ @@ -241,10 +241,10 @@ parse_search_string(bozo_httpreq_t *requ args[0] = str; args[*args_len] = NULL; - for (s = str, i = 0; (s = strchr(s, '+')) != NULL;) { + for (s = str, i = 1; (s = strchr(s, '+')) != NULL; i++) { *s = '\0'; s++; - args[i++] = s; + args[i] = s; } /* @@ -333,8 +333,7 @@ parse_search_string(bozo_httpreq_t *requ parse_err: - free (str); - free (*args); + free(str); free(args); *args_len = 0; @@ -610,9 +609,12 @@ bozo_process_cgi(bozo_httpreq_t *request closelog(); bozo_daemon_closefds(httpd); - if (-1 == execve(path, argv, envp)) + if (-1 == execve(path, argv, envp)) { + bozo_http_error(httpd, 404, request, +"Cannot execute CGI"); bozoerr(httpd, 1, "child exec failed: %s: %s", path, strerror(errno)); + } /* NOT REACHED */ bozoerr(httpd, 1, "child execve returned?!"); } Index: src/libexec/httpd/daemon-bozo.c diff -u src/libexec/httpd/daemon-bozo.c:1.19 src/libexec/httpd/daemon-bozo.c:1.20 --- src/libexec/httpd/daemon-bozo.c:1.19 Thu Nov 22 08:54:08 2018 +++ src/libexec/httpd/daemon-bozo.c Thu Jan 17 07:34:06 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: daemon-bozo.c,v 1.19 2018/11/22 08:54:08 mrg Exp $ */ +/* $NetBSD: daemon-bozo.c,v 1.20 2019/01/17 07:34:06 mrg Exp $ */ /* $eterna: daemon-bozo.c,v 1.24 2011/11/18 09:21:15 mrg Exp $ */ @@ -205,7 +205,7 @@ daemon_runchild(bozohttpd_t *httpd, int } static int -daemon_poll_err(bozohttpd_t *httpd, int fd, int idx) +daemon_poll_err(bozohttpd_t *httpd, int idx) { if ((httpd->fds[idx].revents & (POLLNVAL|POLLERR|POLLHUP)) == 0) return 0; @@ -284,7 +284,7 @@ again: } for (i = 0; i < httpd->nsock; i++) { - if (daemon_poll_err(httpd, fd, i)) + if (daemon_poll_err(httpd, i)) break; if (httpd->fds[i].revents == 0) continue;
CVS commit: src/share/man/man8
Module Name:src Committed By: gutteridge Date: Thu Jan 17 07:05:25 UTC 2019 Modified Files: src/share/man/man8: compat_netbsd32.8 Log Message: compat_netbsd32(8): brief adjustments concerning ARM binary support. At present, aarch64 doesn't actually offer OABI compatibility. Also note that this provides OABI vs. EABI compatibility for 32-bit ARM ports. Addresses the remainder of PR misc/48968. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/share/man/man8/compat_netbsd32.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man8/compat_netbsd32.8 diff -u src/share/man/man8/compat_netbsd32.8:1.12 src/share/man/man8/compat_netbsd32.8:1.13 --- src/share/man/man8/compat_netbsd32.8:1.12 Mon Jan 14 15:55:35 2019 +++ src/share/man/man8/compat_netbsd32.8 Thu Jan 17 07:05:24 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: compat_netbsd32.8,v 1.12 2019/01/14 15:55:35 wiz Exp $ +.\" $NetBSD: compat_netbsd32.8,v 1.13 2019/01/17 07:05:24 gutteridge Exp $ .\" .\" Copyright (c) 2001, 2019 Matthew R. Green .\" All rights reserved. @@ -24,7 +24,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd January 13, 2019 +.Dd January 17, 2019 .Dt COMPAT_NETBSD32 8 .Os .Sh NAME @@ -56,6 +56,9 @@ the default userland is N32 which is a h .Nm framework, and 64-bit binaries are handled similarly to the setup for 32-bit compatibility. +It also provides compatibility between OABI and EABI binaries on 32-bit +.Nx Ns Tn /arm +ports. .Pp To use .Nm , @@ -96,7 +99,6 @@ needs to be found in .It Li mips64 Ta N64 Ta /usr/libexec/ld.elf_so-64 .It Li powerpc64 Ta powerpc Ta /usr/libexec/ld.elf_so-powerpc .It Li arm64 Ta eabi Ta /usr/libexec/ld.elf_so-eabi -.It Li arm64 Ta oabi Ta /usr/libexec/ld.elf_so-oabi .El .Pp Note that the kernel handles rewriting the builting ELF interpreter
CVS commit: src/usr.sbin/btpand
Module Name:src Committed By: gutteridge Date: Thu Jan 17 05:52:22 UTC 2019 Modified Files: src/usr.sbin/btpand: btpand.8 Log Message: btpand(8): replace dhclient(8) references with dhcpcd(8) Addresses part of PR misc/53669. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/btpand/btpand.8 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/btpand/btpand.8 diff -u src/usr.sbin/btpand/btpand.8:1.6 src/usr.sbin/btpand/btpand.8:1.7 --- src/usr.sbin/btpand/btpand.8:1.6 Thu Mar 15 22:35:03 2012 +++ src/usr.sbin/btpand/btpand.8 Thu Jan 17 05:52:21 2019 @@ -1,4 +1,4 @@ -.\" $NetBSD: btpand.8,v 1.6 2012/03/15 22:35:03 njoly Exp $ +.\" $NetBSD: btpand.8,v 1.7 2019/01/17 05:52:21 gutteridge Exp $ .\" .\" Copyright (c) 2008 Iain Hibbert .\" All rights reserved. @@ -23,7 +23,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd August 17, 2008 +.Dd January 17, 2019 .Dt BTPAND 8 .Os .Sh NAME @@ -190,7 +190,7 @@ interface, it will create a pid file and .Sh EXAMPLES .Dl ifconfig tap1 create .Dl btpand -a host -d ubt0 -s NAP -m encrypt -i tap1 -.Dl dhclient -q -o -w -nw tap1 +.Dl dhcpcd -q -b tap1 .Pp Will create an encrypted connection to the NAP on .Ar host , @@ -209,7 +209,7 @@ the GN service with the local SDP server .Xr tap 4 , .Xr brconfig 8 , .Xr btconfig 8 , -.Xr dhclient 8 , +.Xr dhcpcd 8 , .Xr dhcpd 8 , .Xr ifconfig 8 , .Xr sdpd 8
CVS commit: src
Module Name:src Committed By: knakahara Date: Thu Jan 17 02:49:11 UTC 2019 Modified Files: src/distrib/sets/lists/tests: mi src/tests/net: net_common.sh src/tests/net/if_ipsec: Makefile Added Files: src/tests/net/if_ipsec: t_ipsec_pfil.sh Log Message: Add ATF for ipsecif(4) pfil. To generate a diff of this commit: cvs rdiff -u -r1.802 -r1.803 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.28 -r1.29 src/tests/net/net_common.sh cvs rdiff -u -r1.2 -r1.3 src/tests/net/if_ipsec/Makefile cvs rdiff -u -r0 -r1.1 src/tests/net/if_ipsec/t_ipsec_pfil.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.802 src/distrib/sets/lists/tests/mi:1.803 --- src/distrib/sets/lists/tests/mi:1.802 Thu Dec 27 19:35:31 2018 +++ src/distrib/sets/lists/tests/mi Thu Jan 17 02:49:11 2019 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.802 2018/12/27 19:35:31 christos Exp $ +# $NetBSD: mi,v 1.803 2019/01/17 02:49:11 knakahara Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -3338,6 +3338,7 @@ ./usr/tests/net/if_ipsec/Kyuafile tests-net-tests atf,rump,kyua ./usr/tests/net/if_ipsec/t_ipsec tests-net-tests atf,rump ./usr/tests/net/if_ipsec/t_ipsec_natt tests-net-tests atf,rump +./usr/tests/net/if_ipsec/t_ipsec_pfil tests-net-tests atf,rump ./usr/tests/net/if_l2tptests-net-tests compattestfile,atf ./usr/tests/net/if_l2tp/Atffile tests-net-tests atf,rump ./usr/tests/net/if_l2tp/Kyuafile tests-net-tests atf,rump,kyua Index: src/tests/net/net_common.sh diff -u src/tests/net/net_common.sh:1.28 src/tests/net/net_common.sh:1.29 --- src/tests/net/net_common.sh:1.28 Sat Apr 7 12:36:58 2018 +++ src/tests/net/net_common.sh Thu Jan 17 02:49:11 2019 @@ -1,4 +1,4 @@ -# $NetBSD: net_common.sh,v 1.28 2018/04/07 12:36:58 ozaki-r Exp $ +# $NetBSD: net_common.sh,v 1.29 2019/01/17 02:49:11 knakahara Exp $ # # Copyright (c) 2016 Internet Initiative Japan Inc. # All rights reserved. @@ -177,6 +177,7 @@ FS_LIBS="$BASIC_LIBS -lrumpvfs -lrumpfs_ CRYPTO_LIBS="$BASIC_LIBS -lrumpvfs -lrumpdev_opencrypto \ -lrumpkern_z -lrumpkern_crypto" NPF_LIBS="$BASIC_LIBS -lrumpvfs -lrumpdev_bpf -lrumpnet_npf" +CRYPTO_NPF_LIBS="$CRYPTO_LIBS -lrumpdev_bpf -lrumpnet_npf" # We cannot keep variables between test phases, so need to store in files _rump_server_socks=./.__socks @@ -293,6 +294,24 @@ rump_server_npf_start() return 0 } +rump_server_crypto_npf_start() +{ + local sock=$1 + local lib= + local libs="$CRYPTO_NPF_LIBS" + + shift 1 + + for lib + do + libs="$libs -lrumpnet_$lib" + done + + _rump_server_start_common $sock $libs + + return 0 +} + rump_server_add_iface() { local sock=$1 Index: src/tests/net/if_ipsec/Makefile diff -u src/tests/net/if_ipsec/Makefile:1.2 src/tests/net/if_ipsec/Makefile:1.3 --- src/tests/net/if_ipsec/Makefile:1.2 Tue Dec 25 03:54:44 2018 +++ src/tests/net/if_ipsec/Makefile Thu Jan 17 02:49:11 2019 @@ -1,11 +1,11 @@ -# $NetBSD: Makefile,v 1.2 2018/12/25 03:54:44 knakahara Exp $ +# $NetBSD: Makefile,v 1.3 2019/01/17 02:49:11 knakahara Exp $ # .include TESTSDIR= ${TESTSBASE}/net/if_ipsec -.for name in ipsec ipsec_natt +.for name in ipsec ipsec_natt ipsec_pfil TESTS_SH+= t_${name} TESTS_SH_SRC_t_${name}= ../net_common.sh t_${name}.sh \ ../ipsec/common.sh ../ipsec/algorithms.sh Added files: Index: src/tests/net/if_ipsec/t_ipsec_pfil.sh diff -u /dev/null src/tests/net/if_ipsec/t_ipsec_pfil.sh:1.1 --- /dev/null Thu Jan 17 02:49:11 2019 +++ src/tests/net/if_ipsec/t_ipsec_pfil.sh Thu Jan 17 02:49:11 2019 @@ -0,0 +1,364 @@ +# $NetBSD: t_ipsec_pfil.sh,v 1.1 2019/01/17 02:49:11 knakahara Exp $ +# +# Copyright (c) 2019 Internet Initiative Japan Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +#notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +#notice, this list of conditions and the following disclaimer in the +#documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
CVS commit: src/sys
Module Name:src Committed By: knakahara Date: Thu Jan 17 02:47:15 UTC 2019 Modified Files: src/sys/kern: uipc_mbuf.c src/sys/netinet: ip_input.c src/sys/netinet6: ip6_input.c src/sys/netipsec: ipsec.h ipsec_input.c src/sys/sys: mbuf.h Log Message: Fix ipsecif(4) cannot apply input direction packet filter. Reviewed by ozaki-r@n.o and ryo@n.o. Add ATF later. To generate a diff of this commit: cvs rdiff -u -r1.231 -r1.232 src/sys/kern/uipc_mbuf.c cvs rdiff -u -r1.387 -r1.388 src/sys/netinet/ip_input.c cvs rdiff -u -r1.206 -r1.207 src/sys/netinet6/ip6_input.c cvs rdiff -u -r1.86 -r1.87 src/sys/netipsec/ipsec.h cvs rdiff -u -r1.73 -r1.74 src/sys/netipsec/ipsec_input.c cvs rdiff -u -r1.218 -r1.219 src/sys/sys/mbuf.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/uipc_mbuf.c diff -u src/sys/kern/uipc_mbuf.c:1.231 src/sys/kern/uipc_mbuf.c:1.232 --- src/sys/kern/uipc_mbuf.c:1.231 Wed Jan 16 01:50:25 2019 +++ src/sys/kern/uipc_mbuf.c Thu Jan 17 02:47:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_mbuf.c,v 1.231 2019/01/16 01:50:25 knakahara Exp $ */ +/* $NetBSD: uipc_mbuf.c,v 1.232 2019/01/17 02:47:15 knakahara Exp $ */ /* * Copyright (c) 1999, 2001, 2018 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.231 2019/01/16 01:50:25 knakahara Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.232 2019/01/17 02:47:15 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_mbuftrace.h" @@ -567,6 +567,7 @@ m_gethdr(int how, int type) m->m_pkthdr.csum_data = 0; m->m_pkthdr.segsz = 0; m->m_pkthdr.ether_vtag = 0; + m->m_pkthdr.pkthdr_flags = 0; SLIST_INIT(>m_pkthdr.tags); m->m_pkthdr.pattr_class = NULL; Index: src/sys/netinet/ip_input.c diff -u src/sys/netinet/ip_input.c:1.387 src/sys/netinet/ip_input.c:1.388 --- src/sys/netinet/ip_input.c:1.387 Thu Nov 15 10:23:56 2018 +++ src/sys/netinet/ip_input.c Thu Jan 17 02:47:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.387 2018/11/15 10:23:56 maxv Exp $ */ +/* $NetBSD: ip_input.c,v 1.388 2019/01/17 02:47:15 knakahara Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.387 2018/11/15 10:23:56 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.388 2019/01/17 02:47:15 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -567,7 +567,7 @@ ip_input(struct mbuf *m) * IPsec (encapsulated, tunnel mode). */ #if defined(IPSEC) - if (!ipsec_used || !ipsec_indone(m)) + if (!ipsec_used || !ipsec_skip_pfil(m)) #else if (1) #endif Index: src/sys/netinet6/ip6_input.c diff -u src/sys/netinet6/ip6_input.c:1.206 src/sys/netinet6/ip6_input.c:1.207 --- src/sys/netinet6/ip6_input.c:1.206 Mon Jan 14 18:51:15 2019 +++ src/sys/netinet6/ip6_input.c Thu Jan 17 02:47:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_input.c,v 1.206 2019/01/14 18:51:15 maxv Exp $ */ +/* $NetBSD: ip6_input.c,v 1.207 2019/01/17 02:47:15 knakahara Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.206 2019/01/14 18:51:15 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.207 2019/01/17 02:47:15 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_gateway.h" @@ -342,7 +342,7 @@ ip6_input(struct mbuf *m, struct ifnet * * IPsec (encapsulated, tunnel mode). */ #if defined(IPSEC) - if (!ipsec_used || !ipsec_indone(m)) + if (!ipsec_used || !ipsec_skip_pfil(m)) #else if (1) #endif Index: src/sys/netipsec/ipsec.h diff -u src/sys/netipsec/ipsec.h:1.86 src/sys/netipsec/ipsec.h:1.87 --- src/sys/netipsec/ipsec.h:1.86 Thu Nov 22 04:48:34 2018 +++ src/sys/netipsec/ipsec.h Thu Jan 17 02:47:15 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ipsec.h,v 1.86 2018/11/22 04:48:34 knakahara Exp $ */ +/* $NetBSD: ipsec.h,v 1.87 2019/01/17 02:47:15 knakahara Exp $ */ /* $FreeBSD: ipsec.h,v 1.2.4.2 2004/02/14 22:23:23 bms Exp $ */ /* $KAME: ipsec.h,v 1.53 2001/11/20 08:32:38 itojun Exp $ */ @@ -250,6 +250,22 @@ extern int crypto_support; #define ipsec_outdone(m) \ (m_tag_find((m), PACKET_TAG_IPSEC_OUT_DONE) != NULL) +static __inline bool +ipsec_skip_pfil(struct mbuf *m) +{ + bool rv; + + if (ipsec_indone(m) && + ((m->m_pkthdr.pkthdr_flags & PKTHDR_FLAG_IPSEC_SKIP_PFIL) != 0)) { + m->m_pkthdr.pkthdr_flags &= ~PKTHDR_FLAG_IPSEC_SKIP_PFIL; + rv = true; + } else { + rv = false; + } + + return rv; +} + void ipsec_pcbconn(struct inpcbpolicy *); void ipsec_pcbdisconn(struct inpcbpolicy *); void ipsec_invalpcbcacheall(void); Index: src/sys/netipsec/ipsec_input.c diff -u src/sys/netipsec/ipsec_input.c:1.73 src/sys/netipsec/ipsec_input.c:1.74 --- src/sys/netipsec/ipsec_input.c:1.73 Thu Nov 15 10:23:56 2018 +++ src/sys/netipsec/ipsec_input.c Thu Jan 17 02:47:15
CVS commit: src/tests/sys/uvm
Module Name:src Committed By: fox Date: Wed Jan 16 13:54:17 UTC 2019 Modified Files: src/tests/sys/uvm: t_uvm_physseg.c Log Message: Fixed issues with uvm_page_physunload_delete_end test case. 1. "avail_start" and "start" were different, resulting in unreachable code in uvm_page_physunload(), where the condition check "avail_start" < "end" fails. The test has been fixed by setting "avail_start" and "start" to the same value. 2. If "start" is the address with end address being "start + 2", we can unplug twice, the first paddr_t would be "start" and the second one would be "start + 1". Modified the ATF_CHECK_EQ() to reflect these changes. Reviewed by To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/tests/sys/uvm/t_uvm_physseg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/sys/uvm/t_uvm_physseg.c diff -u src/tests/sys/uvm/t_uvm_physseg.c:1.7 src/tests/sys/uvm/t_uvm_physseg.c:1.8 --- src/tests/sys/uvm/t_uvm_physseg.c:1.7 Wed Jan 16 13:45:29 2019 +++ src/tests/sys/uvm/t_uvm_physseg.c Wed Jan 16 13:54:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_uvm_physseg.c,v 1.7 2019/01/16 13:45:29 fox Exp $ */ +/* $NetBSD: t_uvm_physseg.c,v 1.8 2019/01/16 13:54:17 fox Exp $ */ /*- * Copyright (c) 2015, 2016 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: t_uvm_physseg.c,v 1.7 2019/01/16 13:45:29 fox Exp $"); +__RCSID("$NetBSD: t_uvm_physseg.c,v 1.8 2019/01/16 13:54:17 fox Exp $"); /* * If this line is commented out tests related to uvm_physseg_get_pmseg() @@ -2155,7 +2155,7 @@ ATF_TC_BODY(uvm_page_physunload_delete_e */ upm = uvm_page_physload(VALID_START_PFN_1, VALID_START_PFN_1 + 2, - VALID_AVAIL_START_PFN_1 + 1, VALID_AVAIL_START_PFN_1 + 2, + VALID_AVAIL_START_PFN_1, VALID_AVAIL_START_PFN_1 + 2, VM_FREELIST_DEFAULT); ATF_REQUIRE_EQ(1, uvm_physseg_get_entries()); @@ -2177,11 +2177,13 @@ ATF_TC_BODY(uvm_page_physunload_delete_e ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, )); + ATF_CHECK_EQ(VALID_START_PFN_1, atop(p)); + p = 0; ATF_CHECK_EQ(true, uvm_page_physunload(upm, VM_FREELIST_DEFAULT, )); - ATF_CHECK_EQ(VALID_START_PFN_1 + 2, atop(p)); + ATF_CHECK_EQ(VALID_START_PFN_1 + 1, atop(p)); ATF_CHECK_EQ(1, uvm_physseg_get_entries());
CVS commit: src/tests/sys/uvm
Module Name:src Committed By: fox Date: Wed Jan 16 13:45:29 UTC 2019 Modified Files: src/tests/sys/uvm: t_uvm_physseg.c Log Message: Fixed issues with uvm_physseg_atboot_free_leak test case. "\n" in ATF discriptions make it behave in weird ways, like saying "this test is bogus.", fixed the issue by removing the "\n". Reviewed by To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/tests/sys/uvm/t_uvm_physseg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/sys/uvm/t_uvm_physseg.c diff -u src/tests/sys/uvm/t_uvm_physseg.c:1.6 src/tests/sys/uvm/t_uvm_physseg.c:1.7 --- src/tests/sys/uvm/t_uvm_physseg.c:1.6 Wed Jan 16 13:35:51 2019 +++ src/tests/sys/uvm/t_uvm_physseg.c Wed Jan 16 13:45:29 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_uvm_physseg.c,v 1.6 2019/01/16 13:35:51 fox Exp $ */ +/* $NetBSD: t_uvm_physseg.c,v 1.7 2019/01/16 13:45:29 fox Exp $ */ /*- * Copyright (c) 2015, 2016 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: t_uvm_physseg.c,v 1.6 2019/01/16 13:35:51 fox Exp $"); +__RCSID("$NetBSD: t_uvm_physseg.c,v 1.7 2019/01/16 13:45:29 fox Exp $"); /* * If this line is commented out tests related to uvm_physseg_get_pmseg() @@ -401,7 +401,7 @@ ATF_TC(uvm_physseg_atboot_free_leak); ATF_TC_HEAD(uvm_physseg_atboot_free_leak, tc) { atf_tc_set_md_var(tc, "descr", - "does free() leak at boot ?\n" + "does free() leak at boot ?" "This test needs VM_PHYSSEG_MAX > 1)"); }
CVS commit: src/tests/sys/uvm
Module Name:src Committed By: fox Date: Wed Jan 16 13:35:51 UTC 2019 Modified Files: src/tests/sys/uvm: t_uvm_physseg.c Log Message: Fixed issues with uvm_physseg_plug test case. There is a condition check which failed for VM_PHYSSEG_MAX == 2 (not for 1 or 3 and above), in case of 2, pgs == slab + npages1 + npages3, so we need to change ">" check to ">=" check. Reviewed by To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/sys/uvm/t_uvm_physseg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/sys/uvm/t_uvm_physseg.c diff -u src/tests/sys/uvm/t_uvm_physseg.c:1.5 src/tests/sys/uvm/t_uvm_physseg.c:1.6 --- src/tests/sys/uvm/t_uvm_physseg.c:1.5 Wed Jan 16 13:21:02 2019 +++ src/tests/sys/uvm/t_uvm_physseg.c Wed Jan 16 13:35:51 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_uvm_physseg.c,v 1.5 2019/01/16 13:21:02 fox Exp $ */ +/* $NetBSD: t_uvm_physseg.c,v 1.6 2019/01/16 13:35:51 fox Exp $ */ /*- * Copyright (c) 2015, 2016 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: t_uvm_physseg.c,v 1.5 2019/01/16 13:21:02 fox Exp $"); +__RCSID("$NetBSD: t_uvm_physseg.c,v 1.6 2019/01/16 13:35:51 fox Exp $"); /* * If this line is commented out tests related to uvm_physseg_get_pmseg() @@ -522,7 +522,7 @@ ATF_TC_BODY(uvm_physseg_plug, tc) ATF_REQUIRE_EQ(uvm_physseg_plug(VALID_START_PFN_4, npages4, ), true); /* The hot plug slab should have nothing to do with the original slab */ pgs = uvm_physseg_get_pg(upm4, 0); - ATF_REQUIRE(pgs < slab || pgs > (slab + npages1 + ATF_REQUIRE(pgs < slab || pgs >= (slab + npages1 #if VM_PHYSSEG_MAX > 2 + npages2 #endif
CVS commit: src/tests/sys/uvm
Module Name:src Committed By: fox Date: Wed Jan 16 13:21:02 UTC 2019 Modified Files: src/tests/sys/uvm: t_uvm_physseg.c Log Message: Fixed the build failures caused by incompatible type comparisons when VM_PHYSSEG is > 1. Reviewed by To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/sys/uvm/t_uvm_physseg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/sys/uvm/t_uvm_physseg.c diff -u src/tests/sys/uvm/t_uvm_physseg.c:1.4 src/tests/sys/uvm/t_uvm_physseg.c:1.5 --- src/tests/sys/uvm/t_uvm_physseg.c:1.4 Tue Dec 18 07:11:35 2018 +++ src/tests/sys/uvm/t_uvm_physseg.c Wed Jan 16 13:21:02 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: t_uvm_physseg.c,v 1.4 2018/12/18 07:11:35 fox Exp $ */ +/* $NetBSD: t_uvm_physseg.c,v 1.5 2019/01/16 13:21:02 fox Exp $ */ /*- * Copyright (c) 2015, 2016 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__RCSID("$NetBSD: t_uvm_physseg.c,v 1.4 2018/12/18 07:11:35 fox Exp $"); +__RCSID("$NetBSD: t_uvm_physseg.c,v 1.5 2019/01/16 13:21:02 fox Exp $"); /* * If this line is commented out tests related to uvm_physseg_get_pmseg() @@ -512,7 +512,7 @@ ATF_TC_BODY(uvm_physseg_plug, tc) #if VM_PHYSSEG_MAX > 2 + npages2 #endif - + npages3, uvmexp.npages); + + npages3, INT_TO_PSIZE_T(uvmexp.npages)); /* Scavenge plug should fit right in the slab */ pgs = uvm_physseg_get_pg(upm3, 0);
CVS commit: src/sys/dev/mii
Module Name:src Committed By: msaitoh Date: Wed Jan 16 10:10:49 UTC 2019 Modified Files: src/sys/dev/mii: rgephy.c urlphy.c Log Message: Pass flags correctly. See also: http://mail-index.netbsd.org/source-changes/2002/03/25/msg100515.html To generate a diff of this commit: cvs rdiff -u -r1.44 -r1.45 src/sys/dev/mii/rgephy.c cvs rdiff -u -r1.31 -r1.32 src/sys/dev/mii/urlphy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/mii/rgephy.c diff -u src/sys/dev/mii/rgephy.c:1.44 src/sys/dev/mii/rgephy.c:1.45 --- src/sys/dev/mii/rgephy.c:1.44 Wed Jun 27 07:51:36 2018 +++ src/sys/dev/mii/rgephy.c Wed Jan 16 10:10:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rgephy.c,v 1.44 2018/06/27 07:51:36 msaitoh Exp $ */ +/* $NetBSD: rgephy.c,v 1.45 2019/01/16 10:10:49 msaitoh Exp $ */ /* * Copyright (c) 2003 @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.44 2018/06/27 07:51:36 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rgephy.c,v 1.45 2019/01/16 10:10:49 msaitoh Exp $"); /* @@ -134,7 +134,7 @@ rgephy_attach(device_t parent, device_t sc->mii_mpd_model = MII_MODEL(ma->mii_id2); sc->mii_mpd_rev = MII_REV(ma->mii_id2); sc->mii_pdata = mii; - sc->mii_flags = mii->mii_flags; + sc->mii_flags = ma->mii_flags; sc->mii_anegticks = MII_ANEGTICKS_GIGE; sc->mii_funcs = _funcs; Index: src/sys/dev/mii/urlphy.c diff -u src/sys/dev/mii/urlphy.c:1.31 src/sys/dev/mii/urlphy.c:1.32 --- src/sys/dev/mii/urlphy.c:1.31 Thu Jul 7 06:55:41 2016 +++ src/sys/dev/mii/urlphy.c Wed Jan 16 10:10:49 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: urlphy.c,v 1.31 2016/07/07 06:55:41 msaitoh Exp $ */ +/* $NetBSD: urlphy.c,v 1.32 2019/01/16 10:10:49 msaitoh Exp $ */ /* * Copyright (c) 2001, 2002 * Shingo WATANABE . All rights reserved. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.31 2016/07/07 06:55:41 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: urlphy.c,v 1.32 2019/01/16 10:10:49 msaitoh Exp $"); #include #include @@ -110,7 +110,7 @@ urlphy_attach(device_t parent, device_t sc->mii_phy = ma->mii_phyno; sc->mii_funcs = _funcs; sc->mii_pdata = mii; - sc->mii_flags = mii->mii_flags; + sc->mii_flags = ma->mii_flags; sc->mii_anegticks = MII_ANEGTICKS_GIGE; /* Don't do loopback on this PHY. */
CVS commit: src/sys/dev/mii
Module Name:src Committed By: msaitoh Date: Wed Jan 16 08:40:24 UTC 2019 Modified Files: src/sys/dev/mii: ciphy.c Log Message: CIPHY_MII_BMCR -> MII_BMCR in #ifdef foo. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/mii/ciphy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/mii/ciphy.c diff -u src/sys/dev/mii/ciphy.c:1.27 src/sys/dev/mii/ciphy.c:1.28 --- src/sys/dev/mii/ciphy.c:1.27 Wed Jan 16 08:32:58 2019 +++ src/sys/dev/mii/ciphy.c Wed Jan 16 08:40:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ciphy.c,v 1.27 2019/01/16 08:32:58 msaitoh Exp $ */ +/* $NetBSD: ciphy.c,v 1.28 2019/01/16 08:40:24 msaitoh Exp $ */ /*- * Copyright (c) 2004 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.27 2019/01/16 08:32:58 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.28 2019/01/16 08:40:24 msaitoh Exp $"); /* * Driver for the Cicada CS8201 10/100/1000 copper PHY. @@ -183,7 +183,7 @@ ciphy_service(struct mii_softc *sc, stru /* * If we're already in auto mode, just return. */ - if (PHY_READ(sc, CIPHY_MII_BMCR) & CIPHY_BMCR_AUTOEN) + if (PHY_READ(sc, MII_BMCR) & BMCR_AUTOEN) return (0); #endif (void) mii_phy_auto(sc, 0);
CVS commit: src/sys/dev/mii
Module Name:src Committed By: msaitoh Date: Wed Jan 16 08:32:58 UTC 2019 Modified Files: src/sys/dev/mii: ciphy.c ciphyreg.h Log Message: The register bit definitions from register 0 to 15 in ciphyreg.h conform to the 802.3 spec, so remove them and use mii.h's definition. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/mii/ciphy.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/mii/ciphyreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/mii/ciphy.c diff -u src/sys/dev/mii/ciphy.c:1.26 src/sys/dev/mii/ciphy.c:1.27 --- src/sys/dev/mii/ciphy.c:1.26 Thu Jul 7 06:55:41 2016 +++ src/sys/dev/mii/ciphy.c Wed Jan 16 08:32:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ciphy.c,v 1.26 2016/07/07 06:55:41 msaitoh Exp $ */ +/* $NetBSD: ciphy.c,v 1.27 2019/01/16 08:32:58 msaitoh Exp $ */ /*- * Copyright (c) 2004 @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.26 2016/07/07 06:55:41 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ciphy.c,v 1.27 2019/01/16 08:32:58 msaitoh Exp $"); /* * Driver for the Cicada CS8201 10/100/1000 copper PHY. @@ -189,31 +189,31 @@ ciphy_service(struct mii_softc *sc, stru (void) mii_phy_auto(sc, 0); break; case IFM_1000_T: - speed = CIPHY_S1000; + speed = BMCR_S1000; goto setit; case IFM_100_TX: - speed = CIPHY_S100; + speed = BMCR_S100; goto setit; case IFM_10_T: - speed = CIPHY_S10; + speed = BMCR_S10; setit: if ((ife->ifm_media & IFM_GMASK) == IFM_FDX) { -speed |= CIPHY_BMCR_FDX; -gig = CIPHY_1000CTL_AFD; +speed |= BMCR_FDX; +gig = GTCR_ADV_1000TFDX; } else { -gig = CIPHY_1000CTL_AHD; +gig = GTCR_ADV_1000THDX; } - PHY_WRITE(sc, CIPHY_MII_1000CTL, 0); - PHY_WRITE(sc, CIPHY_MII_BMCR, speed); - PHY_WRITE(sc, CIPHY_MII_ANAR, CIPHY_SEL_TYPE); + PHY_WRITE(sc, MII_GTCR, 0); + PHY_WRITE(sc, MII_BMCR, speed); + PHY_WRITE(sc, MII_ANAR, ANAR_CSMA); if (IFM_SUBTYPE(ife->ifm_media) != IFM_1000_T) break; - PHY_WRITE(sc, CIPHY_MII_1000CTL, gig); - PHY_WRITE(sc, CIPHY_MII_BMCR, - speed|CIPHY_BMCR_AUTOEN|CIPHY_BMCR_STARTNEG); + PHY_WRITE(sc, MII_GTCR, gig); + PHY_WRITE(sc, MII_BMCR, + speed | BMCR_AUTOEN | BMCR_STARTNEG); /* * When setting the link manually, one side must @@ -224,15 +224,15 @@ setit: * be a master, otherwise it's a slave. */ if ((mii->mii_ifp->if_flags & IFF_LINK0)) { -PHY_WRITE(sc, CIPHY_MII_1000CTL, -gig|CIPHY_1000CTL_MSE|CIPHY_1000CTL_MSC); +PHY_WRITE(sc, MII_GTCR, +gig | GTCR_MAN_MS | GTCR_ADV_MS); } else { -PHY_WRITE(sc, CIPHY_MII_1000CTL, -gig|CIPHY_1000CTL_MSE); +PHY_WRITE(sc, MII_GTCR, +gig | GTCR_MAN_MS); } break; case IFM_NONE: - PHY_WRITE(sc, MII_BMCR, BMCR_ISO|BMCR_PDOWN); + PHY_WRITE(sc, MII_BMCR, BMCR_ISO | BMCR_PDOWN); break; case IFM_100_T4: default: @@ -330,13 +330,13 @@ ciphy_status(struct mii_softc *sc) if (bmsr & BMSR_LINK) mii->mii_media_status |= IFM_ACTIVE; - bmcr = PHY_READ(sc, CIPHY_MII_BMCR); + bmcr = PHY_READ(sc, MII_BMCR); - if (bmcr & CIPHY_BMCR_LOOP) + if (bmcr & BMCR_LOOP) mii->mii_media_active |= IFM_LOOP; - if (bmcr & CIPHY_BMCR_AUTOEN) { - if ((bmsr & CIPHY_BMSR_ACOMP) == 0) { + if (bmcr & BMCR_AUTOEN) { + if ((bmsr & BMSR_ACOMP) == 0) { /* Erg, still trying, I guess... */ mii->mii_media_active |= IFM_NONE; return; @@ -388,7 +388,7 @@ ciphy_fixup(struct mii_softc *sc) uint16_t model; uint16_t status, speed; - model = MII_MODEL(PHY_READ(sc, CIPHY_MII_PHYIDR2)); + model = MII_MODEL(PHY_READ(sc, MII_PHYIDR2)); status = PHY_READ(sc, CIPHY_MII_AUXCSR); speed = status & CIPHY_AUXCSR_SPEED; Index: src/sys/dev/mii/ciphyreg.h diff -u src/sys/dev/mii/ciphyreg.h:1.5 src/sys/dev/mii/ciphyreg.h:1.6 --- src/sys/dev/mii/ciphyreg.h:1.5 Mon Jun 16 14:43:22 2014 +++ src/sys/dev/mii/ciphyreg.h Wed Jan 16 08:32:58 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ciphyreg.h,v 1.5 2014/06/16 14:43:22 msaitoh Exp $ */ +/* $NetBSD: ciphyreg.h,v 1.6 2019/01/16 08:32:58 msaitoh Exp $ */ /*- * Copyright (c) 2004 @@ -42,134 +42,6 @@ * PHY, embedded within the VIA Networks VT6122 controller. */ -/* Command register */ -#define CIPHY_MII_BMCR 0x00 -#define CIPHY_BMCR_RESET 0x8000 -#define CIPHY_BMCR_LOOP 0x4000 -#define CIPHY_BMCR_SPD0 0x2000 /* speed select, lower bit */ -#define CIPHY_BMCR_AUTOEN 0x1000 /* Autoneg enabled */ -#define CIPHY_BMCR_PDOWN 0x0800 /* Power down */ -#define CIPHY_BMCR_STARTNEG 0x0200 /* Restart autoneg */ -#define CIPHY_BMCR_FDX 0x0100 /* Duplex mode */ -#define CIPHY_BMCR_CTEST 0x0080 /* Collision test enable */ -#define CIPHY_BMCR_SPD1 0x0040 /* Speed select, upper bit */ - -#define CIPHY_S1000 CIPHY_BMCR_SPD1 /* 1000mbps */ -#define CIPHY_S100 CIPHY_BMCR_SPD0 /* 100mpbs */ -#define CIPHY_S10 0
CVS commit: src/sys/dev/mii
Module Name:src Committed By: msaitoh Date: Wed Jan 16 08:32:24 UTC 2019 Modified Files: src/sys/dev/mii: mii.h Log Message: Add MII_100T2CR and MII_GTCR's test mode definitions. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/dev/mii/mii.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/mii/mii.h diff -u src/sys/dev/mii/mii.h:1.24 src/sys/dev/mii/mii.h:1.25 --- src/sys/dev/mii/mii.h:1.24 Wed Jan 16 07:30:35 2019 +++ src/sys/dev/mii/mii.h Wed Jan 16 08:32:24 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: mii.h,v 1.24 2019/01/16 07:30:35 msaitoh Exp $ */ +/* $NetBSD: mii.h,v 1.25 2019/01/16 08:32:24 msaitoh Exp $ */ /* * Copyright (c) 1997 Manuel Bouyer. All rights reserved. @@ -229,6 +229,18 @@ #define GTCR_ADV_1000TFDX 0x0200 /* adv. 1000baseT FDX */ #define GTCR_ADV_1000THDX 0x0100 /* adv. 1000baseT HDX */ +#define T2CR_TEST_NORMAL (0 << 13) /* Normal Operation */ +#define T2CR_TEST_RX (1 << 13) /* RX test */ +#define T2CR_TEST_TX_WAVEFORM (1 << 14) /* Mode 1. TX waveform test */ +#define T2CR_TEST_TX_JITTER (2 << 14) /* Mode 2. TX jitter test */ +#define T2CR_TEST_TX_IDLE (3 << 14) /* Mode 3. TX idle test */ + +#define GTCR_TEST_NORMAL (0 << 13) /* Normal Operation */ +#define GTCR_TEST_TX_WAVEFORM (1 << 13) /* Mode 1. TX waveform test */ +#define GTCR_TEST_TX_JITTER_M (2 << 13) /* Mode 2. TX jitter test (Master) */ +#define GTCR_TEST_TX_JITTER_S (3 << 13) /* Mode 3. TX jitter test (Slave) */ +#define GTCR_TEST_TX_DISTORTION (4 << 13) /* Mode 4. TX distortion test */ + #define MII_GTSR 0x0a /* * Master-Slave status register for * 100BASE-T2 and 1000BASE-T.