#!/bin/sh
ENABLE_LAN2=$(uci get routing.lan2.enable 2>/dev/null || echo 0)
[ "$INTERFACE" = "lan" ] && {
	[ "$ENABLE_LAN2" = "1" -a "$ACTION" = "ifup" ] && ACT="add" || ACT="del"
	LAN2_IP=$(uci get routing.lan2.lan2_ip 2>/dev/null || echo "192.168.2.1")
	LAN2_MASK=$(uci get routing.lan2.lan2_mask 2>/dev/null || echo "255.255.255.0")
	LAN_IP=$(uci -q get network.lan.ipaddr)
    [ "$LAN_IP" = "$LAN2_IP" ] || ip addr "$ACT" "$LAN2_IP"/"$LAN2_MASK" dev br-lan
}
