[LEDE-DEV] Help me understand ubus extensions via C api

2017-07-05 Thread Carlito Nueno
Hi all,

I want to customize a small feature in how hostapd responds to probe
request and I was looking at
https://github.com/lede-project/source/blob/master/package/network/services/hostapd/src/src/ap/ubus.c

Please help me understand how it works? for example when I call `ubus
call hostapd.wlan0-1 del_client "{}" what happens?

I know that ubus_cli
(http://git.openwrt.org/?p=project/ubus.git;a=blob;f=cli.c;h=19ccbb5093ce4c326010a9b2f504d7cd50798275;hb=HEAD)
parses the input but how does ubus call the functions inside the above
file (the ubus.c, ubus hostapd extension)?

I see that there is this function, but how is that called

static int hostapd_bss_del_client(struct ubus_context *ctx, struct
ubus_object *obj, struct ubus_request_data *req, const char *method,
struct blob_attr *msg);


Thank you!

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] Help me understand ubus extensions via C api

2017-07-06 Thread Carlito Nueno
Thanks Alexandru!

That was very helpful. Now I have a better understanding of the ubus structure.

Few more questions:

- when/where does this ubus.c file (executable?) run?
- how these functions used? when are they called? starting from line
42 to line 47 
(https://github.com/lede-project/source/blob/master/package/network/services/hostapd/src/src/ap/ubus.h#L42)

Thanks again.

On Wed, Jul 5, 2017 at 11:54 PM, Alexandru Ardelean
 wrote:
> On Thu, Jul 6, 2017 at 4:31 AM, Carlito Nueno  wrote:
>> Hi all,
>>
>> I want to customize a small feature in how hostapd responds to probe
>> request and I was looking at
>> https://github.com/lede-project/source/blob/master/package/network/services/hostapd/src/src/ap/ubus.c
>>
>> Please help me understand how it works? for example when I call `ubus
>> call hostapd.wlan0-1 del_client "{}" what happens?
>
> the `ubus` cli will talk to ubusd
> ubusd is the broker [or hub] for all things ubus between all processes
> [that register with ubus[d] ]
>
> hostapd has registered the `hostapd.wlan0-1` ubus object here
> https://github.com/lede-project/source/blob/master/package/network/services/hostapd/src/src/ap/ubus.c#L457
> via the ubus_add_object()
>
> all registration to ubusd is done via libubus, which abstracts a lot
> of the stuff to connect/talk to ubusd
> all that you need to use [in a daemon/process with ubus] is in
> libubus.h ; that header is exported at build time for other modules to
> use
> http://git.openwrt.org/?p=project/ubus.git;a=blob;f=libubus.h;h=4e45cb620a28befe23c27d3b8dc7eb1a1d12fb1a;hb=HEAD
>
> it's important that all operations to ubus[d] be done on a
> ubus_context object, which is a wrapper struct for a socket FD, some
> buffer data, and other stuff
>
> [ well, this was mostly ubus internals [in case it interests you ] ]
>
>>
>> I know that ubus_cli
>> (http://git.openwrt.org/?p=project/ubus.git;a=blob;f=cli.c;h=19ccbb5093ce4c326010a9b2f504d7cd50798275;hb=HEAD)
>> parses the input but how does ubus call the functions inside the above
>> file (the ubus.c, ubus hostapd extension)?
>
> the ubus cli tool uses libubus
> but the code for cli, may not be a sufficient example to do other
> operations [like in hostapd ]
>
>>
>> I see that there is this function, but how is that called
>>
>> static int hostapd_bss_del_client(struct ubus_context *ctx, struct
>> ubus_object *obj, struct ubus_request_data *req, const char *method,
>> struct blob_attr *msg);
>>
>
> Coming back to your "I want to customize a small feature in how hostapd"
> I think that all you might need to do is register a new function here:
> https://github.com/lede-project/source/blob/master/package/network/services/hostapd/src/src/ap/ubus.c#L419
> or extend an existing one.
>
> As I mentioned, the ubus cli talks to ubusd.
> When doing `ubus call hostapd.wlan0-1 del_client "{}"` , this
> means that hostapd has already registered a ` hostapd.wlan0-1` with
> ubusd
> When you call "del_client", the hostapd_bss_del_client() callback will
> be called [ubus cli will ask ubusd to access del_client from
> hostapd.wlan0-1 ] , but before that, the `del_policy` object will be
> used to validate the message format.
> [ You may have noticed that some callbacks are UBUS_METHOD_NOARG() and
> some are UBUS_METHOD() ; the ones without a policy arg will get
> processed without any msg format validation ]
>
>>
>> Thank you!
>>
>
> Maybe this information was not too well structured.
> But hope it helps.
>
>> ___
>> Lede-dev mailing list
>> Lede-dev@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/lede-dev

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] How to run a single hostapd instance for two radios?

2017-07-10 Thread Carlito Nueno
Hi all,

I am running lede 17.01.0 and hostapd v2.7-devel. I have two
radios, 2.4 ghz and 5 ghz.

There are two hostapd instances running. How can I have only one
hostapd instance to control both radios. Reason being, I want to have
band steering that's built into hostap. This requires to have only one
hostapd instance, correct?

 1156 root  1964 S/usr/sbin/hostapd -s -P
/var/run/wifi-phy1.pid -B /var/run/hostapd-phy1.conf
 1178 root  1964 S/usr/sbin/hostapd -s -P
/var/run/wifi-phy0.pid -B /var/run/hostapd-phy0.conf

Thanks!

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] compile hostapd/wpa_supplicant with mesh and sae options

2017-12-09 Thread Carlito Nueno
Hi all,

I am trying to compile hostapd/wpa_supplicant with CONFIG_MESH=y and
CONFIG_SAE=y.

I am using sdk to compile an ipk. I download the hostapd source and
added those config options to wpa_supplicant-full.config.

I have this in my sdk conf file:

# CONFIG_PACKAGE_wpad-mini is not set
CONFIG_PACKAGE_wpad=y

But during compilation I see a lot of these kind of errors:

sae.c:(.text.sae_write_commit+0x66): undefined reference to
`crypto_bignum_to_bin'

then log shows:

Makefile:402: recipe for target
'/home/ubuntu/sdk-17.01.4/build_dir/target-mips_24kc_musl-1.1.16/hostapd-wpad-full/hostapd-2016-12-19-ad02e79d/.built'
failed
make[2]: *** 
[/home/ubuntu/sdk-17.01.4/build_dir/target-mips_24kc_musl-1.1.16/hostapd-wpad-full/hostapd-2016-12-19-ad02e79d/.built]
Error 1

Any advice?

Thanks!

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] compile hostapd/wpa_supplicant with mesh and sae options

2017-12-09 Thread Carlito Nueno
I need WPA2 Enterprise and I also want to try / implement 802.11r.

I am attaching the log errors, wap_supplicant.conf, part of wireless
config: https://gist.github.com/ironpillow/e0779261f6d045a6883f5dbd6ae81c1f

I don't get the above errors when I use wpad-mesh but when I use wpad
(full), wpa_supplicant doesn't start because it fails to read or parse
the conf file.


On Sat, Dec 9, 2017 at 7:24 AM, Felix Fietkau  wrote:
> On 2017-12-09 14:36, Carlito Nueno wrote:
>> Hi all,
>>
>> I am trying to compile hostapd/wpa_supplicant with CONFIG_MESH=y and
>> CONFIG_SAE=y.
>>
>> I am using sdk to compile an ipk. I download the hostapd source and
>> added those config options to wpa_supplicant-full.config.
>>
>> I have this in my sdk conf file:
>>
>> # CONFIG_PACKAGE_wpad-mini is not set
>> CONFIG_PACKAGE_wpad=y
>>
>> But during compilation I see a lot of these kind of errors:
>>
>> sae.c:(.text.sae_write_commit+0x66): undefined reference to
>> `crypto_bignum_to_bin'
> Does simply using the wpad-mesh package not already give you what you need?
>
> - Felix

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] compile hostapd/wpa_supplicant with mesh and sae options

2017-12-09 Thread Carlito Nueno
Sorry, clarification:

"I don't get above errors" meaning, I don't get the errors show in the
gist link I posted; errors regarding reading and parsing
wpa_supplicant conf file.

Thanks

On Sat, Dec 9, 2017 at 12:51 PM, Carlito Nueno  wrote:
> I need WPA2 Enterprise and I also want to try / implement 802.11r.
>
> I am attaching the log errors, wap_supplicant.conf, part of wireless
> config: https://gist.github.com/ironpillow/e0779261f6d045a6883f5dbd6ae81c1f
>
> I don't get the above errors when I use wpad-mesh but when I use wpad
> (full), wpa_supplicant doesn't start because it fails to read or parse
> the conf file.
>
>
> On Sat, Dec 9, 2017 at 7:24 AM, Felix Fietkau  wrote:
>> On 2017-12-09 14:36, Carlito Nueno wrote:
>>> Hi all,
>>>
>>> I am trying to compile hostapd/wpa_supplicant with CONFIG_MESH=y and
>>> CONFIG_SAE=y.
>>>
>>> I am using sdk to compile an ipk. I download the hostapd source and
>>> added those config options to wpa_supplicant-full.config.
>>>
>>> I have this in my sdk conf file:
>>>
>>> # CONFIG_PACKAGE_wpad-mini is not set
>>> CONFIG_PACKAGE_wpad=y
>>>
>>> But during compilation I see a lot of these kind of errors:
>>>
>>> sae.c:(.text.sae_write_commit+0x66): undefined reference to
>>> `crypto_bignum_to_bin'
>> Does simply using the wpad-mesh package not already give you what you need?
>>
>> - Felix

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] compile hostapd/wpa_supplicant with mesh and sae options

2017-12-10 Thread Carlito Nueno
I am testing with wpad-mesh and nodes are connecting and I can ping
each node, but logread shows below notice ONLY when mesh iface has
encryption on.

Mon Dec 11 02:54:38 2017 daemon.notice hostapd: handle_probe_req: send failed
Mon Dec 11 02:54:38 2017 daemon.notice hostapd: handle_probe_req: send failed

On Sun, Dec 10, 2017 at 11:20 AM, Carlito Nueno  wrote:
> Thanks! I’ll give it a go and report back.
>
> On Sunday, December 10, 2017, Felix Fietkau  wrote:
>>
>> On 2017-12-10 20:03, Carlito Nueno wrote:
>> > So wpad-mesh can do WPA2 enterprise, EAP and radius? I thought it was
>> > like wpad-mini plus 80211s features.
>> It's like wpad + 802.11s, so it should be able to do what you need.
>>
>> - Felix

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] compile hostapd/wpa_supplicant with mesh and sae options

2017-12-10 Thread Carlito Nueno
I just noticed that when mesh is enabled on wlan0, the ap part does
not work. wlan0-ap does not broadcast ssid.

this is using the wpad-mesh package.

config wifi-iface 'wlan0_ap_radio0'
option mode 'ap'
option device 'radio0'
option network 'lan'
option ifname 'wlan0-ap'
option ssid 'mssid'
option encryption 'psk2+aes'
option key 'passwd'

config wifi-iface 'wlan0_mesh_radio0'
option mode 'mesh'
option device 'radio0'
option network 'wlan0_mesh_if'
option ifname 'wlan0-mesh'
    option mesh_id 'mmesh'
option encryption 'psk2+aes'
option key 'mpasswd'

On Sun, Dec 10, 2017 at 9:15 PM, Carlito Nueno  wrote:
> I am testing with wpad-mesh and nodes are connecting and I can ping
> each node, but logread shows below notice ONLY when mesh iface has
> encryption on.
>
> Mon Dec 11 02:54:38 2017 daemon.notice hostapd: handle_probe_req: send failed
> Mon Dec 11 02:54:38 2017 daemon.notice hostapd: handle_probe_req: send failed
>
> On Sun, Dec 10, 2017 at 11:20 AM, Carlito Nueno  
> wrote:
>> Thanks! I’ll give it a go and report back.
>>
>> On Sunday, December 10, 2017, Felix Fietkau  wrote:
>>>
>>> On 2017-12-10 20:03, Carlito Nueno wrote:
>>> > So wpad-mesh can do WPA2 enterprise, EAP and radius? I thought it was
>>> > like wpad-mini plus 80211s features.
>>> It's like wpad + 802.11s, so it should be able to do what you need.
>>>
>>> - Felix

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] compile hostapd/wpa_supplicant with mesh and sae options

2017-12-13 Thread Carlito Nueno
Thanks Sven, I'll compile LEDE master for my router and will test it.

On Wed, Dec 13, 2017 at 12:09 AM, Sven Eckelmann
 wrote:
> On Sonntag, 10. Dezember 2017 22:09:30 CET Carlito Nueno wrote:
>> I just noticed that when mesh is enabled on wlan0, the ap part does
>> not work. wlan0-ap does not broadcast ssid.
>>
>> this is using the wpad-mesh package.
>
> You need additional changes to get this working. These were just added to LEDE
> master [1].
>
> Kind regards,
> Sven
>
> [1] 
> https://git.lede-project.org/?p=source.git;a=log;h=d91494eedf06ac6b31c1aa9f7172871b16af96c8

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] Lua script as a ubus service using rpcd

2017-12-22 Thread Carlito Nueno
Hi all,

I am trying to make a ubus service in lua.

I placed a lua script (myluaservice) in /usr/libexec/rpcd but I didn't
see it in ubus -v list.

So I placed a shell script (myshellservice) in /usr/libexec/rpcd and
moved the lua script (myluaservice) to /usr/bin/ and made both scripts
executables.

Now I can see the shell script in ubus -v list but lua script is not called.

Both scripts:
https://gist.github.com/ironpillow/4e116a7aa897bf05b3bb39c38f9b23b4.

Thanks!

___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev