diff --git a/meta-sysmocom-bsp/recipes-bsp/init-ifupdown/init-ifupdown/init b/meta-sysmocom-bsp/recipes-bsp/init-ifupdown/init-ifupdown/init new file mode 100644 index 0000000000..986a2ebda8 --- /dev/null +++ b/meta-sysmocom-bsp/recipes-bsp/init-ifupdown/init-ifupdown/init @@ -0,0 +1,91 @@ +#!/bin/sh -e +### BEGIN INIT INFO +# Provides: networking +# Required-Start: mountvirtfs $local_fs +# Required-Stop: $local_fs +# Should-Start: ifupdown +# Should-Stop: ifupdown +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Raise network interfaces. +### END INIT INFO + +PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" + +[ -x /sbin/ifup ] || exit 0 + +check_network_file_systems() { + [ -e /proc/mounts ] || return 0 + + if [ -e /etc/iscsi/iscsi.initramfs ]; then + echo "not deconfiguring network interfaces: iSCSI root is mounted." + exit 0 + fi + + exec 9<&0 < /proc/mounts + while read DEV MTPT FSTYPE REST; do + case $DEV in + /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) + echo "not deconfiguring network interfaces: network devices still mounted." + exit 0 + ;; + esac + case $FSTYPE in + nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs) + echo "not deconfiguring network interfaces: network file systems still mounted." + exit 0 + ;; + esac + done + exec 0<&9 9<&- +} + +check_network_swap() { + [ -e /proc/swaps ] || return 0 + + exec 9<&0 < /proc/swaps + while read DEV MTPT FSTYPE REST; do + case $DEV in + /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*) + echo "not deconfiguring network interfaces: network swap still mounted." + exit 0 + ;; + esac + done + exec 0<&9 9<&- +} + +case "$1" in +start) + echo -n "Configuring network interfaces... " + mkdir /run/network || true + sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1 + ifup -a + echo "done." + ;; + +stop) + check_network_file_systems + check_network_swap + + echo -n "Deconfiguring network interfaces... " + ifdown -a + echo "done." + ;; + +force-reload|restart) + echo "Running $0 $1 is deprecated because it may not enable again some interfaces" + echo "Reconfiguring network interfaces... " + ifdown -a || true + ifup -a + echo "done." + ;; + +*) + echo "Usage: /etc/init.d/networking {start|stop}" + exit 1 + ;; +esac + +exit 0 + diff --git a/meta-sysmocom-bsp/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/interfaces b/meta-sysmocom-bsp/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/interfaces index 8dc4b0ffaa..71c188595d 100644 --- a/meta-sysmocom-bsp/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/interfaces +++ b/meta-sysmocom-bsp/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/interfaces @@ -4,15 +4,27 @@ auto lo iface lo inet loopback -# eth0 is attached to the IDU-internal managed switch +# eth0 is attached to the IDU-internal managed switch (IES-3080) # in the future we will use VLANs to use individual switch ports as -# break-out interfaces. For now we simply do static config for use with -# the iridium openport satmodem -iface eth0 inet static +# break-out interfaces. For now we simply do DHCP. + +# VLAN 2000: The iridium openport satellite modem attached to +# port 1 of the IES-3080 +auto eth0.2000 +iface eth0.2000 inet static address 192.168.0.254 netmask 255.255.255.0 network 192.168.0.0 - post-up ip r add 10.6.1.0/24 via 192.168.0.1 + post-up ip r add 10.6.1.0/24 via 192.168.0.1 + +# VLAN 2001: Reserved for a future C-Band satellite modem +# attached to port 8 of the IES-3080 +auto eth0.2001 +iface eth0.2001 inet manual + +# management VLAN of IES-3080 switch (172.16.2.3) +auto eth0.6 +iface eth0.6 inet manual #eth1 is our admin interface and will provide dhcp to clients auto eth1 @@ -29,7 +41,6 @@ iface eth2 inet manual # * br0 is a bridge interface on top of eth2 # * we use the bridging code so we can run mstpd and become the root bridge - auto br0 iface br0 inet static bridge_ports eth2 @@ -38,21 +49,27 @@ iface br0 inet static netmask 255.255.254.0 network 172.16.4.0 -# VLAN 6: management VLAN +# management VLAN towards {N,P}JB auto br0.6 -iface br0.6 inet static +iface br0.6 inet manual + +# bridge for VLAN 6: management VLAN +auto br-mgmt +iface br-mgmt inet static + bridge_ports br0.6 eth0.6 + bridge_maxwait 0 address 172.16.2.1 netmask 255.255.254.0 network 172.16.2.0 # 172.16.1.1 is the service IP address for SOBMGMT -auto br0.6:0 -iface br0.6:0 inet static +auto br-mgmt:0 +iface br-mgmt:0 inet static address 172.16.1.1 netmask 255.255.255.255 auto br0.7 iface br0.7 inet static - address 172.16.7.1 - netmask 255.255.255.0 - network 172.16.7.0 + address 172.16.7.1 + netmask 255.255.255.0 + network 172.16.7.0 diff --git a/meta-sysmocom-bsp/recipes-bsp/init-ifupdown/init-ifupdown_sysmocom.inc b/meta-sysmocom-bsp/recipes-bsp/init-ifupdown/init-ifupdown_sysmocom.inc index 7ecf300b9c..fa34d7122e 100644 --- a/meta-sysmocom-bsp/recipes-bsp/init-ifupdown/init-ifupdown_sysmocom.inc +++ b/meta-sysmocom-bsp/recipes-bsp/init-ifupdown/init-ifupdown_sysmocom.inc @@ -1,6 +1,6 @@ SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}" FILESEXTRAPATHS_prepend := "${SYSMOCOM}/init-ifupdown-${PV}:${SYSMOCOM}/init-ifupdown:" -PRINC = "10" +PRINC = "11" # systemd does not look at /etc/rcS.d for the script. Make sure # there is a symlink available diff --git a/meta-sysmocom-bsp/recipes-extra/ifupdown/files/ifupdown.conf b/meta-sysmocom-bsp/recipes-extra/ifupdown/files/ifupdown.conf deleted file mode 100644 index 7a7e145390..0000000000 --- a/meta-sysmocom-bsp/recipes-extra/ifupdown/files/ifupdown.conf +++ /dev/null @@ -1 +0,0 @@ -d /run/network - - - - diff --git a/meta-sysmocom-bsp/recipes-extra/ifupdown/ifupdown_0.7.52.bb b/meta-sysmocom-bsp/recipes-extra/ifupdown/ifupdown_0.7.52.bb index 2b5410a492..9114c8d662 100644 --- a/meta-sysmocom-bsp/recipes-extra/ifupdown/ifupdown_0.7.52.bb +++ b/meta-sysmocom-bsp/recipes-extra/ifupdown/ifupdown_0.7.52.bb @@ -7,7 +7,6 @@ LICENSE = "GPLv2" LIC_FILES_CHKSUM = "file://debian/copyright;md5=7adfbe801102d1e7e6bfdd3f03754efa" SRC_URI = "https://launchpadlibrarian.net/194033720/ifupdown_${PV}.tar.xz \ - file://ifupdown.conf \ file://busybox-yocto-compat.patch " SRC_URI[md5sum] = "bb204ae2fa4171d6f1de4097f4570a7d" @@ -15,7 +14,7 @@ SRC_URI[sha256sum] = "8a0647c59ee0606f5da9205c5b3c5b000fea98fe39348f6bb2cba5fecf CFLAGS += "-D'IFUPDOWN_VERSION="0.7"'" -PR = "r3" +PR = "r2" do_configure() { chmod a+rx makecdep.sh makenwdep.sh @@ -27,9 +26,6 @@ do_install() { ln -s ${base_sbindir}/ifup.${BPN} ${D}${base_sbindir}/ifdown.${BPN} ln -s ${base_sbindir}/ifup.${BPN} ${D}${base_sbindir}/ifquery install -D -m 0755 settle-dad.sh ${D}/lib/ifupdown/settle-dad.sh - - install -d ${D}${libdir}/tmpfiles.d - install -m 0644 ${WORKDIR}/ifupdown.conf ${D}${libdir}/tmpfiles.d/ } inherit update-alternatives @@ -44,4 +40,4 @@ ALTERNATIVE_TARGET[ifup] = "${base_sbindir}/ifup.${BPN}" ALTERNATIVE_LINK_NAME[ifdown] = "${base_sbindir}/ifdown" ALTERNATIVE_TARGET[ifdown] = "${base_sbindir}/ifdown.${BPN}" -FILES_${PN} += "/lib/ifupdown/settle-dad.sh ${libdir}/tmpfiles.d/*" +FILES_${PN} += "/lib/ifupdown/settle-dad.sh"