YOUNAVI
November 17, 2024, 8:47am
1
As I know, I can execute a script when I put a script in /etc/hotplug.d/~~
And I want to use it when I attach a device to the wlan.
So I put a test script in /etc/hotplug.d/ieee80211/00-my
#!/bin/sh
[ "${ACTION}" = "add" ] && {
echo hello
}
but it never happen when I associate a new device.
When I just put
echo hello
and write a command "hotplug-call ieee80211" it works.
but ACTION Add deosnt work I guess.
How can I enable it?
Here is my system info.
root@OpenWrt-C50:/etc/hotplug.d/ieee80211# ubus call system board
{
"kernel": "6.6.54",
"hostname": "OpenWrt-C50",
"system": "MediaTek MT7628AN ver:1 eco:2",
"model": "TP-Link Archer C50 v3",
"board_name": "tplink,archer-c50-v3",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "SNAPSHOT",
"revision": "r27722-e00b6ba0c8",
"target": "ramips/mt76x8",
"description": "OpenWrt SNAPSHOT r27722-e00b6ba0c8"
}
}
1 Like
brada4
November 17, 2024, 8:57am
2
1 Like
YOUNAVI
November 17, 2024, 9:22am
3
I am sorry, but
do you mean I didn't put my script on the right directory?
brada4
November 17, 2024, 10:29am
4
Yep, only that.
btw you can add logger $ACTION $DEVICE
and similar to log what triggers the script and with what parameters.
YOUNAVI
November 17, 2024, 10:48am
5
Well, in the doc, "block", "button" ... are subdirectories of hotplug.
I knew it.
But there is a directory "ieee80211" in my hotplug.d folder.
And it is a default setting.
So I guess this is for wlan to detect some STAs or sth attached.
If it is wrong, can you tell guide me a hotplug which can detect wlan client?
brada4
November 17, 2024, 10:54am
6
Log the ACTION to see what events are generated?
Follow the troubleshooting section from the wiki. Use the script shown, trigger it, and it will log what environment variables are passed to each hotplug.d sub directory. https://openwrt.org/docs/guide-user/base-system/hotplug#usagetroubleshooting
YOUNAVI
November 17, 2024, 11:22am
8
@brada4
@RuralRoots
root@OpenWrt-C50:/etc/hotplug.d/iface# logread -e hotplug
Sun Nov 17 10:51:49 2024 kern.warn kernel: [ 7.977972] gpio_button_hotplug: loading out-of-tree module taints kernel.
Sun Nov 17 10:52:13 2024 user.notice hotplug: USER=root ACTION=ifup SHLVL=1 HOME=/ HOTPLUG_TYPE=iface LOGNAME=root DEVICENAME= TERM=linux PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=loopback PWD=/ DEVICE=lo
Sun Nov 17 10:52:15 2024 user.notice hotplug: USER=root ACTION=ifdown SHLVL=1 HOME=/ HOTPLUG_TYPE=iface LOGNAME=root DEVICENAME= TERM=linux PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=lan PWD=/
Sun Nov 17 10:52:21 2024 user.notice hotplug: USER=root ACTION=ifup SHLVL=1 HOME=/ HOTPLUG_TYPE=iface LOGNAME=root DEVICENAME= TERM=linux PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=lan PWD=/ DEVICE=br-lan
yeah.
hotplug.d/iface is working.
but nothing from hotplug.d/ieee80211
And I checked also "net" subdirectory.
But I couldn't get any clue.
Sun Nov 17 11:23:58 2024 kern.warn kernel: [ 7.979539] gpio_button_hotplug: loading out-of-tree module taints kernel.
Sun Nov 17 11:24:21 2024 user.notice hotplug: USER=root ACTION=add SHLVL=1 HOME=/ SEQNUM=468 IFINDEX=4 HOTPLUG_TYPE=net DEVPATH=/devices/virtual/net/br-lan LOGNAME=root DEVICENAME=br-lan TERM=linux SUBSYSTEM=net PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=br-lan PWD=/ DEVTYPE=bridge
Sun Nov 17 11:24:22 2024 user.notice hotplug: USER=root ACTION=add SHLVL=1 HOME=/ SEQNUM=470 IFINDEX=5 HOTPLUG_TYPE=net DEVPATH=/devices/virtual/net/eth0.1 LOGNAME=root DEVICENAME=eth0.1 TERM=linux SUBSYSTEM=net PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=eth0.1 PWD=/ DEVTYPE=vlan
Sun Nov 17 11:24:22 2024 user.notice hotplug: USER=root ACTION=add SHLVL=1 HOME=/ SEQNUM=472 IFINDEX=6 HOTPLUG_TYPE=net DEVPATH=/devices/virtual/net/eth0.2 LOGNAME=root DEVICENAME=eth0.2 TERM=linux SUBSYSTEM=net PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=eth0.2 PWD=/ DEVTYPE=vlan
Sun Nov 17 11:24:23 2024 user.notice hotplug: USER=root ACTION=ifup SHLVL=1 HOME=/ HOTPLUG_TYPE=iface LOGNAME=root DEVICENAME= TERM=linux PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=loopback PWD=/ DEVICE=lo
Sun Nov 17 11:24:24 2024 user.notice hotplug: USER=root ACTION=ifdown SHLVL=1 HOME=/ HOTPLUG_TYPE=iface LOGNAME=root DEVICENAME= TERM=linux PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=lan PWD=/
Sun Nov 17 11:24:31 2024 user.notice hotplug: USER=root ACTION=ifup SHLVL=1 HOME=/ HOTPLUG_TYPE=iface LOGNAME=root DEVICENAME= TERM=linux PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=lan PWD=/ DEVICE=br-lan
Sun Nov 17 11:24:36 2024 user.notice hotplug: USER=root ACTION=add SHLVL=1 HOME=/ SEQNUM=479 IFINDEX=7 HOTPLUG_TYPE=net DEVPATH=/devices/pci0000:00/0000:00:00.0/0000:01:00.0/net/phy1-ap0 LOGNAME=root DEVICENAME=phy1-ap0 TERM=linux SUBSYSTEM=net PATH=/usr/sbin:/usr/bin:/sbin:/bin INTERFACE=phy1-ap0 PWD=/ DEVTYPE=wlan
brada4
November 17, 2024, 11:52am
9
Maybe neigbour gets arp entry?
YOUNAVI
November 17, 2024, 12:04pm
10
put logger in the neigh directory.
but irrelevant...
no more info about hotplug?
no materials, search..
brada4
November 17, 2024, 12:08pm
11
Let system run for some time.
It seems that hotplug event is for WiFi devices, not clients. Not 100% sure.
committed 10:08AM - 03 Nov 16 UTC
Currently, the wifi detection script is executed as part of
the (early) boot pro… cess. Pluggable wifi USB devices, which
are inserted at a later time are not automatically
detected and therefore they don't show up in LuCI.
A user has to deal with wifi detection manually, or restart
the router.
However, the current "sleep 1" window - which the boot
process waits for wifi devices to "settle down" - is too
short to detect wifi devices for some routers anyway.
For example, this can happen with USB WLAN devices on the
WNDR4700. This is because the usb controller needs to load
its firmware from UBI and initialize, before it can operate.
The issue can be seen on a BT HomeHub 5A as well as soon as
the caldata are on an ubi volume. This is because the ath9k
card has to be initialized by owl-loader first. Which has to
wait for the firmware extraction script to retrieve the pci
initialization values inside the caldata.
This patch moves the wifi configuration to hotplug scripts.
For mac80211, the wifi configuration will now automatically
run any time a "ieee80211" device is added. Likewise
broadcom-wl's script checks for new "net" devices which
have the "wl$NUMBER" moniker.
Issues with spawning multiple interface configuration - in
case the detection script is run concurrently - have been
resolved by using a named section for the initial
configuration. Concurrent configuration scripts will now
simply overwrite the same existing configuration.
A workaround which preserves the "sleep 1" window for just
the first boot has been added. This allows the existing
brcm47xx boot and mvebu uci-default scripts to correctly
setup the initial mac addresses and regulatory domain.
And finally, the patch renames the "wifi detect" into
"wifi config". As the script no longer produces any output
that has to be redirected or appended to the configuration
file.
Thanks to Martin Blumenstingl for helping with the implementation
and testing of the patch.
Acked-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
YOUNAVI
November 17, 2024, 12:54pm
13
Well, If my understanding is correct,
That's what I want.
The Wifi Device(AP) hotplug when client attach to the AP.
As it said
This patch moves the wifi configuration to hotplug scripts.
For mac80211, the wifi configuration will now automatically
run any time a "ieee80211" device is added. Likewise
broadcom-wl's script checks for new "net" devices which
have the "wl$NUMBER" moniker.
Well, but no response from hotplug.
I guessed if my phone attach to the AP Wifi, the script in ieee80211 executes.
brada4
November 17, 2024, 12:55pm
14
New device like in usb or pci device, not STA, you can snap hostap log for associations, then dhcp log for IP. Note that MAC addresses may not always match.
YOUNAVI
November 18, 2024, 1:37am
15
Thank you for the reply.
I couldn't find answer from dhcp subdirectory.
Maybe what I want is not implemented yet.
system
Closed
November 28, 2024, 1:37am
16
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.