Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unknown_mac and registering the gateway #7

Closed
ymkins opened this issue Oct 31, 2016 · 3 comments
Closed

unknown_mac and registering the gateway #7

ymkins opened this issue Oct 31, 2016 · 3 comments

Comments

@ymkins
Copy link

ymkins commented Oct 31, 2016

Hi Petr.
I run lorawan-server in docker (Thank you for the Dockerfile).
And I got an issue on registering the gateway (Kerlink, PROD_FW=wirmaV2_wirgrid_v2.2, LORABOARD_TYPE="868-27dBm").

After configuring the packet_forwarder I see server log messages:

11:55:43.298 [error] ERROR: {unknown_mac,<<0,0,2,75,8,14,14,41>>}

As I understand, the server receives packets from my GW station but doesn't handle it.

I've tried to register my GW in the Web Admin "Create new gateway" form.
As I understand, the MAC field is the MAC address of my LoRaWAN Gateway.
The Web form filters the MAC field with:
ng-pattern="[A-Za-z0-9]{16}" placeholder="e.g. 0123456789ABCDEF".
So it doesn't allow enter my value 02:4B:08:0E:0E:29.
I've tried a few converted values (https://www.vultr.com/tools/mac-converter/) in REST API:

curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 'Content-Type: application/json' -d '{"mac":"02:4B:08:0E:0E:29","netid":"000000","gpspos":{"lat":1,"lon":1},"gpsalt":1}' http://lorawan-server:8080/gateways
curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 'Content-Type: application/json' -d '{"mac":"02:4b:08:0e:0e:29","netid":"000000","gpspos":{"lat":1,"lon":1},"gpsalt":1}' http://lorawan-server:8080/gateways
curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 'Content-Type: application/json' -d '{"mac":"024B080E0E29","netid":"000000","gpspos":{"lat":1,"lon":1},"gpsalt":1}' http://lorawan-server:8080/gateways
curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 'Content-Type: application/json' -d '{"mac":"2521280941609","netid":"000000","gpspos":{"lat":1,"lon":1},"gpsalt":1}' http://lorawan-server:8080/gateways
curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 'Content-Type: application/json' -d '{"mac":"02:4b:08:00:00:0e:0e:29","netid":"000000","gpspos":{"lat":1,"lon":1},"gpsalt":1}' http://lorawan-server:8080/gateways
curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 'Content-Type: application/json' -d '{"mac":"02:4b:08:ff:ff:0e:0e:29","netid":"000000","gpspos":{"lat":1,"lon":1},"gpsalt":1}' http://lorawan-server:8080/gateways
curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 'Content-Type: application/json' -d '{"mac":"02:4b:08:ff:fe:0e:0e:29","netid":"000000","gpspos":{"lat":1,"lon":1},"gpsalt":1}' http://lorawan-server:8080/gateways
curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' -H 'Content-Type: application/json' -d '{"mac":"00:4b:08:ff:fe:0e:0e:29","netid":"000000","gpspos":{"lat":1,"lon":1},"gpsalt":1}' http://lorawan-server:8080/gateways

curl -H 'Authorization: Basic YWRtaW46YWRtaW4=' http://lorawan-server:8080/gateways

[{"gpsalt":1,"gpspos":{"lat":1,"lon":1},"netid":"000000","mac":"0234B3083FF3FE30E30E32"},{"gpsalt":1,"gpspos":{"lat":1,"lon":1},"netid":"000000","mac":"252128094160"},{"gpsalt":1,"gpspos":{"lat":1,"lon":1},"netid":"000000","mac":"024B080E0E29"},{"gpsalt":1,"gpspos":{"lat":1,"lon":1},"netid":"000000","mac":"0234B30830E30E32"},{"gpsalt":1,"gpspos":{"lat":1,"lon":1},"netid":"000000","mac":"0034B3083FF3FE30E30E32"},{"gpsalt":1,"gpspos":{"lat":1,"lon":1},"netid":"000000","mac":"0234B3083FF3FF30E30E32"},{"gpsalt":1,"gpspos":{"lat":1,"lon":1},"netid":"000000","mac":"0234B30830030030E30E32"}]

And all time I got same log message:

11:55:43.298 [error] ERROR: {unknown_mac,<<0,0,2,75,8,14,14,41>>}

So, please clarify, how to register the GW.

@gotthardp
Copy link
Owner

The Web form expects a MAC address without the colons. Please note that your 02:4B:08:0E:0E:29 is only 6-bytes long, whereas the MAC address shall be 8-bytes long.

The error message suggests your gateway uses MAC 00:00:02:4B:08:0E:0E:29. Remove the colons and enter this value to the Web form, or via the curl just like you did and it shall work.

@ymkins
Copy link
Author

ymkins commented Oct 31, 2016

Thanks!
And now I see

16:06:06.352 [error] gen_server lorawan_iface_forwarder terminated with reason: no function clause matching lorawan_mac:handle_rxpk({rxq,<<"2016-10-31T16:06:09.566237Z">>,2772238820,2,1,1,-58,6.8}, 4, <<0,107,243,113>>, <<"semtech-mote">>, undefined, 4, <<0,0,0,0,0,0,0>>) line 151
16:06:06.352 [error] CRASH REPORT Process <0.954.0> with 0 neighbours exited with reason: no function clause matching lorawan_mac:handle_rxpk({rxq,<<"2016-10-31T16:06:09.566237Z">>,2772238820,2,1,1,-58,6.8}, 4, <<0,107,243,113>>, <<"semtech-mote">>, undefined, 4, <<0,0,0,0,0,0,0>>) line 151 in gen_server:terminate/7 line 812
16:06:06.357 [error] Supervisor lorawan_sup had child packet_forwarder started with lorawan_iface_forwarder:start_link(1680) at <0.954.0> exit with reason no function clause matching lorawan_mac:handle_rxpk({rxq,<<"2016-10-31T16:06:09.566237Z">>,2772238820,2,1,1,-58,6.8}, 4, <<0,107,243,113>>, <<"semtech-mote">>, undefined, 4, <<0,0,0,0,0,0,0>>) line 151 in context child_terminated
16:06:06.360 [debug] Supervisor lorawan_sup started lorawan_iface_forwarder:start_link(1680) at pid <0.955.0>

So, it's time to implement handlers.

@ymkins ymkins closed this as completed Oct 31, 2016
@gotthardp
Copy link
Owner

Yes, the error you are now getting suggests that your gateway is using some unexpected protocol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants