# wpa_supplicant/eapol_test



## Biker (Apr 28, 2015)

I'm trying build eapol_test from wpa_supplicant port, but I get this error:

```
CC  config.c
  CC  notify.c
  CC  bss.c
  CC  eap_register.c
  CC  ../src/utils/common.c
  CC  ../src/utils/wpa_debug.c
  CC  ../src/utils/wpabuf.c
  CC  wmm_ac.c
  CC  ../src/utils/os_unix.c
../src/utils/Packet32.c:131:14: error: passing 'int8_t *' (aka 'signed char *') to parameter of type 'const char *'
      converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
        if (strncmp(iface, "\\Device\\NPF_", 12) == 0)
                    ^~~~~
/usr/include/string.h:100:26: note: passing argument to parameter here
int      strncmp(const char *, const char *, size_t) __pure;
                             ^
../src/utils/Packet32.c:133:19: error: passing 'int8_t *' (aka 'signed char *') to parameter of type 'const char *'
      converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
        else if (strncmp(iface, "\\DEVICE\\", 8) == 0)
                         ^~~~~
/usr/include/string.h:100:26: note: passing argument to parameter here
int      strncmp(const char *, const char *, size_t) __pure;
                             ^
../src/utils/Packet32.c:139:23: error: passing 'int8_t *' (aka 'signed char *') to parameter of type 'const char *'
      converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
        strncpy(ireq.i_name, iface, sizeof (ifr.ifr_name));
                             ^~~~~
/usr/include/string.h:101:57: note: passing argument to parameter here
char    *strncpy(char * __restrict, const char * __restrict, size_t);
                                                           ^
../src/utils/Packet32.c:150:31: error: passing 'int8_t *' (aka 'signed char *') to parameter of type 'const char *'
      converts between pointers to integer types with different sign [-Werror,-Wpointer-sign]
        strncpy(ifr.ifr_name, iface, sizeof (ifr.ifr_name));
                              ^~~~~
/usr/include/string.h:101:57: note: passing argument to parameter here
char    *strncpy(char * __restrict, const char * __restrict, size_t);
                                                           ^
../src/utils/Packet32.c:117:8: error: unused variable 'ifflags' [-Werror,-Wunused-variable]
        int                     ifflags;
                                ^
../src/utils/Packet32.c:250:8: error: assigning to 'char *' from 'int8_t *' (aka 'signed char *') converts between
      pointers to integer types with different sign [-Werror,-Wpointer-sign]
        plist = namelist;
              ^ ~~~~~~~~
../src/utils/Packet32.c:248:8: error: unused variable 'i' [-Werror,-Wunused-variable]
        int                     i, ifcnt = 0;
                                ^
7 errors generated.
Makefile:1707: recipe for target '../src/utils/Packet32.o' failed
gmake: *** [../src/utils/Packet32.o] Error 1
```

I don't know what should I do to build this.
Can anyone help me?


----------



## talsamon (Apr 28, 2015)

Which FreeBSD version? Which port version of wpa_supplicant? Which Options you set or default options? And what is in /etc/make.conf?

I don't have this two warnings, so I guess you have an old version (recent version is wpa_supplicant-2.4_2)

```
../src/utils/Packet32.c:117:8: error: unused variable 'ifflags' [-Werror,-Wunused-variable]
  int  ifflags;
  ^
../src/utils/Packet32.c:248:8: error: unused variable 'i' [-Werror,-Wunused-variable]
  int  i, ifcnt = 0;
  ^
```

(I don't really think it depends on -Wunused warnings, but you can try it with `CFLAGS=-Wno-unused-variable`. But I think it's caused by other things).


----------



## talsamon (Apr 28, 2015)

Sorry, seems I read the half. With `CONFIG_EAPOL_TEST=y` got the same error.


----------



## talsamon (Apr 28, 2015)

Works for me if I set Option NDIS to off.


----------



## Biker (Apr 28, 2015)

Thanks talsamon, it helped. But now I have next one:

```
CC  config.c
  CC  notify.c
  CC  bss.c
  CC  eap_register.c
  CC  ../src/utils/common.c
  CC  ../src/utils/wpa_debug.c
  CC  ../src/utils/wpabuf.c
  CC  wmm_ac.c
  CC  ../src/utils/os_unix.c
  CC  ../src/utils/eloop.c
  CC  config_file.c
  CC  ../src/rsn_supp/wpa_ft.c
  CC  ../src/rsn_supp/wpa.c
  CC  ../src/rsn_supp/preauth.c
  CC  ../src/rsn_supp/pmksa_cache.c
  CC  ../src/rsn_supp/peerkey.c
  CC  ../src/rsn_supp/wpa_ie.c
  CC  ../src/common/wpa_common.c
  CC  hs20_supplicant.c
  CC  interworking.c
  CC  ../src/eap_peer/eap_peap.c
  CC  ../src/eap_common/eap_peap_common.c
  CC  ../src/eap_peer/eap_ttls.c
  CC  wps_supplicant.c
  CC  ../src/utils/uuid.c
  CC  ../src/eap_peer/eap_wsc.c
  CC  ../src/eap_common/eap_wsc_common.c
  CC  ../src/wps/wps.c
  CC  ../src/wps/wps_common.c
  CC  ../src/wps/wps_attr_parse.c
  CC  ../src/wps/wps_attr_build.c
  CC  ../src/wps/wps_attr_process.c
  CC  ../src/wps/wps_dev_attr.c
  CC  ../src/wps/wps_enrollee.c
  CC  ../src/wps/wps_registrar.c
  CC  ../src/eapol_supp/eapol_supp_sm.c
  CC  ../src/eap_peer/eap.c
  CC  ../src/eap_peer/eap_methods.c
  CC  ../src/crypto/ms_funcs.c
  CC  ../src/eap_common/chap.c
  CC  ../src/eap_peer/eap_tls_common.c
  CC  ../src/crypto/tls_openssl.c
  CC  ../src/crypto/crypto_openssl.c
  CC  ../src/crypto/aes-omac1.c
  CC  ../src/crypto/aes-cbc.c
  CC  ../src/crypto/sha256-prf.c
  CC  ../src/crypto/dh_groups.c
  CC  ../src/crypto/random.c
  CC  ctrl_iface.c
  CC  ctrl_iface_unix.c
  CC  ../src/utils/base64.c
  CC  ../src/common/ieee802_11_common.c
  CC  ../src/common/hw_features_common.c
  CC  ../src/eap_common/eap_common.c
  CC  ../src/crypto/sha1-prf.c
  CC  ../src/crypto/sha1-tlsprf.c
  CC  ../src/common/gas.c
  CC  gas_query.c
  CC  offchannel.c
  CC  ../src/drivers/driver_common.c
  CC  wpa_supplicant.c
  CC  events.c
  CC  blacklist.c
  CC  wpas_glue.c
  CC  scan.c
  CC  ../src/l2_packet/l2_packet_freebsd.c
  CC  eapol_test.c
  CC  ../src/radius/radius_client.c
  CC  ../src/radius/radius.c
  CC  ../src/utils/ip_addr.c
../src/utils/os_unix.o: In function `os_daemonize':
/tmp/obj/ports/wpa_supplicant/wpa_supplicant-2.4/wpa_supplicant/../src/utils/os_unix.c:209: undefined reference to `pidfile_open'
/tmp/obj/ports/wpa_supplicant/wpa_supplicant-2.4/wpa_supplicant/../src/utils/os_unix.c:227: undefined reference to `pidfile_write'
/tmp/obj/ports/wpa_supplicant/wpa_supplicant-2.4/wpa_supplicant/../src/utils/os_unix.c:221: undefined reference to `pidfile_remove'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:1633: recipe for target 'eapol_test' failed
gmake: *** [eapol_test] Error 1
```

System:

```
10.1-STABLE FreeBSD 10.1-STABLE #0 r281609: Fri Apr 17 02:41:55 UTC 2015     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```

Port: wpa_supplicant-2.4_2


----------



## talsamon (Apr 28, 2015)

