Autor: ibid.ag Fecha: A: Edward Bartolo Cc: dng Asunto: Re: [DNG] netman: support for wlan1, wlan2, ... and eth1, eth2,
.... and new systemd's naming scheme
On Wed, Sep 30, 2015 at 09:09:52PM +0200, Edward Bartolo wrote: > Hi All,
>
> My next coding task is to implement support for other network devices
> besides eth0 and wlan0.
>
> Since supporting other network devices essentially is including the
> new device names in the essid interfaces file, I am thinking of
> whether it is possible to hook the system file reader function to
> replace part of the read file so that I wouldn't need to change
> anything in the files themselves. The reason is it shouldn't matter
> which wifi or wired connection one uses to connect a network.
>
> Is it possible? When I programmed for windows I learnt about the great
> potential of hooks.
>
> Such a hook would intercept ifup and ifdown reading the essid files to
> replace the default device name by what the user chooses.
Yes, it's possible.
It's also possible to edit the files on the fly as you're working on.
However, there's another approach that I'd recommend:
ifup -i /etc/network/wifi/$FILE $IFACE=$LOGICAL
will be functionally equivalent to editing files on the fly, without
requiring changes.
$IFACE is the real interface; this might be anything.
$LOGICAL is the name that's in the file.
If you do this, ifup makes the substition on the fly.