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.
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/NetworkMan ager/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). domain. name MASK=255. 255.248. 0 NAME=domain. name =ns1-ip ns1-ip SERVER_ IDENTIFIER= dhcp-server- ip LEASE_TIME= 7200 1229611878 NUMBER= network- ip (first in block, the one often ending with .0) gateway- ip 0=my-ip/ netmaskbitcount gateway-ip _ADDRESS= broadcast- ip (last in block, the one often ending with .255) ADDRESS= my-ip MESSAGE_ TYPE=5 NAME_SERVERS= ns1-ip ns1-ip OFFSET= 7200
IP4_DOMAINS=
DHCP4_SUBNET_
DHCP4_DOMAIN_
IP4_NAMESERVERS
DHCP4_DHCP_
DHCP4_DHCP_
DHCP4_EXPIRY=
DHCP4_NETWORK_
IP4_NUM_ADDRESSES=1
DHCP4_ROUTERS=
IP4_NUM_ROUTES=0
IP4_ADDRESS_
DHCP4_BROADCAST
DHCP4_IP_
DHCP4_DHCP_
DHCP4_DOMAIN_
PWD=/
DHCP4_TIME_
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.