Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Dec 2009 18:35:58 +0000 (UTC)
From:      Xin LI <delphij@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r200267 - in stable/7: etc/defaults etc/rc.d share/man/man5
Message-ID:  <200912081835.nB8IZwRE096125@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: delphij
Date: Tue Dec  8 18:35:57 2009
New Revision: 200267
URL: http://svn.freebsd.org/changeset/base/200267

Log:
  MFC revisions 196550 and 196552:
  
  Add a new rc.d script, static_arp, which enables the administrator to
  statically bind IPv4 <-> MAC address at boot time.
  
  In order to use this, the administrator needs to configure the following
  rc.conf(5) variable:
  
   - static_arp_pairs: A list of names for static bind pairs, and,
   - a series of static_arp_(name): the arguments that is being passed to
     ``arp -S'' operation.
  
  Example:
    static_arp_pairs="gw"
    static_arp_gw="192.168.1.1 00:01:02:03:04:05"
  
  See the rc.conf(5) manual page for more details.

Added:
  stable/7/etc/rc.d/static_arp
     - copied, changed from r196550, head/etc/rc.d/static_arp
Modified:
  stable/7/etc/defaults/rc.conf
  stable/7/etc/rc.d/Makefile
  stable/7/share/man/man5/rc.conf.5   (contents, props changed)
Directory Properties:
  stable/7/etc/   (props changed)
  stable/7/share/man/man5/   (props changed)

Modified: stable/7/etc/defaults/rc.conf
==============================================================================
--- stable/7/etc/defaults/rc.conf	Tue Dec  8 18:23:52 2009	(r200266)
+++ stable/7/etc/defaults/rc.conf	Tue Dec  8 18:35:57 2009	(r200267)
@@ -344,6 +344,7 @@ bsnmpd_flags=""			# Flags for bsnmpd.
 
 ### Network routing options: ###
 defaultrouter="NO"		# Set to default gateway (or NO).
+static_arp_pairs=""		# Set to static ARP list (or leave empty).
 static_routes=""		# Set to static route list (or leave empty).
 natm_static_routes=""		# Set to static route list for NATM (or leave empty).
 gateway_enable="NO"		# Set to YES if this host will be a gateway.

Modified: stable/7/etc/rc.d/Makefile
==============================================================================
--- stable/7/etc/rc.d/Makefile	Tue Dec  8 18:23:52 2009	(r200266)
+++ stable/7/etc/rc.d/Makefile	Tue Dec  8 18:35:57 2009	(r200267)
@@ -32,7 +32,7 @@ FILES=	DAEMON FILESYSTEMS LOGIN NETWORKI
 	random rarpd resolv rfcomm_pppd_server root \
 	route6d routed routing rpcbind rtadvd rwho \
 	savecore sdpd securelevel sendmail \
-	serial sppp statd swap1 \
+	serial sppp statd static_arp swap1 \
 	syscons sysctl syslogd \
 	timed tmp \
 	ugidfw \

Copied and modified: stable/7/etc/rc.d/static_arp (from r196550, head/etc/rc.d/static_arp)
==============================================================================
--- head/etc/rc.d/static_arp	Tue Aug 25 19:07:26 2009	(r196550, copy source)
+++ stable/7/etc/rc.d/static_arp	Tue Dec  8 18:35:57 2009	(r200267)
@@ -41,10 +41,11 @@ stop_cmd="static_arp_stop"
 
 static_arp_start()
 {
+	local e arp_args
+
 	if [ -n "${static_arp_pairs}" ]; then
 		echo -n 'Binding static ARP pair(s):'
 		for e in ${static_arp_pairs}; do
-			local arp_args
 			echo -n " ${e}"
 			eval arp_args=\$static_arp_${e}
 			arp -S ${arp_args} >/dev/null 2>&1
@@ -55,10 +56,11 @@ static_arp_start()
 
 static_arp_stop()
 {
+	local e arp_args
+
 	if [ -n "${static_arp_pairs}" ]; then
 		echo -n 'Unbinding static ARP pair(s):'
 		for e in ${static_arp_pairs}; do
-			local arp_args
 			echo -n " ${e}"
 			eval arp_args=\$static_arp_${e}
 			arp -d ${arp_args%%[ 	]*} > /dev/null 2>&1

Modified: stable/7/share/man/man5/rc.conf.5
==============================================================================
--- stable/7/share/man/man5/rc.conf.5	Tue Dec  8 18:23:52 2009	(r200266)
+++ stable/7/share/man/man5/rc.conf.5	Tue Dec  8 18:35:57 2009	(r200267)
@@ -2193,6 +2193,22 @@ name server!).
 .Pq Vt str
 The IPv6 equivalent of
 .Va defaultrouter .
+.It Va static_arp_pairs
+.Pq Vt str
+Set to the list of static ARP pairs that are to be added at system
+boot time.
+For each whitespace separated
+.Ar element
+in the value, a
+.Va static_arp_ Ns Aq Ar element
+variable is assumed to exist whose contents will later be passed to a
+.Dq Nm arp Cm -S
+operation.
+For example
+.Bd -literal
+static_arp_pairs="gw"
+static_arp_gw="192.168.1.1 00:01:02:03:04:05"
+.Ed
 .It Va static_routes
 .Pq Vt str
 Set to the list of static routes that are to be added at system



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200912081835.nB8IZwRE096125>