mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
netmode: clean all vlans before creating new ones
do not restart services reboot -f
This commit is contained in:
parent
9c00a0928b
commit
bd263e5ca5
6 changed files with 51 additions and 77 deletions
|
|
@ -157,13 +157,13 @@ start_service() {
|
|||
done
|
||||
fi
|
||||
|
||||
# Execute netmode generic post-mode-switch scripts
|
||||
libnetmode_exec "post"
|
||||
cleanup_env_vars "${mode}"
|
||||
|
||||
# Save mode as last mode
|
||||
echo "$mode" > $MODEDIR/.last_mode
|
||||
_log "Switching to Mode [${mode}] done, last mode updated"
|
||||
|
||||
# Execute netmode generic post-mode-switch scripts
|
||||
libnetmode_exec "post"
|
||||
cleanup_env_vars "${mode}"
|
||||
}
|
||||
|
||||
service_triggers()
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ l2_network_config() {
|
|||
uci -q set network.lan6.device='@lan'
|
||||
uci -q set network.lan6.reqprefix='no'
|
||||
|
||||
uci -q set network.wan.disabled='1'
|
||||
uci -q set network.wan6.disabled='1'
|
||||
uci -q delete network.wan
|
||||
uci -q delete network.wan6
|
||||
|
||||
uci -q delete network.br_lan.ports
|
||||
uci -q set network.br_lan.bridge_empty='1'
|
||||
|
|
@ -116,12 +116,3 @@ l2_network_config() {
|
|||
|
||||
l2_network_config
|
||||
l2_mcast_config
|
||||
|
||||
# If device is already boot-up, assume netmode changed during runtime
|
||||
if [ -f /var/run/boot_complete ]; then
|
||||
/etc/init.d/odhcpd stop 2>/dev/null
|
||||
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
|
||||
ubus call uci commit "{\"config\":\"$config\"}"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -43,24 +43,28 @@ l3_network_config() {
|
|||
uci -q delete network.wan.netmask
|
||||
|
||||
uci -q set network.wan6=interface
|
||||
uci -q set network.wan6.proto='dhcpv6'
|
||||
uci -q set network.wan6.proto="dhcpv6"
|
||||
uci -q delete network.wan6.disabled
|
||||
|
||||
if [ -n "$wandev" ] && echo "$NETMODE_vlanid" | grep -Eq '^[0-9]+$' && [ "$NETMODE_vlanid" -ge 1 ]; then
|
||||
uci -q set network.vlan_${NETMODE_vlanid}=device
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.type="8021q"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.name="$wandev.$NETMODE_vlanid"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.ifname="$wandev"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.vid=$NETMODE_vlanid
|
||||
# Delete all VLAN sections; new ones will be created in next function if required
|
||||
for vlandev_sec in $(uci show network | grep "type=.*8021q" | cut -d'.' -f1,2); do
|
||||
uci -q delete $vlandev_sec
|
||||
done
|
||||
|
||||
wandev="$wandev.$NETMODE_vlanid"
|
||||
if [ -n "$wandev" ] && echo "$NETMODE_vlanid" | grep -Eq '^[0-9]+$' && [ "$NETMODE_vlanid" -ge 1 ]; then
|
||||
vlandev="$wandev.$NETMODE_vlanid"
|
||||
vlandev_sec=$(echo $vlandev | tr '.' '_')
|
||||
uci -q set network.${vlandev_sec}=device
|
||||
uci -q set network.${vlandev_sec}.type="8021q"
|
||||
uci -q set network.${vlandev_sec}.name="$vlandev"
|
||||
uci -q set network.${vlandev_sec}.ifname="$wandev"
|
||||
uci -q set network.${vlandev_sec}.vid=$NETMODE_vlanid
|
||||
|
||||
wandev="$vlandev"
|
||||
fi
|
||||
|
||||
uci -q set network.wan.device="$wandev"
|
||||
|
||||
uci -q set network.wan6=interface
|
||||
uci -q set network.wan6.device="$wandev"
|
||||
uci -q set network.wan6.proto="dhcpv6"
|
||||
|
||||
uci -q set network.WAN.mtu="$NETMODE_mtu"
|
||||
|
||||
|
|
@ -122,12 +126,3 @@ l3_network_config() {
|
|||
|
||||
l3_network_config
|
||||
l3_mcast_config
|
||||
|
||||
# If device is already boot-up, assume netmode changed during runtime
|
||||
if [ -f /var/run/boot_complete ]; then
|
||||
/etc/init.d/odhcpd restart 2>/dev/null
|
||||
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
|
||||
ubus call uci commit "{\"config\":\"$config\"}"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -42,22 +42,27 @@ l3_network_pppoe_config() {
|
|||
uci -q delete network.wan.gateway
|
||||
uci -q delete network.wan.netmask
|
||||
|
||||
uci -q set network.wan6.disabled='1'
|
||||
uci -q delete network.wan6
|
||||
|
||||
# Delete all VLAN sections; new ones will be created in next function if required
|
||||
for vlandev_sec in $(uci show network | grep "type=.*8021q" | cut -d'.' -f1,2); do
|
||||
uci -q delete $vlandev_sec
|
||||
done
|
||||
|
||||
if [ -n "$wandev" ] && echo "$NETMODE_vlanid" | grep -Eq '^[0-9]+$' && [ "$NETMODE_vlanid" -ge 1 ]; then
|
||||
uci -q set network.vlan_${NETMODE_vlanid}=device
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.type="8021q"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.name="$wandev.$NETMODE_vlanid"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.ifname="$wandev"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.vid=$NETMODE_vlanid
|
||||
vlandev="$wandev.$NETMODE_vlanid"
|
||||
vlandev_sec=$(echo $vlandev | tr '.' '_')
|
||||
uci -q set network.${vlandev_sec}=device
|
||||
uci -q set network.${vlandev_sec}.type="8021q"
|
||||
uci -q set network.${vlandev_sec}.name="$vlandev"
|
||||
uci -q set network.${vlandev_sec}.ifname="$wandev"
|
||||
uci -q set network.${vlandev_sec}.vid=$NETMODE_vlanid
|
||||
|
||||
wandev="$wandev.$NETMODE_vlanid"
|
||||
wandev="$vlandev"
|
||||
fi
|
||||
|
||||
uci -q set network.wan.device="$wandev"
|
||||
|
||||
uci -q delete network.wan6
|
||||
|
||||
uci -q set network.WAN.mtu="$NETMODE_mtu"
|
||||
|
||||
uci -q delete network.wan.dns
|
||||
|
|
@ -118,12 +123,3 @@ l3_network_pppoe_config() {
|
|||
|
||||
l3_network_pppoe_config
|
||||
l3_mcast_config
|
||||
|
||||
# If device is already boot-up, assume netmode changed during runtime
|
||||
if [ -f /var/run/boot_complete ]; then
|
||||
/etc/init.d/odhcpd restart 2>/dev/null
|
||||
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
|
||||
ubus call uci commit "{\"config\":\"$config\"}"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -43,22 +43,27 @@ l3_network_config() {
|
|||
uci -q delete network.wan.username
|
||||
uci -q delete network.wan.password
|
||||
|
||||
uci -q set network.wan6.disabled='1'
|
||||
uci -q delete network.wan6
|
||||
|
||||
# Delete all VLAN sections; new ones will be created in next function if required
|
||||
for vlandev_sec in $(uci show network | grep "type=.*8021q" | cut -d'.' -f1,2); do
|
||||
uci -q delete $vlandev_sec
|
||||
done
|
||||
|
||||
if [ -n "$wandev" ] && echo "$NETMODE_vlanid" | grep -Eq '^[0-9]+$' && [ "$NETMODE_vlanid" -ge 1 ]; then
|
||||
uci -q set network.vlan_${NETMODE_vlanid}=device
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.type="8021q"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.name="$wandev.$NETMODE_vlanid"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.ifname="$wandev"
|
||||
uci -q set network.vlan_${NETMODE_vlanid}.vid=$NETMODE_vlanid
|
||||
vlandev="$wandev.$NETMODE_vlanid"
|
||||
vlandev_sec=$(echo $vlandev | tr '.' '_')
|
||||
uci -q set network.${vlandev_sec}=device
|
||||
uci -q set network.${vlandev_sec}.type="8021q"
|
||||
uci -q set network.${vlandev_sec}.name="$vlandev"
|
||||
uci -q set network.${vlandev_sec}.ifname="$wandev"
|
||||
uci -q set network.${vlandev_sec}.vid=$NETMODE_vlanid
|
||||
|
||||
wandev="$wandev.$NETMODE_vlanid"
|
||||
wandev="$vlandev"
|
||||
fi
|
||||
|
||||
uci -q set network.wan.device="$wandev"
|
||||
|
||||
uci -q delete network.wan6
|
||||
|
||||
uci -q set network.WAN.mtu="$NETMODE_mtu"
|
||||
|
||||
uci -q delete network.wan.dns
|
||||
|
|
@ -119,12 +124,3 @@ l3_network_config() {
|
|||
|
||||
l3_network_config
|
||||
l3_mcast_config
|
||||
|
||||
# If device is already boot-up, assume netmode changed during runtime
|
||||
if [ -f /var/run/boot_complete ]; then
|
||||
/etc/init.d/odhcpd restart 2>/dev/null
|
||||
for config in network dhcp ssdpd cwmp gateway firewall mcast; do
|
||||
ubus call uci commit "{\"config\":\"$config\"}"
|
||||
sleep 1
|
||||
done
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This script is to restart related datamodel microservices
|
||||
# when wan mode changes
|
||||
|
||||
|
||||
if [ ! -f /var/run/boot_complete ]; then
|
||||
return 0
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -f /etc/bbfdm/dmmap/dmmap_ppp ]; then
|
||||
|
|
@ -16,4 +12,4 @@ if [ -f /etc/bbfdm/dmmap/dmmap_network ]; then
|
|||
rm -f /etc/bbfdm/dmmap/dmmap_network*
|
||||
fi
|
||||
|
||||
reboot &
|
||||
reboot -f
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue