# intel dual band wireless-ac 3165 / wpa_supplicant



## lawg (May 7, 2017)

Hi,

Just installed Freebsd 11 p9. Total noob. 2 days Googling wireless setup and now stuck here.

Modem Router: TP-Link wireless n ADSL2
Computer: LENOVO ideapad 310
On board wireless chipset: Intel dual band wireless AC 3165 Model 3165NGW
Driver: Freebsd iwm(4)

Upon boot:
`.
         .
         Starting wpa_supplicant.
         /etc/rc.d/wpa_supplicant: WARNING: failed to start wpa_supplicant
         Starting dhclient.
         wlan0: no link...................giving up
          /etc/rc.d/dhclient: WARNING: failed to start dhclient
         .
         .`

I created a wpa_supplicant at /etc/wpa_supplicant.conf. As per handbook 30.3 Wireless Networking. Err, the code I got from elsewhere. Presumably when scanning, it will show 2 wifi 'hotspot/name/ssid' and you select which one to use.


```
network={
priority=1
ssid=”wifi1″
psk=”one”
}

network={
priority=2
ssid=”wifi2″
psk=”two”
}
```

The default wpa_supplicant script:


```
#!/bin/sh
#
#$FreeBSD: releng/11.0/etc/rc.d/wpa_supplicant 298514 2016-04-23 16:10:54Z lme $
#

#PROVIDE: wpa_supplicant
#REQUIRE: mountcritremote
#KEYWORD: nojail nostart

. /etc/rc.subr
. /etc/network.subr

name="wpa_supplicant"
desc="WPA/802.11i Supplicant for wireless network devices"
rcvar=

ifn="$2"
if [ -z "$ifn" ]; then
          return 1
fi

is_ndis_interface()
{
            case 'systctl -n net.wlan.$(1#wlan.%parent 2>/dev/null' in ndis*) true ;;
                        *) false ;;
            esac
}

if is_wired_interface $(ifn) ; then
         driver="wired"
elif is_ndis_interface $(ifn) ; then
         driver="ndis"
else
         driver="bsd"
fi

load_rc_config $name

command=${wpa_supplicant_program}
conf_file=${wpa_supplicant_conf_file}
pidfile="/var/run/${name}/${ifn}.pid"
command_args="-B -i $ifn -c $conf_file -D $driver -P $pidfile"
required_files=$conf_file
required_modules="wlan_wep wlan_tkip wlan_ccmp"

run_rc_command "$1"
```
 
The system is using the default /etc/rc.d/wpa_supplicant script/file instead the one that I create at /etc/wpa_supplicant.conf


Thank you for advises.


----------



## tobik@ (May 7, 2017)

lawg said:


> Err, the code I got from elsewhere.
> 
> 
> 
> ...


You are using wrong quotation marks in your /etc/wpa_supplicant.conf: ” != ". Be careful when you copy things.


----------



## lawg (May 13, 2017)

Thank you for your reply tobik.


The wireless seems to be up:-

```
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MUITICAST> metric 0 mtu 1500
ether ac:2b:6e:79:07:16
nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
status: no carrier
ssid "" channel 1 (2412 MHz 11g)
regdomain FCC country US authmode OPEN privacy OFF txpower 30
bmiss 10 scanvalid 60 protmode CTS wme bintval 0
group: wlan
```

I did a scan command: `ifconfig wlan0 scan` and it returned

```
SSID/MESH ID       BSSID                        CHAN   RATE     S:N     INT CAPS
homewifi                         18:a6:f7:62:0a:fb          1       54M     27:0    100 EP     APCHANREP APCHANREP RSN WPS HTCAP WME
```

Then I entered this command: `wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf` and the computer output:

```
Successfully initialized wpa_supplicant
Line 2: unknown network field 'piority'.
Line 4: Invalid passphrase length 3 (expected: 8..63) 'one"'.
Line 4: failed to parse psk ' "one" '.
Line 5: failed to parse network block.
Line 8: unknown network field 'piority'.
Line 10:Invalid passphrase length 3 (expected: 8..63) 'two"'.
Line 10: failed to parse psk ' "two" '.
Line 11: failed to parse network block.
Failed to read or parse configuration '/etc/wpa_supplicant.conf'.
```

Would appreciate it if somebody could give some pointers as to what is happening and what to do next.

Oh by the way, what is the command to do a 'manual' connect to the wireless router/modem?

Thank you.


----------



## aonishenko (May 16, 2017)

lawg said:


> Thank you for your reply tobik.
> 
> 
> The wireless seems to be up:-
> ...


It seems, like your PSK must be 8 characters long or less 63 characters long. Check your PSK setting on router and config.


----------



## SirDice (May 16, 2017)

Yep. The PSK needs to be between 8 and 63 characters. Both 'one' and 'two' are too short.


----------



## lawg (May 17, 2017)

Thank you aonishenko and SirDice for the pointers and have taken steps.

I have changed the codes to the actual codes


