From 7843fb4085057b1dfb7afc6b1b08781ea26216b4 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 18 Apr 2015 22:32:58 +0200 Subject: [PATCH 1/3] idu /etc/network/interfaces: Add VLANs for iridium, switch mgmt --- .../init-ifupdown/sysmocom-idu/interfaces | 43 +++++++++++++------ .../init-ifupdown/init-ifupdown_sysmocom.inc | 2 +- 2 files changed, 31 insertions(+), 14 deletions(-) diff --git a/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/interfaces b/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/interfaces index 8dc4b0ffaa..71c188595d 100644 --- a/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/interfaces +++ b/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/recipes-bsp/init-ifupdown/init-ifupdown_sysmocom.inc b/recipes-bsp/init-ifupdown/init-ifupdown_sysmocom.inc index 7ecf300b9c..fa34d7122e 100644 --- a/recipes-bsp/init-ifupdown/init-ifupdown_sysmocom.inc +++ b/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 From c32b0df2e3a89b70f27767dcd47721e5840d5fee Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 20 Apr 2015 09:39:49 -0400 Subject: [PATCH 2/3] ifupdown: Revert the tmpfiles.d change as the dir is created too late It looks like on my tests with the sysmobts I was saved by busybox-ifplogd executing ifup again. I couldn't figure out the dependencies between the LSB networking service and the tmpfiles.d interaction. So instead of winning a beauty contest we will need to create the directory by hand. Cause: SYS#1514 Revert "ifupdown: Package the new file as well" This reverts commit 15dc869cdacf69bb3728ff0d47f7ff1ffbe18fca. Revert "ifupdown: Try the workdir for the files we copied" This reverts commit 1ef790672e6bdb4ae7e281dcb71edb674c931474. Revert "ifupdown: Create /run/network through a tmpfiles.d" This reverts commit e0c7f3c62132ff7b1a9c7d2c01ef2be60c6c0ddc. --- .../init-ifupdown/sysmocom-idu/init | 91 +++++++++++++++++++ .../init-ifupdown/sysmocom-odu/init | 91 +++++++++++++++++++ recipes-extra/ifupdown/files/ifupdown.conf | 1 - recipes-extra/ifupdown/ifupdown_0.7.52.bb | 8 +- 4 files changed, 184 insertions(+), 7 deletions(-) create mode 100644 recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/init create mode 100644 recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/init delete mode 100644 recipes-extra/ifupdown/files/ifupdown.conf diff --git a/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/init b/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/init new file mode 100644 index 0000000000..986a2ebda8 --- /dev/null +++ b/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/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/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/init b/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/init new file mode 100644 index 0000000000..986a2ebda8 --- /dev/null +++ b/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/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/recipes-extra/ifupdown/files/ifupdown.conf b/recipes-extra/ifupdown/files/ifupdown.conf deleted file mode 100644 index 7a7e145390..0000000000 --- a/recipes-extra/ifupdown/files/ifupdown.conf +++ /dev/null @@ -1 +0,0 @@ -d /run/network - - - - diff --git a/recipes-extra/ifupdown/ifupdown_0.7.52.bb b/recipes-extra/ifupdown/ifupdown_0.7.52.bb index 2b5410a492..9114c8d662 100644 --- a/recipes-extra/ifupdown/ifupdown_0.7.52.bb +++ b/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" From e0bcee0206fd3052fd2cf45c587957e6143fd1c7 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 20 Apr 2015 09:47:19 -0400 Subject: [PATCH 3/3] init-ifupdown: Attempt to make our init script available for everyone Create the /run/network directory for all of our systems. The proper way with tmpfiles.d ends with a depedency mess that has no point in being debugged. My local build hasn't completed yet but we need to rush. Let the CI test this change and we will see. Related: SYS#1514 --- .../init-ifupdown/{sysmocom-idu => }/init | 0 .../init-ifupdown/sysmocom-odu/init | 91 ------------------- 2 files changed, 91 deletions(-) rename recipes-bsp/init-ifupdown/init-ifupdown/{sysmocom-idu => }/init (100%) delete mode 100644 recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/init diff --git a/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/init b/recipes-bsp/init-ifupdown/init-ifupdown/init similarity index 100% rename from recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-idu/init rename to recipes-bsp/init-ifupdown/init-ifupdown/init diff --git a/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/init b/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/init deleted file mode 100644 index 986a2ebda8..0000000000 --- a/recipes-bsp/init-ifupdown/init-ifupdown/sysmocom-odu/init +++ /dev/null @@ -1,91 +0,0 @@ -#!/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 -