Network Manager dispatcher.d and ifconfig
I have a script under the /etc/NetworkManager/dispatcher.d that will extract the assigned IP of an interface. The interface is using DHCP.
To get the IP address I use ifconfig and do some string manipulation. The script would look something like this:
ifconfig $INFACE | grep "inet addr" | cut -d":" -f2
The script works fine when I execute it outside network manager and when the interface is up.
The problem is if I execute it inside the Network Manager it is not getting the IP address. It seems at the time when this script is executed there is no address yet so the string "inet addr" could not be found. I suspect that the reason is that dhclient has not done its job yet. So my questions now are:
Does network manager waits for one script to finish before executing the next one? If not then should I put my script inside the 11-dhclient script? Is there something like a 'post-up' in the Network manager similar to ifup?