```
network={
priority=1
ssid=”home1″
psk=”actual code”
}

network={
priority=2
ssid=”wifi2″
psk=”two”
}
```

Then I did this `wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf`. And I got this, err, it's from the screen:-


```
iwm0: 00000000 | isr4
iwm0: 00010110 | last cmd Id
iwm0: 00000000 | wait event
iwm0: 00000000 | 12p_control
iwm0: 00440000 | 12p_duration
iwm0: 00000000 | 12p_mhvalid
iwm0: 00000000 | 12p_addr_match
iwm0: 00000007 | 1mpm_pmg_sel
iwm0: 22121936 | timestamp
iwm0: 00001828 | flow_handler
iwm0: driver status:
iwm0: tx ring 0: qid=0 cur=1 queued=1
iwm0: tx ring 1: qid=1 cur=0 queued=0
                   .
                   .
                   .
iwm0: tx ring 9: qid=9 cur=30 queued=0
iwm0: tx ring 10: qid=10 cur=0 queued=0
                   .
                   .
                   .
iwm0: tx ring 30: qid=30 cur=0 queued=0
iwm0: tx ring: cur=31
iwm0: 802.11 state 0
iwm0: iwm_intr: controller panicked, iv_state = 0; restarting
May 16 22:25:37 mycomp dhclient[3138]: send_packet: No buffer space available
May 16 22:25:50 mycomp dhclient[3138]: send_packet: Network is down
```
 The last 2 lines are 'normal' screen output while those above are 'white'. I had to CTRL-C and `service netif stop` to stop the process else it keeps repeating.

Errr, how do I retrieve the error log?

Any ideas?


----------



## SirDice (May 17, 2017)

Run this command instead: `wpa_supplicant -d -i wlan0 -c /etc/wpa_supplicant.conf`. So replace -B (Run in the background) with -d (run in foreground with debug enabled). Hopefully that provides some extra information.


```
-d      Enable debugging messages.  If this option is supplied twice,
             more verbose messages are displayed.
```


----------



## lawg (May 17, 2017)

Run the command as per your suggestion SirDice, got the following:-

```
wpa_supplicant v2.5
Successfully initialized wpa_supplicant
Initializing interface 'wlan0' conf '/etc/wpa_supplicant.conf' driver 'default' ctrl_interface 'N/A' bridge 'N/A'
Configuration file '/etc/wpa_supplicant.conf' -> '/etc/wpa_supplicant.conf'
Reading configuration file '/etc/wpa_supplicant.conf'
Priority group 2
  id=1 ssid='wifi2'
Priority group 1
  id=0 ssid='myhome1'
wpa_driver_bsd_capa: drivercaps=0x0580c001, cryptocaps=0x00000000
Add interface wlan0 to a new radio N/A
wlan0: Own MAC address: ac:2b:6e:79:07:16
bsd_set_key: alg=0 addr=0x0 key_idx=0 set_tx=0 seq_len=0 key_len=0
bsd_del_key: key_idx=0
      .
      .
bsd_set_key: alg=0 addr=0x0 key_idx=3 set_tx=0 seq_len=0 key_len=0
bsd_del_key: key_idx=3
wpa_driver_bsd_set_countermeasures: enabled=0
wlan0: RSN: flushing PMKID list in the driver
wlan0: Setting scan request: 0.100000 sec
wlan0: WPS: UUID based on MAC address:989d0814-b31e-51c5-afa7-6fb49aee5d9a
ENGINE: Loading dynamic engine
ENGINE: Loading dynamic engine
EAPOL: SUPP_PAE entering state DISCONNECTED
EAPOL: Supplicant port status: Unauthorized
EAPOL: KEY_RX entering state NO_KEY_RECEIVE
EAPOL: SUPP_BE entering state INITIALIZE
EAP: EAP entering state DISABLED
wlan0: Added interface wlan0
wlan0: State: DISCONNECTED -> DISCONNECTED
wlan0: State: DISCONNECTED -> SCANNING
wlan0: Starting AP scan for wildcard ssid
wlan0: Add radio work 'scan'@0x801ccf000
wlan0: First radio work item in the queue - schedule start immediately
wlan0: Starting radio work 'scan'@0x801ccf000 after 0.000006 second wait
wpa_driver_bsd_set_wpa: enabled=1
wpa_driver_bsd_set_wpa_internal: wpa=3 privacy=1
EAPOL: disable timer tick
Invalid routing message version=0
   .
   .
   .
```

It keeps printing the `Invalid routing message version=0` until I hit `CTRL+C`


----------



## lawg (May 29, 2017)

Can anybody assist me with this problem? Any idea what is happening? If freebsd 11 is unable to handle this particular module, can you suggest an alternate system? 

Thank you in advance.


----------



## lawg (Jun 5, 2017)

Based on Freebsd 11.0-RELEASE Hardware Notes (https://www.freebsd.org/releases/11.0R/hardware.html#wlan), the above mentioned item is not supported.

Thank you for your assistance.


----------

