diff --git a/.gitignore b/.gitignore index fae2bfb..51158ed 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ install-sh missing reboot scripts/devfs.sh -scripts/ifcfg.sh scripts/ifrename.sh scripts/modules_load.sh services/devfs diff --git a/configure.ac b/configure.ac index cd860a4..5a4f61a 100644 --- a/configure.ac +++ b/configure.ac @@ -38,7 +38,6 @@ AC_CONFIG_FILES([services/tmpfsvar]) AC_CONFIG_FILES([services/dhcpcd]) AC_CONFIG_FILES([scripts/devfs.sh]) AC_CONFIG_FILES([scripts/ifrename.sh]) -AC_CONFIG_FILES([scripts/ifcfg.sh]) AC_CONFIG_FILES([scripts/modules_load.sh]) AC_CONFIG_FILES([crontab/swclock]) diff --git a/docs/network.md b/docs/network.md index 3403932..3a76c9a 100644 --- a/docs/network.md +++ b/docs/network.md @@ -34,46 +34,12 @@ Extension cards or external network adapters should be given a different prefix to avoid changes in the order as they come and go. -## Interface Configuration +## Static Interface and Route Configuration -After interface renaming, for each network interface, the configuration path is -scanned for files with the same name as the interface. - -Each successfully found configuration file is processed line by line, top to -bottom. Each line may contain a keyword, followed by multiple arguments. - -The following keywords can be used to add IPv4 or IPv6 network addresses to -an interface: - - * address - * addr - * ip - * ip6 - * ipv6 - -Those commands are expected to be followed by an IPv4 or IPv6 address and -network mask. - - -Furthermore, the following commands can be used for configuring interface -parameters: - - * `arp {on|off}` - * `multicast {on|off}` - * `mtu ` - * `offload [rx {on|off}] [tx {on|off}] [sg {on|off}] [tso {on|off}]` - * `offload [gso {on|off}] [gro {on|off}] [lro {on|off}] [rxvlan {on|off}]` - * `offload [txvlan {on|off}] [ntuple {on|off}] [rxhash {on|off}]` - * `offload [ufo {on|off}]` - - -## Route Configuration - -After interface configuration is done, routes and rules are restored from a -file named `routes` in the same configuration path. - -The file may contain lines starting with `route` or `rule`. Everything that -follows is passed on to `ip route add` or `ip rule add` respectively. +After interface renaming, an iproute2 batch script `/etc/netcfg/static` is +executed with the `-force` option is set, i.e. it will plough throug the +entire script without aborting, but the service will be marked as having +failed if any of the batch lines fail. ## Net Filter Tables diff --git a/scripts/Makemodule.am b/scripts/Makemodule.am index 207b9d2..3616171 100644 --- a/scripts/Makemodule.am +++ b/scripts/Makemodule.am @@ -1,5 +1,5 @@ helper_SCRIPTS += scripts/devfs.sh scripts/trymount.sh scripts/ifrename.sh -helper_SCRIPTS += scripts/ifcfg.sh scripts/ifdown.sh scripts/modules_load.sh +helper_SCRIPTS += scripts/ifdown.sh scripts/modules_load.sh helper_SCRIPTS += scripts/setntpdate.sh scripts/overlay.sh EXTRA_DIST += scripts/trymount.sh scripts/ifdown.sh scripts/setntpdate.sh diff --git a/scripts/ifcfg.sh.in b/scripts/ifcfg.sh.in deleted file mode 100755 index e203826..0000000 --- a/scripts/ifcfg.sh.in +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh -CFGPATH="@ETCPATH@/netcfg" - -[ -d "$CFGPATH" ] || exit 0 - -# configure interfaces -for IFPATH in /sys/class/net/*; do - [ "$IFPATH" = "/sys/class/net/lo" ] && continue - - IF=`basename $IFPATH` - CFGFILE="$CFGPATH/$IF" - - [ -f "$CFGFILE" ] || continue - - ip link set dev "$IF" down - - while read LINE; - do - trimmed=`echo -- $LINE` - [ ! -z "$trimmed" ] || continue - set $trimmed - - case "$1" in - address|addr|ip|ip6|ipv6) - shift - ip address add $@ dev "$IF" - ;; - arp|multicast|mtu) - ip link set dev "$IF" $@ - ;; - offload) - shift - ethtool -K "$IF" $@ - ;; - *) - ;; - esac - done < "$CFGFILE" -done - -# configure static routs -if [ -f "$CFGPATH/routes" ]; then - while read LINE; - do - trimmed=`echo -- $LINE` - [ ! -z "$trimmed" ] || continue - set $trimmed - - case "$1" in - route) - shift - ip route add $@ - ;; - rule) - shift - ip rule add $@ - ;; - *) - ;; - esac - done < "$CFGFILE" -fi - -# activate interfaces -for IFPATH in /sys/class/net/*; do - [ "$IFPATH" = "/sys/class/net/lo" ] && continue - - IF=`basename $IFPATH` - - [ ! -f "$CFGPATH/$IF" ] || ip link set dev "$IF" up -done diff --git a/services/ifcfg.in b/services/ifcfg.in index c2b4127..c7ba823 100644 --- a/services/ifcfg.in +++ b/services/ifcfg.in @@ -3,5 +3,4 @@ type wait target boot after sysinit ifrename before network - -exec "@SCRIPTDIR@/ifcfg.sh" \ No newline at end of file +exec ip -force -batch "@ETCPATH@/netcfg/static"