Merge branch 'dora' of ssh://git.sysmocom.de/customer/generic-poky into dora

This commit is contained in:
Harald Welte 2015-02-13 19:26:05 +01:00
commit 8805f0a8bb
7 changed files with 173 additions and 14 deletions

View File

@ -1,6 +1,6 @@
SYSMOCOM := "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
FILESEXTRAPATHS_prepend := "${SYSMOCOM}/netbase-${PV}:${SYSMOCOM}/netbase:"
PRINC = "4"
PRINC = "7"
# systemd does not look at /etc/rcS.d for the script. Make sure
# there is a symlink available

View File

@ -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

View File

@ -58,8 +58,12 @@ do_install () {
install -d ${D}${sysconfdir}/dbus-1/system.d
install -m 644 dbus/dnsmasq.conf ${D}${sysconfdir}/dbus-1/system.d/
fi
install -d ${D}/srv/tftp
}
FILES_${PN} += "/srv/tftp"
CONFFILES_${PN} = "${sysconfdir}/dnsmasq.conf"
RPROVIDES_${PN} += "${PN}-systemd"

View File

@ -286,8 +286,3 @@ dhcp-range=10.0.0.10,10.0.0.200,2h
# Include a another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf

View File

@ -32,7 +32,7 @@ bogus-priv
# Change this line if you want dns to get its upstream servers from
# somewhere other that /etc/resolv.conf
#resolv-file=
#resolv-file=/etc/resolv.conf.dhcp
# By default, dnsmasq will send queries to any of the upstream
# servers it knows about and tries to favour servers to are known
@ -72,7 +72,7 @@ bogus-priv
# If you want dnsmasq to listen for requests only on specified interfaces
# (and the loopback) give the name of the interface (eg eth0) here.
# Repeat the line for more than one interface.
interface=eth2
#interface=eth2
# Or you can specify which interface _not_ to listen on
#except-interface=
# Or which to listen on by address (remember to include 127.0.0.1 if
@ -106,7 +106,7 @@ interface=eth2
# 2) Sets the "domain" DHCP option thereby potentially setting the
# domain of all systems configured by DHCP
# 3) Provides the domain part for "expand-hosts"
#domain=thekelleys.org.uk
domain=vessel.sob.sysmocom.de
# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
@ -121,7 +121,17 @@ interface=eth2
# agent. If you don't know what a DHCP relay agent is, you probably
# don't need to worry about this.
#dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h
dhcp-range=172.16.2.2,172.16.3.254,255.255.254.0,168h
# DHCP range for the management network of the SOB-JB
dhcp-range=mgmt,172.16.2.10,172.16.3.254,255.255.254.0,168h
# DHCP range for native IP, this is just temporary so we see if
# there are any devices with wrong configuration
dhcp-range=native,172.16.4.10,172.16.4.254,255.255.254.0,168h
# DHCP range for administrative access via eth1
dhcp-range=admin,172.16.6.2,172.16.6.255,255.255.255.0,24h
# This is an example of a DHCP range with a network-id, so that
# some DHCP options may be set only for this network.
@ -287,8 +297,9 @@ dhcp-range=172.16.2.2,172.16.3.254,255.255.254.0,168h
# Include a another lot of configuration options.
#conf-file=/etc/dnsmasq.more.conf
dhcp-hostsfile=/etc/dnsmasq.dhcp-hosts
enable-tftp
tftp-root=/srv/tftp/
tftp-secure

View File

@ -2,7 +2,51 @@ Index: ifupdown-0.7.52/execute.c
===================================================================
--- ifupdown-0.7.52.orig/execute.c
+++ ifupdown-0.7.52/execute.c
@@ -168,8 +168,7 @@ int execute_scripts(interface_defn * ifd
@@ -25,7 +25,7 @@ static void set_environ(interface_defn *
{
char **environend;
int i;
- const int n_env_entries = iface->n_options + 8;
+ const int n_env_entries = (iface ? iface->n_options : 0) + 8;
{
char **ppch;
@@ -42,7 +42,7 @@ static void set_environ(interface_defn *
environend = environ;
*environend = NULL;
- for (i = 0; i < iface->n_options; i++) {
+ for (i = 0; iface && i < iface->n_options; i++) {
if (strcmp(iface->option[i].name, "pre-up") == 0 || strcmp(iface->option[i].name, "up") == 0 || strcmp(iface->option[i].name, "down") == 0 || strcmp(iface->option[i].name, "post-down") == 0) {
continue;
}
@@ -52,6 +52,7 @@ static void set_environ(interface_defn *
*environend = NULL;
}
+ if (iface) {
*(environend++) = setlocalenv("%s=%s", "IFACE", iface->real_iface);
*environend = NULL;
@@ -63,12 +64,17 @@ static void set_environ(interface_defn *
*(environend++) = setlocalenv("%s=%s", "METHOD", iface->method->name);
*environend = NULL;
+ }
+ if (mode) {
*(environend++) = setlocalenv("%s=%s", "MODE", mode);
*environend = NULL;
+ }
+ if (phase) {
*(environend++) = setlocalenv("%s=%s", "PHASE", phase);
*environend = NULL;
+ }
*(environend++) = setlocalenv("%s=%s", "VERBOSITY", verbose ? "1" : "0");
*environend = NULL;
@@ -168,8 +174,7 @@ int execute_scripts(interface_defn * ifd
return 1;
char buf[100];
@ -12,3 +56,15 @@ Index: ifupdown-0.7.52/execute.c
verbose ? "--verbose " : "", opt);
int result = (*exec)(buf);
@@ -285,6 +290,11 @@ int execute(char *command, interface_def
char *out;
int ret;
+ if (!environ) {
+ /* initialize the environment to find /sbin/ip */
+ set_environ(NULL, NULL, NULL);
+ }
+
out = parse(command, ifd);
if (!out) {
return 0;

View File

@ -14,6 +14,8 @@ SRC_URI[sha256sum] = "8a0647c59ee0606f5da9205c5b3c5b000fea98fe39348f6bb2cba5fecf
CFLAGS += "-D'IFUPDOWN_VERSION="0.7"'"
PR = "r1"
do_configure() {
chmod a+rx makecdep.sh makenwdep.sh
}