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

2019-02-22 Thread Martin Tippmann
On Fri, Feb 22, 2019 at 9:17 AM Martin Tippmann  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@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2019-02-22 Thread Martin Tippmann
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

There is also a related bug:
https://bugs.openwrt.org/index.php?do=details_id=1741

Thanks,
Martin

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel