[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:
https://git.openwrt.org/?p=project/netifd.git;a=blob;f=interface-event.c;h=a40f6dc883d3a3654d73d0592cd7eb65c2a8de85;hb=HEAD#l95
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.
regards
Martin
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list