ath.c -> dmesg -> bug

2018-10-10 Thread NN

Hi All,

I try to analyse my dmesg with:

    # dmesg | grep ath0

and I can see ERROR message:

    > ath0 device timeout ...

I have checked "ath.c" file in "/cvs/src/sys/dev/ic/" on stable branch.

I found this one construction: "--sc->sc_tx_time == 0". Probably it's 
meen "0 == 0",


I have made this patch (see in attachment) and now it's working without 
any ERROR/WARNING for me.


Please confirm.

If my FIX for "ath.c" is correct, please update cvs in new 6.4 Release.

Many Thanks & Sorry for my English.

Oleg Pahl (München)

Index: ath.c
===
RCS file: /cvs/src/sys/dev/ic/ath.c,v
retrieving revision 1.116
diff -u -p -u -r1.116 ath.c
--- ath.c    31 Jan 2018 11:27:03 -    1.116
+++ ath.c    11 Oct 2018 00:06:54 -
@@ -930,7 +930,7 @@ ath_watchdog(struct ifnet *ifp)
 if ((ifp->if_flags & IFF_RUNNING) == 0 || sc->sc_invalid)
     return;
 if (sc->sc_tx_timer) {
-        if (--sc->sc_tx_timer == 0) {
+        if (sc->sc_tx_timer == 0) {
         printf("%s: device timeout\n", ifp->if_xname);
         ath_reset(sc, 1);
         ifp->if_oerrors++;

Index: ath.c
===
RCS file: /cvs/src/sys/dev/ic/ath.c,v
retrieving revision 1.116
diff -u -p -u -r1.116 ath.c
--- ath.c	31 Jan 2018 11:27:03 -	1.116
+++ ath.c	11 Oct 2018 00:06:54 -
@@ -930,7 +930,7 @@ ath_watchdog(struct ifnet *ifp)
 	if ((ifp->if_flags & IFF_RUNNING) == 0 || sc->sc_invalid)
 		return;
 	if (sc->sc_tx_timer) {
-		if (--sc->sc_tx_timer == 0) {
+		if (sc->sc_tx_timer == 0) {
 			printf("%s: device timeout\n", ifp->if_xname);
 			ath_reset(sc, 1);
 			ifp->if_oerrors++;



Re: Debug / Driver / Kernel / WiFi

2018-10-06 Thread NN

Hi all,

Many thanks for your support and reply!

I am not Profi (I have experience < 1year with OpenBSD and C 
Programming.), that why its will take me a lot of time to fix and try 
something.


After Mr. Sperling first review of my Code ... I have made few fixes.

In attachment you can see my new patch. Please, try it and send me your 
feedback.


Its working for me. (*no more ERROR: ath0 unable to reset hardware*)

My dmesg output:

ath0 at pci3 dev 0 function 0 "Atheros AR5424" rev 0x11: apic 2 int 18
ath0: AR5424 14.2 phy 7.0 rf 10.2 eeprom 5.3, WOR0W, address 
00:22:5f:54:aa:50


My pcidump output:

8:0:0: Atheros AR5424
    0x: Vendor ID: 168c Product ID: 001c
    0x0004: Command: 0107 Status: 0010
    0x0008: Class: 02 Subclass: 00 Interface: 00 Revision: 11
    0x000c: BIST: 00 Header Type: 00 Latency Timer: 00 Cache Line 
Size: 10

    0x0010: BAR mem 64bit addr: 0xfa00/0x0001
    0x0018: BAR empty ()
    0x001c: BAR empty ()
    0x0020: BAR empty ()
    0x0024: BAR empty ()
    0x0028: Cardbus CIS: 5001
    0x002c: Subsystem Vendor ID: 11ad Product ID: 6303
    0x0030: Expansion ROM Base Address: 
    0x0038: 
    0x003c: Interrupt Pin: 01 Line: 0a Min Gnt: 00 Max Lat: 00
    0x0040: Capability 0x01: Power Management
    State: D0
    0x0050: Capability 0x05: Message Signalled Interrupts (MSI)
    0x0060: Capability 0x10: PCI Express
    Link Speed: 2.5 / 2.5 GT/s Link Width: x1 / x1
    0x0100: Enhanced Capability 0x01: Advanced Error Reporting
    0x0140: Enhanced Capability 0x02: Virtual Channel Capability
    0x0090: Capability 0x11: Extended Message Signalled Interrupts 
(MSI-X)


Now I can scan all networks around me without error:

# doas ifconfig ath0 scan

ath0: flags=8843 mtu 1500
    lladdr 00:22:5f:54:aa:50
    index 2 priority 4 llprio 3
    groups: wlan
    media: IEEE802.11 autoselect (OFDM54 mode 11g)
    status: no network
    ieee80211: nwid RUDEUS chan 1 bssid e0:28:6d:41:65:f3 wpakey 
wpaprotos wpa2 wpaakms psk wpaciphers ccmp wpagroupcipher ccmp
    nwid "Vodafone Hotspot" chan 1 bssid 52:28:6d:41:65:f3 
*0%* HT-MCS23 short_preamble,short_slottime
    nwid Carames3 chan 1 bssid 5c:49:79:1b:b8:76 *0%* 
HT-MCS15 privacy,short_preamble,short_slottime,wpa2
    nwid "Vodafone Homespot" chan 1 bssid 62:28:6d:41:65:f3 
*0%* HT-MCS23 short_preamble,short_slottime
    nwid RUDEUS chan 1 bssid e0:28:6d:41:65:f3 *0%* 
HT-MCS23 privacy,short_preamble,short_slottime,wpa2


But you can see that 0% of Wi-Fi power, and I don't know why ? Any ideas ?

Many thanks for strong Support!
Oleg Pahl



On 10/05/18 22:42, Erling Westenvik wrote:

On Fri, Oct 05, 2018 at 05:12:33PM +0200, Stefan Sperling wrote:

On Fri, Oct 05, 2018 at 04:53:40PM +0200, def...@posteo.de wrote:

I try to make new driver for AR5424* WiFi Module (ath0) becouse of a lot
of issues on my Fujitsu Esprimo Mobile U9210 Laptop. (Just not working
out of the box)

I have two U9210's and would love to see support for the AR5424.
However, you might be better off by simply replacing the card. On one of
my two U9210's I replaced it with a working AR9281/athn(4) 802.11n.
Accessing the card is quite easy and requires only unscrewing two or
four screws and then carefully bending open the bezel above the
keyboard.

On Fri, Oct 05, 2018 at 05:12:33PM +0200, Stefan Sperling wrote:

Please fix the existing driver instead of adding a new one.
A patch was submitted for this device some time ago but there was
never any follow-up after the first round of review process:
https://marc.info/?t=15170706164&r=1&w=2

Actually that thread was the same OP. Right, Oleg?


You could use that patch as a starting point. But please note that it's
unclear whether some or all of these changes were copied from GPL code.
It would be better to base such changes on the FreeBSD driver which
seems to support this device as well.


Could you be so kind to answer:

1. How can I try my new Driver without Build Kernel each time.

No. You have to rebuild the kernel each time.


2. What kind of tools can I use for Debuging WiFi ... (just examples)

Many. Start working on it and ask again when you run into specific problems.


3. Any info about OpenBSD Drivers ? Developers Guides (Just for OpenBSD)

See https://www.openbsd.org/papers/eurobsdcon2017-device-drivers.pdf
and other presentations mentioned therein.

There is this article (also by Stefan) from 2014 as well:

http://undeadly.org/cgi?action=article&sid=20140721125235

Good luck. Please let me know if I can be of any help in testing.

Erling



Index: sys/dev/ic/ar5212.c
===
RCS file: /cvs/src/sys/dev/ic/ar5212.c,v
retrieving revision 1.59
diff -u -p -u -r1.59 ar5212.c
--- sys/dev/ic/ar5212.c	3 Feb 2018

Re: DNS (UNBOUND) + PF ISSUE

2018-08-29 Thread NN

Hi,

All is working for me with new ACL Rule:

    access-control: 0.0.0.0/0 allow

Many Thanks Solène Rapenne !

ISSUE is closed.

P.S.

Why opening unbound to the internet is a bad idea ???

Thx.

On 08/29/18 12:51, Solène Rapenne wrote:

Le 2018-08-29 12:41, NN a écrit :

Hi,

many thanks for your quick answer,
I try to  use your PF rule, and got the same answer from my DNS:

    ...
    >> WARNING: recursion requested but not available
    ...

I need the DNS request RULE's for my PF
Any ideas?

BR
deface


On 08/29/18 12:34, Arnaud BRAND wrote:

Le 2018-08-29 11:57, NN a écrit :

*Hi all,*

*Its my first topic here =)
*

*Please help me investigate DNS+PF issue. **
*

*I have 2 VM on OpenBSD 6.3:*

*    VM#1 - Router with PF, IP:192.168.50.1*

*    VM#2 - DNS (as unbound), IP:192.168.50.2**
*

*here is my pf.conf on VM#1:*

    int_if="{ vether0 re0 }"
    set block-policy drop
    set loginterface egress
    set skip on lo0
    match in all scrub (no-df random-id max-mss 1440)
    match out on egress inet from !(egress:network) to any nat-to 
(egress:0)

    pass out quick inet
    pass in on $int_if inet
    pass in on egress inet proto { tcp, udp } from any to (egress)
port 53 rdr-to 192.168.50.2

*I try to check how my Unbound DNS VM#2 working: *

*# dig @192.168.50.1 google.com*

    ; <<>> DiG 9.4.2-P2 <<>> @192.168.50.1 google.com
    ; (1 server found)
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2704
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, 
ADDITIONAL: 0


    ;; QUESTION SECTION:
    ;google.com.    IN  A

    ;; ANSWER SECTION:
    google.com. 299 IN  A 172.217.21.110

    ;; Query time: 35 msec
    ;; SERVER: 192.168.50.1#53(192.168.178.100)
    ;; WHEN: Wed Aug 29 11:35:57 2018
    ;; MSG SIZE  rcvd: 44

*Looks good. But if I try to do it out of my local net ... with:*

*# dig @external_IP google.com*

    ; <<>> DiG 9.4.2-P2 <<>> @external_IP google.com
    ; (1 server found)
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 24861
    ;; flags: qr rd; QUERY: 0, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
    ;; WARNING: recursion requested but not available <<<   <<<   
<<< ???


    ;; SERVER: external_IP#53
    ;; WHEN: Wed Aug 29 11:30:50 2018
    ;; MSG SIZE  rcvd: 12

*I think that my PF config is wrong. Please help to investigate my 
issue.*


*P.S: unbound.conf is here ...*

server:
    # interface: 188.192.103.156
    interface: 192.168.50.1
    interface: 127.0.0.1
    interface: ::1
    access-control: 0.0.0.0/0 refuse
    access-control: 127.0.0.0/8 allow
    access-control: ::0/0 refuse
    access-control: ::1 allow
    access-control: 192.168.1.0/24 allow
    access-control: 192.168.50.0/24 allow
    access-control: 192.168.178.0/24 allow
    do-not-query-localhost: no
    hide-identity: yes
    hide-version: yes
    port: 53

remote-control:
    control-enable: yes
    control-use-cert: no
    control-interface: /var/run/unbound.sock

forward-zone:
    name: "."
    forward-addr: 192.168.178.1 # fritz.box
    forward-addr: 8.8.8.8 # google.com
    forward-addr: 2001:4860:4860:: # google.com v6
    forward-first: yes # try direct if forwarder fails

Sorry for my English,

BR

deface


Eh... something's off in your configs.
You wrote:
 DNS (as unbound), IP:192.168.50.2
But unbound.conf contains :
 interface: 192.168.50.1
May be it's not used and redirected to 127.0.0.1 ?

Anyway, are you trying to match DNS requests origintaing from the 
inside network and going to public DNS through egress and then 
redirecting these requests to unbound ?

If so, I think you might want to add this rule :
pass in on $int_if inet proto { tcp, udp } from !$UNBOUND_SERVER to 
any  port 53 rdr-to $UNBOUND_SERVER




you have to allow your IP in unbound.conf, look at your rules:

 access-control: 0.0.0.0/0 refuse
 access-control: 127.0.0.0/8 allow
 access-control: ::0/0 refuse
 access-control: ::1 allow
 access-control: 192.168.1.0/24 allow
 access-control: 192.168.50.0/24 allow
 access-control: 192.168.178.0/24 allow

if you are not in the last 3 ranges specified, you won't be allowed
to make a request.

Note: Opening unbound to the internet is a bad idea.





Re: DNS (UNBOUND) + PF ISSUE

2018-08-29 Thread NN

Hi,

many thanks for your quick answer,
I try to  use your PF rule, and got the same answer from my DNS:

    ...
    >> WARNING: recursion requested but not available
    ...

I need the DNS request RULE's for my PF
Any ideas?

BR
deface


On 08/29/18 12:34, Arnaud BRAND wrote:

Le 2018-08-29 11:57, NN a écrit :

*Hi all,*

*Its my first topic here =)
*

*Please help me investigate DNS+PF issue. **
*

*I have 2 VM on OpenBSD 6.3:*

*    VM#1 - Router with PF, IP:192.168.50.1*

*    VM#2 - DNS (as unbound), IP:192.168.50.2**
*

*here is my pf.conf on VM#1:*

    int_if="{ vether0 re0 }"
    set block-policy drop
    set loginterface egress
    set skip on lo0
    match in all scrub (no-df random-id max-mss 1440)
    match out on egress inet from !(egress:network) to any nat-to 
(egress:0)

    pass out quick inet
    pass in on $int_if inet
    pass in on egress inet proto { tcp, udp } from any to (egress)
port 53 rdr-to 192.168.50.2

*I try to check how my Unbound DNS VM#2 working: *

*# dig @192.168.50.1 google.com*

    ; <<>> DiG 9.4.2-P2 <<>> @192.168.50.1 google.com
    ; (1 server found)
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2704
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

    ;; QUESTION SECTION:
    ;google.com.    IN  A

    ;; ANSWER SECTION:
    google.com. 299 IN  A 172.217.21.110

    ;; Query time: 35 msec
    ;; SERVER: 192.168.50.1#53(192.168.178.100)
    ;; WHEN: Wed Aug 29 11:35:57 2018
    ;; MSG SIZE  rcvd: 44

*Looks good. But if I try to do it out of my local net ... with:*

*# dig @external_IP google.com*

    ; <<>> DiG 9.4.2-P2 <<>> @external_IP google.com
    ; (1 server found)
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 24861
    ;; flags: qr rd; QUERY: 0, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
    ;; WARNING: recursion requested but not available <<<   <<<   <<< 
???


    ;; SERVER: external_IP#53
    ;; WHEN: Wed Aug 29 11:30:50 2018
    ;; MSG SIZE  rcvd: 12

*I think that my PF config is wrong. Please help to investigate my 
issue.*


*P.S: unbound.conf is here ...*

server:
    # interface: 188.192.103.156
    interface: 192.168.50.1
    interface: 127.0.0.1
    interface: ::1
    access-control: 0.0.0.0/0 refuse
    access-control: 127.0.0.0/8 allow
    access-control: ::0/0 refuse
    access-control: ::1 allow
    access-control: 192.168.1.0/24 allow
    access-control: 192.168.50.0/24 allow
    access-control: 192.168.178.0/24 allow
    do-not-query-localhost: no
    hide-identity: yes
    hide-version: yes
    port: 53

remote-control:
    control-enable: yes
    control-use-cert: no
    control-interface: /var/run/unbound.sock

forward-zone:
    name: "."
    forward-addr: 192.168.178.1 # fritz.box
    forward-addr: 8.8.8.8 # google.com
    forward-addr: 2001:4860:4860:: # google.com v6
    forward-first: yes # try direct if forwarder fails

Sorry for my English,

BR

deface


Eh... something's off in your configs.
You wrote:
 DNS (as unbound), IP:192.168.50.2
But unbound.conf contains :
 interface: 192.168.50.1
May be it's not used and redirected to 127.0.0.1 ?

Anyway, are you trying to match DNS requests origintaing from the 
inside network and going to public DNS through egress and then 
redirecting these requests to unbound ?

If so, I think you might want to add this rule :
pass in on $int_if inet proto { tcp, udp } from !$UNBOUND_SERVER to 
any  port 53 rdr-to $UNBOUND_SERVER






DNS (UNBOUND) + PF ISSUE

2018-08-29 Thread NN

*Hi all,*

*Its my first topic here =)
*

*Please help me investigate DNS+PF issue. **
*

*I have 2 VM on OpenBSD 6.3:*

*    VM#1 - Router with PF, IP:192.168.50.1*

*    VM#2 - DNS (as unbound), IP:192.168.50.2**
*

*here is my pf.conf on VM#1:*

    int_if="{ vether0 re0 }"
    set block-policy drop
    set loginterface egress
    set skip on lo0
    match in all scrub (no-df random-id max-mss 1440)
    match out on egress inet from !(egress:network) to any nat-to 
(egress:0)

    pass out quick inet
    pass in on $int_if inet
    pass in on egress inet proto { tcp, udp } from any to (egress) port 
53 rdr-to 192.168.50.2


*I try to check how my Unbound DNS VM#2 working: *

*# dig @192.168.50.1 google.com*

    ; <<>> DiG 9.4.2-P2 <<>> @192.168.50.1 google.com
    ; (1 server found)
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2704
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

    ;; QUESTION SECTION:
    ;google.com.    IN  A

    ;; ANSWER SECTION:
    google.com. 299 IN  A 172.217.21.110

    ;; Query time: 35 msec
    ;; SERVER: 192.168.50.1#53(192.168.178.100)
    ;; WHEN: Wed Aug 29 11:35:57 2018
    ;; MSG SIZE  rcvd: 44

*Looks good. But if I try to do it out of my local net ... with:*

*# dig @external_IP google.com*

    ; <<>> DiG 9.4.2-P2 <<>> @external_IP google.com
    ; (1 server found)
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 24861
    ;; flags: qr rd; QUERY: 0, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
    ;; WARNING: recursion requested but not available <<<   <<<   <<< ???

    ;; SERVER: external_IP#53
    ;; WHEN: Wed Aug 29 11:30:50 2018
    ;; MSG SIZE  rcvd: 12

*I think that my PF config is wrong. Please help to investigate my issue.*

*P.S: unbound.conf is here ...*

server:
    # interface: 188.192.103.156
    interface: 192.168.50.1
    interface: 127.0.0.1
    interface: ::1
    access-control: 0.0.0.0/0 refuse
    access-control: 127.0.0.0/8 allow
    access-control: ::0/0 refuse
    access-control: ::1 allow
    access-control: 192.168.1.0/24 allow
    access-control: 192.168.50.0/24 allow
    access-control: 192.168.178.0/24 allow
    do-not-query-localhost: no
    hide-identity: yes
    hide-version: yes
    port: 53

remote-control:
    control-enable: yes
    control-use-cert: no
    control-interface: /var/run/unbound.sock

forward-zone:
    name: "."
    forward-addr: 192.168.178.1 # fritz.box
    forward-addr: 8.8.8.8 # google.com
    forward-addr: 2001:4860:4860:: # google.com v6
    forward-first: yes # try direct if forwarder fails

Sorry for my English,

BR

deface