I believe I have found a bug in NetworkManager, but am not sure. I am using Ubuntu 14.04 (Don`t think ubuntu version matters much here) and have network-manager=0.9.8.8-0ubuntu7.3 installed and my network configuration is indeed managed by NetworkManager.
I wanted to run some custom commands after my connection gets set up and found, that there is this dispatcher.d folder where you can put custom scripts to be run in post-up (NM calls it up) stage. It is important that these scripts are run post-up, because I want to change my routing table after the connection is already set up. I wanted to add a new IPv6 route, that has a source address specified so I couldn`t do it through Network-Manager settings, because there is no option to provide a route with a specified source address (just NM things I guess).
Unfortunately, the scripts are being run after the IPv4 configuration has been committed and done, but before the IPv6 configuration is done. It turns out that I can`t add an IPv6 route if there is no IPv6 configuration yet, so there is no way I can do any IPv6 modifications to my connection in the post-up stage. That sounds like a bug.
Some proof of this is my syslog where I see a line stating IPv4 settings are being committed followed by my script`s custom output, which in turn is followed by a line stating that IPv6 changes are scheduled (starting right after).
Can someone suggest a way to add a custom IPv6 route to my routing table after a NetworkManager connection has come up?
I could do a messy solution like making my script spawn a child, which sleeps a couple of seconds before applying the route, and let the parent die to make NetworkManager continue onwards and set up my IPv6 addresses before the child stops sleeping and adds my route. If that is the only way, then the NM software is inherently flawed and discriminates IPv6 users.