#!/bin/sh
#  Copyright (c) 2025 Qualcomm Technologies, Inc.
#  All Rights Reserved.
#  Confidential and Proprietary - Qualcomm Technologies, Inc.

PPP_IPPARAM="$6"

#both pppoe ipv4 and ipv6 down, will all call here
[ -n "$PPP_IPPARAM" ] && {
	echo "deconfig_backhaul for/tmp/ipv4config.$PPP_IPPARAM"
	if [ -f /tmp/ipv4config.$PPP_IPPARAM ]; then
		/etc/data/lanUtils.sh util_delete_nonwwan_route_rule_v4 $PPP_IPPARAM
		/etc/data/backhaulCommonConfig.sh switch_bh $PPP_IPPARAM 0

		#pppoe ipv6 depend on ipv4
		#after code come here, file /tmp/ipv6config.$PPP_IPPARAM already deleted
		#so call switch_bh_v6 directly
		echo "deconfig_backhaul for/tmp/ipv6config.$PPP_IPPARAM"
		/etc/data/lanUtils.sh util_delete_nonwwan_route_rule_v6 $PPP_IPPARAM
		/etc/data/backhaulCommonConfig.sh switch_bh_v6 $PPP_IPPARAM 0
	fi
}