I am looking to use hotplugs to run certain functionality when an ethernet is connected/disconnected to a router.
I have tried both net and iface hotplugs with the same result.
I have two really simple scripts that log the interface names.
Script name - 99-ethernet-link
#!/bin/sh
logger "net"
logger "INTERFACE:$INTERFACE"
Script name - 99-ethernet-mon
#!/bin/sh
logger "iface"
logger "Interface $INTERFACE"
My issue is that these only seem to fire when the ethernet is disconnected, never when connected? Is there a reason for this or something I am doing wrong here?
ubus call system board
{
"kernel": "5.10.176",
"hostname": "OpenWrt",
"system": "MediaTek MT7628AN ver:1 eco:2",
"model": "TP-Link TL-WR902AC v3",
"board_name": "tplink,tl-wr902ac-v3",
"rootfs_type": "squashfs",
"release": {
"distribution": "OpenWrt",
"version": "22.03.5",
"revision": "r20134-5f15225c1e",
"target": "ramips/mt76x8",
"description": "OpenWrt 22.03.5 r20134-5f15225c1e"
}
}
cat /etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd2d:3f65:7e7c::/48'
config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0.1'
config interface 'lan'
option proto 'static'
option netmask '255.255.255.0'
option ip6assign '60'
option device 'wlan0'
option ipaddr '192.168.4.1'
option force_link '0'
config switch
option name 'switch0'
option reset '1'
option enable_vlan '1'
config switch_vlan
option device 'switch0'
option vlan '1'
option ports '4 6t'
config interface 'wan'
option proto 'dhcp'
option device 'eth0.1'
option broadcast '1'