Re: iwn firmware error
On Fri, Feb 05, 2016 at 01:23:18AM -0500, Michael McConville wrote: > When forcing my laptop to swap, I almost immediately got the following > firmware error. I'm not sure whether this is expected. Restarting the > interface brought things back to normal. > > dmesg follows. Looks like the firmware crashed because an interrupt could not be serviced by the host on time, perhaps? Low-memory situations are evil. Interesting problem, but I don't think I'll find time to look into this. > Feb 5 01:19:04 thinkpad /bsd: iwn0: fatal firmware error > Feb 5 01:19:04 thinkpad /bsd: firmware error log: > Feb 5 01:19:04 thinkpad /bsd: error type = "NMI_INTERRUPT_WDG" > (0x0004) > Feb 5 01:19:04 thinkpad /bsd: program counter = 0x06B4 > Feb 5 01:19:04 thinkpad /bsd: source line = 0xD3EA > Feb 5 01:19:04 thinkpad /bsd: error data = 0x00020263 > Feb 5 01:19:04 thinkpad /bsd: branch link = 0x067A071A > Feb 5 01:19:04 thinkpad /bsd: interrupt link = 0x1532E762 > Feb 5 01:19:04 thinkpad /bsd: time= 1346051188 > Feb 5 01:19:04 thinkpad /bsd: driver status: > Feb 5 01:19:04 thinkpad /bsd: tx ring 0: qid=0 cur=188 queued=135 > Feb 5 01:19:04 thinkpad /bsd: tx ring 1: qid=1 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 2: qid=2 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 3: qid=3 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 4: qid=4 cur=135 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 5: qid=5 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 6: qid=6 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 7: qid=7 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 8: qid=8 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 9: qid=9 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 10: qid=10 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 11: qid=11 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 12: qid=12 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 13: qid=13 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 14: qid=14 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 15: qid=15 cur=0 queued=0 > Feb 5 01:19:04 thinkpad /bsd: tx ring 16: qid=16 cur=0 queued=0 > Feb 5 01:19:05 thinkpad /bsd: tx ring 17: qid=17 cur=0 queued=0 > Feb 5 01:19:06 thinkpad /bsd: tx ring 18: qid=18 cur=0 queued=0 > Feb 5 01:19:06 thinkpad /bsd: tx ring 19: qid=19 cur=0 queued=0 > Feb 5 01:19:06 thinkpad /bsd: rx ring: cur=47 > Feb 5 01:19:06 thinkpad /bsd: 802.11 state 4
iwn firmware error
When forcing my laptop to swap, I almost immediately got the following firmware error. I'm not sure whether this is expected. Restarting the interface brought things back to normal. dmesg follows. Feb 5 01:19:04 thinkpad /bsd: iwn0: fatal firmware error Feb 5 01:19:04 thinkpad /bsd: firmware error log: Feb 5 01:19:04 thinkpad /bsd: error type = "NMI_INTERRUPT_WDG" (0x0004) Feb 5 01:19:04 thinkpad /bsd: program counter = 0x06B4 Feb 5 01:19:04 thinkpad /bsd: source line = 0xD3EA Feb 5 01:19:04 thinkpad /bsd: error data = 0x00020263 Feb 5 01:19:04 thinkpad /bsd: branch link = 0x067A071A Feb 5 01:19:04 thinkpad /bsd: interrupt link = 0x1532E762 Feb 5 01:19:04 thinkpad /bsd: time= 1346051188 Feb 5 01:19:04 thinkpad /bsd: driver status: Feb 5 01:19:04 thinkpad /bsd: tx ring 0: qid=0 cur=188 queued=135 Feb 5 01:19:04 thinkpad /bsd: tx ring 1: qid=1 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 2: qid=2 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 3: qid=3 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 4: qid=4 cur=135 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 5: qid=5 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 6: qid=6 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 7: qid=7 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 8: qid=8 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 9: qid=9 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 10: qid=10 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 11: qid=11 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 12: qid=12 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 13: qid=13 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 14: qid=14 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 15: qid=15 cur=0 queued=0 Feb 5 01:19:04 thinkpad /bsd: tx ring 16: qid=16 cur=0 queued=0 Feb 5 01:19:05 thinkpad /bsd: tx ring 17: qid=17 cur=0 queued=0 Feb 5 01:19:06 thinkpad /bsd: tx ring 18: qid=18 cur=0 queued=0 Feb 5 01:19:06 thinkpad /bsd: tx ring 19: qid=19 cur=0 queued=0 Feb 5 01:19:06 thinkpad /bsd: rx ring: cur=47 Feb 5 01:19:06 thinkpad /bsd: 802.11 state 4 OpenBSD 5.9 (GENERIC.MP) #0: Fri Feb 5 00:38:43 EST 2016 mike@thinkpad:/usr/src/sys/arch/amd64/compile/GENERIC.MP real mem = 4062691328 (3874MB) avail mem = 3933769728 (3751MB) mpath0 at root scsibus0 at mpath0: 256 targets mainbus0 at root bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xe0010 (78 entries) bios0: vendor LENOVO version "6QET61WW (1.31 )" date 10/26/2010 bios0: LENOVO 3626FAU acpi0 at bios0: rev 2 acpi0: sleep states S0 S3 S4 S5 acpi0: tables DSDT FACP SSDT ECDT APIC MCFG HPET ASF! SLIC BOOT SSDT TCPA SSDT SSDT SSDT acpi0: wakeup devices LID_(S3) SLPB(S3) IGBE(S4) EXP1(S4) EXP2(S4) EXP3(S4) EXP4(S4) EXP5(S4) EHC1(S3) EHC2(S3) HDEF(S4) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpiec0 at acpi0 acpimadt0 at acpi0 addr 0xfee0: PC-AT compat cpu0 at mainbus0: apid 0 (boot processor) cpu0: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2793.51 MHz cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT cpu0: 256KB 64b/line 8-way L2 cache cpu0: smt 0, core 0, package 0 mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges cpu0: apic clock running at 132MHz cpu0: mwait min=64, max=64, C-substates=0.2.1.1, IBE cpu1 at mainbus0: apid 1 (application processor) cpu1: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2793.00 MHz cpu1: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT cpu1: 256KB 64b/line 8-way L2 cache cpu1: smt 1, core 0, package 0 cpu2 at mainbus0: apid 4 (application processor) cpu2: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2793.00 MHz cpu2: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT cpu2: 256KB 64b/line 8-way L2 cache cpu2: smt 0, core 2, package 0 cpu3 at mainbus0: apid 5 (application processor) cpu3: Intel(R) Core(TM) i5 CPU M 540 @ 2.53GHz, 2793.00 MHz cpu3: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,POPCNT,AES,NXE,LONG,LAHF,PERF,ITSC,SENSOR,ARAT cpu3: 256KB 64b/line 8-way L2 cache cpu3: smt 1, core 2,
Nop null checks in ti(4)
Clang 3.7 warns about this. The rings are arrays, not pointers, so they can't be NULL. ok? Or should these checks be replaced rather than removed? Index: dev/ic/ti.c === RCS file: /cvs/src/sys/dev/ic/ti.c,v retrieving revision 1.22 diff -u -p -r1.22 ti.c --- dev/ic/ti.c 25 Nov 2015 03:09:58 - 1.22 +++ dev/ic/ti.c 5 Feb 2016 05:34:14 - @@ -484,9 +484,6 @@ ti_handle_events(struct ti_softc *sc) struct ti_event_desc*e; struct ifnet*ifp = &sc->arpcom.ac_if; - if (sc->ti_rdata->ti_event_ring == NULL) - return; - while (sc->ti_ev_saved_considx != sc->ti_ev_prodidx.ti_idx) { e = &sc->ti_rdata->ti_event_ring[sc->ti_ev_saved_considx]; switch (TI_EVENT_EVENT(e)) { @@ -846,9 +843,6 @@ ti_free_tx_ring(struct ti_softc *sc) { int i; struct ti_txmap_entry *entry; - - if (sc->ti_rdata->ti_tx_ring == NULL) - return; for (i = 0; i < TI_TX_RING_CNT; i++) { if (sc->ti_cdata.ti_tx_chain[i] != NULL) {
Re: Simplify tcpdump
Michael McConville wrote: > Stuart Henderson wrote: > > On 2016/01/26 20:16, Michael McConville wrote: > > > Stuart Henderson wrote: > > > > On 2016/01/25 22:52, Michael McConville wrote: > > > > > fddi_bitswap is only used once, and it just adds a layer of > > > > > indirection to its preprocessor condition. > > > > > > > > Oh yuk. This is bogus anyway, and there's no good way to handle it. We > > > > dropped support for FDDI interfaces so it only affect decodes of pcap > > > > files, and who knows where they were created? > > > > > > I'm not familiar with FDDI and I'm new to tcpdump, so I can't offer much > > > input. How much do you think can/should be removed? > > > > FDDI is a dual token-ring network based on 100Mb fibre connections, > > often over larger distances (campus/metro) than a typical lan. It's > > obsolete, we removed support for the adapters, the only place this > > code could possibly be used now is for parsing pcap files captured > > on another system or from older OpenBSD (and there's a kitchen-sink > > pcap decoder in ports these days..). > > > > This bitswap thing is because some OS bitswap the network addresses > > (in the driver or somewhere; they are swapped in pcap files) and some > > don't. > > > > I don't think that it's particularly useful for OpenBSD to support > > decoding this any more. Maybe we should stop rearranging these > > deckchairs and borrow tedu's axe instead. > > Something like this? There's a lot to be removed from libpcap too. Ping. Does anyone else think this is a good idea? Would anyone miss FDDI support? > Index: INSTALL > === > RCS file: /cvs/src/usr.sbin/tcpdump/INSTALL,v > retrieving revision 1.6 > diff -u -p -r1.6 INSTALL > --- INSTALL 5 Dec 2015 21:43:51 - 1.6 > +++ INSTALL 27 Jan 2016 01:49:10 - > @@ -15,7 +15,6 @@ bpf_dump.c - bpf instruction pretty-prin > decnet.h - DECnet definitions > ethertype.h - ethernet definitions > extract.h- alignment definitions > -fddi.h - Fiber Distributed Data Interface definitions > gmt2local.c - time conversion routines > gmt2local.h - time conversion prototypes > igrp.h - Interior Gateway Routing Protocol definitions > @@ -43,7 +42,6 @@ print-decnet.c - DECnet printer routines > print-domain.c - Domain Name System printer routines > print-enc.c - Encapsulated printer routines > print-ether.c- ethernet printer routines > -print-fddi.c - Fiber Distributed Data Interface printer routines > print-gre.c - Generic Routing Encapsulation printer routines > print-icmp.c - Internet Control Message Protocol printer routines > print-igrp.c - Interior Gateway Routing Protocol printer routines > Index: Makefile > === > RCS file: /cvs/src/usr.sbin/tcpdump/Makefile,v > retrieving revision 1.59 > diff -u -p -r1.59 Makefile > --- Makefile 14 Oct 2015 04:55:17 - 1.59 > +++ Makefile 27 Jan 2016 01:49:10 - > @@ -28,7 +28,7 @@ CFLAGS+=-Wall -I${.CURDIR}/../../sbin/pf > # for pcap-int.h > CFLAGS+=-I${.CURDIR}/../../lib/libpcap > > -CFLAGS+=-DCSLIP -DPPP -DHAVE_FDDI -DETHER_SERVICE -DHAVE_NET_SLIP_H > -DHAVE_ETHER_NTOHOST -DINET6 > +CFLAGS+=-DCSLIP -DPPP -DETHER_SERVICE -DHAVE_NET_SLIP_H -DHAVE_ETHER_NTOHOST > -DINET6 > > LDADD+= -lpcap -ll -lcrypto > DPADD+= ${LIBL} ${LIBPCAP} ${LIBCRYPTO} > @@ -38,7 +38,7 @@ SRCS= tcpdump.c addrtoname.c privsep.c p > print-atalk.c print-domain.c print-tftp.c print-bootp.c print-nfs.c \ > print-icmp.c print-sl.c print-ppp.c print-rip.c print-timed.c \ > print-snmp.c print-ntp.c print-null.c print-ospf.c print-gtp.c \ > - print-fddi.c print-llc.c print-sunrpc.c print-hsrp.c print-vqp.c \ > + print-llc.c print-sunrpc.c print-hsrp.c print-vqp.c \ > print-vrrp.c print-wb.c print-decnet.c print-isoclns.c print-ipx.c \ > print-atm.c print-dvmrp.c print-krb.c print-pim.c print-netbios.c \ > util.c bpf_dump.c parsenfsfh.c version.c print-igrp.c \ > Index: fddi.h > === > RCS file: fddi.h > diff -N fddi.h > --- fddi.h7 Oct 2007 16:41:05 - 1.7 > +++ /dev/null 1 Jan 1970 00:00:00 - > @@ -1,71 +0,0 @@ > -/* $OpenBSD: fddi.h,v 1.7 2007/10/07 16:41:05 deraadt Exp $*/ > - > -/* > - * Copyright (c) 1992, 1993, 1994, 1995, 1996 > - * The Regents of the University of California. All rights reserved. > - * > - * Redistribution and use in source and binary forms, with or without > - * modification, are permitted provided that: (1) source code distributions > - * retain the above copyright notice and this paragraph in its entirety, (2) > - * distributions including binary code include the above copyright notice and > - * this paragraph in its entirety in the documentation or other materials > - * provided with the distribution, a
Re: dhclient.c patch
Edgar Pettijohn wrote: > --- dhclient.c.origThu Feb 4 17:57:41 2016 > +++ dhclient.cThu Feb 4 17:57:55 2016 > @@ -57,7 +57,6 @@ > #include "privsep.h" > > #include > -#include > #include > #include > > is brought in through dhcpd.h It'd probably be better to add to all source files that need it and remove it from dhcpd.h. We've been moving toward including everything directly where it's needed. This makes builds faster and makes files more portable. ksh(1) and less(1) have been partially converted.
dhclient.c patch
--- dhclient.c.origThu Feb 4 17:57:41 2016 +++ dhclient.cThu Feb 4 17:57:55 2016 @@ -57,7 +57,6 @@ #include "privsep.h" #include -#include #include #include is brought in through dhcpd.h
Re: fix ADDBA params in ADDBA requests and responses
On Thu, Feb 04, 2016 at 09:42:03AM +0100, Stefan Sperling wrote: > This fixes up parameters in ADDBA requests and responses. > > Again, the current code is using the wrong bitmask to set the ack > policy bit. IEEE80211_BA_ACK_POLICY is for QoS BlockAck request > and response frames, not ADDBA request and response frames. Slightly nicer diff below, initializing ba_params on TX in a better place (we don't use the TX part yet, since we don't send A-MPDU yet but only receive them). > It's important to echo back the set of parameters we got from the AP. > This part is necessary to make the iwn/iwm apple fix I sent yesterday > actually work. Actually, it turns out this change makes airport APs work reliably independently of any driver changes. Index: ieee80211_input.c === RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v retrieving revision 1.156 diff -u -p -r1.156 ieee80211_input.c --- ieee80211_input.c 4 Feb 2016 16:23:40 - 1.156 +++ ieee80211_input.c 4 Feb 2016 16:52:24 - @@ -2499,6 +2499,7 @@ ieee80211_recv_addba_req(struct ieee8021 else if (ba->ba_timeout_val > IEEE80211_BA_MAX_TIMEOUT) ba->ba_timeout_val = IEEE80211_BA_MAX_TIMEOUT; ba->ba_ni = ni; + ba->ba_params = params; timeout_set(&ba->ba_to, ieee80211_rx_ba_timeout, ba); timeout_set(&ba->ba_gap_to, ieee80211_input_ba_gap_timeout, ba); ba->ba_winsize = bufsz; Index: ieee80211_node.h === RCS file: /cvs/src/sys/net80211/ieee80211_node.h,v retrieving revision 1.55 diff -u -p -r1.55 ieee80211_node.h --- ieee80211_node.h4 Feb 2016 16:23:40 - 1.55 +++ ieee80211_node.h4 Feb 2016 16:49:33 - @@ -120,6 +120,9 @@ struct ieee80211_tx_ba { #define IEEE80211_BA_REQUESTED 1 #define IEEE80211_BA_AGREED2 + /* ADDBA parameter set field for this BA agreement. */ + u_int16_t ba_params; + /* These values are IEEE802.11 frame sequence numbers (0x0-0xfff) */ u_int16_t ba_winstart; u_int16_t ba_winend; @@ -140,6 +143,7 @@ struct ieee80211_rx_ba { struct timeout ba_to; int ba_timeout_val; int ba_state; + u_int16_t ba_params; u_int16_t ba_winstart; u_int16_t ba_winend; u_int16_t ba_winsize; Index: ieee80211_output.c === RCS file: /cvs/src/sys/net80211/ieee80211_output.c,v retrieving revision 1.108 diff -u -p -r1.108 ieee80211_output.c --- ieee80211_output.c 21 Jan 2016 20:33:20 - 1.108 +++ ieee80211_output.c 4 Feb 2016 16:32:14 - @@ -1414,7 +1414,6 @@ ieee80211_get_addba_req(struct ieee80211 struct ieee80211_tx_ba *ba = &ni->ni_tx_ba[tid]; struct mbuf *m; u_int8_t *frm; - u_int16_t params; m = ieee80211_getmgmt(M_DONTWAIT, MT_DATA, 9); if (m == NULL) @@ -1424,12 +1423,7 @@ ieee80211_get_addba_req(struct ieee80211 *frm++ = IEEE80211_CATEG_BA; *frm++ = IEEE80211_ACTION_ADDBA_REQ; *frm++ = ba->ba_token; - params = ba->ba_winsize << IEEE80211_ADDBA_BUFSZ_SHIFT | - tid << IEEE80211_ADDBA_TID_SHIFT | - IEEE80211_ADDBA_AMSDU; - if ((ic->ic_htcaps & IEEE80211_HTCAP_DELAYEDBA) == 0) - params |= IEEE80211_ADDBA_BA_POLICY; /* use immediate BA */ - LE_WRITE_2(frm, params); frm += 2; + LE_WRITE_2(frm, ba->ba_params); frm += 2; LE_WRITE_2(frm, ba->ba_timeout_val / IEEE80211_DUR_TU); frm += 2; LE_WRITE_2(frm, ba->ba_winstart); frm += 2; @@ -1465,9 +1459,10 @@ ieee80211_get_addba_resp(struct ieee8021 *frm++ = IEEE80211_ACTION_ADDBA_RESP; *frm++ = token; LE_WRITE_2(frm, status); frm += 2; - params = tid << 2 | IEEE80211_BA_ACK_POLICY; if (status == 0) - params |= ba->ba_winsize << 6; + params = ba->ba_params; + else + params = tid << IEEE80211_ADDBA_TID_SHIFT; LE_WRITE_2(frm, params); frm += 2; if (status == 0) LE_WRITE_2(frm, ba->ba_timeout_val / IEEE80211_DUR_TU); Index: ieee80211_proto.c === RCS file: /cvs/src/sys/net80211/ieee80211_proto.c,v retrieving revision 1.62 diff -u -p -r1.62 ieee80211_proto.c --- ieee80211_proto.c 4 Feb 2016 16:23:40 - 1.62 +++ ieee80211_proto.c 4 Feb 2016 16:50:50 - @@ -646,6 +646,12 @@ ieee80211_addba_request(struct ieee80211 ba->ba_winsize = IEEE80211_BA_MAX_WINSZ; ba->ba_winstart = ssn; ba->ba_winend = (ba->ba_winstart + ba->ba_winsize - 1) & 0xfff; + ba->ba_params = + (ba->ba_winsize << IEEE80211_ADDBA_BUFSZ_SHIFT) | +
iwn: preserve ccmp key across htprot updates
HT protection updates forget about restoring the CCMP key to firmware so WPA breaks when protection mode changes. Index: if_iwn.c === RCS file: /cvs/src/sys/dev/pci/if_iwn.c,v retrieving revision 1.158 diff -u -p -r1.158 if_iwn.c --- if_iwn.c25 Jan 2016 11:27:11 - 1.158 +++ if_iwn.c4 Feb 2016 18:24:56 - @@ -5095,6 +5095,15 @@ iwn_update_htprot(struct ieee80211com *i sc->calib.state = IWN_CALIB_STATE_ASSOC; sc->calib_cnt = 0; timeout_add_msec(&sc->calib_to, 500); + + if ((ni->ni_flags & IEEE80211_NODE_RXPROT) && + ni->ni_pairwise_key.k_cipher == IEEE80211_CIPHER_CCMP) { + if ((error = iwn_set_key(ic, ni, &ni->ni_pairwise_key)) != 0) { + printf("%s: could not set pairwise ccmp key\n", + sc->sc_dev.dv_xname); + return; + } + } } /*
Re: rtadvd usage()
with the changes bluhm suggested OK florian@ On Thu, Feb 04, 2016 at 02:36:25PM +0100, Alexander Bluhm wrote: > On Thu, Feb 04, 2016 at 02:02:46PM +0100, J??r??mie Courr??ges-Anglas wrote: > > +static void usage(void); > > Can you make the usage static __dead void? > > > +#define OPTIONS ":c:ds" > > Our other daemons don't have a leading ':', why to be special here? > > > while ((ch = getopt(argc, argv, OPTIONS)) != -1) { > > This OPTIONS define looks quite useless. Why not put the string here? > > anyway, OK bluhm@ > -- I'm not entirely sure you are real.
Re: rtadvd usage()
On Thu, Feb 04, 2016 at 02:02:46PM +0100, J??r??mie Courr??ges-Anglas wrote: > +static void usage(void); Can you make the usage static __dead void? > +#define OPTIONS ":c:ds" Our other daemons don't have a leading ':', why to be special here? > while ((ch = getopt(argc, argv, OPTIONS)) != -1) { This OPTIONS define looks quite useless. Why not put the string here? anyway, OK bluhm@
rtadvd usage()
AFAIK none of our daemons ignore unknown options, I can't see why rtadvd(8) should be special. Bonus: - main doesn't need to be declared - rtadvd.c now uses poll(2), not select(2) ok? Index: rtadvd.c === RCS file: /cvs/src/usr.sbin/rtadvd/rtadvd.c,v retrieving revision 1.61 diff -u -p -r1.61 rtadvd.c --- rtadvd.c1 Dec 2015 12:11:31 - 1.61 +++ rtadvd.c4 Feb 2016 13:02:10 - @@ -130,7 +130,7 @@ u_int32_t ndopt_flags[] = { [ND_OPT_DNSSL] = NDOPT_FLAG_DNSSL, }; -int main(int, char *[]); +static void usage(void); static void set_die(int); static void die(void); static void sock_open(void); @@ -162,7 +162,7 @@ main(int argc, char *argv[]) closefrom(3); /* get command line options and arguments */ -#define OPTIONS "c:ds" +#define OPTIONS ":c:ds" while ((ch = getopt(argc, argv, OPTIONS)) != -1) { #undef OPTIONS switch (ch) { @@ -175,16 +175,14 @@ main(int argc, char *argv[]) case 's': sflag = 1; break; + default: + usage(); } } argc -= optind; argv += optind; - if (argc == 0) { - fprintf(stderr, - "usage: rtadvd [-ds] [-c configfile] " - "interface ...\n"); - exit(1); - } + if (argc == 0) + usage(); SLIST_INIT(&ralist); @@ -264,7 +262,7 @@ main(int argc, char *argv[]) timeout->tv_sec * 1000 + timeout->tv_usec / 1000)) < 0) { /* EINTR would occur upon SIGUSR1 for status dump */ if (errno != EINTR) - log_warn("select"); + log_warn("poll"); continue; } if (i == 0) /* timeout */ @@ -275,6 +273,14 @@ main(int argc, char *argv[]) rtadvd_input(); } exit(0);/* NOTREACHED */ +} + +static void +usage(void) +{ + fprintf(stderr, "usage: %s [-ds] [-c configfile] interface ...\n", + getprogname()); + exit(1); } static void -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Re: Signed overflow in ufs i_modrev calculation
On Wed, Jan 27, 2016 at 09:52 +0100, Martin Natano wrote: > In ufs, the calculation of i_modrev can produce signed overflow on 32 > bit architectures (found on i386). The tv.tv_usec * 4294 calculation is > designed to move the microseconds part of a struct timeval to the upper > bits of an unsigned(!) 32 bit value to make room for simple i_modrev > increments, but the calculation is performed signed, causing overflow. > The diff below gets rid of the overflow by casting to unsigned first. > > While there I replaced the union _qcvt/SETHIGH/SETLOW dance with simple > bitshift operations. > Committed, thanks!
fix ADDBA params in ADDBA requests and responses
This fixes up parameters in ADDBA requests and responses. Again, the current code is using the wrong bitmask to set the ack policy bit. IEEE80211_BA_ACK_POLICY is for QoS BlockAck request and response frames, not ADDBA request and response frames. It's important to echo back the set of parameters we got from the AP. This part is necessary to make the iwn/iwm apple fix I sent yesterday actually work. Index: ieee80211_input.c === RCS file: /cvs/src/sys/net80211/ieee80211_input.c,v retrieving revision 1.155 diff -u -p -r1.155 ieee80211_input.c --- ieee80211_input.c 1 Feb 2016 18:43:22 - 1.155 +++ ieee80211_input.c 4 Feb 2016 08:28:18 - @@ -2497,6 +2497,7 @@ ieee80211_recv_addba_req(struct ieee8021 ba->ba_state = IEEE80211_BA_INIT; ba->ba_timeout_val = timeout * IEEE80211_DUR_TU; ba->ba_ni = ni; + ba->ba_params = params; timeout_set(&ba->ba_to, ieee80211_rx_ba_timeout, ba); timeout_set(&ba->ba_gap_to, ieee80211_input_ba_gap_timeout, ba); ba->ba_winsize = bufsz; Index: ieee80211_node.h === RCS file: /cvs/src/sys/net80211/ieee80211_node.h,v retrieving revision 1.54 diff -u -p -r1.54 ieee80211_node.h --- ieee80211_node.h1 Feb 2016 18:43:22 - 1.54 +++ ieee80211_node.h4 Feb 2016 08:20:23 - @@ -117,6 +117,9 @@ struct ieee80211_tx_ba { #define IEEE80211_BA_REQUESTED 1 #define IEEE80211_BA_AGREED2 + /* ADDBA parameter set field for this BA agreement. */ + u_int16_t ba_params; + /* These values are IEEE802.11 frame sequence numbers (0x0-0xfff) */ u_int16_t ba_winstart; u_int16_t ba_winend; @@ -137,6 +140,7 @@ struct ieee80211_rx_ba { struct timeout ba_to; int ba_timeout_val; int ba_state; + u_int16_t ba_params; u_int16_t ba_winstart; u_int16_t ba_winend; u_int16_t ba_winsize; Index: ieee80211_output.c === RCS file: /cvs/src/sys/net80211/ieee80211_output.c,v retrieving revision 1.108 diff -u -p -r1.108 ieee80211_output.c --- ieee80211_output.c 21 Jan 2016 20:33:20 - 1.108 +++ ieee80211_output.c 3 Feb 2016 16:48:06 - @@ -1414,7 +1414,6 @@ ieee80211_get_addba_req(struct ieee80211 struct ieee80211_tx_ba *ba = &ni->ni_tx_ba[tid]; struct mbuf *m; u_int8_t *frm; - u_int16_t params; m = ieee80211_getmgmt(M_DONTWAIT, MT_DATA, 9); if (m == NULL) @@ -1424,12 +1423,15 @@ ieee80211_get_addba_req(struct ieee80211 *frm++ = IEEE80211_CATEG_BA; *frm++ = IEEE80211_ACTION_ADDBA_REQ; *frm++ = ba->ba_token; - params = ba->ba_winsize << IEEE80211_ADDBA_BUFSZ_SHIFT | - tid << IEEE80211_ADDBA_TID_SHIFT | - IEEE80211_ADDBA_AMSDU; - if ((ic->ic_htcaps & IEEE80211_HTCAP_DELAYEDBA) == 0) - params |= IEEE80211_ADDBA_BA_POLICY; /* use immediate BA */ - LE_WRITE_2(frm, params); frm += 2; + if (ba->ba_params == 0) { + ba->ba_params = + (ba->ba_winsize << IEEE80211_ADDBA_BUFSZ_SHIFT) | + (tid << IEEE80211_ADDBA_TID_SHIFT) | IEEE80211_ADDBA_AMSDU; + if ((ic->ic_htcaps & IEEE80211_HTCAP_DELAYEDBA) == 0) + /* immediate BA */ + ba->ba_params |= IEEE80211_ADDBA_BA_POLICY; + } + LE_WRITE_2(frm, ba->ba_params); frm += 2; LE_WRITE_2(frm, ba->ba_timeout_val / IEEE80211_DUR_TU); frm += 2; LE_WRITE_2(frm, ba->ba_winstart); frm += 2; @@ -1465,9 +1467,10 @@ ieee80211_get_addba_resp(struct ieee8021 *frm++ = IEEE80211_ACTION_ADDBA_RESP; *frm++ = token; LE_WRITE_2(frm, status); frm += 2; - params = tid << 2 | IEEE80211_BA_ACK_POLICY; if (status == 0) - params |= ba->ba_winsize << 6; + params = ba->ba_params; + else + params = tid << IEEE80211_ADDBA_TID_SHIFT; LE_WRITE_2(frm, params); frm += 2; if (status == 0) LE_WRITE_2(frm, ba->ba_timeout_val / IEEE80211_DUR_TU);