Commit b774b48d authored by Francklin Simo's avatar Francklin Simo

Enable forwarding on appropriate components and when necessary

parent 6eb2b8e4
......@@ -210,33 +210,23 @@ class OpenSandIfaces(object):
def _check_sysctl(self):
""" check sysctl values and log if the value may lead to errors """
if OpenSandIfaces._name == 'sat':
if OpenSandIfaces._name == 'sat' or OpenSandIfaces._name == 'gw-phy':
return
with open("/proc/sys/net/ipv4/ip_forward", 'ro') as sysctl:
if sysctl.read().rstrip('\n') != "1":
LOGGER.warning("IPv4 ip_forward is disabled, you should "
"enable it")
if OpenSandIfaces._name != 'gw-phy':
for iface in [OpenSandIfaces._lan_iface]:
with open("/proc/sys/net/ipv4/conf/%s/forwarding" % iface,
'ro') as sysctl:
if sysctl.read().rstrip('\n') != "1":
LOGGER.warning("IPv4 forwarding on interface %s is "
"disabled, you won't be able to route "
"packets toward WS behind this host" %
iface)
if OpenSandIfaces._name != 'gw-net-acc':
for iface in [OpenSandIfaces._emu_iface]:
with open("/proc/sys/net/ipv4/conf/%s/forwarding" % iface,
'ro') as sysctl:
if sysctl.read().rstrip('\n') != "1":
LOGGER.warning("IPv4 forwarding on interface %s is "
"disabled, you won't be able to route "
"packets toward WS behind this host" %
iface)
"enable it, so be able to route "
"packets toward WS behind this host")
for iface in [OpenSandIfaces._lan_iface]:
with open("/proc/sys/net/ipv4/conf/%s/forwarding" % iface,
'ro') as sysctl:
if sysctl.read().rstrip('\n') != "1":
LOGGER.warning("IPv4 forwarding on interface %s is "
"disabled, you won't be able to route "
"packets toward WS behind this host" %
iface)
def get_descr(self):
""" get the addresses elements """
......
......@@ -46,7 +46,6 @@ SYSCTL="true"
# workstations
IP_FORWARD="1"
FORWARDING="1"
PROXY_ARP="1"
# Source default library
if [ -f /etc/default/opensand-daemon ]; then
......@@ -120,44 +119,11 @@ check_root(){
# Configure sysctl
set_sysctl(){
db_get opensand-daemon/network/emu_iface
EMU_IFACE=$RET
# enable forwarding
echo "Set ip_forward=$IP_FORWARD"
evecho /sbin/sysctl -w "net/ipv4/ip_forward"=$IP_FORWARD
echo -n "Set forwarding=$FORWARDING on "
echo "$EMU_IFACE, $LAN_IFACE and $BR_IFACE interfaces"
evecho /sbin/sysctl -w "net/ipv4/conf/$EMU_IFACE/forwarding"=$FORWARDING
evecho /sbin/sysctl -w "net/ipv4/conf/$LAN_IFACE/forwarding"=$FORWARDING
evecho /sbin/sysctl -w "net/ipv4/conf/$BR_IFACE/forwarding"=$FORWARDING
# if the IPv6 address does not exist we cannot change forwarding so apply it on all/default
evecho /sbin/sysctl -w "net/ipv6/conf/all/forwarding"=$FORWARDING
evecho /sbin/sysctl -w "net/ipv6/conf/default/forwarding"=$FORWARDING
evecho /sbin/sysctl -w "net/ipv6/conf/$BR_IFACE/forwarding"=$FORWARDING
}
set_sysctl_phy(){
db_get opensand-daemon/network/emu_iface
EMU_IFACE=$RET
# enable forwarding
echo "Set ip_forward=$IP_FORWARD"
evecho /sbin/sysctl -w "net/ipv4/ip_forward"=$IP_FORWARD
echo -n "Set forwarding=$FORWARDING on "
echo "$EMU_IFACE interfaces"
evecho /sbin/sysctl -w "net/ipv4/conf/$EMU_IFACE/forwarding"=$FORWARDING
# if the IPv6 address does not exist we cannot change forwarding so apply it on all/default
evecho /sbin/sysctl -w "net/ipv6/conf/all/forwarding"=$FORWARDING
evecho /sbin/sysctl -w "net/ipv6/conf/default/forwarding"=$FORWARDING
}
set_sysctl_net_acc(){
# enable forwarding
echo "Set ip_forward=$IP_FORWARD"
evecho /sbin/sysctl -w "net/ipv4/ip_forward"=$IP_FORWARD
echo -n "Set forwarding=$FORWARDING on "
echo "$BR_IFACE and $LAN_IFACE interfaces"
echo "$LAN_IFACE and $BR_IFACE interfaces"
evecho /sbin/sysctl -w "net/ipv4/conf/$LAN_IFACE/forwarding"=$FORWARDING
evecho /sbin/sysctl -w "net/ipv4/conf/$BR_IFACE/forwarding"=$FORWARDING
# if the IPv6 address does not exist we cannot change forwarding so apply it on all/default
......@@ -166,14 +132,6 @@ set_sysctl_net_acc(){
evecho /sbin/sysctl -w "net/ipv6/conf/$BR_IFACE/forwarding"=$FORWARDING
}
set_br_sysctl(){
# enable forwarding
echo "Set forwarding=$FORWARDING on $BR_IFACE inteface"
evecho /sbin/sysctl -w "net/ipv4/conf/$BR_IFACE/forwarding"=$FORWARDING
evecho /sbin/sysctl -w "net/ipv6/conf/$BR_IFACE/forwarding"=$FORWARDING
return
}
# load the configuration file
load_net_config(){
......@@ -322,20 +280,10 @@ config(){
return
fi
if [ ${SYSCTL} = "true" -a ${NAME} != 'SAT' ]; then
if [[ $NAME != SAT && $NAME != GW-PHY* ]]; then
echo "# Configuring sysctl"
echo " See /etc/default/opensand-daemon to avoid this modifications"
if [[ $NAME = GW-PHY* ]]; then
set_sysctl_phy
elif [[ $NAME = GW-NET-ACC* ]]; then
set_sysctl_net_acc
else
set_sysctl
fi
fi
if [[ $NAME != SAT && $NAME != GW-PHY* ]]; then
echo "# Configuring sysctl for bridge"
set_br_sysctl
set_sysctl
fi
set_dhcp_server
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment