[OpenWrt-Devel] netifd: DEVICE= always empty for ACTION=ifdown for scripts in /etc/hotplug.d/iface

Martin Tippmann mt at i3o.de
Fri Feb 22 03:43:35 EST 2019

On Fri, Feb 22, 2019 at 9:17 AM Martin Tippmann <mt at i3o.de> wrote:
> Hi,
> I'm calling some iptables rules from a scripts in /etc/hotplug.d/iface
> and these failed because there seems to be no $DEVICE variable for
> ACTION=ifdown events.
> It's not really obvious that the device is not populated for ifdown
> events, is there a reason for this? I guess the data about the device
> must be there and existing.
> I'm confused wether this behavoir is intented or a bug, it looks like
> this was never working/implemented:
> https://git.openwrt.org/?p=project/netifd.git;a=blob;f=interface.c;h=b21d2345bfc9577884e76aaf006dcdb39e330d5b;hb=HEAD#l227

Sorry, wrong link to the source - I guess it's this code here:

if ((current_ev == IFEV_UP || current_ev == IFEV_UPDATE) && current->l3_dev.dev)
 device = current->l3_dev.dev->ifname;

so for ifdown events device is always NULL in run_cmd:

run_cmd(current->name, device, current_ev, current->updated);

and the variable is not populated.


openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list