#!/bin/sh
#
# when trying to set properties of a net interface with help of "proc/sysconfig/net/intf_type", for example, use command
# "echo br-lan 0xc0000000 > /proc/sysconfig/net/intf_type" to set properties of interface  br-lan. It actually set the
# element intf_type of the net_device object relate to "br-lan". intf_type is a bit map, you can find complete
# definition in following kernel source code.
# 	include/uapi/linux/netdevice.h
#	include/linux/netdevice.h
#

[ "$ACTION" == "ifup"] && exit 0


if [ "$DEVICE" == "pppoe-internet" ]; then
	#wan(1<<17) internet(1<<14) pppoe(intf_type[9:4]=2)
            echo pppoe-internet 0x00024020 > /proc/sysconfig/net/intf_type
fi

if [ "$DEVICE" == "pptp-internet" ]; then
	#wan(1<<17) internet(1<<14) pptp(intf_type[9:4]=3)
            echo pptp-internet 0x00024030 > /proc/sysconfig/net/intf_type
fi

if [ "$DEVICE" == "l2tp-internet" ]; then
	#wan(1<<17) internet(1<<14) l2tp(intf_type[9:4]=4)
            echo l2tp-internet 0x00024040 > /proc/sysconfig/net/intf_type
fi

if [ "$DEVICE" == "pppoev6-wanv6" ]; then
	#wan(1<<17) internet(1<<14) pppoev6(intf_type[9:4]=7)
            echo pppoev6-wanv6 0x00024070 > /proc/sysconfig/net/intf_type
fi


return 0
