[28434] in Source-Commits

home help back first fref pref prev next nref lref last post

Re: netparams commit: Initial checkin of netparams

daemon@ATHENA.MIT.EDU (Jonathan Reed)
Wed Sep 17 13:01:09 2014

Date: Wed, 17 Sep 2014 13:01:01 -0400 (EDT)
From: Jonathan Reed <jdreed@mit.edu>
To: source-commits@mit.edu
In-Reply-To: <201409171657.s8HGverP016236@drugstore.mit.edu>
Message-ID: <alpine.DEB.2.10.1409171259250.32310@infinite-loop.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII



On Wed, 17 Sep 2014, Jonathan D Reed wrote:

> https://github.com/mit-athena/netparams/commit/634c80f4712f6365c7b524da3c542c7f354a3dba
> commit 634c80f4712f6365c7b524da3c542c7f354a3dba
> Author: Jonathan Reed <jdreed@mit.edu>
> Date:   Wed Sep 17 12:56:38 2014 -0400
>
>    Initial checkin of netparams
>
>    Move netparams from the installer to an actual package, which can
>    server as the canonical location.  Update netparams to look in
>    more modern locations for the default masks file and the local masks
>    file.  Clean up some stray whitespace in masks file.
>

For better reviewability, the actuall diff is more like this:

--- /home/jdreed/src/athena/misc/scripts/installer/pxe/stage1/debathena/athena/netparams	2013-10-04 12:30:44.656597584 -0400
+++ netparams	2014-09-17 12:09:47.385530708 -0400
@@ -191,7 +191,8 @@
  # Process arguments.
  defaultbits=24
  errornf=false
-maskfile=""
+maskfile="/usr/share/debathena-netparams/masks"
+localmaskfile="/etc/netparams/masks.local"
  while getopts d:ef: opt; do
  	case "$opt" in
  	d)
@@ -202,6 +203,8 @@
  		;;
  	f)
  		maskfile=$OPTARG
+		# If you pass -f, local masks file is not consulted
+		localmaskfile=""
  		;;
  	\?)
  		echo "$usage"
@@ -217,6 +220,12 @@
  	exit 1
  fi

+# Make sure the masks file exists
+if ! [ -e "$maskfile" ]; then
+	echo "$maskfile does not exist" 1>&2
+	exit 1
+fi
+
  # Make sure our addresses are in something like the proper format.
  for ip in "$@"; do
  	if [ `expr "$ip" : "$ipreg"` -eq 0 ]; then
@@ -227,15 +236,11 @@
  done

  for ip in "$@"; do
-	if [ -n "$maskfile" ]; then
+	if [ -n "$localmaskfile" ] && [ -e "$localmaskfile" ]; then
+		getnetmask "$ip" "$localmaskfile"
+	fi
+	if [ -z "$maskbits" ]; then
  		getnetmask "$ip" "$maskfile"
-	elif [ -f /etc/athena/masks.local ]; then
-		getnetmask "$ip" /etc/athena/masks.local
-		if [ -z "$maskbits" ]; then
-			getnetmask "$ip" /etc/athena/masks
-		fi
-	else
-		getnetmask "$ip" /etc/athena/masks
  	fi
  	if [ -z "$maskbits" ]; then
  		# Error out if we were told to, or guess.

home help back first fref pref prev next nref lref last post