Re: Update settings after device attach, but before connection setup

On Tue, 2012-10-02 at 05:58 +0400, Andrey Bondarenko wrote:
> Hi,
> I'm using Kubuntu 12.04 (NetworkManager  I have
> Ethernet link connected to LAN all the time (eth0) and want to use my
> Android phone from time to time (usb0) for direct Internet access.
> I have created two custom connections for both links for better
> connection compatibility with each other. Also I have bound each
> connection to a MAC address, so each device got its own settings.
> The problem is: my phone assigns new MAC address to its tethering
> device (usb0) on every reboot. So I have to update phone connection
> settings each time.

Use udev rules matched on the interface name to assign a static MAC
address to the interface each time with ethtool.  This sort of thing is
much easier and less error prone if you push the change to the device,
not the NM connection.  The lower it is, the easier it is for anything
higher in the stack to use it.  Let me know if that works; something

ACTION=="add",KERNEL=="usb0", RUN+="ip link set usb0 address xx:xx:xx:xx:xx:xx"


> To automate things I've created udev rule that fires on phone attach
> and updates MAC address in connection file.  This works mostly except
> the first time. Looks like there is a race conditions and
> NetworkManager didn't notice connection file update. In result, it
> cannot match new phone MAC address to custom connection and starts
> automatic connection which does not work as I expect.
> Can somebody direct me to NetworkManager API that allow me update
> connection settings before it start choosing connection and configure
> an attached device?
> Thanks,
> Andrey
> _______________________________________________
> networkmanager-list mailing list
> networkmanager-list gnome org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]