network-manager-conf: Enhance support for user module
Now all scenarios with a user module are covered: - static setup with a user module will create a bridge with static IP - dhcp setup with a user module will put a static IP on the UM and DHCP on the main interface BugzID: 81969
This commit is contained in:
parent
230743c03d
commit
063bdd83a3
|
|
@ -14,7 +14,6 @@ SRC_URI = " \
|
||||||
file://eth0-static \
|
file://eth0-static \
|
||||||
file://eth0-dhcp \
|
file://eth0-dhcp \
|
||||||
file://bridge-slave-eth0.nmconnection \
|
file://bridge-slave-eth0.nmconnection \
|
||||||
file://bridge-slave-umnet0.nmconnection \
|
|
||||||
file://NetworkManager.conf \
|
file://NetworkManager.conf \
|
||||||
file://00-fallback-dns.conf \
|
file://00-fallback-dns.conf \
|
||||||
file://unmanaged-devices.conf \
|
file://unmanaged-devices.conf \
|
||||||
|
|
@ -27,37 +26,57 @@ SRC_URI_append_am335x-nrhw20 = " \
|
||||||
|
|
||||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||||
|
|
||||||
|
SYSTEM_CONNECTIONS = "${D}${sysconfdir}/NetworkManager/system-connections/"
|
||||||
|
|
||||||
do_install () {
|
do_install () {
|
||||||
install -d ${D}${sysconfdir}/NetworkManager/dnsmasq.d
|
install -d ${D}${sysconfdir}/NetworkManager/dnsmasq.d
|
||||||
install -d ${D}${sysconfdir}/NetworkManager/system-connections
|
install -d ${SYSTEM_CONNECTIONS}
|
||||||
install -m 0644 ${WORKDIR}/NetworkManager.conf ${D}${sysconfdir}/NetworkManager/
|
install -m 0644 ${WORKDIR}/NetworkManager.conf ${D}${sysconfdir}/NetworkManager/
|
||||||
install -m 0644 ${WORKDIR}/00-fallback-dns.conf ${D}${sysconfdir}/NetworkManager/dnsmasq.d/
|
install -m 0644 ${WORKDIR}/00-fallback-dns.conf ${D}${sysconfdir}/NetworkManager/dnsmasq.d/
|
||||||
|
|
||||||
|
static_ifaces=""
|
||||||
|
dhcp_ifaces=""
|
||||||
|
bridged_ifaces=""
|
||||||
|
|
||||||
if ${@bb.utils.contains('PACKAGECONFIG','ethernet-dhcp','true','false',d)}; then
|
if ${@bb.utils.contains('PACKAGECONFIG','ethernet-dhcp','true','false',d)}; then
|
||||||
install -m 0600 ${WORKDIR}/eth0-dhcp ${D}${sysconfdir}/NetworkManager/system-connections/eth0.nmconnection
|
# DHCP on main interface and static IP on the user module interface (if present)
|
||||||
|
dhcp_ifaces="$DEFAULT_ETH"
|
||||||
|
if ${@bb.utils.contains('MACHINE_FEATURES','user-module','true','false',d)}; then
|
||||||
|
static_ifaces="umnet0"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
install -m 0600 ${WORKDIR}/eth0-static ${D}${sysconfdir}/NetworkManager/system-connections/eth0.nmconnection
|
# static IP either on the bridge or main interface
|
||||||
|
if ${@bb.utils.contains('MACHINE_FEATURES','user-module','true','false',d)}; then
|
||||||
|
static_ifaces="br0"
|
||||||
|
bridged_ifaces="$DEFAULT_ETH umnet0"
|
||||||
|
else
|
||||||
|
static_ifaces="$DEFAULT_ETH"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the distro supports the user module we must bridge eth0 and umnet0
|
|
||||||
# and configure br0 instead of eth0
|
|
||||||
if ${@bb.utils.contains('COMBINED_FEATURES','user-module','true','false',d)}; then
|
|
||||||
DEFAULT_ETH="br0"
|
|
||||||
install -m 0600 ${WORKDIR}/bridge-slave-eth0.nmconnection ${D}${sysconfdir}/NetworkManager/system-connections/
|
|
||||||
install -m 0600 ${WORKDIR}/bridge-slave-umnet0.nmconnection ${D}${sysconfdir}/NetworkManager/system-connections/
|
|
||||||
|
|
||||||
# Change type of main connection to bridge
|
for iface in $static_ifaces; do
|
||||||
sed -i "s/type=.*/type=bridge/g" ${D}${sysconfdir}/NetworkManager/system-connections/eth0.nmconnection
|
install -m 0600 ${WORKDIR}/eth0-static ${SYSTEM_CONNECTIONS}/$iface.nmconnection
|
||||||
printf "\n[bridge]\nstp=false\n" >> ${D}${sysconfdir}/NetworkManager/system-connections/eth0.nmconnection
|
sed -i "s/eth0/$iface/g" ${SYSTEM_CONNECTIONS}/$iface.nmconnection
|
||||||
fi
|
|
||||||
|
|
||||||
# Handle HWs with different default interface
|
# Handle bridges
|
||||||
if [ "$DEFAULT_ETH" != "eth0" ]; then
|
if ! [ "$iface" = "${iface#br}" ]; then
|
||||||
# Replace interface name
|
# Change type of main connection to bridge
|
||||||
sed -i "s/eth0/$DEFAULT_ETH/g" ${D}${sysconfdir}/NetworkManager/system-connections/eth0.nmconnection
|
sed -i "s/type=.*/type=bridge/g" ${SYSTEM_CONNECTIONS}/$iface.nmconnection
|
||||||
mv ${D}${sysconfdir}/NetworkManager/system-connections/eth0.nmconnection \
|
printf "\n[bridge]\nstp=false\n" >> ${SYSTEM_CONNECTIONS}/$iface.nmconnection
|
||||||
${D}${sysconfdir}/NetworkManager/system-connections/$DEFAULT_ETH.nmconnection
|
fi
|
||||||
fi
|
done
|
||||||
|
|
||||||
|
for iface in $dhcp_ifaces; do
|
||||||
|
install -m 0600 ${WORKDIR}/eth0-dhcp ${SYSTEM_CONNECTIONS}/$iface.nmconnection
|
||||||
|
sed -i "s/eth0/$iface/g" ${SYSTEM_CONNECTIONS}/$iface.nmconnection
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
for iface in $bridged_ifaces; do
|
||||||
|
install -m 0600 ${WORKDIR}/bridge-slave-eth0.nmconnection ${SYSTEM_CONNECTIONS}/$iface.nmconnection
|
||||||
|
sed -i "s/eth0/$iface/g" ${SYSTEM_CONNECTIONS}/$iface.nmconnection
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
if ${@bb.utils.contains('PACKAGECONFIG','unmanaged-devices','true','false',d)}; then
|
if ${@bb.utils.contains('PACKAGECONFIG','unmanaged-devices','true','false',d)}; then
|
||||||
|
|
@ -67,11 +86,11 @@ do_install () {
|
||||||
}
|
}
|
||||||
|
|
||||||
do_install_append_am335x-nrhw20() {
|
do_install_append_am335x-nrhw20() {
|
||||||
rm -rf ${D}${sysconfdir}/NetworkManager/system-connections/*
|
rm -rf ${SYSTEM_CONNECTIONS}/*
|
||||||
if ${@bb.utils.contains('PACKAGECONFIG','ethernet-dhcp','true','false',d)}; then
|
if ${@bb.utils.contains('PACKAGECONFIG','ethernet-dhcp','true','false',d)}; then
|
||||||
install -m 0600 ${WORKDIR}/system-connections-dhcp/* ${D}${sysconfdir}/NetworkManager/system-connections/
|
install -m 0600 ${WORKDIR}/system-connections-dhcp/* ${SYSTEM_CONNECTIONS}/
|
||||||
else
|
else
|
||||||
install -m 0600 ${WORKDIR}/system-connections-static/* ${D}${sysconfdir}/NetworkManager/system-connections/
|
install -m 0600 ${WORKDIR}/system-connections-static/* ${SYSTEM_CONNECTIONS}/
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -79,7 +98,7 @@ do_install_append_am335x-nrhw20() {
|
||||||
FILES_${PN} = " \
|
FILES_${PN} = " \
|
||||||
${sysconfdir}/NetworkManager/NetworkManager.conf \
|
${sysconfdir}/NetworkManager/NetworkManager.conf \
|
||||||
${sysconfdir}/NetworkManager/dnsmasq.d \
|
${sysconfdir}/NetworkManager/dnsmasq.d \
|
||||||
${sysconfdir}/NetworkManager/system-connections \
|
${sysconfdir}/NetworkManager/system-connections \
|
||||||
${sysconfdir}/NetworkManager/conf.d \
|
${sysconfdir}/NetworkManager/conf.d \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
[connection]
|
[connection]
|
||||||
id=bridge-slave-eth0
|
id=bridge-slave-eth0
|
||||||
uuid=06ecc0bb-7408-4ddd-b55c-dbb735c1d030
|
|
||||||
type=ethernet
|
type=ethernet
|
||||||
interface-name=eth0
|
interface-name=eth0
|
||||||
master=br0
|
master=br0
|
||||||
|
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
[connection]
|
|
||||||
id=bridge-slave-umnet0
|
|
||||||
uuid=128dbe32-f484-4062-9bc5-31f90bfb1063
|
|
||||||
type=ethernet
|
|
||||||
interface-name=umnet0
|
|
||||||
master=br0
|
|
||||||
permissions=
|
|
||||||
slave-type=bridge
|
|
||||||
|
|
||||||
[ethernet]
|
|
||||||
mac-address-blacklist=
|
|
||||||
|
|
||||||
[bridge-port]
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
[connection]
|
[connection]
|
||||||
id=ethernet
|
id=ethernet
|
||||||
uuid=2a2b6485-4d06-4b86-8051-751399c6881a
|
|
||||||
type=ethernet
|
type=ethernet
|
||||||
interface-name=eth0
|
interface-name=eth0
|
||||||
permissions=
|
permissions=
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
[connection]
|
[connection]
|
||||||
id=ethernet
|
id=ethernet
|
||||||
uuid=2a2b6485-4d06-4b86-8051-751399c6881a
|
|
||||||
type=ethernet
|
type=ethernet
|
||||||
interface-name=eth0
|
interface-name=eth0
|
||||||
permissions=
|
permissions=
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue