1226654Smm#!/bin/sh 2226654Smm# 3226657Smm# Copyright (c) 2011 Xin Li <delphij@FreeBSD.org> 4226654Smm# All rights reserved. 5226654Smm# 6226654Smm# Redistribution and use in source and binary forms, with or without 7226654Smm# modification, are permitted provided that the following conditions 8226654Smm# are met: 9226654Smm# 1. Redistributions of source code must retain the above copyright 10226654Smm# notice, this list of conditions and the following disclaimer. 11226654Smm# 2. Redistributions in binary form must reproduce the above copyright 12226654Smm# notice, this list of conditions and the following disclaimer in the 13226654Smm# documentation and/or other materials provided with the distribution. 14226654Smm# 15226654Smm# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16226654Smm# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17226654Smm# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18226654Smm# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19226654Smm# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20226654Smm# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21226654Smm# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22226654Smm# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23226654Smm# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24226654Smm# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25226654Smm# SUCH DAMAGE. 26226654Smm# 27226654Smm# Configure static NDP table 28226654Smm# 29226654Smm# $FreeBSD: releng/10.3/etc/rc.d/static_ndp 226657 2011-10-23 10:17:42Z mm $ 30226654Smm# 31226654Smm 32226654Smm# PROVIDE: static_ndp 33226654Smm# REQUIRE: netif 34226654Smm# KEYWORD: nojail 35226654Smm 36226654Smm. /etc/rc.subr 37226654Smm. /etc/network.subr 38226654Smm 39226654Smmname="static_ndp" 40226654Smmstart_cmd="static_ndp_start" 41226654Smmstop_cmd="static_ndp_stop" 42226654Smm 43226654Smmstatic_ndp_start() 44226654Smm{ 45226654Smm local e ndp_args 46226654Smm 47226654Smm if [ -n "${static_ndp_pairs}" ]; then 48226654Smm echo -n 'Binding static NDP pair(s):' 49226654Smm for e in ${static_ndp_pairs}; do 50226654Smm echo -n " ${e}" 51226654Smm eval ndp_args=\$static_ndp_${e} 52226654Smm ndp -s ${ndp_args} >/dev/null 2>&1 53226654Smm done 54226654Smm echo '.' 55226654Smm fi 56226654Smm} 57226654Smm 58226654Smmstatic_ndp_stop() 59226654Smm{ 60226654Smm local e ndp_args 61226654Smm 62226654Smm if [ -n "${static_ndp_pairs}" ]; then 63226654Smm echo -n 'Unbinding static NDP pair(s):' 64226654Smm for e in ${static_ndp_pairs}; do 65226654Smm echo -n " ${e}" 66226654Smm eval ndp_args=\$static_ndp_${e} 67226654Smm ndp -d ${ndp_args%%[ ]*} > /dev/null 2>&1 68226654Smm done 69226654Smm echo '.' 70226654Smm fi 71226654Smm} 72226654Smm 73226654Smmload_rc_config $name 74226654Smmrun_rc_command "$1" 75