rc.d/static_arp for v6: static_ndp

Frank Bartels freebsd at knarf.de
Fri Jul 9 14:55:25 UTC 2010


Hi,

I've just noticed we have rc.d/static_arp for a while now, but the
v6 counterpart is missing: I'd call it static_ndp.

So I took rc.d/static_arp and patched it. ndp does not know about
-S (deleting old entry first), so I've just changed it to -s. Maybe
someone is able to add -S to ndp, otherwise one should add -d line
before -s.

rc.conf works the same way:

static_ndp_pairs="gateway"
static_ndp_gateway="2001:db8:120:9260::1 00:26:ff:ff:ff:ff"

--- /etc/rc.d/static_arp        2010-07-09 15:25:08.929932175 +0200
+++ /usr/local/etc/rc.d/static_ndp      2010-07-09 16:39:20.396958047 +0200
@@ -24,46 +24,46 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# Configure static ARP table
+# Configure static NDP table
 #
-# $FreeBSD: src/etc/rc.d/static_arp,v 1.4.2.2.2.1 2010/06/14 02:09:06 kensmith Exp $
+# $FreeBSD$
 #
 
-# PROVIDE: static_arp
+# PROVIDE: static_ndp
 # REQUIRE: netif
 # KEYWORD: nojail
 
 . /etc/rc.subr
 
-name="static_arp"
-start_cmd="static_arp_start"
-stop_cmd="static_arp_stop"
+name="static_ndp"
+start_cmd="static_ndp_start"
+stop_cmd="static_ndp_stop"


-static_arp_start()
+static_ndp_start()
 {
-       local e arp_args
+       local e ndp_args
 
-       if [ -n "${static_arp_pairs}" ]; then
-               echo -n 'Binding static ARP pair(s):'
-               for e in ${static_arp_pairs}; do
+       if [ -n "${static_ndp_pairs}" ]; then
+               echo -n 'Binding static NDP pair(s):'
+               for e in ${static_ndp_pairs}; do
                        echo -n " ${e}"
-                       eval arp_args=\$static_arp_${e}
-                       arp -S ${arp_args} >/dev/null 2>&1
+                       eval ndp_args=\$static_ndp_${e}
+                       ndp -s ${ndp_args} >/dev/null 2>&1
                done
                echo '.'
        fi
 }
 
-static_arp_stop()
+static_ndp_stop()
 {
-       local e arp_args
+       local e ndp_args
 
-       if [ -n "${static_arp_pairs}" ]; then
-               echo -n 'Unbinding static ARP pair(s):'
-               for e in ${static_arp_pairs}; do
+       if [ -n "${static_ndp_pairs}" ]; then
+               echo -n 'Unbinding static NDP pair(s):'
+               for e in ${static_ndp_pairs}; do
                        echo -n " ${e}"
-                       eval arp_args=\$static_arp_${e}
-                       arp -d ${arp_args%%[    ]*} > /dev/null 2>&1
+                       eval ndp_args=\$static_ndp_${e}
+                       ndp -d ${ndp_args%%[    ]*} > /dev/null 2>&1
                done
                echo '.'
        fi

It seems this "hack" is needed for the native v6 connectity provided
by Hetzner (German hosting provider).

Cheers,
Knarf


More information about the freebsd-rc mailing list