softraid_crypto.c malloc failure case
Hi, In sr_crypto_change_maskkey() p was being checked for NULL twice, once after malloc() and once at goto label. I think malloc() failure would be the only case where p doesn't need to be freed, so add a special goto label for this. Sorry if I got it wrong. - Michael Index: softraid_crypto.c === RCS file: /cvs/src/sys/dev/softraid_crypto.c,v retrieving revision 1.131 diff -u -p -u -r1.131 softraid_crypto.c --- softraid_crypto.c 8 Sep 2016 17:39:08 - 1.131 +++ softraid_crypto.c 17 Jan 2017 04:34:57 - @@ -548,7 +548,7 @@ sr_crypto_change_maskkey(struct sr_disci ksz = sizeof(sd->mds.mdd_crypto.scr_key); p = malloc(ksz, M_DEVBUF, M_WAITOK | M_CANFAIL | M_ZERO); if (p == NULL) - goto out; + goto out_nomem; if (sr_crypto_decrypt(c, p, kdfinfo1->maskkey, ksz, sd->mds.mdd_crypto.scr_meta->scm_mask_alg) == -1) @@ -597,11 +597,10 @@ sr_crypto_change_maskkey(struct sr_disci rv = 0; /* Success */ out: - if (p) { - explicit_bzero(p, ksz); - free(p, M_DEVBUF, ksz); - } + explicit_bzero(p, ksz); + free(p, M_DEVBUF, ksz); +out_nomem: explicit_bzero(check_digest, sizeof(check_digest)); explicit_bzero(&kdfinfo1->maskkey, sizeof(kdfinfo1->maskkey)); explicit_bzero(&kdfinfo2->maskkey, sizeof(kdfinfo2->maskkey));
Re: NET_LOCK() pr_sysctl
On Mon, Jan 16, 2017 at 07:34:43PM +, Alexander Bluhm wrote: > On Mon, Jan 09, 2017 at 11:55:55PM +0100, Alexander Bluhm wrote: > > On Thu, Dec 22, 2016 at 01:38:17AM +0100, Mateusz Guzik wrote: > > > In this particular case, what happens if the access results in a page > > > fault and the area comes from a nfs mapped file? If network i/o is done > > > from the same context, this should result in 'locking against myself' > > > assertion failure. > > > > I have written a program the sets a sysctl value from a memory > > mapped file mounted on NFS. As expected it panics when NET_LOCK() > > is enabled. > > I was wondering why my test program did only crash during copyin > but never for copyout. For sysctl(2) the copyout does never sleep > as the memory is wired. This is done to avoid races when collecting > data for the oldp. Once more, I'm not familiar with the codebase, only skimmed through so apologies for mistakes (if any). I think the current code is buggy and the approach needs to be adjusted to work. On a more SMP-ified kernel a concurrently running thread can munlock the area or mmap something over it. Then vsunlock executed over it will cause trouble. The same checks used during munlock have to be repeated. Even the current kernel has the problem - since NET_LOCK is a sleepable lock, the caller can be put off the cpu and the newly scheduled thread can do aforementioned shenaningans. Likely there is a similar story for other sysctl handlers. With spurious vsunlock taken care off, we are back to recursive locking due to the area not faulted in. If you want to stick to holding NET_LOCK over copyin/copyout, I suggest introducing _nofault variants - that is, instead of faulting the page in, just return an error. The kernel did what it should by wiring appropriate pages. If you play games by changing the same mappings, the failure is on you. I.e. it will not affect legitimate programs. However, this slows down the general sysctl interface for a corner case. At the very least, a dedicated helper for wiring pages can be introduced and it would be executed by sysctls interested in the facility. > > If I implement the same trick for newp, I can avoid the "netlock > locking against myself" with sysctl on memory mapped files over > NFS. Of course other copyin/copyout paths like pf(4) ioctl(2) still > have to be checked. IPsec pfkey seem to use the sysctl mechanism. > > Note that the variable dolock was always 1, so I removed it. > > ok? > > bluhm > > Index: kern/kern_sysctl.c > === > RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_sysctl.c,v > retrieving revision 1.320 > diff -u -p -r1.320 kern_sysctl.c > --- kern/kern_sysctl.c11 Nov 2016 18:59:09 - 1.320 > +++ kern/kern_sysctl.c16 Jan 2017 18:49:20 - > @@ -157,7 +157,7 @@ sys_sysctl(struct proc *p, void *v, regi > syscallarg(void *) new; > syscallarg(size_t) newlen; > } */ *uap = v; > - int error, dolock = 1; > + int error; > size_t savelen = 0, oldlen = 0; > sysctlfn *fn; > int name[CTL_MAXNAME]; > @@ -219,30 +219,41 @@ sys_sysctl(struct proc *p, void *v, regi > if (SCARG(uap, oldlenp) && > (error = copyin(SCARG(uap, oldlenp), &oldlen, sizeof(oldlen > return (error); > - if (SCARG(uap, old) != NULL) { > + if (SCARG(uap, old) != NULL || SCARG(uap, new) != NULL) { > if ((error = rw_enter(&sysctl_lock, RW_WRITE|RW_INTR)) != 0) > return (error); > - if (dolock) { > - if (atop(oldlen) > uvmexp.wiredmax - uvmexp.wired) { > - rw_exit_write(&sysctl_lock); > - return (ENOMEM); > - } > - error = uvm_vslock(p, SCARG(uap, old), oldlen, > - PROT_READ | PROT_WRITE); > - if (error) { > - rw_exit_write(&sysctl_lock); > - return (error); > - } > + } > + if (SCARG(uap, old) != NULL) { > + if (atop(oldlen) > uvmexp.wiredmax - uvmexp.wired) { > + error = ENOMEM; > + goto unlock; > } > + error = uvm_vslock(p, SCARG(uap, old), oldlen, > + PROT_READ | PROT_WRITE); > + if (error) > + goto unlock; > savelen = oldlen; > } > + if (SCARG(uap, new) != NULL) { > + if (atop(SCARG(uap, newlen)) > uvmexp.wiredmax - uvmexp.wired) { > + error = ENOMEM; > + goto unwire; > + } > + error = uvm_vslock(p, SCARG(uap, new), SCARG(uap, newlen), > + PROT_READ | PROT_WRITE); > + if (error) > + goto unwire; > + } > erro
Re: 11n support for athn(4)
On 16 January 2017 at 23:30, Stefan Sperling wrote: > On Mon, Jan 16, 2017 at 07:18:04PM +, Peter Kay wrote: >> I'm still having issues with this. >> >> When the access p64 bytes from 192.168.1.251: icmp_seq=678 ttl=255 >> time=4.502 ms oint wedges, it seems to affect my Android phone more >> than the iwn laptop. ifconfig athn0 down up does resolve the problem >> in the short term. > > Do you have 2 antennas properly connected to the athn card? Three, yes, but note that unless the antennas have been unreasonably disturbed during the snapshot upgrade nothing has changed. Also, it takes a day or so for the access point to start failing, so I'm suspecting a software issue.
Re: NET_LOCK() pr_sysctl
On 16.1.2017. 23:53, Alexander Bluhm wrote: > Hrvoje Popovski has tested the diff and found some ugly > pmap_unwire: wiring for pmap 0xff00075f5210 va 0x7f7d5000 didn't > change! > kernel printfs. The happens when sysctl(8) writes a value. > > If oldp and newp are in the same page, I have called uvm_vsunlock() > twice on the same address. I have added a simple check that does > not cover complicated overlappings but catches the common case. > > Also I think PROT_READ for the newp should be enough. > Does anybody know, why the oldp is mapped PROT_READ | PROT_WRITE? > Is PROT_WRITE not sufficient? > > bluhm Hi, with this new diff i don't see any logs and box seems stable ...
Re: 11n support for athn(4)
On Mon, Jan 16, 2017 at 07:18:04PM +, Peter Kay wrote: > I'm still having issues with this. > > When the access point wedges, it seems to affect my Android phone more > than the iwn laptop. ifconfig athn0 down up does resolve the problem > in the short term. Do you have 2 antennas properly connected to the athn card?
Re: NET_LOCK() pr_sysctl
On Mon, Jan 16, 2017 at 08:34:43PM +0100, Alexander Bluhm wrote: > If I implement the same trick for newp, I can avoid the "netlock > locking against myself" with sysctl on memory mapped files over > NFS. Of course other copyin/copyout paths like pf(4) ioctl(2) still > have to be checked. IPsec pfkey seem to use the sysctl mechanism. Hrvoje Popovski has tested the diff and found some ugly pmap_unwire: wiring for pmap 0xff00075f5210 va 0x7f7d5000 didn't change! kernel printfs. The happens when sysctl(8) writes a value. If oldp and newp are in the same page, I have called uvm_vsunlock() twice on the same address. I have added a simple check that does not cover complicated overlappings but catches the common case. Also I think PROT_READ for the newp should be enough. Does anybody know, why the oldp is mapped PROT_READ | PROT_WRITE? Is PROT_WRITE not sufficient? bluhm Index: kern/kern_sysctl.c === RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_sysctl.c,v retrieving revision 1.320 diff -u -p -r1.320 kern_sysctl.c --- kern/kern_sysctl.c 11 Nov 2016 18:59:09 - 1.320 +++ kern/kern_sysctl.c 16 Jan 2017 22:37:42 - @@ -157,7 +157,7 @@ sys_sysctl(struct proc *p, void *v, regi syscallarg(void *) new; syscallarg(size_t) newlen; } */ *uap = v; - int error, dolock = 1; + int error; size_t savelen = 0, oldlen = 0; sysctlfn *fn; int name[CTL_MAXNAME]; @@ -219,30 +219,45 @@ sys_sysctl(struct proc *p, void *v, regi if (SCARG(uap, oldlenp) && (error = copyin(SCARG(uap, oldlenp), &oldlen, sizeof(oldlen return (error); - if (SCARG(uap, old) != NULL) { + if (SCARG(uap, old) != NULL || SCARG(uap, new) != NULL) { if ((error = rw_enter(&sysctl_lock, RW_WRITE|RW_INTR)) != 0) return (error); - if (dolock) { - if (atop(oldlen) > uvmexp.wiredmax - uvmexp.wired) { - rw_exit_write(&sysctl_lock); - return (ENOMEM); - } - error = uvm_vslock(p, SCARG(uap, old), oldlen, - PROT_READ | PROT_WRITE); - if (error) { - rw_exit_write(&sysctl_lock); - return (error); - } + } + if (SCARG(uap, old) != NULL) { + if (atop(oldlen) > uvmexp.wiredmax - uvmexp.wired) { + error = ENOMEM; + goto unlock; } + error = uvm_vslock(p, SCARG(uap, old), oldlen, + PROT_READ | PROT_WRITE); + if (error) + goto unlock; savelen = oldlen; } + if (SCARG(uap, new) != NULL) { + if (atop(SCARG(uap, newlen)) > uvmexp.wiredmax - uvmexp.wired) { + error = ENOMEM; + goto unwire; + } + error = uvm_vslock(p, SCARG(uap, new), SCARG(uap, newlen), + PROT_READ); + if (error) + goto unwire; + } error = (*fn)(&name[1], SCARG(uap, namelen) - 1, SCARG(uap, old), &oldlen, SCARG(uap, new), SCARG(uap, newlen), p); - if (SCARG(uap, old) != NULL) { - if (dolock) - uvm_vsunlock(p, SCARG(uap, old), savelen); + if (SCARG(uap, new) != NULL && (SCARG(uap, old) == NULL || + (trunc_page((vaddr_t)SCARG(uap, new)) < + trunc_page((vaddr_t)SCARG(uap, old)) || + (round_page((vaddr_t)SCARG(uap, new) + SCARG(uap, newlen)) > + round_page((vaddr_t)SCARG(uap, old) + savelen) + uvm_vsunlock(p, SCARG(uap, new), SCARG(uap, newlen)); + unwire: + if (SCARG(uap, old) != NULL) + uvm_vsunlock(p, SCARG(uap, old), savelen); + unlock: + if (SCARG(uap, old) != NULL || SCARG(uap, new) != NULL) rw_exit_write(&sysctl_lock); - } if (error) return (error); if (SCARG(uap, oldlenp))
Re: xenocara fontconfig: make slight hinting the default
On Sun, Jan 15, 2017 at 10:37:20AM +0100, Nils Reuße wrote: > On 01/04/2017 01:19 PM, Nils Reuße wrote: > > Dear all, > > > > fontconfig made slight hinting the default in version 2.11.95 (see commit > > at [1]). > > > > xenocara currently ships, but does not install the new hinting conf files: > > > > $ cd /usr/xenocara/dist/fontconfig/conf.d/ > > $ for file in *conf; do if ! test -f /etc/fonts/conf.avail/$file; then > > echo "$file not found"; fi; done > > 10-hinting-full.conf not found > > 10-hinting-medium.conf not found > > 10-hinting-none.conf not found > > 10-hinting-slight.conf not found > > > > The patch below installs the missing files and makes slight hinting the > > default. > > > > Any comments? Hmm right, I forgot to add the new files. I'm committing the diff that installs them to conf.avail. I'll wait a bit until more people have tried the new default 'slight' anti-aliasing do decide if OpenBSD wants this as a default or not. Most developpers are quite conservative and don't like the anti-aliased fonts... > > > > Kind regards > > Nils > > > > [1] > > https://cgit.freedesktop.org/fontconfig/commit/?id=98434b3392172233094cac25ade7225c93da9f1c > > > > > > Index: distrib/sets/lists/xetc/mi > > === > > RCS file: /cvs/xenocara/distrib/sets/lists/xetc/mi,v > > retrieving revision 1.31 > > diff -u -p -u -r1.31 mi > > --- distrib/sets/lists/xetc/mi 28 Oct 2015 00:46:31 - 1.31 > > +++ distrib/sets/lists/xetc/mi 4 Jan 2017 11:21:03 - > > @@ -12,6 +12,7 @@ > > ./etc/X11/xdm/xdm-config > > ./etc/X11/xinit/xinitrc > > ./etc/X11/xsm/system.xsm > > +./etc/fonts/conf.d/10-hinting-slight.conf > > ./etc/fonts/conf.d/10-scale-bitmap-fonts.conf > > ./etc/fonts/conf.d/20-unhint-small-dejavu-sans-mono.conf > > ./etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf > > Index: lib/fontconfig/conf.d/Makefile > > === > > RCS file: /cvs/xenocara/lib/fontconfig/conf.d/Makefile,v > > retrieving revision 1.10 > > diff -u -p -u -r1.10 Makefile > > --- lib/fontconfig/conf.d/Makefile 19 Nov 2016 08:45:51 - 1.10 > > +++ lib/fontconfig/conf.d/Makefile 4 Jan 2017 11:21:03 - > > @@ -9,6 +9,7 @@ DOC_FILES= \ > > README > > > > CONF_LINKS = \ > > + 10-hinting-slight.conf \ > > 10-scale-bitmap-fonts.conf \ > > 20-unhint-small-vera.conf \ > > 30-lucida-aliases.conf \ > > @@ -29,6 +30,10 @@ CONF_LINKS = \ > > > > AVAIL_FILES = \ > > 10-autohint.conf\ > > + 10-hinting-full.conf\ > > + 10-hinting-medium.conf \ > > + 10-hinting-none.conf\ > > + 10-hinting-slight.conf \ > > 10-no-sub-pixel.conf\ > > 10-scale-bitmap-fonts.conf \ > > 10-sub-pixel-bgr.conf \ > > > > Any comment? -- Matthieu Herrb signature.asc Description: PGP signature
Re: [patch] Enable support for Subpixel Antialiasing / LCD Filter
On 01/15/2017 03:04 PM, Stuart Henderson wrote: Other Linux/BSD systems have this option enabled for a long time now, under them Ubuntu, Debian [2], Freebsd [3], Arch Linux [4] and more. There has been a privious discussion on this list on this topic [5] where tedu@ mentions, that this issue is irrelevant once you get a decent display with a higher DPI (or use bitmap fonts), which is of course true [6]. But at least for me, at work we still have (and buy) new monitors that have a DPI of 96 (e.g. Dell U2412M). On these displays, bitmap fonts are too tiny for me and don't scale well, so subpixel rendering with enabled lcd filter really makes a difference. Hi Stuart, thanks for your reply. btw it is "li...@wrant.com" not tedu writing that. good for him/her to have a 27" high DPI display but I agree with you here. True, i misread that. Sorry for confusing the two. [1] https://www.freetype.org/patents.html "A survey from June 2007 shows no less than nine patents from Microsoft that cover ClearType." "Does FreeType Implement Any of the Patented Techniques? Technically, no. The patents cover the whole process of generating and displaying sub-pixel images. Since the font engine doesn't do the display part, it cannot infringe." ... but xenocara as a whole does display. Indeed. [2] http://metadata.ftp-master.debian.org/changelogs/main/f/freetype/freetype_2.5.2-3+deb8u1_changelog " * debian/patches-freetype/enable-subpixel-rendering.patch: enable subpixel rendering features, used by libcairo and xft to provide LCD colour filtering. This is considered no more or less evil than the bytecode interpreter which we also enable." this doesn't strike me as a robust evaluation of the patent situation. [3] http://www.freshports.org/print/freetype2/ "The following configuration options are available for freetype2-2.6.3: LCD_FILTERING=on: Sub-pixel rendering (patented)" optional and a warning about patents in the description. And FreeBSD's inclusion of CDDL code (e.g. ZFS) shows they have a different approach to patents than OpenBSD. [4] https://git.archlinux.org/svntogit/packages.git/tree/trunk/0002-Enable-subpixel-rendering.patch?h=packages/freetype2 https://wiki.archlinux.org/index.php/Talk:Font_configuration - "does not require patching FreeType and Fontconfig because Arch Linux already does this. However, Arch Linux does not enable the patent encumbered settings by default" - I don't really understand what arch are doing here. With the patch that all systems use, freetype is compiled with support for sub-pixel rendering, which is patent encumbered. Tools like fontconfig can then use this functionality from freetype to render fonts with subpixel rendering, but the setting is disabled by default in fontconfig. So even if support is compiled in, it is not used by default, and users have to create a config file. Is there a chance to get this enabled in xenocara? I don't think there's really been enough analysis of the patent situation to give us the information to know whether enabling this by default is going to get users or OpenBSD into patent-related problems or not. Ok, i can't really help/decide on this issue, all i could do is to show what others are doing ;) So i guess i just recompile freetype on each update. Here's how you do it on -current (needs /usr/src and /usr/xenocara set up and patched, of course): $ cd /usr/xenocara/lib/freetype $ doas make clean $ doas make $ doas make install
Re: ksh(1): preserve xtrace option
Anton Lindqvist, 16 Jan 2017 10:02: > > Hmm, I see now that my memory is false, ksh93 (available as port) does > > trace into functions. Still, I'm undecided if we want to change our > > ksh. > > Any thoughts from others on changing the defaults? just my 2 cents. when many years ago i found out that ksh does not trace into functions i also considered it a bug. in the tools and languages i use, when a debug mode is set, one is not expected to reconfirm that setting in every entered function. i think the "least surprising result" would be to trace into functions, and disable tracing in the particular function where tracing is not desired... as i personally want to see all debug output, i always have a global set -x and local set -x's. as such i am all for the change. -f --
Re: NET_LOCK() pr_sysctl
On Mon, Jan 09, 2017 at 11:55:55PM +0100, Alexander Bluhm wrote: > On Thu, Dec 22, 2016 at 01:38:17AM +0100, Mateusz Guzik wrote: > > In this particular case, what happens if the access results in a page > > fault and the area comes from a nfs mapped file? If network i/o is done > > from the same context, this should result in 'locking against myself' > > assertion failure. > > I have written a program the sets a sysctl value from a memory > mapped file mounted on NFS. As expected it panics when NET_LOCK() > is enabled. I was wondering why my test program did only crash during copyin but never for copyout. For sysctl(2) the copyout does never sleep as the memory is wired. This is done to avoid races when collecting data for the oldp. If I implement the same trick for newp, I can avoid the "netlock locking against myself" with sysctl on memory mapped files over NFS. Of course other copyin/copyout paths like pf(4) ioctl(2) still have to be checked. IPsec pfkey seem to use the sysctl mechanism. Note that the variable dolock was always 1, so I removed it. ok? bluhm Index: kern/kern_sysctl.c === RCS file: /data/mirror/openbsd/cvs/src/sys/kern/kern_sysctl.c,v retrieving revision 1.320 diff -u -p -r1.320 kern_sysctl.c --- kern/kern_sysctl.c 11 Nov 2016 18:59:09 - 1.320 +++ kern/kern_sysctl.c 16 Jan 2017 18:49:20 - @@ -157,7 +157,7 @@ sys_sysctl(struct proc *p, void *v, regi syscallarg(void *) new; syscallarg(size_t) newlen; } */ *uap = v; - int error, dolock = 1; + int error; size_t savelen = 0, oldlen = 0; sysctlfn *fn; int name[CTL_MAXNAME]; @@ -219,30 +219,41 @@ sys_sysctl(struct proc *p, void *v, regi if (SCARG(uap, oldlenp) && (error = copyin(SCARG(uap, oldlenp), &oldlen, sizeof(oldlen return (error); - if (SCARG(uap, old) != NULL) { + if (SCARG(uap, old) != NULL || SCARG(uap, new) != NULL) { if ((error = rw_enter(&sysctl_lock, RW_WRITE|RW_INTR)) != 0) return (error); - if (dolock) { - if (atop(oldlen) > uvmexp.wiredmax - uvmexp.wired) { - rw_exit_write(&sysctl_lock); - return (ENOMEM); - } - error = uvm_vslock(p, SCARG(uap, old), oldlen, - PROT_READ | PROT_WRITE); - if (error) { - rw_exit_write(&sysctl_lock); - return (error); - } + } + if (SCARG(uap, old) != NULL) { + if (atop(oldlen) > uvmexp.wiredmax - uvmexp.wired) { + error = ENOMEM; + goto unlock; } + error = uvm_vslock(p, SCARG(uap, old), oldlen, + PROT_READ | PROT_WRITE); + if (error) + goto unlock; savelen = oldlen; } + if (SCARG(uap, new) != NULL) { + if (atop(SCARG(uap, newlen)) > uvmexp.wiredmax - uvmexp.wired) { + error = ENOMEM; + goto unwire; + } + error = uvm_vslock(p, SCARG(uap, new), SCARG(uap, newlen), + PROT_READ | PROT_WRITE); + if (error) + goto unwire; + } error = (*fn)(&name[1], SCARG(uap, namelen) - 1, SCARG(uap, old), &oldlen, SCARG(uap, new), SCARG(uap, newlen), p); - if (SCARG(uap, old) != NULL) { - if (dolock) - uvm_vsunlock(p, SCARG(uap, old), savelen); + if (SCARG(uap, new) != NULL) + uvm_vsunlock(p, SCARG(uap, new), SCARG(uap, newlen)); + unwire: + if (SCARG(uap, old) != NULL) + uvm_vsunlock(p, SCARG(uap, old), savelen); + unlock: + if (SCARG(uap, old) != NULL || SCARG(uap, new) != NULL) rw_exit_write(&sysctl_lock); - } if (error) return (error); if (SCARG(uap, oldlenp))
Re: 11n support for athn(4)
I'm still having issues with this. When the access point wedges, it seems to affect my Android phone more than the iwn laptop. ifconfig athn0 down up does resolve the problem in the short term. I see the changes have already been committed, so it's no longer necessary to patch recent snapshots (running 14th, #133). ifconfig athn0 media produces athn0: flags=8843 mtu 1500 lladdr x:x:x:x description: 802.11b/g wireless index 1 priority 4 llprio 3 groups: wlan media: IEEE802.11 autoselect (autoselect mode 11n hostap) status: active ieee80211: nwid myAP chan 9 bssid x:x:x:x wpakey 0xdeadbeef wpaprotos wpa2 wpaakms psk paciphers ccmp wpagroupcipher ccmp supported media: media autoselect media autoselect mediaopt hostap media autoselect mediaopt monitor media autoselect mode 11b media autoselect mode 11b mediaopt hostap media autoselect mode 11b mediaopt monitor media autoselect mode 11g media autoselect mode 11g mediaopt hostap media autoselect mode 11g mediaopt monitor media autoselect mode 11n media autoselect mode 11n mediaopt hostap media autoselect mode 11n mediaopt monitor inet 1.1.1.1 netmask 0xff00 broadcast 1.1.1.255 I can possibly try switching developer options on one of the Android phones I have lying around. On 14 January 2017 at 12:53, Stefan Sperling wrote: > On Sat, Jan 14, 2017 at 12:42:09PM +, Peter Kay wrote: >> On 14 January 2017 at 12:02, Stefan Sperling wrote: >> > On Sat, Jan 14, 2017 at 11:31:00AM +, Peter Kay wrote: >> >> On 14 January 2017 at 11:23, Stefan Sperling wrote: >> >> > If one of your clients says it cannot authenticate, then this client may be >> > trying to use TKIP/WPA1. You can enable wpa1 explicitly for such clients: >> > ifconfig athn0 wpaprotos wpa1,wpa2 >> > But understand that you'll be running broken WEP-grade crypto if you do >> > this. >> I'll upgrade to the latest snapshot. It's not a TKIP/WPA1 issue as a >> reboot fixes it. > > A reboot is very drastic and won't help with narrowing down the > cause of your issue. > > Can you find a better way to unwedge the AP when it runs into problems? > Does 'ifconfig iwn0 scan' on the client help? > Does 'ifconfig athn0 down up' on the AP help?
Re: src/usr.sbin/slowcgi: possible bug
Florian Obser wrotes: >On Mon, Jan 02, 2017 at 04:29:21PM +0330, temp+...@frad.ir wrote: >> Hi tech@, >> >> I recently checked the slowcgi(8) and found that it might have an issue >> when buf_pos is at the end of buffer and buf_len is zero. >> >> Am I right? > >we can simplify this even more. There is no need to remember the >buffer position outside of this function. It will be 0 on every call, >either because we made progress in parsing data and then copied the >rest to the beginning of the buffer or we did not make progress at >all, and then we need to start parsing from the beginning again. > >OK? It seems perfect. > >diff --git slowcgi.c slowcgi.c >index dec4df8d1a1..83d12d99160 100644 >--- slowcgi.c >+++ slowcgi.c >@@ -118,7 +118,6 @@ struct request { > struct eventtmo; > int fd; > uint8_t buf[FCGI_RECORD_SIZE]; >- size_t buf_pos; > size_t buf_len; > struct fcgi_response_head response_head; > struct fcgi_stdin_head stdin_head; >@@ -495,7 +494,6 @@ slowcgi_accept(int fd, short events, void *arg) > return; > } > c->fd = s; >- c->buf_pos = 0; > c->buf_len = 0; > c->request_started = 0; > c->stdin_fd_closed = c->stdout_fd_closed = c->stderr_fd_closed = 0; >@@ -632,12 +630,12 @@ slowcgi_request(int fd, short events, void *arg) > { > struct request *c; > ssize_t n; >- size_t parsed; >+ size_t parsed, pos = 0; > > c = arg; > >- n = read(fd, c->buf + c->buf_pos + c->buf_len, >- FCGI_RECORD_SIZE - c->buf_pos-c->buf_len); >+ n = read(fd, c->buf + c->buf_len, >+ FCGI_RECORD_SIZE - c->buf_len); > > switch (n) { > case -1: >@@ -666,16 +664,15 @@ slowcgi_request(int fd, short events, void *arg) >* at that point, which is what happens here. >*/ > do { >- parsed = parse_record(c->buf + c->buf_pos, c->buf_len, c); >- c->buf_pos += parsed; >+ parsed = parse_record(c->buf + pos, c->buf_len, c); >+ pos += parsed; > c->buf_len -= parsed; > } while (parsed > 0 && c->buf_len > 0); > > /* Make space for further reads */ >- if (c->buf_len > 0) { >- bcopy(c->buf + c->buf_pos, c->buf, c->buf_len); >- c->buf_pos = 0; >- } >+ if (c->buf_len > 0 && pos > 0) >+ bcopy(c->buf + pos, c->buf, c->buf_len); >+ > return; > fail: > cleanup_request(c); > >
Probe up to 255 LUNs on mpii(4)
This is enough to probe and initiate I/O to multiple LUNs on mpii(4) and lets robert@ attach (but not use) his tape library where LUN 0 is an st(4) and LUN 1 is a ch(4). OK? The reason we limit it to 255 is that LUN numbers larger than 255 need to be encoded in a fairly complicated manner and this can be done later: http://bxr.su/FreeBSD/sys/dev/mps/mps_sas.h#118 P.S. TASK_MGMT command theoretically needs to care about LUNs as well, but not the TARGET_RESET that we're using since it resets all of them (which is actually a wrong thing to do according to the mps(4) driver from LSI in FreeBSD, but it's a different story). diff --git sys/dev/pci/mpii.c sys/dev/pci/mpii.c index 1633c8f5ae4..13a39c654b5 100644 --- sys/dev/pci/mpii.c +++ sys/dev/pci/mpii.c @@ -579,11 +579,11 @@ mpii_attach(struct device *parent, struct device *self, void *aux) /* we should be good to go now, attach scsibus */ sc->sc_link.adapter = &mpii_switch; sc->sc_link.adapter_softc = sc; sc->sc_link.adapter_target = -1; sc->sc_link.adapter_buswidth = sc->sc_max_devices; - sc->sc_link.luns = 1; + sc->sc_link.luns = 255; sc->sc_link.openings = sc->sc_max_cmds - 1; sc->sc_link.pool = &sc->sc_iopool; memset(&saa, 0, sizeof(saa)); saa.saa_sc_link = &sc->sc_link;
Re: xargs: fix -I when used with -0
On Mon, 16 Jan 2017 09:21:39 -0700, "Todd C. Miller" wrote: > When using the -0 flag, a "line" is delimited by a NUL char, not a > newline. This fixes things like: > > $ printf 'hello\00world\00' | xargs -n 1 -0 -I arg printf '>%s<\n' "arg" Sorry, the actual test command is: $ printf 'hello\00world\00' | xargs -0 -I arg printf '>%s<\n' "arg" The -n1 form will return the correct results regardless of the patch. - todd
Re: 11n support for athn(4)
Hello Stefan, many many thanks for this work! I tested today with the latest snapshot from yesterday and a custom compiled kernel from today's sources. AP is my APU1D4 and Client is my ThinkPad T530 with iwn: AP: athn0 at pci4 dev 0 function 0 "Atheros AR9281" rev 0x01: apic 2 int 19 athn0: AR9280 rev 2 (2T2R), ROM rev 22, address 04:f0:21:17:40:ba athn0: flags=8947 mtu 1500 lladdr 04:f0:21:17:40:ba index 4 priority 4 llprio 3 groups: wlan media: IEEE802.11 autoselect (autoselect hostap) status: active ieee80211: nwid TEST chan 1 bssid 04:f0:21:17:40:ba wpakey XXX wpaprotos wpa2 wpaakms psk wpaciphers ccmp wpagroupcipher ccmp athn0: sending auth to 6c:88:14:36:27:b0 on channel 1 mode auto athn0: station 6c:88:14:36:27:b0 newly authenticated (open) athn0: sending assoc_resp to 6c:88:14:36:27:b0 on channel 1 mode auto athn0: sending msg 1/4 of the 4-way handshake to 6c:88:14:36:27:b0 athn0: received auth from 6c:88:14:36:27:b0 rssi 34 mode auto athn0: received assoc_req from 6c:88:14:36:27:b0 rssi 33 mode auto athn0: sending msg 1/4 of the 4-way handshake to 6c:88:14:36:27:b0 athn0: received msg 2/4 of the 4-way handshake from 6c:88:14:36:27:b0 athn0: sending msg 3/4 of the 4-way handshake to 6c:88:14:36:27:b0 athn0: received msg 4/4 of the 4-way handshake from 6c:88:14:36:27:b0 Client: iwn0 at pci2 dev 0 function 0 "Intel Centrino Advanced-N 6205" rev 0x34: msi, MIMO 2T2R, MoW, address 6c:88:14:36:27:b0 iwn0: end active scan iwn0: sending auth to 04:f0:21:17:40:ba on channel 1 mode 11g iwn0: sending assoc_req to 04:f0:21:17:40:ba on channel 1 mode 11g iwn0: received auth from 04:f0:21:17:40:ba rssi -20 mode 11g iwn0: associated with 04:f0:21:17:40:ba ssid "TEST" channel 1 start MCS 0 short preamble long slot time HT enabled iwn0: received assoc_resp from 04:f0:21:17:40:ba rssi -21 mode 11g iwn0: received msg 1/4 of the 4-way handshake from 04:f0:21:17:40:ba iwn0: sending msg 2/4 of the 4-way handshake to 04:f0:21:17:40:ba iwn0: received msg 3/4 of the 4-way handshake from 04:f0:21:17:40:ba iwn0: sending msg 4/4 of the 4-way handshake to 04:f0:21:17:40:ba iwn0: flags=208847 mtu 1500 lladdr 6c:88:14:36:27:b0 index 2 priority 4 llprio 3 groups: wlan egress media: IEEE802.11 autoselect mode 11n (HT-MCS2 mode 11n) status: active ieee80211: nwid TEST chan 1 bssid 04:f0:21:17:40:ba -20dBm wpakey XXX wpaprotos wpa2 wpaakms psk wpaciphers ccmp wpagroupcipher ccmp Unfortunately the throughput is very low, only ~7 MBit. With mode 11g I get ~16 MBit. zarathustra:~# tcpbench apu01 elapsed_ms bytes mbps bwidth 1004 7482725.962 100.00% Conn: 1 Mbps:5.962 Peak Mbps:5.962 Avg Mbps:5.962 2007 8396646.697 100.00% Conn: 1 Mbps:6.697 Peak Mbps:6.697 Avg Mbps:6.697 3010 8182446.533 100.00% Conn: 1 Mbps:6.533 Peak Mbps:6.697 Avg Mbps:6.533 4013 9096367.255 100.00% Conn: 1 Mbps:7.255 Peak Mbps:7.255 Avg Mbps:7.255 5014 8568006.848 100.00% Conn: 1 Mbps:6.848 Peak Mbps:7.255 Avg Mbps:6.848 6015 8682246.946 100.00% Conn: 1 Mbps:6.946 Peak Mbps:7.255 Avg Mbps:6.946 7021 8725086.945 100.00% Conn: 1 Mbps:6.945 Peak Mbps:7.255 Avg Mbps:6.945 8023 8353806.670 100.00% Conn: 1 Mbps:6.670 Peak Mbps:7.255 Avg Mbps:6.670 9025 8482326.779 100.00% Conn: 1 Mbps:6.779 Peak Mbps:7.255 Avg Mbps:6.779 10028 8439486.731 100.00% Conn: 1 Mbps:6.731 Peak Mbps:7.255 Avg Mbps:6.731 11036 8310966.596 100.00% Conn: 1 Mbps:6.596 Peak Mbps:7.255 Avg Mbps:6.596 I'm now ready to test furhter. Many thanks again! Regards Uwe Am 09.01.2017 13:54:55, schrieb Stefan Sperling: > This diff adds 11n support to the athn(4) driver. > Requires -current net80211 code from today. > > Tested in hostap mode and client mode with: > athn0 at pci1 dev 0 function 0 "Atheros AR9281" rev 0x01: apic 2 int 16 > athn0: AR9280 rev 2 (2T2R), ROM rev 22, adddress xx:xx:xx:xx:xx:xx > > And in client mode with: > athn0 at uhub1 port 2 configuration 1 interface 0 "ATHEROS USB2.0 WLAN" rev > 2.00/1.08 addr 2 > athn0: AR9271 rev 1 (1T1R), ROM rev 13, address xx:xx:xx:xx:xx:xx > > Hostap performance is not perfect yet but should be no worse than > 11a/b/g modes in the same environment. > > For Linux clients a fix for WME params is needed which I also posted to tech@. > > This diff does not modify the known-broken and disabled ar9003 code, > apart from making sure it still builds. > > I'm looking for
iwm(4): Remove old iwm_get_{active,passive}_dwell functions.
The iwm_get_active_dwell() and iwm_get_passive_dwell() functions are unused, and where removed in Linux iwlwifi git commit 9437e9941025bc83d3dd43f2927019149029f667. Index: sys/dev/pci/if_iwm.c === RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v retrieving revision 1.156 diff -u -r1.156 if_iwm.c --- sys/dev/pci/if_iwm.c12 Jan 2017 18:06:57 - 1.156 +++ sys/dev/pci/if_iwm.c16 Jan 2017 16:42:56 - @@ -409,8 +409,6 @@ intiwm_add_aux_sta(struct iwm_softc *); uint16_t iwm_scan_rx_chain(struct iwm_softc *); uint32_t iwm_scan_rate_n_flags(struct iwm_softc *, int, int); -uint16_t iwm_get_active_dwell(struct iwm_softc *, int, int); -uint16_t iwm_get_passive_dwell(struct iwm_softc *, int); uint8_tiwm_lmac_scan_fill_channels(struct iwm_softc *, struct iwm_scan_channel_cfg_lmac *, int); intiwm_fill_probe_req(struct iwm_softc *, struct iwm_scan_probe_req *); @@ -4459,12 +4457,6 @@ return err; } -#define IWM_PLCP_QUIET_THRESH 1 -#define IWM_ACTIVE_QUIET_TIME 10 -#define LONG_OUT_TIME_PERIOD 600 -#define SHORT_OUT_TIME_PERIOD 200 -#define SUSPEND_TIME_PERIOD 100 - uint16_t iwm_scan_rx_chain(struct iwm_softc *sc) { @@ -4500,30 +4492,6 @@ tx_ant); else return htole32(IWM_RATE_6M_PLCP | tx_ant); -} - -/* - * If req->n_ssids > 0, it means we should do an active scan. - * In case of active scan w/o directed scan, we receive a zero-length SSID - * just to notify that this scan is active and not passive. - * In order to notify the FW of the number of SSIDs we wish to scan (including - * the zero-length one), we need to set the corresponding bits in chan->type, - * one for each SSID, and set the active bit (first). If the first SSID is - * already included in the probe template, so we need to set only - * req->n_ssids - 1 bits in addition to the first bit. - */ -uint16_t -iwm_get_active_dwell(struct iwm_softc *sc, int flags, int n_ssids) -{ - if (flags & IEEE80211_CHAN_2GHZ) - return 30 + 3 * (n_ssids + 1); - return 20 + 2 * (n_ssids + 1); -} - -uint16_t -iwm_get_passive_dwell(struct iwm_softc *sc, int flags) -{ - return (flags & IEEE80211_CHAN_2GHZ) ? 100 + 20 : 100 + 10; } uint8_t
iwm(4): Update struct iwm_scan_results_notif. Remove a few old defines.
Hi, This patch updates the struct iwm_scan_results_notif to FW Api version 3, and removes the unused enum iwm_scan_complete_status status codes, as well as the deprecated/unused struct iwm_scan_complete_notif. This corresponds to the Linux iwlwifi commits 1083fd7391e989be52022f0f338e9dadc048b063 and 75118fdb63496e4611ab50380499ddd62b9de69f. No functional change, since struct iwm_scan_results_notif isn't accessed in iwm at the moment. Index: sys/dev/pci/if_iwmreg.h === RCS file: /cvs/src/sys/dev/pci/if_iwmreg.h,v retrieving revision 1.21 diff -u -r1.21 if_iwmreg.h --- sys/dev/pci/if_iwmreg.h 10 Dec 2016 19:03:53 - 1.21 +++ sys/dev/pci/if_iwmreg.h 16 Jan 2017 16:23:01 - @@ -5001,48 +5001,14 @@ #define IWM_SCAN_PROBE_STATUS_FAIL_TTL (1 << 1) #define IWM_SCAN_PROBE_STATUS_FAIL_BT (1 << 2) -/* How many statistics are gathered for each channel */ -#define IWM_SCAN_RESULTS_STATISTICS 1 - /** - * status codes for scan complete notifications - * @IWM_SCAN_COMP_STATUS_OK: scan completed successfully - * @IWM_SCAN_COMP_STATUS_ABORT: scan was aborted by user - * @IWM_SCAN_COMP_STATUS_ERR_SLEEP: sending null sleep packet failed - * @IWM_SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT: timeout before channel is ready - * @IWM_SCAN_COMP_STATUS_ERR_PROBE: sending probe request failed - * @IWM_SCAN_COMP_STATUS_ERR_WAKEUP: sending null wakeup packet failed - * @IWM_SCAN_COMP_STATUS_ERR_ANTENNAS: invalid antennas chosen at scan command - * @IWM_SCAN_COMP_STATUS_ERR_INTERNAL: internal error caused scan abort - * @IWM_SCAN_COMP_STATUS_ERR_COEX: medium was lost ot WiMax - * @IWM_SCAN_COMP_STATUS_P2P_ACTION_OK: P2P public action frame TX was successful - * (not an error!) - * @IWM_SCAN_COMP_STATUS_ITERATION_END: indicates end of one repeatition the driver - * asked for - * @IWM_SCAN_COMP_STATUS_ERR_ALLOC_TE: scan could not allocate time events -*/ -#define IWM_SCAN_COMP_STATUS_OK0x1 -#define IWM_SCAN_COMP_STATUS_ABORT 0x2 -#define IWM_SCAN_COMP_STATUS_ERR_SLEEP 0x3 -#define IWM_SCAN_COMP_STATUS_ERR_CHAN_TIMEOUT 0x4 -#define IWM_SCAN_COMP_STATUS_ERR_PROBE 0x5 -#define IWM_SCAN_COMP_STATUS_ERR_WAKEUP0x6 -#define IWM_SCAN_COMP_STATUS_ERR_ANTENNAS 0x7 -#define IWM_SCAN_COMP_STATUS_ERR_INTERNAL 0x8 -#define IWM_SCAN_COMP_STATUS_ERR_COEX 0x9 -#define IWM_SCAN_COMP_STATUS_P2P_ACTION_OK 0xA -#define IWM_SCAN_COMP_STATUS_ITERATION_END 0x0B -#define IWM_SCAN_COMP_STATUS_ERR_ALLOC_TE 0x0C - -/** - * struct iwm_scan_results_notif - scan results for one channel - * ( IWM_SCAN_RESULTS_NOTIFICATION = 0x83 ) + * struct iwm_scan_results_notif - scan results for one channel - + * SCAN_RESULT_NTF_API_S_VER_3 * @channel: which channel the results are from * @band: 0 for 5.2 GHz, 1 for 2.4 GHz * @probe_status: IWM_SCAN_PROBE_STATUS_*, indicates success of probe request * @num_probe_not_sent: # of request that weren't sent due to not enough time * @duration: duration spent in channel, in usecs - * @statistics: statistics gathered for this channel */ struct iwm_scan_results_notif { uint8_t channel; @@ -5050,29 +5016,7 @@ uint8_t probe_status; uint8_t num_probe_not_sent; uint32_t duration; - uint32_t statistics[IWM_SCAN_RESULTS_STATISTICS]; -} __packed; /* IWM_SCAN_RESULT_NTF_API_S_VER_2 */ - -/** - * struct iwm_scan_complete_notif - notifies end of scanning (all channels) - * ( IWM_SCAN_COMPLETE_NOTIFICATION = 0x84 ) - * @scanned_channels: number of channels scanned (and number of valid results) - * @status: one of IWM_SCAN_COMP_STATUS_* - * @bt_status: BT on/off status - * @last_channel: last channel that was scanned - * @tsf_low: TSF timer (lower half) in usecs - * @tsf_high: TSF timer (higher half) in usecs - * @results: all scan results, only "scanned_channels" of them are valid - */ -struct iwm_scan_complete_notif { - uint8_t scanned_channels; - uint8_t status; - uint8_t bt_status; - uint8_t last_channel; - uint32_t tsf_low; - uint32_t tsf_high; - struct iwm_scan_results_notif results[IWM_MAX_NUM_SCAN_CHANNELS]; -} __packed; /* IWM_SCAN_COMPLETE_NTF_API_S_VER_2 */ +} __packed; #define IWM_SCAN_CLIENT_SCHED_SCAN (1 << 0) #define IWM_SCAN_CLIENT_NETDETECT (1 << 1)
xargs: fix -I when used with -0
When using the -0 flag, a "line" is delimited by a NUL char, not a newline. This fixes things like: $ printf 'hello\00world\00' | xargs -n 1 -0 -I arg printf '>%s<\n' "arg" Before: >hello world< After: >hello< >world< This change is consistent with the behavior of GNU xargs, FreeBSD and NetBSD. We appear to be the only outlier. The diff below is adapted from the FreeBSD change. - todd Index: usr.bin/xargs/xargs.c === RCS file: /cvs/src/usr.bin/xargs/xargs.c,v retrieving revision 1.31 diff -u -p -u -r1.31 xargs.c --- usr.bin/xargs/xargs.c 9 Dec 2015 19:29:49 - 1.31 +++ usr.bin/xargs/xargs.c 16 Jan 2017 16:20:25 - @@ -278,15 +278,22 @@ parse_input(int argc, char *argv[]) } goto arg1; case '\0': - if (zflag) + if (zflag) { + /* +* Increment 'count', so that nulls will be treated +* as end-of-line, as well as end-of-argument. This +* is needed so -0 works properly with -I and -L. +*/ + count++; goto arg2; + } goto addch; case '\n': + if (zflag) + goto addch; hasblank = 1; if (hadblank == 0) count++; - if (zflag) - goto addch; /* Quotes do not escape newlines. */ arg1: if (insingle || indouble) Index: regress/usr.bin/xargs/xargs-L.sh === RCS file: /cvs/src/regress/usr.bin/xargs/xargs-L.sh,v retrieving revision 1.1 diff -u -p -u -r1.1 xargs-L.sh --- regress/usr.bin/xargs/xargs-L.sh25 Mar 2010 01:43:47 - 1.1 +++ regress/usr.bin/xargs/xargs-L.sh16 Jan 2017 16:13:12 - @@ -76,18 +76,18 @@ test_xargs 'a \\\nb' '-0' 'a \\ test_xargs 'a\\\n b' '-0' 'a\\\n b|' test_xargs 'a \\\n b''-0' 'a \\\n b|' -test_xargs 'a b\0c' '-0 -L 1' 'a b|c|' -test_xargs 'a b\0c' '-0 -L 1' 'a b|c|' +test_xargs 'a b\0c' '-0 -L 1' 'a b|\nc|' +test_xargs 'a b\0c' '-0 -L 1' 'a b|\nc|' test_xargs 'a\nb\0c' '-0 -L 1' 'a\nb|\nc|' test_xargs 'a\n\nb\0c' '-0 -L 1' 'a\n\nb|\nc|' -test_xargs 'a \nb\0c''-0 -L 1' 'a \nb|c|' +test_xargs 'a \nb\0c''-0 -L 1' 'a \nb|\nc|' test_xargs 'a\n b\0c''-0 -L 1' 'a\n b|\nc|' -test_xargs 'a \n b\0c' '-0 -L 1' 'a \n b|c|' +test_xargs 'a \n b\0c' '-0 -L 1' 'a \n b|\nc|' test_xargs 'a\n \nb\0c' '-0 -L 1' 'a\n \nb|\nc|' -test_xargs 'a \n\nb\0c' '-0 -L 1' 'a \n\nb|c|' +test_xargs 'a \n\nb\0c' '-0 -L 1' 'a \n\nb|\nc|' -test_xargs 'a\\ b\0c''-0 -L 1' 'a\\ b|c|' -test_xargs 'a\\ \nb\0c' '-0 -L 1' 'a\\ \nb|c|' +test_xargs 'a\\ b\0c''-0 -L 1' 'a\\ b|\nc|' +test_xargs 'a\\ \nb\0c' '-0 -L 1' 'a\\ \nb|\nc|' test_xargs 'a\n\\ b\0c' '-0 -L 1' 'a\n\\ b|\nc|' test_xargs 'a\\\nb\0c' '-0 -L 1' 'a\\\nb|\nc|'
iwm(4): Remove a few dead definitions from if_iwmreg.h.
Hi, This patch removes a couple of definitions from if_iwmreg.h which were never used in iwm(4), which were removed from iwlwifi in Linux git commit 76f8c0e17edc6eba43f84952e5a87c7f50f69370. Index: sys/dev/pci/if_iwmreg.h === RCS file: /cvs/src/sys/dev/pci/if_iwmreg.h,v retrieving revision 1.21 diff -u -r1.21 if_iwmreg.h --- sys/dev/pci/if_iwmreg.h 10 Dec 2016 19:03:53 - 1.21 +++ sys/dev/pci/if_iwmreg.h 16 Jan 2017 15:54:59 - @@ -414,23 +414,12 @@ #define IWM_CSR_SECURE_BOOT_CPU_STATUS_SIGN_VERF_FAIL 0x0010 #define IWM_FH_UCODE_LOAD_STATUS 0x1af0 -#define IWM_CSR_UCODE_LOAD_STATUS_ADDR 0x1e70 - -#define IWM_LMPM_CPU_UCODE_LOADING_STARTED 0x0001 -#define IWM_LMPM_CPU_HDRS_LOADING_COMPLETED0x0003 -#define IWM_LMPM_CPU_UCODE_LOADING_COMPLETED 0x0007 -#define IWM_LMPM_CPU_STATUS_NUM_OF_LAST_COMPLETED 0x00F8 -#define IWM_LMPM_CPU_STATUS_NUM_OF_LAST_LOADED_BLOCK 0xFF00 #define IWM_FH_MEM_TB_MAX_LENGTH 0x2 -#define IWM_LMPM_SECURE_INSPECTOR_CODE_ADDR0x1e38 -#define IWM_LMPM_SECURE_INSPECTOR_DATA_ADDR0x1e3c #define IWM_LMPM_SECURE_UCODE_LOAD_CPU1_HDR_ADDR 0x1e78 #define IWM_LMPM_SECURE_UCODE_LOAD_CPU2_HDR_ADDR 0x1e7c -#define IWM_LMPM_SECURE_INSPECTOR_CODE_MEM_SPACE 0x40 -#define IWM_LMPM_SECURE_INSPECTOR_DATA_MEM_SPACE 0x402000 #define IWM_LMPM_SECURE_CPU1_HDR_MEM_SPACE 0x42 #define IWM_LMPM_SECURE_CPU2_HDR_MEM_SPACE 0x420400
iwm(4): Remove definitions for deprecated old scanning API.
Hi, This removes the old deprecated scan API definitions, which have been unused since the upgrade of iwm(4) to version 16 firmware. Also matching the iwlwifi code, it uses a IWM_DEFAULT_SCAN_CHANNELS (== 40) definition instead of IWM_MAX_NUM_SCAN_CHANNELS (== 36) as default value for sc->sc_capa_n_scan_channels. This patch mostly matches the header-file changes in Linux iwlwifi git commit 1f9403863c080478ad78247c89b018e95bdfb027. Index: sys/dev/pci/if_iwm.c === RCS file: /cvs/src/sys/dev/pci/if_iwm.c,v retrieving revision 1.156 diff -u -r1.156 if_iwm.c --- sys/dev/pci/if_iwm.c12 Jan 2017 18:06:57 - 1.156 +++ sys/dev/pci/if_iwm.c16 Jan 2017 15:08:01 - @@ -525,6 +525,8 @@ return 0; } +#define IWM_DEFAULT_SCAN_CHANNELS 40 + struct iwm_tlv_calib_data { uint32_t ucode_type; struct iwm_tlv_calib_ctrl calib; @@ -588,7 +590,7 @@ } sc->sc_capaflags = 0; - sc->sc_capa_n_scan_channels = IWM_MAX_NUM_SCAN_CHANNELS; + sc->sc_capa_n_scan_channels = IWM_DEFAULT_SCAN_CHANNELS; memset(sc->sc_enabled_capa, 0, sizeof(sc->sc_enabled_capa)); memset(sc->sc_fw_mcc, 0, sizeof(sc->sc_fw_mcc)); @@ -6635,7 +6637,6 @@ case IWM_PHY_CONTEXT_CMD: case IWM_BINDING_CONTEXT_CMD: case IWM_TIME_EVENT_CMD: - case IWM_SCAN_REQUEST_CMD: case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP, IWM_SCAN_CFG_CMD): case IWM_WIDE_ID(IWM_ALWAYS_LONG_GROUP, IWM_SCAN_REQ_UMAC): case IWM_SCAN_OFFLOAD_REQUEST_CMD: Index: sys/dev/pci/if_iwmreg.h === RCS file: /cvs/src/sys/dev/pci/if_iwmreg.h,v retrieving revision 1.21 diff -u -r1.21 if_iwmreg.h --- sys/dev/pci/if_iwmreg.h 10 Dec 2016 19:03:53 - 1.21 +++ sys/dev/pci/if_iwmreg.h 16 Jan 2017 15:08:04 - @@ -1752,13 +1752,6 @@ /* Thermal Throttling*/ #define IWM_REPLY_THERMAL_MNG_BACKOFF 0x7e -/* Scanning */ -#define IWM_SCAN_REQUEST_CMD 0x80 -#define IWM_SCAN_ABORT_CMD 0x81 -#define IWM_SCAN_START_NOTIFICATION0x82 -#define IWM_SCAN_RESULTS_NOTIFICATION 0x83 -#define IWM_SCAN_COMPLETE_NOTIFICATION 0x84 - /* NVM */ #define IWM_NVM_ACCESS_CMD 0x88 @@ -4667,55 +4660,10 @@ /* Scan Commands, Responses, Notifications */ -/* Masks for iwm_scan_channel.type flags */ -#define IWM_SCAN_CHANNEL_TYPE_ACTIVE (1 << 0) -#define IWM_SCAN_CHANNEL_NARROW_BAND (1 << 22) - /* Max number of IEs for direct SSID scans in a command */ #define IWM_PROBE_OPTION_MAX 20 /** - * struct iwm_scan_channel - entry in IWM_REPLY_SCAN_CMD channel table - * @channel: band is selected by iwm_scan_cmd "flags" field - * @tx_gain: gain for analog radio - * @dsp_atten: gain for DSP - * @active_dwell: dwell time for active scan in TU, typically 5-50 - * @passive_dwell: dwell time for passive scan in TU, typically 20-500 - * @type: type is broken down to these bits: - * bit 0: 0 = passive, 1 = active - * bits 1-20: SSID direct bit map. If any of these bits is set then - * the corresponding SSID IE is transmitted in probe request - * (bit i adds IE in position i to the probe request) - * bit 22: channel width, 0 = regular, 1 = TGj narrow channel - * - * @iteration_count: - * @iteration_interval: - * This struct is used once for each channel in the scan list. - * Each channel can independently select: - * 1) SSID for directed active scans - * 2) Txpower setting (for rate specified within Tx command) - * 3) How long to stay on-channel (behavior may be modified by quiet_time, - * quiet_plcp_th, good_CRC_th) - * - * To avoid uCode errors, make sure the following are true (see comments - * under struct iwm_scan_cmd about max_out_time and quiet_time): - * 1) If using passive_dwell (i.e. passive_dwell != 0): - * active_dwell <= passive_dwell (< max_out_time if max_out_time != 0) - * 2) quiet_time <= active_dwell - * 3) If restricting off-channel time (i.e. max_out_time !=0): - * passive_dwell < max_out_time - * active_dwell < max_out_time - */ -struct iwm_scan_channel { - uint32_t type; - uint16_t channel; - uint16_t iteration_count; - uint32_t iteration_interval; - uint16_t active_dwell; - uint16_t passive_dwell; -} __packed; /* IWM_SCAN_CHANNEL_CONTROL_API_S_VER_1 */ - -/** * struct iwm_ssid_ie - directed scan network information element * * Up to 20 of these may appear in IWM_REPLY_SCAN_CMD, @@ -4730,7 +4678,6 @@ } __packed; /* IWM_SCAN_DIRECT_SSID_IE_API_S_VER_1 */ /* scan offload */ -#define IWM_MAX_SCAN_CHANNELS 40 #define IWM_SCAN_MAX_BLACKLIST_LEN 64 #define IWM_SCAN_SHORT_BLACKLIST_LEN 16 #define IWM_SCAN_MAX_PROFILES 11 @@ -4747,33 +4694,6 @@ #define IWM_MAX_SCHED_SCAN_PLANS 2 /** - * masks for scan command flags
Re: ksh(1): preserve xtrace option
On Fri, Jan 13, 2017 at 10:56:51AM +0100, Otto Moerbeek wrote: > On Fri, Jan 13, 2017 at 10:20:19AM +0100, Otto Moerbeek wrote: > > > On Fri, Jan 13, 2017 at 09:51:51AM +0100, Otto Moerbeek wrote: > > > > > On Fri, Jan 13, 2017 at 09:46:54AM +0100, Anton Lindqvist wrote: > > > > > > > Consider the following script which calculates the sum of the first N > > > > integers recursively: > > > > > > > > $ cat >sum.sh < > > > sum() { > > > > [ $1 -eq 0 ] && echo $2 || sum $(($1 - 1)) $(($2 + $1)) > > > > } > > > > > > > > sum 5 > > > > ! > > > > > > > > Executing the script with the x option gives the following output: > > > > > > > > $ sh -x sum.sh > > > > + sum 5 > > > > 15 > > > > > > > > I would expect the recursive calls to be traced, similar to how GNU > > > > bash/sh behaves. With the patch below applied the output is as expected: > > > > > > > > $ sh -x sum.sh > > > > + sum 5 > > > > + [ 5 -eq 0 ] > > > > + sum 4 5 > > > > + [ 4 -eq 0 ] > > > > + sum 3 9 > > > > + [ 3 -eq 0 ] > > > > + sum 2 12 > > > > + [ 2 -eq 0 ] > > > > + sum 1 14 > > > > + [ 1 -eq 0 ] > > > > + sum 0 15 > > > > + [ 0 -eq 0 ] > > > > + echo 15 > > > > 15 > > > > > > > > The patch make sure to assigns the TRACE flag to every user-defined > > > > function if the x option is present. The piece of code that led me to > > > > this: > > > > > > > > $ sed -n 606,607p /usr/src/bin/ksh/exec.c > > > > old_xflag = Flag(FXTRACE); > > > > Flag(FXTRACE) = tp->flag & TRACE ? true : false; > > > > > > Hmmm, > > > > > > afaik -x has always been local to a function in ksh-like shells. > > > To enable tracing within function call set -x in the fucntion te be > > > traced. > > > > or set the trace attribute for a specific function: > > > > typeset -ft sum Thanks, didn't know. > Hmm, I see now that my memory is false, ksh93 (available as port) does > trace into functions. Still, I'm undecided if we want to change our > ksh. Any thoughts from others on changing the defaults?