svn commit: r368246 - in head/sys/dev/usb: quirk storage

2020-12-01 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Dec  1 18:24:06 2020
New Revision: 368246
URL: https://svnweb.freebsd.org/changeset/base/368246

Log:
  USB umass: add quirk to not probe
  
  Some USB WLAN devices have "on-board" storage showing up as umass
  and making the root mount wait for a very long time.
  The WLAN drivers know how to deal with that an issue an eject
  command later when attaching themselves.
  Introduce a quirk to not probe these devices as umass and avoid
  hangs and confusion altogether.
  
  Reviewed by:  hselasky, imp
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D27434

Modified:
  head/sys/dev/usb/quirk/usb_quirk.c
  head/sys/dev/usb/quirk/usb_quirk.h
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/quirk/usb_quirk.c
==
--- head/sys/dev/usb/quirk/usb_quirk.c  Tue Dec  1 18:22:34 2020
(r368245)
+++ head/sys/dev/usb/quirk/usb_quirk.c  Tue Dec  1 18:24:06 2020
(r368246)
@@ -539,6 +539,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK
USB_QUIRK(QUALCOMMINC, ZTE_MF730M, 0x, 0x, UQ_MSC_NO_GETMAXLUN,
UQ_MSC_NO_INQUIRY, UQ_CFG_INDEX_0),
USB_QUIRK(SMART2, G2MEMKEY, 0x, 0x, UQ_MSC_NO_INQUIRY),
+   USB_QUIRK(RALINK, RT_STOR, 0x0001, 0x0001, UQ_MSC_IGNORE),
/* Non-standard USB MIDI devices */
USB_QUIRK(ROLAND, UM1, 0x, 0x, UQ_AU_VENDOR_CLASS),
USB_QUIRK(ROLAND, SC8850, 0x, 0x, UQ_AU_VENDOR_CLASS),
@@ -642,6 +643,7 @@ static const char *usb_quirk_str[USB_QUIRK_MAX] = {
[UQ_MSC_FORCE_PROTO_ATAPI]  = "UQ_MSC_FORCE_PROTO_ATAPI",
[UQ_MSC_FORCE_PROTO_UFI]= "UQ_MSC_FORCE_PROTO_UFI",
[UQ_MSC_FORCE_PROTO_RBC]= "UQ_MSC_FORCE_PROTO_RBC",
+   [UQ_MSC_IGNORE] = "UQ_MSC_IGNORE",
[UQ_MSC_EJECT_HUAWEI]   = "UQ_MSC_EJECT_HUAWEI",
[UQ_MSC_EJECT_SIERRA]   = "UQ_MSC_EJECT_SIERRA",
[UQ_MSC_EJECT_SCSIEJECT]= "UQ_MSC_EJECT_SCSIEJECT",

Modified: head/sys/dev/usb/quirk/usb_quirk.h
==
--- head/sys/dev/usb/quirk/usb_quirk.h  Tue Dec  1 18:22:34 2020
(r368245)
+++ head/sys/dev/usb/quirk/usb_quirk.h  Tue Dec  1 18:24:06 2020
(r368246)
@@ -93,6 +93,7 @@ enum {
UQ_MSC_FORCE_PROTO_ATAPI,   /* force ATAPI command protocol */
UQ_MSC_FORCE_PROTO_UFI, /* force UFI command protocol */
UQ_MSC_FORCE_PROTO_RBC, /* force RBC command protocol */
+   UQ_MSC_IGNORE,  /* device should be ignored by umass */
 
/* Ejection of mass storage (driver disk) */
UQ_MSC_EJECT_HUAWEI,/* ejects after Huawei USB command */

Modified: head/sys/dev/usb/storage/umass.c
==
--- head/sys/dev/usb/storage/umass.cTue Dec  1 18:22:34 2020
(r368245)
+++ head/sys/dev/usb/storage/umass.cTue Dec  1 18:24:06 2020
(r368246)
@@ -784,6 +784,12 @@ umass_probe_proto(device_t dev, struct usb_attach_arg 
memset(, 0, sizeof(ret));
ret.error = BUS_PROBE_GENERIC;
 
+   /* Check if we should deny probing. */
+   if (usb_test_quirk(uaa, UQ_MSC_IGNORE)) {
+   ret.error = ENXIO;
+   goto done;
+   }
+
/* Search for protocol enforcement */
 
if (usb_test_quirk(uaa, UQ_MSC_FORCE_WIRE_BBB)) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_w

2020-11-30 Thread Bjoern A. Zeeb

On 30 Nov 2020, at 14:53, cglogic wrote:

So you propose to make it dependent on linuxkpi? What have to do a 
user who does not compile linuxkpi, but wants to use if_wg?


If we’d move the implementations into linuxkpi you’d have to compile 
it to use if_wg.

So that this however is only a question.

Effectively you are using parts of linuxkpi now already, just 
copy (duplicated) into local files under if_wg;  for as much as I 
can see for most of that would however not require linuxkpi to be 
loaded, just present at compile time like any other kernel headers.


/bz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_w

2020-11-30 Thread Bjoern A. Zeeb

On 30 Nov 2020, at 9:27, Emmanuel Vadot wrote:


On Mon, 30 Nov 2020 01:13:12 +
"Bjoern A. Zeeb"  wrote:


On 29 Nov 2020, at 19:38, Matt Macy wrote:


Author: mmacy
Date: Sun Nov 29 19:38:03 2020
New Revision: 368163
URL: https://svnweb.freebsd.org/changeset/base/368163

Log:
  Import kernel WireGuard support

  Data path largely shared with the OpenBSD implementation by
  Matt Dunwoodie 

  Reviewed by:  gre...@freebsd.org
  MFC after:1 month
  Sponsored by: Rubicon LLC, (Netgate)
  Differential Revision:https://reviews.freebsd.org/D26137

Added:
  head/sbin/ifconfig/ifwg.c   (contents, props changed)
  head/sys/dev/if_wg/
  head/sys/dev/if_wg/include/
  head/sys/dev/if_wg/include/crypto/blake2s.h   (contents, props
changed)
  head/sys/dev/if_wg/include/crypto/curve25519.h   (contents, props
changed)
  head/sys/dev/if_wg/include/crypto/zinc.h   (contents, props 
changed)

  head/sys/dev/if_wg/include/sys/
  head/sys/dev/if_wg/include/sys/if_wg_session.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/if_wg_session_vars.h   (contents,
props changed)
  head/sys/dev/if_wg/include/sys/simd-x86_64.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/support.h   (contents, props 
changed)

  head/sys/dev/if_wg/include/sys/wg_cookie.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/wg_module.h   (contents, props
changed)
  head/sys/dev/if_wg/include/sys/wg_noise.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/blake2s.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/chacha20.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/chacha20poly1305.h   (contents,
props changed)
  head/sys/dev/if_wg/include/zinc/curve25519.h   (contents, props
changed)
  head/sys/dev/if_wg/include/zinc/poly1305.h   (contents, props
changed)
  head/sys/dev/if_wg/module/
  head/sys/dev/if_wg/module/blake2s.c   (contents, props changed)
  head/sys/dev/if_wg/module/blake2s.h   (contents, props changed)
  head/sys/dev/if_wg/module/chacha20-x86_64.S   (contents, props
changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c
 (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c
 (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h   (contents,
props changed)
  head/sys/dev/if_wg/module/curve25519.c   (contents, props changed)
  head/sys/dev/if_wg/module/if_wg_session.c   (contents, props
changed)
  head/sys/dev/if_wg/module/module.c   (contents, props changed)
  head/sys/dev/if_wg/module/poly1305-x86_64.S   (contents, props
changed)
  head/sys/dev/if_wg/module/wg_cookie.c   (contents, props changed)
  head/sys/dev/if_wg/module/wg_noise.c   (contents, props changed)
  head/sys/mod

Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_w

2020-11-30 Thread Bjoern A. Zeeb

On 29 Nov 2020, at 19:38, Matt Macy wrote:

Hi,


Author: mmacy
Date: Sun Nov 29 19:38:03 2020
New Revision: 368163
URL: https://svnweb.freebsd.org/changeset/base/368163

Log:
  Import kernel WireGuard support

  Data path largely shared with the OpenBSD implementation by
  Matt Dunwoodie 

  MFC after:1 month

Added:


probably an oversight as all the other files seem at least 
dual-licensed.


This one is GPL-2.0 only:

/* SPDX-License-Identifier: GPL-2.0 */

  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S 
  (contents, props changed)


Seems we don’t actually use most of these non-amd64 files (currently).
Can we remove at least this one please to avoid accidentally compiling 
it in in the future (and then not MFC it please)?



Thanks,
Bjoern
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_w

2020-11-29 Thread Bjoern A. Zeeb

On 29 Nov 2020, at 19:38, Matt Macy wrote:


Author: mmacy
Date: Sun Nov 29 19:38:03 2020
New Revision: 368163
URL: https://svnweb.freebsd.org/changeset/base/368163

Log:
  Import kernel WireGuard support

  Data path largely shared with the OpenBSD implementation by
  Matt Dunwoodie 

  Reviewed by:  gre...@freebsd.org
  MFC after:1 month
  Sponsored by: Rubicon LLC, (Netgate)
  Differential Revision:https://reviews.freebsd.org/D26137

Added:
  head/sbin/ifconfig/ifwg.c   (contents, props changed)
  head/sys/dev/if_wg/
  head/sys/dev/if_wg/include/
  head/sys/dev/if_wg/include/crypto/blake2s.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/crypto/curve25519.h   (contents, props 
changed)

  head/sys/dev/if_wg/include/crypto/zinc.h   (contents, props changed)
  head/sys/dev/if_wg/include/sys/
  head/sys/dev/if_wg/include/sys/if_wg_session.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/sys/if_wg_session_vars.h   (contents, 
props changed)
  head/sys/dev/if_wg/include/sys/simd-x86_64.h   (contents, props 
changed)

  head/sys/dev/if_wg/include/sys/support.h   (contents, props changed)
  head/sys/dev/if_wg/include/sys/wg_cookie.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/sys/wg_module.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/sys/wg_noise.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/zinc/blake2s.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/zinc/chacha20.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/zinc/chacha20poly1305.h   (contents, 
props changed)
  head/sys/dev/if_wg/include/zinc/curve25519.h   (contents, props 
changed)
  head/sys/dev/if_wg/include/zinc/poly1305.h   (contents, props 
changed)

  head/sys/dev/if_wg/module/
  head/sys/dev/if_wg/module/blake2s.c   (contents, props changed)
  head/sys/dev/if_wg/module/blake2s.h   (contents, props changed)
  head/sys/dev/if_wg/module/chacha20-x86_64.S   (contents, props 
changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c  
 (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S 
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c 
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c  
 (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c 
  (contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c   
(contents, props changed)
  head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h   (contents, 
props changed)

  head/sys/dev/if_wg/module/curve25519.c   (contents, props changed)
  head/sys/dev/if_wg/module/if_wg_session.c   (contents, props 
changed)

  head/sys/dev/if_wg/module/module.c   (contents, props changed)
  head/sys/dev/if_wg/module/poly1305-x86_64.S   (contents, props 
changed)

  head/sys/dev/if_wg/module/wg_cookie.c   (contents, props changed)
  head/sys/dev/if_wg/module/wg_noise.c   (contents, props changed)
  head/sys/modules/if_wg/
  

Re: svn commit: r368045 - in head: . etc/mtree rescue/rescue sbin sbin/ping sbin/ping/tests sbin/ping6 sbin/ping6/tests tools/build/mk

2020-11-27 Thread Bjoern A. Zeeb

On 26 Nov 2020, at 18:51, Alan Somers wrote:


On Thu, Nov 26, 2020 at 2:16 AM Bjoern A. Zeeb <
bzeeb-li...@lists.zabbadoz.net> wrote:


On 26 Nov 2020, at 4:29, Alan Somers wrote:


Author: asomers
Date: Thu Nov 26 04:29:30 2020
New Revision: 368045
URL: https://svnweb.freebsd.org/changeset/base/368045

Log:
  Merge ping6 to ping

  There is now a single ping binary, which chooses to use ICMP or
ICMPv4
  based on the -4 and -6 options, and the format of the address.

  Submitted by:   Ján Sučan 
  Sponsored by:   Google LLC (Google Summer of Code 2019)
  MFC after:  Never
  Differential Revision:  https://reviews.freebsd.org/D21377


I don’t have IPv4 anymore.
I don’t see any WITHOUT_INET or -DINET checks.
How can I compile INET out now?



I don't see any such checks before, either.  Was it ever possible to
exclude ping by building WITHOUT_INET?


No, for various reasons including startup scripts relying on it etc.
I think no one ever bothered to fully find it all.

But it was possible to just ditch the binary (not installing it into 
custom images, or rm -f it post-install along with other things).



Now it’s a “dual-stack handling” binary and those we’ve tried 
with a lot of care to make sure they grow compiling out both ways as you 
cannot throw away the binary anymore.


I don’t know how hard it is to do this now.  I’ll be happy to have a 
look and help if it’s not a 5 minute job for you knowing the code and 
split up.   Would we just have to handle main.c with #ifdefs and the old 
ping[4] files from the Makefile or is ping6 also using shared code from 
the former ping[4]?



/bz


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r368045 - in head: . etc/mtree rescue/rescue sbin sbin/ping sbin/ping/tests sbin/ping6 sbin/ping6/tests tools/build/mk

2020-11-26 Thread Bjoern A. Zeeb

On 26 Nov 2020, at 4:29, Alan Somers wrote:


Author: asomers
Date: Thu Nov 26 04:29:30 2020
New Revision: 368045
URL: https://svnweb.freebsd.org/changeset/base/368045

Log:
  Merge ping6 to ping

  There is now a single ping binary, which chooses to use ICMP or 
ICMPv4

  based on the -4 and -6 options, and the format of the address.

  Submitted by: Ján Sučan 
  Sponsored by: Google LLC (Google Summer of Code 2019)
  MFC after:Never
  Differential Revision:https://reviews.freebsd.org/D21377


I don’t have IPv4 anymore.
I don’t see any WITHOUT_INET or -DINET checks.
How can I compile INET out now?


Also can we please have a ping6 [binary, compat shell script, or 
hardlink] back which defaults to -6 with appropriate option parsing by 
default?
People used that in scripts and whatnot for about 20 years (and 
there’s even still stuff in tools in our own tree referencing it).


/bz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r368031 - in head: libexec/rc sys/netinet6

2020-11-25 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Nov 25 20:58:01 2020
New Revision: 368031
URL: https://svnweb.freebsd.org/changeset/base/368031

Log:
  IPv6: set ifdisabled in the kernel rather than in rc
  
  Enable ND6_IFF_IFDISABLED when the interface is created in the
  kernel before return to user space.
  
  This avoids a race when an interface is create by a program which
  also calls ifconfig IF inet6 -ifdisabled and races with the
  devd -> /etc/pccard_ether -> .. netif start IF -> ifdisabled
  calls (the devd/rc framework disabling IPv6 again after the program
  had enabled it already).
  
  In case the global net.inet6.ip6.accept_rtadv was turned on,
  we also default to enabling IPv6 on the interfaces, rather than
  disabling them.
  
  PR:   248172
  Reported by:  Gert Doering (gert greenie.muc.de)
  Reviewed by:  glebius (, phk)
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D27324

Modified:
  head/libexec/rc/network.subr
  head/sys/netinet6/nd6.c

Modified: head/libexec/rc/network.subr
==
--- head/libexec/rc/network.subrWed Nov 25 20:05:05 2020
(r368030)
+++ head/libexec/rc/network.subrWed Nov 25 20:58:01 2020
(r368031)
@@ -134,8 +134,6 @@ ifconfig_up()
if ! noafif $1 && afexists inet6; then
if checkyesno ipv6_activate_all_interfaces; then
_ipv6_opts="-ifdisabled"
-   elif [ "$1" != "lo0" ]; then
-   _ipv6_opts="ifdisabled"
fi
 
# backward compatibility: $ipv6_enable

Modified: head/sys/netinet6/nd6.c
==
--- head/sys/netinet6/nd6.c Wed Nov 25 20:05:05 2020(r368030)
+++ head/sys/netinet6/nd6.c Wed Nov 25 20:58:01 2020(r368031)
@@ -273,6 +273,10 @@ nd6_ifattach(struct ifnet *ifp)
 
nd->flags = ND6_IFF_PERFORMNUD;
 
+   /* Set IPv6 disabled on all interfaces but loopback by default. */
+   if ((ifp->if_flags & IFF_LOOPBACK) == 0)
+   nd->flags |= ND6_IFF_IFDISABLED;
+
/* A loopback interface always has ND6_IFF_AUTO_LINKLOCAL.
 * XXXHRS: Clear ND6_IFF_AUTO_LINKLOCAL on an IFT_BRIDGE interface by
 * default regardless of the V_ip6_auto_linklocal configuration to
@@ -290,8 +294,11 @@ nd6_ifattach(struct ifnet *ifp)
 */
if (V_ip6_accept_rtadv &&
!(ifp->if_flags & IFF_LOOPBACK) &&
-   (ifp->if_type != IFT_BRIDGE))
+   (ifp->if_type != IFT_BRIDGE)) {
nd->flags |= ND6_IFF_ACCEPT_RTADV;
+   /* If we globally accept rtadv, assume IPv6 on. */
+   nd->flags &= ~ND6_IFF_IFDISABLED;
+   }
if (V_ip6_no_radr && !(ifp->if_flags & IFF_LOOPBACK))
nd->flags |= ND6_IFF_NO_RADR;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367539 - head/sys/dev/usb

2020-11-09 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Nov  9 23:36:51 2020
New Revision: 367539
URL: https://svnweb.freebsd.org/changeset/base/367539

Log:
  usb_hub: fix whitespace
  
  Fix a whitespace "error" introduced in r367435 noticed when
  preparing the MFC.  No functional changes.

Modified:
  head/sys/dev/usb/usb_hub.c

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Mon Nov  9 23:34:32 2020(r367538)
+++ head/sys/dev/usb/usb_hub.c  Mon Nov  9 23:36:51 2020(r367539)
@@ -720,7 +720,7 @@ repeat:
if ((sc->sc_st.port_change & UPS_C_CONNECT_STATUS) ||
(!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS))) {
if (timeout) {
-  DPRINTFN(0, "giving up port %d reset - "
+   DPRINTFN(0, "giving up port %d reset - "
   "device vanished: change %#x status %#x\n",
   portno, sc->sc_st.port_change,
   sc->sc_st.port_status);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367538 - head/sys/arm64/arm64

2020-11-09 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Nov  9 23:34:32 2020
New Revision: 367538
URL: https://svnweb.freebsd.org/changeset/base/367538

Log:
  arm64: bs_sr_ take II
  
  In r367327 generic_bs_sr_ were derived from mips.  Given we are calling
  generic_bs_w_ and no write directly, we do not have to do the address
  calculations ourselves as eneric_bs_w_ will do a str val [bsh, offset].
  All we actually have to do is increment offset.
  
  MFC after:3 days

Modified:
  head/sys/arm64/arm64/bus_machdep.c

Modified: head/sys/arm64/arm64/bus_machdep.c
==
--- head/sys/arm64/arm64/bus_machdep.c  Mon Nov  9 23:05:28 2020
(r367537)
+++ head/sys/arm64/arm64/bus_machdep.c  Mon Nov  9 23:34:32 2020
(r367538)
@@ -136,40 +136,36 @@ static void
 generic_bs_sr_1(void *t, bus_space_handle_t bsh,
 bus_size_t offset, uint8_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr++)
-   generic_bs_w_1(t, bsh, addr, value);
+   for (; count != 0; count--, offset++)
+   generic_bs_w_1(t, bsh, offset, value);
 }
 
 static void
 generic_bs_sr_2(void *t, bus_space_handle_t bsh,
   bus_size_t offset, uint16_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr += 2)
-   generic_bs_w_2(t, bsh, addr, value);
+   for (; count != 0; count--, offset += 2)
+   generic_bs_w_2(t, bsh, offset, value);
 }
 
 static void
 generic_bs_sr_4(void *t, bus_space_handle_t bsh,
 bus_size_t offset, uint32_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr += 4)
-   generic_bs_w_4(t, bsh, addr, value);
+   for (; count != 0; count--, offset += 4)
+   generic_bs_w_4(t, bsh, offset, value);
 }
 
 static void
 generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
 uint64_t value, size_t count)
 {
-   bus_addr_t addr = bsh + offset;
 
-   for (; count != 0; count--, addr += 8)
-   generic_bs_w_8(t, bsh, addr, value);
+   for (; count != 0; count--, offset += 8)
+   generic_bs_w_8(t, bsh, offset, value);
 }
 
 struct bus_space memmap_bus = {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367435 - head/sys/dev/usb

2020-11-06 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Nov  6 22:40:00 2020
New Revision: 367435
URL: https://svnweb.freebsd.org/changeset/base/367435

Log:
  usb_hub: giving up port reset - device vanished
  
  Improve the output of the recently often experienced debug message in order
  to gather further data.
  
  PR:   237666
  Reviewed by:  hselasky
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D27108

Modified:
  head/sys/dev/usb/usb_hub.c

Modified: head/sys/dev/usb/usb_hub.c
==
--- head/sys/dev/usb/usb_hub.c  Fri Nov  6 22:11:05 2020(r367434)
+++ head/sys/dev/usb/usb_hub.c  Fri Nov  6 22:40:00 2020(r367435)
@@ -720,8 +720,10 @@ repeat:
if ((sc->sc_st.port_change & UPS_C_CONNECT_STATUS) ||
(!(sc->sc_st.port_status & UPS_CURRENT_CONNECT_STATUS))) {
if (timeout) {
-   DPRINTFN(0, "giving up port reset "
-   "- device vanished\n");
+  DPRINTFN(0, "giving up port %d reset - "
+  "device vanished: change %#x status %#x\n",
+  portno, sc->sc_st.port_change,
+  sc->sc_st.port_status);
goto error;
}
timeout = 1;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367327 - head/sys/arm64/arm64

2020-11-04 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Nov  4 12:11:50 2020
New Revision: 367327
URL: https://svnweb.freebsd.org/changeset/base/367327

Log:
  arm64: implement bs_sr_
  
  Implement the bs_sr_ generic functions based on the generic
  mips implementation calling the generic bs_w_ functions in a loop.
  
  ral(4) (rt2860.c) panics in RAL_SET_REGION_4() because bs_sr_4()
  is NULL.  It seems ral(4) and ti(4) might be the only consumers of
  these functions I could find quickly so keeping them in C rather than asm.
  
  Reported by:  Steve Wheeler (https://redmine.pfsense.org/issues/11021)
  Reviewed by:  mmel
  MFC after:3 days

Modified:
  head/sys/arm64/arm64/bus_machdep.c

Modified: head/sys/arm64/arm64/bus_machdep.c
==
--- head/sys/arm64/arm64/bus_machdep.c  Wed Nov  4 12:07:33 2020
(r367326)
+++ head/sys/arm64/arm64/bus_machdep.c  Wed Nov  4 12:11:50 2020
(r367327)
@@ -128,6 +128,50 @@ generic_bs_subregion(void *t, bus_space_handle_t bsh, 
return (0);
 }
 
+/*
+ * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
+ * by tag/handle starting at `offset'.
+ */
+static void
+generic_bs_sr_1(void *t, bus_space_handle_t bsh,
+bus_size_t offset, uint8_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr++)
+   generic_bs_w_1(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_2(void *t, bus_space_handle_t bsh,
+  bus_size_t offset, uint16_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr += 2)
+   generic_bs_w_2(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_4(void *t, bus_space_handle_t bsh,
+bus_size_t offset, uint32_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr += 4)
+   generic_bs_w_4(t, bsh, addr, value);
+}
+
+static void
+generic_bs_sr_8(void *t, bus_space_handle_t bsh, bus_size_t offset,
+uint64_t value, size_t count)
+{
+   bus_addr_t addr = bsh + offset;
+
+   for (; count != 0; count--, addr += 8)
+   generic_bs_w_8(t, bsh, addr, value);
+}
+
 struct bus_space memmap_bus = {
/* cookie */
.bs_cookie = NULL,
@@ -187,10 +231,10 @@ struct bus_space memmap_bus = {
.bs_sm_8 = NULL,
 
/* set region */
-   .bs_sr_1 = NULL,
-   .bs_sr_2 = NULL,
-   .bs_sr_4 = NULL,
-   .bs_sr_8 = NULL,
+   .bs_sr_1 =  generic_bs_sr_1,
+   .bs_sr_2 =  generic_bs_sr_2,
+   .bs_sr_4 =  generic_bs_sr_4,
+   .bs_sr_8 =  generic_bs_sr_8,
 
/* copy */
.bs_c_1 = NULL,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r367326 - head/sys/net80211

2020-11-04 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Nov  4 12:07:33 2020
New Revision: 367326
URL: https://svnweb.freebsd.org/changeset/base/367326

Log:
  net80211: fix a typo
  
  Correct a typo referring to the wrong flags in a comment.
  No functional changes.
  
  MFC after:3 days
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/net80211/_ieee80211.h

Modified: head/sys/net80211/_ieee80211.h
==
--- head/sys/net80211/_ieee80211.h  Wed Nov  4 11:48:08 2020
(r367325)
+++ head/sys/net80211/_ieee80211.h  Wed Nov  4 12:07:33 2020
(r367326)
@@ -619,7 +619,7 @@ struct ieee80211_rx_stats {
} evm;
 
/* 32 bits */
-   uint8_t c_phytype;  /* PHY type, FW flags above */
+   uint8_t c_phytype;  /* PHY type, FP flags above */
uint8_t c_vhtnss;   /* VHT - number of spatial streams */
uint8_t c_pad2[2];
 };
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366817 - head/sys/net80211

2020-10-18 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Oct 18 21:34:04 2020
New Revision: 366817
URL: https://svnweb.freebsd.org/changeset/base/366817

Log:
  net80211: factor out the priv(9) checks into OS specifc code.
  
  Factor out the priv(9) checks into OS specifc code so other OSes can equally
  implement them.  This sorts out those XXX in the net80211 code.
  We provide 3 arguments (cmd, vap, ifp) where available to the functions, in
  order to allow other OSes to use that data but also in case we'd add auditing
  to these check to have the information available. For now the arguments are
  marked __unused.
  
  PR:   249403
  Reported by:  martin(NetBSD)
  Reviewed by:  adrian, martin(NetBSD)
  MFC after:10 days
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26541

Modified:
  head/sys/net80211/ieee80211_freebsd.c
  head/sys/net80211/ieee80211_freebsd.h
  head/sys/net80211/ieee80211_ioctl.c

Modified: head/sys/net80211/ieee80211_freebsd.c
==
--- head/sys/net80211/ieee80211_freebsd.c   Sun Oct 18 20:54:15 2020
(r366816)
+++ head/sys/net80211/ieee80211_freebsd.c   Sun Oct 18 21:34:04 2020
(r366817)
@@ -75,6 +75,42 @@ SYSCTL_INT(_net_wlan, OID_AUTO, debug, CTLFLAG_RW, 
 static const char wlanname[] = "wlan";
 static struct if_clone *wlan_cloner;
 
+/*
+ * priv(9) NET80211 checks.
+ * Return 0 if operation is allowed, E* (usually EPERM) otherwise.
+ */
+int
+ieee80211_priv_check_vap_getkey(u_long cmd __unused,
+ struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_VAP_GETKEY));
+}
+
+int
+ieee80211_priv_check_vap_manage(u_long cmd __unused,
+ struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_VAP_MANAGE));
+}
+
+int
+ieee80211_priv_check_vap_setmac(u_long cmd __unused,
+ struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_VAP_SETMAC));
+}
+
+int
+ieee80211_priv_check_create_vap(u_long cmd __unused,
+struct ieee80211vap *vap __unused, struct ifnet *ifp __unused)
+{
+
+   return (priv_check(curthread, PRIV_NET80211_CREATE_VAP));
+}
+
 static int
 wlan_clone_create(struct if_clone *ifc, int unit, caddr_t params)
 {
@@ -83,7 +119,7 @@ wlan_clone_create(struct if_clone *ifc, int unit, cadd
struct ieee80211com *ic;
int error;
 
-   error = priv_check(curthread, PRIV_NET80211_CREATE_VAP);
+   error = ieee80211_priv_check_create_vap(0, NULL, NULL);
if (error)
return error;
 

Modified: head/sys/net80211/ieee80211_freebsd.h
==
--- head/sys/net80211/ieee80211_freebsd.h   Sun Oct 18 20:54:15 2020
(r366816)
+++ head/sys/net80211/ieee80211_freebsd.h   Sun Oct 18 21:34:04 2020
(r366817)
@@ -43,6 +43,19 @@
 #include 
 
 /*
+ * priv(9) NET80211 checks.
+ */
+struct ieee80211vap;
+int ieee80211_priv_check_vap_getkey(u_long, struct ieee80211vap *,
+struct ifnet *);
+int ieee80211_priv_check_vap_manage(u_long, struct ieee80211vap *,
+struct ifnet *);
+int ieee80211_priv_check_vap_setmac(u_long, struct ieee80211vap *,
+struct ifnet *);
+int ieee80211_priv_check_create_vap(u_long, struct ieee80211vap *,
+struct ifnet *);
+
+/*
  * Common state locking definitions.
  */
 typedef struct {

Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Sun Oct 18 20:54:15 2020
(r366816)
+++ head/sys/net80211/ieee80211_ioctl.c Sun Oct 18 21:34:04 2020
(r366817)
@@ -40,7 +40,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -72,7 +71,8 @@ static int ieee80211_scanreq(struct ieee80211vap *,
struct ieee80211_scan_req *);
 
 static int
-ieee80211_ioctl_getkey(struct ieee80211vap *vap, struct ieee80211req *ireq)
+ieee80211_ioctl_getkey(u_long cmd, struct ieee80211vap *vap,
+struct ieee80211req *ireq)
 {
struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_node *ni;
@@ -106,8 +106,7 @@ ieee80211_ioctl_getkey(struct ieee80211vap *vap, struc
ik.ik_flags = wk->wk_flags & (IEEE80211_KEY_XMIT | IEEE80211_KEY_RECV);
if (wk->wk_keyix == vap->iv_def_txkey)
ik.ik_flags |= IEEE80211_KEY_DEFAULT;
-   /* XXX TODO: move priv check to ieee80211_freebsd.c */
-   if (priv_check(curthread, PRIV_NET80211_VAP_GETKEY) == 0) {
+   if (ieee80211_priv_check_vap_getkey(cmd, vap, NULL) == 0) {
/* NB: only root can read key data */
ik.ik_keyrsc = wk->wk_keyrsc[IEEE80211_NONQOS_TID];
ik.ik_keytsc = wk->wk_keytsc;
@@ -822,8 

svn commit: r366800 - in head: sbin/ifconfig sys/net80211

2020-10-17 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Oct 18 00:27:20 2020
New Revision: 366800
URL: https://svnweb.freebsd.org/changeset/base/366800

Log:
  net80211: update for (more) VHT160 support
  
  Implement two macros IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ()
  and its 80+80 counter part to check in vhtcaps for appropriate
  levels of support and use the macros throughout the code.
  
  Add vht160_chan_ranges/is_vht160_valid_freq and handle analogue
  to vht80 in various parts of the code.
  
  Add ieee80211_add_channel_cbw() which also takes the CBW flag
  fields and make the former ieee80211_add_channel() a wrapper to it.
  With the CBW flags we can add HT/VHT channels passing them to
  getflags() for the 2/5ghz functions.
  
  In ifconfig(8) add the regdomain_addchans() support for VHT160
  and VHT80P80.
  
  With this (+ regdoain.xml updates) VHT160 channels can be
  configured, listed, and pass regdomain where appropriate.
  
  Tested with:  iwlwifi
  Reviewed by:  adrian
  MFC after:10 days
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26712

Modified:
  head/sbin/ifconfig/ifieee80211.c
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211.h
  head/sys/net80211/ieee80211_regdomain.c
  head/sys/net80211/ieee80211_var.h
  head/sys/net80211/ieee80211_vht.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cSat Oct 17 23:42:33 2020
(r366799)
+++ head/sbin/ifconfig/ifieee80211.cSun Oct 18 00:27:20 2020
(r366800)
@@ -2405,7 +2405,31 @@ regdomain_makechannels(
>dc_chaninfo);
}
 
-   /* XXX TODO: VHT80P80, VHT160 */
+   /* VHT160 */
+   if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160MHZ(
+   dc->dc_vhtcaps)) {
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
+   IEEE80211_CHAN_VHT160,
+   >dc_chaninfo);
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
+   IEEE80211_CHAN_VHT160,
+   >dc_chaninfo);
+   }
+
+   /* VHT80P80 */
+   if (IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_IS_160_80P80MHZ(
+   dc->dc_vhtcaps)) {
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |
+   IEEE80211_CHAN_VHT80P80,
+   >dc_chaninfo);
+   regdomain_addchans(ci, >bands_11ac, reg,
+   IEEE80211_CHAN_A | IEEE80211_CHAN_HT40D |
+   IEEE80211_CHAN_VHT80P80,
+   >dc_chaninfo);
+   }
}
 
if (!LIST_EMPTY(>bands_11ng) && dc->dc_htcaps != 0) {

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Sat Oct 17 23:42:33 2020
(r366799)
+++ head/sys/net80211/ieee80211.c   Sun Oct 18 00:27:20 2020
(r366800)
@@ -1163,6 +1163,12 @@ struct vht_chan_range vht80_chan_ranges[] = {
{ 0, 0 }
 };
 
+struct vht_chan_range vht160_chan_ranges[] = {
+   { 5170, 5330 },
+   { 5490, 5650 },
+   { 0, 0 }
+};
+
 static int
 set_vht_extchan(struct ieee80211_channel *c)
 {
@@ -1177,8 +1183,24 @@ set_vht_extchan(struct ieee80211_channel *c)
}
 
if (IEEE80211_IS_CHAN_VHT160(c)) {
-   printf("%s: TODO VHT160 channel (ieee=%d, flags=0x%08x)\n",
-   __func__, c->ic_ieee, c->ic_flags);
+   for (i = 0; vht160_chan_ranges[i].freq_start != 0; i++) {
+   if (c->ic_freq >= vht160_chan_ranges[i].freq_start &&
+   c->ic_freq < vht160_chan_ranges[i].freq_end) {
+   int midpoint;
+
+   midpoint = vht160_chan_ranges[i].freq_start + 
80;
+   c->ic_vht_ch_freq1 =
+   ieee80211_mhz2ieee(midpoint, c->ic_flags);
+   c->ic_vht_ch_freq2 = 0;
+#if 0
+   printf("%s: %d, freq=%d, midpoint=%d, freq1=%d, 
freq2=%d\n",
+   __func__, c->ic_ieee, c->ic_freq, midpoint,
+   c->ic_vht_ch_freq1, c->ic_vht_ch_freq2);
+#endif
+   return (1);
+

svn commit: r366799 - head/sys/dev/extres/clk

2020-10-17 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Oct 17 23:42:33 2020
New Revision: 366799
URL: https://svnweb.freebsd.org/changeset/base/366799

Log:
  clk: fix indentation
  
  Just fix indentation of an if() clause.
  No functional changes intended.
  
  MFC after:3 days

Modified:
  head/sys/dev/extres/clk/clk.c

Modified: head/sys/dev/extres/clk/clk.c
==
--- head/sys/dev/extres/clk/clk.c   Sat Oct 17 22:47:08 2020
(r366798)
+++ head/sys/dev/extres/clk/clk.c   Sat Oct 17 23:42:33 2020
(r366799)
@@ -544,7 +544,7 @@ clknode_create(struct clkdom * clkdom, clknode_class_t
CLK_TOPO_SLOCK();
clknode = clknode_find_by_name(def->name);
CLK_TOPO_UNLOCK();
-   if (clknode !=  NULL) {
+   if (clknode !=  NULL) {
if (!(clknode->flags & CLK_NODE_LINKED) &&
def->flags & CLK_NODE_LINKED) {
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366798 - head/sys/kern

2020-10-17 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Oct 17 22:47:08 2020
New Revision: 366798
URL: https://svnweb.freebsd.org/changeset/base/366798

Log:
  ddb: add show sysinit command
  
  Add a show sysinit command to ddb (similar to show vnet_sysinit) which
  proved to be helpful to debug some ordering issues on early-mid kernel
  start panics.

Modified:
  head/sys/kern/init_main.c

Modified: head/sys/kern/init_main.c
==
--- head/sys/kern/init_main.c   Sat Oct 17 21:30:46 2020(r366797)
+++ head/sys/kern/init_main.c   Sat Oct 17 22:47:08 2020(r366798)
@@ -47,6 +47,7 @@
 __FBSDID("$FreeBSD$");
 
 #include "opt_ddb.h"
+#include "opt_kdb.h"
 #include "opt_init_path.h"
 #include "opt_verbose_sysinit.h"
 
@@ -838,3 +839,51 @@ kick_init(const void *udata __unused)
sched_add(td, SRQ_BORING);
 }
 SYSINIT(kickinit, SI_SUB_KTHREAD_INIT, SI_ORDER_MIDDLE, kick_init, NULL);
+
+/*
+ * DDB(4).
+ */
+#ifdef DDB
+static void
+db_show_print_syinit(struct sysinit *sip, bool ddb)
+{
+   const char *sname, *funcname;
+   c_db_sym_t sym;
+   db_expr_t  offset;
+
+#define xprint(...)\
+   if (ddb)\
+   db_printf(__VA_ARGS__); \
+   else\
+   printf(__VA_ARGS__)
+
+   if (sip == NULL) {
+   xprint("%s: no sysinit * given\n", __func__);
+   return;
+   }
+
+   sym = db_search_symbol((vm_offset_t)sip, DB_STGY_ANY, );
+   db_symbol_values(sym, , NULL);
+   sym = db_search_symbol((vm_offset_t)sip->func, DB_STGY_PROC, );
+   db_symbol_values(sym, , NULL);
+   xprint("%s(%p)\n", (sname != NULL) ? sname : "", sip);
+   xprint("  %#08x %#08x\n", sip->subsystem, sip->order);
+   xprint("  %p(%s)(%p)\n",
+   sip->func, (funcname != NULL) ? funcname : "", sip->udata);
+#undef xprint
+}
+
+DB_SHOW_COMMAND(sysinit, db_show_sysinit)
+{
+   struct sysinit **sipp;
+
+   db_printf("SYSINIT vs Name(Ptr)\n");
+   db_printf("  Subsystem  Order\n");
+   db_printf("  Function(Name)(Arg)\n");
+   for (sipp = sysinit; sipp < sysinit_end; sipp++) {
+   db_show_print_syinit(*sipp, true);
+   if (db_pager_quit)
+   break;
+   }
+}
+#endif /* DDB */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf

2020-10-17 Thread Bjoern A. Zeeb

On 17 Oct 2020, at 20:48, Sean Bruno wrote:


Same buildfailure with GENERIC-NODEBUG.


Seems different.



https://people.freebsd.org/~sbruno/backlight.txt


HEAD with which version of the drm port/package?

/bz


sbruno@alice:~ % pkg info |grep kmod
drm-current-kmod-4.16.g20200320 DRM modules for the linuxkpi-based KMS
components
drm-kmod-g20190710 Metaport of DRM modules for the
linuxkpi-based KMS components
gpu-firmware-kmod-g20200503Firmware modules for the linuxkpi-based
KMS components


You may want to have to update this to recent and try again;  if that 
still breaks I assume either Hans or I will be happy to help until manu 
is back.


I’d assume with more linuxkpi bits implemented in HEAD the conflicts 
in head will stay … and port/package updates will have to happen once 
in a while (*).


https://svnweb.freebsd.org/base?view=revision=366374
https://svnweb.freebsd.org/ports?view=revision=551266

/bz

(*) manu is making sure that after the commit to head the new port keeps 
compiling with older kernels for a while using __FreeBSD_version; I may 
have a partial solution that might allow us to update the port first but 
neither won’t help with old ports like in this case.


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366372 - in head/sys: compat/linuxkpi/common/include/linux compat/linuxkpi/common/src conf

2020-10-17 Thread Bjoern A. Zeeb

On 17 Oct 2020, at 20:14, Sean Bruno wrote:


On 2020-10-17 05:27, Alexander V. Chernikov wrote:

02.10.2020, 19:26, "Emmanuel Vadot" :

Author: manu
Date: Fri Oct 2 18:26:41 2020
New Revision: 366372
URL: https://svnweb.freebsd.org/changeset/base/366372

Log:
  linuxkpi: Add backlight support
  
  Add backlight function to linuxkpi.
  Graphics drivers expose the backlight of the panel directly 
so

allow them to use the backlight subsystem so
  user can use backlight(8) to configure them.
  
  Reviewed by: hselasky
  Relnotes: yes
  Differential Revision: The FreeBSD Foundation

Added:
  head/sys/compat/linuxkpi/common/include/linux/backlight.h
(contents, props changed)
Modified:
  head/sys/compat/linuxkpi/common/include/linux/device.h
  head/sys/compat/linuxkpi/common/src/linux_kmod.c
  head/sys/compat/linuxkpi/common/src/linux_pci.c
  head/sys/conf/kmod.mk

It breaks the build for me with
 
/usr/home/melifaro/free/head/sys/compat/linuxkpi/common/src/linux_pci.c:70:10:
fatal error: 'backlight_if.h' file not found




Same buildfailure with GENERIC-NODEBUG.


Seems different.



https://people.freebsd.org/~sbruno/backlight.txt


HEAD with which version of the drm port/package?

/bz


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366623 - head/sys/netinet

2020-10-10 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Oct 11 00:01:00 2020
New Revision: 366623
URL: https://svnweb.freebsd.org/changeset/base/366623

Log:
  ip_mroute: fix the viftable export sysctl
  
  It seems that in r354857 I got more than one thing wrong.
  Convert the SYSCTL_OPAQUE to a SYSCTL_PROC to properly export the these
  days allocated and not longer static per-vnet viftable array.
  This fixes a problem with netstat -g which would show bogus information
  for the IPv4 Virtual Interface Table.
  
  PR:   246626
  Reported by:  Ozkan KIRIK (ozkan.kirik gmail.com)
  MFC after:3 days

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cSat Oct 10 21:52:00 2020
(r366622)
+++ head/sys/netinet/ip_mroute.cSun Oct 11 00:01:00 2020
(r366623)
@@ -181,13 +181,6 @@ VNET_DEFINE_STATIC(vifi_t, numvifs);
 #defineV_numvifs   VNET(numvifs)
 VNET_DEFINE_STATIC(struct vif *, viftable);
 #defineV_viftable  VNET(viftable)
-/*
- * No one should be able to "query" this before initialisation happened in
- * vnet_mroute_init(), so we should still be fine.
- */
-SYSCTL_OPAQUE(_net_inet_ip, OID_AUTO, viftable, CTLFLAG_VNET | CTLFLAG_RD,
-_NAME(viftable), sizeof(*V_viftable) * MAXVIFS, "S,vif[MAXVIFS]",
-"IPv4 Multicast Interfaces (struct vif[MAXVIFS], netinet/ip_mroute.h)");
 
 static struct mtx vif_mtx;
 #defineVIF_LOCK()  mtx_lock(_mtx)
@@ -2805,6 +2798,30 @@ static SYSCTL_NODE(_net_inet_ip, OID_AUTO, mfctable,
 CTLFLAG_RD | CTLFLAG_MPSAFE, sysctl_mfctable,
 "IPv4 Multicast Forwarding Table "
 "(struct *mfc[mfchashsize], netinet/ip_mroute.h)");
+
+static int
+sysctl_viflist(SYSCTL_HANDLER_ARGS)
+{
+   int error;
+
+   if (req->newptr)
+   return (EPERM);
+   if (V_viftable == NULL) /* XXX unlocked */
+   return (0);
+   error = sysctl_wire_old_buffer(req, sizeof(*V_viftable) * MAXVIFS);
+   if (error)
+   return (error);
+
+   VIF_LOCK();
+   error = SYSCTL_OUT(req, V_viftable, sizeof(*V_viftable) * MAXVIFS);
+   VIF_UNLOCK();
+   return (error);
+}
+
+SYSCTL_PROC(_net_inet_ip, OID_AUTO, viftable,
+CTLTYPE_OPAQUE | CTLFLAG_VNET | CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, 0,
+sysctl_viflist, "S,vif[MAXVIFS]",
+"IPv4 Multicast Interfaces (struct vif[MAXVIFS], netinet/ip_mroute.h)");
 
 static void
 vnet_mroute_init(const void *unused __unused)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366525 - head/sys/net80211

2020-10-07 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Oct  7 22:52:24 2020
New Revision: 366525
URL: https://svnweb.freebsd.org/changeset/base/366525

Log:
  net80211: whitespace
  
  Fix indentation for the multi-line copies of
  ieee80211_add_channel_list_5ghz() for the 3 bands.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/net80211/ieee80211_regdomain.c

Modified: head/sys/net80211/ieee80211_regdomain.c
==
--- head/sys/net80211/ieee80211_regdomain.c Wed Oct  7 22:29:26 2020
(r366524)
+++ head/sys/net80211/ieee80211_regdomain.c Wed Oct  7 22:52:24 2020
(r366525)
@@ -158,14 +158,14 @@ ieee80211_init_channels(struct ieee80211com *ic,
IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == 2)
cbw_flags |= NET80211_CBW_FLAG_VHT80P80;
ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
-  nchans, def_chan_5ghz_band1, nitems(def_chan_5ghz_band1),
-  bands, cbw_flags);
+   nchans, def_chan_5ghz_band1, nitems(def_chan_5ghz_band1),
+   bands, cbw_flags);
ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
nchans, def_chan_5ghz_band2, nitems(def_chan_5ghz_band2),
-  bands, cbw_flags);
+   bands, cbw_flags);
ieee80211_add_channel_list_5ghz(chans, IEEE80211_CHAN_MAX,
nchans, def_chan_5ghz_band3, nitems(def_chan_5ghz_band3),
-  bands, cbw_flags);
+   bands, cbw_flags);
}
if (rd != NULL)
ic->ic_regdomain = *rd;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366524 - head/sbin/ifconfig

2020-10-07 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Oct  7 22:29:26 2020
New Revision: 366524
URL: https://svnweb.freebsd.org/changeset/base/366524

Log:
  80211: ifconfig replace MS() with _IEEE80211_MASKSHIFT()
  
  As we did in the kernel in r366112 replace the MS() macro with the version(s)
  added to the kernel: _IEEE80211_MASKSHIFT().  Also provide its counter part.
  This will later allow use to use other macros defined in net80211 headers
  here in ifconfig.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sbin/ifconfig/ifieee80211.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cWed Oct  7 22:07:26 2020
(r366523)
+++ head/sbin/ifconfig/ifieee80211.cWed Oct  7 22:29:26 2020
(r366524)
@@ -138,6 +138,14 @@
 #defineIEEE80211_FVHT_USEVHT80P80 0x00010  /* CONF: Use VHT 80+80 
*/
 #endif
 
+/* Helper macros unified. */
+#ifndef_IEEE80211_MASKSHIFT
+#define_IEEE80211_MASKSHIFT(_v, _f)(((_v) & _f) >> _f##_S)
+#endif
+#ifndef_IEEE80211_SHIFTMASK
+#define_IEEE80211_SHIFTMASK(_v, _f)(((_v) << _f##_S) & _f)
+#endif
+
 #defineMAXCHAN 1536/* max 1.5K channels */
 
 #defineMAXCOL  78
@@ -2706,7 +2714,6 @@ printie(const char* tag, const uint8_t *ie, size_t iel
 static void
 printwmeparam(const char *tag, const u_int8_t *ie, size_t ielen, int maxlen)
 {
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
static const char *acnames[] = { "BE", "BK", "VO", "VI" };
const struct ieee80211_wme_param *wme =
(const struct ieee80211_wme_param *) ie;
@@ -2721,17 +2728,17 @@ printwmeparam(const char *tag, const u_int8_t *ie, siz
const struct ieee80211_wme_acparams *ac =
>params_acParams[i];
 
-   printf(" %s[%saifsn %u cwmin %u cwmax %u txop %u]"
-   , acnames[i]
-   , MS(ac->acp_aci_aifsn, WME_PARAM_ACM) ? "acm " : ""
-   , MS(ac->acp_aci_aifsn, WME_PARAM_AIFSN)
-   , MS(ac->acp_logcwminmax, WME_PARAM_LOGCWMIN)
-   , MS(ac->acp_logcwminmax, WME_PARAM_LOGCWMAX)
-   , LE_READ_2(>acp_txop)
-   );
+   printf(" %s[%saifsn %u cwmin %u cwmax %u txop %u]", acnames[i],
+   _IEEE80211_MASKSHIFT(ac->acp_aci_aifsn, WME_PARAM_ACM) ?
+   "acm " : "",
+   _IEEE80211_MASKSHIFT(ac->acp_aci_aifsn, WME_PARAM_AIFSN),
+   _IEEE80211_MASKSHIFT(ac->acp_logcwminmax,
+   WME_PARAM_LOGCWMIN),
+   _IEEE80211_MASKSHIFT(ac->acp_logcwminmax,
+   WME_PARAM_LOGCWMAX),
+   LE_READ_2(>acp_txop));
}
printf(">");
-#undef MS
 }
 
 static void
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366523 - head/sys/compat/linuxkpi/common/include/linux

2020-10-07 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Oct  7 22:07:26 2020
New Revision: 366523
URL: https://svnweb.freebsd.org/changeset/base/366523

Log:
  LinuxKPI: add a bitfield.h implementation.
  
  This code was iteratively implemented during the work on various WiFi
  drivers -- from individual functions to a macro-created implementations
  for the various bit sized needed (and then extended to more for
  comepleteness). Some of the bit combinations do not seem to make sense
  so are left out.
  
  The __bf_shf(x) was obtained from D26681 [1].
  
  Requested by: manu [1]
  Reviewed by:  hselasky, manu
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D26708

Added:
  head/sys/compat/linuxkpi/common/include/linux/bitfield.h   (contents, props 
changed)

Added: head/sys/compat/linuxkpi/common/include/linux/bitfield.h
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/compat/linuxkpi/common/include/linux/bitfield.hWed Oct  7 
22:07:26 2020(r366523)
@@ -0,0 +1,105 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2020 The FreeBSD Foundation
+ *
+ * This software was developed by Björn Zeeb under sponsorship from
+ * the FreeBSD Foundation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef_LINUX_BITFIELD_H
+#define_LINUX_BITFIELD_H
+
+#include 
+#include 
+
+/* Use largest possible type. */
+static inline uint64_t ___lsb(uint64_t f) { return (f & -f); }
+static inline uint64_t ___bitmask(uint64_t f) { return (f / ___lsb(f)); }
+
+#define_uX_get_bits(_n)
\
+   static __inline uint ## _n ## _t\
+   u ## _n ## _get_bits(uint ## _n ## _t v, uint ## _n ## _t f)\
+   {   \
+   return ((v & f) / ___lsb(f));   \
+   }
+
+_uX_get_bits(64)
+_uX_get_bits(32)
+_uX_get_bits(16)
+_uX_get_bits(8)
+
+#define_leX_get_bits(_n)   
\
+   static __inline uint ## _n ## _t\
+   le ## _n ## _get_bits(__le ## _n v, uint ## _n ## _t f) \
+   {   \
+   return ((le ## _n ## _to_cpu(v) & f) / ___lsb(f));  \
+   }
+
+_leX_get_bits(64)
+_leX_get_bits(32)
+_leX_get_bits(16)
+
+#define_uX_encode_bits(_n) 
\
+   static __inline uint ## _n ## _t\
+   u ## _n ## _encode_bits(uint ## _n ## _t v, uint ## _n ## _t f) \
+   {   \
+   return ((v & ___bitmask(f)) * ___lsb(f));   \
+   }
+
+_uX_encode_bits(64)
+_uX_encode_bits(32)
+_uX_encode_bits(16)
+_uX_encode_bits(8)
+
+#define_leX_encode_bits(_n)
\
+   static __inline uint ## _n ## _t\
+   le ## _n ## _encode_bits(__le ## _n v, uint ## _n ## _t f)\
+   {   \
+   return (cpu_to_le ## _n((v & ___bitmask(f)) * ___lsb(f))); \
+   }
+
+_leX_encode_bits(64)
+_leX_encode_bits(32)
+_leX_encode_bits(16)
+
+static __inline void
+le32p_replace_bits(uint32_t *p, uint32_t v, uint32_t f)
+{
+
+   *p = (*p & ~(cpu_to_le32(v))) | le32_encode_bits(v, f);
+   return;
+}
+

svn commit: r366522 - in head: lib/lib80211 sbin/ifconfig sys/net80211

2020-10-07 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Oct  7 21:56:58 2020
New Revision: 366522
URL: https://svnweb.freebsd.org/changeset/base/366522

Log:
  80211: non-functional changes
  
  Sort a few VHT160 and 80+80 lines, update some comments, and remove
  a superfluous ','.
  
  No functional changes intended.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/lib80211/lib80211_regdomain.c
  head/sbin/ifconfig/ifieee80211.c
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_node.h

Modified: head/lib/lib80211/lib80211_regdomain.c
==
--- head/lib/lib80211/lib80211_regdomain.c  Wed Oct  7 20:31:13 2020
(r366521)
+++ head/lib/lib80211/lib80211_regdomain.c  Wed Oct  7 21:56:58 2020
(r366522)
@@ -191,11 +191,11 @@ decode_flag(struct mystate *mt, const char *p, int len
FLAG(IEEE80211_CHAN_VHT20),
FLAG(IEEE80211_CHAN_VHT40),
FLAG(IEEE80211_CHAN_VHT80),
+   FLAG(IEEE80211_CHAN_VHT160),
/*
 * XXX VHT80P80? This likely should be done by
 * 80MHz chan logic in net80211 / ifconfig.
 */
-   FLAG(IEEE80211_CHAN_VHT160),
FLAG(IEEE80211_CHAN_ST),
FLAG(IEEE80211_CHAN_TURBO),
FLAG(IEEE80211_CHAN_PASSIVE),

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cWed Oct  7 20:31:13 2020
(r366521)
+++ head/sbin/ifconfig/ifieee80211.cWed Oct  7 21:56:58 2020
(r366522)
@@ -2385,8 +2385,7 @@ regdomain_makechannels(
>dc_chaninfo);
}
 
-   /* VHT80 */
-   /* XXX dc_vhtcap? */
+   /* VHT80 is mandatory (and so should be VHT40 above). */
if (1) {
regdomain_addchans(ci, >bands_11ac, reg,
IEEE80211_CHAN_A | IEEE80211_CHAN_HT40U |

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Wed Oct  7 20:31:13 2020
(r366521)
+++ head/sys/net80211/ieee80211.c   Wed Oct  7 21:56:58 2020
(r366522)
@@ -158,7 +158,7 @@ ieee80211_chan_init(struct ieee80211com *ic)
 
/*
 * Setup the HT40/VHT40 upper/lower bits.
-* The VHT80 math is done elsewhere.
+* The VHT80/... math is done elsewhere.
 */
if (IEEE80211_IS_CHAN_HT40(c) && c->ic_extieee == 0)
c->ic_extieee = ieee80211_mhz2ieee(c->ic_freq +
@@ -167,8 +167,8 @@ ieee80211_chan_init(struct ieee80211com *ic)
 
/* Update VHT math */
/*
-* XXX VHT again, note that this assumes VHT80 channels
-* are legit already
+* XXX VHT again, note that this assumes VHT80/... channels
+* are legit already.
 */
set_vht_extchan(c);
 
@@ -712,8 +712,8 @@ ieee80211_vap_attach(struct ieee80211vap *vap, ifm_cha
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
-   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
+   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
IEEE80211_UNLOCK(ic);
 
return 1;
@@ -767,8 +767,8 @@ ieee80211_vap_detach(struct ieee80211vap *vap)
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_VHT);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT40);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80);
-   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT160);
+   ieee80211_syncflag_vht_locked(ic, IEEE80211_FVHT_USEVHT80P80);
 
/* NB: this handles the bpfdetach done below */
ieee80211_syncflag_ext_locked(ic, IEEE80211_FEXT_BPF);
@@ -1160,7 +1160,7 @@ struct vht_chan_range vht80_chan_ranges[] = {
{ 5570, 5650 },
{ 5650, 5730 },
{ 5735, 5815 },
-   { 0, 0, }
+   { 0, 0 }
 };
 
 static int

Modified: head/sys/net80211/ieee80211_node.h
==
--- head/sys/net80211/ieee80211_node.h  Wed Oct  7 20:31:13 2020
(r366521)
+++ head/sys/net80211/ieee80211_node.h  Wed Oct  7 21:56:58 2020
(r366522)
@@ -70,7 +70,7 @@ struct ieee80211vap;
 struct ieee80211_scanparams;
 
 /*
- * Information element 

svn commit: r366268 - head/sys/dev/rtwn/usb

2020-09-29 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Sep 29 20:46:25 2020
New Revision: 366268
URL: https://svnweb.freebsd.org/changeset/base/366268

Log:
  rtwn: narrow the epoch area
  
  Rather than placing the epoch around the entire receive loop which
  might call into rtwn_rx_frame() and USB and sleep, split the loop
  into two[1] and leave us with one unlock/lock cycle as well.
  
  PR:   249925
  Reported by:  thj, (rkoberman gmail.com)
  Tested by:thj
  Suggested by: adrian [1]
  Reviewed by:  adrian
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation (initially, paniced my iwl lab host)
  Differential Revision:https://reviews.freebsd.org/D26554

Modified:
  head/sys/dev/rtwn/usb/rtwn_usb_rx.c

Modified: head/sys/dev/rtwn/usb/rtwn_usb_rx.c
==
--- head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Sep 29 20:29:07 2020
(r366267)
+++ head/sys/dev/rtwn/usb/rtwn_usb_rx.c Tue Sep 29 20:46:25 2020
(r366268)
@@ -368,7 +368,7 @@ rtwn_bulk_rx_callback(struct usb_xfer *xfer, usb_error
struct rtwn_softc *sc = >uc_sc;
struct ieee80211com *ic = >sc_ic;
struct ieee80211_node *ni;
-   struct mbuf *m = NULL, *next;
+   struct mbuf *m0, *m = NULL, *next;
struct rtwn_data *data;
 
RTWN_ASSERT_LOCKED(sc);
@@ -400,24 +400,30 @@ tr_setup:
 * ieee80211_input() because here is at the end of a USB
 * callback and safe to unlock.
 */
+   m0 = m;
+   while (m != NULL) {
+   M_ASSERTPKTHDR(m);
+   m->m_pkthdr.PH_loc.ptr = rtwn_rx_frame(sc, m);
+   m = m->m_nextpkt;
+   }
NET_EPOCH_ENTER(et);
+   RTWN_UNLOCK(sc);
+   m = m0;
while (m != NULL) {
next = m->m_nextpkt;
m->m_nextpkt = NULL;
 
-   ni = rtwn_rx_frame(sc, m);
-
-   RTWN_UNLOCK(sc);
-
+   ni = m->m_pkthdr.PH_loc.ptr;
+   m->m_pkthdr.PH_loc.ptr = NULL;
if (ni != NULL) {
(void)ieee80211_input_mimo(ni, m);
ieee80211_free_node(ni);
} else {
(void)ieee80211_input_mimo_all(ic, m);
}
-   RTWN_LOCK(sc);
m = next;
}
+   RTWN_LOCK(sc);
NET_EPOCH_EXIT(et);
break;
default:
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r366196 - head/sys/arm64/conf

2020-09-27 Thread Bjoern A. Zeeb

On 27 Sep 2020, at 10:15, Michal Meloun wrote:


Author: mmel
Date: Sun Sep 27 10:15:03 2020
New Revision: 366196
URL: https://svnweb.freebsd.org/changeset/base/366196

Log:
  Add LINUX_BOOT_ABI back to arm64 GENERIC kernel.

  It was removed in r355289 but forgot to return it back when new 
u-boot booti
  support was committed.  Although booti is not the preferred method 
of
  booting the kernel, it is very useful for the initial phase of 
porting
  FreeBSD to a new platform or booting the kernel on various embedded 
boards

  in an industrial environment.


Seem this prevents (at least my) kernels to boot from loader.

Removing the option and rebuilding and the kernel booted.

/bz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r366112 - in head/sys: dev/ath dev/bwn dev/iwn dev/malo dev/mwl net80211

2020-09-24 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Sep 24 10:57:39 2020
New Revision: 366112
URL: https://svnweb.freebsd.org/changeset/base/366112

Log:
  Provide MS() and SM() macros for 80211 and wireless drivers.
  
  We have (two versions) of MS() and SM() macros which we use throughout
  the wireless code.  Change all but three places (ath_hal, rtwn, and rsu)
  to the newly provided _IEEE80211_MASKSHIFT() and _IEEE80211_SHIFTMASK()
  macros.  Also change one internal case using both _S and _M instead of
  just _S away from _M (one of the reasons rtwn and rsu were not changed).
  
  This was done semi-mechanically.  No functional changes intended.
  
  Requested by: gnn (D26091)
  Reviewed by:  adrian (pre line wrap)
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26539

Modified:
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_ath_tx_ht.c
  head/sys/dev/bwn/if_bwn.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/malo/if_malo.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/net80211/ieee80211_freebsd.c
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_output.c
  head/sys/net80211/ieee80211_regdomain.c
  head/sys/net80211/ieee80211_sta.c
  head/sys/net80211/ieee80211_superg.c
  head/sys/net80211/ieee80211_var.h
  head/sys/net80211/ieee80211_vht.c

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cThu Sep 24 10:42:28 2020
(r366111)
+++ head/sys/dev/ath/if_ath_tx.cThu Sep 24 10:57:39 2020
(r366112)
@@ -2598,7 +2598,6 @@ ieee80211_is_action(struct ieee80211_frame *wh)
return 1;
 }
 
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
 /*
  * Return an alternate TID for ADDBA request frames.
  *
@@ -2637,11 +2636,10 @@ ath_tx_action_frame_override_queue(struct ath_softc *s
 
/* Extract TID, return it */
baparamset = le16toh(ia->rq_baparamset);
-   *tid = (int) MS(baparamset, IEEE80211_BAPS_TID);
+   *tid = (int) _IEEE80211_MASKSHIFT(baparamset, IEEE80211_BAPS_TID);
 
return 1;
 }
-#undef MS
 
 /* Per-node software queue operations */
 

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==
--- head/sys/dev/ath/if_ath_tx_ht.c Thu Sep 24 10:42:28 2020
(r366111)
+++ head/sys/dev/ath/if_ath_tx_ht.c Thu Sep 24 10:57:39 2020
(r366112)
@@ -406,7 +406,6 @@ static int
 ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf,
 uint16_t pktlen, int is_first)
 {
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
const HAL_RATE_TABLE *rt = sc->sc_currates;
struct ieee80211_node *ni = first_bf->bf_node;
struct ieee80211vap *vap = ni->ni_vap;
@@ -421,7 +420,8 @@ ath_compute_num_delims(struct ath_softc *sc, struct at
/*
 * Get the advertised density from the node.
 */
-   peer_mpdudensity = MS(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
+   peer_mpdudensity =
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MPDUDENSITY);
 
/*
 * vap->iv_ampdu_density is a net80211 value, rather than the actual
@@ -528,7 +528,6 @@ ath_compute_num_delims(struct ath_softc *sc, struct at
__func__, pktlen, minlen, rix, rc, width, half_gi, ndelim);
 
return ndelim;
-#undef MS
 }
 
 /*
@@ -568,7 +567,6 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
 {
struct ieee80211vap *vap = ni->ni_vap;
 
-#defineMS(_v, _f)  (((_v) & _f) >> _f##_S)
int amin = ATH_AGGR_MAXSIZE;
int i;
 
@@ -583,8 +581,8 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
 * Check the HTCAP field for the maximum size the node has
 * negotiated.  If it's smaller than what we have, cap it there.
 */
-   amin = MIN(amin, ath_rx_ampdu_to_byte(MS(ni->ni_htparam,
-   IEEE80211_HTCAP_MAXRXAMPDU)));
+   amin = MIN(amin, ath_rx_ampdu_to_byte(
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU)));
 
for (i = 0; i < ATH_RC_NUM; i++) {
if (bf->bf_state.bfs_rc[i].tries == 0)
@@ -598,11 +596,10 @@ ath_get_aggr_limit(struct ath_softc *sc, struct ieee80
__func__,
sc->sc_aggr_limit,
vap->iv_ampdu_limit,
-   MS(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU),
+   _IEEE80211_MASKSHIFT(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU),
amin);
 
return amin;
-#undef MS
 }
 
 /*

Modified: head/sys/dev/bwn/if_bwn.c
==
--- head/sys/dev/bwn/if_bwn.c   Thu Sep 24 10:42:28 2020(r366111)
+++ head/sys/dev/bwn/if_bwn.c   Thu Sep 24 10:57:39 2020(r366112)
@@ -2122,7 +2122,6 @@ bwn_stop(struct bwn_softc *sc)
 

Re: svn commit: r366042 - in head/stand: i386/zfsboot libsa

2020-09-23 Thread Bjoern A. Zeeb
On 23 Sep 2020, at 1:04, Warner Losh wrote:

>Ideally, we'd keep the cp /dev/null in the
>   build as a regression test,

Well or at least write a test case so that at least CI catches it.

/bz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r365419 - in head/sys/dev: ath bwi iwm iwn mwl otus usb/wlan wtap

2020-09-11 Thread Bjoern A. Zeeb

On 11 Sep 2020, at 14:02, Tomoaki AOKI wrote:


On Thu, 10 Sep 2020 10:22:05 +
"Bjoern A. Zeeb"  wrote:


On 9 Sep 2020, at 22:41, Tomoaki AOKI wrote:


This breaks at least iwm. (Other drivers not tested.)

Messages below are repeatedly shown and no carrier detected.
Manually reverting this commit fixes the issue.

iwm0: failed to send antennas before calibration: 35
iwm_run_init_ucode: failed 35
iwm_init_hw failed 35
iwm0: could not initiate scan


and lesser times messages below.

iwm0: iwm_send_phy_db_data: Cannot send HCMD of Phy DB cfg section, 
35

iwm_init_hw failed 35
iwm0: could not initiate scan




I’ll try to test iwm as well, in case you are faster, can you 
please
try this instead of reverting;  the previous version never made it 
past

the first return anymore in the last years it seems, so we can remove
the function entirely to keep the status quo:

Sorry for the oversight.


Your patch (needed to fix some line wrapping, though) fixed the issue
for me. Thanks!


Committed in r365633 in HEAD.   stable/12 already has the fix (#if 0ed 
the code).

I’ll merged the change in 3 days to keep the code in sync.


Thanks a lot for reporting and testing!

Bjoern
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r365633 - head/sys/dev/iwm

2020-09-11 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Sep 11 14:18:47 2020
New Revision: 365633
URL: https://svnweb.freebsd.org/changeset/base/365633

Log:
  iwm: fix regression from r365419 (ieee80211_media_change())
  
  In r365419 ieee80211_media_change() callers were updated to not longer
  act on the obselete ENETRESET return code.
  While in the old days iwm has done a stop/init cycle in these cases,
  this was not executed since r193340.
  As a consequence simplify iwm code as well by passing ieee80211_media_change()
  right to ieee80211_vap_attach() as there is no more need for a local
  implementation.
  
  Reported by:  Tomoaki AOKI (junchoon dec.sakura.ne.jp)
  Tested by:Tomoaki AOKI (junchoon dec.sakura.ne.jp)
  MFC after:3 days
  X-MFC:fix is already in stable/12
  PR:   248955

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Fri Sep 11 14:00:10 2020(r365632)
+++ head/sys/dev/iwm/if_iwm.c   Fri Sep 11 14:18:47 2020(r365633)
@@ -354,7 +354,6 @@ static struct ieee80211_node *
 static uint8_t iwm_rate_from_ucode_rate(uint32_t);
 static int iwm_rate2ridx(struct iwm_softc *, uint8_t);
 static voidiwm_setrates(struct iwm_softc *, struct iwm_node *, int);
-static int iwm_media_change(struct ifnet *);
 static int iwm_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static voidiwm_endscan_cb(void *, int);
 static int iwm_send_bt_init_conf(struct iwm_softc *);
@@ -4417,27 +4416,6 @@ iwm_setrates(struct iwm_softc *sc, struct iwm_node *in
}
 }
 
-static int
-iwm_media_change(struct ifnet *ifp)
-{
-   struct ieee80211vap *vap = ifp->if_softc;
-   struct ieee80211com *ic = vap->iv_ic;
-   struct iwm_softc *sc = ic->ic_softc;
-   int error;
-
-   error = ieee80211_media_change(ifp);
-   if (error != 0)
-   return (error);
-
-   IWM_LOCK(sc);
-   if (ic->ic_nrunning > 0) {
-   iwm_stop(sc);
-   iwm_init(sc);
-   }
-   IWM_UNLOCK(sc);
-   return (0);
-}
-
 static void
 iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap *vap)
 {
@@ -6432,8 +6410,8 @@ iwm_vap_create(struct ieee80211com *ic, const char nam
 
ieee80211_ratectl_init(vap);
/* Complete setup. */
-   ieee80211_vap_attach(vap, iwm_media_change, ieee80211_media_status,
-   mac);
+   ieee80211_vap_attach(vap, ieee80211_media_change,
+   ieee80211_media_status, mac);
ic->ic_opmode = opmode;
 
return vap;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r365419 - in head/sys/dev: ath bwi iwm iwn mwl otus usb/wlan wtap

2020-09-10 Thread Bjoern A. Zeeb

On 9 Sep 2020, at 22:41, Tomoaki AOKI wrote:


This breaks at least iwm. (Other drivers not tested.)

Messages below are repeatedly shown and no carrier detected.
Manually reverting this commit fixes the issue.

iwm0: failed to send antennas before calibration: 35
iwm_run_init_ucode: failed 35
iwm_init_hw failed 35
iwm0: could not initiate scan


and lesser times messages below.

iwm0: iwm_send_phy_db_data: Cannot send HCMD of Phy DB cfg section, 35
iwm_init_hw failed 35
iwm0: could not initiate scan




I’ll try to test iwm as well, in case you are faster, can you please 
try this instead of reverting;  the previous version never made it past 
the first return anymore in the last years it seems, so we can remove 
the function entirely to keep the status quo:


Sorry for the oversight.


Index: if_iwm.c
===
--- if_iwm.c(revision 365559)
+++ if_iwm.c(working copy)
@@ -354,7 +354,6 @@ static struct ieee80211_node *
 static uint8_t iwm_rate_from_ucode_rate(uint32_t);
 static int iwm_rate2ridx(struct iwm_softc *, uint8_t);
 static voidiwm_setrates(struct iwm_softc *, struct iwm_node *, 
int);

-static int iwm_media_change(struct ifnet *);
 static int iwm_newstate(struct ieee80211vap *, enum 
ieee80211_state, int);

 static voidiwm_endscan_cb(void *, int);
 static int iwm_send_bt_init_conf(struct iwm_softc *);
@@ -4417,27 +4416,6 @@ iwm_setrates(struct iwm_softc *sc, struct 
iwm_node

}
 }

-static int
-iwm_media_change(struct ifnet *ifp)
-{
-   struct ieee80211vap *vap = ifp->if_softc;
-   struct ieee80211com *ic = vap->iv_ic;
-   struct iwm_softc *sc = ic->ic_softc;
-   int error;
-
-   error = ieee80211_media_change(ifp);
-   if (error != 0)
-   return (error);
-
-   IWM_LOCK(sc);
-   if (ic->ic_nrunning > 0) {
-   iwm_stop(sc);
-   iwm_init(sc);
-   }
-   IWM_UNLOCK(sc);
-   return (0);
-}
-
 static void
 iwm_bring_down_firmware(struct iwm_softc *sc, struct ieee80211vap 
*vap)

 {
@@ -6432,8 +6410,8 @@ iwm_vap_create(struct ieee80211com *ic, const char

ieee80211_ratectl_init(vap);
/* Complete setup. */
-   ieee80211_vap_attach(vap, iwm_media_change, 
ieee80211_media_status,

-   mac);
+   ieee80211_vap_attach(vap, ieee80211_media_change,
+   ieee80211_media_status, mac);
ic->ic_opmode = opmode;

return vap;







Author: bz
Date: Mon Sep  7 15:35:40 2020
New Revision: 365419
URL: https://svnweb.freebsd.org/changeset/base/365419

Log:
  WiFi: fix ieee80211_media_change() callers

  In r178354 with the introduction of multi-bss ("vap") support

factoring
  out started and with r193340 ieee80211_media_change() no longer 
returned

 ENETRESET but only 0 or error.
  As ieee80211(9) tells the ieee80211_media_change() function should 
not

  be called directly but is registered with ieee80211_vap_attach()

instead.
  Some drivers have not been fully converted.  After fixing the 
return

  checking some of these functions were simply wrappers between
  ieee80211_vap_attach() and ieee80211_media_change(), so remove the

extra

  function, where possible as well.

  PR:   248955
  Submitted by: Tong Zhang (ztong0001 gmail.com) (original)
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/bwi/if_bwi.c
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/otus/if_otus.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/wtap/if_wtap.c

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Mon Sep  7 14:40:33 2020(r365418)
+++ head/sys/dev/ath/if_ath.c   Mon Sep  7 15:35:40 2020(r365419)
@@ -160,7 +160,6 @@ static int  ath_init(struct ath_softc *);
 static voidath_stop(struct ath_softc *);
 static int ath_reset_vap(struct ieee80211vap *, u_long);
 static int ath_transmit(struct ieee80211com *, struct mbuf *);
-static int ath_media_change(struct ifnet *);
 static voidath_watchdog(void *);
 static voidath_parent(struct ieee80211com *);
 static voidath_fatal_proc(void *, int);


(snip)


Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Mon Sep  7 14:40:33 2020(r365418)
+++ head/sys/dev/iwm/if_iwm.c   Mon Sep  7 15:35:40 2020(r365419)
@@ -4426,8 +4426,8 @@ iwm_media_change(struct ifnet *ifp)
int error;

error = ieee80211_media_change(ifp);
-   if (error != ENETRESET)
-   return error;
+   if (error != 0)
+   return (error);

IWM_LOCK(sc);
if (ic->ic_nrunning > 0) {
@@ -4435,7 +4435,7 @@ iwm_media_change(struct ifnet *ifp)
iwm_init(sc);
}
  

Re: svn commit: r365445 - head/sys/cam/mmc

2020-09-08 Thread Bjoern A. Zeeb

On 8 Sep 2020, at 7:10, Andriy Gapon wrote:


On 08/09/2020 08:46, Andriy Gapon wrote:

Author: avg
Date: Tue Sep  8 05:46:10 2020
New Revision: 365445
URL: https://svnweb.freebsd.org/changeset/base/365445

Log:
  mmc_da: make sure that part_index is not used uninitialized in 
sddastart

[snip]

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Tue Sep  8 04:44:37 2020(r365444)
+++ head/sys/cam/mmc/mmc_da.c   Tue Sep  8 05:46:10 2020(r365445)
@@ -1808,6 +1808,7 @@ sddastart(struct cam_periph *periph, union ccb 
*start_

}

 	/* Find partition that has outstanding commands.  Prefer current 
partition. */

+   part_index = softc->part_curr;
part = softc->part[softc->part_curr];
bp = bioq_first(>bio_queue);
if (bp == NULL) {



One thing that concerns me is that it was obvious (to a human) that 
part_index

could be used uninitialized if bp was not NULL.
Yet, there was no warning or error from the compiler when I built that 
code for

armv7.

I wonder if we disable some relevant warnings for that architecture.
Or if the compiler (clang 11) could not figure that out.



I had just finished dissecting my hang in g_waitidle on boot on the 
nanopi-m4v2/arm64 this morning and when I saw your commits as I came 
back home .. guess what:


364132  boots
364219  boots
364263  boots
364274  boots
364283  boots
364284  no			<< 
https://svnweb.freebsd.org/base?view=revision=364284  (clang 
merge)

364285  no
364307  no
364482  no
364657  no
365335  no
365364  no
365448  boots

/bz

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r365419 - in head/sys/dev: ath bwi iwm iwn mwl otus usb/wlan wtap

2020-09-07 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Sep  7 15:35:40 2020
New Revision: 365419
URL: https://svnweb.freebsd.org/changeset/base/365419

Log:
  WiFi: fix ieee80211_media_change() callers
  
  In r178354 with the introduction of multi-bss ("vap") support factoring
  out started and with r193340 ieee80211_media_change() no longer returned
  ENETRESET but only 0 or error.
  As ieee80211(9) tells the ieee80211_media_change() function should not
  be called directly but is registered with ieee80211_vap_attach() instead.
  
  Some drivers have not been fully converted.  After fixing the return
  checking some of these functions were simply wrappers between
  ieee80211_vap_attach() and ieee80211_media_change(), so remove the extra
  function, where possible as well.
  
  PR:   248955
  Submitted by: Tong Zhang (ztong0001 gmail.com) (original)
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/bwi/if_bwi.c
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwn/if_iwn.c
  head/sys/dev/mwl/if_mwl.c
  head/sys/dev/otus/if_otus.c
  head/sys/dev/usb/wlan/if_run.c
  head/sys/dev/wtap/if_wtap.c

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Mon Sep  7 14:40:33 2020(r365418)
+++ head/sys/dev/ath/if_ath.c   Mon Sep  7 15:35:40 2020(r365419)
@@ -160,7 +160,6 @@ static int  ath_init(struct ath_softc *);
 static voidath_stop(struct ath_softc *);
 static int ath_reset_vap(struct ieee80211vap *, u_long);
 static int ath_transmit(struct ieee80211com *, struct mbuf *);
-static int ath_media_change(struct ifnet *);
 static voidath_watchdog(void *);
 static voidath_parent(struct ieee80211com *);
 static voidath_fatal_proc(void *, int);
@@ -1766,8 +1765,8 @@ ath_vap_create(struct ieee80211com *ic, const char nam
ATH_UNLOCK(sc);
 
/* complete setup */
-   ieee80211_vap_attach(vap, ath_media_change, ieee80211_media_status,
-   mac);
+   ieee80211_vap_attach(vap, ieee80211_media_change,
+   ieee80211_media_status, mac);
return vap;
 bad2:
reclaim_address(sc, mac);
@@ -3541,14 +3540,6 @@ finish:
ATH_KTR(sc, ATH_KTR_TX, 0, "ath_transmit: finished");
 
return (retval);
-}
-
-static int
-ath_media_change(struct ifnet *ifp)
-{
-   int error = ieee80211_media_change(ifp);
-   /* NB: only the fixed rate can change and that doesn't need a reset */
-   return (error == ENETRESET ? 0 : error);
 }
 
 /*

Modified: head/sys/dev/bwi/if_bwi.c
==
--- head/sys/dev/bwi/if_bwi.c   Mon Sep  7 14:40:33 2020(r365418)
+++ head/sys/dev/bwi/if_bwi.c   Mon Sep  7 15:35:40 2020(r365419)
@@ -118,7 +118,6 @@ static void bwi_set_channel(struct ieee80211com *);
 static voidbwi_scan_end(struct ieee80211com *);
 static int bwi_newstate(struct ieee80211vap *, enum ieee80211_state, int);
 static voidbwi_updateslot(struct ieee80211com *);
-static int bwi_media_change(struct ifnet *);
 
 static voidbwi_calibrate(void *);
 
@@ -607,8 +606,8 @@ bwi_vap_create(struct ieee80211com *ic, const char nam
ieee80211_ratectl_init(vap);
 
/* complete setup */
-   ieee80211_vap_attach(vap, bwi_media_change, ieee80211_media_status,
-   mac);
+   ieee80211_vap_attach(vap, ieee80211_media_change,
+   ieee80211_media_status, mac);
ic->ic_opmode = opmode;
return vap;
 }
@@ -1807,14 +1806,6 @@ back:
BWI_UNLOCK(sc);
 
return error;
-}
-
-static int
-bwi_media_change(struct ifnet *ifp)
-{
-   int error = ieee80211_media_change(ifp);
-   /* NB: only the fixed rate can change and that doesn't need a reset */
-   return (error == ENETRESET ? 0 : error);
 }
 
 static int

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Mon Sep  7 14:40:33 2020(r365418)
+++ head/sys/dev/iwm/if_iwm.c   Mon Sep  7 15:35:40 2020(r365419)
@@ -4426,8 +4426,8 @@ iwm_media_change(struct ifnet *ifp)
int error;
 
error = ieee80211_media_change(ifp);
-   if (error != ENETRESET)
-   return error;
+   if (error != 0)
+   return (error);
 
IWM_LOCK(sc);
if (ic->ic_nrunning > 0) {
@@ -4435,7 +4435,7 @@ iwm_media_change(struct ifnet *ifp)
iwm_init(sc);
}
IWM_UNLOCK(sc);
-   return error;
+   return (0);
 }
 
 static void

Modified: head/sys/dev/iwn/if_iwn.c
==
--- head/sys/dev/iwn/if_iwn.c   Mon Sep  7 14:40:33 2020(r365418)
+++ head/sys/dev/iwn/if_iwn.c   Mon Sep  7 15:35:40 2020(r365419)
@@ -194,7 +194,6 @@ static void iwn_read_eeprom_enhinfo(struct 

svn commit: r365350 - head/sys/netinet/tcp_stacks

2020-09-04 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Sep  5 00:20:32 2020
New Revision: 365350
URL: https://svnweb.freebsd.org/changeset/base/365350

Log:
  bbr: remove unused static function
  
  bbr_log_type_hrdwtso() is a file local static unused function.
  Remove it to avoid warnings on kernel compiles.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D26331

Modified:
  head/sys/netinet/tcp_stacks/bbr.c

Modified: head/sys/netinet/tcp_stacks/bbr.c
==
--- head/sys/netinet/tcp_stacks/bbr.c   Sat Sep  5 00:19:40 2020
(r365349)
+++ head/sys/netinet/tcp_stacks/bbr.c   Sat Sep  5 00:20:32 2020
(r365350)
@@ -11716,31 +11716,6 @@ done_with_input:
 }
 
 static void
-bbr_log_type_hrdwtso(struct tcpcb *tp, struct tcp_bbr *bbr, int len, int mod, 
int what_we_can_send)
-{
-   if (tp->t_logstate != TCP_LOG_STATE_OFF) {
-   union tcp_log_stackspecific log;
-   struct timeval tv;
-   uint32_t cts;
-
-   cts = tcp_get_usecs();
-   bbr_fill_in_logging_data(bbr, _bbr, cts);
-   log.u_bbr.flex1 = bbr->r_ctl.rc_pace_min_segs;
-   log.u_bbr.flex2 = what_we_can_send;
-   log.u_bbr.flex3 = bbr->r_ctl.rc_pace_max_segs;
-   log.u_bbr.flex4 = len;
-   log.u_bbr.flex5 = 0;
-   log.u_bbr.flex7 = mod;
-   log.u_bbr.flex8 = 1;
-   TCP_LOG_EVENTP(tp, NULL,
-   >t_inpcb->inp_socket->so_rcv,
-   >t_inpcb->inp_socket->so_snd,
-   TCP_HDWR_TLS, 0,
-   0, , false, );
-   }
-}
-
-static void
 bbr_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so,
 struct tcpcb *tp, int32_t drop_hdrlen, int32_t tlen, uint8_t iptos)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r365349 - head/sys/kern

2020-09-04 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Sep  5 00:19:40 2020
New Revision: 365349
URL: https://svnweb.freebsd.org/changeset/base/365349

Log:
  uipc_ktls: remove unused static function
  
  m_segments() was added with r363464 but never used. Remove it to
  avoid warnings when compiling kernels.
  
  Reported by:  rmacklem (also says jhb)
  Reviewed by:  gallatin, jhb
  Differential Revision:https://reviews.freebsd.org/D26330

Modified:
  head/sys/kern/uipc_ktls.c

Modified: head/sys/kern/uipc_ktls.c
==
--- head/sys/kern/uipc_ktls.c   Fri Sep  4 23:36:43 2020(r365348)
+++ head/sys/kern/uipc_ktls.c   Sat Sep  5 00:19:40 2020(r365349)
@@ -1643,21 +1643,6 @@ out:
return (top);
 }
 
-static int
-m_segments(struct mbuf *m, int skip)
-{
-   int count;
-
-   while (skip >= m->m_len) {
-   skip -= m->m_len;
-   m = m->m_next;
-   }
-
-   for (count = 0; m != NULL; count++)
-   m = m->m_next;
-   return (count);
-}
-
 static void
 ktls_decrypt(struct socket *so)
 {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r365335 - head/sys/dev/usb/storage

2020-09-04 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Sep  4 18:29:59 2020
New Revision: 365335
URL: https://svnweb.freebsd.org/changeset/base/365335

Log:
  umass: enhance debugging
  
  Investigating a hang I found having some more error information
  available would be helpful, so be more verbose and also tell cam/xpt
  status in case of error/panic.
  
  Reviewed by:  hselasky
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D26287

Modified:
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/storage/umass.c
==
--- head/sys/dev/usb/storage/umass.cFri Sep  4 18:26:35 2020
(r365334)
+++ head/sys/dev/usb/storage/umass.cFri Sep  4 18:29:59 2020
(r365335)
@@ -2063,6 +2063,7 @@ static int
 umass_cam_attach_sim(struct umass_softc *sc)
 {
struct cam_devq *devq;  /* Per device Queue */
+   cam_status status;
 
/*
 * A HBA is attached to the CAM layer.
@@ -2091,11 +2092,12 @@ umass_cam_attach_sim(struct umass_softc *sc)
}
 
mtx_lock(>sc_mtx);
-
-   if (xpt_bus_register(sc->sc_sim, sc->sc_dev,
-   sc->sc_unit) != CAM_SUCCESS) {
+   status = xpt_bus_register(sc->sc_sim, sc->sc_dev, sc->sc_unit);
+   if (status != CAM_SUCCESS) {
cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
mtx_unlock(>sc_mtx);
+   printf("%s: xpt_bus_register failed with status %#x\n",
+   __func__, status);
return (ENOMEM);
}
mtx_unlock(>sc_mtx);
@@ -2121,14 +2123,22 @@ umass_cam_attach(struct umass_softc *sc)
 static void
 umass_cam_detach_sim(struct umass_softc *sc)
 {
+   cam_status status;
+
if (sc->sc_sim != NULL) {
-   if (xpt_bus_deregister(cam_sim_path(sc->sc_sim))) {
+   status = xpt_bus_deregister(cam_sim_path(sc->sc_sim));
+   if (status == CAM_REQ_CMP) {
/* accessing the softc is not possible after this */
sc->sc_sim->softc = NULL;
+   DPRINTF(sc, UDMASS_SCSI, "%s: %s:%d:%d caling "
+   "cam_sim_free sim %p refc %u mtx %p\n",
+   __func__, sc->sc_name, cam_sim_path(sc->sc_sim),
+   sc->sc_unit, sc->sc_sim,
+   sc->sc_sim->refcount, sc->sc_sim->mtx);
cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
} else {
-   panic("%s: CAM layer is busy\n",
-   sc->sc_name);
+   panic("%s: %s: CAM layer is busy: %#x\n",
+   __func__, sc->sc_name, status);
}
sc->sc_sim = NULL;
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r365334 - head/sys/dev/usb/storage

2020-09-04 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Sep  4 18:26:35 2020
New Revision: 365334
URL: https://svnweb.freebsd.org/changeset/base/365334

Log:
  umass: fix a cam_sim leak in error case
  
  While debugging a hang I noticed that in case of error in
  umass_cam_attach_sim() we miss a cam_sim_free() call.
  Added that to not leak resources.
  
  Reviewed by:  hselasky
  MFC after:3 days
  Differential Revision:D26287

Modified:
  head/sys/dev/usb/storage/umass.c

Modified: head/sys/dev/usb/storage/umass.c
==
--- head/sys/dev/usb/storage/umass.cFri Sep  4 18:18:05 2020
(r365333)
+++ head/sys/dev/usb/storage/umass.cFri Sep  4 18:26:35 2020
(r365334)
@@ -2094,6 +2094,7 @@ umass_cam_attach_sim(struct umass_softc *sc)
 
if (xpt_bus_register(sc->sc_sim, sc->sc_dev,
sc->sc_unit) != CAM_SUCCESS) {
+   cam_sim_free(sc->sc_sim, /* free_devq */ TRUE);
mtx_unlock(>sc_mtx);
return (ENOMEM);
}
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r365333 - head/sys/cam

2020-09-04 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Sep  4 18:18:05 2020
New Revision: 365333
URL: https://svnweb.freebsd.org/changeset/base/365333

Log:
  cam_sim: harmonize code related to acquiring a mtx
  
  cam_sim_free(), cam_sim_release(), and cam_sim_hold() all assign
  a mtx variable during declaration and then if NULL or the mtx is
  held may re-asign the variable and/or acquire/release a lock.
  
  Harmonize the code, avoiding double assignments and make it look
  the same for all three function (with cam_sim_free() not needing
  an extra case).
  
  No functional changes intended.
  
  Reviewed by:  imp; no-objections by: mav
  MFC after:3 days
  Differential Revision:https://reviews.freebsd.org/D26286

Modified:
  head/sys/cam/cam_sim.c

Modified: head/sys/cam/cam_sim.c
==
--- head/sys/cam/cam_sim.c  Fri Sep  4 17:37:58 2020(r365332)
+++ head/sys/cam/cam_sim.c  Fri Sep  4 18:18:05 2020(r365333)
@@ -124,14 +124,15 @@ cam_sim_alloc_dev(sim_action_func sim_action, sim_poll
 void
 cam_sim_free(struct cam_sim *sim, int free_devq)
 {
-   struct mtx *mtx = sim->mtx;
+   struct mtx *mtx;
int error;
 
-   if (mtx) {
-   mtx_assert(mtx, MA_OWNED);
-   } else {
+   if (sim->mtx == NULL) {
mtx = _sim_free_mtx;
mtx_lock(mtx);
+   } else {
+   mtx = sim->mtx;
+   mtx_assert(mtx, MA_OWNED);
}
sim->refcount--;
if (sim->refcount > 0) {
@@ -139,7 +140,7 @@ cam_sim_free(struct cam_sim *sim, int free_devq)
KASSERT(error == 0, ("invalid error value for msleep(9)"));
}
KASSERT(sim->refcount == 0, ("sim->refcount == 0"));
-   if (sim->mtx == NULL)
+   if (mtx == _sim_free_mtx)   /* sim->mtx == NULL */
mtx_unlock(mtx);
 
if (free_devq)
@@ -150,17 +151,16 @@ cam_sim_free(struct cam_sim *sim, int free_devq)
 void
 cam_sim_release(struct cam_sim *sim)
 {
-   struct mtx *mtx = sim->mtx;
+   struct mtx *mtx;
 
-   if (mtx) {
-   if (!mtx_owned(mtx))
-   mtx_lock(mtx);
-   else
-   mtx = NULL;
-   } else {
+   if (sim->mtx == NULL)
mtx = _sim_free_mtx;
+   else if (!mtx_owned(sim->mtx))
+   mtx = sim->mtx;
+   else
+   mtx = NULL; /* We hold the lock. */
+   if (mtx)
mtx_lock(mtx);
-   }
KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
sim->refcount--;
if (sim->refcount == 0)
@@ -172,17 +172,16 @@ cam_sim_release(struct cam_sim *sim)
 void
 cam_sim_hold(struct cam_sim *sim)
 {
-   struct mtx *mtx = sim->mtx;
+   struct mtx *mtx;
 
-   if (mtx) {
-   if (!mtx_owned(mtx))
-   mtx_lock(mtx);
-   else
-   mtx = NULL;
-   } else {
+   if (sim->mtx == NULL)
mtx = _sim_free_mtx;
+   else if (!mtx_owned(sim->mtx))
+   mtx = sim->mtx;
+   else
+   mtx = NULL; /* We hold the lock. */
+   if (mtx)
mtx_lock(mtx);
-   }
KASSERT(sim->refcount >= 1, ("sim->refcount >= 1"));
sim->refcount++;
if (mtx)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364771 - head/usr.sbin/rtsold

2020-08-25 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Aug 25 16:09:23 2020
New Revision: 364771
URL: https://svnweb.freebsd.org/changeset/base/364771

Log:
  rtsol(d): add script for "M bit"
  
  While we do support the "O bit" running a script (usually to start a
  dhcpv6 client) we have no options for setups which set the "M bit" for,
  e.g., static address assignment as in EC2.
  
  Duplicate most of the "O bit" logic to also start a script for the
  "M bit" with the one difference: if the "M bit" is set we will not
  start the script for the "O bit" as well (per RFC 4861, Section 4.2).
  
  Reviewed by:  hrs, markj
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D26099

Modified:
  head/usr.sbin/rtsold/dump.c
  head/usr.sbin/rtsold/rtsol.c
  head/usr.sbin/rtsold/rtsold.8
  head/usr.sbin/rtsold/rtsold.c
  head/usr.sbin/rtsold/rtsold.h

Modified: head/usr.sbin/rtsold/dump.c
==
--- head/usr.sbin/rtsold/dump.c Tue Aug 25 15:19:45 2020(r364770)
+++ head/usr.sbin/rtsold/dump.c Tue Aug 25 16:09:23 2020(r364771)
@@ -84,6 +84,8 @@ rtsold_dump(FILE *fp)
}
fprintf(fp, "  interface status: %s\n",
ifi->active > 0 ? "active" : "inactive");
+   fprintf(fp, "  managed config: %s\n",
+   ifi->managedconfig ? "on" : "off");
fprintf(fp, "  other config: %s\n",
ifi->otherconfig ? "on" : "off");
fprintf(fp, "  rtsold status: %s\n", ifstatstr[ifi->state]);

Modified: head/usr.sbin/rtsold/rtsol.c
==
--- head/usr.sbin/rtsold/rtsol.cTue Aug 25 15:19:45 2020
(r364770)
+++ head/usr.sbin/rtsold/rtsol.cTue Aug 25 16:09:23 2020
(r364771)
@@ -79,6 +79,7 @@ static int ra_opt_rdnss_dispatch(struct ifinfo *, stru
 struct script_msg_head_t *, struct script_msg_head_t *);
 static char *make_rsid(const char *, const char *, struct rainfo *);
 
+#define_ARGS_MANAGED   managedconf_script, ifi->ifname
 #define_ARGS_OTHER otherconf_script, ifi->ifname
 #define_ARGS_RESADDresolvconf_script, "-a", rsid
 #define_ARGS_RESDELresolvconf_script, "-d", rsid
@@ -291,18 +292,36 @@ rtsol_input(int sock)
nd_ra = (struct nd_router_advert *)icp;
 
/*
+* Process the "M bit."
+* If the value of ManagedConfigFlag changes from FALSE to TRUE, the
+* host should invoke the stateful autoconfiguration protocol,
+* requesting information.
+* [RFC 4861 Section 4.2]
+* XXX ??? [draft-ietf-v6ops-dhcpv6-slaac-problem-07]
+*/
+   if (((nd_ra->nd_ra_flags_reserved) & ND_RA_FLAG_MANAGED) &&
+   !ifi->managedconfig) {
+   warnmsg(LOG_DEBUG, __func__,
+   "ManagedConfigFlag on %s is turned on", ifi->ifname);
+   ifi->managedconfig = 1;
+   CALL_SCRIPT(MANAGED, NULL);
+   }
+
+   /*
 * Process the "O bit."
 * If the value of OtherConfigFlag changes from FALSE to TRUE, the
 * host should invoke the stateful autoconfiguration protocol,
-* requesting information.
-* [RFC 2462 Section 5.5.3]
+* requesting information unless the "M bit" was set as well in
+* which case the "O bit" is redundant.
+* [RFC 4861 Section 4.2]
 */
if (((nd_ra->nd_ra_flags_reserved) & ND_RA_FLAG_OTHER) &&
!ifi->otherconfig) {
warnmsg(LOG_DEBUG, __func__,
"OtherConfigFlag on %s is turned on", ifi->ifname);
ifi->otherconfig = 1;
-   CALL_SCRIPT(OTHER, NULL);
+   if (!ifi->managedconfig)
+   CALL_SCRIPT(OTHER, NULL);
}
clock_gettime(CLOCK_MONOTONIC_FAST, );
newent_rai = 0;

Modified: head/usr.sbin/rtsold/rtsold.8
==
--- head/usr.sbin/rtsold/rtsold.8   Tue Aug 25 15:19:45 2020
(r364770)
+++ head/usr.sbin/rtsold/rtsold.8   Tue Aug 25 16:09:23 2020
(r364771)
@@ -29,7 +29,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd June 14, 2011
+.Dd August 19, 2020
 .Dt RTSOLD 8
 .Os
 .\"
@@ -40,23 +40,27 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl dDfFmu1
+.Op Fl M Ar script-name
 .Op Fl O Ar script-name
 .Op Fl p Ar pidfile
 .Op Fl R Ar script-name
 .Ar interface ...
 .Nm
 .Op Fl dDfFmu1
+.Op Fl M Ar script-name
 .Op Fl O Ar script-name
 .Op Fl p Ar pidfile
 .Op Fl R Ar script-name
 .Fl a
 .Nm rtsol
 .Op Fl dDu
+.Op Fl M Ar script-name
 .Op Fl O Ar script-name
 .Op Fl R Ar script-name
 .Ar interface ...
 .Nm rtsol
 .Op Fl dDu
+.Op Fl M Ar script-name
 .Op Fl O Ar script-name
 .Op Fl R Ar script-name
 .Fl a
@@ -208,6 +212,20 @@ Transmit Router Solicitation packets until at least on
 Advertisement packet has arrived on each
 

svn commit: r364673 - in head/sys: dev/rtwn dev/usb/wlan net80211

2020-08-24 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 24 13:15:08 2020
New Revision: 364673
URL: https://svnweb.freebsd.org/changeset/base/364673

Log:
  net80211: enhance getflags*() and ieee80211_add_channel*()
  
  For ieee80211_add_channel+*() we are passing in an int flag for
  ht40 and in some cases another int flag for vht80 where we'd only
  need two bits really.
  Convert these variables to a bitflag and fold them together into one.
  This also allows for VHT160 and VHT80P80 and whatever may come to
  be considered. Define the various options currently needed.
  
  Change the drivers (rtwn and rsu) which actually set this bit to non-0.
  For convenience the "1" currently used for HT40 is preserved.
  
  Enahnce getflags_5ghz() to handle the full set of VHT flags based
  on the input flags from the the driver.
  
  Update the regdomain implementation as well to make use of the new
  flags and deal with higher [V]HT bandwidths.
  
  ieee80211_add_channel() specifically did not take flags so it will
  not support naything beyond 20Mhz channels.
  
  Note: I am not entirely happy with the "cbw_flag[s]" name, but we
  do use chan_flags elsewhere already.
  
  MFC after:2 weeks
  Reviewed by:  adrian, gnn
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential revision:https://reviews.freebsd.org/D26091

Modified:
  head/sys/dev/rtwn/if_rtwn.c
  head/sys/dev/usb/wlan/if_rsu.c
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_regdomain.c
  head/sys/net80211/ieee80211_var.h

Modified: head/sys/dev/rtwn/if_rtwn.c
==
--- head/sys/dev/rtwn/if_rtwn.c Mon Aug 24 13:14:38 2020(r364672)
+++ head/sys/dev/rtwn/if_rtwn.c Mon Aug 24 13:15:08 2020(r364673)
@@ -1525,25 +1525,29 @@ rtwn_getradiocaps(struct ieee80211com *ic,
 {
struct rtwn_softc *sc = ic->ic_softc;
uint8_t bands[IEEE80211_MODE_BYTES];
-   int i;
+   int cbw_flags, i;
 
+   cbw_flags = (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) ?
+   NET80211_CBW_FLAG_HT40 : 0;
+
memset(bands, 0, sizeof(bands));
setbit(bands, IEEE80211_MODE_11B);
setbit(bands, IEEE80211_MODE_11G);
setbit(bands, IEEE80211_MODE_11NG);
ieee80211_add_channels_default_2ghz(chans, maxchans, nchans,
-   bands, !!(ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40));
+   bands, cbw_flags);
 
/* XXX workaround add_channel_list() limitations */
setbit(bands, IEEE80211_MODE_11A);
setbit(bands, IEEE80211_MODE_11NA);
for (i = 0; i < nitems(sc->chan_num_5ghz); i++) {
+
if (sc->chan_num_5ghz[i] == 0)
continue;
 
ieee80211_add_channel_list_5ghz(chans, maxchans, nchans,
sc->chan_list_5ghz[i], sc->chan_num_5ghz[i], bands,
-   !!(ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40));
+   cbw_flags);
}
 }
 

Modified: head/sys/dev/usb/wlan/if_rsu.c
==
--- head/sys/dev/usb/wlan/if_rsu.c  Mon Aug 24 13:14:38 2020
(r364672)
+++ head/sys/dev/usb/wlan/if_rsu.c  Mon Aug 24 13:15:08 2020
(r364673)
@@ -779,7 +779,8 @@ rsu_getradiocaps(struct ieee80211com *ic,
if (sc->sc_ht)
setbit(bands, IEEE80211_MODE_11NG);
ieee80211_add_channels_default_2ghz(chans, maxchans, nchans,
-   bands, (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) != 0);
+   bands, (ic->ic_htcaps & IEEE80211_HTCAP_CHWIDTH40) ?
+   NET80211_CBW_FLAG_HT40 : 0);
 }
 
 static void

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Mon Aug 24 13:14:38 2020
(r364672)
+++ head/sys/net80211/ieee80211.c   Mon Aug 24 13:15:08 2020
(r364673)
@@ -1301,7 +1301,7 @@ copychan_prev(struct ieee80211_channel chans[], int ma
  * XXX VHT-2GHz
  */
 static void
-getflags_2ghz(const uint8_t bands[], uint32_t flags[], int ht40)
+getflags_2ghz(const uint8_t bands[], uint32_t flags[], int cbw_flags)
 {
int nmodes;
 
@@ -1312,7 +1312,7 @@ getflags_2ghz(const uint8_t bands[], uint32_t flags[],
flags[nmodes++] = IEEE80211_CHAN_G;
if (isset(bands, IEEE80211_MODE_11NG))
flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT20;
-   if (ht40) {
+   if (cbw_flags & NET80211_CBW_FLAG_HT40) {
flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT40U;
flags[nmodes++] = IEEE80211_CHAN_G | IEEE80211_CHAN_HT40D;
}
@@ -1320,12 +1320,12 @@ getflags_2ghz(const uint8_t bands[], uint32_t flags[],
 }
 
 static void
-getflags_5ghz(const uint8_t bands[], uint32_t flags[], int ht40, int vht80)
+getflags_5ghz(const uint8_t bands[], uint32_t flags[], int cbw_flags)
 {
int nmodes;
 
/*
-  

svn commit: r364553 - head/sys/net80211

2020-08-23 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Aug 23 21:42:23 2020
New Revision: 364553
URL: https://svnweb.freebsd.org/changeset/base/364553

Log:
  net80211: improve media information for VHT5GHZ
  
  Improve ieee80211_media_setup(), media2mode(), and
  ieee80211_rate2media() for VHT5GHZ at least.
  
  Reviewed by:  adrian, gnn
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26089

Modified:
  head/sys/net80211/ieee80211.c

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Sun Aug 23 21:38:48 2020
(r364552)
+++ head/sys/net80211/ieee80211.c   Sun Aug 23 21:42:23 2020
(r364553)
@@ -1920,12 +1920,18 @@ ieee80211_media_setup(struct ieee80211com *ic,
 
/*
 * Add VHT media.
+* XXX-BZ skip "VHT_2GHZ" for now.
 */
-   for (; mode <= IEEE80211_MODE_VHT_5GHZ; mode++) {
+   for (mode = IEEE80211_MODE_VHT_5GHZ; mode <= IEEE80211_MODE_VHT_5GHZ;
+   mode++) {
if (isclr(ic->ic_modecaps, mode))
continue;
addmedia(media, caps, addsta, mode, IFM_AUTO);
addmedia(media, caps, addsta, mode, IFM_IEEE80211_VHT);
+   }
+   if (isset(ic->ic_modecaps, IEEE80211_MODE_VHT_5GHZ)) {
+  addmedia(media, caps, addsta,
+  IEEE80211_MODE_AUTO, IFM_IEEE80211_VHT);
 
/* XXX TODO: VHT maxrate */
}
@@ -2044,6 +2050,12 @@ media2mode(const struct ifmedia_entry *ime, uint32_t f
case IFM_IEEE80211_11NG:
*mode = IEEE80211_MODE_11NG;
break;
+   case IFM_IEEE80211_VHT2G:
+   *mode = IEEE80211_MODE_VHT_2GHZ;
+   break;
+   case IFM_IEEE80211_VHT5G:
+   *mode = IEEE80211_MODE_VHT_5GHZ;
+   break;
case IFM_AUTO:
*mode = IEEE80211_MODE_AUTO;
break;
@@ -2387,12 +2399,36 @@ ieee80211_rate2media(struct ieee80211com *ic, int rate
{  75, IFM_IEEE80211_MCS },
{  76, IFM_IEEE80211_MCS },
};
+   static const struct ratemedia vhtrates[] = {
+   {   0, IFM_IEEE80211_VHT },
+   {   1, IFM_IEEE80211_VHT },
+   {   2, IFM_IEEE80211_VHT },
+   {   3, IFM_IEEE80211_VHT },
+   {   4, IFM_IEEE80211_VHT },
+   {   5, IFM_IEEE80211_VHT },
+   {   6, IFM_IEEE80211_VHT },
+   {   7, IFM_IEEE80211_VHT },
+   {   8, IFM_IEEE80211_VHT }, /* Optional. */
+   {   9, IFM_IEEE80211_VHT }, /* Optional. */
+#if 0
+   /* Some QCA and BRCM seem to support this; offspec. */
+   {  10, IFM_IEEE80211_VHT },
+   {  11, IFM_IEEE80211_VHT },
+#endif
+   };
int m;
 
/*
-* Check 11n rates first for match as an MCS.
+* Check 11ac/11n rates first for match as an MCS.
 */
-   if (mode == IEEE80211_MODE_11NA) {
+   if (mode == IEEE80211_MODE_VHT_5GHZ) {
+   if (rate & IFM_IEEE80211_VHT) {
+   rate &= ~IFM_IEEE80211_VHT;
+   m = findmedia(vhtrates, nitems(vhtrates), rate);
+   if (m != IFM_AUTO)
+   return (m | IFM_IEEE80211_VHT);
+   }
+   } else if (mode == IEEE80211_MODE_11NA) {
if (rate & IEEE80211_RATE_MCS) {
rate &= ~IEEE80211_RATE_MCS;
m = findmedia(htrates, nitems(htrates), rate);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364551 - head/sys/net80211

2020-08-23 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Aug 23 21:37:20 2020
New Revision: 364551
URL: https://svnweb.freebsd.org/changeset/base/364551

Log:
  net80211: set_vht_extchan() reverse order to always return best
  
  In set_vht_extchan() the checks are performed in the order of VHT20/40/80.
  That means if a channel has a lower and higheer VHT flag set we would
  return the lower first.
  We normally do not set more than one VHT flag so this change is supposed
  to be a NOP but follows the logical thinking order of returning the best
  first. Also we nowhere assert a single VHT flag so make sure we'll not
  be stuck with VHT20 when we could do more.
  
  While here add the debugging printfs for VHT160 and VHT80P80 which still
  need doing once we deal with a driver at that level.
  
  Reviewed by:  adrian, gnn
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26088

Modified:
  head/sys/net80211/ieee80211.c

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Sun Aug 23 21:35:23 2020
(r364550)
+++ head/sys/net80211/ieee80211.c   Sun Aug 23 21:37:20 2020
(r364551)
@@ -1168,23 +1168,17 @@ set_vht_extchan(struct ieee80211_channel *c)
 {
int i;
 
-   if (! IEEE80211_IS_CHAN_VHT(c)) {
+   if (! IEEE80211_IS_CHAN_VHT(c))
return (0);
-   }
 
-   if (IEEE80211_IS_CHAN_VHT20(c)) {
-   c->ic_vht_ch_freq1 = c->ic_ieee;
-   return (1);
+   if (IEEE80211_IS_CHAN_VHT80P80(c)) {
+   printf("%s: TODO VHT80+80 channel (ieee=%d, flags=0x%08x)\n",
+   __func__, c->ic_ieee, c->ic_flags);
}
 
-   if (IEEE80211_IS_CHAN_VHT40(c)) {
-   if (IEEE80211_IS_CHAN_HT40U(c))
-   c->ic_vht_ch_freq1 = c->ic_ieee + 2;
-   else if (IEEE80211_IS_CHAN_HT40D(c))
-   c->ic_vht_ch_freq1 = c->ic_ieee - 2;
-   else
-   return (0);
-   return (1);
+   if (IEEE80211_IS_CHAN_VHT160(c)) {
+   printf("%s: TODO VHT160 channel (ieee=%d, flags=0x%08x)\n",
+   __func__, c->ic_ieee, c->ic_flags);
}
 
if (IEEE80211_IS_CHAN_VHT80(c)) {
@@ -1206,6 +1200,21 @@ set_vht_extchan(struct ieee80211_channel *c)
}
}
return (0);
+   }
+
+   if (IEEE80211_IS_CHAN_VHT40(c)) {
+   if (IEEE80211_IS_CHAN_HT40U(c))
+   c->ic_vht_ch_freq1 = c->ic_ieee + 2;
+   else if (IEEE80211_IS_CHAN_HT40D(c))
+   c->ic_vht_ch_freq1 = c->ic_ieee - 2;
+   else
+   return (0);
+   return (1);
+   }
+
+   if (IEEE80211_IS_CHAN_VHT20(c)) {
+   c->ic_vht_ch_freq1 = c->ic_ieee;
+   return (1);
}
 
printf("%s: unknown VHT channel type (ieee=%d, flags=0x%08x)\n",
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364466 - head

2020-08-21 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Aug 21 22:31:45 2020
New Revision: 364466
URL: https://svnweb.freebsd.org/changeset/base/364466

Log:
  After the clang/llvm version 11 import LLD_VERSION is no longer used
  upstream so Version.inc now only defines LLD_VERSION_STRING.
  
  This breaks the WANT_LINKER_VERSION magic and might lead to us building
  more than needed (e.g., for croos-tools).
  
  Change the awk script to parse LLD_VERSION_STRING instead of LLD_VERSION,
  which not only unbreaks the current situation but should also be backwards
  compatible as dim points out.
  
  PR:   248818
  Reviewed by:  emaste, dim (seems right and the way to go)
  MFC after:4 weeks
  X-MFC before: 364284

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Fri Aug 21 21:34:52 2020(r364465)
+++ head/Makefile.inc1  Fri Aug 21 22:31:45 2020(r364466)
@@ -264,7 +264,7 @@ _WANT_LINKER_FREEBSD_VERSION!= \
 WANT_LINKER_FREEBSD_VERSION=${_WANT_LINKER_FREEBSD_VERSION:C/.*-(.*)/\1/}
 WANT_LINKER_VERSION_FILE= lib/clang/include/lld/Common/Version.inc
 WANT_LINKER_VERSION!= \
-   awk '$$2 == "LLD_VERSION" {split($$3, a, "."); print a[1] * 1 + 
a[2] * 100 + a[3]}' \
+   awk '$$2 == "LLD_VERSION_STRING" { gsub("\"", "", $$3); split($$3, a, 
"."); print a[1] * 1 + a[2] * 100 + a[3]}' \
${SRCDIR}/${WANT_LINKER_VERSION_FILE} || echo unknown
 .else
 WANT_LINKER_FREEBSD_VERSION_FILE=
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364327 - head/sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 20:18:01 2020
New Revision: 364327
URL: https://svnweb.freebsd.org/changeset/base/364327

Log:
  net80211: replace magic number by define
  
  Rather than coding an array size of [4] replace the number with
  WME_NUM_AC.
  
  MFC after:2 weeks
  Reviewed by:  adrian
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26090

Modified:
  head/sys/net80211/ieee80211_proto.h

Modified: head/sys/net80211/ieee80211_proto.h
==
--- head/sys/net80211/ieee80211_proto.h Mon Aug 17 20:16:33 2020
(r364326)
+++ head/sys/net80211/ieee80211_proto.h Mon Aug 17 20:18:01 2020
(r364327)
@@ -286,7 +286,7 @@ struct ieee80211_wme_state {
u_int   wme_hipri_switch_thresh;/* aggressive mode switch thresh */
u_int   wme_hipri_switch_hysteresis;/* aggressive mode switch 
hysteresis */
 
-   struct wmeParams wme_params[4]; /* from assoc resp for each AC*/
+   struct wmeParams wme_params[WME_NUM_AC]; /* from assoc resp for each AC 
*/
struct chanAccParams wme_wmeChanParams; /* WME params applied to self */
struct chanAccParams wme_wmeBssChanParams;/* WME params bcast to 
stations */
struct chanAccParams wme_chanParams;/* params applied to self */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364326 - head/sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 20:16:33 2020
New Revision: 364326
URL: https://svnweb.freebsd.org/changeset/base/364326

Log:
  net80211: VHT correct NSS Set loop boundary
  
  For the  tuple, NSS is 1..8 (or in our loop case 0..7
  but not 0..6). Correct the boundry to check for < 8 and not < 7.
  
  MFC after:2 weeks
  Reviewed by:  adrian
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26087

Modified:
  head/sys/net80211/ieee80211_vht.c

Modified: head/sys/net80211/ieee80211_vht.c
==
--- head/sys/net80211/ieee80211_vht.c   Mon Aug 17 20:11:43 2020
(r364325)
+++ head/sys/net80211/ieee80211_vht.c   Mon Aug 17 20:16:33 2020
(r364326)
@@ -218,7 +218,7 @@ ieee80211_vht_announce(struct ieee80211com *ic)
IEEE80211_VHTCAP_BITS);
 
/* For now, just 5GHz VHT.  Worry about 2GHz VHT later */
-   for (i = 0; i < 7; i++) {
+   for (i = 0; i < 8; i++) {
/* Each stream is 2 bits */
tx = (ic->ic_vht_mcsinfo.tx_mcs_map >> (2*i)) & 0x3;
rx = (ic->ic_vht_mcsinfo.rx_mcs_map >> (2*i)) & 0x3;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364324 - head/sys/dev/mmc/host

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 20:07:14 2020
New Revision: 364324
URL: https://svnweb.freebsd.org/changeset/base/364324

Log:
  dwmmc: remove printf even under bootverbose
  
  Remove two debugging printfs, even if hidden under boot -v.
  They seemed to be of debug nature and always spit onto the
  console when running camcontrol devlist -v.
  
  Reviewed by:  manu
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D25962

Modified:
  head/sys/dev/mmc/host/dwmmc.c

Modified: head/sys/dev/mmc/host/dwmmc.c
==
--- head/sys/dev/mmc/host/dwmmc.c   Mon Aug 17 19:17:54 2020
(r364323)
+++ head/sys/dev/mmc/host/dwmmc.c   Mon Aug 17 20:07:14 2020
(r364324)
@@ -1461,9 +1461,6 @@ dwmmc_cam_action(struct cam_sim *sim, union ccb *ccb)
{
struct ccb_trans_settings *cts = >cts;
 
-   if (bootverbose)
-   device_printf(sc->dev, "Got XPT_GET_TRAN_SETTINGS\n");
-
cts->protocol = PROTO_MMCSD;
cts->protocol_version = 1;
cts->transport = XPORT_MMCSD;
@@ -1481,8 +1478,7 @@ dwmmc_cam_action(struct cam_sim *sim, union ccb *ccb)
}
case XPT_SET_TRAN_SETTINGS:
{
-   if (bootverbose)
-   device_printf(sc->dev, "Got XPT_SET_TRAN_SETTINGS\n");
+
dwmmc_cam_settran_settings(sc, ccb);
ccb->ccb_h.status = CAM_REQ_CMP;
break;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364315 - head/sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 16:51:21 2020
New Revision: 364315
URL: https://svnweb.freebsd.org/changeset/base/364315

Log:
  net80211: return 80P80 before 160
  
  In ieee80211_vht_get_chwidth_ie() we need to return 80P80 (3) before
  VHT160 (2) as otherwise we'll never use 80P80.  Fix the order.
  
  MFC after:2 weeks
  X-MFC with:   r364303 (which missed this)
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/net80211/ieee80211_vht.c

Modified: head/sys/net80211/ieee80211_vht.c
==
--- head/sys/net80211/ieee80211_vht.c   Mon Aug 17 16:37:46 2020
(r364314)
+++ head/sys/net80211/ieee80211_vht.c   Mon Aug 17 16:51:21 2020
(r364315)
@@ -693,10 +693,10 @@ ieee80211_vht_get_chwidth_ie(struct ieee80211_channel 
 * well?
 */
 
-   if (IEEE80211_IS_CHAN_VHT160(c))
-   return IEEE80211_VHT_CHANWIDTH_160MHZ;
if (IEEE80211_IS_CHAN_VHT80P80(c))
return IEEE80211_VHT_CHANWIDTH_80P80MHZ;
+   if (IEEE80211_IS_CHAN_VHT160(c))
+   return IEEE80211_VHT_CHANWIDTH_160MHZ;
if (IEEE80211_IS_CHAN_VHT80(c))
return IEEE80211_VHT_CHANWIDTH_80MHZ;
if (IEEE80211_IS_CHAN_VHT40(c))
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r364312 - head/sys/net80211

2020-08-17 Thread Bjoern A. Zeeb

On 17 Aug 2020, at 16:42, Oliver Pinter wrote:


On Monday, August 17, 2020, Bjoern A. Zeeb  wrote:


Author: bz
Date: Mon Aug 17 16:28:59 2020
New Revision: 364312
URL: https://svnweb.freebsd.org/changeset/base/364312

Log:
  net80211: remove vertical whitespace

  No functional changes.

  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_vht.c

Modified: head/sys/net80211/ieee80211_ioctl.c

==
--- head/sys/net80211/ieee80211_ioctl.c Mon Aug 17 16:27:02 2020
(r364311)
+++ head/sys/net80211/ieee80211_ioctl.c Mon Aug 17 16:28:59 2020
(r364312)
@@ -1159,12 +1159,9 @@ ieee80211_ioctl_get80211(struct ieee80211vap 
*vap,

u_l
if (vap->iv_flags_ext & IEEE80211_FEXT_UAPSD)
ireq->i_val = 1;
break;
-
-   /* VHT */


Removed comment.


case IEEE80211_IOC_VHTCONF:
ireq->i_val = vap->iv_flags_vht & 
IEEE80211_FVHT_MASK;

break;
-
default:
error = ieee80211_ioctl_getdefault(vap, ireq);
break;



Yes. We don’t do comments on any of the other cases and this one did 
not say much anyway.


/bz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364312 - head/sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 16:28:59 2020
New Revision: 364312
URL: https://svnweb.freebsd.org/changeset/base/364312

Log:
  net80211: remove vertical whitespace
  
  No functional changes.
  
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_vht.c

Modified: head/sys/net80211/ieee80211.c
==
--- head/sys/net80211/ieee80211.c   Mon Aug 17 16:27:02 2020
(r364311)
+++ head/sys/net80211/ieee80211.c   Mon Aug 17 16:28:59 2020
(r364312)
@@ -529,8 +529,7 @@ ieee80211_vap_setup(struct ieee80211com *ic, struct ie
 
ifp = if_alloc(IFT_ETHER);
if (ifp == NULL) {
-   ic_printf(ic, "%s: unable to allocate ifnet\n",
-   __func__);
+   ic_printf(ic, "%s: unable to allocate ifnet\n", __func__);
return ENOMEM;
}
if_initname(ifp, name, unit);
@@ -1210,9 +1209,7 @@ set_vht_extchan(struct ieee80211_channel *c)
}
 
printf("%s: unknown VHT channel type (ieee=%d, flags=0x%08x)\n",
-   __func__,
-   c->ic_ieee,
-   c->ic_flags);
+   __func__, c->ic_ieee, c->ic_flags);
 
return (0);
 }
@@ -1247,11 +1244,7 @@ addchan(struct ieee80211_channel chans[], int maxchans
 
 #if 0
printf("%s: %d: ieee=%d, freq=%d, flags=0x%08x\n",
-   __func__,
-   *nchans,
-   ieee,
-   freq,
-   flags);
+   __func__, *nchans, ieee, freq, flags);
 #endif
 
c = [(*nchans)++];
@@ -1281,9 +1274,7 @@ copychan_prev(struct ieee80211_channel chans[], int ma
 
 #if 0
printf("%s: %d: flags=0x%08x\n",
-   __func__,
-   *nchans,
-   flags);
+   __func__, *nchans, flags);
 #endif
 
c = [(*nchans)++];
@@ -1779,11 +1770,7 @@ ieee80211_lookup_channel_rxstatus(struct ieee80211vap 
 
IEEE80211_DPRINTF(vap, IEEE80211_MSG_INPUT,
"%s: freq=%d, ieee=%d, flags=0x%08x; c=%p\n",
-   __func__,
-   (int) rxs->c_freq,
-   (int) rxs->c_ieee,
-   flags,
-   c);
+   __func__, (int) rxs->c_freq, (int) rxs->c_ieee, flags, c);
 
return (c);
 }

Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Mon Aug 17 16:27:02 2020
(r364311)
+++ head/sys/net80211/ieee80211_ioctl.c Mon Aug 17 16:28:59 2020
(r364312)
@@ -1159,12 +1159,9 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l
if (vap->iv_flags_ext & IEEE80211_FEXT_UAPSD)
ireq->i_val = 1;
break;
-
-   /* VHT */
case IEEE80211_IOC_VHTCONF:
ireq->i_val = vap->iv_flags_vht & IEEE80211_FVHT_MASK;
break;
-
default:
error = ieee80211_ioctl_getdefault(vap, ireq);
break;

Modified: head/sys/net80211/ieee80211_vht.c
==
--- head/sys/net80211/ieee80211_vht.c   Mon Aug 17 16:27:02 2020
(r364311)
+++ head/sys/net80211/ieee80211_vht.c   Mon Aug 17 16:28:59 2020
(r364312)
@@ -93,9 +93,7 @@ vht_recv_action_placeholder(struct ieee80211_node *ni,
 
 #ifdef IEEE80211_DEBUG
ieee80211_note(ni->ni_vap, "%s: called; fc=0x%.2x/0x%.2x",
-   __func__,
-   wh->i_fc[0],
-   wh->i_fc[1]);
+   __func__, wh->i_fc[0], wh->i_fc[1]);
 #endif
return (0);
 }
@@ -107,9 +105,7 @@ vht_send_action_placeholder(struct ieee80211_node *ni,
 
 #ifdef IEEE80211_DEBUG
ieee80211_note(ni->ni_vap, "%s: called; category=%d, action=%d",
-   __func__,
-   category,
-   action);
+   __func__, category, action);
 #endif
return (EINVAL);
 }
@@ -229,9 +225,7 @@ ieee80211_vht_announce(struct ieee80211com *ic)
if (tx == 3 && rx == 3)
continue;
ic_printf(ic, "[VHT] NSS %d: TX MCS 0..%d, RX MCS 0..%d\n",
-   i + 1,
-   vht_mcs_to_num(tx),
-   vht_mcs_to_num(rx));
+   i + 1, vht_mcs_to_num(tx), vht_mcs_to_num(rx));
}
 }
 
@@ -269,10 +263,7 @@ ieee80211_parse_vhtopmode(struct ieee80211_node *ni, c
 
 #if 0
printf("%s: chan1=%d, chan2=%d, chanwidth=%d, basicmcs=0x%04x\n",
-   __func__,
-   ni->ni_vht_chan1,
-   ni->ni_vht_chan2,
-   ni->ni_vht_chanwidth,
+   __func__, ni->ni_vht_chan1, ni->ni_vht_chan2, ni->ni_vht_chanwidth,
ni->ni_vht_basicmcs);
 #endif
 }
@@ -702,27 +693,20 @@ ieee80211_vht_get_chwidth_ie(struct ieee80211_channel 
 * well?
 */
 
-   if 

svn commit: r364305 - head/sys/net

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 13:51:25 2020
New Revision: 364305
URL: https://svnweb.freebsd.org/changeset/base/364305

Log:
  For consistency and to avoid any problems getting past the 31bit
  boundry change the last two IF_Mbps(2500) and additionally one
  IF_Mbps(5000) to ULL as well.
  
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/net/if_media.h

Modified: head/sys/net/if_media.h
==
--- head/sys/net/if_media.h Mon Aug 17 13:08:04 2020(r364304)
+++ head/sys/net/if_media.h Mon Aug 17 13:51:25 2020(r364305)
@@ -807,9 +807,9 @@ struct ifmedia_baudrate {
{ IFM_ETHER | IFM_10G_KR,   IF_Gbps(10ULL) },   \
{ IFM_ETHER | IFM_10G_CR1,  IF_Gbps(10ULL) },   \
{ IFM_ETHER | IFM_20G_KR2,  IF_Gbps(20ULL) },   \
-   { IFM_ETHER | IFM_2500_KX,  IF_Mbps(2500) },\
-   { IFM_ETHER | IFM_2500_T,   IF_Mbps(2500) },\
-   { IFM_ETHER | IFM_5000_T,   IF_Mbps(5000) },\
+   { IFM_ETHER | IFM_2500_KX,  IF_Mbps(2500ULL) }, \
+   { IFM_ETHER | IFM_2500_T,   IF_Mbps(2500ULL) }, \
+   { IFM_ETHER | IFM_5000_T,   IF_Mbps(5000ULL) }, \
{ IFM_ETHER | IFM_50G_PCIE, IF_Gbps(50ULL) },   \
{ IFM_ETHER | IFM_25G_PCIE, IF_Gbps(25ULL) },   \
{ IFM_ETHER | IFM_1000_SGMII,   IF_Mbps(1000) },\
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364303 - in head: sbin/ifconfig sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 13:04:18 2020
New Revision: 364303
URL: https://svnweb.freebsd.org/changeset/base/364303

Log:
  80211: consistently order 160 and 80+80
  
  For flags and checks the order goes VHT160 and then VHT80P80 unless
  checks are in reverse order ("more comes first") in which case we
  deal with VHT80P80 first.
  The one reverse order to pick out is where we check channel
  prefernences.  While it may seem that VHT160 is better, finding
  two "free" channels (VHT 80+80) is more likely so we do prefer that.
  
  While dealing with VHT160 and VHT80P80 add extra clauses previously
  missing or marked TODO in a few places.
  
  Reviewed by:  adrian, gnn
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26002

Modified:
  head/sbin/ifconfig/ifieee80211.c
  head/sys/net80211/_ieee80211.h
  head/sys/net80211/ieee80211.c
  head/sys/net80211/ieee80211_vht.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cMon Aug 17 13:02:01 2020
(r364302)
+++ head/sbin/ifconfig/ifieee80211.cMon Aug 17 13:04:18 2020
(r364303)
@@ -2176,8 +2176,6 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci,
 
/*
 * VHT first - HT is a subset.
-*
-* XXX TODO: VHT80P80, VHT160 is not yet done.
 */
if (flags & IEEE80211_CHAN_VHT) {
if ((chanFlags & IEEE80211_CHAN_VHT20) &&
@@ -2201,7 +2199,20 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci,
"VHT80 channel\n", freq);
continue;
}
-
+   if ((chanFlags & IEEE80211_CHAN_VHT160) &&
+   (flags & IEEE80211_CHAN_VHT160) == 0) {
+   if (verbose)
+   printf("%u: skip, not a "
+   "VHT160 channel\n", freq);
+   continue;
+   }
+   if ((chanFlags & IEEE80211_CHAN_VHT80P80) &&
+   (flags & IEEE80211_CHAN_VHT80P80) == 0) {
+   if (verbose)
+   printf("%u: skip, not a "
+   "VHT80+80 channel\n", freq);
+   continue;
+   }
flags &= ~IEEE80211_CHAN_VHT;
flags |= chanFlags & IEEE80211_CHAN_VHT;
}
@@ -3958,8 +3969,11 @@ get_chaninfo(const struct ieee80211_channel *c, int pr
if (IEEE80211_IS_CHAN_TURBO(c))
strlcat(buf, " Turbo", bsize);
if (precise) {
-   /* XXX should make VHT80U, VHT80D */
-   if (IEEE80211_IS_CHAN_VHT80(c) &&
+   if (IEEE80211_IS_CHAN_VHT80P80(c))
+   strlcat(buf, " vht/80p80", bsize);
+   else if (IEEE80211_IS_CHAN_VHT160(c))
+   strlcat(buf, " vht/160", bsize);
+   else if (IEEE80211_IS_CHAN_VHT80(c) &&
IEEE80211_IS_CHAN_HT40D(c))
strlcat(buf, " vht/80-", bsize);
else if (IEEE80211_IS_CHAN_VHT80(c) &&
@@ -4013,10 +4027,11 @@ print_chaninfo(const struct ieee80211_channel *c, int 
 static int
 chanpref(const struct ieee80211_channel *c)
 {
+
+   if (IEEE80211_IS_CHAN_VHT80P80(c))
+   return 90;
if (IEEE80211_IS_CHAN_VHT160(c))
return 80;
-   if (IEEE80211_IS_CHAN_VHT80P80(c))
-   return 75;
if (IEEE80211_IS_CHAN_VHT80(c))
return 70;
if (IEEE80211_IS_CHAN_VHT40(c))

Modified: head/sys/net80211/_ieee80211.h
==
--- head/sys/net80211/_ieee80211.h  Mon Aug 17 13:02:01 2020
(r364302)
+++ head/sys/net80211/_ieee80211.h  Mon Aug 17 13:04:18 2020
(r364303)
@@ -157,7 +157,7 @@ struct ieee80211_channel {
 /*
  * Note: for VHT operation we will need significantly more than
  * IEEE80211_CHAN_MAX channels because of the combinations of
- * VHT20, VHT40, VHT80, VHT80+80 and VHT160.
+ * VHT20, VHT40, VHT80, VHT160, and VHT80+80.
  */
 #defineIEEE80211_CHAN_MAX  1024
 #defineIEEE80211_CHAN_BYTEShowmany(IEEE80211_CHAN_MAX, NBBY)
@@ -194,8 +194,8 @@ struct ieee80211_channel {
 #defineIEEE80211_CHAN_VHT40U   0x0200 /* VHT40 channel, ext above 
*/
 #define

svn commit: r364301 - in head: lib/lib80211 sbin/ifconfig sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 12:52:57 2020
New Revision: 364301
URL: https://svnweb.freebsd.org/changeset/base/364301

Log:
  80211: consistently spell 80P80
  
  The standard uses 80+80 and 80p80 but nowhere 80_80.
  Switch the latter to 80P80 for all the macros and comments refering
  to #defined flags which I could find.
  The only place we leave as 80p80 is the ifconfig command line arguments
  as we spell them all in lower case.
  Ideally we would use 80+80 for any interactions with the user and
  80P80 for anything internal but let us not confuse parsers and
  hence avoid the '+' in either case.
  
  Reviewed by:  adrian, gnn
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26001

Modified:
  head/lib/lib80211/lib80211_regdomain.c
  head/sbin/ifconfig/ifieee80211.c
  head/sys/net80211/_ieee80211.h
  head/sys/net80211/ieee80211_ht.c
  head/sys/net80211/ieee80211_var.h
  head/sys/net80211/ieee80211_vht.c

Modified: head/lib/lib80211/lib80211_regdomain.c
==
--- head/lib/lib80211/lib80211_regdomain.c  Mon Aug 17 12:47:08 2020
(r364300)
+++ head/lib/lib80211/lib80211_regdomain.c  Mon Aug 17 12:52:57 2020
(r364301)
@@ -192,7 +192,7 @@ decode_flag(struct mystate *mt, const char *p, int len
FLAG(IEEE80211_CHAN_VHT40),
FLAG(IEEE80211_CHAN_VHT80),
/*
-* XXX VHT80_80? This likely should be done by
+* XXX VHT80P80? This likely should be done by
 * 80MHz chan logic in net80211 / ifconfig.
 */
FLAG(IEEE80211_CHAN_VHT160),

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cMon Aug 17 12:47:08 2020
(r364300)
+++ head/sbin/ifconfig/ifieee80211.cMon Aug 17 12:52:57 2020
(r364301)
@@ -2177,7 +2177,7 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci,
/*
 * VHT first - HT is a subset.
 *
-* XXX TODO: VHT80p80, VHT160 is not yet done.
+* XXX TODO: VHT80P80, VHT160 is not yet done.
 */
if (flags & IEEE80211_CHAN_VHT) {
if ((chanFlags & IEEE80211_CHAN_VHT20) &&
@@ -2387,7 +2387,7 @@ regdomain_makechannels(
>dc_chaninfo);
}
 
-   /* XXX TODO: VHT80_80, VHT160 */
+   /* XXX TODO: VHT80P80, VHT160 */
}
 
if (!LIST_EMPTY(>bands_11ng) && dc->dc_htcaps != 0) {
@@ -4015,7 +4015,7 @@ chanpref(const struct ieee80211_channel *c)
 {
if (IEEE80211_IS_CHAN_VHT160(c))
return 80;
-   if (IEEE80211_IS_CHAN_VHT80_80(c))
+   if (IEEE80211_IS_CHAN_VHT80P80(c))
return 75;
if (IEEE80211_IS_CHAN_VHT80(c))
return 70;

Modified: head/sys/net80211/_ieee80211.h
==
--- head/sys/net80211/_ieee80211.h  Mon Aug 17 12:47:08 2020
(r364300)
+++ head/sys/net80211/_ieee80211.h  Mon Aug 17 12:52:57 2020
(r364301)
@@ -194,7 +194,7 @@ struct ieee80211_channel {
 #defineIEEE80211_CHAN_VHT40U   0x0200 /* VHT40 channel, ext above 
*/
 #defineIEEE80211_CHAN_VHT40D   0x0400 /* VHT40 channel, ext below 
*/
 #defineIEEE80211_CHAN_VHT800x0800 /* VHT80 channel */
-#defineIEEE80211_CHAN_VHT80_80 0x1000 /* VHT80+80 channel */
+#defineIEEE80211_CHAN_VHT80P80 0x1000 /* VHT80+80 channel */
 #defineIEEE80211_CHAN_VHT160   0x2000 /* VHT160 channel */
 /* XXX note: 0x8000 is used in src/sbin/ifconfig/ifieee80211.c :( */
 
@@ -203,14 +203,14 @@ struct ieee80211_channel {
 
 #defineIEEE80211_CHAN_VHT40(IEEE80211_CHAN_VHT40U | 
IEEE80211_CHAN_VHT40D)
 #defineIEEE80211_CHAN_VHT  (IEEE80211_CHAN_VHT20 | 
IEEE80211_CHAN_VHT40 \
-   | IEEE80211_CHAN_VHT80 | 
IEEE80211_CHAN_VHT80_80 \
+   | IEEE80211_CHAN_VHT80 | 
IEEE80211_CHAN_VHT80P80 \
| IEEE80211_CHAN_VHT160)
 
 #defineIEEE80211_CHAN_BITS \
"\20\1PRIV0\2PRIV2\3PRIV3\4PRIV4\5TURBO\6CCK\7OFDM\0102GHZ\0115GHZ" \
"\12PASSIVE\13DYN\14GFSK\15GSM\16STURBO\17HALF\20QUARTER\21HT20" \
"\22HT40U\23HT40D\24DFS\0254MSXMIT\26NOADHOC\27NOHOSTAP\03011D" \
-   "\031VHT20\032VHT40U\033VHT40D\034VHT80\035VHT80_80\036VHT160"
+   "\031VHT20\032VHT40U\033VHT40D\034VHT80\035VHT80P80\036VHT160"
 
 /*
  * Useful combinations of channel characteristics.
@@ -337,8 +337,8 @@ struct 

svn commit: r364299 - in head: sbin/ifconfig sys/net80211

2020-08-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 17 12:43:07 2020
New Revision: 364299
URL: https://svnweb.freebsd.org/changeset/base/364299

Log:
  net80211 / ifconfig: cleanup the use of IEEE80211_FVHT_USEVHT*
  
  Rather then using magic numbers duplicate IEEE80211_FVHT_VHT* in
  ifconfig (cleanup of these and other flags used and not exposed by
  net80211 should happen later) and use those.
  In the kernel this simplifies one ioctl path (the other one currently
  relies on individual bit flags being passed in).
  We also re-order the 80P80 and 160 flag for 160 to come before 80+80
  and more clearly leave the flags as TODO in one of the 160/80+80 cases.
  
  Reviewed by:  adrian
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Differential Revision:https://reviews.freebsd.org/D26000

Modified:
  head/sbin/ifconfig/ifieee80211.c
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_var.h
  head/sys/net80211/ieee80211_vht.c

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cMon Aug 17 12:38:35 2020
(r364298)
+++ head/sbin/ifconfig/ifieee80211.cMon Aug 17 12:43:07 2020
(r364299)
@@ -129,6 +129,15 @@
 #defineIEEE80211_NODE_UAPSD0x40/* UAPSD enabled */
 #endif
 
+/* XXX should also figure out where to put these for k/u-space sharing. */
+#ifndef IEEE80211_FVHT_VHT
+#defineIEEE80211_FVHT_VHT  0x1 /* CONF: VHT supported 
*/
+#defineIEEE80211_FVHT_USEVHT40 0x2 /* CONF: Use VHT40 */
+#defineIEEE80211_FVHT_USEVHT80 0x4 /* CONF: Use VHT80 */
+#defineIEEE80211_FVHT_USEVHT160 0x8/* CONF: Use VHT160 */
+#defineIEEE80211_FVHT_USEVHT80P80 0x00010  /* CONF: Use VHT 80+80 
*/
+#endif
+
 #defineMAXCHAN 1536/* max 1.5K channels */
 
 #defineMAXCOL  78
@@ -5331,26 +5340,26 @@ end:
 
if (IEEE80211_IS_CHAN_VHT(c) || verbose) {
getvhtconf(s);
-   if (vhtconf & 0x1)
+   if (vhtconf & IEEE80211_FVHT_VHT)
LINE_CHECK("vht");
else
LINE_CHECK("-vht");
-   if (vhtconf & 0x2)
+   if (vhtconf & IEEE80211_FVHT_USEVHT40)
LINE_CHECK("vht40");
else
LINE_CHECK("-vht40");
-   if (vhtconf & 0x4)
+   if (vhtconf & IEEE80211_FVHT_USEVHT80)
LINE_CHECK("vht80");
else
LINE_CHECK("-vht80");
-   if (vhtconf & 0x8)
-   LINE_CHECK("vht80p80");
-   else
-   LINE_CHECK("-vht80p80");
-   if (vhtconf & 0x10)
+   if (vhtconf & IEEE80211_FVHT_USEVHT160)
LINE_CHECK("vht160");
else
LINE_CHECK("-vht160");
+   if (vhtconf & IEEE80211_FVHT_USEVHT80P80)
+   LINE_CHECK("vht80p80");
+   else
+   LINE_CHECK("-vht80p80");
}
 
if (get80211val(s, IEEE80211_IOC_WME, ) != -1) {
@@ -5951,16 +5960,16 @@ static struct cmd ieee80211_cmds[] = {
DEF_CMD("-ht40",0,  set80211htconf),
DEF_CMD("ht",   3,  set80211htconf),/* NB: 20+40 */
DEF_CMD("-ht",  0,  set80211htconf),
-   DEF_CMD("vht",  1,  set80211vhtconf),
-   DEF_CMD("-vht", 0,  set80211vhtconf),
-   DEF_CMD("vht40",2,  set80211vhtconf),
-   DEF_CMD("-vht40",   -2, set80211vhtconf),
-   DEF_CMD("vht80",4,  set80211vhtconf),
-   DEF_CMD("-vht80",   -4, set80211vhtconf),
-   DEF_CMD("vht80p80", 8,  set80211vhtconf),
-   DEF_CMD("-vht80p80",-8, set80211vhtconf),
-   DEF_CMD("vht160",   16, set80211vhtconf),
-   DEF_CMD("-vht160",  -16,set80211vhtconf),
+   DEF_CMD("vht",  IEEE80211_FVHT_VHT, 
set80211vhtconf),
+   DEF_CMD("-vht", 0,  
set80211vhtconf),
+   DEF_CMD("vht40",IEEE80211_FVHT_USEVHT40,
set80211vhtconf),
+   DEF_CMD("-vht40",   -IEEE80211_FVHT_USEVHT40,   
set80211vhtconf),
+   DEF_CMD("vht80",IEEE80211_FVHT_USEVHT80,
set80211vhtconf),
+   DEF_CMD("-vht80",   -IEEE80211_FVHT_USEVHT80,   
set80211vhtconf),
+   DEF_CMD("vht160",   IEEE80211_FVHT_USEVHT160,   
set80211vhtconf),
+   DEF_CMD("-vht160",  -IEEE80211_FVHT_USEVHT160,  
set80211vhtconf),
+   DEF_CMD("vht80p80", IEEE80211_FVHT_USEVHT80P80, 
set80211vhtconf),
+   DEF_CMD("-vht80p80",

svn commit: r364075 - in head/sys: netinet netinet6

2020-08-10 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Aug 10 10:58:43 2020
New Revision: 364075
URL: https://svnweb.freebsd.org/changeset/base/364075

Log:
  MC: add a note with reference to the discussion and history as-to why we
  are where we are now.  The main thing is to try to get rid of the delayed
  freeing to avoid blocking on the taskq when shutting down vnets.
  
  X-Timeout:if you still see this before 14-RELEASE remove it.

Modified:
  head/sys/netinet/in_mcast.c
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet/in_mcast.c
==
--- head/sys/netinet/in_mcast.c Mon Aug 10 10:52:54 2020(r364074)
+++ head/sys/netinet/in_mcast.c Mon Aug 10 10:58:43 2020(r364075)
@@ -251,6 +251,7 @@ inm_release_wait(void *arg __unused)
taskqueue_drain(taskqueue_inm_free, _free_task);
 }
 #ifdef VIMAGE
+/* XXX-BZ FIXME, see D24914. */
 VNET_SYSUNINIT(inm_release_wait, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, 
inm_release_wait, NULL);
 #endif
 

Modified: head/sys/netinet6/in6_mcast.c
==
--- head/sys/netinet6/in6_mcast.c   Mon Aug 10 10:52:54 2020
(r364074)
+++ head/sys/netinet6/in6_mcast.c   Mon Aug 10 10:58:43 2020
(r364075)
@@ -549,6 +549,7 @@ in6m_release_wait(void *arg __unused)
taskqueue_drain_all(taskqueue_in6m_free);
 }
 #ifdef VIMAGE
+/* XXX-BZ FIXME, see D24914. */
 VNET_SYSUNINIT(in6m_release_wait, SI_SUB_PROTO_DOMAIN, SI_ORDER_FIRST, 
in6m_release_wait, NULL);
 #endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364043 - head/sys/cam/mmc

2020-08-07 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Aug  7 19:58:16 2020
New Revision: 364043
URL: https://svnweb.freebsd.org/changeset/base/364043

Log:
  mmc_da: fix memory leak in sddaregister()
  
  In case we are failing to allocate mmcdata, we are returning with
  a softc allocated but not attached to anything and thus leak the
  memory.
  
  Reviewed by:  scottl
  MFC after:2 weeks
  X-MFC:only if we also mfc other mmccam changes?
  Differential Revision:https://reviews.freebsd.org/D25987

Modified:
  head/sys/cam/mmc/mmc_da.c

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Fri Aug  7 19:36:08 2020(r364042)
+++ head/sys/cam/mmc/mmc_da.c   Fri Aug  7 19:58:16 2020(r364043)
@@ -789,7 +789,6 @@ sddaregister(struct cam_periph *periph, void *arg)
 
softc = (struct sdda_softc *)malloc(sizeof(*softc), M_DEVBUF,
M_NOWAIT|M_ZERO);
-
if (softc == NULL) {
printf("sddaregister: Unable to probe new device. "
"Unable to allocate softc\n");
@@ -802,6 +801,7 @@ sddaregister(struct cam_periph *periph, void *arg)
if (softc->mmcdata == NULL) {
printf("sddaregister: Unable to probe new device. "
"Unable to allocate mmcdata\n");
+   free(softc, M_DEVBUF);
return (CAM_REQ_CMP_ERR);
}
periph->softc = softc;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364018 - in head/sys: netinet netinet6 sys

2020-08-07 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Aug  7 15:13:53 2020
New Revision: 364018
URL: https://svnweb.freebsd.org/changeset/base/364018

Log:
  IPV6_PKTINFO support for v4-mapped IPv6 sockets
  
  When using v4-mapped IPv6 sockets with IPV6_PKTINFO we do not
  respect the given v4-mapped src address on the IPv4 socket.
  Implement the needed functionality. This allows single-socket
  UDP applications (such as OpenVPN) to work better on FreeBSD.
  
  Requested by: Gert Doering (gert greenie.net), pfsense
  Tested by:Gert Doering (gert greenie.net)
  Reviewed by:  melifaro
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D24135

Modified:
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/udp6_usrreq.c
  head/sys/sys/protosw.h

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Fri Aug  7 15:11:27 2020
(r364017)
+++ head/sys/netinet/udp_usrreq.c   Fri Aug  7 15:13:53 2020
(r364018)
@@ -163,7 +163,7 @@ VNET_PCPUSTAT_SYSUNINIT(udpstat);
 #ifdef INET
 static voidudp_detach(struct socket *so);
 static int udp_output(struct inpcb *, struct mbuf *, struct sockaddr *,
-   struct mbuf *, struct thread *);
+   struct mbuf *, struct thread *, int);
 #endif
 
 static void
@@ -1083,9 +1083,65 @@ udp_ctloutput(struct socket *so, struct sockopt *sopt)
 }
 
 #ifdef INET
+#ifdef INET6
+/* The logic here is derived from ip6_setpktopt(). See comments there. */
 static int
+udp_v4mapped_pktinfo(struct cmsghdr *cm, struct sockaddr_in * src,
+struct inpcb *inp, int flags)
+{
+   struct ifnet *ifp;
+   struct in6_pktinfo *pktinfo;
+   struct in_addr ia;
+
+   if ((flags & PRUS_IPV6) == 0)
+   return (0);
+
+   if (cm->cmsg_level != IPPROTO_IPV6)
+   return (0);
+
+   if  (cm->cmsg_type != IPV6_2292PKTINFO &&
+   cm->cmsg_type != IPV6_PKTINFO)
+   return (0);
+
+   if (cm->cmsg_len !=
+   CMSG_LEN(sizeof(struct in6_pktinfo)))
+   return (EINVAL);
+
+   pktinfo = (struct in6_pktinfo *)CMSG_DATA(cm);
+   if (!IN6_IS_ADDR_V4MAPPED(>ipi6_addr) &&
+   !IN6_IS_ADDR_UNSPECIFIED(>ipi6_addr))
+   return (EINVAL);
+
+   /* Validate the interface index if specified. */
+   if (pktinfo->ipi6_ifindex > V_if_index)
+   return (ENXIO);
+
+   ifp = NULL;
+   if (pktinfo->ipi6_ifindex) {
+   ifp = ifnet_byindex(pktinfo->ipi6_ifindex);
+   if (ifp == NULL)
+   return (ENXIO);
+   }
+   if (ifp != NULL && !IN6_IS_ADDR_UNSPECIFIED(>ipi6_addr)) {
+
+   ia.s_addr = pktinfo->ipi6_addr.s6_addr32[3];
+   if (in_ifhasaddr(ifp, ia) == 0)
+   return (EADDRNOTAVAIL);
+   }
+
+   bzero(src, sizeof(*src));
+   src->sin_family = AF_INET;
+   src->sin_len = sizeof(*src);
+   src->sin_port = inp->inp_lport;
+   src->sin_addr.s_addr = pktinfo->ipi6_addr.s6_addr32[3];
+
+   return (0);
+}
+#endif
+
+static int
 udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
-struct mbuf *control, struct thread *td)
+struct mbuf *control, struct thread *td, int flags)
 {
struct udpiphdr *ui;
int len = m->m_pkthdr.len;
@@ -1149,6 +1205,11 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s
error = EINVAL;
break;
}
+#ifdef INET6
+   error = udp_v4mapped_pktinfo(cm, , inp, flags);
+   if (error != 0)
+   break;
+#endif
if (cm->cmsg_level != IPPROTO_IP)
continue;
 
@@ -1696,7 +1757,7 @@ udp_send(struct socket *so, int flags, struct mbuf *m,
 
inp = sotoinpcb(so);
KASSERT(inp != NULL, ("udp_send: inp == NULL"));
-   return (udp_output(inp, m, addr, control, td));
+   return (udp_output(inp, m, addr, control, td, flags));
 }
 #endif /* INET */
 

Modified: head/sys/netinet6/udp6_usrreq.c
==
--- head/sys/netinet6/udp6_usrreq.c Fri Aug  7 15:11:27 2020
(r364017)
+++ head/sys/netinet6/udp6_usrreq.c Fri Aug  7 15:13:53 2020
(r364018)
@@ -784,7 +784,7 @@ udp6_output(struct socket *so, int flags_arg, struct m
in6_sin6_2_sin_in_sock((struct sockaddr *)sin6);
pru = inetsw[ip_protox[nxt]].pr_usrreqs;
/* addr will just be freed in sendit(). */
-   return ((*pru->pru_send)(so, flags_arg, m,
+   return ((*pru->pru_send)(so, flags_arg | PRUS_IPV6, m,
(struct sockaddr *)sin6, control, td));
}
} 

svn commit: r364012 - head/lib/lib80211

2020-08-07 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Aug  7 12:47:00 2020
New Revision: 364012
URL: https://svnweb.freebsd.org/changeset/base/364012

Log:
  lib80211: fix indentation of comments for some netbands.
  
  Whitespace only; no functional changes.
  
  MFC after:2 weeks
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/lib/lib80211/lib80211_regdomain.h

Modified: head/lib/lib80211/lib80211_regdomain.h
==
--- head/lib/lib80211/lib80211_regdomain.h  Fri Aug  7 12:24:23 2020
(r364011)
+++ head/lib/lib80211/lib80211_regdomain.h  Fri Aug  7 12:47:00 2020
(r364012)
@@ -73,10 +73,10 @@ struct regdomain {
netband_head bands_11b; /* 11b operation */
netband_head bands_11g; /* 11g operation */
netband_head bands_11a; /* 11a operation */
-   netband_head bands_11ng;/* 11ng operation */
-   netband_head bands_11na;/* 11na operation */
-   netband_head bands_11ac;/* 11ac 5GHz operation */
-   netband_head bands_11acg;/* 11ac 2GHz operation */
+   netband_head bands_11ng;/* 11ng operation */
+   netband_head bands_11na;/* 11na operation */
+   netband_head bands_11ac;/* 11ac 5GHz operation */
+   netband_head bands_11acg;   /* 11ac 2GHz operation */
 
LIST_ENTRY(regdomain)   next;
 };
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r364011 - in head: sbin/ifconfig share/man/man4 sys/net80211

2020-08-07 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Aug  7 12:24:23 2020
New Revision: 364011
URL: https://svnweb.freebsd.org/changeset/base/364011

Log:
  net80211/ifconfig: print hardware device name for wlan interfaces
  
  Add IEEE80211_IOC_IC_NAME to query the ic_name field and in ifconfig
  to print the parent interface again. This functionality was lost
  around r287197. It helps in case of multiple wlan interfaces and
  multiple underlying hardware devices to keep track which wlan
  interface belongs to which physical device.
  
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
  Reviewed by:  adrian, Idwer Vollering
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D25832

Modified:
  head/sbin/ifconfig/ifieee80211.c
  head/share/man/man4/net80211.4
  head/sys/net80211/ieee80211_ioctl.c
  head/sys/net80211/ieee80211_ioctl.h

Modified: head/sbin/ifconfig/ifieee80211.c
==
--- head/sbin/ifconfig/ifieee80211.cFri Aug  7 12:19:21 2020
(r364010)
+++ head/sbin/ifconfig/ifieee80211.cFri Aug  7 12:24:23 2020
(r364011)
@@ -4779,6 +4779,23 @@ getid(int s, int ix, void *data, size_t len, int *plen
return 0;
 }
 
+static int
+getdevicename(int s, void *data, size_t len, int *plen)
+{
+   struct ieee80211req ireq;
+
+   (void) memset(, 0, sizeof(ireq));
+   (void) strlcpy(ireq.i_name, name, sizeof(ireq.i_name));
+   ireq.i_type = IEEE80211_IOC_IC_NAME;
+   ireq.i_val = -1;
+   ireq.i_data = data;
+   ireq.i_len = len;
+   if (ioctl(s, SIOCG80211, ) < 0)
+   return (-1);
+   *plen = ireq.i_len;
+   return (0);
+}
+
 static void
 ieee80211_status(int s)
 {
@@ -5501,6 +5518,12 @@ end:
LINE_CHECK("hwmpmaxhops %u", val);
}
}
+
+   LINE_BREAK();
+
+   if (getdevicename(s, data, sizeof(data), ) < 0)
+   return;
+   LINE_CHECK("parent interface: %s", data);
 
LINE_BREAK();
 }

Modified: head/share/man/man4/net80211.4
==
--- head/share/man/man4/net80211.4  Fri Aug  7 12:19:21 2020
(r364010)
+++ head/share/man/man4/net80211.4  Fri Aug  7 12:24:23 2020
(r364011)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 10, 2009
+.Dd August 7, 2020
 .Dt NET80211 4
 .Os
 .Sh NAME
@@ -393,6 +393,16 @@ Valid values are:
 and
 .Dv IEEE80211_HWMP_ROOTMODE_RANN
 (send broadcast Root Announcement (RANN) frames).
+.It Dv IEEE80211_IOC_IC_NAME
+Return the underlying hardware
+.Xr device 9
+name in the buffer pointed to by
+.Va i_data
+and the name length including terminating NUL character in
+.Va i_len .
+If the buffer length is too small to hold the full name
+.Er EINVAL
+will be returned.
 .It Dv IEEE80211_IOC_INACTIVITY
 Return whether or not the system handles inactivity processing in
 .Va i_val .

Modified: head/sys/net80211/ieee80211_ioctl.c
==
--- head/sys/net80211/ieee80211_ioctl.c Fri Aug  7 12:19:21 2020
(r364010)
+++ head/sys/net80211/ieee80211_ioctl.c Fri Aug  7 12:24:23 2020
(r364011)
@@ -785,6 +785,13 @@ ieee80211_ioctl_get80211(struct ieee80211vap *vap, u_l
int error = 0;
 
switch (ireq->i_type) {
+   case IEEE80211_IOC_IC_NAME:
+   len = strlen(ic->ic_name) + 1;
+   if (len > ireq->i_len)
+   return (EINVAL);
+   ireq->i_len = len;
+   error = copyout(ic->ic_name, ireq->i_data, ireq->i_len);
+   break;
case IEEE80211_IOC_SSID:
switch (vap->iv_state) {
case IEEE80211_S_INIT:

Modified: head/sys/net80211/ieee80211_ioctl.h
==
--- head/sys/net80211/ieee80211_ioctl.h Fri Aug  7 12:19:21 2020
(r364010)
+++ head/sys/net80211/ieee80211_ioctl.h Fri Aug  7 12:24:23 2020
(r364011)
@@ -743,6 +743,9 @@ struct ieee80211req {
 #defineIEEE80211_IOC_QUIET_OFFSET  207 /* Quiet Offset */
 #defineIEEE80211_IOC_QUIET_DUR 208 /* Quiet Duration */
 #defineIEEE80211_IOC_QUIET_COUNT   209 /* Quiet Count */
+
+#defineIEEE80211_IOC_IC_NAME   210 /* HW device name. */
+
 /*
  * Parameters for controlling a scan requested with
  * IEEE80211_IOC_SCAN_REQ.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r363862 - head/sys/cam/mmc

2020-08-05 Thread Bjoern A. Zeeb

On 4 Aug 2020, at 20:04, Emmanuel Vadot wrote:


Author: manu
Date: Tue Aug  4 20:04:00 2020
New Revision: 363862
URL: https://svnweb.freebsd.org/changeset/base/363862

Log:
  mmccam: Hold the periph during init

  We need to sleep during this routine so acquire the cam hold too.


Turns out that with this my /dev/sddaX.. device nodes are never created.
Reverting this and things work a lot better again.




  Reviewed by:  imp
  Differential Revision:https://reviews.freebsd.org/D25946

Modified:
  head/sys/cam/mmc/mmc_da.c

Modified: head/sys/cam/mmc/mmc_da.c
==
--- head/sys/cam/mmc/mmc_da.c   Tue Aug  4 20:02:23 2020(r363861)
+++ head/sys/cam/mmc/mmc_da.c   Tue Aug  4 20:04:00 2020(r363862)
@@ -1109,7 +1109,9 @@ sdda_start_init_task(void *context, int pending) 
{

  CAM_PRIORITY_NONE);

cam_periph_lock(periph);
+   cam_periph_hold(periph, PRIBIO|PCATCH);
sdda_start_init(context, new_ccb);
+   cam_periph_unhold(periph);
cam_periph_unlock(periph);
xpt_free_ccb(new_ccb);
 }

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r363489 - head/sys/dev/mmc/host

2020-07-24 Thread Bjoern A. Zeeb
On 24 Jul 2020, at 19:52, Emmanuel Vadot wrote:

> Author: manu
> Date: Fri Jul 24 19:52:52 2020
> New Revision: 363489
> URL: https://svnweb.freebsd.org/changeset/base/363489
>
> Log:
>   dwmmc: Add MMCCAM part
>
>   Add support for MMCCAM for dwmmc
>
>   Submitted by:   kibab
>   Tested On:  Rock64, RockPro64

And nanopc-t4.

Thank you both for all the work!!!

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r363061 - in head/usr.sbin/wpa: hostapd wpa_supplicant

2020-07-10 Thread Bjoern A. Zeeb
On 9 Jul 2020, at 23:01, Cy Schubert wrote:

> Author: cy
> Date: Thu Jul  9 23:01:36 2020
> New Revision: 363061
> URL: https://svnweb.freebsd.org/changeset/base/363061
>
> Log:
>   Enable support for IEEE 802.11N, 802.11W, 802.11AC and 802.11.AX to
>   hostapd and wpa_supplicant.

Thank you for also doing wpa_supplicant.


>   Submitted by:   bz
>   MFC after:  2 weeks
>   Relnotes:   yes
>   Sponsored by:   Rubicon Communications, LLC (d/b/a "Netgate")
>
> Modified:
>   head/usr.sbin/wpa/hostapd/Makefile
>   head/usr.sbin/wpa/wpa_supplicant/Makefile
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362815 - head/sys/net80211

2020-07-01 Thread Bjoern A. Zeeb

On 1 Jul 2020, at 0:23, Adrian Chadd wrote:


Author: adrian
Date: Wed Jul  1 00:23:49 2020
New Revision: 362815
URL: https://svnweb.freebsd.org/changeset/base/362815

Log:
  [net80211] Migrate HT/legacy protection mode and preamble 
calculation to per-VAP flags


can you please put these changes into Phabricator with adequate time to 
get the reviewed in the future?



/bz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362472 - head/sys/netinet

2020-06-21 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Jun 21 22:09:30 2020
New Revision: 362472
URL: https://svnweb.freebsd.org/changeset/base/362472

Log:
  Rather than zeroing MAXVIFS times size of pointer [r362289] (still better than
  sizeof pointer before [r354857]), we need to zero MAXVIFS times the size of
  the struct.  All good things come in threes; I hope this is it on this one.
  
  PR:   246629, 206583
  Reported by:  kib
  MFC after:ASAP

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cSun Jun 21 22:02:49 2020
(r362471)
+++ head/sys/netinet/ip_mroute.cSun Jun 21 22:09:30 2020
(r362472)
@@ -740,7 +740,7 @@ X_ip_mrouter_done(void)
if_allmulti(ifp, 0);
}
 }
-bzero((caddr_t)V_viftable, sizeof(V_viftable) * MAXVIFS);
+bzero((caddr_t)V_viftable, sizeof(*V_viftable) * MAXVIFS);
 V_numvifs = 0;
 V_pim_assert_enabled = 0;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362289 - head/sys/netinet

2020-06-17 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Jun 17 21:04:38 2020
New Revision: 362289
URL: https://svnweb.freebsd.org/changeset/base/362289

Log:
  When converting the static arrays to mallocarray() in r356621 I missed
  one place where we now need to multiply the size of the struct with the
  number of entries.  This lead to problems when restarting user space
  daemons, as the cleanup was never properly done, resulting in MRT_ADD_VIF
  EADDRINUSE.
  Properly zero all array elements to avoid this problem.
  
  PR:   246629, 206583
  Reported by:  (many)
  MFC after:4 days
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cWed Jun 17 20:58:37 2020
(r362288)
+++ head/sys/netinet/ip_mroute.cWed Jun 17 21:04:38 2020
(r362289)
@@ -740,7 +740,7 @@ X_ip_mrouter_done(void)
if_allmulti(ifp, 0);
}
 }
-bzero((caddr_t)V_viftable, sizeof(V_viftable));
+bzero((caddr_t)V_viftable, sizeof(V_viftable) * MAXVIFS);
 V_numvifs = 0;
 V_pim_assert_enabled = 0;
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362288 - head/sys/netinet

2020-06-17 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Jun 17 20:58:37 2020
New Revision: 362288
URL: https://svnweb.freebsd.org/changeset/base/362288

Log:
  The call into ifa_ifwithaddr() needs to be epoch protected; ortherwise
  we'll panic on an assertion.
  While here, leave a comment that the ifp was never protected and stable
  (as glebius pointed out) and this needs to be fixed properly.
  
  Discovered while working on:  PR 246629
  Reviewed by:  glebius
  MFC after:4 days
  Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

Modified:
  head/sys/netinet/ip_mroute.c

Modified: head/sys/netinet/ip_mroute.c
==
--- head/sys/netinet/ip_mroute.cWed Jun 17 19:57:59 2020
(r362287)
+++ head/sys/netinet/ip_mroute.cWed Jun 17 20:58:37 2020
(r362288)
@@ -879,13 +879,19 @@ add_vif(struct vifctl *vifcp)
 */
ifp = NULL;
 } else {
+   struct epoch_tracker et;
+
sin.sin_addr = vifcp->vifc_lcl_addr;
+   NET_EPOCH_ENTER(et);
ifa = ifa_ifwithaddr((struct sockaddr *));
if (ifa == NULL) {
+   NET_EPOCH_EXIT(et);
VIF_UNLOCK();
return EADDRNOTAVAIL;
}
ifp = ifa->ifa_ifp;
+   /* XXX FIXME we need to take a ref on ifp and cleanup properly! */
+   NET_EPOCH_EXIT(et);
 }
 
 if ((vifcp->vifc_flags & VIFF_TUNNEL) != 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r361723 - head/sys/compat/linuxkpi/common/include/linux

2020-06-02 Thread Bjoern A. Zeeb

On 2 Jun 2020, at 10:36, Emmanuel Vadot wrote:


 Hello Hans,

On Tue, 2 Jun 2020 10:19:45 + (UTC)
Hans Petter Selasky  wrote:


Author: hselasky
Date: Tue Jun  2 10:19:45 2020
New Revision: 361723
URL: https://svnweb.freebsd.org/changeset/base/361723

Log:
  Implement struct_size() function macro in the LinuxKPI.

  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h	Tue Jun  2 
09:45:43 2020	(r361722)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h	Tue Jun  2 
10:19:45 2020	(r361723)

@@ -555,4 +555,10 @@ linux_ratelimited(linux_ratelimit_t *rl)
return (ppsratecheck(>lasttime, >counter, 1));
 }

+#definestruct_size(ptr, field, num) ({ \
+   const size_t __size = offsetof(__typeof(*(ptr)), field); \
+	const size_t __max = (SIZE_MAX - __size) / sizeof((ptr)->field[0]); 
\
+	((num) > __max) ? SIZE_MAX : (__size + sizeof((ptr)->field[0]) * 
(num)); \

+})
+
 #endif /* _LINUX_KERNEL_H_ */


 Can you bump FreeBSD_version so I can fix
https://github.com/freebsd/drm-kmod/ and update the
graphics/drm-devel-kmod port please ?


I almost wonder if we want a “linuxkkpi version” to check instead.
If there’s a lot more “work” on the linuxkpi we might not want to 
bump __FreeBSD_version for every change which can conflict/affect 
external code?


/bz

___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358992 - head/sys/kern

2020-03-14 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Mar 14 14:04:55 2020
New Revision: 358992
URL: https://svnweb.freebsd.org/changeset/base/358992

Log:
  kern_jail: missing \0 termination check on osrelease parameter
  
  If a user spplies a non-\0 terminated osrelease parameter reading it back
  may disclose kernel memory.
  This is a problem in case of nested jails (children.max > 0, which is not
  the default).  Otherwise root outside the jail has access to kernel memory
  by other means and root inside a jail cannot create a child jail.
  
  Add the proper \0 check at the end of a supplied osrelease parameter and
  make sure any copies of the field will be \0-terminated.
  
  Submitted by: Hans Christian Woithe (chwoithe yahoo.com)
  MFC after:3 days

Modified:
  head/sys/kern/kern_jail.c

Modified: head/sys/kern/kern_jail.c
==
--- head/sys/kern/kern_jail.c   Sat Mar 14 11:55:27 2020(r358991)
+++ head/sys/kern/kern_jail.c   Sat Mar 14 14:04:55 2020(r358992)
@@ -865,8 +865,12 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
"osrelease cannot be changed after creation");
goto done_errmsg;
}
-   if (len == 0 || len >= OSRELEASELEN) {
+   if (len == 0 || osrelstr[len - 1] != '\0') {
error = EINVAL;
+   goto done_free;
+   }
+   if (len >= OSRELEASELEN) {
+   error = ENAMETOOLONG;
vfs_opterror(opts,
"osrelease string must be 1-%d bytes long",
OSRELEASELEN - 1);
@@ -1241,9 +1245,11 @@ kern_jail_set(struct thread *td, struct uio *optuio, i
 
pr->pr_osreldate = osreldt ? osreldt : ppr->pr_osreldate;
if (osrelstr == NULL)
-   strcpy(pr->pr_osrelease, ppr->pr_osrelease);
+   strlcpy(pr->pr_osrelease, ppr->pr_osrelease,
+   sizeof(pr->pr_osrelease));
else
-   strcpy(pr->pr_osrelease, osrelstr);
+   strlcpy(pr->pr_osrelease, osrelstr,
+   sizeof(pr->pr_osrelease));
 
LIST_INIT(>pr_children);
mtx_init(>pr_mtx, "jail mutex", NULL, MTX_DEF | MTX_DUPOK);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358897 - head/share/man/man4

2020-03-11 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Mar 11 20:23:36 2020
New Revision: 358897
URL: https://svnweb.freebsd.org/changeset/base/358897

Log:
  Correctly spell TUNABLES.

Modified:
  head/share/man/man4/liquidio.4

Modified: head/share/man/man4/liquidio.4
==
--- head/share/man/man4/liquidio.4  Wed Mar 11 20:20:21 2020
(r358896)
+++ head/share/man/man4/liquidio.4  Wed Mar 11 20:23:36 2020
(r358897)
@@ -77,7 +77,7 @@ LiquidIO II CN2350 210SV/225SV
 .It
 LiquidIO II CN2360 210SV/225SV
 .El
-.Sh LOADER TUBABLES
+.Sh LOADER TUNABLES
 Tunables can be set at the
 .Xr loader 8
 prompt before booting the kernel or stored in
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358625 - head/sys/net

2020-03-04 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Mar  4 17:17:02 2020
New Revision: 358625
URL: https://svnweb.freebsd.org/changeset/base/358625

Log:
  Implement optional table entry limits for if_llatbl.
  
  Implement counting of table entries linked on a per-table base
  with an optional (if set > 0) limit of the maximum number of table
  entries.
  
  For that the public lltable_link_entry() and lltable_unlink_entry()
  functions as well as the internal function pointers change from void
  to having an int return type.
  
  Given no consumer currently sets the new llt_maxentries this can be
  committed on its own.  The moment we make use of the table limits,
  the callers of the link function must check the return value as
  it can change and entries might not be added.
  
  Adjustments for IPv6 (and possibly IPv4) will follow.
  
  Sponsored by: Netflix (originally)
  Reviewed by:  melifaro
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D22713

Modified:
  head/sys/net/if_llatbl.c
  head/sys/net/if_llatbl.h

Modified: head/sys/net/if_llatbl.c
==
--- head/sys/net/if_llatbl.cWed Mar  4 17:13:35 2020(r358624)
+++ head/sys/net/if_llatbl.cWed Mar  4 17:17:02 2020(r358625)
@@ -153,17 +153,29 @@ htable_foreach_lle(struct lltable *llt, llt_foreach_cb
return (error);
 }
 
-static void
+/*
+ * The htable_[un]link_entry() functions return:
+ * 0 if the entry was (un)linked already and nothing changed,
+ * 1 if the entry was added/removed to/from the table, and
+ * -1 on error (e.g., not being able to add the entry due to limits reached).
+ * While the "unlink" operation should never error, callers of
+ * lltable_link_entry() need to check for errors and handle them.
+ */
+static int
 htable_link_entry(struct lltable *llt, struct llentry *lle)
 {
struct llentries *lleh;
uint32_t hashidx;
 
if ((lle->la_flags & LLE_LINKED) != 0)
-   return;
+   return (0);
 
IF_AFDATA_WLOCK_ASSERT(llt->llt_ifp);
 
+   if (llt->llt_maxentries > 0 &&
+   llt->llt_entries >= llt->llt_maxentries)
+   return (-1);
+
hashidx = llt->llt_hash(lle, llt->llt_hsize);
lleh = >lle_head[hashidx];
 
@@ -171,22 +183,33 @@ htable_link_entry(struct lltable *llt, struct llentry 
lle->lle_head = lleh;
lle->la_flags |= LLE_LINKED;
CK_LIST_INSERT_HEAD(lleh, lle, lle_next);
+   llt->llt_entries++;
+
+   return (1);
 }
 
-static void
+static int
 htable_unlink_entry(struct llentry *lle)
 {
+   struct lltable *llt;
 
if ((lle->la_flags & LLE_LINKED) == 0)
-   return;
+   return (0);
 
-   IF_AFDATA_WLOCK_ASSERT(lle->lle_tbl->llt_ifp);
+   llt = lle->lle_tbl;
+   IF_AFDATA_WLOCK_ASSERT(llt->llt_ifp);
+   KASSERT(llt->llt_entries > 0, ("%s: lltable %p (%s) entries %d <= 0",
+   __func__, llt, if_name(llt->llt_ifp), llt->llt_entries));
+
CK_LIST_REMOVE(lle, lle_next);
lle->la_flags &= ~(LLE_VALID | LLE_LINKED);
 #if 0
lle->lle_tbl = NULL;
lle->lle_head = NULL;
 #endif
+   llt->llt_entries--;
+
+   return (1);
 }
 
 struct prefix_match_data {
@@ -483,6 +506,9 @@ lltable_free(struct lltable *llt)
llentry_free(lle);
}
 
+   KASSERT(llt->llt_entries == 0, ("%s: lltable %p (%s) entires not 0: %d",
+   __func__, llt, llt->llt_ifp->if_xname, llt->llt_entries));
+
llt->llt_free_tbl(llt);
 }
 
@@ -608,18 +634,18 @@ lltable_free_entry(struct lltable *llt, struct llentry
llt->llt_free_entry(llt, lle);
 }
 
-void
+int
 lltable_link_entry(struct lltable *llt, struct llentry *lle)
 {
 
-   llt->llt_link_entry(llt, lle);
+   return (llt->llt_link_entry(llt, lle));
 }
 
-void
+int
 lltable_unlink_entry(struct lltable *llt, struct llentry *lle)
 {
 
-   llt->llt_unlink_entry(lle);
+   return (llt->llt_unlink_entry(lle));
 }
 
 void

Modified: head/sys/net/if_llatbl.h
==
--- head/sys/net/if_llatbl.hWed Mar  4 17:13:35 2020(r358624)
+++ head/sys/net/if_llatbl.hWed Mar  4 17:17:02 2020(r358625)
@@ -151,8 +151,8 @@ typedef int (llt_match_prefix_t)(const struct sockaddr
 typedef void (llt_free_entry_t)(struct lltable *, struct llentry *);
 typedef void (llt_fill_sa_entry_t)(const struct llentry *, struct sockaddr *);
 typedef void (llt_free_tbl_t)(struct lltable *);
-typedef void (llt_link_entry_t)(struct lltable *, struct llentry *);
-typedef void (llt_unlink_entry_t)(struct llentry *);
+typedef int (llt_link_entry_t)(struct lltable *, struct llentry *);
+typedef int (llt_unlink_entry_t)(struct llentry *);
 typedef void (llt_mark_used_t)(struct llentry *);
 
 typedef int (llt_foreach_cb_t)(struct lltable *, struct llentry *, void *);
@@ -162,6 +162,8 @@ struct lltable {

svn commit: r358620 - in head: sys/netinet usr.bin/netstat

2020-03-04 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Mar  4 16:20:59 2020
New Revision: 358620
URL: https://svnweb.freebsd.org/changeset/base/358620

Log:
  Add new ICMPv6 counters for Anti-DoS limits.
  
  Add four new counters for ND6 related Anti-DoS measures.
  We split these out into a separate upfront commit so that we only
  change the struct size one time.  Implementations using them will
  follow.
  
  PR:   157410
  Reviewed by:  melifaro
  MFC after:2 weeks
  X-MFC:cannot really MFC this without breaking netstat
  Sponsored by: Netflix (initially)
  Differential Revision:https://reviews.freebsd.org/D22711

Modified:
  head/sys/netinet/icmp6.h
  head/usr.bin/netstat/inet6.c

Modified: head/sys/netinet/icmp6.h
==
--- head/sys/netinet/icmp6.hWed Mar  4 14:56:32 2020(r358619)
+++ head/sys/netinet/icmp6.hWed Mar  4 16:20:59 2020(r358620)
@@ -635,6 +635,10 @@ struct icmp6stat {
uint64_t icp6s_badrs;   /* bad router solicitation */
uint64_t icp6s_badra;   /* bad router advertisement */
uint64_t icp6s_badredirect; /* bad redirect message */
+   uint64_t icp6s_overflowdefrtr;  /* Too many default routers. */
+   uint64_t icp6s_overflowprfx;/* Too many prefixes. */
+   uint64_t icp6s_overflownndp;/* Too many neighbour entries. */
+   uint64_t icp6s_overflowredirect;/* Too many redirects. */
 };
 
 #ifdef _KERNEL

Modified: head/usr.bin/netstat/inet6.c
==
--- head/usr.bin/netstat/inet6.cWed Mar  4 14:56:32 2020
(r358619)
+++ head/usr.bin/netstat/inet6.cWed Mar  4 16:20:59 2020
(r358620)
@@ -1055,6 +1055,14 @@ icmp6_stats(u_long off, const char *name, int af1 __un
"{N:/bad router advertisement message%s}\n");
p(icp6s_badredirect, "\t{:bad-redirect/%ju} "
"{N:/bad redirect message%s}\n");
+   p(icp6s_overflowdefrtr, "\t{:default-routers-overflows/%ju} "
+   "{N:/default routers overflow%s}\n");
+   p(icp6s_overflowprfx, "\t{:prefixes-overflows/%ju} "
+   "{N:/prefix overflow%s}\n");
+   p(icp6s_overflownndp, "\t{:neighbour-entries-overflows/%ju} "
+   "{N:/neighbour entries overflow%s}\n");
+   p(icp6s_overflowredirect, "\t{:redirect-overflows/%ju} "
+   "{N:/redirect overflow%s}\n");
xo_close_container("errors");
p(icp6s_pmtuchg, "\t{:path-mtu-changes/%ju} {N:/path MTU change%s}\n");
 #undef p
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358577 - head/sys/netinet

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 14:15:30 2020
New Revision: 358577
URL: https://svnweb.freebsd.org/changeset/base/358577

Log:
  tcp_hpts: make RSS kernel compile again.
  
  Add proper #includes, and #ifdefs and some style fixes to make RSS
  kernels compile again.  There are still possible issues with uin16_t
  vs. uint_t cpuid which I am not going near.
  
  Reviewed by:  gallatin
  Differential Revision:https://reviews.freebsd.org/D23726

Modified:
  head/sys/netinet/tcp_hpts.c

Modified: head/sys/netinet/tcp_hpts.c
==
--- head/sys/netinet/tcp_hpts.c Tue Mar  3 14:07:44 2020(r358576)
+++ head/sys/netinet/tcp_hpts.c Tue Mar  3 14:15:30 2020(r358577)
@@ -28,7 +28,9 @@ __FBSDID("$FreeBSD$");
 
 #include "opt_inet.h"
 #include "opt_inet6.h"
+#include "opt_rss.h"
 #include "opt_tcpdebug.h"
+
 /**
  * Some notes about usage.
  *
@@ -151,6 +153,11 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#ifdef RSS
+#include 
+#include 
+#endif
+
 #define TCPSTATES  /* for logging */
 
 #include 
@@ -180,7 +187,6 @@ __FBSDID("$FreeBSD$");
 #include 
 #endif
 
-#include "opt_rss.h"
 
 MALLOC_DEFINE(M_TCPHPTS, "tcp_hpts", "TCP hpts");
 #ifdef RSS
@@ -1151,9 +1157,10 @@ hpts_random_cpu(struct inpcb *inp){
 }
 
 static uint16_t
-hpts_cpuid(struct inpcb *inp){
+hpts_cpuid(struct inpcb *inp)
+{
u_int cpuid;
-#ifdef NUMA
+#if !defined(RSS) && defined(NUMA)
struct hpts_domain_info *di;
 #endif
 
@@ -1167,7 +1174,7 @@ hpts_cpuid(struct inpcb *inp){
return (inp->inp_hpts_cpu);
}
/* If one is set the other must be the same */
-#ifdef RSS
+#ifdef RSS
cpuid = rss_hash2cpuid(inp->inp_flowid, inp->inp_flowtype);
if (cpuid == NETISR_CPUID_NONE)
return (hpts_random_cpu(inp));
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358576 - head/sys/kern

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 14:07:44 2020
New Revision: 358576
URL: https://svnweb.freebsd.org/changeset/base/358576

Log:
  upic_ktrls: make RSS compile again here
  
  The results of ktls_get_cpu() are stored in u_int and NETISR_CPUID_NONE
  requires u_int.  Adjust uint16_t to uint_t in order to make RSS kernels
  compile some more again.
  
  HPTS still has to be fixed, which is a bit more complicated.
  
  Reviewed by:  jhb, gallatin, rrs
  Differential Revision:https://reviews.freebsd.org/D23726

Modified:
  head/sys/kern/uipc_ktls.c

Modified: head/sys/kern/uipc_ktls.c
==
--- head/sys/kern/uipc_ktls.c   Tue Mar  3 13:48:12 2020(r358575)
+++ head/sys/kern/uipc_ktls.c   Tue Mar  3 14:07:44 2020(r358576)
@@ -299,11 +299,11 @@ ktls_crypto_backend_deregister(struct ktls_crypto_back
 }
 
 #if defined(INET) || defined(INET6)
-static uint16_t
+static u_int
 ktls_get_cpu(struct socket *so)
 {
struct inpcb *inp;
-   uint16_t cpuid;
+   u_int cpuid;
 
inp = sotoinpcb(so);
 #ifdef RSS
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358575 - head/sys/netinet6

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 13:48:12 2020
New Revision: 358575
URL: https://svnweb.freebsd.org/changeset/base/358575

Log:
  ip6: retire in6_selectroute_fib() as promised 8 years ago
  
  In r231852 I added in6_selectroute_fib() as a compat function with the
  fibnum as an extra argument compared to in6_selectroute() to keep the
  KPI stable.
  Way too late retire this function again and add the fib to in6_selectroute()
  which also only has a single consumer now and was an orphan function before.

Modified:
  head/sys/netinet6/in6_src.c
  head/sys/netinet6/ip6_output.c
  head/sys/netinet6/ip6_var.h

Modified: head/sys/netinet6/in6_src.c
==
--- head/sys/netinet6/in6_src.c Tue Mar  3 13:25:08 2020(r358574)
+++ head/sys/netinet6/in6_src.c Tue Mar  3 13:48:12 2020(r358575)
@@ -640,10 +640,10 @@ selectroute(struct sockaddr_in6 *dstsock, struct ip6_p
if (dstsock->sin6_addr.s6_addr32[0] == 0 &&
dstsock->sin6_addr.s6_addr32[1] == 0 &&
!IN6_IS_ADDR_LOOPBACK(>sin6_addr)) {
-   printf("in6_selectroute: strange destination %s\n",
+   printf("%s: strange destination %s\n", __func__,
   ip6_sprintf(ip6buf, >sin6_addr));
} else {
-   printf("in6_selectroute: destination = %s%%%d\n",
+   printf("%s: destination = %s%%%d\n", __func__,
   ip6_sprintf(ip6buf, >sin6_addr),
   dstsock->sin6_scope_id); /* for debug */
}
@@ -895,33 +895,16 @@ in6_selectif(struct sockaddr_in6 *dstsock, struct ip6_
return (0);
 }
 
-/*
- * Public wrapper function to selectroute().
- *
- * XXX-BZ in6_selectroute() should and will grow the FIB argument. The
- * in6_selectroute_fib() function is only there for backward compat on stable.
- */
+/* Public wrapper function to selectroute(). */
 int
 in6_selectroute(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
 struct ip6_moptions *mopts, struct route_in6 *ro,
-struct ifnet **retifp, struct rtentry **retrt)
-{
-
-   return (selectroute(dstsock, opts, mopts, ro, retifp,
-   retrt, 0, RT_DEFAULT_FIB));
-}
-
-#ifndef BURN_BRIDGES
-int
-in6_selectroute_fib(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts,
-struct ip6_moptions *mopts, struct route_in6 *ro,
 struct ifnet **retifp, struct rtentry **retrt, u_int fibnum)
 {
 
return (selectroute(dstsock, opts, mopts, ro, retifp,
retrt, 0, fibnum));
 }
-#endif
 
 /*
  * Default hop limit selection. The precedence is as follows:

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Tue Mar  3 13:25:08 2020
(r358574)
+++ head/sys/netinet6/ip6_output.c  Tue Mar  3 13:48:12 2020
(r358575)
@@ -709,7 +709,7 @@ again:
dst_sa.sin6_len = sizeof(dst_sa);
dst_sa.sin6_addr = ip6->ip6_dst;
}
-   error = in6_selectroute_fib(_sa, opt, im6o, ro, 
,
+   error = in6_selectroute(_sa, opt, im6o, ro, ,
, fibnum);
if (error != 0) {
IP6STAT_INC(ip6s_noroute);

Modified: head/sys/netinet6/ip6_var.h
==
--- head/sys/netinet6/ip6_var.h Tue Mar  3 13:25:08 2020(r358574)
+++ head/sys/netinet6/ip6_var.h Tue Mar  3 13:48:12 2020(r358575)
@@ -416,10 +416,7 @@ intin6_selectsrc_addr(uint32_t, const struct 
in6_addr
 uint32_t, struct ifnet *, struct in6_addr *, int *);
 int in6_selectroute(struct sockaddr_in6 *, struct ip6_pktopts *,
struct ip6_moptions *, struct route_in6 *, struct ifnet **,
-   struct rtentry **);
-intin6_selectroute_fib(struct sockaddr_in6 *, struct ip6_pktopts *,
-   struct ip6_moptions *, struct route_in6 *, struct ifnet **,
-   struct rtentry **, u_int);
+   struct rtentry **, u_int);
 u_int32_t ip6_randomid(void);
 u_int32_t ip6_randomflowlabel(void);
 void in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358572 - head/sys/netinet6

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 11:32:47 2020
New Revision: 358572
URL: https://svnweb.freebsd.org/changeset/base/358572

Log:
  ip6_output: use new routing KPI when not passed a cached route
  
  Implement the equivalent of r347375 (IPv4) for the IPv6 output path.
  In IPv6 we get passed a cached route (and inp) by udp6_output()
  depending on whether we acquired a write lock on the INP.
  In case we neither bind nor connect a first UDP packet would come in
  with a cached route (wlocked) and all further packets would not.
  In case we bind and do not connect we never write-lock the inp.
  
  When we do not pass in a cached route, rather than providing the
  storage for a route locally and pass it over the old lookup code
  and down the stack, use the new route lookup KPI and acquire all
  details we need to send the packet.
  
  Compared to the IPv4 code the IPv6 code has a couple of possible
  complications: given an option with a routing hdr/caching route there,
  and path mtu (ro_pmtu) case which now equally has to deal with the
  possibility of having a route which is NULL passed in, and the
  fwd_tag in case a firewall changes the next hop (something to
  factor out in the future).
  
  Sponsored by: Netflix
  Reviewed by:  glebius
  MFC after:2 weeks
  Differential Revision:https://reviews.freebsd.org/D23886

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Tue Mar  3 10:02:58 2020
(r358571)
+++ head/sys/netinet6/ip6_output.c  Tue Mar  3 11:32:47 2020
(r358572)
@@ -424,12 +424,12 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
struct ifnet *ifp, *origifp;
struct mbuf *m = m0;
struct mbuf *mprev;
-   int tlen, len;
-   struct route_in6 ip6route;
-   struct rtentry *rt = NULL;
-   struct sockaddr_in6 *dst, src_sa, dst_sa;
+   struct route_in6 *ro_pmtu;
+   struct rtentry *rt;
+   struct sockaddr_in6 *dst, sin6, src_sa, dst_sa;
struct in6_addr odst;
u_char *nexthdrp;
+   int tlen, len;
int error = 0;
struct in6_ifaddr *ia = NULL;
u_long mtu;
@@ -438,7 +438,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
struct ip6_exthdrs exthdrs;
struct in6_addr src0, dst0;
u_int32_t zone;
-   struct route_in6 *ro_pmtu = NULL;
bool hdrsplit;
int sw_csum, tso;
int needfiblookup;
@@ -631,15 +630,15 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
IP6STAT_INC(ip6s_localout);
 
/* Route packet. */
-   if (ro == NULL) {
-   ro = 
-   bzero((caddr_t)ro, sizeof(*ro));
-   }
ro_pmtu = ro;
if (opt && opt->ip6po_rthdr)
ro = >ip6po_route;
-   dst = (struct sockaddr_in6 *)>ro_dst;
+   if (ro != NULL)
+   dst = (struct sockaddr_in6 *)>ro_dst;
+   else
+   dst = 
fibnum = (inp != NULL) ? inp->inp_inc.inc_fibnum : M_GETFIB(m);
+
 again:
/*
 * If specified, try to fill in the traffic class field.
@@ -666,55 +665,127 @@ again:
else
ip6->ip6_hlim = V_ip6_defmcasthlim;
}
+
+   if (ro == NULL || ro->ro_rt == NULL) {
+   bzero(dst, sizeof(*dst));
+   dst->sin6_family = AF_INET6;
+   dst->sin6_len = sizeof(*dst);
+   dst->sin6_addr = ip6->ip6_dst;
+   } 
/*
-* Validate route against routing table additions;
-* a better/more specific route might have been added.
+* Validate route against routing table changes.
 * Make sure that the address family is set in route.
 */
-   if (inp) {
-   ro->ro_dst.sin6_family = AF_INET6;
-   RT_VALIDATE((struct route *)ro, >inp_rt_cookie, fibnum);
-   }
-   if (ro->ro_rt && fwd_tag == NULL && (ro->ro_rt->rt_flags & RTF_UP) &&
-   ro->ro_dst.sin6_family == AF_INET6 &&
-   IN6_ARE_ADDR_EQUAL(>ro_dst.sin6_addr, >ip6_dst)) {
-   rt = ro->ro_rt;
-   ifp = ro->ro_rt->rt_ifp;
+   rt = NULL;
+   ifp = NULL;
+   mtu = 0;
+   if (ro != NULL) {
+   if (ro->ro_rt != NULL && inp != NULL) {
+   ro->ro_dst.sin6_family = AF_INET6; /* XXX KASSERT? */
+   RT_VALIDATE((struct route *)ro, >inp_rt_cookie,
+   fibnum);
+   }
+   if (ro->ro_rt != NULL && fwd_tag == NULL &&
+   ((ro->ro_rt->rt_flags & RTF_UP) == 0 ||
+   ro->ro_rt->rt_ifp == NULL ||
+   !RT_LINK_IS_UP(ro->ro_rt->rt_ifp) ||
+   ro->ro_dst.sin6_family != AF_INET6 ||
+   !IN6_ARE_ADDR_EQUAL(>ro_dst.sin6_addr, >ip6_dst)))
+   

svn commit: r358569 - head/sys/netinet6

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 09:50:33 2020
New Revision: 358569
URL: https://svnweb.freebsd.org/changeset/base/358569

Log:
  in6_fib: return nh_ia in the ext interface as we do for IPv4
  
  Like for IPv4 add nh_ia to the ext interface and return rt_ifa
  in order to be used for, e.g., packet/octets accounting purposes.
  
  Reviewed by:  melifaro
  MFC after:1 week
  Sponsored by: Netflix
  Differential Revision:https://reviews.freebsd.org/D23873

Modified:
  head/sys/netinet6/in6_fib.c
  head/sys/netinet6/in6_fib.h

Modified: head/sys/netinet6/in6_fib.c
==
--- head/sys/netinet6/in6_fib.c Tue Mar  3 09:45:16 2020(r358568)
+++ head/sys/netinet6/in6_fib.c Tue Mar  3 09:50:33 2020(r358569)
@@ -75,6 +75,8 @@ static void fib6_rte_to_nh_basic(struct rtentry *rte, 
 static struct ifnet *fib6_get_ifaifp(struct rtentry *rte);
 #define RNTORT(p)  ((struct rtentry *)(p))
 
+#defineifatoia6(ifa)   ((struct in6_ifaddr *)(ifa))
+
 CHK_STRUCT_ROUTE_COMPAT(struct route_in6, ro_dst);
 
 /*
@@ -153,6 +155,7 @@ fib6_rte_to_nh_extended(struct rtentry *rte, const str
gw = (struct sockaddr_in6 *)rt_key(rte);
if (IN6_IS_ADDR_UNSPECIFIED(>sin6_addr))
pnh6->nh_flags |= NHF_DEFAULT;
+   pnh6->nh_ia = ifatoia6(rte->rt_ifa);
 }
 
 /*

Modified: head/sys/netinet6/in6_fib.h
==
--- head/sys/netinet6/in6_fib.h Tue Mar  3 09:45:16 2020(r358568)
+++ head/sys/netinet6/in6_fib.h Tue Mar  3 09:50:33 2020(r358569)
@@ -41,14 +41,15 @@ struct nhop6_basic {
struct in6_addr nh_addr;/* GW/DST IPv4 address */
 };
 
-/* Does not differ from nhop6_basic */
+/* Extended nexthop info used for control protocols. */
 struct nhop6_extended {
struct ifnet*nh_ifp;/* Logical egress interface */
+   struct in6_ifaddr *nh_ia;   /* Associated address. */
uint16_tnh_mtu; /* nexthop mtu */
uint16_tnh_flags;   /* nhop flags */
uint8_t spare[4];
struct in6_addr nh_addr;/* GW/DST IPv6 address */
-   uint64_tspare2[2];
+   uint64_tspare2[1];
 };
 
 int fib6_lookup_nh_basic(uint32_t fibnum, const struct in6_addr *dst,
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358568 - head/sys/netinet6

2020-03-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Mar  3 09:45:16 2020
New Revision: 358568
URL: https://svnweb.freebsd.org/changeset/base/358568

Log:
  fib6_rte_to_nh_*: return a link-local gw address with scope embedded
  
  In fib6_rte_to_nh_* when returning a link-local gateway address
  currently we do clear the scope. That could be recovered using
  the ifp returned as well, but the code in general seems to
  expect a link-local address with scope embeedded as otherwise
  the "dst" (gw) passed to the output routines will not include
  scope and not send the packet out (the right interface).
  
  Do not clear the scope when returning a link-local address and
  allow packets to go out (the right interface).
  
  Remove the (now) extra scope recovery in the IPv6 fast-fwd code.
  
  Sponsored by: Netflix
  Reviewed by:  melifaro, ae
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D23872

Modified:
  head/sys/netinet6/in6_fib.c
  head/sys/netinet6/ip6_fastfwd.c

Modified: head/sys/netinet6/in6_fib.c
==
--- head/sys/netinet6/in6_fib.c Tue Mar  3 08:28:16 2020(r358567)
+++ head/sys/netinet6/in6_fib.c Tue Mar  3 09:45:16 2020(r358568)
@@ -115,9 +115,9 @@ fib6_rte_to_nh_basic(struct rtentry *rte, const struct
 
pnh6->nh_mtu = min(rte->rt_mtu, IN6_LINKMTU(rte->rt_ifp));
if (rte->rt_flags & RTF_GATEWAY) {
+   /* Return address with embedded scope. */
gw = (struct sockaddr_in6 *)rte->rt_gateway;
pnh6->nh_addr = gw->sin6_addr;
-   in6_clearscope(>nh_addr);
} else
pnh6->nh_addr = *dst;
/* Set flags */
@@ -143,9 +143,9 @@ fib6_rte_to_nh_extended(struct rtentry *rte, const str
 
pnh6->nh_mtu = min(rte->rt_mtu, IN6_LINKMTU(rte->rt_ifp));
if (rte->rt_flags & RTF_GATEWAY) {
+   /* Return address with embedded scope. */
gw = (struct sockaddr_in6 *)rte->rt_gateway;
pnh6->nh_addr = gw->sin6_addr;
-   in6_clearscope(>nh_addr);
} else
pnh6->nh_addr = *dst;
/* Set flags */

Modified: head/sys/netinet6/ip6_fastfwd.c
==
--- head/sys/netinet6/ip6_fastfwd.c Tue Mar  3 08:28:16 2020
(r358567)
+++ head/sys/netinet6/ip6_fastfwd.c Tue Mar  3 09:45:16 2020
(r358568)
@@ -274,14 +274,7 @@ passout:
m_clrprotoflags(m); /* Avoid confusing lower layers. */
IP_PROBE(send, NULL, NULL, ip6, nh.nh_ifp, NULL, ip6);
 
-   /*
-* XXX: we need to use destination address with embedded scope
-* zone id, because LLTABLE uses such form of addresses for lookup.
-*/
dst.sin6_addr = nh.nh_addr;
-   if (IN6_IS_SCOPE_LINKLOCAL(_addr))
-   dst.sin6_addr.s6_addr16[1] = htons(nh.nh_ifp->if_index & 
0x);
-
error = (*nh.nh_ifp->if_output)(nh.nh_ifp, m,
(struct sockaddr *), NULL);
if (error != 0) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358427 - head/sys/netinet6

2020-02-28 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Feb 28 11:16:41 2020
New Revision: 358427
URL: https://svnweb.freebsd.org/changeset/base/358427

Log:
  mld6: initialize oifp to avoid bogus results/panics in edge cases
  
  In certain cases (probably not during normal operation but observed in
  the lab during development) ip6_ouput() could return without error
  and ifpp () not updated.
  Given oifp was never initialized we would take the later branch
  as oifp was not NULL, and when calling icmp6_ifstat_inc() we would
  panic dereferencing a garbage pointer.
  For code stability initialize oifp to NULL before first use to always
  have a deterministic value and not rely on a called function to behave
  and always and for ever do the work for us as we hope for.
  
  MFC after:3 days
  Sponsored by: Netflix

Modified:
  head/sys/netinet6/mld6.c

Modified: head/sys/netinet6/mld6.c
==
--- head/sys/netinet6/mld6.cFri Feb 28 10:57:23 2020(r358426)
+++ head/sys/netinet6/mld6.cFri Feb 28 11:16:41 2020(r358427)
@@ -3159,6 +3159,7 @@ mld_dispatch_packet(struct mbuf *m)
mld = (struct mld_hdr *)(mtod(md, uint8_t *) + off);
type = mld->mld_type;
 
+   oifp = NULL;
error = ip6_output(m0, _po, NULL, IPV6_UNSPECSRC, ,
, NULL);
if (error) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r358348 - in head/lib/libc: . gdtoa gen sparc64 sparc64/fpu sparc64/gen sparc64/sys sys

2020-02-26 Thread Bjoern A. Zeeb

On 26 Feb 2020, at 18:55, Warner Losh wrote:


Author: imp
Date: Wed Feb 26 18:55:09 2020
New Revision: 358348
URL: https://svnweb.freebsd.org/changeset/base/358348

Log:
  Remove sparc64 specific parts of libc.


I have a silly question for which it’s long been too late, but for the 
next time .. why do we need a gazillion of commits to remove sparc64 
rather than 1 “atomic” one (or maybe 2 in case the one missed a bit) 
to remove it all (which would also allow other people to bring it back 
into private trees a lot more easily compared to tracking changes over 
weeks)?


Bjoern
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358311 - head/sys/netinet6

2020-02-25 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Feb 25 15:03:41 2020
New Revision: 358311
URL: https://svnweb.freebsd.org/changeset/base/358311

Log:
  ip6_output: fix regression introduced in r358167 for ipv6 fragmentation
  
  When moving the calculations for the optlen into the if (opt) block
  which deals with possible extension headers I failed to initialise
  unfragpartlen to the ipv6 header length if there were no extension
  headers present.  Correct that mistake to make IPv6 fragment length
  calculcations work again.
  
  Reported by:  hselasky, kp
  OKed by:  hselasky, kp
  MFC after:3 days
  X-MFC with:   r358167
  PR:   244393

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Tue Feb 25 12:56:06 2020
(r358310)
+++ head/sys/netinet6/ip6_output.c  Tue Feb 25 15:03:41 2020
(r358311)
@@ -497,7 +497,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
 */
bzero(, sizeof(exthdrs));
optlen = 0;
-   unfragpartlen = 0;
+   unfragpartlen = sizeof(struct ip6_hdr);
if (opt) {
/* Hop-by-Hop options header. */
MAKE_EXTHDR(opt->ip6po_hbh, _hbh, optlen);
@@ -535,7 +535,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
/* Routing header. */
MAKE_EXTHDR(opt->ip6po_rthdr, _rthdr, optlen);
 
-   unfragpartlen = optlen + sizeof(struct ip6_hdr);
+   unfragpartlen += optlen;
 
/*
 * NOTE: we don't add AH/ESP length here (done in
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r358167 - head/sys/netinet6

2020-02-25 Thread Bjoern A. Zeeb

On 25 Feb 2020, at 12:44, Kristof Provost wrote:

This change introduces a slight regression when a host replies to 
IPv6 ping fragmented packets. The problem is the "unfragpartlen" must 
also be set in the else case of "if (opt)", else the payload offset 
computation for IPv6 fragments goes wrong by the size of the IPv6 
header!



Confirmed, because the pf fragmentation:v6 test also fails on this.




Patch goes like this:


diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c
index 06c57bcec48..a6c8d148833 100644
--- a/sys/netinet6/ip6_output.c
+++ b/sys/netinet6/ip6_output.c
@@ -459,7 +459,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts 
*opt,

 */
bzero(, sizeof(exthdrs));
optlen = 0;
-   unfragpartlen = 0;
if (opt) {
/* Hop-by-Hop options header. */
MAKE_EXTHDR(opt->ip6po_hbh, _hbh, 
optlen);
@@ -497,8 +496,6 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts 
*opt,

/* Routing header. */
MAKE_EXTHDR(opt->ip6po_rthdr, _rthdr, 
optlen);

-   unfragpartlen = optlen + sizeof(struct ip6_hdr);
-
/*
 * NOTE: we don't add AH/ESP length here (done in
 * ip6_ipsec_output()).
@@ -508,6 +505,8 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts 
*opt,
MAKE_EXTHDR(opt->ip6po_dest2, _dest2, 
optlen);

}
+   unfragpartlen = optlen + sizeof(struct ip6_hdr);
+
/*
 * If there is at least one extension header,
 * separate IP6 header from the payload.



And with this patch the test passes again.


And fails for other packets.  The patch is wrong.

Offset gets changed after we set unfragpartlen inside the block so 
moving it outside the block unfragpartlen may point to the wrong thing.


Your tests are too simple to detect this problem.

Try this one please:

Index: ip6_output.c
===
--- ip6_output.c(revision 358297)
+++ ip6_output.c(working copy)
@@ -497,7 +497,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *op
 */
bzero(, sizeof(exthdrs));
optlen = 0;
-   unfragpartlen = 0;
+   unfragpartlen = sizeof(struct ip6_hdr);
if (opt) {
/* Hop-by-Hop options header. */
MAKE_EXTHDR(opt->ip6po_hbh, _hbh, optlen);
@@ -535,7 +535,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *op
/* Routing header. */
MAKE_EXTHDR(opt->ip6po_rthdr, _rthdr, 
optlen);


-   unfragpartlen = optlen + sizeof(struct ip6_hdr);
+   unfragpartlen += optlen;

/*
 * NOTE: we don't add AH/ESP length here (done in


/bz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358297 - head/sys/netinet6

2020-02-24 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Feb 24 19:12:20 2020
New Revision: 358297
URL: https://svnweb.freebsd.org/changeset/base/358297

Log:
  Fix IPv6 checksums when exthdrs are present.
  
  In two places in ip6_output we are doing (delayed) checksum calculations.
  The initial logic came from SCTP in r205075,205104 and later I copied
  and adjusted it for the TCP|UDP case in r235958.
  The problem was that the original SCTP offsets were already wrong for any
  case with extension headers present given IPv6 extension headers are not
  part of the pseudo checksum calculations.
  The later changes do not help in case there is checksum offloading as for
  extension headers (incl. fragments) we do currrently never offload as we
  have no infrastructure to know whether the NIC can handle these cases.
  
  Correct the offsets for delayed checksum calculations and properly handle
  mbuf flags.  In addition harmonize the almost identical duplicate code.
  
  While here eliminate the now unneeded variable hlen and add an always
  missing mtod() call in the 1-b and 3 cases after the introduction of
  the mb_unmapped_to_ext() calls.
  
  Reported by:  Francis Dupont (fdupont isc.org)
  PR:   243675
  MFC after:6 days
  Reviewed by:  markj (earlier version), gallatin
  Differential Revision:https://reviews.freebsd.org/D23760

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Mon Feb 24 19:11:52 2020
(r358296)
+++ head/sys/netinet6/ip6_output.c  Mon Feb 24 19:12:20 2020
(r358297)
@@ -210,6 +210,44 @@ in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_sho
*(u_short *)mtodo(m, offset) = csum;
 }
 
+static int
+ip6_output_delayed_csum(struct mbuf *m, struct ifnet *ifp, int csum_flags,
+int plen, int optlen, bool frag)
+{
+
+   KASSERT((plen >= optlen), ("%s:%d: plen %d < optlen %d, m %p, ifp %p "
+   "csum_flags %#x frag %d\n",
+   __func__, __LINE__, plen, optlen, m, ifp, csum_flags, frag));
+
+   if ((csum_flags & CSUM_DELAY_DATA_IPV6) ||
+#ifdef SCTP
+   (csum_flags & CSUM_SCTP_IPV6) ||
+#endif
+   (!frag && (ifp->if_capenable & IFCAP_NOMAP) == 0)) {
+   m = mb_unmapped_to_ext(m);
+   if (m == NULL) {
+   if (frag)
+   in6_ifstat_inc(ifp, ifs6_out_fragfail);
+   else
+   IP6STAT_INC(ip6s_odropped);
+   return (ENOBUFS);
+   }
+   if (csum_flags & CSUM_DELAY_DATA_IPV6) {
+   in6_delayed_cksum(m, plen - optlen,
+   sizeof(struct ip6_hdr) + optlen);
+   m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6;
+   }
+#ifdef SCTP
+   if (csum_flags & CSUM_SCTP_IPV6) {
+   sctp_delayed_cksum(m, sizeof(struct ip6_hdr) + optlen);
+   m->m_pkthdr.csum_flags &= ~CSUM_SCTP_IPV6;
+   }
+#endif
+   }
+
+   return (0);
+}
+
 int
 ip6_fragment(struct ifnet *ifp, struct mbuf *m0, int hlen, u_char nextproto,
 int fraglen , uint32_t id)
@@ -386,7 +424,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
struct ifnet *ifp, *origifp;
struct mbuf *m = m0;
struct mbuf *mprev;
-   int hlen, tlen, len;
+   int tlen, len;
struct route_in6 ip6route;
struct rtentry *rt = NULL;
struct sockaddr_in6 *dst, src_sa, dst_sa;
@@ -1007,36 +1045,10 @@ passout:
 * XXX-BZ  Need a framework to know when the NIC can handle it, even
 * with ext. hdrs.
 */
-   if (sw_csum & CSUM_DELAY_DATA_IPV6) {
-   sw_csum &= ~CSUM_DELAY_DATA_IPV6;
-   m = mb_unmapped_to_ext(m);
-   if (m == NULL) {
-   error = ENOBUFS;
-   IP6STAT_INC(ip6s_odropped);
-   goto bad;
-   }
-   in6_delayed_cksum(m, plen, sizeof(struct ip6_hdr));
-   } else if ((ifp->if_capenable & IFCAP_NOMAP) == 0) {
-   m = mb_unmapped_to_ext(m);
-   if (m == NULL) {
-   error = ENOBUFS;
-   IP6STAT_INC(ip6s_odropped);
-   goto bad;
-   }
-   }
-#ifdef SCTP
-   if (sw_csum & CSUM_SCTP_IPV6) {
-   sw_csum &= ~CSUM_SCTP_IPV6;
-   m = mb_unmapped_to_ext(m);
-   if (m == NULL) {
-   error = ENOBUFS;
-   IP6STAT_INC(ip6s_odropped);
-   goto bad;
-   }
-   sctp_delayed_cksum(m, sizeof(struct ip6_hdr));
-   }
-#endif
-   m->m_pkthdr.csum_flags &= ifp->if_hwassist;
+   error = ip6_output_delayed_csum(m, ifp, sw_csum, plen, optlen, false);
+ 

Re: svn commit: r358167 - head/sys/netinet6

2020-02-24 Thread Bjoern A. Zeeb

On 24 Feb 2020, at 14:21, Hans Petter Selasky wrote:

Hi Hans,


On 2020-02-20 11:56, Bjoern A. Zeeb wrote:


+
+   unfragpartlen = optlen + sizeof(struct ip6_hdr);
+



Hi Bjoren,

This change introduces a slight regression when a host replies to IPv6 
ping fragmented packets. The problem is the "unfragpartlen" must also 
be set in the else case of "if (opt)", else the payload offset 
computation for IPv6 fragments goes wrong by the size of the IPv6 
header!


After r358167:



ping6 -s 3000 fe80::ee0d:9aff:fed4:2c8c%mce2
PING6(3048=40+8+3000 bytes) fe80::ee0d:9aff:fed4:2c94%mce2 --> 
fe80::ee0d:9aff:fed4:2c8c%mce2

^C
--- fe80::ee0d:9aff:fed4:2c8c%mce2 ping6 statistics ---
2 packets transmitted, 0 packets received, 100.0% packet loss



With the patch mentioned in the end of this e-mail:


are you sure that this is the problem?  Or does 
https://reviews.freebsd.org/D23760 solve the actual problem?


/bz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r358167 - head/sys/netinet6

2020-02-20 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Feb 20 10:56:12 2020
New Revision: 358167
URL: https://svnweb.freebsd.org/changeset/base/358167

Log:
  ip6_output: improve extension header handling
  
  Move IPv6 source address checks from after extension header heandling
  to the top of the function. If we do not pass these checks there is
  no reason to do a lot of work upfront.
  
  Fold extension header preparations and length calculations together into
  a single branch and macro rather than doing them sequentially.
  Likewise move extension header concatination into a single branch block
  only doing it if we recorded any extension header length length.
  
  Reviewed by:  melifaro (earlier version), markj, gallatin
  Sponsored by: Netflix (partially, originally)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D23740

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Thu Feb 20 09:33:14 2020
(r358166)
+++ head/sys/netinet6/ip6_output.c  Thu Feb 20 10:56:12 2020
(r358167)
@@ -156,10 +156,10 @@ static int copypktopts(struct ip6_pktopts *, struct ip
 
 
 /*
- * Make an extension header from option data.  hp is the source, and
- * mp is the destination.
+ * Make an extension header from option data.  hp is the source,
+ * mp is the destination, and _ol is the optlen.
  */
-#define MAKE_EXTHDR(hp, mp)\
+#defineMAKE_EXTHDR(hp, mp, _ol)
\
 do {   \
if (hp) {   \
struct ip6_ext *eh = (struct ip6_ext *)(hp);\
@@ -167,6 +167,7 @@ static int copypktopts(struct ip6_pktopts *, struct ip
((eh)->ip6e_len + 1) << 3); \
if (error)  \
goto freehdrs;  \
+   (_ol) += (*(mp))->m_len;\
}   \
 } while (/*CONSTCOND*/ 0)
 
@@ -384,22 +385,23 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
struct ip6_hdr *ip6;
struct ifnet *ifp, *origifp;
struct mbuf *m = m0;
-   struct mbuf *mprev = NULL;
+   struct mbuf *mprev;
int hlen, tlen, len;
struct route_in6 ip6route;
struct rtentry *rt = NULL;
struct sockaddr_in6 *dst, src_sa, dst_sa;
struct in6_addr odst;
+   u_char *nexthdrp;
int error = 0;
struct in6_ifaddr *ia = NULL;
u_long mtu;
int alwaysfrag, dontfrag;
-   u_int32_t optlen = 0, plen = 0, unfragpartlen = 0;
+   u_int32_t optlen, plen = 0, unfragpartlen;
struct ip6_exthdrs exthdrs;
struct in6_addr src0, dst0;
u_int32_t zone;
struct route_in6 *ro_pmtu = NULL;
-   int hdrsplit = 0;
+   bool hdrsplit;
int sw_csum, tso;
int needfiblookup;
uint32_t fibnum;
@@ -436,13 +438,50 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
}
 #endif /* IPSEC */
 
+   /* Source address validation. */
+   ip6 = mtod(m, struct ip6_hdr *);
+   if (IN6_IS_ADDR_UNSPECIFIED(>ip6_src) &&
+   (flags & IPV6_UNSPECSRC) == 0) {
+   error = EOPNOTSUPP;
+   IP6STAT_INC(ip6s_badscope);
+   goto bad;
+   }
+   if (IN6_IS_ADDR_MULTICAST(>ip6_src)) {
+   error = EOPNOTSUPP;
+   IP6STAT_INC(ip6s_badscope);
+   goto bad;
+   }
+
+   /*
+* If we are given packet options to add extension headers prepare them.
+* Calculate the total length of the extension header chain.
+* Keep the length of the unfragmentable part for fragmentation.
+*/
bzero(, sizeof(exthdrs));
+   optlen = 0;
+   unfragpartlen = 0;
if (opt) {
/* Hop-by-Hop options header. */
-   MAKE_EXTHDR(opt->ip6po_hbh, _hbh);
+   MAKE_EXTHDR(opt->ip6po_hbh, _hbh, optlen);
+
/* Destination options header (1st part). */
if (opt->ip6po_rthdr) {
+#ifndef RTHDR_SUPPORT_IMPLEMENTED
/*
+* If there is a routing header, discard the packet
+* right away here. RH0/1 are obsolete and we do not
+* currently support RH2/3/4.
+* People trying to use RH253/254 may want to disable
+* this check.
+* The moment we do support any routing header (again)
+* this block should check the routing type more
+* 

svn commit: r358071 - head/sys/netinet6

2020-02-18 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Feb 18 11:28:00 2020
New Revision: 358071
URL: https://svnweb.freebsd.org/changeset/base/358071

Log:
  ip6_output: update comments.
  
  Clear up some comments and improve to panic messages.
  
  No functional changes.
  
  MFC after:3 days

Modified:
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet6/ip6_output.c
==
--- head/sys/netinet6/ip6_output.c  Tue Feb 18 11:27:08 2020
(r358070)
+++ head/sys/netinet6/ip6_output.c  Tue Feb 18 11:28:00 2020
(r358071)
@@ -181,7 +181,9 @@ static int copypktopts(struct ip6_pktopts *, struct ip
 do {\
if (m) {\
if (!hdrsplit) \
-   panic("assumption failed: hdr not split"); \
+   panic("%s:%d: assumption failed: "\
+   "hdr not split: hdrsplit %d exthdrs %p",\
+   __func__, __LINE__, hdrsplit, );\
*mtod((m), u_char *) = *(p);\
*(p) = (i);\
p = mtod((m), u_char *);\
@@ -356,8 +358,9 @@ done:
 }
 
 /*
- * IP6 output. The packet in mbuf chain m contains a skeletal IP6
- * header (with pri, len, nxt, hlim, src, dst).
+ * IP6 output.
+ * The packet in mbuf chain m contains a skeletal IP6 header (with pri, len,
+ * nxt, hlim, src, dst).
  * This function may modify ver and hlim only.
  * The mbuf chain containing the packet will be freed.
  * The mbuf opt, if present, will not be freed.
@@ -365,9 +368,8 @@ done:
  * skipped and ro->ro_rt would be used. If ro is present but ro->ro_rt is NULL,
  * then result of route lookup is stored in ro->ro_rt.
  *
- * type of "mtu": rt_mtu is u_long, ifnet.ifr_mtu is int, and
- * nd_ifinfo.linkmtu is u_int32_t.  so we use u_long to hold largest one,
- * which is rt_mtu.
+ * Type of "mtu": rt_mtu is u_long, ifnet.ifr_mtu is int, and nd_ifinfo.linkmtu
+ * is uint32_t.  So we use u_long to hold largest one, which is rt_mtu.
  *
  * ifpp - XXX: just for statistics
  */
@@ -410,7 +412,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
INP_LOCK_ASSERT(inp);
M_SETFIB(m, inp->inp_inc.inc_fibnum);
if ((flags & IP_NODEFAULTFLOWID) == 0) {
-   /* unconditionally set flowid */
+   /* Unconditionally set flowid. */
m->m_pkthdr.flowid = inp->inp_flowid;
M_HASHTYPE_SET(m, inp->inp_flowtype);
}
@@ -436,12 +438,12 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
 
bzero(, sizeof(exthdrs));
if (opt) {
-   /* Hop-by-Hop options header */
+   /* Hop-by-Hop options header. */
MAKE_EXTHDR(opt->ip6po_hbh, _hbh);
-   /* Destination options header(1st part) */
+   /* Destination options header (1st part). */
if (opt->ip6po_rthdr) {
/*
-* Destination options header(1st part)
+* Destination options header (1st part).
 * This only makes sense with a routing header.
 * See Section 9.2 of RFC 3542.
 * Disabling this part just for MIP6 convenience is
@@ -452,9 +454,9 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
 */
MAKE_EXTHDR(opt->ip6po_dest1, _dest1);
}
-   /* Routing header */
+   /* Routing header. */
MAKE_EXTHDR(opt->ip6po_rthdr, _rthdr);
-   /* Destination options header(2nd part) */
+   /* Destination options header (2nd part). */
MAKE_EXTHDR(opt->ip6po_dest2, _dest2);
}
 
@@ -471,7 +473,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
optlen += exthdrs.ip6e_rthdr->m_len;
unfragpartlen = optlen + sizeof(struct ip6_hdr);
 
-   /* NOTE: we don't add AH/ESP length here (done in ip6_ipsec_output) */
+   /* NOTE: we don't add AH/ESP length here (done in ip6_ipsec_output). */
if (exthdrs.ip6e_dest2)
optlen += exthdrs.ip6e_dest2->m_len;
 
@@ -490,7 +492,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
 
ip6 = mtod(m, struct ip6_hdr *);
 
-   /* adjust mbuf packet header length */
+   /* Adjust mbuf packet header length. */
m->m_pkthdr.len += optlen;
plen = m->m_pkthdr.len - sizeof(*ip6);
 
@@ -504,7 +506,7 @@ ip6_output(struct mbuf *m0, struct ip6_pktopts *opt,
m = exthdrs.ip6e_ip6;
hdrsplit++;
}
-   /* adjust pointer */
+   /* Adjust pointer. */
ip6 = mtod(m, struct ip6_hdr *);
if ((error = ip6_insert_jumboopt(, plen)) != 0)
goto freehdrs;
@@ -516,26 +518,29 @@ 

svn commit: r358020 - in head: . lib/libkvm sys/net sys/sys

2020-02-17 Thread Bjoern A. Zeeb
Author: bz
Date: Mon Feb 17 11:08:50 2020
New Revision: 358020
URL: https://svnweb.freebsd.org/changeset/base/358020

Log:
  Partially revert VNET change and expand VNET structure.
  
  Revert parts of r353274 replacing vnet_state with a shutdown flag.
  
  Not having the state flag for the current SI_SUB_* makes it harder to debug
  kernel or module panics related to VNET bringup or teardown.
  Not having the state also does not allow us to check for other dependency
  levels between components, e.g. for moving interfaces.
  
  Expand the VNET structure with the new boolean flag indicating that we are
  doing a shutdown of a given vnet and update the vnet magic cookie for the
  change.
  
  Update libkvm to compile with a bool in the kernel struct.
  
  Bump __FreeBSD_version for (external) module builds to more easily detect
  the change.
  
  Reviewed by:  hselasky
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D23097

Modified:
  head/UPDATING
  head/lib/libkvm/kvm.c
  head/lib/libkvm/kvm_private.c
  head/lib/libkvm/kvm_vnet.c
  head/sys/net/if.c
  head/sys/net/vnet.c
  head/sys/net/vnet.h
  head/sys/sys/param.h

Modified: head/UPDATING
==
--- head/UPDATING   Mon Feb 17 09:59:28 2020(r358019)
+++ head/UPDATING   Mon Feb 17 11:08:50 2020(r358020)
@@ -26,6 +26,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20200217:
+   The size of struct vnet and the magic cookie have changed.
+   Users need to recompile libkvm and all modules using VIMAGE
+   together with their new kernel.
+
 20200212:
Defining the long deprecated NO_CTF, NO_DEBUG_FILES, NO_INSTALLLIB,
NO_MAN, NO_PROFILE, and NO_WARNS variables is now an error.  Update

Modified: head/lib/libkvm/kvm.c
==
--- head/lib/libkvm/kvm.c   Mon Feb 17 09:59:28 2020(r358019)
+++ head/lib/libkvm/kvm.c   Mon Feb 17 11:08:50 2020(r358020)
@@ -49,6 +49,7 @@ __SCCSID("@(#)kvm.c   8.2 (Berkeley) 2/13/94");
 #include 
 #include 
 
+#include 
 #include 
 
 #include 

Modified: head/lib/libkvm/kvm_private.c
==
--- head/lib/libkvm/kvm_private.c   Mon Feb 17 09:59:28 2020
(r358019)
+++ head/lib/libkvm/kvm_private.c   Mon Feb 17 11:08:50 2020
(r358020)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 
 #include 

Modified: head/lib/libkvm/kvm_vnet.c
==
--- head/lib/libkvm/kvm_vnet.c  Mon Feb 17 09:59:28 2020(r358019)
+++ head/lib/libkvm/kvm_vnet.c  Mon Feb 17 11:08:50 2020(r358020)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
 #include 
 
 #include 

Modified: head/sys/net/if.c
==
--- head/sys/net/if.c   Mon Feb 17 09:59:28 2020(r358019)
+++ head/sys/net/if.c   Mon Feb 17 11:08:50 2020(r358020)
@@ -322,6 +322,11 @@ SX_SYSINIT_FLAGS(ifnet_sx, _sxlock, "ifnet_sx", 
  */
 #defineIFNET_HOLD  (void *)(uintptr_t)(-1)
 
+#ifdef VIMAGE
+#defineVNET_IS_SHUTTING_DOWN(_vnet)
\
+((_vnet)->vnet_shutdown && (_vnet)->vnet_state < SI_SUB_VNET_DONE)
+#endif
+
 static if_com_alloc_t *if_com_alloc[256];
 static if_com_free_t *if_com_free[256];
 
@@ -1080,7 +1085,7 @@ if_detach_internal(struct ifnet *ifp, int vmove, struc
 #ifdef VIMAGE
bool shutdown;
 
-   shutdown = ifp->if_vnet->vnet_shutdown;
+   shutdown = VNET_IS_SHUTTING_DOWN(ifp->if_vnet);
 #endif
IFNET_WLOCK();
CK_STAILQ_FOREACH(iter, _ifnet, if_link)
@@ -1339,6 +1344,7 @@ if_vmove_loan(struct thread *td, struct ifnet *ifp, ch
struct prison *pr;
struct ifnet *difp;
int error;
+   bool shutdown;
 
/* Try to find the prison within our visibility. */
sx_slock(_lock);
@@ -1366,7 +1372,8 @@ if_vmove_loan(struct thread *td, struct ifnet *ifp, ch
}
 
/* Make sure the VNET is stable. */
-   if (ifp->if_vnet->vnet_shutdown) {
+   shutdown = VNET_IS_SHUTTING_DOWN(ifp->if_vnet);
+   if (shutdown) {
CURVNET_RESTORE();
prison_free(pr);
return (EBUSY);
@@ -1391,6 +1398,7 @@ if_vmove_reclaim(struct thread *td, char *ifname, int 
struct vnet *vnet_dst;
struct ifnet *ifp;
int error;
+   bool shutdown;
 
/* Try to find the prison within our visibility. */
sx_slock(_lock);
@@ -1419,7 +1427,8 @@ if_vmove_reclaim(struct thread *td, char *ifname, int 
}
 

svn commit: r356986 - head/sys/netinet

2020-01-22 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Jan 22 15:06:59 2020
New Revision: 356986
URL: https://svnweb.freebsd.org/changeset/base/356986

Log:
  Fix NOINET kernels after r356983.
  
  All gotos to the label are within the #ifdef INET section, which leaves
  us with an unused label.  Cover the label under #ifdef INET as well to
  avoid the warning and compile time error.

Modified:
  head/sys/netinet/tcp_usrreq.c

Modified: head/sys/netinet/tcp_usrreq.c
==
--- head/sys/netinet/tcp_usrreq.c   Wed Jan 22 14:07:27 2020
(r356985)
+++ head/sys/netinet/tcp_usrreq.c   Wed Jan 22 15:06:59 2020
(r356986)
@@ -679,7 +679,9 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n
tcp_timer_activate(tp, TT_KEEP, TP_KEEPINIT(tp));
NET_EPOCH_ENTER(et);
error = tp->t_fb->tfb_tcp_output(tp);
+#ifdef INET
 out_in_epoch:
+#endif
NET_EPOCH_EXIT(et);
 out:
/*
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356662 - head/sys/netinet6

2020-01-12 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Jan 12 17:41:09 2020
New Revision: 356662
URL: https://svnweb.freebsd.org/changeset/base/356662

Log:
  nd6_rtr: constantly use __func__ for nd6log()
  
  Over time one or two hard coded function names did not match the
  actual function anymore.  Consistently use __func__ for nd6log() calls
  and re-wrap/re-format some messages for consitency.
  
  MFC after:2 weeks

Modified:
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/netinet6/nd6_rtr.c
==
--- head/sys/netinet6/nd6_rtr.c Sun Jan 12 16:58:21 2020(r356661)
+++ head/sys/netinet6/nd6_rtr.c Sun Jan 12 17:41:09 2020(r356662)
@@ -177,7 +177,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len)
ip6 = mtod(m, struct ip6_hdr *);
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
-   "nd6_rs_input: invalid hlim (%d) from %s to %s on %s\n",
+   "%s: invalid hlim (%d) from %s to %s on %s\n", __func__,
ip6->ip6_hlim, ip6_sprintf(ip6bufs, >ip6_src),
ip6_sprintf(ip6bufd, >ip6_dst), if_name(ifp)));
goto bad;
@@ -205,7 +205,7 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len)
nd6_option_init(nd_rs + 1, icmp6len, );
if (nd6_options() < 0) {
nd6log((LOG_INFO,
-   "nd6_rs_input: invalid ND option, ignored\n"));
+   "%s: invalid ND option, ignored\n", __func__));
/* nd6_options have incremented stats */
goto freeit;
}
@@ -219,9 +219,8 @@ nd6_rs_input(struct mbuf *m, int off, int icmp6len)
 
if (lladdr && ((ifp->if_addrlen + 2 + 7) & ~7) != lladdrlen) {
nd6log((LOG_INFO,
-   "nd6_rs_input: lladdrlen mismatch for %s "
-   "(if %d, RS packet %d)\n",
-   ip6_sprintf(ip6bufs, ),
+   "%s: lladdrlen mismatch for %s (if %d, RS packet %d)\n",
+   __func__, ip6_sprintf(ip6bufs, ),
ifp->if_addrlen, lladdrlen - 2));
goto bad;
}
@@ -377,7 +376,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
ip6 = mtod(m, struct ip6_hdr *);
if (ip6->ip6_hlim != 255) {
nd6log((LOG_ERR,
-   "nd6_ra_input: invalid hlim (%d) from %s to %s on %s\n",
+   "%s: invalid hlim (%d) from %s to %s on %s\n", __func__,
ip6->ip6_hlim, ip6_sprintf(ip6bufs, >ip6_src),
ip6_sprintf(ip6bufd, >ip6_dst), if_name(ifp)));
goto bad;
@@ -386,7 +385,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
saddr6 = ip6->ip6_src;
if (!IN6_IS_ADDR_LINKLOCAL()) {
nd6log((LOG_ERR,
-   "nd6_ra_input: src %s is not link-local\n",
+   "%s: src %s is not link-local\n", __func__,
ip6_sprintf(ip6bufs, )));
goto bad;
}
@@ -405,7 +404,7 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
nd6_option_init(nd_ra + 1, icmp6len, );
if (nd6_options() < 0) {
nd6log((LOG_INFO,
-   "nd6_ra_input: invalid ND option, ignored\n"));
+   "%s: invalid ND option, ignored\n", __func__));
/* nd6_options have incremented stats */
goto freeit;
}
@@ -482,26 +481,25 @@ nd6_ra_input(struct mbuf *m, int off, int icmp6len)
 
if (pi->nd_opt_pi_len != 4) {
nd6log((LOG_INFO,
-   "nd6_ra_input: invalid option "
-   "len %d for prefix information option, "
-   "ignored\n", pi->nd_opt_pi_len));
+   "%s: invalid option len %d for prefix "
+   "information option, ignored\n", __func__,
+   pi->nd_opt_pi_len));
continue;
}
 
if (128 < pi->nd_opt_pi_prefix_len) {
nd6log((LOG_INFO,
-   "nd6_ra_input: invalid prefix "
-   "len %d for prefix information option, "
-   "ignored\n", pi->nd_opt_pi_prefix_len));
+   "%s: invalid prefix len %d for prefix "
+   "information option, ignored\n", __func__,
+   pi->nd_opt_pi_prefix_len));
continue;
}
 
if (IN6_IS_ADDR_MULTICAST(>nd_opt_pi_prefix)
 || IN6_IS_ADDR_LINKLOCAL(>nd_opt_pi_prefix)) {
nd6log((LOG_INFO,
- 

svn commit: r356661 - head/sys/netinet6

2020-01-12 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Jan 12 16:58:21 2020
New Revision: 356661
URL: https://svnweb.freebsd.org/changeset/base/356661

Log:
  nd6_rtr: make nd6_prefix_onlink() static
  
  nd6_prefix_onlink() is not used anywhere outside nd6_rtr.c.  Stop
  exporting it and make it file local static.

Modified:
  head/sys/netinet6/nd6.h
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/netinet6/nd6.h
==
--- head/sys/netinet6/nd6.h Sun Jan 12 15:45:27 2020(r356660)
+++ head/sys/netinet6/nd6.h Sun Jan 12 16:58:21 2020(r356661)
@@ -418,7 +418,6 @@ void nd6_prefix_unlink(struct nd_prefix *, struct nd_p
 void nd6_prefix_del(struct nd_prefix *);
 void nd6_prefix_ref(struct nd_prefix *);
 void nd6_prefix_rele(struct nd_prefix *);
-int nd6_prefix_onlink(struct nd_prefix *);
 int nd6_prefix_offlink(struct nd_prefix *);
 void pfxlist_onlink_check(void);
 struct nd_prefix *nd6_prefix_lookup(struct nd_prefixctl *);

Modified: head/sys/netinet6/nd6_rtr.c
==
--- head/sys/netinet6/nd6_rtr.c Sun Jan 12 15:45:27 2020(r356660)
+++ head/sys/netinet6/nd6_rtr.c Sun Jan 12 16:58:21 2020(r356661)
@@ -76,6 +76,7 @@ __FBSDID("$FreeBSD$");
 static struct nd_defrouter *defrtrlist_update(struct nd_defrouter *);
 static int prelist_update(struct nd_prefixctl *, struct nd_defrouter *,
 struct mbuf *, int);
+static int nd6_prefix_onlink(struct nd_prefix *);
 
 TAILQ_HEAD(nd6_drhead, nd_defrouter);
 VNET_DEFINE_STATIC(struct nd6_drhead, nd6_defrouter);
@@ -2088,7 +2089,7 @@ nd6_prefix_onlink_rtrequest(struct nd_prefix *pr, stru
return (a_failure);
 }
 
-int
+static int
 nd6_prefix_onlink(struct nd_prefix *pr)
 {
struct epoch_tracker et;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356638 - head/sys/netinet6

2020-01-11 Thread Bjoern A. Zeeb
Author: bz
Date: Sat Jan 11 18:55:12 2020
New Revision: 356638
URL: https://svnweb.freebsd.org/changeset/base/356638

Log:
  in6_mcast: make in6_joingroup_locked() static
  
  in6_joingroup_locked() is only used file-local. No need to export it
  hance make it static.

Modified:
  head/sys/netinet6/in6_mcast.c
  head/sys/netinet6/in6_var.h

Modified: head/sys/netinet6/in6_mcast.c
==
--- head/sys/netinet6/in6_mcast.c   Sat Jan 11 18:36:10 2020
(r356637)
+++ head/sys/netinet6/in6_mcast.c   Sat Jan 11 18:55:12 2020
(r356638)
@@ -121,8 +121,6 @@ MTX_SYSINIT(in6_multi_free_mtx, _multi_free_mtx, "
 struct sx in6_multi_sx;
 SX_SYSINIT(in6_multi_sx, _multi_sx, "in6_multi_sx");
 
-
-
 static voidim6f_commit(struct in6_mfilter *);
 static int im6f_get_source(struct in6_mfilter *imf,
const struct sockaddr_in6 *psin,
@@ -144,6 +142,8 @@ static void im6s_merge(struct ip6_msource *ims,
const struct in6_msource *lims, const int rollback);
 static int in6_getmulti(struct ifnet *, const struct in6_addr *,
struct in6_multi **);
+static int in6_joingroup_locked(struct ifnet *, const struct in6_addr *,
+   struct in6_mfilter *, struct in6_multi **, int);
 static int in6m_get_source(struct in6_multi *inm,
const struct in6_addr *addr, const int noalloc,
struct ip6_msource **pims);
@@ -1197,7 +1197,7 @@ in6_joingroup(struct ifnet *ifp, const struct in6_addr
  * If the MLD downcall fails, the group is not joined, and an error
  * code is returned.
  */
-int
+static int
 in6_joingroup_locked(struct ifnet *ifp, const struct in6_addr *mcaddr,
 /*const*/ struct in6_mfilter *imf, struct in6_multi **pinm,
 const int delay)

Modified: head/sys/netinet6/in6_var.h
==
--- head/sys/netinet6/in6_var.h Sat Jan 11 18:36:10 2020(r356637)
+++ head/sys/netinet6/in6_var.h Sat Jan 11 18:55:12 2020(r356638)
@@ -863,8 +863,6 @@ int im6o_mc_filter(const struct ip6_moptions *, const 
const struct sockaddr *, const struct sockaddr *);
 int in6_joingroup(struct ifnet *, const struct in6_addr *,
struct in6_mfilter *, struct in6_multi **, int);
-intin6_joingroup_locked(struct ifnet *, const struct in6_addr *,
-   struct in6_mfilter *, struct in6_multi **, int);
 intin6_leavegroup(struct in6_multi *, struct in6_mfilter *);
 intin6_leavegroup_locked(struct in6_multi *, struct in6_mfilter *);
 void   in6m_clear_recorded(struct in6_multi *);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356528 - head/libexec/rc/rc.d

2020-01-08 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Jan  8 23:34:50 2020
New Revision: 356528
URL: https://svnweb.freebsd.org/changeset/base/356528

Log:
  Run netoptions startup script in vnet jails.
  
  People use rc.conf inside vnet jails to configure networking setups.
  Presumably because some sysctl were not virtualised up until r356527 the
  script was not run for vnet jails leaving the rc.conf options without
  effect for non-obvious reasons.  Run the netoptions startup script also
  for VNET jails now to make the rc.conf options work.
  
  PR:   243193
  MFC after:2 weeks

Modified:
  head/libexec/rc/rc.d/netoptions

Modified: head/libexec/rc/rc.d/netoptions
==
--- head/libexec/rc/rc.d/netoptions Wed Jan  8 23:30:26 2020
(r356527)
+++ head/libexec/rc/rc.d/netoptions Wed Jan  8 23:34:50 2020
(r356528)
@@ -6,7 +6,7 @@
 # PROVIDE: netoptions
 # REQUIRE: FILESYSTEMS
 # BEFORE: netif
-# KEYWORD: nojail
+# KEYWORD: nojailvnet
 
 . /etc/rc.subr
 . /etc/network.subr
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r356527 - in head/sys: dev/cxgbe/tom netinet netinet/tcp_stacks netinet6

2020-01-08 Thread Bjoern A. Zeeb
Author: bz
Date: Wed Jan  8 23:30:26 2020
New Revision: 356527
URL: https://svnweb.freebsd.org/changeset/base/356527

Log:
  vnet: virtualise more network stack sysctls.
  
  Virtualise tcp_always_keepalive, TCP and UDP log_in_vain.  All three are
  set in the netoptions startup script, which we would love to run for VNETs
  as well [1].
  
  While virtualising the log_in_vain sysctls seems pointles at first for as
  long as the kernel message buffer is not virtualised, it at least allows
  an administrator to debug the base system or an individual jail if needed
  without turning the logging on for all jails running on a system.
  
  PR:   243193 [1]
  MFC after:2 weeks

Modified:
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_stacks/bbr.c
  head/sys/netinet/tcp_stacks/rack.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_timer.c
  head/sys/netinet/tcp_timer.h
  head/sys/netinet/tcp_var.h
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet/udp_var.h
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==
--- head/sys/dev/cxgbe/tom/t4_tom.c Wed Jan  8 23:06:13 2020
(r356526)
+++ head/sys/dev/cxgbe/tom/t4_tom.c Wed Jan  8 23:30:26 2020
(r356527)
@@ -1146,7 +1146,7 @@ init_conn_params(struct vi_info *vi , struct offload_s
cp->nagle = tp->t_flags & TF_NODELAY ? 0 : 1;
 
/* TCP Keepalive. */
-   if (tcp_always_keepalive || so_options_get(so) & SO_KEEPALIVE)
+   if (V_tcp_always_keepalive || so_options_get(so) & SO_KEEPALIVE)
cp->keepalive = 1;
else
cp->keepalive = 0;

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cWed Jan  8 23:06:13 2020
(r356526)
+++ head/sys/netinet/tcp_input.cWed Jan  8 23:30:26 2020
(r356527)
@@ -132,9 +132,9 @@ __FBSDID("$FreeBSD$");
 
 const int tcprexmtthresh = 3;
 
-int tcp_log_in_vain = 0;
-SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_in_vain, CTLFLAG_RW,
-_log_in_vain, 0,
+VNET_DEFINE(int, tcp_log_in_vain) = 0;
+SYSCTL_INT(_net_inet_tcp, OID_AUTO, log_in_vain, CTLFLAG_VNET | CTLFLAG_RW,
+_NAME(tcp_log_in_vain), 0,
 "Log all incoming TCP segments to closed ports");
 
 VNET_DEFINE(int, blackhole) = 0;
@@ -892,8 +892,8 @@ findpcb:
 * Log communication attempts to ports that are not
 * in use.
 */
-   if ((tcp_log_in_vain == 1 && (thflags & TH_SYN)) ||
-   tcp_log_in_vain == 2) {
+   if ((V_tcp_log_in_vain == 1 && (thflags & TH_SYN)) ||
+   V_tcp_log_in_vain == 2) {
if ((s = tcp_log_vain(NULL, th, (void *)ip, ip6)))
log(LOG_INFO, "%s; %s: Connection attempt "
"to closed port\n", s, __func__);

Modified: head/sys/netinet/tcp_stacks/bbr.c
==
--- head/sys/netinet/tcp_stacks/bbr.c   Wed Jan  8 23:06:13 2020
(r356526)
+++ head/sys/netinet/tcp_stacks/bbr.c   Wed Jan  8 23:30:26 2020
(r356527)
@@ -835,7 +835,7 @@ bbr_start_hpts_timer(struct tcp_bbr *bbr, struct tcpcb
 */
if ((hpts_timeout == 0) &&
(slot == 0)) {
-   if ((tcp_always_keepalive || inp->inp_socket->so_options & 
SO_KEEPALIVE) &&
+   if ((V_tcp_always_keepalive || inp->inp_socket->so_options & 
SO_KEEPALIVE) &&
(tp->t_state <= TCPS_CLOSING)) {
/*
 * Ok we have no timer (persists, rack, tlp, rxt  or
@@ -998,7 +998,7 @@ bbr_timer_audit(struct tcpcb *tp, struct tcp_bbr *bbr,
 * (and the hptsi timer).
 */
return;
-   } else if (((tcp_always_keepalive ||
+   } else if (((V_tcp_always_keepalive ||
inp->inp_socket->so_options & SO_KEEPALIVE) &&
(tp->t_state <= TCPS_CLOSING)) &&
(tmr_up == PACE_TMR_KEEP) &&
@@ -4919,7 +4919,7 @@ bbr_timeout_keepalive(struct tcpcb *tp, struct tcp_bbr
TCPSTAT_INC(tcps_keeptimeo);
if (tp->t_state < TCPS_ESTABLISHED)
goto dropit;
-   if ((tcp_always_keepalive || inp->inp_socket->so_options & 
SO_KEEPALIVE) &&
+   if ((V_tcp_always_keepalive || inp->inp_socket->so_options & 
SO_KEEPALIVE) &&
tp->t_state <= TCPS_CLOSING) {
if (ticks - tp->t_rcvtime >= TP_KEEPIDLE(tp) + TP_MAXIDLE(tp))
goto dropit;
@@ -11790,7 +11790,7 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr 
((bbr->r_ctl.rc_hpts_flags & PACE_TMR_MASK) == 0) &&
  

svn commit: r356386 - head/sys/netgraph

2020-01-05 Thread Bjoern A. Zeeb
Author: bz
Date: Sun Jan  5 19:14:16 2020
New Revision: 356386
URL: https://svnweb.freebsd.org/changeset/base/356386

Log:
  netgraph/ng_bridge: Reestablish old ABI
  
  In order to be able to merge r353026 bring back support for the old
  cookie API for a transition period in 12.x releases (and possibly 13)
  before the old API can be removed again entirely.
  
  Suggested by: julian
  Submitted by: Lutz Donnerhacke (lutz donnerhacke.de)
  PR:   240787
  Reviewed by:  julian
  MFC after:2 weeks
  X-MFC with:   r353026
  Differential Revision:https://reviews.freebsd.org/D21961

Modified:
  head/sys/netgraph/ng_bridge.c
  head/sys/netgraph/ng_bridge.h

Modified: head/sys/netgraph/ng_bridge.c
==
--- head/sys/netgraph/ng_bridge.c   Sun Jan  5 18:15:41 2020
(r356385)
+++ head/sys/netgraph/ng_bridge.c   Sun Jan  5 19:14:16 2020
(r356386)
@@ -393,6 +393,72 @@ ng_bridge_rcvmsg(node_p node, item_p item, hook_p last
 
NGI_GET_MSG(item, msg);
switch (msg->header.typecookie) {
+#ifdef NGM_BRIDGE_TABLE_ABI
+   case NGM_BRIDGE_COOKIE_TBL:
+   switch (msg->header.cmd) {
+   case NGM_BRIDGE_GET_CONFIG:
+   {
+   struct ng_bridge_config_tbl *conf;
+
+   NG_MKRESPONSE(resp, msg, sizeof(*conf),
+   M_NOWAIT|M_ZERO);
+   if (resp == NULL) {
+   error = ENOMEM;
+   break;
+   }
+   conf = (struct ng_bridge_config_tbl *)resp->data;
+   conf->cfg = priv->conf;
+   break;
+   }
+   case NGM_BRIDGE_SET_CONFIG:
+   {
+   struct ng_bridge_config_tbl *conf;
+
+   if (msg->header.arglen != sizeof(*conf)) {
+   error = EINVAL;
+   break;
+   }
+   conf = (struct ng_bridge_config_tbl *)msg->data;
+   priv->conf = conf->cfg;
+   break;
+   }
+   case NGM_BRIDGE_GET_TABLE:
+   {
+   struct ng_bridge_host_tbl_ary *ary;
+   struct ng_bridge_hent *hent;
+   int i, bucket;
+
+   NG_MKRESPONSE(resp, msg, sizeof(*ary) +
+   (priv->numHosts * sizeof(*ary->hosts)), M_NOWAIT);
+   if (resp == NULL) {
+   error = ENOMEM;
+   break;
+   }
+   ary = (struct ng_bridge_host_tbl_ary *)resp->data;
+   ary->numHosts = priv->numHosts;
+   i = 0;
+   for (bucket = 0; bucket < priv->numBuckets; bucket++) {
+   SLIST_FOREACH(hent, >tab[bucket], next) {
+   memcpy(ary->hosts[i].addr,
+   hent->host.addr,
+   sizeof(ary->hosts[i].addr));
+   ary->hosts[i].age = hent->host.age;
+   ary->hosts[i].staleness =
+hent->host.staleness;
+   ary->hosts[i].linkNum = strtol(
+   NG_HOOK_NAME(hent->host.link->hook) 
+
+   strlen(NG_BRIDGE_HOOK_LINK_PREFIX),
+   NULL, 10);
+   i++;
+   }
+   }
+   break;
+   }
+   }
+   /* If already handled break, otherwise use new ABI. */
+   if (resp != NULL || error != 0)
+   break;
+#endif /* NGM_BRIDGE_TABLE_ABI */
case NGM_BRIDGE_COOKIE:
switch (msg->header.cmd) {
case NGM_BRIDGE_GET_CONFIG:

Modified: head/sys/netgraph/ng_bridge.h
==
--- head/sys/netgraph/ng_bridge.h   Sun Jan  5 18:15:41 2020
(r356385)
+++ head/sys/netgraph/ng_bridge.h   Sun Jan  5 19:14:16 2020
(r356386)
@@ -43,10 +43,24 @@
 #ifndef _NETGRAPH_NG_BRIDGE_H_
 #define _NETGRAPH_NG_BRIDGE_H_
 
+/*
+ * Support the older ABI based on fixed size tables.
+ * ABI is deprecated, to be removed in releases > 12
+ * Please note: There is no API support!
+ * You canno create new messages using the old API but messages conforming the
+ * old ABI are understood.
+ */
+#defineNGM_BRIDGE_TABLE_ABI
+
 /* Node type name and magic 

Re: svn commit: r355554 - head/usr.bin/netstat

2019-12-09 Thread Bjoern A. Zeeb

On 9 Dec 2019, at 10:21, Baptiste Daroussin wrote:


Author: bapt
Date: Mon Dec  9 10:21:24 2019
New Revision: 34
URL: https://svnweb.freebsd.org/changeset/base/34

Log:
  Fix: netstat -rs

  Routing statistics requires somes symbols that are only loaded when 
not running

  live. Load them only in that specific case



We should really make sure we can get them another way and don’t need 
this.

Of course that’s another issue ;-)

/bz
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r355449 - head/sys/netinet

2019-12-06 Thread Bjoern A. Zeeb

On 6 Dec 2019, at 22:09, Gleb Smirnoff wrote:


   Hi,

there is a functional change here:

On Fri, Dec 06, 2019 at 04:35:48PM +, Bjoern A. Zeeb wrote:
B> URL: https://svnweb.freebsd.org/changeset/base/355449
B>
B> Log:
B>   carp: replace caddr_t with char *
B>
B>   Change the remaining caddr_t usages to char * following the 
removal

B>   of the KAME macros
B>
B>   No functional change.
...
B> @@ -978,6 +978,7 @@ carp_send_ad_locked(struct carp_softc *sc)
B>  #endif /* INET */
B>  #ifdef INET6
B>   if (sc->sc_naddrs6) {
B> + struct epoch_tracker et;
B>   struct ip6_hdr *ip6;
B>
B>   m = m_gethdr(M_NOWAIT, MT_DATA);
B> @@ -1031,8 +1032,10 @@ carp_send_ad_locked(struct carp_softc *sc)
B>
B>   CARPSTATS_INC(carps_opackets6);
B>
B> + NET_EPOCH_ENTER(et);
B>   carp_send_ad_error(sc, ip6_output(m, NULL, NULL, 0,
B>   >sc_carpdev->if_carp->cif_im6o, NULL, NULL));
B> + NET_EPOCH_EXIT(et);
B>   }
B>  #endif /* INET6 */

This could be correct change, just needs some explanation.


Sorry.  My bad.  I had a patch from a different branch applied in 
between review and commit and forgot to clean up before committing.


I’ll put the epoch changes up for review the next hours/days.  I have 
reverted this part in the meantime in 355466.


Thanks for catching this.

/bz


___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r355466 - head/sys/netinet

2019-12-06 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Dec  6 22:20:26 2019
New Revision: 355466
URL: https://svnweb.freebsd.org/changeset/base/355466

Log:
  Remove the extra epoch tracker change sneaked into r355449 and was not part
  of the originally reviewed or described change.
  
  Pointyhat to:   bz
  Reported by:glebius

Modified:
  head/sys/netinet/ip_carp.c

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Fri Dec  6 22:12:39 2019(r355465)
+++ head/sys/netinet/ip_carp.c  Fri Dec  6 22:20:26 2019(r355466)
@@ -978,7 +978,6 @@ carp_send_ad_locked(struct carp_softc *sc)
 #endif /* INET */
 #ifdef INET6
if (sc->sc_naddrs6) {
-   struct epoch_tracker et;
struct ip6_hdr *ip6;
 
m = m_gethdr(M_NOWAIT, MT_DATA);
@@ -1032,10 +1031,8 @@ carp_send_ad_locked(struct carp_softc *sc)
 
CARPSTATS_INC(carps_opackets6);
 
-   NET_EPOCH_ENTER(et);
carp_send_ad_error(sc, ip6_output(m, NULL, NULL, 0,
>sc_carpdev->if_carp->cif_im6o, NULL, NULL));
-   NET_EPOCH_EXIT(et);
}
 #endif /* INET6 */
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r355452 - head/sys/netinet6

2019-12-06 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Dec  6 16:53:42 2019
New Revision: 355452
URL: https://svnweb.freebsd.org/changeset/base/355452

Log:
  Update comment.
  
  Update the comment related to SIIT and v4mapped addresses being rejected
  by us when coming from the wire given we have supported IPv6-only kernels
  for a few years now.
  See also draft-itojun-v6ops-v4mapped-harmful.
  
  Suggested by: melifaro
  MFC after:2 weeks

Modified:
  head/sys/netinet6/ip6_input.c

Modified: head/sys/netinet6/ip6_input.c
==
--- head/sys/netinet6/ip6_input.c   Fri Dec  6 16:48:36 2019
(r355451)
+++ head/sys/netinet6/ip6_input.c   Fri Dec  6 16:53:42 2019
(r355452)
@@ -677,11 +677,10 @@ ip6_input(struct mbuf *m)
 * and bypass security checks (act as if it was from 127.0.0.1 by using
 * IPv6 src :::127.0.0.1).  Be cautious.
 *
-* This check chokes if we are in an SIIT cloud.  As none of BSDs
-* support IPv4-less kernel compilation, we cannot support SIIT
-* environment at all.  So, it makes more sense for us to reject any
-* malicious packets for non-SIIT environment, than try to do a
-* partial support for SIIT environment.
+* We have supported IPv6-only kernels for a few years and this issue
+* has not come up.  The world seems to move mostly towards not using
+* v4mapped on the wire, so it makes sense for us to keep rejecting
+* any such packets.
 */
if (IN6_IS_ADDR_V4MAPPED(>ip6_src) ||
IN6_IS_ADDR_V4MAPPED(>ip6_dst)) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r355450 - head/sys/netinet6

2019-12-06 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Dec  6 16:42:58 2019
New Revision: 355450
URL: https://svnweb.freebsd.org/changeset/base/355450

Log:
  ip6_input: remove redundant v4mapped check
  
  In ip6_input() we apply the same v4mapped address check twice. The only
  case which skipps the first one is M_FASTFWD_OURS which should have passed
  the check on the firstinput pass and passed the firewall.
  Remove the 2nd redundant check.
  
  Reviewed by:  kp, melifaro
  MFC after:2 weeks
  Sponsored by: Netflix (originally)
  Differential Revision:https://reviews.freebsd.org/D22462

Modified:
  head/sys/netinet6/ip6_input.c

Modified: head/sys/netinet6/ip6_input.c
==
--- head/sys/netinet6/ip6_input.c   Fri Dec  6 16:35:48 2019
(r355449)
+++ head/sys/netinet6/ip6_input.c   Fri Dec  6 16:42:58 2019
(r355450)
@@ -897,24 +897,6 @@ passin:
return;
}
 
-   ip6 = mtod(m, struct ip6_hdr *);
-
-   /*
-* Malicious party may be able to use IPv4 mapped addr to confuse
-* tcp/udp stack and bypass security checks (act as if it was from
-* 127.0.0.1 by using IPv6 src :::127.0.0.1).  Be cautious.
-*
-* For SIIT end node behavior, you may want to disable the check.
-* However, you will  become vulnerable to attacks using IPv4 mapped
-* source.
-*/
-   if (IN6_IS_ADDR_V4MAPPED(>ip6_src) ||
-   IN6_IS_ADDR_V4MAPPED(>ip6_dst)) {
-   IP6STAT_INC(ip6s_badscope);
-   in6_ifstat_inc(rcvif, ifs6_in_addrerr);
-   goto bad;
-   }
-
/*
 * Tell launch routine the next header
 */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r355449 - head/sys/netinet

2019-12-06 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Dec  6 16:35:48 2019
New Revision: 355449
URL: https://svnweb.freebsd.org/changeset/base/355449

Log:
  carp: replace caddr_t with char *
  
  Change the remaining caddr_t usages to char * following the removal
  of the KAME macros
  
  No functional change.
  
  Requested by: glebius
  Reviewed by:  glebius
  MFC after:2 weeks
  Sponsored by: Netflix (originally)
  Differential Revision:https://reviews.freebsd.org/D22399

Modified:
  head/sys/netinet/ip_carp.c
  head/sys/netinet/ip_carp.h

Modified: head/sys/netinet/ip_carp.c
==
--- head/sys/netinet/ip_carp.c  Fri Dec  6 16:34:04 2019(r355448)
+++ head/sys/netinet/ip_carp.c  Fri Dec  6 16:35:48 2019(r355449)
@@ -575,7 +575,7 @@ carp6_input(struct mbuf **mp, int *offp, int proto)
return (IPPROTO_DONE);
}
}
-   ch = (struct carp_header *)(mtod(m, caddr_t) + *offp);
+   ch = (struct carp_header *)(mtod(m, char *) + *offp);
 
 
/* verify the CARP checksum */
@@ -978,6 +978,7 @@ carp_send_ad_locked(struct carp_softc *sc)
 #endif /* INET */
 #ifdef INET6
if (sc->sc_naddrs6) {
+   struct epoch_tracker et;
struct ip6_hdr *ip6;
 
m = m_gethdr(M_NOWAIT, MT_DATA);
@@ -1031,8 +1032,10 @@ carp_send_ad_locked(struct carp_softc *sc)
 
CARPSTATS_INC(carps_opackets6);
 
+   NET_EPOCH_ENTER(et);
carp_send_ad_error(sc, ip6_output(m, NULL, NULL, 0,
>sc_carpdev->if_carp->cif_im6o, NULL, NULL));
+   NET_EPOCH_EXIT(et);
}
 #endif /* INET6 */
 
@@ -1190,7 +1193,7 @@ carp_iamatch6(struct ifnet *ifp, struct in6_addr *tadd
return (ifa);
 }
 
-caddr_t
+char *
 carp_macmatch6(struct ifnet *ifp, struct mbuf *m, const struct in6_addr *taddr)
 {
struct ifaddr *ifa;
@@ -1847,7 +1850,7 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct threa
carp_carprcp(, sc, priveleged);
carpr.carpr_count = count;
error = copyout(,
-   (caddr_t)ifr_data_get_ptr(ifr) +
+   (char *)ifr_data_get_ptr(ifr) +
(i * sizeof(carpr)), sizeof(carpr));
if (error) {
CIF_UNLOCK(ifp->if_carp);

Modified: head/sys/netinet/ip_carp.h
==
--- head/sys/netinet/ip_carp.h  Fri Dec  6 16:34:04 2019(r355448)
+++ head/sys/netinet/ip_carp.h  Fri Dec  6 16:35:48 2019(r355449)
@@ -149,7 +149,7 @@ int carp_output (struct ifnet *, struct mbuf *,
 intcarp_master(struct ifaddr *);
 intcarp_iamatch(struct ifaddr *, uint8_t **);
 struct ifaddr  *carp_iamatch6(struct ifnet *, struct in6_addr *);
-caddr_tcarp_macmatch6(struct ifnet *, struct mbuf *, const 
struct in6_addr *);
+char * carp_macmatch6(struct ifnet *, struct mbuf *, const struct 
in6_addr *);
 intcarp_forus(struct ifnet *, u_char *);
 
 /* These are external networking stack hooks for CARP */
@@ -174,7 +174,7 @@ extern int (*carp_iamatch_p)(struct ifaddr *, uint8_t 
 #ifdef INET6
 /* netinet6/nd6_nbr.c */
 extern struct ifaddr *(*carp_iamatch6_p)(struct ifnet *, struct in6_addr *);
-extern caddr_t (*carp_macmatch6_p)(struct ifnet *, struct mbuf *,
+extern char * (*carp_macmatch6_p)(struct ifnet *, struct mbuf *,
 const struct in6_addr *);
 #endif
 #endif
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r355448 - head/sys/kern

2019-12-06 Thread Bjoern A. Zeeb
Author: bz
Date: Fri Dec  6 16:34:04 2019
New Revision: 355448
URL: https://svnweb.freebsd.org/changeset/base/355448

Log:
  Improve EPOCH_TRACE
  
  Two changes to EPOCH_TRACE:
  (1) add a sysctl to surpress the backtrace from epoch_trace_report().
  Sometimes the log line for the recursion is enough and the
  backtrace massively spams the console.
  (2) In order to be able to go without the backtrace do not only
  print where the previous occurance happened, but also where
  the current one happens.  That way we have file:line information
  for both and can look at them without the need for getting line
  numbers from backtrace and a debugging tool.
  
  Reviewed by:  glebius
  Sponsored by: Netflix (originally)
  Differential Revision:https://reviews.freebsd.org/D22641

Modified:
  head/sys/kern/subr_epoch.c

Modified: head/sys/kern/subr_epoch.c
==
--- head/sys/kern/subr_epoch.c  Fri Dec  6 16:20:22 2019(r355447)
+++ head/sys/kern/subr_epoch.c  Fri Dec  6 16:34:04 2019(r355448)
@@ -169,6 +169,10 @@ RB_GENERATE_STATIC(stacktree, stackentry, se_node, sta
 static struct mtx epoch_stacks_lock;
 MTX_SYSINIT(epochstacks, _stacks_lock, "epoch_stacks", MTX_DEF);
 
+static bool epoch_trace_stack_print = true;
+SYSCTL_BOOL(_kern_epoch, OID_AUTO, trace_stack_print, CTLFLAG_RWTUN,
+_trace_stack_print, 0, "Print stack traces on epoch reports");
+
 static void epoch_trace_report(const char *fmt, ...) __printflike(1, 2);
 static inline void
 epoch_trace_report(const char *fmt, ...)
@@ -197,7 +201,8 @@ epoch_trace_report(const char *fmt, ...)
va_start(ap, fmt);
(void)vprintf(fmt, ap);
va_end(ap);
-   stack_print_ddb(_stack);
+   if (epoch_trace_stack_print)
+   stack_print_ddb(_stack);
 }
 
 static inline void
@@ -209,8 +214,9 @@ epoch_trace_enter(struct thread *td, epoch_t epoch, ep
SLIST_FOREACH(iet, >td_epochs, et_tlink)
if (iet->et_epoch == epoch)
epoch_trace_report("Recursively entering epoch %s "
-   "previously entered at %s:%d\n",
-   epoch->e_name, iet->et_file, iet->et_line);
+   "at %s:%d, previously entered at %s:%d\n",
+   epoch->e_name, file, line,
+   iet->et_file, iet->et_line);
et->et_epoch = epoch;
et->et_file = file;
et->et_line = line;
@@ -223,9 +229,10 @@ epoch_trace_exit(struct thread *td, epoch_t epoch, epo
 {
 
if (SLIST_FIRST(>td_epochs) != et) {
-   epoch_trace_report("Exiting epoch %s in a not nested order. "
-   "Most recently entered %s at %s:%d\n",
+   epoch_trace_report("Exiting epoch %s in a not nested order "
+   "at %s:%d. Most recently entered %s at %s:%d\n",
epoch->e_name,
+   file, line,
SLIST_FIRST(>td_epochs)->et_epoch->e_name,
SLIST_FIRST(>td_epochs)->et_file,
SLIST_FIRST(>td_epochs)->et_line);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r355327 - in head/sys: netinet netinet6

2019-12-03 Thread Bjoern A. Zeeb
Author: bz
Date: Tue Dec  3 14:46:38 2019
New Revision: 355327
URL: https://svnweb.freebsd.org/changeset/base/355327

Log:
  Make icmp6_reflect() static.
  
  icmp6_reflect() is not used anywhere outside icmp6.c, no reason to
  export it.
  
  Sponsored by: Netflix

Modified:
  head/sys/netinet/icmp6.h
  head/sys/netinet6/icmp6.c

Modified: head/sys/netinet/icmp6.h
==
--- head/sys/netinet/icmp6.hTue Dec  3 13:47:46 2019(r355326)
+++ head/sys/netinet/icmp6.hTue Dec  3 14:46:38 2019(r355327)
@@ -701,7 +701,6 @@ voidicmp6_error2(struct mbuf *, int, int, int, 
struct
 inticmp6_input(struct mbuf **, int *, int);
 void   icmp6_fasttimo(void);
 void   icmp6_slowtimo(void);
-void   icmp6_reflect(struct mbuf *, size_t);
 void   icmp6_prepare(struct mbuf *);
 void   icmp6_redirect_input(struct mbuf *, int);
 void   icmp6_redirect_output(struct mbuf *, struct rtentry *);

Modified: head/sys/netinet6/icmp6.c
==
--- head/sys/netinet6/icmp6.c   Tue Dec  3 13:47:46 2019(r355326)
+++ head/sys/netinet6/icmp6.c   Tue Dec  3 14:46:38 2019(r355327)
@@ -137,6 +137,7 @@ VNET_DECLARE(int, icmp6_nodeinfo);
 
 static void icmp6_errcount(int, int);
 static int icmp6_rip6_input(struct mbuf **, int);
+static void icmp6_reflect(struct mbuf *, size_t);
 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 *);
@@ -2034,7 +2035,7 @@ icmp6_rip6_input(struct mbuf **mp, int off)
  * Reflect the ip6 packet back to the source.
  * OFF points to the icmp6 header, counted from the top of the mbuf.
  */
-void
+static void
 icmp6_reflect(struct mbuf *m, size_t off)
 {
struct in6_addr src6, *srcp;
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


  1   2   3   4   5   6   7   8   9   10   >