Comment 10 for bug 293139

Revision history for this message
Johan Ehnberg (johan-ehnberg) wrote : Re: NetworkManager does not use dhclient-exit-hooks.d, DNSSEC does not work

It turns out NetworkManager has its own mechanism for this. It took me a while (almost no documentation...) to figure it out.

NM uses a dispatcher much like dhclient-exit-hooks.d. Instead of separate directories, the script is always started, and given two arguments: interface and action (which is one of up, down, vpn-up or vpn-down). Everything else is available as environment variables. The scripts are located in /etc/NetworkManager/dispatcher.d and run in alphabetical order.

That part was easy, so we can basically migrate any scripts to follow the new behaviour. It may even simplify things by consolidating ppp/vpn/eth/whatever actions. I updated my script accordingly.

These environment variables were given in my case (anonymized).
IP4_DOMAINS=domain.name
DHCP4_SUBNET_MASK=255.255.248.0
DHCP4_DOMAIN_NAME=domain.name
IP4_NAMESERVERS=ns1-ip ns1-ip
DHCP4_DHCP_SERVER_IDENTIFIER=dhcp-server-ip
DHCP4_DHCP_LEASE_TIME=7200
DHCP4_EXPIRY=1229611878
DHCP4_NETWORK_NUMBER=network-ip (first in block, the one often ending with .0)
IP4_NUM_ADDRESSES=1
DHCP4_ROUTERS=gateway-ip
IP4_NUM_ROUTES=0
IP4_ADDRESS_0=my-ip/netmaskbitcount gateway-ip
DHCP4_BROADCAST_ADDRESS=broadcast-ip (last in block, the one often ending with .255)
DHCP4_IP_ADDRESS=my-ip
DHCP4_DHCP_MESSAGE_TYPE=5
DHCP4_DOMAIN_NAME_SERVERS=ns1-ip ns1-ip
PWD=/
DHCP4_TIME_OFFSET=7200

It may be possible to simply link the script to the dispatcher, or write a simple wrapper which renames variables for it. But it sure breaks any setup relying purely on dhcp or ppp hooks.