Please, send the result of `make showconfig` (I don't want to test each option).

Works for me at least with this options:

```
TLS=on: Transport Layer Security
  PEAP=on: Protected Extensible Authentication Protocol
  TTLS=on: Tunneled Transport Layer Security
  MD5=on: MD5 hash (deprecated, no key generation)
  MSCHAPv2=on: Microsoft CHAP version 2 (RFC 2759)
  GTC=on: Generic Token Card
  LEAP=on: Lightweight Extensible Authentication Protocol
  OTP=on: One-Time Password
  PSK=on: Pre-Shared key
  FAST=off: Flexible Authentication via Secure Tunneling
  SIM=off: Subscriber Identity Module
  PWD=off: Shared password (RFC 5931)
  PAX=off: Password Authenticated Exchange
  AKA=off: Autentication and Key Agreement (UMTS)
  AKA_PRIME=off: AKA Prime variant (RFC 5448)
  SAKE=off: Shared-Secret Authentication & Key Establishment
  GPSK=off: Generalized Pre-Shared Key
  TNC=off: Trusted Network Connect
  IKEv2=off: Internet Key Exchange version 2
  EKE=off: Encrypted Key Exchange
```


----------



## talsamon (Apr 28, 2015)

It seems all options are working,  except NDIS and P2P.


----------



## Biker (Apr 28, 2015)

These are my settings:

```
===> The following configuration options are available for wpa_supplicant-2.4_2:
     DEBUG_FILE=on: Support for writing debug log to a file
     DEBUG_SYSLOG=off: Send debug messages to syslog instead of stdout
     DELAYED_MIC=off: Mitigate TKIP attack, random delay on MIC errors
     HS20=on: Hotspot 2.0
     HT_OVERRIDES=off: Disable HT/HT40, mask MCS rates, etc
     IEEE80211AC=off: Very High Throughput, AP mode (IEEE 802.11ac)
     IEEE80211N=off: High Throughput, AP mode (IEEE 802.11n)
     IEEE80211R=on: Fast BSS Transition (IEEE 802.11r-2008)
     IEEE80211W=off: Management Frame Protection (IEEE 802.11w)
     INTERWORKING=on: Improve ext. network interworking (IEEE 802.11u)
     NO_ROAMING=off: Disable roaming
     P2P=off: Peer-to-Peer support
     PKCS12=on: PKCS#12 (PFS) support
     PRIVSEP=off: Privilege separation
     SMARTCARD=on: Private key on smartcard support
     TDLS=off: Tunneled Direct Link Setup
     TLSV12=off: Build with TLS v1.2 instead of TLS v1.0
     VHT_OVERRIDES=off: Disable VHT, mask MCS rates, etc
     WPS=on: Wi-Fi Protected Setup
     WPS_ER=off: Enable WPS External Registrar
     WPS_NFC=off: Near Field Communication (NFC) configuration
     WPS_NOREG=off: Disable open network credentials when registrar
====> Driver options: you have to choose at least one of them
     BSD=on: BSD net80211 interface
     WIRED=on: Wired ethernet interface
     NDIS=off: Windows NDIS interface
     TEST=on: Development testing interface
     NONE=off: The 'no driver' interface, e.g. WPS ER only
====> Extensible Authentication Protocols: you have to choose at least one of them
     TLS=on: Transport Layer Security
     PEAP=on: Protected Extensible Authentication Protocol
     TTLS=on: Tunneled Transport Layer Security
     MD5=on: MD5 hash (deprecated, no key generation)
     MSCHAPv2=on: Microsoft CHAP version 2 (RFC 2759)
     GTC=on: Generic Token Card
     LEAP=on: Lightweight Extensible Authentication Protocol
     OTP=on: One-Time Password
     PSK=on: Pre-Shared key
     FAST=off: Flexible Authentication via Secure Tunneling
     SIM=off: Subscriber Identity Module
     PWD=off: Shared password (RFC 5931)
     PAX=off: Password Authenticated Exchange
     AKA=off: Autentication and Key Agreement (UMTS)
     AKA_PRIME=off: AKA Prime variant (RFC 5448)
     SAKE=off: Shared-Secret Authentication & Key Establishment
     GPSK=off: Generalized Pre-Shared Key
     TNC=off: Trusted Network Connect
     IKEv2=off: Internet Key Exchange version 2
     EKE=off: Encrypted Key Exchange
```

And make.conf

```
WRKDIRPREFIX?=/tmp/obj
WRKDIR?=${WRKDIRPREFIX}/ports/${.CURDIR:C/.*\///}
DISTDIR=/usr/local/ports/distfiles
```

How you build eapol_test?
By run `make eapol`?


----------



## talsamon (Apr 28, 2015)

Oh, sorry, I have complete missunderstood.


----------



## Ethereal (Sep 4, 2018)

Hi all,

I'm facing a problem as well when trying to make the eapol_test. Please see the output below. Does anyone have any suggestions?

```
2.4.4-DEVELOPMENT][admin@friday.localdomain]/usr/local/sbin/wpa_supplicant-2.6/wpa_supplicant: make eapol_test
make: "/usr/local/sbin/wpa_supplicant-2.6/wpa_supplicant/Makefile" line 1: Need an operator
make: "/usr/local/sbin/wpa_supplicant-2.6/wpa_supplicant/Makefile" line 3: Need an operator
make: "/usr/local/sbin/wpa_supplicant-2.6/wpa_supplicant/Makefile" line 5: Need an operator
make: "/usr/local/sbin/wpa_supplicant-2.6/wpa_supplicant/Makefile" line 7: Need an operator
make: "/usr/local/sbin/wpa_supplicant-2.6/wpa_supplicant/Makefile" line 9: Need an operator
make: "/usr/local/sbin/wpa_supplicant-2.6/wpa_supplicant/Makefile" line 12: Need an operator
make: "/usr/local/sbin/wpa_supplicant-2.6/wpa_supplicant/Makefile" line 14: Need an operator
```

Thanks,
E


----------



## bds (Sep 5, 2018)

Are you building this using ports? I'd suggest using (cd /usr/ports/security/wpa_supplicant && make patch) to download, extract in a more appropriate place and ensure any patches are applied.
Anyway, the port Makefile tells us to use (GNU) gmake - I'm guessing you're not.


----------



## Ethereal (Oct 31, 2018)

I am super new in BSD so what I did was:

wget the tar file
extract the tar file
cp defconfig .config   then edit the line "#CONFIG_EAPOL_TEST=y " to "#CONFIG_EAPOL_TEST=y "
saved
and make eapol_test 

What am I doing wrong ?
Could you point me in the right direction?
I am using FreeBSD 11.2



bds said:


> Are you building this using ports? I'd suggest using (cd /usr/ports/security/wpa_supplicant && make patch) to download, extract in a more appropriate place and ensure any patches are applied.
> Anyway, the port Makefile tells us to use (GNU) gmake - I'm guessing you're not.


----------



## SirDice (Oct 31, 2018)

Ethereal said:


> What am I doing wrong ?
> Could you point me in the right direction?


Handbook: Chapter 4. Installing Applications: Packages and Ports

security/wpa_supplicant


----------



## Ethereal (Oct 31, 2018)

Ethereal said:


> I am super new in BSD so what I did was:
> 
> wget the tar file
> extract the tar file
> ...



I also tried gmake as you suggested and now I get:






I am still looking on internet for this error.
Thanks,
n


----------



## Ethereal (Oct 31, 2018)

SirDice said:


> Handbook: Chapter 4. Installing Applications: Packages and Ports
> 
> security/wpa_supplicant


Thanks SirDice 

I followed the instructions and I think I broke it:


----------



## SirDice (Oct 31, 2018)

What _exactly_ do you need it for? If you're just looking for a way to connect with wireless use wpa_supplicant(8). 

Handbook: 31.3. Wireless Networking


----------



## Ethereal (Oct 31, 2018)

SirDice said:


> What _exactly_ do you need it for? If you're just looking for a way to connect with wireless use wpa_supplicant(8).
> 
> Handbook: 31.3. Wireless Networking


I need eapol_test to test radius auth on a remote radius server, from CLI.
Basically to send a radius req. I only need eapol_test.


----------



## SirDice (Oct 31, 2018)

Perhaps net/freeradius-client or net/radiusclient are more useful?


----------



## Ethereal (Oct 31, 2018)

SirDice said:


> Perhaps net/freeradius-client or net/radiusclient are more useful?


I can use radclient already.
eapol_test provides a better output when it comes to troubleshoot, that's why I need eapol_test.
Cheers,
N


----------



## SirDice (Oct 31, 2018)

Right. Unfortunately it doesn't look like anybody managed to get it to build with security/wpa_supplicant.


----------



## Ethereal (Nov 1, 2018)

SirDice said:


> Right. Unfortunately it doesn't look like anybody managed to get it to build with security/wpa_supplicant.



So I am still trying to build this. Now I get the following error and I think I am getting closer.
The 1st error I got was:




After digging into Makefile line 107, and some google I think this is related to spaces and tabs.





After adding a tab in front of line 107 I get this:




What I am missing?

Cheers,
N


----------



## SirDice (Nov 1, 2018)

You're in the port structure itself right now. So you'll need to tell the ports system to extract and patch the original source. Then you can try building it from there.

I usually do something like this:

```
cd /usr/ports/security/wpa_supplicant 
make extract
make patch
```
You should now have a work/ directory with the original source extracted in it. Change to the correct directory and run the gmake(1) there.


----------



## Ethereal (Nov 1, 2018)

SirDice said:


> You're in the port structure itself right now. So you'll need to tell the ports system to extract and patch the original source. Then you can try building it from there.
> 
> I usually do something like this:
> 
> ...



Golden!!!
So basically I've built eapol_test on FreeBSD 11.2 only to move it to a pfSense box as I couldn't build it there. 
All's fine now! 
Thanks SirDice and all for the support!


----------

