F #227: Refactor loc-10-network
* F #227: Update network context - Rework support for DHCP and DHCP6 - Support new context ETH?_METHOD and ETH?_IP6_METHOD - Add new loc-10-network netcfg interface: initialize_network - Wipe out stale netcfg configs to avoid conflicts - Add reference links for some workarounds - Fix shellcheck Signed-off-by: Petr Ospalý <pospaly@opennebula.io> * F #227: Let networkd to use default for IPv6 Signed-off-by: Petr Ospalý <pospaly@opennebula.io> * F #227: Improve cleanup in initialize_network Signed-off-by: Petr Ospalý <pospaly@opennebula.io> * F #227: Fix Network Manager reconfiguration Signed-off-by: Petr Ospalý <pospaly@opennebula.io> * M #-: Update systemd service descriptions * F #227: Adapt FreeBSD, support live reconfiguration * B #239: Use systemctl --no-block in udev on Debian-like * F #227: Fix unmanaged-devices with NM on ubuntu Instead of touching 10-globally-managed-devices.conf during netcfg-nm script we are shipping the file as part of the package. The reason is that this file must be in place *BEFORE* Network Manager daemon is started and reload is not sufficiant (read: it does not work). Other option would be to restarting NM instead of reloading but that would ifup/down all interfaces which is not a desired behavior especially if those are in use (recontextualization). Signed-off-by: Petr Ospalý <pospaly@opennebula.io> * F #227: Improve cleanup for NM Signed-off-by: Petr Ospalý <pospaly@opennebula.io> * F #227: Fix initialize_network usage and cleanup Signed-off-by: Petr Ospalý <pospaly@opennebula.io> * F #227: Workaround FreeBSD emul. NIC attach, manage rtsold * F #227: Fix is_true argument usage Signed-off-by: Petr Ospalý <pospaly@opennebula.io> * F #227: Improve NM reconfigure Signed-off-by: Petr Ospalý <pospaly@opennebula.io> * F #227: Fix NM and networkd reconfiguration Signed-off-by: Petr Ospalý <pospaly@opennebula.io> * F #227: Fix netplan's issue with empty stanzas Signed-off-by: Petr Ospalý <pospaly@opennebula.io> * B #239: Use abs. path /bin/systemctl in Debian-like udev Closes #239 Co-authored-by: Vlastimil Holer <vholer@opennebula.io>pull/244/head
parent
70cf13f434
commit
bfba520831
@ -0,0 +1,7 @@
|
||||
# This enables sensible default for 'unmanaged-devices' on ubuntu:
|
||||
# https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1638842
|
||||
# https://askubuntu.com/questions/882806/ethernet-device-not-managed
|
||||
#
|
||||
# This file must exist prior start of NetworkManager to take an effect -
|
||||
# a simple reloading of the already running daemon will not work.
|
||||
|
@ -0,0 +1,47 @@
|
||||
# On NIC hotplug the delayed reconfiguration is triggered.
|
||||
|
||||
# NOTE: With hot-attached emulated NICs (e1000, ...) the interface
|
||||
# and kernel event may appear later, even after CD-ROM is refreshed.
|
||||
# Such interface doesn't configure, since new change in context
|
||||
# script is not detected anymore. We hack the state files so that the
|
||||
# recontextualization is forced to run.
|
||||
notify 21 {
|
||||
match "system" "ETHERNET";
|
||||
match "type" "IFATTACH";
|
||||
match "subsystem" "!vtnet[0-9]+";
|
||||
action "/bin/sh -c 'test -f /var/run/one-context/context.sh.local && echo >> /var/run/one-context/context.sh.local; test -f /var/run/one-context/context.sh.network && echo >> /var/run/one-context/context.sh.network; service one-context-reconfigure-delayed onestart'";
|
||||
};
|
||||
|
||||
notify 20 {
|
||||
match "system" "ETHERNET";
|
||||
match "type" "IFATTACH";
|
||||
action "service one-context-reconfigure-delayed onestart";
|
||||
};
|
||||
|
||||
notify 20 {
|
||||
match "system" "IFNET";
|
||||
match "type" "DETACH";
|
||||
action "service one-context-reconfigure-delayed onestart";
|
||||
};
|
||||
|
||||
# On CONTEXT CD-ROM change the immediate reconfiguration is triggered.
|
||||
notify 20 {
|
||||
match "system" "DEVFS";
|
||||
match "subsystem" "CDEV";
|
||||
match "type" "CREATE";
|
||||
match "cdev" "iso9660/CONTEXT";
|
||||
action "service one-context-reconfigure onestart";
|
||||
};
|
||||
|
||||
# Handle disk resize
|
||||
# NOTE: Event not generated on FreeBSD 12 and older
|
||||
notify 20 {
|
||||
match "system" "GEOM";
|
||||
match "subsystem" "DEV";
|
||||
match "type" "SIZECHANGE";
|
||||
match "cdev" "!(cd[0-9]+|.*/.*|.*p[0-9]+)"; # skip CD-ROM/context, filesystems and partitions
|
||||
action "service one-context-force onestart";
|
||||
};
|
||||
|
||||
# Handle swap hot-attach
|
||||
# NOTE: swap activation not supported on FreeBSD now
|
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Public domain
|
||||
|
||||
### For FreeBSD only:
|
||||
# Modified dual-dhclient script from package net/dual-dhclient
|
||||
# which conditionally triggers only a specific DHCP client
|
||||
# if it's enabled in interface configuration. This script needs to
|
||||
# 1. have dhclient from package net/isc-dhcp44-client installed
|
||||
# 2. be explicitly configured in /etc/rc.conf via
|
||||
# dhclient_program="/usr/sbin/one-dual-dhclient"
|
||||
|
||||
# trigger DHCPv4 client only if DHCP tag is in interface configuration
|
||||
if sysrc -f /etc/rc.conf.d/network -f /etc/rc.conf -n "ifconfig_$@" | grep -q -i DHCP; then
|
||||
/sbin/dhclient "$@"
|
||||
fi
|
||||
|
||||
# trigger DHCPv6 client only if DHCP tag is in interface configuration
|
||||
if sysrc -f /etc/rc.conf.d/network -f /etc/rc.conf -n "ifconfig_$@_ipv6" | grep -q -i DHCP; then
|
||||
DHCLIENT6='/usr/local/sbin/dhclient'
|
||||
|
||||
if ! [ -x "${DHCLIENT6}" ]; then
|
||||
echo "ERROR: Suitable DHCPv6 client ${DHCLIENT6} not found. Install net/isc-dhcp44-client!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
"${DHCLIENT6}" -6 -nw -cf /dev/null "$@"
|
||||
fi
|
Loading…
Reference in new issue