#!/bin/sh

me="[$(basename "${0}")]"

case $1 in
	start)
		echo "${me} set up interfaces"

		# Do not cross answer arp requests and use best local address in
		# arp requests sent on interface.
		# This should be done _before_ we bring up the interfaces.
		sysctl -w net.ipv4.conf.lan2-private.arp_ignore=1
		sysctl -w net.ipv4.conf.lan2-private.arp_announce=2
		sysctl -w net.ipv4.conf.lan1-public.arp_ignore=1
		sysctl -w net.ipv4.conf.lan1-public.arp_announce=2

		ip link set cpu-port up
		ip link set lan2-private up
		ip link set lan1-public up
		;;
	stop)
		echo "${me} shut down interfaces"
		ip link set lan1-public down
		ip link set lan2-private down
		ip link set cpu-port down
		;;
	*)
		echo "Usage: $0 {start|stop}"
		;;
esac

exit 0
