The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2229
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Naming functions like tools but do something different is not that intuitive https://manpages.debian.org/testing/ifupdown/ifup.8.en.html That is why I changed it to `_ifup` and `_ifdown` to make that clear that it does something different. Also there is no need to pass along environment parameters as function parameter. Signed-off-by: Felix [email protected]
From 0c6dc63764889f96ff6e61b21213c4aaf2bef8f6 Mon Sep 17 00:00:00 2001 From: fliiiix <[email protected]> Date: Thu, 22 Mar 2018 16:18:59 +0100 Subject: [PATCH] Rename ifup/down and remove usless parameter passing --- config/init/common/lxc-net.in | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/config/init/common/lxc-net.in b/config/init/common/lxc-net.in index ddbd4aaab..df9f1181d 100644 --- a/config/init/common/lxc-net.in +++ b/config/init/common/lxc-net.in @@ -38,17 +38,17 @@ _netmask2cidr () echo $(( $2 + (${#x}/4) )) } -ifdown() { - ip addr flush dev $1 - ip link set dev $1 down +_ifdown() { + ip addr flush dev ${LXC_BRIDGE} + ip link set dev ${LXC_BRIDGE} down } -ifup() { +_ifup() { MASK=`_netmask2cidr ${LXC_NETMASK}` CIDR_ADDR="${LXC_ADDR}/${MASK}" - ip addr add ${CIDR_ADDR} dev $1 - ip link set dev $1 address $LXC_BRIDGE_MAC - ip link set dev $1 up + ip addr add ${CIDR_ADDR} dev ${LXC_BRIDGE} + ip link set dev ${LXC_BRIDGE} address $LXC_BRIDGE_MAC + ip link set dev ${LXC_BRIDGE} up } start() { @@ -89,7 +89,7 @@ start() { fi fi - ifup ${LXC_BRIDGE} ${LXC_ADDR} ${LXC_NETMASK} + _ifup LXC_IPV6_ARG="" if [ -n "$LXC_IPV6_ADDR" ] && [ -n "$LXC_IPV6_MASK" ] && [ -n "$LXC_IPV6_NETWORK" ]; then @@ -151,7 +151,7 @@ stop() { [ -f "${varrun}/network_up" ] || [ "$1" = "force" ] || { echo "lxc-net isn't running"; exit 1; } if [ -d /sys/class/net/${LXC_BRIDGE} ]; then - ifdown ${LXC_BRIDGE} + _ifdown iptables $use_iptables_lock -D INPUT -i ${LXC_BRIDGE} -p udp --dport 67 -j ACCEPT iptables $use_iptables_lock -D INPUT -i ${LXC_BRIDGE} -p tcp --dport 67 -j ACCEPT iptables $use_iptables_lock -D INPUT -i ${LXC_BRIDGE} -p udp --dport 53 -j ACCEPT
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
