10696600cSBjoern A. Zeeb#!/bin/sh 20696600cSBjoern A. Zeeb# 30696600cSBjoern A. Zeeb# Copyright (c) 2009 Xin LI <delphij@FreeBSD.org> 40696600cSBjoern A. Zeeb# 50696600cSBjoern A. Zeeb# Redistribution and use in source and binary forms, with or without 60696600cSBjoern A. Zeeb# modification, are permitted provided that the following conditions 70696600cSBjoern A. Zeeb# are met: 80696600cSBjoern A. Zeeb# 1. Redistributions of source code must retain the above copyright 90696600cSBjoern A. Zeeb# notice, this list of conditions and the following disclaimer. 100696600cSBjoern A. Zeeb# 2. Redistributions in binary form must reproduce the above copyright 110696600cSBjoern A. Zeeb# notice, this list of conditions and the following disclaimer in the 120696600cSBjoern A. Zeeb# documentation and/or other materials provided with the distribution. 130696600cSBjoern A. Zeeb# 140696600cSBjoern A. Zeeb# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 150696600cSBjoern A. Zeeb# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 160696600cSBjoern A. Zeeb# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 170696600cSBjoern A. Zeeb# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 180696600cSBjoern A. Zeeb# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 190696600cSBjoern A. Zeeb# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 200696600cSBjoern A. Zeeb# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 210696600cSBjoern A. Zeeb# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 220696600cSBjoern A. Zeeb# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 230696600cSBjoern A. Zeeb# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 240696600cSBjoern A. Zeeb# SUCH DAMAGE. 250696600cSBjoern A. Zeeb# 260696600cSBjoern A. Zeeb# Configure static ARP table 270696600cSBjoern A. Zeeb# 280696600cSBjoern A. Zeeb# 290696600cSBjoern A. Zeeb 300696600cSBjoern A. Zeeb# PROVIDE: static_arp 310696600cSBjoern A. Zeeb# REQUIRE: netif 320696600cSBjoern A. Zeeb# KEYWORD: nojailvnet 330696600cSBjoern A. Zeeb 340696600cSBjoern A. Zeeb. /etc/rc.subr 350696600cSBjoern A. Zeeb. /etc/network.subr 360696600cSBjoern A. Zeeb 370696600cSBjoern A. Zeebname="static_arp" 380696600cSBjoern A. Zeebdesc="Static ARP Configuration" 390696600cSBjoern A. Zeebstart_cmd="static_arp_start" 400696600cSBjoern A. Zeebstop_cmd="static_arp_stop" 410696600cSBjoern A. Zeeb 420696600cSBjoern A. Zeebstatic_arp_start() 430696600cSBjoern A. Zeeb{ 440696600cSBjoern A. Zeeb local e arp_args 450696600cSBjoern A. Zeeb 460696600cSBjoern A. Zeeb if [ -n "${static_arp_pairs}" ]; then 470696600cSBjoern A. Zeeb echo -n 'Binding static ARP pair(s):' 480696600cSBjoern A. Zeeb for e in ${static_arp_pairs}; do 490696600cSBjoern A. Zeeb echo -n " ${e}" 500696600cSBjoern A. Zeeb eval arp_args=\$static_arp_${e} 510696600cSBjoern A. Zeeb arp -S ${arp_args} >/dev/null 2>&1 520696600cSBjoern A. Zeeb done 530696600cSBjoern A. Zeeb echo '.' 540696600cSBjoern A. Zeeb fi 550696600cSBjoern A. Zeeb} 560696600cSBjoern A. Zeeb 570696600cSBjoern A. Zeebstatic_arp_stop() 580696600cSBjoern A. Zeeb{ 590696600cSBjoern A. Zeeb local e arp_args 600696600cSBjoern A. Zeeb 610696600cSBjoern A. Zeeb if [ -n "${static_arp_pairs}" ]; then 620696600cSBjoern A. Zeeb echo -n 'Unbinding static ARP pair(s):' 630696600cSBjoern A. Zeeb for e in ${static_arp_pairs}; do 640696600cSBjoern A. Zeeb echo -n " ${e}" 650696600cSBjoern A. Zeeb eval arp_args=\$static_arp_${e} 660696600cSBjoern A. Zeeb arp -d ${arp_args%%[ ]*} > /dev/null 2>&1 670696600cSBjoern A. Zeeb done 680696600cSBjoern A. Zeeb echo '.' 690696600cSBjoern A. Zeeb fi 700696600cSBjoern A. Zeeb} 710696600cSBjoern A. Zeeb 720696600cSBjoern A. Zeebload_rc_config $name 73*f99f0ee1SAlexander Leidinger 74*f99f0ee1SAlexander Leidinger# doesn't make sense to run in a svcj: config setting 75*f99f0ee1SAlexander Leidingerstatc_arp_svcj="NO" 76*f99f0ee1SAlexander Leidinger 770696600cSBjoern A. Zeebrun_rc_command "$1" 78